git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@992 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2007-05-10 16:51:52 +00:00
parent cb5302b2b5
commit 1a1567df03
15 changed files with 1309 additions and 484 deletions
+272 -125
View File
@@ -2,97 +2,189 @@
docsection [CubeScript]
docident [-] [Performs a subtraction.];
docargument [A] [the minuend] [];
docargument [B] [the subtrahend] [];
docargument [A] [the minuend] [] [0];
docargument [B] [the subtrahend] [] [0];
docident [*] [Performs a multiplication.];
docargument [A] [the multiplicand] [];
docargument [B] [the multiplier] [];
docargument [A] [the multiplicand] [] [0];
docargument [B] [the multiplier] [] [0];
docident [+] [Performs an addition.];
docargument [A] [the first summand] [];
docargument [B] [the second summand] [];
docargument [A] [the first summand] [] [0];
docargument [B] [the second summand] [] [0];
docremark [Example: echo the sum of x and y is (+ $x $y)];
docident [<] [Determines if a value is smaller than a second value.];
docargument [A] [the first value] [];
docargument [B] [the second value] [];
docargument [A] [the first value] [] [0];
docargument [B] [the second value] [] [0];
docident [=] [Determines if two values are equal.];
docargument [A] [first value] [];
docargument [B] [second value] [];
docargument [A] [first value] [] [0];
docargument [B] [second value] [] [0];
docident [>] [Determines if a value is bigger than a second value.];
docargument [A] [the first value] [];
docargument [B] [the second value] [];
docargument [A] [the first value] [] [0];
docargument [B] [the second value] [] [0];
docident [at] [Grabs a word out of a string.];
docargument [S] [the string] [];
docargument [N] [the index of the word] [];
docargument [S] [the string] [] [0];
docargument [N] [the index of the word] [] [0];
docremark [The word is saved to the alias 's'.];
docexample [at "zero one two three" 2; echo $s] [output: two];
docident [concat] [Concatenates multiple strings with spaces inbetween.];
docargument [S] [the first string] [];
docargument [S] [the first string] [] [0];
docargument [...] [collection of strings to concatenate] [] [1];
docremark [The newly created string is saved to the alias 's'.];
docexample [alias a "hello"; concat $a "world"; echo $s] [output: hello world];
docident [concatword] [Concatenates multiple strings.];
docargument [S] [the first string] [];
docargument [S] [the first string] [] [0];
docargument [...] [collection of strings to concatenate] [] [1];
docremark [The newly created string is saved to the alias 's'.];
docexample [alias a "Cube"; concatword $a "Script"; echo $s] [output: CubeScript];
docident [div] [Performs a division.];
docargument [A] [the dividend] [];
docargument [B] [the divisor] [];
docargument [A] [the dividend] [] [0];
docargument [B] [the divisor] [] [0];
docident [if] [Controls the script flow based on a boolean expression.];
docargument [cond] [the condition] [0 (false) or anything else (true)];
docargument [true] [the body to execute if the condition is true] [];
docargument [false] [the body to execute if the condition is true] [];
docargument [cond] [the condition] [0 (false) or anything else (true)] [0];
docargument [true] [the body to execute if the condition is true] [] [0];
docargument [false] [the body to execute if the condition is true] [] [0];
docexample [if (> $x 10) [ echo x is bigger than 10 ] [ else x too small ]] [];
docident [loop] [Loops the specified body.];
docargument [N] [the amount of loops] [];
docargument [body] [the body to execute on each iteration] [];
docargument [N] [the amount of loops] [] [0];
docargument [body] [the body to execute on each iteration] [] [0];
docremark [This command sets the alias "i" from 0 to N-1 for every iteration.];
docexample [loop 10 [ echo $i ]] [];
docident [mod] [Performs a modulo operation.];
docargument [A] [the dividend] [];
docargument [B] [the divisor] [];
docargument [A] [the dividend] [] [0];
docargument [B] [the divisor] [] [0];
docident [sleep] [Executes a command after specified time period.];
docargument [N] [the amount of milliseconds] [];
docargument [C] [the command to execute] [];
docargument [N] [the amount of milliseconds] [] [0];
docargument [C] [the command to execute] [] [0];
docexample [sleep 1000 [ echo foo ]] [Prints 'foo' to the screen after 1 second.];
docident [strcmp] [Determines if two strings are equal.];
docargument [A] [the first string] [];
docargument [B] [the second string] [];
docargument [A] [the first string] [] [0];
docargument [B] [the second string] [] [0];
docident [while] [Loops the specified body while the condition evaluates to true.];
docargument [cond] [the condition] [0 (false) or anything else (true)];
docargument [body] [the body to execute on each iteration] [];
docargument [cond] [the condition] [0 (false) or anything else (true)] [0];
docargument [body] [the body to execute on each iteration] [] [0];
docremark [This command sets the alias "i" from 0 to N-1 for every iteration. Note that the condition here has to have [], otherwise it would only be evaluated once.];
docexample [alias i 0; while [ (< $i 10) ] [ echo $i; alias i (+ $i 1) ]] [];
docsection [Engine]
docsection [Gameplay]
docident [millis] [Returns the number of milliseconds since engine start.];
docident [connect] [Connects to a server.];
docargument [N] [the (dns) name or ip of the server] [] [0];
docargument [P] [the password] [] [0];
docexample [connect 127.0.0.1 myPassword] [];
docsection [Game]
docident [demo] [Plays a recorded demo.];
docargument [S] [the demo name] [] [0];
docremark [Playback is interpolated for the player whose perspective you view.];
docident [demodelaymsec] [Changes the demo playback delay.];
docargument [D] [delay in milliseconds] [min 0/max 500/default 120];
docremark [Only touch if you know what you are doing: changes the delay in msec with which the demo is played back to allow for interpolation. Default is 100, if you decrease it you will most likely just get choppier (it will obstruct the spline interpolation) for an unnoticable bit less lag. Increase it if you notice choppyness in playback, should not be needed in general, but may help if you insist on playing back demos at very low demoplaybackspeed.];
docident [demoplaybackspeed] [Sets the playback speed for a demo.];
docargument [P] [the playback speed] [min 10/max 1000/default 100];
docremark [To see the effect, the variable must be set before playing a demo.];
docident [demotracking] [Specifies if particles should be emitted on demo players position.];
docargument [B] [sets the demo tracking state] [1 (on), 0 (off) min 0/max 1/default 0];
docremark [When demotracking is on (B = 1), the camera will create a red particle every frame where it moves, creating a trail. This can be used to inspect someone's movement in a game. It will only show the last N particles according to the maxparticles variable, which you may want to increase to 10000. The particles will remain even after you stop the demo, so you can use edit mode to look at it from all angles.];
docident [disconnect] [Leaves a server.];
docident [gamespeed] [Sets the gamespeed in percent.];
docargument [N] [the game speed] [min 10/max 1000/default 100];
docremark [This does not work in multiplayer. For entertainment purposes only :)];
docident [getmap] [Retrieves the last map that was sent to the server using 'sendmap'.];
docident [hidestats] [Turns on/off display of fps/rendering stats on the HUD.];
docargument [B] [Turns the stats off (1) or on (0)] [min 0/max 1/default 1];
docident [mode] [Set gameplay mode to N for the next game played (next map load).];
docargument [N] [the mode number] [TODO] [0];
docident [name] [Sets the nick name for the local player.];
docargument [N] [the name] [] [0];
docident [record] [Starts recording of a demo.];
docargument [S] [the demo name] [] [0];
docremark [This works for any multiplayer mode, including the default "ffa" mode you are in when you load up a map locally. The file is saved to demos/S.cdgz.];
docident [say] [Outputs text to other players.];
docargument [S...] [the text] [] [1];
docremark [If the text begins with an percent character (%), only team mates will receive the message.];
docident [saycommand] [Puts a prompt on screen.];
docargument [S...] [the text to display in the prompt] [] [1];
docremark [this puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players.];
docremark [this puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players.];
docremark [this puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players.];
docremark [this puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players.];
docremark [this puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players.];
docremark [this puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players.];
docremark [this puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players.];
dockey [T] [] [opens empty prompt];
dockey [BACKQUOTE] [`] [opens a command prompt /];
dockey [TAB] [] [autocompletes commands/variables/aliases];
dockey [UP] [] [browse command history forwards];
dockey [DOWN] [] [browse command history backwards];
docident [schowscores] [Shows or hides the scores.];
dockey [TAB] [] [];
docident [sendmap] [Sends the current map to the server and sends other players a message about it.];
docargument [M] [map to save and reload locally] [] [0];
docremark [If the map argument is specified, the map is first saved and then reloaded before sending it. Note its always required to be on the map one wants to send before issuing this command!];
docident [stop] [Stops any demo recording or playback.];
docident [team] [Sets the team for the local player.];
docargument [S] [the team name] [either CLA or RVSF] [0];
docexample [team CLA] [];
docident [weapon] [Changes the weapon.];
docargument [N] [the weapon number] [0 (knife), 1 (pistol), 2 (shotgun), 3 (sub), 4 (sniper), 5 (assault), 6 (grenades)] [0];
docsection [General]
docident [alias] [Binds a name to commands.];
docargument [N] [the name of the alias] [string, must not contain '$'];
docargument [A] [the commands] [string];
docargument [N] [the name of the alias] [string, must not contain '$'] [0];
docargument [A] [the commands] [string] [0];
docremark [It is possible to re-bind an alias, even during its evaluation.];
docremark [Example: alias myalias [ echo "hello world"; alias myalias [ echo "I already said hello" ] ]];
docident [attack] [Fires the current weapon.];
docremark [default: left mouse button];
docident [autoreload] [Indicates if the weapons should be reloaded automatically.];
docargument [B] [the autoreload state] [on (1), off (0) min 0/max 1/default 1];
docident [backward] [Moves the player backward.];
docremark [default keys: S and Down Arrow];
docident [bind] [Binds a key to a command.];
docargument [K] [the key to bind] [string];
docargument [A] [the command] [string, usually an alias];
docargument [K] [the key to bind] [string] [0];
docargument [A] [the command] [string, usually an alias] [0];
docremark [To find out what key names and their default bindings are, look at config/keymap.cfg, then add bind commands to your autoexec.cfg.];
docident [conskip] [Allows to browse through the console history by offsetting the console output.];
docargument [N] [the offset] [] [0];
dockey [KP_MINUS] [- on the keypad] [scrolls into the history (conskip 1)];
dockey [KP_PLUS] [+ on the keypad] [resets the history (conskip -1000)];
docident [crosshairfx] [Turns on or off crosshair effects.];
docargument [B] [Turns the effects on (1) or off (0)] [min 0/max 1/default 1];
docremark [When on, the crosshair will go grey when the weapon is reloading, orange when health se 50 or red when se 25.];
@@ -101,48 +193,92 @@ docident [crosshairsize] [Sets the size of your crosshair.];
docargument [N] [the crosshair size] [min 0/max 50/default 15];
docremark [The crosshair is turned off entirely if the size is set to 0.];
docident [docargument] [Adds a new argument documentation to an identifier.];
docargument [T] [the token] [] [0];
docargument [D] [the description] [] [0];
docargument [V] [the value notes] [] [0];
docargument [I] [flags this argument as variable-length] [1 (true), 0 (false)] [0];
docremark [An argument represents either a command argument or a variable value. The new argument is added to the last added identifier documentation.];
docremark [The last argument of an identifier can be flagged as variable-length to indicate that it represents an unknown number of arguments.];
docident [docfind] [Searches the ingame docs for identifier documentations matching the specified search string.];
docargument [S] [the search string] [] [0];
docremark [The name, description and remarks are included in the search.];
docident [docident] [Adds a new identifier documentation to a section.];
docargument [N] [name of the identifier] [] [0];
docargument [D] [the description] [] [0];
docremark [An identifier represents a command or variable. The new identifier documentation is assigned to the last added documentation section.];
docremark [The name may countain spaces to create a "multipart" identifier documentation that can be used to describe a complex argument as a single pseudo identifier, look at the examples.];
docexample [docident fov "Sets the field of view."] [];
docexample [docident "newent light" "Adds a new light entitiy."] [];
docident [docinvalid] [Outputs a list of identifer documentations that do not match any existing identifer.];
docremark [Multipart identifiers are not included in this list, see 'docident'.];
docident [docref] [Adds a new documentation reference to an identifier.];
docargument [N] [the display name] [] [0];
docargument [I] [the identifier to refer to] [] [0];
docargument [U] [the URL to refer to] [] [0];
docremark [The new reference is added to the last added identifier documentation.];
docident [docremark] [Adds a new documentation remark to an identifier.];
docargument [S] [the remark] [] [0];
docremark [The new remark is added to the last added identifier documentation.];
docident [docsection] [Adds a new section to the ingame documentation.];
docargument [S] [the section name] [] [0];
docident [docundone] [Outputs a list of yet undocumented identifiers (commands,variables, etc)];
docargument [A] [output all identifiers] [1 (true), 0 (false)] [0];
docremark [If the one argument is omitted, only the builtin identifiers will be listed. Therefore specify the argument other identifers like aliases should be included too.];
docremark [Note that the list also includes identifiers that contain the substrings "TODO" or "UNDONE" in their documentation.];
docident [docwritebaseref] [Writes out a base XML documentation reference containing templates for the builtin identifiers.];
docargument [R] [the reference name] [] [0];
docargument [S] [the XML schema location string] [] [0];
docargument [T] [XML stylesheet to use] [] [0];
docremark [The generated reference is written to "config/autogenerated_base_reference.xml" by default. The three arguments can be changed later on in the generated XML document.];
docident [dynlight] [Determines wether dynamic shadows and lights are rendered, providedjust incase they slow your fps down too much.];
docargument [R] [the radius of a dynamic light] [min 0/max 32/default 16];
docremark [With radius you can specify the radius of a dynamic light, smaller to maybe gain some speed (0 is off entirely), or bigger to see the effect of dynamic shadows more dramatically (try shooting it past some pillars that have a dark area on the other side... or use the "gamespeed" variable).];
docident [exec] [Executes all commands in a specified config file.];
docargument [C] [the config file] [];
docargument [C] [the config file] [] [0];
docident [fog] [Sets the fog distance.];
docargument [N] [the fog distance] [integer, default is 160];
docargument [N] [the fog distance] [integer, default is 160] [0];
docremark [You can do this for tweaking the visual effect of the fog, or if you are on a slow machine, setting the fog to a low value can also be a very effective way to increase fps (if you are geometry limited). Try out different values on big maps / maps which give you low fps.];
docident [fogcolour] [Sets fog and clearing colour.];
docargument [C] [the colour] [integer, default is 0x8099B3];
docargument [C] [the colour] [integer, default is 0x8099B3] [0];
docremark [This and the fog variable can be set in the map config file.];
docident [forward] [Moves the player forward.];
docremark [default keys: W and Up Arrow];
docident [fov] [Sets the field of view (fov).];
docargument [N] [the fov value] [60..120];
docargument [N] [the fov value] [60..120] [0];
docident [gamma] [Sets the hardware gamma value.];
docargument [N] [the gamma value] [min 30/max 300/default 100];
docremark [May not work if your card/driver doesn't support it.];
docident [hidestats] [Turns on/off display of fps/rendering stats on the HUD.];
docargument [B] [Turns the stats off (1) or on (0)] [min 0/max 1/default 1];
docident [history] [Executes the specified command in the command line history.];
docargument [N] [the N'th command from the history] [];
docargument [N] [the N'th command from the history] [] [0];
docremark [For example, binding "history 0" to a key allows to quickly repeat the last command typed in (useful for placing many identical entities etc.)];
docident [invmouse] [Sets mouse to "flight sim" mode.];
docargument [B] [sets invmouse] [0 (off), else (on)];
docargument [B] [sets invmouse] [0 (off), else (on)] [0];
docident [jump] [Triggers a jump.];
docremark [default keys: space and right mouse.];
docident [keymap] [Sets up the keymap for the specified key.];
docargument [K] [the key to map] [];
docargument [N] [the name for the key] [];
docargument [A] [the default action] [];
docargument [K] [the key to map] [] [0];
docargument [N] [the name for the key] [] [0];
docargument [A] [the default action] [] [0];
docremark [You should never have to use this command manually, use "bind" instead.];
docident [left] [Moves the player left.];
@@ -156,48 +292,60 @@ docident [lightscale] [Used to finetune the "overbright lighting" rendering feat
docargument [N] [the brightness of the scene] [min 1/max 100/default 4];
docremark [After changing this value, a "recalc" is needed to see the differences.];
docident [map] [Loads up a map in the gamemode set previously by the 'mode' command.];
docargument [M] [name of the map to load] [string] [0];
docremark [TODO: multiplayer voting];
docremark [A map given as "blah" refers to "packages/base/blah.cgz", "mypackage/blah" refers to "packages/mypackage/blah.cgz". At every map load, "config/default_map_settings.cfg" is loaded which sets up all texture definitions, etc. Everything defined in there can be overridden per package or per map by creating a "package.cfg" or "mapname.cfg" which contains whatever you want to do differently from the default.];
docremark [When the map finishes it will load the next map when one is defined, otherwise reloads the current map. You can define what map follows a particular map by making an alias like (in the map script): alias nextmap_blah1 blah2 (loads "blah2" after "blah1").];
docident [maxroll] [Sets the maximum value the display will roll on strafing.];
docargument [N] [the roll value] [min 0/max 20/default 0];
docident [menuitem] [Creates a new menuitem.];
docargument [N] [the name of the menuitem] [];
docargument [A] [the action on selection] [];
docargument [N] [the name of the menuitem] [] [0];
docargument [A] [the action on selection] [] [0];
docremark [If the action argument is omitted, then it will be set to the same value as the description. Upon pressing return, the associated action will be executed. See config/menus.cfg for examples.];
docident [millis] [Returns the number of milliseconds since engine start.];
docexample [echo (millis)] [];
docident [minmillis] [Sets the minimum number of milliseconds a frame should take.];
docargument [N] [the number of milliseconds] [integer, 0 (off), default is 5];
docargument [N] [the number of milliseconds] [integer, 0 (off), default is 5] [0];
docremark [This is for very fast machines that run Cube at hundreds of fps. Default is 5, i.e. try to stay close to 200fps. This command is not exact, i.e. the precise delay it generates depends on OS and other factors... experiment with your ideal setting.];
docident [musicvol] [Sets the music volume.];
docargument [N] [the volume] [0..255];
docargument [N] [the volume] [0..255] [0];
docident [newmenu] [Creates a new menu.];
docargument [N] [the name of the menu] [];
docargument [N] [the name of the menu] [] [0];
docident [onrelease] [Executes a command on the release of a key/button.];
docargument [A] [the command] [];
docargument [A] [the command] [] [0];
docremark [This command must be placed in an action in a bind or in an alias in a bind.];
docexample [bind CTRL [ echo "key pressed"; onrelease [ echo "key released" ] ]] [];
docident [particlesize] [Scales all particles.];
docargument [P] [the scale percentage] [min 20/max 500/default 100];
docident [quit] [Quits the game without asking.];
docident [rate] [Sets the clients maximum downstream bandwidth.];
docargument [N] [the bytes per second] [min 0/max 25000/default 0];
docremark [Leaving it at 0 (the default) means the server will dynamically try to do the best thing, this is recommended for players who don't have a clue what their bandwidth is (setting your rate unoptimally is worse than not setting it all). Modem players (56k) could try rate 4000 and tweak from there, dsl players can try rate 6000-10000. Note that the more players on a server, the more critical the effect of your rate. If you are tweak addicted, you can try playing with the variables throttle_decel (how quickly to start dropping packets when your connection becomes bandwidth limited) throttle_accel (how quickly to recover once bandwidth becomes available again) and throttle_interval (how quickly to reestimate the situation). Change the defaults at your own risk.];
docident [right] [Moves the player right.];
docremark [default keys: D and Right Arrow];
docident [screenshot] [Takes a screenshot.];
docremark [Writes out "screenshots/screenshotN.bmp", where N is the number of milliseconds since cube was launched. default key = F12];
docident [screenshot] [Takes a screenshot.];
docremark [Screenshots are saved to "screenshots/screenshotN.bmp", where N is the number of milliseconds since the game was launched (default key = F12).];
docremark [Screenshots are saved to "screenshots/screenshotN.bmp", where N is the number of milliseconds since the game was launched.];
dockey [F12] [] [];
docident [sensitivity] [Sets the mouse sensitivity.];
docargument [S] [the sensitivity] [integer];
docargument [S] [the sensitivity] [integer] [0];
docremark [With 'sensitivityscale' you can specify a number that the sensitivity is divided by.];
docident [showmenu] [Displays the specified menu.];
docargument [N] [the name of a previously defined menu] [];
docargument [N] [the name of a previously defined menu] [] [0];
docremark [The menu allows the user to pick an item with the cursor keys. Upon pressing return, the associated action will be executed. Pressing ESC will cancel the menu.];
docident [soundbufferlen] [Sets the sound buffer length.];
@@ -207,6 +355,9 @@ docremark [Tweak this if you experience stuttering or lagging sound.];
docident [soundvol] [Sets the sound volume.];
docargument [N] [the volume] [min 0/max 255/default 155];
docident [updatefrommaster] [Contacts the masterserver and adds any new servers to the server list.];
docremark [The servers are written to the config/servers.cfg file. This menu can be reached through the Multiplayer menu.];
docident [watersubdiv] [Determines the subdivision of the water surface in maps.];
docargument [N] [the subdivisioin value] [min 1/max 64/default 4];
docremark [Must be a power of 2: 4 is the default, 8 is recommended for people on slow machines, 2 is nice for fast machines, and 1 is quite OTT. See "waterlevel" (edit reference) on how to add water to your own levels.];
@@ -214,39 +365,40 @@ docremark [Must be a power of 2: 4 is the default, 8 is recommended for people o
docsection [Editing]
docident [arch] [Makes an arch out of the current selection.];
docargument [S] [side delta (optional)] [];
docargument [S] [side delta (optional)] [] [0];
docremark [The selection must be a heighfield before this command can be used. Will make the arch in the long direction, i.e when you have 6x2 cubes selected, the arch will span 7 vertices. Optionally, sidedelta specifies the delta to add to the outer rows of vertices in the other direction, i.e. give the impression of an arch that bends 2 ways (try "arch 2" on an selection of atleast 2 thick to see the effect). Not all arch sizes are necessarily available, see config/prefabs.cfg.];
docident [archvertex] [Defines a vertex delta for a specific arch span prefab, used by the 'arch' command.];
docargument [S] [span value] [integer];
docargument [V] [vertex value] [integer];
docargument [D] [delta value] [integer];
docargument [S] [span value] [integer] [0];
docargument [V] [vertex value] [integer] [0];
docargument [D] [delta value] [integer] [0];
docremark [See config/prefabs.cfg for an example on usage.];
docident [clearents] [Deletes all entities of said type.];
docargument [T] [the entity type, see command 'newent'] [string];
docargument [T] [the entity type, see command 'newent'] [string] [0];
docident [copy] [Copies the current selection into a buffer.];
docremark [hotkey c];
docident [corner] [Makes the current selection into a "corner".];
docremark [Currently there is only one type of corner (a 45 degree one), only works on a single unit (cube) at a time. It can be positioned either next to 2 solid walls or in the middle of 2 higher floorlevels and 2 lower ones forming a diagonal (and similar with ceiling).];
docremark [In both cases, the corner will orient itself automatically depending on its neighbours, behaviour with other configurations than the 2 above is unspecified. Since the latter configuration generates possibly 2 floor and 2 ceiling levels, up to 4 textures are used: for example for the 2 floors the higher one will of the cube itself, and the lower one of a neighbouring low cube. Default key = k you can make bigger corners at once by pressing "corner" on grid aligned 2x2/4x4/8x8 selections, with equal size solid blocks next to them.];
docremark [In both cases, the corner will orient itself automatically depending on its neighbours, behaviour with other configurations than the 2 above is unspecified. Since the latter configuration generates possibly 2 floor and 2 ceiling levels, up to 4 textures are used: for example for the 2 floors the higher one will of the cube itself, and the lower one of a neighbouring low cube. You can make bigger corners at once by issuing "corner" on grid aligned 2x2/4x4/8x8 selections, with equal size solid blocks next to them.];
dockey [K] [] [];
docident [delent] [Deletes the entity closest to the player];
docremark [hotkey x];
docident [editheight] [Changes the height of the current selection.];
docargument [T] [an integer denoting the type] [0 (floor), 2 (ceiling)];
docargument [D] [the delta value to move it in] [1 (forwards), -1 (backwards)];
docargument [T] [an integer denoting the type] [0 (floor), 2 (ceiling)] [0];
docargument [D] [the delta value to move it in] [1 (forwards), -1 (backwards)] [0];
docremark [Default keys are [ and ] for floor level, and o/p for ceiling.];
docident [editing] [A variable indicating if the game is in editmode.];
docargument [] [editmode] [1 (true), 0 (false) read-only];
docident [edittex] [Changes the texture on current selection by browsing through a list of textures directly shown on the cubes.];
docargument [T] [an integer denoting the type] [0 (floor), 1 (lower or wall), 2 (ceiling), 3 (upper wall)];
docargument [D] [the direction you want to cycle the textures in] [1 (forwards), -1 (backwards)];
docargument [T] [an integer denoting the type] [0 (floor), 1 (lower or wall), 2 (ceiling), 3 (upper wall)] [0];
docargument [D] [the direction you want to cycle the textures in] [1 (forwards), -1 (backwards)] [0];
docremark [Default keys are the six keys above the cursor keys, which each 2 of them cycle one type (and numpad 7/4 for upper).];
docremark [The way this works is slightly strange at first, but allows for very fast texture assignment. All textures are in 3 individual lists for each type (both wall kinds treated the same), and each time a texture is used, it is moved to the top of the list. So after a bit of editing, all your most frequently used textures will come first when pressing these keys, and the most recently used texture is set immediately when you press the forward key for the type. These lists are saved with the map. make a selection (including wall bits) and press these keys to get a feel for what they do.];
@@ -255,40 +407,35 @@ docremark [In map edit mode you can select bits of the map by clicking or draggi
docremark [Hotkey E];
docident [entproperty] [Changes property of the closest entity.];
docargument [P] [the property to change] [0..3];
docargument [A] [amount by wich the property is increased] [integer];
docargument [P] [the property to change] [0..3] [0];
docargument [A] [amount by wich the property is increased] [integer] [0];
docremark [For example 'entproperty 0 2' when executed near a lightsource would increase its radius by 2.];
docident [equalize] [Levels the floor/ceiling of the selection.];
docargument [T] [an integer denoting the type] [0 (floor), 2 (ceiling)];
docargument [T] [an integer denoting the type] [0 (floor), 2 (ceiling)] [0];
docremark [default keys , and .];
docident [flrceil] [A variable indicating if the player looks at the floor or at the ceiling.];
docargument [] [flrceil] [0 (floor), 2 (ceiling) read-only];
docident [fullbright] [Sets all light values to fullbright.];
docargument [B] [sets fullbright on or off] [0 (off), 1 (on)];
docargument [B] [sets fullbright on or off] [0 (off), 1 (on)] [0];
docremark [Will be reset when you issue a 'recalc'. Only works in edit mode.];
docident [heighfield] [Marks the current selection as a heightfield.];
docargument [T] [an integer denoting the type] [0 (floor), 2 (ceiling)];
docargument [T] [an integer denoting the type] [0 (floor), 2 (ceiling)] [0];
docremark [marks the current selection as a heightfield, with T being floor or ceiling, as above. A surface marked as heightfield will use the vdelta values (see below) of its 4 corners to create a sloped surface. To mark a heightfield as normal again (ignoring vdelta values, set or not) use "solid 0". Default keys are h (floor) and i (ceiling).];
docremark [Heightfields should be made the exact size that is needed, not more not less. The most important reason for this is that cube automatically generates "caps" (side-faces for heightfields) only on the borders of the heighfield. This also means if you have 2 independant heightfields accidentally touch eachother, you will not get correct caps. Also, a heighfield is slightly slower to render than a non-heighfield floor or ceiling. Last but not least, a heightfield should have all the same baseheight (i.e. the height determined by a normal editheight operation) to get correct results.];
docident [map] [Loads up a map in the gamemode set previously by the 'mode' command.];
docargument [M] [name of the map to load] [string];
docremark [A map given as "blah" refers to "packages/base/blah.cgz", "mypackage/blah" refers to "packages/mypackage/blah.cgz". At every map load, "config/default_map_settings.cfg" is loaded which sets up all texture definitions, etc. Everything defined in there can be overridden per package or per map by creating a "package.cfg" or "mapname.cfg" which contains whatever you want to do differently from the default.];
docremark [When the map finishes it will load the next map when one is defined, otherwise reloads the current map. You can define what map follows a particular map by making an alias like (in the map script): alias nextmap_blah1 blah2 (loads "blah2" after "blah1").];
docident [mapenlarge] [Enlarges the current map.];
docremark [This command will make the current map 1 power of two bigger. So a 6 size map (64x64 units) it will become a 7 map (128x128), with the old map in the middle (from 32-96) and the new areas solid.];
docident [mapmodel] [Registers a mapmodel that can be placed in maps.];
docargument [R] [the square radius] [string];
docargument [H] [the height] [integer];
docargument [Z] [the initial Z-offset above ground] [integer];
docargument [S] [the snap value in 16ths of a cube unit] [integer, 0 meaning no snap];
docargument [N] [the name of the map model] [string];
docargument [R] [the square radius] [string] [0];
docargument [H] [the height] [integer] [0];
docargument [Z] [the initial Z-offset above ground] [integer] [0];
docargument [S] [the snap value in 16ths of a cube unit] [integer, 0 meaning no snap] [0];
docargument [N] [the name of the map model] [string] [0];
docremark [A map model registered with this command can be placed in a map using the 'newent mapmodel' command. All of these values are used for collision as well as rendering. Specifying a snap can be useful for architectural mapmodels, as the md2 format doesn't provide exact vertex coordinates.];
docremark [Example: mapmodel 4 2 4 2 this map model is 8x8x2 in size (x,y,z), by default hovers 4 units above ground, and has all coordinates snapped to the nearest even number. See data/models.cfg.];
@@ -296,15 +443,15 @@ docident [mapmodelreset] [Resets the mapmodel slots/indices to 0.];
docremark [Each subsequent mapmodel command increases it again. See config/default_map_settings.cfg for an example.];
docident [mapmsg] [Sets the map message, which will be displayed when the map loads.];
docargument [M] [the map message] [string];
docargument [M] [the map message] [string] [0];
docremark [For example: mapmsg "Map By Author".];
docident [newent] [Adds a new entity];
docargument [type] [the entity type] [light, playerstart, clips, ammobox, grenades, health, armour, akimbo, mapmodel, trigger, ladder, ctf-flag];
docargument [value1] [see newent 'type'] [];
docargument [value2] [see newent 'type'] [];
docargument [value3] [see newent 'type'] [];
docargument [value4] [see newent 'type'] [];
docargument [type] [the entity type] [light, playerstart, clips, ammobox, grenades, health, armour, akimbo, mapmodel, trigger, ladder, ctf-flag] [0];
docargument [value1] [see newent 'type'] [] [0];
docargument [value2] [see newent 'type'] [] [0];
docargument [value3] [see newent 'type'] [] [0];
docargument [value4] [see newent 'type'] [] [0];
docremark [(x,y) is determined by the current selection (the red dot corner) and z by the camera height, of said type. Type is a string giving the type of entity, such as "light", and may optionally take values (depending on the entity).];
docident [newent ammo] [Adds a new ammo box item.];
@@ -316,7 +463,7 @@ docident [newent armour] [Adds a new akimbo item.];
docident [newent clips] [Adds a new clip item.];
docident [newent ctf-flag] [Adds a CTF flag entity.];
docargument [T] [denotes the flag's team] [0 (CLA), 1 (RVSF)];
docargument [T] [denotes the flag's team] [0 (CLA), 1 (RVSF)] [0];
docremark [Note that this entity is only rendered as flag if the current game mode is CTF.];
docident [newent grenades] [Adds a new grenades item.];
@@ -324,35 +471,35 @@ docident [newent grenades] [Adds a new grenades item.];
docident [newent health] [Adds a new health item.];
docident [newent ladder] [Adds a ladder entity.];
docargument [H] [the height of the ladder] [integer];
docargument [H] [the height of the ladder] [integer] [0];
docremark [Note that this entity is used for physics only, to create a visual ladder you will need to add a mapmodel entity too.];
docident [newent light] [Adds a new light entity];
docargument [radius] [the light radius] [1..32];
docargument [R] [red colour component. see remarks below.] [1..255];
docargument [G] [green colour component] [1..255];
docargument [B] [blue colour component] [1..255];
docargument [radius] [the light radius] [1..32] [0];
docargument [R] [red colour component. see remarks below.] [1..255] [0];
docargument [G] [green colour component] [1..255] [0];
docargument [B] [blue colour component] [1..255] [0];
docremark [if only argument R is specified, it is interpreted as brightness for white light.];
docident [newent mapmodel] [Adds a map model, i.e. an object rendered as md2/md3 which you collide against but has no behaviour or movement];
docargument [N] [the mapmodel identifier] [integer];
docargument [Z] [extra elevation above ground] [integer];
docargument [T] [the map texture to use (optional)] [integer];
docargument [N] [the mapmodel identifier] [integer] [0];
docargument [Z] [extra elevation above ground] [integer] [0];
docargument [T] [the map texture to use (optional)] [integer] [0];
docremark [The mapmodel identifier is the desired map model which is defined by the 'mapmodel' command. The map texture refers to a texture which is defined by the 'texture' command, if omitted the models default skin will be used. The 'mapmodel' and 'texture' commands are placed in the map config normally. Mapmodels are more expensive than normal map geometry, do not use insane amounts of them to replace normal geometry.];
docident [newent playerstart] [Adds a new spawn spot.];
docremark [The yaw is taken from the current camera yaw.];
docident [newent teledest] [Creates a teleport destination.];
docargument [N] [the teleport identifier] [0..255];
docargument [N] [the teleport identifier] [0..255] [0];
docremark [Teleports are linked to a teledest with the same identifier. The teledest uses the current camera yaw.];
docident [newent teleport] [Creates a teleport connection.];
docargument [N] [the teleport identifier] [0..255];
docargument [N] [the teleport identifier] [0..255] [0];
docremark [Teleports are linked to a teledest with the same identifier.];
docident [newmap] [Creates a new map.];
docargument [S] [the size of the new map] [6..12];
docargument [S] [the size of the new map] [6..12] [0];
docremark [The new map has 2^S cubes. For S, 6 is small, 7 medium, 8 large.];
docident [paste] [Pastes a previously copied selection.];
@@ -360,16 +507,16 @@ docremark [To paste a selection back requires a same size selection at the desti
docremark [hotkey v];
docident [perlin] [Generates a perlin noise landscape in the current selection.];
docargument [S] [the scale, frequency of the features] [default is 10];
docargument [E] [the random seed] [integer];
docargument [C] [cube size, how many cubes to generate a surface for at once (unused)] [];
docargument [S] [the scale, frequency of the features] [default is 10] [0];
docargument [E] [the random seed] [integer] [0];
docargument [C] [cube size, how many cubes to generate a surface for at once (unused)] [] [0];
docremark [Keep the seed the same to create multiple perlin areas which fit with eachother, or use different numbers if to create alternative random generations.];
docident [recalc] [Recomputes all there is to recompute about a map, currently only lighting.];
docremark [hotkey R];
docident [registersound] [Registers a sound.];
docargument [N] [sound name] [string, see config/sounds.cfg];
docargument [N] [sound name] [string, see config/sounds.cfg] [0];
docremark [This command returns the sound number, which is assigned from 0 onwards, and which can be used with "sound" command. If the sound was already registered, its existing index is returned. registersound does not actually load the sound, this is done on first play.];
docremark [See for example config/sounds.cfg.];
@@ -377,20 +524,20 @@ docident [replace] [Repeats the last texture edit thruout the map.];
docremark [The way it works is intuitive: simply edit any texture anywhere, then using "replace" will replace all textures thruout the map in the same way (taking into account wether it was a floor/wall/ceil/upper too). If the there was more than one "old" texture in your selection, the one nearest to the red dot is used. This operation can't be undone.];
docident [savemap] [Saves the current map.];
docargument [M] [file name of the map, see command 'map' for the naming scheme] [string];
docargument [M] [file name of the map, see command 'map' for the naming scheme] [string] [0];
docremark [savemap makes a versioned backup (mapname_N.BAK) if a map by that name already exists. If the name argument is omitted, it is saved under the current map name.];
docremark [Where you store a map depends on the complexity of what you are creating: if its a single map (maybe with its own .cfg) then the "base" package is the best place. If its multiple maps or a map with new media (textures etc.) its better to store it in its own package (a directory under "packages"), which makes distributing it less messy.];
docident [scalelights] [Scales all lights in the map.];
docargument [P] [percentage] [];
docargument [I] [intensity] [];
docargument [P] [percentage] [] [0];
docargument [I] [intensity] [] [0];
docremark [This command is useful if a map is too dark or bright but you want to keep the light entities where they are.];
docident [select] [Selects the given area, as if dragged with the mouse.];
docargument [X] [the X coordinate] [];
docargument [Y] [the Y coordinate] [];
docargument [XS] [the length along the X axis] [];
docargument [XY] [the length along the Y axis] [];
docargument [X] [the X coordinate] [] [0];
docargument [Y] [the Y coordinate] [] [0];
docargument [XS] [the length along the X axis] [] [0];
docargument [XY] [the length along the Y axis] [] [0];
docremark [This command is useful for making complex geometry-generating scripts. The current dimensions of the selection (either created by the user or this command) are in the variables selx, sely, selxs and selys and can also be read/modified.];
docremark [Coordinates are as follows: after a "newmap 6" the top-left corner (the one where the red dot points) are (8,8), the opposite corner is (56,56) (or (120,120) on a "newmap 7" etc.).];
@@ -398,21 +545,21 @@ docident [showmip] [Toggles between showing what parts of the scenery are render
docremark [Shows hat parts of the scenery are rendered using what size cubes, and outputs some stats too. This can give mappers hints as to what architecture to align / textures to change etc.];
docident [slope] [Makes a slope out of the current selection.];
docargument [X] [x delta step] [integer];
docargument [Y] [y delta step] [integer];
docargument [X] [x delta step] [integer] [0];
docargument [Y] [y delta step] [integer] [0];
docremark [The selection must be a heighfield before this command can be used. The steps specify the slope with the red vertex as left-top, i.e. "slope 1 2" will make a slope that increases just 1 step from left to right, and is slightly steeper from top to bottom. "slope -6 0" decreases steeply from left to right, and does not slope at all from top to bottom. Note that like the vdelta command, an increasing vdelta goes further away from the player, regardless of floor or ceiling.];
docident [solid] [makes the current selection all solid (i.e. wall) or all non-solid.];
docargument [B] [an integer denoting the solid-ness] [0 (non-solid), 1..* (solid)];
docargument [B] [an integer denoting the solid-ness] [0 (non-solid), 1..* (solid)] [0];
docremark [This operation retains floor/ceiling heights/textures while swapping between the two. Default keys f and g respectively.];
docident [sound] [Plays the specified sound.];
docargument [S] [the sound to play] [string, see config/sounds.cfg];
docargument [S] [the sound to play] [string, see config/sounds.cfg] [0];
docremark [See config/sounds.cfg for default sounds, and use registersound to register your own. For example, sound 0 and sound (registersound "aard/jump") both play the standard jump sound.];
docident [texture] [Binds a texture to the current texture slot.];
docargument [S] [number of a secondary texture (unused)] [string];
docargument [F] [file name of the texture to bind] [string];
docargument [S] [number of a secondary texture (unused)] [string] [0];
docargument [F] [file name of the texture to bind] [string] [0];
docremark [Binds the texture indicated in filename to the current texture slot, then increments the slot number. This is for use in map configs only. A secondary textures can be specified for a single texture slot, for use in shaders and other features (unused for now, should be set to 0 to indicate primary texture).];
docident [texturereset] [Sets the texture slot to 0 for the subsequent "texture" commands.];
@@ -424,16 +571,16 @@ docident [undo] [Multi-level undo of any of the changes caused by editing operat
docremark [hotkey u];
docident [undomegs] [Sets the number of megabytes used for the undo buffer.];
docargument [N] [number of megabytes, default is 1] [integer];
docargument [N] [number of megabytes, default is 1] [integer] [0];
docremark [undo's work for any size areas, so the amount of undo steps per megabyte is more for small areas than for big ones (a megabyte fits 280 undo steps on a 16x16 area, but only 4 steps on a 128x128 area).];
docident [vdelta] [changes the vdelta value of the current selection];
docargument [N] [vdelta value] [];
docargument [N] [vdelta value] [] [0];
docremark [Note that unlike all other editing functions, this function doesn't affect a cube, but its top-left vertex (market by the dot in the editing cursor). So to edit a N * M heightfield, you will likely have to edit the vdelta of (N+1) * (M+1) cubes, i.e. you have to select 1 row and 1 column more in the opposite direction of the red dot to affect all the vertices of a heightfield of a given size (try it, it makes sense :)];
docremark [A floor delta offsets vertices to beneath the level set by editheight (and a ceil delta to above). Delta offsets have a precision of a quarter of a unit, however you should use non-unitsize vertices only to touch other such vertices. Default keys are 8 and 9 to decrease/increase the vdelta.];
docident [waterlevel] [Sets the global water level for the map.];
docargument [H] [the water level] [integer];
docargument [H] [the water level] [integer] [0];
docremark [Every cube that has a lower floor than the water level will be rendered with a nice wavy water alpha texture. Water physics will be applied to any entity located below it.];
docremark [Performance notes: water is rendered for a whole square encapsulating all visible water areas in the map (try flying above the map in edit mode to see how). So the most efficient water is a single body of water, or multiple water areas that are mostly not visible from eachother. Players can influence how accurate the water is rendered using the "watersubdiv" command (map config).];
+552 -144
View File
@@ -3,7 +3,6 @@
<!--<?xml-stylesheet type="text/xsl" href="transformations/cuberef2cubescript.xslt"?>-->
<?xml-stylesheet type="text/xsl" href="transformations/cuberef2xhtml.xslt"?>
<!--
See reference.xsd and types.xsd before editing this file.
-->
@@ -12,7 +11,7 @@
<description>
This reference describes the commands and variables available in AssaultCube.
</description>
<sections sort="true">
<sections sort="false">
<section name="CubeScript">
<description>This section describes identifiers that are closely related to the CubeScript language.</description>
<identifiers sort="true">
@@ -246,11 +245,455 @@
</command>
</identifiers>
</section>
<section name="Engine">
<section name="Gameplay">
<description>
This section describes identifiers closely related to the Cube Engine.
This section describes gameplay related identifiers.
</description>
<identifiers>
<command name="name">
<description>Sets the nick name for the local player.</description>
<arguments>
<argument token="N" description="the name"/>
</arguments>
</command>
<command name="say">
<description>Outputs text to other players.</description>
<remarks>
<remark>
If the text begins with an percent character (%),
only team mates will receive the message.
</remark>
</remarks>
<arguments>
<variableArgument token="S..." description="the text"/>
</arguments>
</command>
<command name="saycommand">
<description>
Puts a prompt on screen.
</description>
<remarks>
<remark>
this puts a prompt on screen where you can type stuff into,
which will capture all keystrokes until you press return (or esc to cancel).
If what you typed started with a "/", the rest of it will be executed as a command,
otherwise its something you "say" to all players.
</remark>
<remark>
this puts a prompt on screen where you can type stuff into,
which will capture all keystrokes until you press return (or esc to cancel).
If what you typed started with a "/", the rest of it will be executed as a command,
otherwise its something you "say" to all players.
</remark>
<remark>
this puts a prompt on screen where you can type stuff into,
which will capture all keystrokes until you press return (or esc to cancel).
If what you typed started with a "/", the rest of it will be executed as a command,
otherwise its something you "say" to all players.
</remark>
<remark>
this puts a prompt on screen where you can type stuff into,
which will capture all keystrokes until you press return (or esc to cancel).
If what you typed started with a "/", the rest of it will be executed as a command,
otherwise its something you "say" to all players.
</remark>
<remark>
this puts a prompt on screen where you can type stuff into,
which will capture all keystrokes until you press return (or esc to cancel).
If what you typed started with a "/", the rest of it will be executed as a command,
otherwise its something you "say" to all players.
</remark>
<remark>
this puts a prompt on screen where you can type stuff into,
which will capture all keystrokes until you press return (or esc to cancel).
If what you typed started with a "/", the rest of it will be executed as a command,
otherwise its something you "say" to all players.
</remark>
<remark>
this puts a prompt on screen where you can type stuff into,
which will capture all keystrokes until you press return (or esc to cancel).
If what you typed started with a "/", the rest of it will be executed as a command,
otherwise its something you "say" to all players.
</remark>
</remarks>
<defaultKeys>
<key alias="T" description="opens empty prompt"/>
<key alias="BACKQUOTE" name="`" description="opens a command prompt /"/>
<key alias="TAB" description="autocompletes commands/variables/aliases"/>
<key alias="UP" description="browse command history forwards"/>
<key alias="DOWN" description="browse command history backwards"/>
</defaultKeys>
<arguments>
<variableArgument token="S..." description="the text to display in the prompt" optional="true"/>
</arguments>
</command>
<command name="connect">
<description>
Connects to a server.
</description>
<examples>
<example>
<code>
connect 127.0.0.1 myPassword
</code>
</example>
</examples>
<arguments>
<argument token="N" description="the (dns) name or ip of the server"/>
<argument token="P" description="the password" optional="true"/>
</arguments>
</command>
<command name="disconnect">
<description>Leaves a server.</description>
</command>
<command name="team">
<description>Sets the team for the local player.</description>
<examples>
<example>
<code>
team CLA
</code>
</example>
</examples>
<arguments>
<argument token="S" description="the team name" valueNotes="either CLA or RVSF"/>
</arguments>
</command>
<command name="schowscores">
<description>Shows or hides the scores.</description>
<defaultKeys>
<key alias="TAB"/>
</defaultKeys>
</command>
<command name="weapon">
<description>Changes the weapon.</description>
<arguments>
<argument token="N" description="the weapon number" valueNotes="0 (knife), 1 (pistol), 2 (shotgun), 3 (sub), 4 (sniper), 5 (assault), 6 (grenades)"/>
</arguments>
</command>
<command name="mode">
<description>Set gameplay mode to N for the next game played (next map load).</description>
<references>
<identifierReference identifier="map"/>
</references>
<arguments>
<argument token="N" description="the mode number" valueNotes="TODO"/>
</arguments>
</command>
<command name="sendmap">
<description>Sends the current map to the server and sends other players a message about it.</description>
<remarks>
<remark>
If the map argument is specified, the map is first saved and then reloaded before sending it.
Note its always required to be on the map one wants
to send before issuing this command!
</remark>
</remarks>
<references>
<identifierReference identifier="getmap"/>
</references>
<arguments>
<argument token="M" description="map to save and reload locally" optional="true"/>
</arguments>
</command>
<command name="getmap">
<description>Retrieves the last map that was sent to the server using 'sendmap'.</description>
<references>
<identifierReference identifier="sendmap"/>
</references>
</command>
<command name="record">
<description>Starts recording of a demo.</description>
<remarks>
<remark>
This works for any multiplayer mode, including the default "ffa" mode you are in when
you load up a map locally. The file is saved to demos/S.cdgz.
</remark>
</remarks>
<arguments>
<argument token="S" description="the demo name"/>
</arguments>
</command>
<command name="stop">
<description>
Stops any demo recording or playback.
</description>
</command>
<command name="demo">
<description>Plays a recorded demo.</description>
<remarks>
<remark>
Playback is interpolated for the player whose perspective you view.
</remark>
</remarks>
<arguments>
<argument token="S" description="the demo name"/>
</arguments>
</command>
<variable name="hidestats">
<description>Turns on/off display of fps/rendering stats on the HUD.</description>
<value token="B" description="Turns the stats off (1) or on (0)" minValue="0" maxValue="1" defaultValue="1"/>
</variable>
<variable name="demoplaybackspeed">
<description>Sets the playback speed for a demo.</description>
<remarks>
<remark>To see the effect, the variable must be set before playing a demo.</remark>
</remarks>
<value token="P" description="the playback speed" minValue="10" maxValue="1000" defaultValue="100"/>
</variable>
<variable name="demodelaymsec">
<description>Changes the demo playback delay.</description>
<remarks>
<remark>
Only touch if you know what you are doing:
changes the delay in msec with which the demo is played back to allow for interpolation.
Default is 100, if you decrease it you will most likely just get choppier (it will obstruct
the spline interpolation) for an unnoticable bit less lag. Increase it if you notice choppyness
in playback, should not be needed in general, but may help if you insist on playing back
demos at very low demoplaybackspeed.
</remark>
</remarks>
<value token="D" description="delay in milliseconds" minValue="0" maxValue="500" defaultValue="120"/>
</variable>
<variable name="demotracking">
<description>Specifies if particles should be emitted on demo players position.</description>
<remarks>
<remark>
When demotracking is on (B = 1), the camera will create a red particle every frame where it moves,
creating a trail. This can be used to inspect someone's movement in a game.
It will only show the last N particles according to the maxparticles variable,
which you may want to increase to 10000. The particles will remain even after
you stop the demo, so you can use edit mode to look at it from all angles.
</remark>
</remarks>
<value token="B" description="sets the demo tracking state" minValue="0" maxValue="1" defaultValue="0" valueNotes="1 (on), 0 (off)"/>
</variable>
<variable name="gamespeed">
<description>Sets the gamespeed in percent.</description>
<remarks>
<remark>This does not work in multiplayer. For entertainment purposes only :)</remark>
</remarks>
<value token="N" description="the game speed" minValue="10" maxValue="1000" defaultValue="100"/>
</variable>
</identifiers>
</section>
<section name="General">
<description>
This section describes general identifiers.
</description>
<identifiers>
<command name="docsection">
<description>Adds a new section to the ingame documentation.</description>
<references>
<identifierReference identifier="docident"/>
</references>
<arguments>
<argument token="S" description="the section name"/>
</arguments>
</command>
<command name="docident">
<description>Adds a new identifier documentation to a section.</description>
<remarks>
<remark>
An identifier represents a command or variable. The new identifier
documentation is assigned to the last added documentation section.
</remark>
<remark>
The name may countain spaces to create a "multipart" identifier documentation
that can be used to describe a complex argument as a single pseudo identifier,
look at the examples.
</remark>
</remarks>
<examples>
<example>
<code>docident fov "Sets the field of view."</code>
</example>
<example>
<code>docident "newent light" "Adds a new light entitiy."</code>
</example>
</examples>
<references>
<identifierReference identifier="docsection"/>
<identifierReference identifier="docargument"/>
<identifierReference identifier="docremark"/>
<identifierReference identifier="docref"/>
<identifierReference identifier="docundone"/>
<identifierReference identifier="docinvalid"/>
<identifierReference identifier="docfind"/>
<identifierReference identifier="docwritebaseref"/>
</references>
<arguments>
<argument token="N" description="name of the identifier"/>
<argument token="D" description="the description"/>
</arguments>
</command>
<command name="docargument">
<description>Adds a new argument documentation to an identifier.</description>
<remarks>
<remark>
An argument represents either a command argument or a variable value.
The new argument is added to the last added identifier documentation.
</remark>
<remark>
The last argument of an identifier can be flagged as variable-length
to indicate that it represents an unknown number of arguments.
</remark>
</remarks>
<references>
<identifierReference identifier="docident"/>
</references>
<arguments>
<argument token="T" description="the token"/>
<argument token="D" description="the description"/>
<argument token="V" description="the value notes"/>
<argument token="I" description="flags this argument as variable-length" valueNotes="1 (true), 0 (false)" optional="true"/>
</arguments>
</command>
<command name="docremark">
<description>Adds a new documentation remark to an identifier.</description>
<remarks>
<remark>
The new remark is added to the last added identifier documentation.
</remark>
</remarks>
<references>
<identifierReference identifier="docident"/>
</references>
<arguments>
<argument token="S" description="the remark"/>
</arguments>
</command>
<command name="docref">
<description>Adds a new documentation reference to an identifier.</description>
<remarks>
<remark>
The new reference is added to the last added identifier documentation.
</remark>
</remarks>
<references>
<identifierReference identifier="docident"/>
</references>
<arguments>
<argument token="N" description="the display name"/>
<argument token="I" description="the identifier to refer to" optional="true"/>
<argument token="U" description="the URL to refer to" optional="true"/>
</arguments>
</command>
<command name="docundone">
<description>Outputs a list of yet undocumented identifiers (commands,variables, etc)</description>
<remarks>
<remark>
If the one argument is omitted, only the builtin identifiers will be listed. Therefore specify the argument
other identifers like aliases should be included too.
</remark>
<remark>
Note that the list also includes identifiers that contain the substrings "TODO" or "UNDONE" in their documentation.
</remark>
</remarks>
<references>
<identifierReference identifier="docident"/>
<identifierReference identifier="docinvalid"/>
<identifierReference identifier="docfind"/>
</references>
<arguments>
<argument token="A" description="output all identifiers" valueNotes="1 (true), 0 (false)" optional="true"/>
</arguments>
</command>
<command name="docinvalid">
<description>Outputs a list of identifer documentations that do not match any existing identifer.</description>
<remarks>
<remark>
Multipart identifiers are not included in this list, see 'docident'.
</remark>
</remarks>
<references>
<identifierReference identifier="docident"/>
<identifierReference identifier="docinvalid"/>
<identifierReference identifier="docfind"/>
</references>
</command>
<command name="docfind">
<description>Searches the ingame docs for identifier documentations matching the specified search string.</description>
<remarks>
<remark>
The name, description and remarks are included in the search.
</remark>
</remarks>
<references>
<identifierReference identifier="docident"/>
<identifierReference identifier="docundone"/>
<identifierReference identifier="docinvalid"/>
</references>
<arguments>
<argument token="S" description="the search string"/>
</arguments>
</command>
<command name="docwritebaseref">
<description>Writes out a base XML documentation reference containing templates for the builtin identifiers.</description>
<remarks>
<remark>
The generated reference is written to "config/autogenerated_base_reference.xml" by default.
The three arguments can be changed later on in the generated XML document.
</remark>
</remarks>
<references>
<identifierReference identifier="docident"/>
<identifierReference identifier="docundone"/>
<identifierReference identifier="docinvalid"/>
<identifierReference identifier="docfind"/>
</references>
<arguments>
<argument token="R" description="the reference name" optional="true"/>
<argument token="S" description="the XML schema location string" optional="true"/>
<argument token="T" description="XML stylesheet to use" optional="true"/>
</arguments>
</command>
<command name="map">
<description>Loads up a map in the gamemode set previously by the 'mode' command.</description>
<remarks>
<remark>
TODO: multiplayer voting
</remark>
<remark>
A map given as "blah" refers to "packages/base/blah.cgz", "mypackage/blah" refers to "packages/mypackage/blah.cgz".
At every map load, "config/default_map_settings.cfg" is loaded which sets up all texture definitions, etc. Everything
defined in there can be overridden per package or per map by creating a "package.cfg" or "mapname.cfg" which
contains whatever you want to do differently from the default.
</remark>
<remark>
When the map finishes it will load the next map when one is defined, otherwise reloads the current map.
You can define what map follows a particular map by making an alias like (in the map script): alias nextmap_blah1 blah2
(loads "blah2" after "blah1").
</remark>
</remarks>
<arguments>
<argument token="M" description="name of the map to load" valueNotes="string"/>
</arguments>
</command>
<command name="jump">
<description>Triggers a jump.</description>
<remarks>
<remark>default keys: space and right mouse.</remark>
</remarks>
</command>
<command name="updatefrommaster">
<description>Contacts the masterserver and adds any new servers to the server list.</description>
<remarks>
<remark>The servers are written to the config/servers.cfg file. This menu can be reached through the Multiplayer menu.</remark>
</remarks>
</command>
<command name="conskip">
<description>
Allows to browse through the console history by offsetting the console output.
</description>
<defaultKeys>
<key alias="KP_MINUS" name="- on the keypad" description="scrolls into the history (conskip 1)"/>
<key alias="KP_PLUS" name="+ on the keypad" description="resets the history (conskip -1000)"/>
</defaultKeys>
<arguments>
<argument token="N" description="the offset"/>
</arguments>
</command>
<command name="millis">
<description>Returns the number of milliseconds since engine start.</description>
<examples>
@@ -260,10 +703,6 @@
</examples>
<return token="N" description="the milliseconds"/>
</command>
</identifiers>
</section>
<section name="Game">
<identifiers>
<command name="bind">
<description>Binds a key to a command.</description>
<remarks>
@@ -295,7 +734,7 @@
<arguments>
<argument token="A" description="the command"/>
</arguments>
</command>
</command>
<command name="alias">
<description>Binds a name to commands.</description>
<remarks>
@@ -305,7 +744,7 @@
<remark>
Example: alias myalias [ echo "hello world"; alias myalias [ echo "I already said hello" ] ]
</remark>
</remarks>
</remarks>
<arguments>
<argument token="N" description="the name of the alias" valueNotes="string, must not contain '$'"/>
<argument token="A" description="the commands" valueNotes="string"/>
@@ -344,32 +783,12 @@
<remark>default: left mouse button</remark>
</remarks>
</command>
<command name="jump">
<description>Triggers a jump.</description>
<remarks>
<remark>default keys: space and right mouse.</remark>
</remarks>
</command>
<command name="invmouse">
<description>Sets mouse to "flight sim" mode.</description>
<arguments>
<argument token="B" description="sets invmouse" valueNotes="0 (off), else (on)"/>
</arguments>
</command>
<command name="sensitivity">
<description>Sets the mouse sensitivity.</description>
<remarks>
<remark>
With 'sensitivityscale' you can specify a number that the sensitivity is divided by.
</remark>
</remarks>
<references>
<identifierReference name="sensitivityscale" identifier="sensitivityscale"/>
</references>
<arguments>
<argument token="S" description="the sensitivity" valueNotes="integer"/>
</arguments>
</command>
<command name="fov">
<description>Sets the field of view (fov).</description>
<arguments>
@@ -416,18 +835,13 @@
<description>Takes a screenshot.</description>
<remarks>
<remark>
Writes out "screenshots/screenshotN.bmp", where N is the number of milliseconds since cube was launched.
default key = F12
Screenshots are saved to "screenshots/screenshotN.bmp",
where N is the number of milliseconds since the game was launched.
</remark>
</remarks>
</command>
<command name="screenshot">
<description>Takes a screenshot.</description>
<remarks>
<remark>
Screenshots are saved to "screenshots/screenshotN.bmp",
where N is the number of milliseconds since the game was launched (default key = F12).</remark>
</remarks>
<defaultKeys>
<key alias="F12"/>
</defaultKeys>
</command>
<command name="musicvol">
<description>Sets the music volume.</description>
@@ -482,13 +896,13 @@
</remarks>
<arguments>
<argument token="N" description="the name of a previously defined menu"/>
</arguments>
</arguments>
</command>
<command name="history">
<description>Executes the specified command in the command line history.</description>
<remarks>
<remark>
For example, binding "history 0" to a key allows to quickly repeat the last
For example, binding "history 0" to a key allows to quickly repeat the last
command typed in (useful for placing many identical entities etc.)
</remark>
</remarks>
@@ -512,72 +926,20 @@
<argument token="A" description="the default action"/>
</arguments>
</command>
<variable name="lighterror">
<description>Allows to finetune the amount of "error" the mipmapper/stripifier allow themselves for changing lightlevels.</description>
<command name="sensitivity">
<description>Sets the mouse sensitivity.</description>
<remarks>
<remark>
If this variable is changed this during play,
a "recalc" is needed to see the effect.
With 'sensitivityscale' you can specify a number that the sensitivity is divided by.
</remark>
</remarks>
<references>
<identifierReference identifier="recalc"/>
<identifierReference name="sensitivityscale" identifier="sensitivityscale"/>
</references>
<value token="E" description="the error value, 1 being the best quality" minValue="1" maxValue="100" defaultValue="8" readOnly="false"/>
</variable>
<variable name="dynlight">
<description>Determines wether dynamic shadows and lights are rendered, providedjust incase they slow your fps down too much.</description>
<remarks>
<remark>
With radius you can specify the radius of a dynamic light,
smaller to maybe gain some speed (0 is off entirely),
or bigger to see the effect of dynamic shadows more dramatically
(try shooting it past some pillars that have a dark area on the other side... or use the "gamespeed" variable).
</remark>
</remarks>
<value token="R" description="the radius of a dynamic light" minValue="0" maxValue="32" defaultValue="16"/>
</variable>
<variable name="watersubdiv">
<description>Determines the subdivision of the water surface in maps.</description>
<remarks>
<remark>
Must be a power of 2: 4 is the default, 8 is recommended for people on slow machines,
2 is nice for fast machines, and 1 is quite OTT. See "waterlevel" (edit reference)
on how to add water to your own levels.
</remark>
</remarks>
<value token="N" description="the subdivisioin value" minValue="1" maxValue="64" defaultValue="4"/>
</variable>
<variable name="soundvol">
<description>Sets the sound volume.</description>
<value token="N" description="the volume" minValue="0" maxValue="255" defaultValue="155"/>
</variable>
<variable name="soundbufferlen">
<description>Sets the sound buffer length.</description>
<remarks>
<remark>
Tweak this if you experience stuttering or lagging sound.
</remark>
</remarks>
<value token="N" description="the buffer length" minValue="128" maxValue="4096" defaultValue="1024"/>
</variable>
<variable name="gamma">
<description>Sets the hardware gamma value.</description>
<remarks>
<remark>
May not work if your card/driver doesn't support it.
</remark>
</remarks>
<value token="N" description="the gamma value" minValue="30" maxValue="300" defaultValue="100"/>
</variable>
<variable name="hidestats">
<description>Turns on/off display of fps/rendering stats on the HUD.</description>
<value token="B" description="Turns the stats off (1) or on (0)" minValue="0" maxValue="1" defaultValue="1"/>
</variable>
<variable name="maxroll">
<description>Sets the maximum value the display will roll on strafing.</description>
<value token="N" description="the roll value" minValue="0" maxValue="20" defaultValue="0"/>
</variable>
<arguments>
<argument token="S" description="the sensitivity" valueNotes="integer"/>
</arguments>
</command>
<variable name="crosshairsize">
<description>Sets the size of your crosshair.</description>
<remarks>
@@ -595,6 +957,89 @@
</remark>
</remarks>
<value token="B" description="Turns the effects on (1) or off (0)" minValue="0" maxValue="1" defaultValue="1"/>
</variable>
<variable name="maxroll">
<description>Sets the maximum value the display will roll on strafing.</description>
<value token="N" description="the roll value" minValue="0" maxValue="20" defaultValue="0"/>
</variable>
<variable name="lighterror">
<description>Allows to finetune the amount of "error" the mipmapper/stripifier allow themselves for changing lightlevels.</description>
<remarks>
<remark>
If this variable is changed this during play,
a "recalc" is needed to see the effect.
</remark>
</remarks>
<references>
<identifierReference identifier="recalc"/>
</references>
<value token="E" description="the error value, 1 being the best quality" minValue="1" maxValue="100" defaultValue="8" readOnly="false"/>
</variable>
<variable name="autoreload">
<description>Indicates if the weapons should be reloaded automatically.</description>
<value token="B" description="the autoreload state" minValue="0" maxValue="1" defaultValue="1" valueNotes="on (1), off (0)"/>
</variable>
<variable name="dynlight">
<description>Determines wether dynamic shadows and lights are rendered, providedjust incase they slow your fps down too much.</description>
<remarks>
<remark>
With radius you can specify the radius of a dynamic light,
smaller to maybe gain some speed (0 is off entirely),
or bigger to see the effect of dynamic shadows more dramatically
(try shooting it past some pillars that have a dark area on the other side... or use the "gamespeed" variable).
</remark>
</remarks>
<value token="R" description="the radius of a dynamic light" minValue="0" maxValue="32" defaultValue="16"/>
</variable>
<variable name="watersubdiv">
<description>Determines the subdivision of the water surface in maps.</description>
<remarks>
<remark>
Must be a power of 2: 4 is the default, 8 is recommended for people on slow machines,
2 is nice for fast machines, and 1 is quite OTT. See "waterlevel" (edit reference)
on how to add water to your own levels.
</remark>
</remarks>
<value token="N" description="the subdivisioin value" minValue="1" maxValue="64" defaultValue="4"/>
</variable>
<variable name="soundvol">
<description>Sets the sound volume.</description>
<value token="N" description="the volume" minValue="0" maxValue="255" defaultValue="155"/>
</variable>
<variable name="rate">
<description>Sets the clients maximum downstream bandwidth.</description>
<remarks>
<remark>
Leaving it at 0 (the default) means the server will dynamically try to do the best thing,
this is recommended for players who don't have a clue what their bandwidth is
(setting your rate unoptimally is worse than not setting it all).
Modem players (56k) could try rate 4000 and tweak from there, dsl players can try rate 6000-10000.
Note that the more players on a server, the more critical the effect of your rate.
If you are tweak addicted, you can try playing with the variables throttle_decel
(how quickly to start dropping packets when your connection becomes bandwidth limited)
throttle_accel (how quickly to recover once bandwidth becomes available again) and
throttle_interval (how quickly to reestimate the situation). Change the defaults at your own risk.
</remark>
</remarks>
<value token="N" description="the bytes per second" minValue="0" maxValue="25000" defaultValue="0"/>
</variable>
<variable name="soundbufferlen">
<description>Sets the sound buffer length.</description>
<remarks>
<remark>
Tweak this if you experience stuttering or lagging sound.
</remark>
</remarks>
<value token="N" description="the buffer length" minValue="128" maxValue="4096" defaultValue="1024"/>
</variable>
<variable name="gamma">
<description>Sets the hardware gamma value.</description>
<remarks>
<remark>
May not work if your card/driver doesn't support it.
</remark>
</remarks>
<value token="N" description="the gamma value" minValue="30" maxValue="300" defaultValue="100"/>
</variable>
<variable name="lightscale">
<description>Used to finetune the "overbright lighting" rendering feature when enabled.</description>
@@ -616,27 +1061,6 @@
</section>
<section name="Editing">
<identifiers>
<!--
<variable>
<description></description>
<remarks>
<remark>
</remark>
</remarks>
<value/>
</variable>
<command name="">
<description></description>
<remarks>
<remark></remark>
</remarks>
<arguments>
<argument/>
</arguments>
</command>
-->
<command name="edittoggle">
<description><![CDATA[switches between map edit mode and normal.]]></description>
<remarks>
@@ -759,10 +1183,13 @@
In both cases, the corner will orient itself automatically depending on its neighbours, behaviour with other
configurations than the 2 above is unspecified. Since the latter configuration generates possibly 2 floor and
2 ceiling levels, up to 4 textures are used: for example for the 2 floors the higher one will of the cube
itself, and the lower one of a neighbouring low cube. Default key = k you can make bigger corners at once by
pressing "corner" on grid aligned 2x2/4x4/8x8 selections, with equal size solid blocks next to them.
itself, and the lower one of a neighbouring low cube. You can make bigger corners at once by
issuing "corner" on grid aligned 2x2/4x4/8x8 selections, with equal size solid blocks next to them.
</remark>
</remarks>
<defaultKeys>
<key alias="K"/>
</defaultKeys>
</command>
<command name="undo">
<description>Multi-level undo of any of the changes caused by editing operations</description>
@@ -962,25 +1389,6 @@
<remark>hotkey R</remark>
</remarks>
</command>
<command name="map">
<description>Loads up a map in the gamemode set previously by the 'mode' command.</description>
<remarks>
<remark>
A map given as "blah" refers to "packages/base/blah.cgz", "mypackage/blah" refers to "packages/mypackage/blah.cgz".
At every map load, "config/default_map_settings.cfg" is loaded which sets up all texture definitions, etc. Everything
defined in there can be overridden per package or per map by creating a "package.cfg" or "mapname.cfg" which
contains whatever you want to do differently from the default.
</remark>
<remark>
When the map finishes it will load the next map when one is defined, otherwise reloads the current map.
You can define what map follows a particular map by making an alias like (in the map script): alias nextmap_blah1 blah2
(loads "blah2" after "blah1").
</remark>
</remarks>
<arguments>
<argument token="M" description="name of the map to load" valueNotes="string"/>
</arguments>
</command>
<command name="savemap">
<description>Saves the current map.</description>
<remarks>
+33 -4
View File
@@ -50,6 +50,12 @@
<xs:maxLength value="128" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="keyAliasType">
<xs:restriction base="xs:string">
<xs:maxLength value="16" />
</xs:restriction>
</xs:simpleType>
<!-- complex types -->
@@ -91,17 +97,31 @@
<xs:complexType name="variableArgumentValueDescriptionType">
<xs:complexContent>
<xs:extension base="argumentValueDescriptionType">
<xs:attribute name="token" type="tokenType" fixed="..."/> <!-- damned web browsers don't use it, needs to be set manually in the doc -->
<xs:attribute name="token" type="tokenType" default="..."/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="argumentValueDescriptionCollectionType">
<xs:sequence>
<xs:element name="argument" type="argumentValueDescriptionType" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="argument" type="argumentValueDescriptionType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="variableArgument" type="variableArgumentValueDescriptionType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<!-- keys -->
<xs:complexType name="keyType">
<xs:attribute name="alias" type="keyAliasType" use="required"/>
<xs:attribute name="name" type="nameType" use="optional"/>
<xs:attribute name="description" type="descriptionType" use="optional"/>
</xs:complexType>
<xs:complexType name="keyCollectionType">
<xs:sequence>
<xs:element name="key" type="keyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- references -->
@@ -125,6 +145,14 @@
</xs:complexContent>
</xs:complexType>
<xs:complexType name="wikiReferenceType">
<xs:complexContent>
<xs:extension base="referenceType">
<xs:attribute name="article" use="required" type="urlType"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="referenceCollectionType">
<xs:sequence>
<xs:element name="identifierReference" type="identifierReferenceType" minOccurs="0" maxOccurs="unbounded"/>
@@ -163,6 +191,7 @@
<xs:element name="remarks" type="remarkCollectionType" minOccurs="0" maxOccurs="1"/>
<xs:element name="examples" type="exampleCollectionType" minOccurs="0" maxOccurs="1"/>
<xs:element name="references" type="referenceCollectionType" minOccurs="0" maxOccurs="1"/>
<xs:element name="defaultKeys" type="keyCollectionType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="nameType"/>
</xs:complexType>
@@ -172,7 +201,7 @@
<xs:element name="command" type="commandType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="variable" type="variableType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="sort" type="xs:boolean" default="false"/>
<xs:attribute name="sort" type="xs:boolean" default="true"/>
</xs:complexType>
<xs:complexType name="commandType">
@@ -210,7 +239,7 @@
<xs:sequence>
<xs:element name="section" type="sectionType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="sort" type="xs:boolean" default="false"/>
<xs:attribute name="sort" type="xs:boolean" default="true"/>
</xs:complexType>
<!-- document root -->
+3 -1
View File
@@ -1,6 +1,8 @@
/* ZLIB licensed, (C) 2007 Adrian 'driAn' Henke, http://www.sprintf.org */
/* common styles for all AC xhtml documentation pages */
/*
common styles for all documentation pages
*/
/* main layout */
+5 -115
View File
@@ -1,122 +1,12 @@
/* (C) Adrian Henke 2007 - ZLIB License */
/* ZLIB licensed, (C) 2007 Adrian 'driAn' Henke, http://www.sprintf.org */
/*
styles for the readme
*/
@import url(ac.css);
/*
html
{
background-color: #343434; /* blame firefox' buggy xslt support
}
body
{
font-family: Verdana, Sans-Serif;
margin: 0px;
padding: 10px 0 10px 0;
font-size: 12px;
color: Black;
}
ul
{
list-style-type:square;
}
p
{
margin-top: 0;
margin-bottom: 1em;
}
img
{
border-width: 0;
}
pre
{
margin: 0 0 1em 0;
padding: 0;
font-family: Courier New;
font-size: 12px;
}
table
{
margin-bottom: 1em;
}
h1
{
font-size: 24px;
margin: 0 0 0.5em 0;
}
h2
{
font-size: 18px;
margin: 0 0 0.5em 0;
}
h3
{
font-size: 14px;
margin: 0 0 0.5em 0;
}
#main
{
background-color: #666666;
width: 650px;
margin: 0;
padding: 10px;
text-align: left;
border: solid 1px black;
}
#header
{
background-color: black;
width: 650px;
margin: 0px;
padding: 0;
height: 10px;
text-align: right;
font-size: 10px;
color: White;
font-family: Courier New, Sans-Serif;
line-height: 1em;
}
#footer
{
background-color: black;
width: 650px;
margin: 0;
padding: 0;
height: 10px;
text-align: right;
font-size: 10px;
color: White !important;
font-family: Courier New, Sans-Serif;
line-height: 1em;
}
#footer a, #footer a:hover, #footer a:visited
{
color: White;
text-decoration: none;
}
a, a:hover, a:visited
{
color: #333333;
}
*/
/* guns */
table#guns td
+35 -2
View File
@@ -1,7 +1,40 @@
/* (C) 2007 Adrian 'driAn' Henke - http://www.sprintf.org - ZLIB licensed */
/* ZLIB licensed, (C) 2007 Adrian 'driAn' Henke, http://www.sprintf.org */
/*
styles for the reference
*/
@import url(ac.css);
/* fix positioned menu */
div#fixedmenu a
{
visibility: hidden;
position: fixed;
padding: 5px;
left: 10px;
bottom: 10px;
font-size: 16px;
font-family: Courier New, Sans-Serif;
font-weight: bold;
text-decoration: none;
border: solid 2px black;
background-color: #444444;
color: Black;
}
body > div#fixedmenu a /* broken browsers will ignore this and therefore keep the menu hidden */
{
visibility: visible;
}
div#fixedmenu a:hover
{
background-color: #555555;
}
/* side contentspanel */
div#contentspanel
@@ -49,6 +82,7 @@ div#contentspanel div.identifiers a
display: block;
position: relative;
width: 130px;
overflow: hidden;
}
div#contentspanel div.identifiers a:hover
@@ -205,7 +239,6 @@ div.section div.identifier div.remarks div.remark
div.section div.identifier div.references
{
text-align: right;
}
div.section div.identifier div.references a.internal
+4
View File
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- ZLIB licensed, (C) 2007 Adrian 'driAn' Henke, http://www.sprintf.org -->
<!--
embeds a single xhtml documentation page into a common layout
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:h="http://www.w3.org/1999/xhtml">
<xsl:output method="html" omit-xml-declaration="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
+58 -13
View File
@@ -1,16 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- (C) 2007 Adrian 'driAn' Henke - http://www.sprintf.org - ZLIB licensed -->
<!-- ZLIB licensed, (C) 2007 Adrian 'driAn' Henke, http://www.sprintf.org -->
<!--
transforms a cuberef document to a cubescript document
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:r="http://cubers.net/Schemas/CubeRef/Reference" xmlns:t="http://cubers.net/Schemas/CubeRef/Types">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://cubers.net/Schemas/CubeRef">
<xsl:output method="text" encoding="utf-8"/>
<!-- horizontal tab -->
<xsl:variable name="indent">
<xsl:text>&#09;</xsl:text>
</xsl:variable>
<xsl:template match="/r:cuberef">
<xsl:text>// auto generated script to make the command reference readable for AssaultCube&#13;&#10;</xsl:text>
<!-- line feed, CRLF (dos/win) -->
<xsl:variable name="newline">
<xsl:text>&#13;&#10;</xsl:text>
</xsl:variable>
<xsl:template match="/t:cuberef">
<xsl:text>// auto generated script to make the doc reference readable for Cube games, see the 'docs/cuberef.txt'</xsl:text>
<xsl:value-of select="$newline"/>
<!-- sections -->
<xsl:for-each select="t:sections/t:section">
@@ -18,21 +29,22 @@
<xsl:text>[</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>]</xsl:text>
<xsl:text>&#13;&#10; &#13;&#10;</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
<!-- identifiers -->
<xsl:for-each select="t:identifiers/*">
<xsl:sort select="@name"/> <!-- always sort to avoid axcessive sorting inside the Cube games -->
<xsl:text>docident </xsl:text>
<xsl:text>[</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>] [</xsl:text>
<xsl:value-of select="normalize-space(t:description)"/>
<xsl:text>];</xsl:text>
<xsl:text>&#13;&#10;</xsl:text>
<xsl:value-of select="$newline"/>
<!-- argument descriptions -->
<xsl:for-each select="t:arguments/t:argument">
<xsl:for-each select="t:arguments/*">
<xsl:text>docargument </xsl:text>
<xsl:text>[</xsl:text>
<xsl:value-of select="@token"/>
@@ -40,8 +52,17 @@
<xsl:value-of select="@description"/>
<xsl:text>] [</xsl:text>
<xsl:value-of select="@valueNotes"/>
<xsl:text>] [</xsl:text>
<xsl:choose>
<xsl:when test="local-name() = 'variableArgument'">
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>];</xsl:text>
<xsl:text>&#13;&#10;</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:for-each>
<!-- var descriptions (fake arg) -->
@@ -70,7 +91,7 @@
</xsl:otherwise>
</xsl:choose>
<xsl:text>];</xsl:text>
<xsl:text>&#13;&#10;</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:if>
<!-- remarks -->
@@ -79,7 +100,31 @@
<xsl:text>[</xsl:text>
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>];</xsl:text>
<xsl:text>&#13;&#10;</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:for-each>
<!-- examples -->
<xsl:for-each select="t:examples/*">
<xsl:text>docexample </xsl:text>
<xsl:text>[</xsl:text>
<xsl:value-of select="normalize-space(t:code)"/>
<xsl:text>] [</xsl:text>
<xsl:value-of select="normalize-space(t:explanation)"/>
<xsl:text>];</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:for-each>
<!-- default keys -->
<xsl:for-each select="t:defaultKeys/*">
<xsl:text>dockey </xsl:text>
<xsl:text>[</xsl:text>
<xsl:value-of select="@alias"/>
<xsl:text>] [</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>] [</xsl:text>
<xsl:value-of select="@description"/>
<xsl:text>];</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:for-each>
<!-- references -->
@@ -92,10 +137,10 @@
<xsl:text>] [</xsl:text>
<xsl:value-of select="@url"/>
<xsl:text>];</xsl:text>
<xsl:text>&#13;&#10;</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:for-each>
<xsl:text> &#13;&#10;</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:for-each>
</xsl:for-each>
+64 -15
View File
@@ -8,6 +8,22 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://cubers.net/Schemas/CubeRef">
<xsl:output method="html" omit-xml-declaration="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
<xsl:template match="t:key">
<xsl:choose>
<xsl:when test="@name">
<xsl:value-of select="@name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@alias"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@description">
<xsl:text>, </xsl:text>
<xsl:value-of select="@description"/>
</xsl:if>
</xsl:template>
<xsl:template name="identifierLink">
<a>
@@ -15,6 +31,9 @@
<xsl:text>#identifier_</xsl:text>
<xsl:value-of select="translate(@name, ' ', '_')"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</xsl:template>
@@ -30,6 +49,9 @@
</head>
<body>
<div id="fixedmenu">
<a href="#">TOP</a>
</div>
<div id="main">
<!-- version -->
@@ -48,7 +70,7 @@
<div id="contentspanel">
<xsl:if test="t:sections">
<xsl:for-each select="t:sections/t:section">
<xsl:sort select="@name[../../@sort = 'true' or ../../@sort = '1']"/>
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
<div class="sectiontitle">
<a>
<xsl:attribute name="href">
@@ -62,7 +84,7 @@
<xsl:if test="t:identifiers">
<ul>
<xsl:for-each select="t:identifiers/*">
<xsl:sort select="@name[../../@sort = 'true' or ../../@sort = '1']"/>
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
<li>
<xsl:call-template name="identifierLink"/>
</li>
@@ -89,7 +111,7 @@
</p>
<ul>
<xsl:for-each select="t:sections/t:section">
<xsl:sort select="@name[../../@sort = 'true' or ../../@sort = '1']"/>
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
<li>
<a>
<xsl:attribute name="href">
@@ -105,7 +127,7 @@
<!-- sections -->
<xsl:for-each select="t:sections/t:section">
<xsl:sort select="@name[../../@sort = 'true' or ../../@sort = '1']"/>
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
<div class="section">
<h2>
<!-- section anchor -->
@@ -123,7 +145,9 @@
<!-- identifiers -->
<xsl:for-each select="t:identifiers/*">
<xsl:sort select="@name[../../@sort = 'true' or ../../@sort = '1']"/>
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
<xsl:variable name="readOnly" select="t:value/@readOnly and (t:value/@readOnly = 'true' or t:value/@readOnly = '1')"/>
<div class="identifier">
<!-- identifier anchor -->
<xsl:attribute name="id">
@@ -142,7 +166,7 @@
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:when>
<xsl:when test="t:value and t:value/@token and t:value/@readOnly != 'true' and t:value/@readOnly != '1'"><!-- variable value -->
<xsl:when test="t:value and not($readOnly)"><!-- variable value -->
<xsl:text> </xsl:text>
<xsl:value-of select="t:value/@token"/>
</xsl:when>
@@ -156,7 +180,7 @@
<!-- arguments or value description -->
<xsl:choose>
<xsl:when test="t:arguments"><!-- command args -->
<xsl:when test="t:arguments/*"><!-- command args -->
<div class="argumentDescriptions">
<table>
<tr>
@@ -171,6 +195,9 @@
</td>
<td class="description">
<xsl:value-of select="@description"/>
<xsl:if test="@optional">
<xsl:text> (optional)</xsl:text>
</xsl:if>
</td>
<td class="values">
<xsl:value-of select="@valueNotes"/>
@@ -184,10 +211,10 @@
<div class="valueDescription">
<table>
<tr>
<xsl:if test="t:value/@token and t:value/@readOnly != 'true' and t:value/@readOnly != '1'">
<th>
Token
</th>
<xsl:if test="not($readOnly)">
<th>
Token
</th>
</xsl:if>
<th>
Description
@@ -197,7 +224,7 @@
<th>Default</th>
</tr>
<tr>
<xsl:if test="t:value/@token and t:value/@readOnly != 'true' and t:value/@readOnly != '1'">
<xsl:if test="not($readOnly)">
<td class="token">
<xsl:value-of select="t:value/@token"/>
</td>
@@ -234,7 +261,6 @@
</xsl:if>
<!-- examples -->
<xsl:if test="t:examples">
<div class="examples">
<xsl:for-each select="t:examples/t:example">
@@ -255,11 +281,31 @@
</div>
</xsl:if>
<!-- default keys -->
<xsl:if test="t:defaultKeys/*">
<div class="defaultKeys">
<xsl:choose>
<xsl:when test="count(t:defaultKeys/*) = 1">
<xsl:text>default key: </xsl:text>
<xsl:apply-templates select="t:defaultKeys/*"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>default keys:</xsl:text>
<br/>
<xsl:for-each select="t:defaultKeys/*">
<xsl:apply-templates select="."/>
<br/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
<!-- references -->
<xsl:if test="t:references">
<div class="references">
see also:
<!-- refer to internal resource (identifier anchor) -->
<!-- refer to identifiers (identifier anchor) -->
<xsl:for-each select="t:references/t:identifierReference">
<a>
<xsl:attribute name="href">
@@ -276,8 +322,11 @@
</xsl:otherwise>
</xsl:choose>
</a>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<!-- refer to external resource -->
<!-- refer to web resources -->
<xsl:for-each select="t:references/t:webReference">
<a>
<xsl:attribute name="href">
+2 -16
View File
@@ -3,20 +3,6 @@
#include "cube.h"
enum { ID_VAR, ID_COMMAND, ID_ALIAS };
struct ident
{
int type; // one of ID_* above
char *name;
int min, max; // ID_VAR
int *storage; // ID_VAR
void (*fun)(); // ID_VAR, ID_COMMAND
int narg; // ID_VAR, ID_COMMAND
char *action, *executing; // ID_ALIAS
bool persist;
};
void itoa(char *s, int i) { s_sprintf(s)("%d", i); }
char *exchangestr(char *o, char *n) { delete[] o; return newstring(n); }
@@ -365,7 +351,7 @@ void writecfg()
COMMAND(writecfg, ARG_NONE);
void identnames(vector<char *> &names)
void identnames(vector<char *> &names, bool builtinonly)
{
enumerateht(*idents) names.add(idents->enumc->key);
enumerateht(*idents) if(!builtinonly || idents->enumc->data.type != ID_ALIAS) names.add(idents->enumc->key);
}
+14
View File
@@ -1,3 +1,17 @@
enum { ID_VAR, ID_COMMAND, ID_ALIAS };
struct ident
{
int type; // one of ID_* above
char *name;
int min, max; // ID_VAR
int *storage; // ID_VAR
void (*fun)(); // ID_VAR, ID_COMMAND
int narg; // ID_VAR, ID_COMMAND
char *action, *executing; // ID_ALIAS
bool persist;
};
enum // function signatures for script functions, see command.cpp
{
ARG_1INT, ARG_2INT, ARG_3INT, ARG_4INT,
+12
View File
@@ -278,6 +278,18 @@ void keypress(int code, bool isdown, int cooked)
case SDLK_v:
if(SDL_GetModState()&(KMOD_LCTRL|KMOD_RCTRL)) { pasteconsole(); return; }
case SDLK_F1:
toggledoc();
break;
case SDLK_F2:
scrolldoc(-4);
break;
case SDLK_F3:
scrolldoc(4);
break;
default:
resetcomplete();
if(cooked)
+250 -47
View File
@@ -4,22 +4,37 @@
void renderdocsection(void *menu, bool init);
extern hashtable<char *, ident> *idents;
struct docargument
{
char *token, *desc, *values;
bool vararg;
};
struct docref
{
char *name, *ident, *url;
char *name, *ident, *url, *article;
};
struct docexample
{
char *code, *explanation;
};
struct dockey
{
char *alias, *name, *desc;
};
struct docident
{
char *name, *desc;
vector<docargument> arguments;
vector<char *> remarks;
cvector remarks;
vector<docref> references;
vector<docexample> examples;
vector<dockey> keys;
};
struct docsection
@@ -29,7 +44,7 @@ struct docsection
};
vector<docsection> sections;
hashtable<char *, docident> docidents; // manage globally instead of a section tree because cmds must be unique
hashtable<char *, docident> docidents; // manage globally instead of a section tree to ensure uniqueness
docsection *lastsection = NULL;
docident *lastident = NULL;
@@ -53,13 +68,14 @@ void adddocident(char *name, char *desc)
lastident = &c;
}
void adddocargument(char *token, char *desc, char *values)
void adddocargument(char *token, char *desc, char *values, char *vararg)
{
if(!token || !desc || !lastident) return;
if(!lastident || !token || !desc) return;
docargument &a = lastident->arguments.add();
a.token = newstring(token);
a.desc = newstring(desc);
a.values = values && strlen(values) ? newstring(values) : NULL;
a.vararg = vararg && atoi(vararg) == 1 ? true : false;
}
void adddocremark(char *remark)
@@ -68,29 +84,93 @@ void adddocremark(char *remark)
lastident->remarks.add(newstring(remark));
}
void adddocref(char *name, char *ident, char *url)
void adddocref(char *name, char *ident, char *url, char *article)
{
if(!lastident || !name) return;
docref &r = lastident->references.add();
r.name = newstring(name);
r.ident = ident && strlen(ident) ? newstring(ident) : NULL;
r.url = url && strlen(url) ? newstring(url) : NULL;
r.article = article && strlen(article) ? newstring(article) : NULL;
}
void adddocexample(char *code, char *explanation)
{
if(!lastident || !code) return;
docexample &e = lastident->examples.add();
e.code = newstring(code);
e.explanation = explanation && strlen(explanation) ? newstring(explanation) : NULL;
}
void adddockey(char *alias, char *name, char *desc)
{
if(!lastident || !alias) return;
dockey &k = lastident->keys.add();
k.alias = newstring(alias);
k.name = name && strlen(name) ? newstring(name) : NULL;
k.desc = desc && strlen(desc) ? newstring(desc) : NULL;
}
COMMANDN(docsection, adddocsection, ARG_1STR);
COMMANDN(docident, adddocident, ARG_2STR);
COMMANDN(docargument, adddocargument, ARG_4STR);
COMMANDN(docremark, adddocremark, ARG_1STR);
COMMANDN(docref, adddocref, ARG_3STR);
COMMANDN(docexample, adddocexample, ARG_2STR);
COMMANDN(dockey, adddockey, ARG_3STR);
int stringsort(const char **a, const char **b) { return strcmp(*a, *b); }
void doctodo()
char *cvecstr(vector<char *> &cvec, char *substr, int *rline = NULL)
{
vector<char *> inames;
identnames(inames);
char *r = NULL;
loopv(cvec) if(cvec[i]) if((r = strstr(cvec[i], substr)) != NULL)
{
if(rline) *rline = i;
break;
}
return r;
}
void docundone(int allidents)
{
cvector inames;
identnames(inames, !(allidents > 0));
inames.sort(stringsort);
loopv(inames)
{
docident *id = docidents.access(inames[i]);
if(id) // search for substrings that indicate undoneness
{
cvector srch;
srch.add(id->name);
srch.add(id->desc);
loopvj(id->remarks) srch.add(id->remarks[j]);
loopvj(id->arguments)
{
srch.add(id->arguments[j].token);
srch.add(id->arguments[j].desc);
srch.add(id->arguments[j].values);
}
loopvj(id->references)
{
srch.add(id->references[j].ident);
srch.add(id->references[j].name);
srch.add(id->references[j].url);
}
if(!cvecstr(srch, "TODO") && !cvecstr(srch, "UNDONE")) continue;
}
conoutf(inames[i]);
}
}
void docinvalid()
{
cvector inames;
identnames(inames, true);
inames.sort(stringsort);
conoutf("documentation TODO");
conoutf("undocumented identifiers:");
loopv(inames) if(!docidents.access(inames[i])) conoutf(inames[i]);
conoutf("documented but unimplemented identifiers:");
enumerateht(docidents) if(!strchr(docidents.enumc->data.name, ' ') && !identexists(docidents.enumc->data.name))
conoutf(docidents.enumc->data.name);
conoutf("done");
}
void docfind(char *search)
@@ -98,30 +178,111 @@ void docfind(char *search)
enumerateht(docidents)
{
docident &i = docidents.enumc->data;
vector<char *> searchstrings;
searchstrings.add(i.name);
searchstrings.add(i.desc);
loopvk(i.remarks) searchstrings.add(i.remarks[k]);
loopvk(searchstrings)
cvector srch;
srch.add(i.name);
srch.add(i.desc);
loopvk(i.remarks) srch.add(i.remarks[k]);
char *r;
int rline;
if(r = cvecstr(srch, search, &rline))
{
char *r = strstr(searchstrings[k], search);
if(!r) continue;
const int matchchars = 200;
string match;
s_strncpy(match, r-searchstrings[k] > matchchars/2 ? r-matchchars/2 : searchstrings[k], matchchars/2);
conoutf("%s\t%s", i.name, match);
s_strncpy(match, r-srch[rline] > matchchars/2 ? r-matchchars/2 : srch[rline], matchchars/2);
conoutf("%-20s%s", i.name, match);
}
}
}
COMMANDN(docsection, adddocsection, ARG_1STR);
COMMANDN(docident, adddocident, ARG_3STR);
COMMANDN(docargument, adddocargument, ARG_3STR);
COMMANDN(docremark, adddocremark, ARG_1STR);
COMMANDN(docref, adddocref, ARG_3STR);
COMMAND(doctodo, ARG_NONE);
char *xmlstringenc(char *d, const char *s, size_t len)
{
if(!d || !s) return NULL;
struct spchar { char c; char repl[8]; } const spchars[] = { {'&', "&amp;"}, {'<', "&lt;"}, {'>', "gt;"}, {'"', "&quot;"}, {'\'', "&apos;"}};
char *dc = d;
const char *sc = s;
while(*sc && (size_t)(dc - d) < len - 1)
{
bool specialc = false;
loopi(sizeof(spchars)/sizeof(spchar)) if(spchars[i].c == *sc)
{
specialc = true;
size_t rlen = strlen(spchars[i].repl);
if(dc - d + rlen <= len - 1)
{
memcpy(dc, spchars[i].repl, rlen);
dc += rlen;
break;
}
}
if(!specialc) memcpy(dc++, sc, 1);
*dc = 0;
sc++;
}
return d;
}
void docwritebaseref(char *ref, char *schemalocation, char *transformation)
{
s_sprintfd(outfile)("docs%cautogenerated_base_reference.xml", PATHDIV);
FILE *f = fopen(outfile, "w");
if(!f) return;
char desc[] = "<description>TODO: Description</description>";
fprintf(f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
fprintf(f, "<?xml-stylesheet type=\"text/xsl\" href=\"%s\"?>\n", transformation && strlen(transformation) ? transformation : "transformations/cuberef2xhtml.xslt");
fprintf(f, "<cuberef name=\"%s\" version=\"v0.1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"%s\" xmlns=\"http://cubers.net/Schemas/CubeRef\">\n", ref && strlen(ref) ? ref : "Unnamed Reference", schemalocation && strlen(schemalocation) ? schemalocation : "http://cubers.net/Schemas/CubeRef schemas/cuberef.xsd");
fprintf(f, "\t%s\n", desc);
fprintf(f, "\t<sections>\n");
fprintf(f, "\t\t<section name=\"Main\">\n");
fprintf(f, "\t\t\t%s\n", desc);
fprintf(f, "\t\t\t<identifiers>\n");
string name;
enumerateht(*idents)
{
ident &id = idents->enumc->data;
if(id.type != ID_COMMAND) continue;
fprintf(f, "\t\t\t\t<command name=\"%s\">\n", xmlstringenc(name, id.name, _MAXDEFSTR));
fprintf(f, "\t\t\t\t\t%s\n", desc);
if(id.narg != ARG_NONE && id.narg != ARG_DOWN)
{
fprintf(f, "\t\t\t\t\t<arguments>\n");
if(id.narg == ARG_VARI) fprintf(f, "\t\t\t\t\t\t<variableArgument token=\"...\" description=\"TODO\"/>\n");
else
{
int base = id.narg >= ARG_1EST ? ARG_1EST : (id.narg >= ARG_1EXP ? ARG_1EXP : (id.narg >= ARG_1STR ? ARG_1STR : ARG_1INT));
loopj(id.narg-base+1) fprintf(f, "\t\t\t\t\t\t<argument token=\"%c\" description=\"TODO\"/>\n", (char)(*"A")+j);
}
fprintf(f, "\t\t\t\t\t</arguments>\n");
}
fprintf(f, "\t\t\t\t</command>\n");
}
enumerateht(*idents)
{
ident &id = idents->enumc->data;
if(id.type != ID_VAR) continue;
fprintf(f, "\t\t\t\t<%variable name=\"%s\">\n", xmlstringenc(name, id.name, _MAXDEFSTR));
fprintf(f, "\t\t\t\t\t<description>TODO</description>\n");
fprintf(f, "\t\t\t\t\t<value %s description=\"TODO\" minValue=\"%i\" maxValue=\"%i\" defaultValue=\"%i\" %s/>\n", id.min>id.max ? "" : "token=\"N\"", id.min, id.max, *id.storage, id.min>id.max ? "readOnly=\"true\"" : "");
fprintf(f, "\t\t\t\t</variable>\n");
}
fprintf(f, "\t\t\t</identifiers>\n\t\t</section>\n\t</sections>\n</cuberef>\n");
fclose(f);
}
COMMAND(docundone, ARG_1INT);
COMMAND(docinvalid, ARG_NONE);
COMMAND(docfind, ARG_1STR);
VAR(loaddoc, 0, 1, 1);
COMMAND(docwritebaseref, ARG_3STR);
VAR(docvisible, 0, 1, 1);
VAR(docskip, 0, 0, 1000);
void toggledoc() { docvisible = !docvisible; }
void scrolldoc(int i) { docskip += i; if(docskip < 0) docskip = 0; }
int numargs(char *args)
{
@@ -149,6 +310,8 @@ int numargs(char *args)
void renderdoc(int x, int y)
{
if(!docvisible) return;
char *exp = getcurcommand();
if(!exp || *exp != '/' || strlen(exp) < 2) return;
@@ -165,7 +328,7 @@ void renderdoc(int x, int y)
if(ident)
{
const int linemax = VIRTW*4/3;
vector<char *> doclines;
cvector doclines;
char *label = doclines.add(newstringbuf(ident->name)); // label
loopvj(ident->arguments)
@@ -175,7 +338,7 @@ void renderdoc(int x, int y)
}
doclines.add(NULL);
vector<char *> desc;
cvector desc;
text_block(ident->desc, linemax, desc); // desc
loopvj(desc) doclines.add(desc[j]);
doclines.add(NULL);
@@ -201,11 +364,14 @@ void renderdoc(int x, int y)
}
else arg = numargs(args);
if(arg >= 0)
if(arg >= 0) // multipart idents need a fixed argument offset
{
char *c = cmd;
while((c = strchr(c, ' ')) && c++) arg--; // multipart idents need a fixed argument offset
while((c = strchr(c, ' ')) && c++) arg--;
}
// fixes offset for var args
if(arg >= ident->arguments.length() && ident->arguments.last().vararg) arg = ident->arguments.length() - 1;
}
loopvj(ident->arguments)
@@ -216,25 +382,54 @@ void renderdoc(int x, int y)
s_sprintf(argstr)("\f%d%-8s%s %s%s%s", j == arg ? 4 : 5, a->token, a->desc,
a->values ? "(" : "", a->values ? a->values : "", a->values ? ")" : "");
}
}
doclines.add(NULL);
if(ident->remarks.length()) loopvj(ident->remarks) // remarks
doclines.add(NULL);
}
if(ident->remarks.length()) // remarks
{
vector<char *> remarks;
text_block(ident->remarks[j], linemax, remarks);
loopvk(remarks) doclines.add(remarks[k]);
loopvj(ident->remarks)
{
cvector remarks;
text_block(ident->remarks[j], linemax, remarks);
loopvk(remarks) doclines.add(remarks[k]);
}
doclines.add(NULL);
}
doclines.add(NULL);
if(ident->references.length()) // refs
if(ident->examples.length()) // examples
{
doclines.add(ident->examples.length() == 1 ? "Example:" : "Examples:");
loopvj(ident->examples)
{
cvector lines;
text_block(ident->examples[j].code, linemax, lines);
text_block(ident->examples[j].explanation, linemax, lines);
loopvk(lines) doclines.add(lines[k]);
}
doclines.add(NULL);
}
if(ident->keys.length()) // default keys
{
doclines.add(ident->keys.length() == 1 ? "Default key:" : "Default keys:");
loopvj(ident->keys)
{
dockey &k = ident->keys[j];
s_sprintfd(line)("%-10s %s", k.name ? k.name : k.alias, k.desc ? k.desc : "");
doclines.add(newstring(line));
}
doclines.add(NULL);
}
if(ident->references.length()) // references
{
struct category { string label; string refs; }
categories[] = {{"related identifiers", ""} , {"web resources", ""}, {"other", ""}};
categories[] = {{"related identifiers", ""} , {"web resources", ""}, {"wiki articles", ""}, {"other", ""}};
loopvj(ident->references)
{
docref &r = ident->references[j];
char *ref = r.ident ? categories[0].refs : (r.url ? categories[1].refs : categories[2].refs);
char *ref = r.ident ? categories[0].refs : (r.url ? categories[1].refs : (r.article ? categories[2].refs : categories[3].refs));
s_strcat(ref, r.name);
if(j < ident->references.length()-1) s_strcat(ref, ", ");
}
@@ -246,10 +441,19 @@ void renderdoc(int x, int y)
s_strcat(line, categories[j].refs);
}
}
doclines.add(NULL);
int screenlines = (VIRTH*2/3/FONTH)-1;
if(docskip) docskip = min(docskip, doclines.length() - screenlines); // normalize
bool more = docskip < doclines.length() - screenlines;
for(int j = docskip; j > 0; j--) doclines.remove(0); // cut top for scrolling
for(int j = doclines.length(); j > screenlines; j--) doclines.pop(); // fit on screen
loopvj(doclines) if(doclines[j]) draw_textf("%s", x, y+j*FONTH, doclines[j]);
doclines.deletecontentsa();
if(more) draw_textf("\f4more (F3)", x, y+screenlines*FONTH); // footer
if(docskip > 0) draw_textf("\f4less (F2)", x, y+(screenlines+1)*FONTH);
draw_textf("\f4disable doc reference (F1)", x, y+(screenlines+2)*FONTH);
return;
}
}
@@ -293,5 +497,4 @@ void renderdocmenu(void *menu, bool init)
s_sprintf(a.cmd)("showmenu [%s]", sections[i].name);
menumanual(menu, i, sections[i].name, a.cmd);
}
}
}
+4 -2
View File
@@ -15,7 +15,7 @@ extern void complete(char *s);
extern void alias(char *name, char *action);
extern char *getalias(char *name);
extern void writecfg();
extern void identnames(vector<char *> &names);
extern void identnames(vector<char *> &names, bool builtinonly);
// console
extern void keypress(int code, bool isdown, int cooked);
@@ -334,7 +334,9 @@ extern PFNGLACTIVETEXTUREARBPROC glActiveTexture_;
extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f_;
extern PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3f_;
// docs
// doc
extern void renderdoc(int x, int y);
extern void renderdocmenu(void *menu, bool init);
extern void toggledoc();
extern void scrolldoc(int i);
+1
View File
@@ -175,6 +175,7 @@ int text_visible(const char *str, int max)
// cut strings to fit on screen
void text_block(const char *str, int max, vector<char *> &lines)
{
if(!str) return;
int visible;
while((visible = text_visible(str, max)))
{