cl_game.h File Reference

Shared game type headers. More...

#include "client.h"
#include "ui/ui_nodes.h"
#include "cl_game_campaign.h"
#include "cl_game_skirmish.h"
#include "cl_game_multiplayer.h"
Include dependency graph for cl_game.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define GAME_NONE   0
#define GAME_SINGLEPLAYER   (1 << 0)
#define GAME_MULTIPLAYER   (1 << 1)
#define GAME_CAMPAIGN   (GAME_SINGLEPLAYER | (1 << 2))
#define GAME_SKIRMISH   (GAME_SINGLEPLAYER | (1 << 3))
#define GAME_MAX   GAME_SKIRMISH
#define GAME_IsSingleplayer()   (cls.gametype & GAME_SINGLEPLAYER)
#define GAME_IsMultiplayer()   (cls.gametype == GAME_MULTIPLAYER)

Functions

void GAME_InitStartup (void)
void GAME_SetMode (int gametype)
void GAME_ReloadMode (void)
void GAME_Init (qboolean load)
void GAME_DisplayItemInfo (uiNode_t *node, const char *string)
 Shows game type specific item information (if it's not resolvable via objDef_t).
qboolean GAME_ItemIsUseable (const objDef_t *od)
void GAME_HandleResults (struct dbuffer *msg, int winner, int *numSpawned, int *numAlive, int numKilled[][MAX_TEAMS], int numStunned[][MAX_TEAMS])
 After a mission was finished this function is called.
void GAME_SpawnSoldiers (void)
 Called during startup of mission to send team info.
int GAME_GetCurrentTeam (void)
equipDef_tGAME_GetEquipmentDefinition (void)
void GAME_CharacterCvars (const character_t *chr)
character_tGAME_GetCharacter (int index)
 Returns a character that can be used to store the game type specific character values.
size_t GAME_GetCharacterArraySize (void)
void GAME_ResetCharacters (void)
 Will reset (memset) all characters in the static character array.
void GAME_GenerateTeam (const char *teamDefID, const equipDef_t *ed, int teamMembers)
void GAME_AppendTeamMember (int memberIndex, const char *teamDefID, const equipDef_t *ed)
void GAME_StartBattlescape (qboolean isTeamPlay)
 Called when the server sends the EV_START event.
void GAME_EndBattlescape (void)
 This is called when a client quits the battlescape.
void GAME_EndRoundAnnounce (int playerNum, int team)
 Send end round announcements.
qboolean GAME_TeamIsKnown (const teamDef_t *teamDef)
const char * GAME_GetTeamDef (void)
void GAME_Drop (void)
void GAME_Frame (void)
 Called every frame and allows us to hook into the current running game mode.
const char * GAME_GetModelForItem (const objDef_t *od, struct uiModel_s **menuModel)
 Get a model for an item.

Detailed Description

Shared game type headers.

Definition in file cl_game.h.


Define Documentation

#define GAME_CAMPAIGN   (GAME_SINGLEPLAYER | (1 << 2))

Definition at line 35 of file cl_game.h.

 
#define GAME_IsMultiplayer (  )     (cls.gametype == GAME_MULTIPLAYER)
 
#define GAME_IsSingleplayer (  )     (cls.gametype & GAME_SINGLEPLAYER)

Definition at line 40 of file cl_game.h.

Referenced by CL_FixCustomSkinIDX(), Con_MessageModeSay_f(), and Con_MessageModeSayTeam_f().

#define GAME_MAX   GAME_SKIRMISH

Definition at line 38 of file cl_game.h.

Referenced by GAME_SetMode().

#define GAME_MULTIPLAYER   (1 << 1)

Definition at line 34 of file cl_game.h.

#define GAME_NONE   0

Definition at line 32 of file cl_game.h.

Referenced by CL_Shutdown(), GAME_Drop(), GAME_Exit_f(), GAME_GetCurrentType(), and GAME_ReloadMode().

#define GAME_SINGLEPLAYER   (1 << 0)

Definition at line 33 of file cl_game.h.

#define GAME_SKIRMISH   (GAME_SINGLEPLAYER | (1 << 3))

Definition at line 36 of file cl_game.h.


Function Documentation

void GAME_AppendTeamMember ( int  memberIndex,
const char *  teamDefID,
const equipDef_t ed 
)
void GAME_CharacterCvars ( const character_t chr  ) 

Definition at line 741 of file cl_game.c.

References GAME_GetCurrentType().

Referenced by CL_UpdateCharacterValues().

void GAME_DisplayItemInfo ( uiNode_t node,
const char *  string 
)

Shows game type specific item information (if it's not resolvable via objDef_t).

Parameters:
[in] node The menu node to show the information in.
[in] string The id of the 'thing' to show information for.

Definition at line 191 of file cl_game.c.

References GAME_GetCurrentType().

Referenced by UI_ItemNodeDraw().

void GAME_Drop ( void   ) 

Definition at line 757 of file cl_game.c.

References GAME_GetCurrentType(), GAME_NONE, GAME_SetMode(), qfalse, qtrue, SV_Shutdown(), and UI_InitStack().

Referenced by CL_Drop().

void GAME_EndBattlescape ( void   ) 

This is called when a client quits the battlescape.

See also:
GAME_StartBattlescape

Definition at line 168 of file cl_game.c.

References cls, Com_Printf(), inventoryInterface_s::GetUsedSlots, and client_static_s::i.

Referenced by CL_Disconnect().

void GAME_EndRoundAnnounce ( int  playerNum,
int  team 
)

Send end round announcements.

Parameters:
playerNum The server player number of the player that has ended the round
team The team the player is in

Todo:
do we need the team number here? isn't the playernum enough to get the team?

Definition at line 178 of file cl_game.c.

References GAME_GetCurrentType().

Referenced by CL_EndRoundAnnounce().

void GAME_Frame ( void   ) 

Called every frame and allows us to hook into the current running game mode.

Definition at line 781 of file cl_game.c.

References GAME_GetCurrentType().

Referenced by CL_Frame().

void GAME_GenerateTeam ( const char *  teamDefID,
const equipDef_t ed,
int  teamMembers 
)
character_t* GAME_GetCharacter ( int  index  ) 

Returns a character that can be used to store the game type specific character values.

Note:
The returned pointer is a reference to static memory
Parameters:
index The index of the character array. This value must be greater than 0 and not bigger than the value GAME_GetCharacterArraySize returned
See also:
GAME_GetCharacterArraySize
GAME_ResetCharacters
Returns:
A character slot

Definition at line 58 of file cl_game.c.

References Com_Error(), ERR_DROP, and lengthof.

Referenced by GAME_AppendTeamMember(), and MP_LoadTeamMultiplayerInfo().

size_t GAME_GetCharacterArraySize ( void   ) 
Returns:
The size of the static character array
See also:
GAME_GetCharacter
GAME_ResetCharacters

Definition at line 71 of file cl_game.c.

References lengthof.

Referenced by GAME_GenerateTeam(), GAME_MP_AutoTeam(), GAME_SK_Start_f(), GAME_Spawn(), and MP_LoadTeamMultiplayerInfo().

int GAME_GetCurrentTeam ( void   ) 

Definition at line 710 of file cl_game.c.

References GAME_GetCurrentType(), and TEAM_DEFAULT.

equipDef_t* GAME_GetEquipmentDefinition ( void   ) 
const char* GAME_GetModelForItem ( const objDef_t od,
uiModel_t **  uiModel 
)

Get a model for an item.

Parameters:
[in] od The object definition to get the model from.
[out] menuModel The menu model pointer.
Returns:
The model path for the item. Never NULL.

Definition at line 796 of file cl_game.c.

References GAME_GetCurrentType(), cgame_export_t::GetModelForItem(), objDef_s::model, and UI_GetUIModel().

Referenced by UI_DrawItem(), and UI_ItemNodeDraw().

const char* GAME_GetTeamDef ( void   ) 
void GAME_HandleResults ( struct dbuffer msg,
int  winner,
int *  numSpawned,
int *  numAlive,
int  numKilled[][MAX_TEAMS],
int  numStunned[][MAX_TEAMS] 
)

After a mission was finished this function is called.

Parameters:
msg The network message buffer
winner The winning team
numSpawned The amounts of all spawned actors per team
numAlive The amount of survivors per team
numKilled The amount of killed actors for all teams. The first dimension contains the attacker team, the second the victim team
numStunned The amount of stunned actors for all teams. The first dimension contains the attacker team, the second the victim team

Definition at line 512 of file cl_game.c.

References CL_Drop(), and GAME_GetCurrentType().

Referenced by CL_ParseResults().

void GAME_Init ( qboolean  load  ) 
void GAME_InitStartup ( void   ) 
qboolean GAME_ItemIsUseable ( const objDef_t od  ) 
void GAME_ReloadMode ( void   ) 
void GAME_ResetCharacters ( void   ) 

Will reset (memset) all characters in the static character array.

See also:
GAME_GetCharacterArraySize
GAME_GetCharacter

Definition at line 81 of file cl_game.c.

References chrDisplayList, and chr_list_s::num.

Referenced by GAME_GenerateTeam(), and MP_LoadTeamMultiplayerInfo().

void GAME_SetMode ( int  gametype  ) 
void GAME_SpawnSoldiers ( void   ) 
void GAME_StartBattlescape ( qboolean  isTeamPlay  ) 

Called when the server sends the EV_START event.

Parameters:
isTeamPlay true if the game is a teamplay round. This can be interesting for multiplayer based game types
See also:
GAME_EndBattlescape

Definition at line 152 of file cl_game.c.

References cls, Com_Printf(), GAME_GetCurrentType(), inventoryInterface_s::GetUsedSlots, client_static_s::i, mn_hud, qtrue, cvar_s::string, and UI_InitStack().

Referenced by CL_StartGame().

qboolean GAME_TeamIsKnown ( const teamDef_t teamDef  ) 

Definition at line 729 of file cl_game.c.

References GAME_GetCurrentType(), qfalse, and qtrue.

Referenced by CL_ActorAppear(), and CL_AddTargetingBox().


Generated by  doxygen 1.6.2