Compare commits

...

4 Commits

Author SHA1 Message Date
an 11b4e635e5 whoops 2019-08-14 05:28:36 -04:00
an 94e70bd557 organize into folders (why didn't i think of this sooner?) 2019-08-14 05:27:32 -04:00
an b7f8614ab4 add Array::Append 2019-08-14 04:31:58 -04:00
an 03f151dca4 change flags style 2019-08-14 04:31:50 -04:00
80 changed files with 262 additions and 249 deletions

128
api.md
View File

@ -26,7 +26,7 @@ modder rather than for the engine.
<!-- inter-toc actor --> <!-- inter-toc actor -->
* [State](api-actor-State.md) * [State](api/actor/State.md)
<!-- end --> <!-- end -->
@ -36,15 +36,15 @@ TODO
<!-- inter-toc base --> <!-- inter-toc base -->
* [Array](api-base-Array.md) * [Array](api/base/Array.md)
* [Color](api-base-Color.md) * [CVar](api/base/CVar.md)
* [CVar](api-base-CVar.md) * [Color](api/base/Color.md)
* [FixedArray](api-base-FixedArray.md) * [FixedArray](api/base/FixedArray.md)
* [Object](api-base-Object.md) * [Object](api/base/Object.md)
* [String](api-base-String.md) * [StringTable](api/base/StringTable.md)
* [StringTable](api-base-StringTable.md) * [String](api/base/String.md)
* [Thinker](api-base-Thinker.md) * [Thinker](api/base/Thinker.md)
* [Vector](api-base-Vector.md) * [Vector](api/base/Vector.md)
<!-- end --> <!-- end -->
@ -54,14 +54,14 @@ TODO
<!-- inter-toc drawing --> <!-- inter-toc drawing -->
* [BrokenLines](api-drawing-BrokenLines.md) * [BrokenLines](api/drawing/BrokenLines.md)
* [Console](api-drawing-Console.md) * [Console](api/drawing/Console.md)
* [Font](api-drawing-Font.md) * [Font](api/drawing/Font.md)
* [GIFont](api-drawing-GIFont.md) * [GIFont](api/drawing/GIFont.md)
* [Screen](api-drawing-Screen.md) * [Screen](api/drawing/Screen.md)
* [Shape2D](api-drawing-Shape2D.md) * [Shape2D](api/drawing/Shape2D.md)
* [TexMan](api-drawing-TexMan.md) * [TexMan](api/drawing/TexMan.md)
* [TextureID](api-drawing-TextureID.md) * [TextureID](api/drawing/TextureID.md)
<!-- end --> <!-- end -->
@ -71,11 +71,11 @@ TODO
<!-- inter-toc events --> <!-- inter-toc events -->
* [ConsoleEvent](api-events-ConsoleEvent.md) * [ConsoleEvent](api/events/ConsoleEvent.md)
* [EventHandler](api-events-EventHandler.md) * [EventHandler](api/events/EventHandler.md)
* [RenderEvent](api-events-RenderEvent.md) * [RenderEvent](api/events/RenderEvent.md)
* [ReplaceEvent](api-events-ReplaceEvent.md) * [ReplaceEvent](api/events/ReplaceEvent.md)
* [StaticEventHandler](api-events-StaticEventHandler.md) * [StaticEventHandler](api/events/StaticEventHandler.md)
<!-- end --> <!-- end -->
@ -85,7 +85,7 @@ TODO
<!-- inter-toc files --> <!-- inter-toc files -->
* [Wads](api-files-Wads.md) * [Wads](api/files/Wads.md)
<!-- end --> <!-- end -->
@ -95,11 +95,11 @@ TODO
<!-- inter-toc inter --> <!-- inter-toc inter -->
* [InterBackground](api-inter-InterBackground.md) * [InterBackground](api/inter/InterBackground.md)
* [PatchInfo](api-inter-PatchInfo.md) * [PatchInfo](api/inter/PatchInfo.md)
* [StatusScreen](api-inter-StatusScreen.md) * [StatusScreen](api/inter/StatusScreen.md)
* [WBPlayerStruct](api-inter-WBPlayerStruct.md) * [WBPlayerStruct](api/inter/WBPlayerStruct.md)
* [WBStartStruct](api-inter-WBStartStruct.md) * [WBStartStruct](api/inter/WBStartStruct.md)
<!-- end --> <!-- end -->
@ -115,17 +115,17 @@ for [statistics drivers][1].
<!-- inter-toc level --> <!-- inter-toc level -->
* [F3DFloor](api-level-F3DFloor.md) * [F3DFloor](api/level/F3DFloor.md)
* [FColorMap](api-level-FColorMap.md) * [FColorMap](api/level/FColorMap.md)
* [Line](api-level-Line.md) * [LineIdIterator](api/level/LineIdIterator.md)
* [LineIdIterator](api-level-LineIdIterator.md) * [Line](api/level/Line.md)
* [SecPlane](api-level-SecPlane.md) * [SecPlane](api/level/SecPlane.md)
* [SecSpecial](api-level-SecSpecial.md) * [SecSpecial](api/level/SecSpecial.md)
* [Sector](api-level-Sector.md) * [SectorEffect](api/level/SectorEffect.md)
* [SectorEffect](api-level-SectorEffect.md) * [SectorTagIterator](api/level/SectorTagIterator.md)
* [SectorTagIterator](api-level-SectorTagIterator.md) * [Sector](api/level/Sector.md)
* [Side](api-level-Side.md) * [Side](api/level/Side.md)
* [Vertex](api-level-Vertex.md) * [Vertex](api/level/Vertex.md)
<!-- end --> <!-- end -->
@ -135,9 +135,9 @@ TODO
<!-- inter-toc player --> <!-- inter-toc player -->
* [PlayerClass](api-player-PlayerClass.md) * [PlayerClass](api/player/PlayerClass.md)
* [PlayerSkin](api-player-PlayerSkin.md) * [PlayerSkin](api/player/PlayerSkin.md)
* [Team](api-player-Team.md) * [Team](api/player/Team.md)
<!-- end --> <!-- end -->
@ -147,7 +147,7 @@ TODO
<!-- inter-toc sound --> <!-- inter-toc sound -->
* [SeqNode](api-sound-SeqNode.md) * [SeqNode](api/sound/SeqNode.md)
<!-- end --> <!-- end -->
@ -155,9 +155,9 @@ TODO
# Weapons # Weapons
<!-- inter-toc wep --> <!-- inter-toc weapon -->
* [PSprite](api-wep-PSprite.md) * [PSprite](api/weapon/PSprite.md)
<!-- end --> <!-- end -->
@ -165,39 +165,39 @@ TODO
# Global Objects # Global Objects
<!-- inter-toc global-data --> <!-- inter-toc global/data -->
* [Client](api-global-data-Client.md) * [Client](api/global/data/Client.md)
* [Constants](api-global-data-Constants.md) * [Constants](api/global/data/Constants.md)
* [Game](api-global-data-Game.md) * [Game](api/global/data/Game.md)
* [Information](api-global-data-Information.md) * [Information](api/global/data/Information.md)
* [Player](api-global-data-Player.md) * [Player](api/global/data/Player.md)
<!-- end --> <!-- end -->
These variables are accessible in any context and are not bound by any specific These variables are accessible in any context and are not bound by any specific
object. Generally these mirror global information within the engine itself. object. Generally these mirror global information within the engine itself.
<!-- inter-toc global-func --> <!-- inter-toc global/func -->
* [Classes](api-global-func-Classes.md) * [Classes](api/global/func/Classes.md)
* [Game](api-global-func-Game.md) * [Game](api/global/func/Game.md)
* [Math](api-global-func-Math.md) * [Math](api/global/func/Math.md)
* [Random](api-global-func-Random.md) * [Random](api/global/func/Random.md)
* [Sound](api-global-func-Sound.md) * [Sound](api/global/func/Sound.md)
* [System](api-global-func-System.md) * [System](api/global/func/System.md)
<!-- end --> <!-- end -->
These functions are accessible in any context and are not bound by any specific These functions are accessible in any context and are not bound by any specific
object. Generally these are utility functions. object. Generally these are utility functions.
<!-- inter-toc global-type --> <!-- inter-toc global/type -->
* [DehInfo](api-global-type-DehInfo.md) * [DehInfo](api/global/type/DehInfo.md)
* [FOptionMenuSettings](api-global-type-FOptionMenuSettings.md) * [FOptionMenuSettings](api/global/type/FOptionMenuSettings.md)
* [GameInfoStruct](api-global-type-GameInfoStruct.md) * [GameInfoStruct](api/global/type/GameInfoStruct.md)
* [LevelLocals](api-global-type-LevelLocals.md) * [LevelLocals](api/global/type/LevelLocals.md)
<!-- end --> <!-- end -->

View File

@ -17,13 +17,13 @@ struct State
readonly uint16 TicRange; readonly uint16 TicRange;
readonly uint8 UseFlags; readonly uint8 UseFlags;
readonly bool bCANRAISE; readonly bool bCanRaise;
readonly bool bDEHACKED; readonly bool bDeHackEd;
readonly bool bFAST; readonly bool bFast;
readonly bool bFULLBRIGHT; readonly bool bFullBright;
readonly bool bNODELAY; readonly bool bNoDelay;
readonly bool bSAMEFRAME; readonly bool bSameFrame;
readonly bool bSLOW; readonly bool bSlow;
int DistanceTo(State other); int DistanceTo(State other);
bool InStateSequence(State base); bool InStateSequence(State base);
@ -65,38 +65,38 @@ struct State
The scope of this state. See *Action Scoping*. Can have any of the The scope of this state. See *Action Scoping*. Can have any of the
`DefaultStateUsage` flags. `DefaultStateUsage` flags.
- `bCANRAISE` - `bCanRaise`
State has the `CANRAISE` flag, allowing `A_VileChase` to target this actor State has the `CanRaise` flag, allowing `A_VileChase` to target this actor
for healing without entering an infinitely long state. for healing without entering an infinitely long state.
- `bDEHACKED` - `bDeHackEd`
`true` if the state has been modified by DeHackEd. `true` if the state has been modified by DeHackEd.
- `bFAST` - `bFast`
State has the `FAST` flag, halving the duration when fast monsters is State has the `Fast` flag, halving the duration when fast monsters is
enabled. enabled.
- `bFULLBRIGHT` - `bFullBright`
State has the `BRIGHT` flag, making it fully bright regardless of other State has the `Bright` flag, making it fully bright regardless of other
lighting conditions. lighting conditions.
- `bNODELAY` - `bNoDelay`
State has the `NODELAY` flag, forcing the associated action function to be State has the `NoDelay` flag, forcing the associated action function to be
run if the actor is in its first tic. run if the actor is in its first tic.
- `bSAMEFRAME` - `bSameFrame`
`true` if the state's frame is to be kept from the last frame used, i.e., is `true` if the state's frame is to be kept from the last frame used, i.e., is
`#`. `#`.
- `bSLOW` - `bSlow`
State has the `SLOW` flag, doubling the duration when slow monsters is State has the `Slow` flag, doubling the duration when slow monsters is
enabled. enabled.
- `DistanceTo` - `DistanceTo`

View File

@ -12,6 +12,7 @@ struct Array<Type>
uint Max() const; uint Max() const;
uint Size() const; uint Size() const;
void Append(array<Type> other);
void Copy(array<Type> other); void Copy(array<Type> other);
void Move(array<Type> other); void Move(array<Type> other);
@ -51,6 +52,11 @@ struct Array<Type>
Removes the last item in the array, possibly destroying it. Returns `false` Removes the last item in the array, possibly destroying it. Returns `false`
if there are no items in the array to begin with. if there are no items in the array to begin with.
- `Append`
Value-copies another array's contents and places them into this array at the
end.
- `Copy` - `Copy`
Value-copies another array's contents into this array. The contents of Value-copies another array's contents into this array. The contents of

View File

@ -5,7 +5,7 @@ The base class of all `class` types.
``` ```
class Object class Object
{ {
bool bDESTROYED; bool bDestroyed;
class GetClass(); class GetClass();
string GetClassName(); string GetClassName();
@ -17,7 +17,7 @@ class Object
} }
``` ```
- `bDESTROYED` - `bDestroyed`
This object wants to be destroyed but has not yet been garbage collected. This object wants to be destroyed but has not yet been garbage collected.

View File

@ -36,11 +36,11 @@ class PSprite : Object play
double X; double X;
double Y; double Y;
bool bADDBOB; bool bAddBob;
bool bADDWEAPON; bool bAddWeapon;
bool bCVARFAST; bool bCVarFast;
bool bFLIP; bool bFlip;
bool bPOWDOUBLE; bool bPowDouble;
void SetState(State newstate, bool pending = false); void SetState(State newstate, bool pending = false);
void Tick(); void Tick();
@ -108,23 +108,23 @@ class PSprite : Object play
The offset from the weapon's normal resting position on the vertical axis. The offset from the weapon's normal resting position on the vertical axis.
Note that `32` is the real resting position because of `A_Raise`. Note that `32` is the real resting position because of `A_Raise`.
- `bADDBOB` - `bAddBob`
Adds the weapon's bobbing to this layer's offset. Adds the weapon's bobbing to this layer's offset.
- `bADDWEAPON` - `bAddWeapon`
Adds the weapon layer's offsets to this layer's offset. Adds the weapon layer's offsets to this layer's offset.
- `bCVARFAST` - `bCVarFast`
Layer will respect `sv_fastweapons`. Layer will respect `sv_fastweapons`.
- `bFLIP` - `bFlip`
Flips the weapon visually horizontally. Flips the weapon visually horizontally.
- `bPOWDOUBLE` - `bPowDouble`
Layer will respect `PowerDoubleFiringSpeed`. Layer will respect `PowerDoubleFiringSpeed`.

View File

@ -2,11 +2,11 @@
<!-- inter-toc --> <!-- inter-toc -->
* [Classes](glossary-Classes.md) * [Classes](glossary/Classes.md)
* [Concepts](glossary-Concepts.md) * [Concepts](glossary/Concepts.md)
* [Structures](glossary-Structures.md) * [Structures](glossary/Structures.md)
* [Style](glossary-Style.md) * [Style](glossary/Style.md)
* [Versions](glossary-Versions.md) * [Versions](glossary/Versions.md)
<!-- end --> <!-- end -->

View File

@ -127,15 +127,15 @@ Finally, here is a table of contents for each language element:
<!-- inter-toc --> <!-- inter-toc -->
* [Classes](lang-Classes.md) * [Classes](language/Classes.md)
* [Constants](lang-Constants.md) * [Constants](language/Constants.md)
* [Enumerations](lang-Enumerations.md) * [Enumerations](language/Enumerations.md)
* [Expressions](lang-Expressions.md) * [Expressions](language/Expressions.md)
* [Members](lang-Members.md) * [Members](language/Members.md)
* [Methods](lang-Methods.md) * [Methods](language/Methods.md)
* [Statements](lang-Statements.md) * [Statements](language/Statements.md)
* [Structures](lang-Structures.md) * [Structures](language/Structures.md)
* [Types](lang-Types.md) * [Types](language/Types.md)
<!-- end --> <!-- end -->

View File

@ -211,7 +211,7 @@ Flag definitions are used within classes to define defaultable boolean flags on
actors. They are not valid on classes not derived from Actor. actors. They are not valid on classes not derived from Actor.
When registered, a flag will be available in the `default` block as When registered, a flag will be available in the `default` block as
`CLASSNAME.FLAGNAME`, as well as a member as `bFLAGNAME`. `ClassName.FlagName`, as well as a member as `bFlagName`.
Each flag operates on a singular bit of any integer member of the class. The Each flag operates on a singular bit of any integer member of the class. The
integer must be exactly 32 bits, though if it is signed or not does not matter. integer must be exactly 32 bits, though if it is signed or not does not matter.
@ -246,23 +246,23 @@ class MyCoolActorWithFlags : Actor
// Hey, those sentences sounded familiar... // Hey, those sentences sounded familiar...
default default
{ {
+MYCOOLACTORWITHFLAGS.THIS_ONE_IS_ON +MyCoolActorWithFlags.ThisOneIsOn
-MYCOOLACTORWITHFLAGS.THIS_ONE_IS_OFF -MyCoolActorWithFlags.ThisOneIsOff
} }
// Declare a flag field for all of the flags. This can hold up to 32 flags. // Declare a flag field for all of the flags. This can hold up to 32 flags.
int m_Flags; int m_Flags;
// Declare the flags, one at a time... // Declare the flags, one at a time...
flagdef THIS_ONE_IS_ON: m_Flags, 0; flagdef ThisOneIsOn: m_Flags, 0;
flagdef THIS_ONE_IS_OFF: m_Flags, 1; flagdef ThisOneIsOff: m_Flags, 1;
flagdef THIS_ONE_ALIASES_ON: m_Flags, 0; flagdef ThisOneAliasesOn: m_Flags, 0;
// Unnecessary, since you can just access it directly, but this demonstrates // Unnecessary, since you can just access it directly, but this demonstrates
// how declared flags can be used in methods. // how declared flags can be used in methods.
bool CheckIfOnIsOn() bool CheckIfOnIsOn()
{ {
return bTHIS_ONE_IS_ON; return bThisOneIsOn;
} }
} }
``` ```

View File

@ -3,55 +3,62 @@
## By Alison Sanderson. Attribution is encouraged, though not required. ## By Alison Sanderson. Attribution is encouraged, though not required.
## <https://creativecommons.org/publicdomain/zero/1.0/legalcode> ## <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
## TOCGen: Generates inter-file TOCs. ## TOCGen: Generates inter-file TOCs.
## Example usage:
## tools/tocgen.rb
$d = Dir["*.md"] def emit_filtered_file_toc file_matcher
links = []
files = ALL_MD_FILES.map do |p| p.match file_matcher end.compact
def filter_emit r for md_file in files
res = [] links << "* [#{md_file[1]}](#{md_file[0]})"
for m in $d.map{|p| p.match r}.compact
res << "* [#{m[1]}](#{m[0]})"
end
res.join ?\n
end end
def find_toc_areas f links.sort.join ?\n
re = /^(<!-- inter-toc\s*([^\s]+)\s*-->)(?:.|\n)*?(<!-- end -->)/i
f.to_enum(:scan, re).map{$~}
end end
def filter_toc_areas f TOC_REGEX = /^(<!-- inter-toc\s*([^\s]+)?\s*-->)(?:.|\n)*?(<!-- end -->)/i
o = String.new def find_inter_toc_areas file
lof = 0 file.to_enum(:scan, TOC_REGEX).map do $~ end
for area in find_toc_areas f
of = area.offset 0
o << f[lof...of[0]]
o << area[1]
o << "\n\n"
o << filter_emit(yield area[2])
o << "\n\n"
o << area[3]
lof = of[1]
end
o << f[lof..-1]
o
end end
def rewrite fnam def filter_toc_areas file
f = File.read fnam content = ""
o = yield f last_offset = 0
File.write fnam, o
for area in find_inter_toc_areas file
offset = area.offset 0
content << file[last_offset...offset[0]]
content << area[1]
content << "\n\n"
content << emit_filtered_file_toc(yield area[2])
content << "\n\n"
content << area[3]
last_offset = offset[1]
end end
rewrite "api.md" do |f| content << file[last_offset..-1]
filter_toc_areas f do |a| /api-#{a}-(\w+).md/ end content
end end
rewrite "glossary.md" do |f| def rewrite filename
filter_toc_areas f do |a| /glossary-(\w+).md/ end file = File.read filename
output = yield file
File.write filename, output
end end
rewrite "lang.md" do |f| ALL_MD_FILES = Dir["{api,glossary,language}/**/*.md"]
filter_toc_areas f do |a| /lang-(\w+).md/ end
rewrite "api.md" do |file|
filter_toc_areas file do |folder| /api\/#{folder}\/(\w+).md/ end
end
rewrite "glossary.md" do |file|
filter_toc_areas file do |_| /glossary\/(\w+).md/ end
end
rewrite "language.md" do |file|
filter_toc_areas file do |_| /language\/(\w+).md/ end
end end
## EOF ## EOF

View File

@ -10,45 +10,45 @@
require "./tools/zsclasstree.rb" require "./tools/zsclasstree.rb"
DIR = ARGV.shift FILES = ARGV.shift
VER = ARGV.shift VERSION = ARGV.shift
si = ClassSiphon.new DIR siphon = ClassSiphon.new FILES
f = open "glossary-Classes.md", "wb" file = open "glossary-Classes.md", "wb"
f.puts <<_end_ file.puts <<_end_
# Classes # Classes
Here is a full tree of all classes in ZScript as of GZDoom #{VER}. There are Here is a full tree of all classes in ZScript as of GZDoom #{VERSION}. There
#{si.classes.count + 1} classes total. are #{siphon.classes.count + 1} classes total.
``` ```
Object Object
_end_ _end_
si.print_classes f siphon.print_classes file
f.puts <<_end_ file.puts <<_end_
``` ```
<!-- EOF --> <!-- EOF -->
_end_ _end_
f = open "glossary-Structures.md", "wb" file = open "glossary-Structures.md", "wb"
f.puts <<_end_ file.puts <<_end_
# Structures # Structures
Here is a full list of all structures in ZScript as of GZDoom #{VER}. There are Here is a full list of all structures in ZScript as of GZDoom #{VERSION}.
#{si.structs.count} structures total. Note that some of these are merely There are #{siphon.structs.count} structures total. Note that some of these
implementation details and should not be used in code. are merely implementation details and should not be used in code.
``` ```
Struct Struct
_end_ _end_
si.print_structs f siphon.print_structs file
f.puts <<_end_ file.puts <<_end_
``` ```
<!-- EOF --> <!-- EOF -->