User:Monster Iestyn/Source Code Documentation/d_netcmd.h

From SRB2 Wiki
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 __D_NETCMD__

Includes

Externs

Data name Data type Non-extern location(s) Description
cv_playername consvar_t d_netcmd.c name console variable struct
cv_playercolor consvar_t d_netcmd.c color console variable struct
cv_skin consvar_t d_netcmd.c skin console variable struct
cv_playername2 consvar_t d_netcmd.c name2 console variable struct
cv_playercolor2 consvar_t d_netcmd.c color2 console variable struct
cv_skin2 consvar_t d_netcmd.c skin2 console variable struct
cv_seenames
cv_allowseenames
consvar_t d_netcmd.c Declared only if SEENAMES is defined

seenames and allowseenames console variable structs

cv_usemouse consvar_t d_netcmd.c usemouse console variable struct
cv_usejoystick consvar_t d_netcmd.c usejoystick console variable struct
cv_usejoystick2 consvar_t d_netcmd.c usejoystick2 console variable struct
cv_joyport consvar_t d_netcmd.c Declared only if LJOYSTICK is defined1

joyport console variable struct

cv_joyport2 consvar_t d_netcmd.c Declared only if LJOYSTICK is defined1

joyport2 console variable struct

cv_joyscale consvar_t d_netcmd.c joyscale console variable struct
cv_joyscale2 consvar_t d_netcmd.c joyscale2 console variable struct
cv_mouse2port consvar_t d_netcmd.c mouse2port console variable struct
cv_usemouse2 consvar_t d_netcmd.c usemouse2 console variable struct
cv_mouse2opt consvar_t d_netcmd.c Unix-only

mouse2opt console variable struct

cv_itemrespawntime consvar_t p_mobj.c respawnitemtime console variable struct
cv_itemrespawn consvar_t p_mobj.c respawnitem console variable struct
cv_flagtime consvar_t p_mobj.c flagtime console variable struct
cv_suddendeath consvar_t p_mobj.c suddendeath console variable struct
cv_touchtag consvar_t d_netcmd.c touchtag console variable struct
cv_hidetime consvar_t d_netcmd.c hidetime console variable struct
cv_pointlimit consvar_t d_netcmd.c pointlimit console variable struct
cv_timelimit consvar_t d_netcmd.c timelimit console variable struct
cv_numlaps consvar_t d_netcmd.c numlaps console variable struct
cv_usemapnumlaps consvar_t d_netcmd.c usemaplaps console variable struct
timelimitintics UINT32 d_netcmd.c
cv_allowexitlevel consvar_t d_netcmd.c allowexitlevel console variable struct
cv_hazardlog consvar_t d_netcmd.c hazardlog console variable struct
cv_autobalance consvar_t d_netcmd.c autobalance console variable struct
cv_teamscramble consvar_t d_netcmd.c teamscramble console variable struct
cv_scrambleonchange consvar_t d_netcmd.c scrambleonchange console variable struct
cv_netstat consvar_t d_netcmd.c netstat console variable struct
cv_splats consvar_t p_mobj.c Declared only if WALLSPLATS is defined

splats console variable struct

cv_countdowntime consvar_t d_netcmd.c countdowntime console variable struct
cv_runscripts consvar_t d_netcmd.c runscripts console variable struct
cv_mute consvar_t d_netcmd.c mute console variable struct
cv_killingdead consvar_t d_netcmd.c killingdead console variable struct
cv_pause consvar_t d_netcmd.c pausepermission console variable struct
cv_restrictskinchange
cv_allowteamchange
cv_respawntime
consvar_t d_netcmd.c restrictskinchange, allowteamchange and respawndelay console variable structs
cv_teleporters
cv_superring
cv_supersneakers
cv_invincibility
consvar_t d_netcmd.c tv_teleporter, tv_superring, tv_supersneaker and tv_invincibility console variable structs
cv_jumpshield
cv_watershield
cv_ringshield
cv_forceshield
cv_bombshield
consvar_t d_netcmd.c tv_jumpshield, tv_watershield, tv_ringshield, tv_forceshield and tv_bombshield console variable structs
cv_1up
cv_eggmanbox
consvar_t d_netcmd.c tv_1up and tv_eggman console variable structs
cv_recycler consvar_t d_netcmd.c tv_recycler console variable struct
cv_itemfinder consvar_t d_netcmd.c itemfinder console variable struct
cv_inttime
cv_advancemap
cv_playersforexit
consvar_t d_netcmd.c inttime, advancemap and playersforexit console variable structs
cv_soniccd consvar_t r_main.c soniccd console variable struct
cv_match_scoring consvar_t d_netcmd.c matchscoring console variable struct
cv_overtime consvar_t d_netcmd.c overtime console variable struct
cv_startinglives consvar_t d_netcmd.c startinglives console variable struct
cv_rollingdemos consvar_t d_netcmd.c rollingdemos console variable struct
cv_ringslinger
cv_soundtest
consvar_t d_netcmd.c ringslinger and soundtest console variable structs
cv_specialrings
cv_powerstones
cv_matchboxes
cv_competitionboxes
consvar_t d_netcmd.c specialrings, powerstones, matchboxes and competitionboxes console variable structs
cv_maxping consvar_t d_netcmd.c Declared only if NEWPING is defined

maxping console variable struct

cv_skipmapcheck consvar_t d_netcmd.c skipmapcheck console variable struct
cv_sleep consvar_t d_netcmd.c cpusleep console variable struct
*netxcmdnames[MAXNETXCMD - 1] const char d_netcmd.c The array storing string names for all net command types

1 LJOYSTICK appears to be a macro Doom Legacy used for experimental Linux joystick 1.x code (?). It is normally undefined and therefore the relevant code is unused by SRB2.

Typedefs

Name Type Attributes Description
netxcmd_t enum
changeteam_packet_t struct ATTRPACK
changeteam_value_t struct ATTRPACK
changeteam_union_t union ATTRPACK

Enumerations

netxcmd_t

See also: Net commands
Value Name Description
1 XD_NAMEANDCOLOR Sends a player's current name, color and skin.
2 XD_WEAPONPREF Sends other player preferences.
3 XD_KICK Sent by the server or admin to kick a player from the server.
4 XD_NETVAR Sent by the server or admin when a networked console variable is changed.
5 XD_SAY Sends a say command.
6 XD_MAP Sent by the server or admin when the map is changed.
7 XD_EXITLEVEL Sent by the server or admin to finish the level.
8 XD_ADDFILE Sent by the server to add a file to the netgame.
9 XD_PAUSE Sends a pause command.
10 XD_ADDPLAYER Sent by the server or admin(?) to add a joining player to the netgame.
11 XD_TEAMCHANGE Sends a team change command.
12 XD_CLEARSCORES Sent by the server or admin to clear all players' scores.
13 XD_LOGIN Sends a login request to the server.
14 XD_VERIFIED Sent by the server to give admin privileges to a player.
15 XD_RANDOMSEED Unused
16 XD_RUNSOC Sent by the server or admin to run a SOC file.
17 XD_REQADDFILE Sent by an admin to request the server to add a file to the game.
18 XD_DELFILE Sent by the server or admin to delete a file from the game.
19 XD_SETMOTD Sent by the server or admin to set the Message of the day.
20 XD_SUICIDE Sends a suicide command.
21 XD_DEMOTED Sent by the server to remove admin privileges from a player.
22 XD_LUACMD Declared only if HAVE_BLUA is defined

Sent by the server when a networked Lua-defined console command is used.

23 XD_LUAVAR Declared only if HAVE_BLUA is defined

Unimplemented

241 MAXNETXCMD Number of net command types.

1 This is the value of the constant only if HAVE_BLUA is defined; otherwise, it is 22.

Structs

changeteam_packet_t

changeteam_value_t

Unions

changeteam_union_t

Function prototypes

Function name Return type Params Defined in Description
D_RegisterServerCommands void none d_netcmd.c Registers server commands and variables. Anything required by a dedicated server should probably go here.
D_RegisterClientCommands void none d_netcmd.c Registers client commands and variables. Nothing needed for a dedicated server should be registered here.
D_SendPlayerConfig void none d_netcmd.c Sends the local player's preferences to the other clients. If splitscreen is enabled locally or a bot is present (neither are possible in netplay for public releases of SRB2 currently), this also sends player 2's preferences.
Command_ExitGame_f void none d_netcmd.c Function called by the console command exitgame when executed.
Command_Retry_f void none d_netcmd.c Function called by the console command retry when executed.
D_GameTypeChanged void INT32 lastgametype d_netcmd.c Adjusts certain settings to match a changed gametype.
D_MapChange void INT32 pmapnum,
INT32 pgametype,
boolean pultmode,
boolean presetplayers,
INT32 pdelay,
boolean pskipprecutscene,
boolean pfromlevelselect
d_netcmd.c Runs a map change. If the local player is the server, this will also call SV_SpawnServer to start up a server (if one is not already running) and add any players waiting to join.

Note that this function's behaviour can be split into two main steps: the first step is setting up a buffer using the function's arguments, and the second step sending the buffer via a XD_MAP net command (and calling SV_SpawnServer if you are the server). However, due to complications these two steps must not be run at the same time when D_MapChange is called from a menu (such as when a Single Player game is being started up). pdelay determines which of these two parts the D_MapChange function call should run:

  • 0: Run both parts immediately (this must not be done from a menu)
  • 1: Run the first step only. Note that the buffer is statically allocated, so it will be unchanged for the next D_MapChange call, if a delay value of 2 is used next time.
  • 2: Run the second step only. The buffer from step one is sent here, if it was previously prepared by a D_MapChange call with a delay value of 1.

Note that if SV_SpawnServer is called and fails to start a server (if one is not already running), this function will not send a XD_MAP net command.

IsPlayerAdmin boolean INT32 playernum d_netcmd.c Checks if the player is an admin locally.
SetAdminPlayer void INT32 playernum d_netcmd.c Gives admin privileges to the player locally.
ClearAdminPlayers void none d_netcmd.c Removes admin privileges from all players locally.
RemoveAdminPlayer void INT32 playernum d_netcmd.c Removes admin privileges from the player locally.
ItemFinder_OnChange void none d_netcmd.c Function called by the console variable itemfinder (cv_itemfinder) when modified.
D_SetPassword void const char *pw d_netcmd.c Sets the password for granting admin status.
CanChangeSkin UINT8 INT32 playernum d_netcmd.c Returns 1 if the player has permission to change skin (does not include movement-based checks). Otherwise, returns 0.