User:Monster Iestyn/Source Code Documentation/g_game.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 __G_GAME__

Includes

Externs

Data name Data type Non-extern location(s) Description
gamedatafilename[64] char g_game.c
timeattackfolder[64] char g_game.c
customversionstring[32] char g_game.c
*seenplayer player_t g_game.c Declared only if SEENAMES is defined
player_names[MAXPLAYERS][MAXPLAYERNAME+1] char g_game.c
players[MAXPLAYERS] player_t g_game.c
playeringame[MAXPLAYERS] boolean g_game.c
demoplayback
titledemo
demorecording
timingdemo
boolean g_game.c
singledemo boolean g_game.c
demo_start boolean g_game.c
*metalplayback mobj_t g_game.c
levelstarttic tic_t g_game.c
prevmap
nextmap
INT16 g_game.c The map numbers of the map last played and next map to go to, respectively. These are used only by the level completion and tally screen code.

Both are 0-based, i.e. 0 is MAP01.

gameovertics INT32 g_game.c
timeinmap tic_t g_game.c
rw_maximums[NUM_WEAPONS] INT16 g_game.c
cv_chatwidth
cv_chatnotifications
cv_chatheight
cv_chattime
cv_consolechat
cv_chatbacktint
cv_chatspamprotection
cv_compactscoreboard
consvar_t g_game.c
cv_crosshair
cv_crosshair2
consvar_t g_game.c
cv_invertmouse
cv_alwaysfreelook
cv_chasefreelook
cv_mousemove
consvar_t g_game.c invertmouse, alwaysmlook, chasemlook and mousemove console variable structs
cv_invertmouse2
cv_alwaysfreelook2
cv_chasefreelook2
cv_mousemove2
consvar_t g_game.c invertmouse2, alwaysmlook2, chasemlook2 and mousemove2 console variable structs
cv_useranalog
cv_useranalog2
consvar_t g_game.c useranalog and useranalog2 console variable structs
cv_analog
cv_analog2
consvar_t g_game.c analog and analog2 console variable structs
cv_sideaxis
cv_turnaxis
cv_moveaxis
cv_lookaxis
cv_jumpaxis
cv_spinaxis
cv_fireaxis
cv_firenaxis
consvar_t g_game.c
cv_sideaxis2
cv_turnaxis2
cv_moveaxis2
cv_lookaxis2
cv_jumpaxis2
cv_spinaxis2
cv_fireaxis2
cv_firenaxis2
consvar_t g_game.c
cv_ghost_bestscore
cv_ghost_besttime
cv_ghost_bestrings
cv_ghost_last
cv_ghost_guest
consvar_t m_menu.c
localangle
localangle2
angle_t g_game.c
localaiming
localaiming2
INT32 g_game.c

Macros

Macro Defined as Description
GAMEDATASIZE (4*8192)
KB_LOOKSPEED (1<<25)
MAXPLMOVE (50)
SLOWTURNTICS (6)

Function prototypes

Function name Return type Params Defined in Attributes Description
G_BuildMapName const char * INT32 map g_game.c
G_BuildTiccmd void ticcmd_t *cmd,
INT32 realtics
g_game.c
G_BuildTiccmd2 void ticcmd_t *cmd,
INT32 realtics
g_game.c
G_CopyTiccmd ticcmd_t * ticcmd_t *dest,
const ticcmd_t *src,
const size_t n
g_game.c
G_MoveTiccmd ticcmd_t * ticcmd_t *dest,
const ticcmd_t *src,
const size_t n
g_game.c
G_ClipAimingPitch INT16 INT32 *aiming g_game.c
G_SoftwareClipAimingPitch INT16 INT32 *aiming g_game.c
G_ChangePlayerReferences void mobj_t *oldmo,
mobj_t *newmo
g_game.c
G_DoReborn void INT32 playernum g_game.c
G_PlayerReborn void INT32 player g_game.c
G_InitNew void UINT8 pultmode,
const char *mapname,
boolean resetplayer,
boolean skipprecutscene
g_game.c
G_BuildMapTitle char * INT32 mapnum g_game.c
G_FindCTFStart mapthing_t * INT32 playernum g_game.c Finds a randomly chosen CTF start for the player to spawn at. If a CTF start is found that is not occupied by another player, this function returns the map Thing for it; otherwise, this returns NULL. If the player belongs to either the Red or Blue CTF team in the current gametype, this function checks only the corresponding CTF starts for that team. If the player doesn't belong to any team (e.g. if they are a spectator, or in a gametype without teams), this function randomly picks a start from any team.

Note that this function expects a maximum of 32 starts for each CTF team; if there are any more starts than this, the extra starts will be ignored.

G_FindMatchStart mapthing_t * INT32 playernum g_game.c Finds a randomly chosen Match start for the player to spawn at. If a Match start is found that is not occupied by another player, this function returns the map Thing for it; otherwise, this returns NULL.

Note that this function expects a maximum of 64 Match starts; if there are any more starts than this, the extra starts will be ignored.

G_FindCoopStart mapthing_t * INT32 playernum g_game.c Finds a Coop start for the player to spawn at. Unlike G_FindCTFStart and G_FindMatchStart the Coop start checked is not randomly chosen, but depends on the player's number. If the start is not occupied by another player, this function returns the map Thing for it; if it is occupied, then this returns the map Thing for Player 1's start (regardless of whether it is occupied). If no Coop starts are found, this returns NULL.
G_SpawnPlayer void INT32 playernum,
boolean starpost
g_game.c Spawns a player, and moves them to a location appropriate for the gametype. If starpost is true, the player is assumed to be re-spawning at a starpost's location, rather than looking for a player start to be moved to.
G_DeferedInitNew void UINT8 pultmode,
const char *mapname,
INT32 pickedchar,
boolean SSSG,
boolean FLS
g_game.c
G_DoLoadLevel void boolean resetplayer g_game.c
G_DeferedPlayDemo void const char *demo g_game.c
G_LoadGame void UINT32 slot,
INT16 mapoverride
g_game.c Loads a game from a Single Player savegame slot. By default, the savegame's saved map number is used as the map to start the game at. However, if mapoverride is non-zero, it overrides this map with another choice – this is used by a completed savegame's level select to select a different starting map.

If the savegame slot is for a different version of SRB2 than the one being played, an on-screen message will be displayed that requires the user to respond, depending on whether the game is compiled to support saves from other versions or not. If the game cannot be loaded for some reason, a console error message will be displayed.

G_SaveGameData void none g_game.c
G_SaveGame void UINT32 slot g_game.c Saves the game to a Single Player savegame slot. If at the credits or evaluation screen, this marks the game as completed.

If the game cannot be saved for some reason, a console error message will be displayed.

G_RecordDemo void const char *demo g_game.c
G_RecordMetal void none g_game.c
G_BeginRecording void none g_game.c
G_BeginMetal void none g_game.c
G_SetDemoTime void UINT32 ptime,
UINT32 pscore,
UINT16 prings
g_game.c
G_CmpDemoTime UINT8 char *oldname,
char *newname
g_game.c
G_ReadDemoTiccmd void ticcmd_t *cmd,
INT32 playernum
g_game.c
G_WriteDemoTiccmd void ticcmd_t *cmd,
INT32 playernum
g_game.c
G_GhostAddThok void none g_game.c If recording a demo with ghost data, registers a thok item spawn event
G_GhostAddSpin void none g_game.c If recording a demo with ghost data, registers a spin item spawn event
G_GhostAddRev void none g_game.c If recording a demo with ghost data, registers a rev item spawn event
G_GhostAddColor void ghostcolor_t color g_game.c If recording a demo with ghost data, registers a color change event (super transformation, Fire Flower, or Mario-style invincibility)
G_GhostAddFlip void none g_game.c If recording a demo with ghost data, registers a flip event
G_GhostAddScale void fixed_t scale g_game.c If recording a demo with ghost data, registers a scale change event
G_GhostAddHit void mobj_t *victim g_game.c If recording a demo with ghost data, registers an enemy hit event
G_WriteGhostTic void mobj_t *ghost g_game.c
G_ConsGhostTic void none g_game.c
G_GhostTicker void none g_game.c
G_ReadMetalTic void mobj_t *metal g_game.c
G_WriteMetalTic void mobj_t *metal g_game.c
G_SaveMetal void UINT8 **buffer g_game.c
G_LoadMetal void UINT8 **buffer g_game.c
G_DoPlayDemo void char *defdemoname g_game.c
G_TimeDemo void const char *name g_game.c
G_AddGhost void char *defdemoname g_game.c
G_DoPlayMetal void none g_game.c
G_DoneLevelLoad void none g_game.c
G_StopMetalDemo void none g_game.c
G_StopMetalRecording void none g_game.c ATTRNORETURN
FUNCNORETURN
G_StopDemo void none g_game.c
G_CheckDemoStatus boolean none g_game.c
G_GetGametypeByName INT32 const char *gametypestr g_game.c Returns the number for the given gametype name string, or -1 if not valid.
G_IsSpecialStage boolean INT32 mapnum g_game.c Returns true if the given map number is a Special Stage; otherwise returns false.
G_GametypeUsesLives boolean none g_game.c Returns true if the current game mode uses lives (Single Player, Coop, or Competition); otherwise returns false. If in Record Attack or a NiGHTS level, this returns false regardless of gametype.
G_GametypeHasTeams boolean none g_game.c Returns true if the current game mode has teams (Team Match or CTF); otherwise returns false.
G_GametypeHasSpectators boolean none g_game.c Returns true if the current game mode supports spectators (Match, CTF or Tag); otherwise returns false.
G_RingSlingerGametype boolean none g_game.c Returns true if the current game mode supports firing rings (Match, CTF, or Tag), or if otherwise ringslinger is enabled; otherwise returns false.
G_PlatformGametype boolean none g_game.c Returns true if the current game mode is a "platformer" game type (Single Player, Coop, Race, or Competition); otherwise returns false.
G_TagGametype boolean none g_game.c Returns true if the current game mode is Tag or Hide and Seek; otherwise returns false.
G_ExitLevel void none g_game.c
G_NextLevel void none g_game.c
G_Continue void none g_game.c
G_UseContinue void none g_game.c
G_AfterIntermission void none g_game.c
G_EndGame void None g_game.c Handles end-game events; this can either start the credits screen, start the evaluation screen, or go back to the title screen.
G_Ticker void boolean run g_game.c Game loop ticker; handles main game actions, runs wipes if the game state was changed, respawns players if needed.
G_Responder boolean event_t *ev g_game.c Handles all key input not handled by menu or console. If not eaten by responders called within this function, inputs will be remapped to game controls. Returns true if the event was "eaten", false if not.
G_AddPlayer void INT32 playernum g_game.c
G_SetExitGameFlag void none g_game.c
G_ClearExitGameFlag void none g_game.c
G_GetExitGameFlag boolean none g_game.c
G_SetRetryFlag void none g_game.c
G_ClearRetryFlag void none g_game.c
G_GetRetryFlag boolean none g_game.c
G_LoadGameData void none g_game.c
G_LoadGameSettings void none g_game.c
G_SetGameModified void boolean silent g_game.c
G_SetGamestate void gamestate_t newstate g_game.c
G_AllocMainRecordData void INT32 i g_game.c
G_AllocNightsRecordData void INT32 i g_game.c
G_ClearRecords void none g_game.c
G_GetBestScore UINT32 INT16 map g_game.c
G_GetBestTime tic_t INT16 map g_game.c
G_GetBestRings UINT16 INT16 map g_game.c
G_GetBestNightsScore UINT32 INT16 map,
UINT8 mare
g_game.c
G_GetBestNightsTime tic_t INT16 map,
UINT8 mare
g_game.c
G_GetBestNightsRings UINT16 INT16 map,
UINT8 mare
g_game.c
G_AddTempNightsRecords void UINT32 pscore,
tic_t ptime,
UINT8 mare
g_game.c
G_SetNightsRecords void none g_game.c
G_TicsToHours INT32 tic_t tics g_game.c FUNCMATH Returns the time in game tics converted to hours.
G_TicsToMinutes INT32 tic_t tics,
boolean full
g_game.c FUNCMATH Returns the time in game tics converted to minutes.
G_TicsToSeconds INT32 tic_t tics g_game.c FUNCMATH Returns the time in game tics converted to seconds.
G_TicsToCentiseconds INT32 tic_t tics g_game.c FUNCMATH Returns the time in game tics converted to centiseconds.
G_TicsToMilliseconds INT32 tic_t tics g_game.c FUNCMATH Returns the time in game tics converted to milliseconds.
G_TOLFlag INT16 INT32 pgametype g_game.c

Typedefs

Name Type Description
ghostcolor_t enum

ghostcolor_t

Value Name Description
0 GHC_NORMAL
1 GHC_SUPER
2 GHC_FIREFLOWER
3 GHC_INVINCIBLE