UFO: Alien Invasion
Loading...
Searching...
No Matches
cl_game.h File Reference

Shared game type headers. More...

#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "cgame.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.

Macros

#define GAME_IsSingleplayer()
#define CGAME_HARD_LINKED_FUNCTIONS

Functions

bool GAME_IsMultiplayer (void)
void GAME_ParseModes (const char *name, const char **text)
void GAME_InitStartup (void)
void GAME_Shutdown (void)
void GAME_InitUIData (void)
 Fills the game mode list entries with the parsed values from the script.
void GAME_UnloadGame (void)
void GAME_SetMode (const struct cgame_export_s *gametype)
void GAME_ReloadMode (void)
void GAME_Init (bool load)
void GAME_DisplayItemInfo (uiNode_t *node, const char *string)
 Shows game type specific item information (if it's not resolvable via objDef_t).
bool GAME_ItemIsUseable (const objDef_t *od)
void GAME_HandleResults (dbuffer *msg, int winner, int *numSpawned, int *numAlive, int numKilled[][MAX_TEAMS], int numStunned[][MAX_TEAMS], bool nextmap)
 After a mission was finished this function is called.
void GAME_SpawnSoldiers (void)
 Called during startup of mission to send team info.
void GAME_StartMatch (void)
const char * GAME_GetRelativeSavePath (char *bufbuf, size_t bufSize)
const char * GAME_GetAbsoluteSavePath (char *bufbuf, size_t bufSize)
equipDef_t * GAME_GetEquipmentDefinition (void)
bool GAME_HandleServerCommand (const char *command, dbuffer *msg)
void GAME_AddChatMessage (const char *format,...)
void GAME_CharacterCvars (const character_t *chr)
character_t * GAME_GetCharacter (int index)
 Returns a character that can be used to store the game type specific character values.
character_t * GAME_GetCharacterByUCN (int ucn)
 Returns a character that can be used to store the game type specific character values.
size_t GAME_GetCharacterArraySize (void)
const char * GAME_GetCurrentName (void)
void GAME_ResetCharacters (void)
 Reset 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 (bool isTeamPlay)
 Called when the server sends the EV_START event.
void GAME_InitMissionBriefing (const char *title)
void GAME_EndBattlescape (void)
 This is called when a client quits the battlescape.
void GAME_EndRoundAnnounce (int playerNum, int team)
 Send end round announcements.
bool GAME_TeamIsKnown (const teamDef_t *teamDef)
void GAME_NotifyEvent (event_t eventType)
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.
void GAME_DrawBaseLayout (int baseIdx, int x, int y, int totalMarge, int w, int h, int padding, const vec4_t bgcolor, const vec4_t color)
void GAME_DrawBaseLayoutTooltip (int baseIdx, int x, int y)
 Cgame callback to draw tooltip for baselayout UI node.
const char * GAME_GetModelForItem (const objDef_t *od, struct uiModel_s **menuModel)
const mapDef_t * GAME_GetCurrentSelectedMap (void)
void GAME_SwitchCurrentSelectedMap (int step)
bool GAME_IsTeamEmpty (void)
int GAME_GetCurrentTeam (void)
void GAME_DrawMap (geoscapeData_t *data)
void GAME_DrawMapMarkers (uiNode_t *node)
void GAME_MapClick (uiNode_t *node, int x, int y, const vec2_t pos)
void GAME_SetServerInfo (const char *server, const char *serverport)
character_t * GAME_GetSelectedChr (void)
 Returns the currently selected character.
int GAME_GetChrMaxLoad (const character_t *chr)
 Returns the max weight the given character can carry.
const equipDef_t * GAME_ChangeEquip (const linkedList_t *equipmentList, changeEquipType_t changeType, const char *equipID)
 Changed the given cvar to the next/prev equipment definition.

Variables

geoscapeData_t geoscapeData

Detailed Description

Shared game type headers.

Definition in file cl_game.h.

Macro Definition Documentation

◆ CGAME_HARD_LINKED_FUNCTIONS

#define CGAME_HARD_LINKED_FUNCTIONS
Value:
void Sys_Error (const char* error, ...) \
{ \
va_list argptr; \
char text[1024]; \
va_start(argptr, error); \
Q_vsnprintf(text, sizeof(text), error, argptr); \
va_end(argptr); \
cgi->Sys_Error("%s", text); \
} \
\
void Com_Printf (const char* msg, ...) \
{ \
va_list argptr; \
char text[1024]; \
va_start(argptr, msg); \
Q_vsnprintf(text, sizeof(text), msg, argptr); \
va_end(argptr); \
cgi->Com_Printf("%s", text); \
} \
\
void Com_DPrintf (int level, const char* msg, ...) \
{ \
va_list argptr; \
char text[1024]; \
va_start(argptr, msg); \
Q_vsnprintf(text, sizeof(text), msg, argptr); \
va_end(argptr); \
cgi->Com_DPrintf(level, "%s", text); \
}
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
Definition common.cpp:440
void Com_Printf(const char *const fmt,...)
Definition common.cpp:428
const cgame_import_t * cgi
level_locals_t level
Definition g_main.cpp:38
void Sys_Error(const char *error,...)
Definition g_main.cpp:421

Definition at line 91 of file cl_game.h.

◆ GAME_IsSingleplayer

#define GAME_IsSingleplayer ( )
Value:
bool GAME_IsMultiplayer(void)
Definition cl_game.cpp:299

Definition at line 36 of file cl_game.h.

Referenced by CL_FixActorSkinIDX().

Function Documentation

◆ GAME_AddChatMessage()

◆ GAME_AppendTeamMember()

◆ GAME_ChangeEquip()

const equipDef_t * GAME_ChangeEquip ( const linkedList_t * equipmentList,
changeEquipType_t changeType,
const char * equipID )

◆ GAME_CharacterCvars()

void GAME_CharacterCvars ( const character_t * chr)

◆ GAME_DisplayItemInfo()

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]nodeThe menu node to show the information in.
[in]stringThe id of the 'thing' to show information for.

Definition at line 338 of file cl_game.cpp.

References GAME_DisplayItemInfo(), GAME_GetCurrentType(), cgame_export_t::GetModelForItem(), and UI_DrawModelNode().

Referenced by uiItemNode::draw(), GAME_DisplayItemInfo(), and GAME_Init().

◆ GAME_DrawBaseLayout()

void GAME_DrawBaseLayout ( int baseIdx,
int x,
int y,
int totalMarge,
int w,
int h,
int padding,
const vec4_t bgcolor,
const vec4_t color )

◆ GAME_DrawBaseLayoutTooltip()

void GAME_DrawBaseLayoutTooltip ( int baseIdx,
int x,
int y )

Cgame callback to draw tooltip for baselayout UI node.

Parameters
[in]baseIdxNumeric index of the base
[in]xHorizontal screen position
[in]yVertical screen position

Definition at line 1521 of file cl_game.cpp.

References GAME_DrawBaseLayoutTooltip(), and GAME_GetCurrentType().

Referenced by uiBaseLayoutNode::drawTooltip(), GAME_DrawBaseLayoutTooltip(), and GAME_Init().

◆ GAME_DrawMap()

void GAME_DrawMap ( geoscapeData_t * data)

Definition at line 931 of file cl_game.cpp.

References data, GAME_DrawMap(), and GAME_GetCurrentType().

Referenced by uiGeoscapeNode::draw(), GAME_DrawMap(), and GAME_GetModelForItem().

◆ GAME_DrawMapMarkers()

void GAME_DrawMapMarkers ( uiNode_t * node)

◆ GAME_Drop()

void GAME_Drop ( void )

◆ GAME_EndBattlescape()

void GAME_EndBattlescape ( void )

This is called when a client quits the battlescape.

See also
GAME_StartBattlescape

Definition at line 314 of file cl_game.cpp.

References cls, Com_Printf(), Cvar_Set(), GAME_EndBattlescape(), InventoryInterface::GetUsedSlots(), and client_static_t::i.

Referenced by CL_Disconnect(), GAME_EndBattlescape(), and GAME_Init().

◆ GAME_EndRoundAnnounce()

void GAME_EndRoundAnnounce ( int playerNum,
int team )

Send end round announcements.

Parameters
playerNumThe server player number of the player that has ended the round
teamThe 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 325 of file cl_game.cpp.

References GAME_EndRoundAnnounce(), and GAME_GetCurrentType().

Referenced by CL_EndRoundAnnounce(), GAME_EndRoundAnnounce(), and GAME_Init().

◆ GAME_Frame()

void GAME_Frame ( void )

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

Definition at line 1496 of file cl_game.cpp.

References cls, client_static_t::frametime, GAME_Frame(), GAME_GetCurrentType(), key_console, and client_static_t::keyDest.

Referenced by CL_Frame(), GAME_Frame(), and GAME_Init().

◆ GAME_GenerateTeam()

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

◆ GAME_GetAbsoluteSavePath()

const char * GAME_GetAbsoluteSavePath ( char * buf,
size_t bufSize )

◆ GAME_GetCharacter()

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
indexThe 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 197 of file cl_game.cpp.

References characters, Com_Error(), ERR_DROP, GAME_GetCharacter(), index, and lengthof.

Referenced by GAME_AppendTeamMember(), GAME_GetCharacter(), GAME_Init(), and GAME_LoadTeamInfo().

◆ GAME_GetCharacterArraySize()

size_t GAME_GetCharacterArraySize ( void )

◆ GAME_GetCharacterByUCN()

character_t * GAME_GetCharacterByUCN ( int ucn)

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
ucnThe unique character number
Returns
null if no character with the specified ucn was found.

Definition at line 211 of file cl_game.cpp.

References characters, GAME_GetCharacterByUCN(), i, lengthof, and character_t::ucn.

Referenced by GAME_GetCharacterByUCN(), and GAME_Init().

◆ GAME_GetChrMaxLoad()

int GAME_GetChrMaxLoad ( const character_t * chr)

Returns the max weight the given character can carry.

Parameters
[in]chrThe character to find the max load for.
Returns
The max load the character can carry or NONE.

Definition at line 1577 of file cl_game.cpp.

References ABILITY_POWER, GAME_GetChrMaxLoad(), GAME_GetCurrentType(), NONE, character_t::score, and chrScoreGlobal_t::skills.

Referenced by CL_ActorInvMove(), GAME_AppendTeamMember(), GAME_GetChrMaxLoad(), GAME_GetImportData(), GAME_GetModelForItem(), GAME_LoadCharacter(), HUD_UpdateActorLoad_f(), cgame_import_t::int(), INV_MoveItem(), and INV_UpdateActorLoad_f().

◆ GAME_GetCurrentName()

◆ GAME_GetCurrentSelectedMap()

◆ GAME_GetCurrentTeam()

int GAME_GetCurrentTeam ( void )

◆ GAME_GetEquipmentDefinition()

◆ GAME_GetModelForItem()

◆ GAME_GetRelativeSavePath()

◆ GAME_GetSelectedChr()

character_t * GAME_GetSelectedChr ( void )

Returns the currently selected character.

Returns
The selected character or nullptr.

Definition at line 1555 of file cl_game.cpp.

References chrDisplayList, Cvar_GetInteger(), GAME_GetCurrentType(), GAME_GetSelectedChr(), cgame_export_t::GetSelectedChr(), and LIST_Foreach.

Referenced by GAME_GetModelForItem(), GAME_GetSelectedChr(), INV_MoveItem(), and INV_UpdateActorLoad_f().

◆ GAME_GetTeamDef()

◆ GAME_HandleResults()

void GAME_HandleResults ( dbuffer * msg,
int winner,
int * numSpawned,
int * numAlive,
int numKilled[][MAX_TEAMS],
int numStunned[][MAX_TEAMS],
bool nextmap )

After a mission was finished this function is called.

Parameters
msgThe network message buffer
winnerThe winning team or -1 if it was a draw
numSpawnedThe amounts of all spawned actors per team
numAliveThe amount of survivors per team
numKilledThe amount of killed actors for all teams. The first dimension contains the attacker team, the second the victim team
numStunnedThe amount of stunned actors for all teams. The first dimension contains the attacker team, the second the victim team
nextmapIndicates if there is another map to follow within the same msission

Definition at line 1135 of file cl_game.cpp.

References CL_Drop(), GAME_GetCurrentType(), GAME_HandleResults(), and MAX_TEAMS.

Referenced by CL_ParseResults(), GAME_HandleResults(), and GAME_Init().

◆ GAME_HandleServerCommand()

bool GAME_HandleServerCommand ( const char * command,
dbuffer * msg )

◆ GAME_Init()

◆ GAME_InitMissionBriefing()

◆ GAME_InitStartup()

◆ GAME_InitUIData()

void GAME_InitUIData ( void )

Fills the game mode list entries with the parsed values from the script.

Definition at line 1649 of file cl_game.cpp.

References cgameTypes, Com_Printf(), GAME_GetCGameAPI_(), GAME_InitUIData(), GAME_UnloadGame(), i, cgame_export_t::isMultiplayer, cgameType_t::name, numCGameTypes, UI_ExecuteConfunc(), and cgameType_t::window.

Referenced by CLMN_Init(), and GAME_InitUIData().

◆ GAME_IsMultiplayer()

◆ GAME_IsTeamEmpty()

◆ GAME_ItemIsUseable()

◆ GAME_MapClick()

void GAME_MapClick ( uiNode_t * node,
int x,
int y,
const vec2_t pos )

◆ GAME_NotifyEvent()

void GAME_NotifyEvent ( event_t eventType)

◆ GAME_ParseModes()

void GAME_ParseModes ( const char * name,
const char ** text )

◆ GAME_ReloadMode()

◆ GAME_ResetCharacters()

void GAME_ResetCharacters ( void )

◆ GAME_SetMode()

void GAME_SetMode ( const struct cgame_export_s * gametype)

◆ GAME_SetServerInfo()

void GAME_SetServerInfo ( const char * server,
const char * serverport )

◆ GAME_Shutdown()

◆ GAME_SpawnSoldiers()

◆ GAME_StartBattlescape()

void GAME_StartBattlescape ( bool isTeamPlay)

Called when the server sends the EV_START event.

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

Definition at line 1296 of file cl_game.cpp.

References _, cl, CL_GetConfigString(), CS_MAPTITLE, Cvar_Set(), GAME_GetCurrentType(), GAME_InitMissionBriefing(), GAME_StartBattlescape(), HUD_InitUI(), and clientBattleScape_t::mapMaxLevel.

Referenced by CL_StartGame(), GAME_Init(), and GAME_StartBattlescape().

◆ GAME_StartMatch()

◆ GAME_SwitchCurrentSelectedMap()

◆ GAME_TeamIsKnown()

bool GAME_TeamIsKnown ( const teamDef_t * teamDef)

◆ GAME_UnloadGame()

Variable Documentation

◆ geoscapeData

geoscapeData_t geoscapeData
extern

Definition at line 147 of file cl_game.cpp.

Referenced by GAME_GetImportData(), and uiGeoscapeNode::onLoading().