User:Monster Iestyn/Source Code Documentation/command.h
Jump to navigation
Jump to search
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article. |
Online link | GitHub entry |
---|---|
File type | C header file |
#include guard | __COMMAND_H__
|
Includes
Command buffer and command execution
Typedefs
Name | Type | Description |
---|---|---|
com_func_t
|
void (*function)(void)
|
A pointer to a function intended to be called by a console command when executed. These kind of functions do not use any parameters. |
Function prototypes
Function name | Return type | Params | Defined in | Description |
---|---|---|---|---|
COM_AddCommand
|
void | const char *name ,com_func_t func
|
command.c
|
Adds a console command. |
COM_AddLuaCommand
|
int | const char *name
|
command.c
|
Adds a console command for Lua. This is the same as COM_AddCommand , except no I_Error s are used; a negative value is returned instead. A return value of 1 indicates an existing command was replaced, and a return value of 0 indicates a new command was added (i.e.: no command of the given name existed before).
|
COM_Argc
|
size_t
|
none | command.c
|
Gets a console command argument count. |
COM_Argv
|
const char *
|
size_t arg
|
command.c
|
Gets a console command argument. |
COM_Args
|
char *
|
none | command.c
|
Gets all console command arguments. |
COM_CheckParm
|
size_t
|
const char *check
|
command.c
|
Checks if a parameter was passed to a console command. |
COM_CheckPartialParm
|
size_t
|
const char *check
|
command.c
|
|
COM_FirstOption
|
size_t
|
none | command.c
|
|
COM_CompleteCommand
|
const char *
|
const char *partial ,INT32 skips
|
command.c
|
Does command completion for the console. |
COM_BufAddTextEx
|
void | const char *btext ,int flags
|
command.c
|
Adds text into the command buffer for later execution. |
COM_BufInsertTextEx
|
void | const char *btext ,int flags
|
command.c
|
Adds command text and executes it immediately. |
COM_ImmedExecute
|
void | const char *ptext
|
command.c
|
Executes a string immediately. Used for skirting around WAIT commands. |
COM_BufExecute
|
void | none | command.c
|
Flushes (executes) console commands in the buffer. |
COM_BufTicker
|
void | none | command.c
|
Progress the wait timer and flush waiting console commands when ready. |
COM_Init
|
void | none | command.c
|
Initializes command buffer and adds basic commands. |
Macros
Macro | Defined as | Description |
---|---|---|
COM_BufAddText(s)
|
COM_BufAddTextEx(s, 0)
|
|
COM_BufInsertText(s)
|
COM_BufInsertTextEx(s, 0)
|
Variable-sized buffers
Typedefs
Name | Type | Description |
---|---|---|
vsbuf_t struct vsbuf_s
|
struct
|
A variable size buffer. |
Structs
vsbuf_t
Data name | Data type | Description |
---|---|---|
allowoverflow
|
boolean | |
overflowed
|
boolean | |
*data
|
UINT8 | |
maxsize
|
size_t
|
|
cursize
|
size_t
|
Function prototypes
Function name | Return type | Params | Defined in | Description |
---|---|---|---|---|
VS_Alloc
|
void | vsbuf_t *buf ,size_t initsize
|
command.c
|
Initializes a variable size buffer. |
VS_Free
|
void | vsbuf_t *buf
|
command.c
|
Frees a variable size buffer. |
VS_Clear
|
void | vsbuf_t *buf
|
command.c
|
Clears a variable size buffer. |
VS_GetSpace
|
void *
|
vsbuf_t *buf ,size_t length
|
command.c
|
Makes sure a variable size buffer has enough space for data of a certain length. |
VS_Write
|
void | vsbuf_t *buf ,const void *data ,size_t length
|
command.c
|
Copies data to the end of a variable size buffer. |
VS_WriteEx
|
void | vsbuf_t *buf ,const void *data ,size_t length ,int flags );
|
command.c
|
|
VS_Print
|
void | vsbuf_t *buf ,const void *data
|
command.c
|
Prints text in a variable buffer. Like VS_Write() plus a trailing NULL.
|
Console variables
Typedefs
Name | Type | Description |
---|---|---|
cvflags_t
|
enum
|
Console variable flags. |
CV_PossibleValue_t struct CV_PossibleValue_s
|
struct
|
A possible value for a console variable, stores both integer and string form. |
consvar_t struct consvar_s
|
struct
|
The console variable struct. |
Enumerations
Lua command registration flags
Value | Name | Description |
---|---|---|
1 | COM_ADMIN
|
|
2 | COM_SPLITSCREEN
|
|
4 | COM_LOCAL
|
=Command buffer flags
Value | Name | Description |
---|---|---|
1 | COM_SAFE
|
cvflags_t
Value | Name | Description |
---|---|---|
1 | CV_SAVE
|
Variable's value is saved to config.cfg when changed
|
2 | CV_CALL
|
A function is called when the variable is changed |
4 | CV_NETVAR
|
Variable is synchronised for everyone in netgames; only the server or admin can modify this |
8 | CV_NOINIT
|
Function isn't called when variable is first registered (should be combined with CV_CALL always)
|
16 | CV_FLOAT
|
Variable takes floating-point values – i.e. non-whole numbers such as 0.5 and 0.45 are accepted). These are then converted to a fixed-point integer value (e.g.: "0.5" becomes FRACUNIT /2)
|
32 | CV_NOTINNET
|
Variable cannot be changed in netgames |
64 | CV_MODIFIED
|
This flag is set when variable is modified |
128 | CV_SHOWMODIF
|
Console displays a message when variable is modified |
256 | CV_SHOWMODIFONETIME
|
Console displays a message when variable is modified, but only once |
512 | CV_NOSHOWHELP
|
Variable is not shown in the list generated by the help console command
|
1024 | CV_HIDEN
|
Variable is not accessible by the console |
2048 | CV_CHEAT
|
Variable is a cheat, and can be reset to its default value by using cheats off in the console
|
4096 | CV_NOLUA
|
Variable cannot be called from Lua. |
Structs
CV_PossibleValue_t
Data name | Data type | Description |
---|---|---|
value
|
INT32 | |
*strvalue
|
const char
|
consvar_t
Data name | Data type | Description |
---|---|---|
*name
|
const char
|
|
*defaultvalue
|
const char
|
|
flags
|
INT32 | |
*PossibleValue
|
CV_PossibleValue_t
|
|
(*func)(void)
|
void | |
value
|
INT32 | |
*string
|
const char
|
|
*zstring
|
char
|
|
netid
|
UINT16 | |
changed
|
char
|
|
*next
|
struct consvar_s
|
Externs
Data name | Data type | Non-extern location(s) | Description |
---|---|---|---|
CV_OnOff[]
|
CV_PossibleValue_t
|
command.c
|
The possible values array for "On/Off" console variables. |
CV_YesNo[]
|
CV_PossibleValue_t
|
command.c
|
The possible values array for "Yes/No" console variables. |
CV_Unsigned[]
|
CV_PossibleValue_t
|
command.c
|
The possible values array for console variables that take only unsigned numbers. The minimum value allowed is 0, the maximum value allowed is 999999999. |
CV_Natural[]
|
CV_PossibleValue_t
|
command.c
|
The possible values array for console variables that take only natural numbers. The minimum value allowed is 1, the maximum value allowed is 999999999. |
cv_execversion
|
consvar_t
|
command.c
|
Function prototypes
Function name | Return type | Params | Defined in | Description |
---|---|---|---|---|
CV_InitFilterVar
|
void | none | command.c
|
Filter consvars by version. |
CV_ToggleExecVersion
|
void | boolean enable
|
Toggles on/off execversion. | |
CV_RegisterVar
|
void | consvar_t *variable
|
command.c
|
Registers a variable for later use from the console. |
CV_FindVar
|
consvar_t *
|
const char *name
|
command.c
|
|
CV_ClearChangedFlags
|
void | none | command.c
|
Marks all variables as unchanged, indicating they've not been changed by the user this game. |
CV_CompleteVar
|
const char *
|
char *partial ,INT32 skips
|
command.c
|
Completes the name of a console variable. |
CV_Set
|
void | consvar_t *var ,const char *value
|
command.c
|
Sets a value to a variable, performing some checks and calling the callback function if there is one. |
CV_SetValue
|
void | consvar_t *var ,INT32 value
|
command.c
|
Sets a numeric value to a variable, performing some checks and calling the callback function if there is one. |
CV_StealthSetValue
|
void | consvar_t *var ,INT32 value
|
command.c
|
Sets a numeric value to a variable without calling its callback function. |
CV_StealthSet
|
void | consvar_t *var ,const char *value
|
command.c
|
Sets a value to a variable without calling its callback function. |
CV_AddValue
|
void | consvar_t *var ,INT32 increment
|
command.c
|
Adds a value to a console variable. Used to increment and decrement variables from the menu. Contains special cases to handle pointlimit in some multiplayer modes, map number for game hosting, etc. |
CV_SaveVariables
|
void | FILE *f
|
command.c
|
Saves console variables to a file if they have the CV_SAVE flag set.
|
CV_SaveVars
|
void | UINT8 **p ,boolean in_demo
|
command.c
|
Saves data for all changed netvars (console variables with CV_NETVAR ) to the buffer. If in_demo is true, save the string name of the netvar instead of the ID.
|
CV_LoadDemoVars
|
void | UINT8 **p
|
command.c
|
Loads data for all changed netvars from the buffer. (Used for demos) |
CV_LoadNetVars
|
void | UINT8 **p
|
command.c
|
Loads data for all changed netvars from the buffer. (Used for netgames) |
CV_ResetCheatNetVars
|
void | none | command.c
|
Resets all console variables marked as "cheats" to their default values. |
CV_IsSetToDefault
|
boolean | consvar_t *v
|
command.c
|
Returns true if the variable's current value is its default value, false if not.
|
CV_CheatsEnabled
|
UINT8 | none | command.c
|
Returns true if any console variables marked as "cheats" are not at their default settings, false if not.
|
Macros
Macro | Defined as | Description |
---|---|---|
CV_SaveNetVars(p)
|
CV_SaveVars(p, false)
|
Saves data for all changed netvars (console variables with CV_NETVAR ) to the buffer. (Used for netgames)
|
CV_SaveDemoVars(p)
|
CV_SaveVars(p, true)
|
Saves data for all changed netvars (console variables with CV_NETVAR ) to the buffer. (Used for demos)
|