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

Shared game type code. More...

Include dependency graph for cl_game.cpp:

Go to the source code of this file.

Data Structures

class  GAMECvarListener
class  GAMECmdListener

Macros

#define MAX_CGAMETYPES   16

Functions

static const cgame_export_t * GAME_GetCurrentType (void)
static SharedPtr< GAMECvarListener > cvarListener (new GAMECvarListener())
static SharedPtr< GAMECmdListener > cmdListener (new GAMECmdListener())
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_AppendTeamMember (int memberIndex, const char *teamDefID, const equipDef_t *ed)
void GAME_GenerateTeam (const char *teamDefID, const equipDef_t *ed, int teamMembers)
void GAME_ReloadMode (void)
bool GAME_IsMultiplayer (void)
void GAME_EndBattlescape (void)
 This is called when a client quits the battlescape.
void GAME_EndRoundAnnounce (int playerNum, int team)
 Send end round announcements.
void GAME_DisplayItemInfo (uiNode_t *node, const char *string)
 Shows game type specific item information (if it's not resolvable via objDef_t).
void GAME_SetServerInfo (const char *server, const char *serverport)
static void CL_QueryMasterServer (const char *action, http_callback_t callback)
bool GAME_HandleServerCommand (const char *command, dbuffer *msg)
void GAME_AddChatMessage (const char *format,...)
bool GAME_IsTeamEmpty (void)
static void GAME_NET_OOB_Printf (struct net_stream *s, const char *format,...)
static void GAME_NET_OOB_Printf2 (const char *format,...)
static void GAME_UI_Popup (const char *title, const char *format,...)
static char * GAME_StrDup (const char *string)
static void GAME_Free (void *ptr)
static memPool_t * GAME_CreatePool (const char *name)
static void GAME_FreePool (memPool_t *pool)
static char * GAME_PoolStrDup (const char *in, memPool_t *pool, const int tagNum)
static void GAME_DestroyInventory (Inventory *const inv)
static void GAME_EquipActor (character_t *const chr, const equipDef_t *ed, const objDef_t *weapon, int maxWeight)
static bool GAME_RemoveFromInventory (Inventory *const i, const invDef_t *container, Item *fItem)
static void GAME_WebUpload (int category, const char *filenamefilename)
static void GAME_WebDelete (int category, const char *filenamefilename)
static void GAME_WebDownloadFromUser (int category, const char *filenamefilename, int userId)
static void GAME_WebListForUser (int category, int userId)
static void GAME_SetNextUniqueCharacterNumber (int ucn)
static int GAME_GetNextUniqueCharacterNumber (void)
static void GAME_CollectItems (void *data, int won, void(*collectItem)(void *, const objDef_t *, int), void(*collectAmmo)(void *, const Item *), void(*ownitems)(const Inventory *))
static void GAME_CollectAliens (void *data, void(*collect)(void *, const teamDef_t *, int, bool))
 Collecting stunned and dead alien bodies after the mission.
static int UI_DrawString_ (const char *fontID, align_t align, int x, int y, const char *c)
static void UI_PushWindow_ (const char *name)
static void UI_DrawNormImageByName_ (bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const char *name)
static void R_UploadAlpha_ (const char *name, const byte *alphaData)
static void R_DrawImageCentered (int x, int y, const char *name)
static const char * Com_EParse_ (const char **text, const char *errhead, const char *errinfo)
static const cgame_import_t * GAME_GetImportData (const cgameType_t *t)
static void GAME_FreeInventory (void *data)
static void * GAME_AllocInventoryMemory (size_t sizesize)
static void GAME_FreeAllInventory (void)
void GAME_UnloadGame (void)
void GAME_SwitchCurrentSelectedMap (int step)
const mapDef_t * GAME_GetCurrentSelectedMap (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_SetMode (const cgame_export_t *gametype)
void GAME_ParseModes (const char *name, const char **text)
static const cgame_export_t * GAME_GetCGameAPI (const cgameType_t *t)
static const cgame_export_t * GAME_GetCGameAPI_ (const cgameType_t *t)
static void GAME_SetMode_f (void)
 Decides which game mode should be set - takes the menu as reference.
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.
static void GAME_NetSendItem (dbuffer *bufbuf, const Item *item, containerIndex_t container, int x, int y)
static void GAME_NetSendInventory (dbuffer *bufbuf, const Inventory *inv)
static void GAME_NetSendCharacter (dbuffer *bufbuf, const character_t *chr)
 Send the character information to the server that is needed to spawn the soldiers of the player.
static void GAME_SendCurrentTeamSpawningInfo (dbuffer *bufbuf, linkedList_t *team)
 Stores a team-list (chr-list) info to buffer (which might be a network buffer, too).
const char * GAME_GetTeamDef (void)
static bool GAME_Spawn (linkedList_t **chrList)
void GAME_StartBattlescape (bool isTeamPlay)
 Called when the server sends the EV_START event.
void GAME_InitMissionBriefing (const char *title)
static void GAME_InitializeBattlescape (linkedList_t *team)
 This is called if actors are spawned (or at least the spawning commands were send to the server). This callback can e.g. be used to set initial actor states. E.g. request crouch and so on. These events are executed without consuming time.
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)
void GAME_NotifyEvent (event_t eventType)
bool GAME_TeamIsKnown (const teamDef_t *teamDef)
void GAME_CharacterCvars (const character_t *chr)
static void GAME_Abort_f (void)
 Let the aliens win the match.
void GAME_Drop (void)
static void GAME_Exit_f (void)
 Quits the current running game by calling the shutdown callback.
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, uiModel_t **uiModel)
 Get a model for an item.
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.
void GAME_InitUIData (void)
 Fills the game mode list entries with the parsed values from the script.
void GAME_InitStartup (void)
void GAME_Shutdown (void)

Variables

static cgameType_t cgameTypes [MAX_CGAMETYPES]
static int numCGameTypes
geoscapeData_t geoscapeData
static equipDef_t equipDefStandard
static character_t characters [MAX_ACTIVETEAM]
 static character array that can be used by a game mode to store the needed character values.
static const int TAG_INVENTORY = 17462
static const inventoryImport_t inventoryImport = { GAME_FreeInventory, GAME_FreeAllInventory, GAME_AllocInventoryMemory }
static const value_t cgame_vals []
 Valid equipment definition values from script files.

Detailed Description

Shared game type code.

Definition in file cl_game.cpp.

Macro Definition Documentation

◆ MAX_CGAMETYPES

#define MAX_CGAMETYPES   16

Definition at line 59 of file cl_game.cpp.

Referenced by GAME_ParseModes().

Function Documentation

◆ CL_QueryMasterServer()

void CL_QueryMasterServer ( const char * action,
http_callback_t callback )
static
See also
CL_PingServers_f

Definition at line 356 of file cl_game.cpp.

References CL_QueryMasterServer(), HTTP_GetURL(), masterserver_url, cvar_t::string, and va().

Referenced by CL_QueryMasterServer(), and GAME_GetImportData().

◆ cmdListener()

SharedPtr< GAMECmdListener > cmdListener ( new GAMECmdListener())
static

◆ Com_EParse_()

const char * Com_EParse_ ( const char ** text,
const char * errhead,
const char * errinfo )
static

Definition at line 581 of file cl_game.cpp.

References Com_EParse(), and Com_EParse_().

Referenced by Com_EParse_(), and GAME_GetImportData().

◆ cvarListener()

SharedPtr< GAMECvarListener > cvarListener ( new GAMECvarListener())
static

◆ GAME_Abort_f()

void GAME_Abort_f ( void )
static

Let the aliens win the match.

Definition at line 1461 of file cl_game.cpp.

References Cbuf_AddText(), GAME_Abort_f(), and TEAM_ALIEN.

Referenced by GAME_Abort_f(), and GAME_InitStartup().

◆ GAME_AddChatMessage()

◆ GAME_AllocInventoryMemory()

void * GAME_AllocInventoryMemory ( size_t size)
static

◆ 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_CollectAliens()

void GAME_CollectAliens ( void * data,
void(* collect )(void *, const teamDef_t *, int, bool) )
static

Collecting stunned and dead alien bodies after the mission.

Definition at line 533 of file cl_game.cpp.

References data, GAME_CollectAliens(), LE_GetNextInUse(), LE_IsActor(), LE_IsAlien, LE_IsDead, LE_IsStunned, and le_t::teamDef.

Referenced by GAME_CollectAliens(), and GAME_GetImportData().

◆ GAME_CollectItems()

void GAME_CollectItems ( void * data,
int won,
void(* collectItem )(void *, const objDef_t *, int),
void(* collectAmmo )(void *, const Item *),
void(* ownitems )(const Inventory *) )
static

◆ GAME_CreatePool()

memPool_t * GAME_CreatePool ( const char * name)
static

Definition at line 438 of file cl_game.cpp.

References GAME_CreatePool(), Mem_CreatePool, and name.

Referenced by GAME_CreatePool(), and GAME_GetImportData().

◆ GAME_DestroyInventory()

void GAME_DestroyInventory ( Inventory *const inv)
static

◆ 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_EquipActor()

void GAME_EquipActor ( character_t *const chr,
const equipDef_t * ed,
const objDef_t * weapon,
int maxWeight )
static

◆ GAME_Exit_f()

void GAME_Exit_f ( void )
static

Quits the current running game by calling the shutdown callback.

Definition at line 1486 of file cl_game.cpp.

References GAME_Exit_f(), GAME_SetMode(), and GAME_UnloadGame().

Referenced by GAME_Exit_f(), and GAME_InitStartup().

◆ 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_Free()

void GAME_Free ( void * ptr)
static

Definition at line 433 of file cl_game.cpp.

References GAME_Free(), and Mem_Free.

Referenced by GAME_Free(), and GAME_GetImportData().

◆ GAME_FreeAllInventory()

void GAME_FreeAllInventory ( void )
static

Definition at line 893 of file cl_game.cpp.

References cl_genericPool, GAME_FreeAllInventory(), Mem_FreeTag, and TAG_INVENTORY.

Referenced by GAME_FreeAllInventory().

◆ GAME_FreeInventory()

void GAME_FreeInventory ( void * data)
static

Definition at line 882 of file cl_game.cpp.

References data, GAME_FreeInventory(), and Mem_Free.

Referenced by GAME_FreeInventory().

◆ GAME_FreePool()

void GAME_FreePool ( memPool_t * pool)
static

Definition at line 443 of file cl_game.cpp.

References GAME_FreePool(), and Mem_FreePool.

Referenced by GAME_FreePool(), and GAME_GetImportData().

◆ 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_GetCGameAPI()

◆ GAME_GetCGameAPI_()

const cgame_export_t * GAME_GetCGameAPI_ ( const cgameType_t * t)
static

◆ 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_GetCurrentType()

◆ GAME_GetEquipmentDefinition()

◆ GAME_GetImportData()

const cgame_import_t * GAME_GetImportData ( const cgameType_t * t)
static
Todo
add a wrapper here that stores the cgame command and removes them on shutdown automatically
Todo
add a wrapper here that stores the cgame cvars and removes them on shutdown automatically

Definition at line 586 of file cl_game.cpp.

References _Mem_Alloc(), cgame_import_t::Alloc(), BEP_Evaluate(), Cbuf_AddText(), Cbuf_Execute(), cgame_import_t::cgameType, cgi, cgame_import_t::CL_ActorGetSkillString(), CL_ActorGetSkillString(), CL_Disconnect(), CL_Drop(), CL_GenerateCharacter(), CL_GetClientState(), CL_GetPlayerNum(), CL_Milliseconds(), CL_OnBattlescape(), cgame_import_t::CL_PlayerGetName(), CL_PlayerGetName(), CL_QueryMasterServer(), CL_SetClientState(), cgame_import_t::CL_Translate(), CL_Translate(), CL_UpdateCharacterValues(), Cmd_AddCommand(), Cmd_AddParamCompleteFunction(), Cmd_Argc(), cgame_import_t::Cmd_Args(), Cmd_Args(), cgame_import_t::Cmd_Argv(), Cmd_Argv(), Cmd_ExecuteString(), Cmd_GenericCompleteFunction(), Cmd_RemoveCommand(), Cmd_TableAddList(), Cmd_TableRemoveList(), Com_DPrintf(), Com_Drop(), Com_DropShipShortNameToID(), cgame_import_t::Com_DropShipTypeToShortName(), Com_DropShipTypeToShortName(), cgame_import_t::Com_EParse(), Com_EParse_(), Com_EParseValue(), Com_Error(), Com_GetConstInt(), Com_GetConstIntFromNamespace(), cgame_import_t::Com_GetConstVariable(), Com_GetConstVariable(), Com_GetDropShipIdsNum(), Com_GetHumanAircraftIdsNum(), cgame_import_t::Com_GetMapDefinitionByID(), Com_GetMapDefinitionByID(), cgame_import_t::Com_GetRandomMapAssemblyNameForCraft(), Com_GetRandomMapAssemblyNameForCraft(), cgame_import_t::Com_GetRandomMapAssemblyNameForCrashedCraft(), Com_GetRandomMapAssemblyNameForCrashedCraft(), cgame_import_t::Com_GetTeamDefinitionByID(), Com_GetTeamDefinitionByID(), Com_GetUfoIdsNum(), cgame_import_t::Com_GetUGVByID(), Com_GetUGVByID(), cgame_import_t::Com_GetUGVByIDSilent(), Com_GetUGVByIDSilent(), Com_ParseBlock(), Com_ParseBlockToken(), Com_ParseBoolean(), Com_ParseList(), Com_Printf(), Com_RegisterConstInt(), Com_RegisterConstList(), Com_ServerState(), Com_SetGameType(), cgame_import_t::Com_UFOCrashedTypeToShortName(), Com_UFOCrashedTypeToShortName(), Com_UFOShortNameToID(), cgame_import_t::Com_UFOTypeToShortName(), Com_UFOTypeToShortName(), Com_UnregisterConstList(), Com_UnregisterConstVariable(), cgame_import_t::Com_ValueToStr(), Com_ValueToStr(), cgame_import_t::CreatePool(), cgame_import_t::csi, csi, Cvar_Delete(), cgame_import_t::Cvar_ForceSet(), Cvar_ForceSet(), cgame_import_t::Cvar_Get(), Cvar_Get(), Cvar_GetInteger(), cgame_import_t::Cvar_GetString(), Cvar_GetString(), Cvar_GetValue(), cgame_import_t::Cvar_Set(), Cvar_Set(), Cvar_SetValue(), cgame_import_t::Cvar_VariableStringOld(), Cvar_VariableStringOld(), FS_BuildFileList(), FS_CheckFile(), FS_CloseFile(), FS_FreeFile(), FS_LoadFile(), cgame_import_t::FS_NextFileFromFileList(), FS_NextFileFromFileList(), cgame_import_t::FS_NextScriptHeader(), FS_NextScriptHeader(), FS_OpenFile(), FS_Read(), FS_RemoveFile(), FS_WriteFile(), GAME_AppendTeamMember(), GAME_AutoTeam(), cgame_import_t::GAME_ChangeEquip(), GAME_ChangeEquip(), GAME_CollectAliens(), GAME_CollectItems(), GAME_CreatePool(), GAME_DestroyInventory(), GAME_EquipActor(), GAME_Free(), GAME_FreePool(), GAME_GetAbsoluteSavePath(), GAME_GetCharacterArraySize(), GAME_GetChrMaxLoad(), cgame_import_t::GAME_GetCurrentSelectedMap(), GAME_GetCurrentSelectedMap(), GAME_GetCurrentTeam(), GAME_GetImportData(), GAME_GetNextUniqueCharacterNumber(), GAME_GetRelativeSavePath(), GAME_IsTeamEmpty(), GAME_LoadCharacter(), GAME_LoadDefaultTeam(), GAME_NET_OOB_Printf(), GAME_NET_OOB_Printf2(), GAME_PoolStrDup(), GAME_ReloadMode(), GAME_RemoveFromInventory(), GAME_SaveCharacter(), GAME_SetNextUniqueCharacterNumber(), GAME_SetServerInfo(), cgame_import_t::GAME_StrDup(), GAME_StrDup(), GAME_SwitchCurrentSelectedMap(), GAME_UI_Popup(), GAME_WebDelete(), GAME_WebDownloadFromUser(), GAME_WebListForUser(), GAME_WebUpload(), geoscapeData, cgame_import_t::GetAbsoluteSavePath(), cgame_import_t::GetRelativeSavePath(), HUD_DisplayMessage(), HUD_InitUI(), cgame_import_t::INV_GetEquipmentDefinitionByID(), INV_GetEquipmentDefinitionByID(), cgame_import_t::INV_GetFilterType(), INV_GetFilterType(), INV_GetFilterTypeID(), INV_ItemDescription(), INV_ItemMatchesFilter(), cgame_import_t::LIST_Add(), LIST_Add(), LIST_AddPointer(), LIST_AddString(), LIST_AddStringSorted(), cgame_import_t::LIST_ContainsString(), LIST_ContainsString(), cgame_import_t::LIST_CopyStructure(), LIST_CopyStructure(), LIST_Count(), LIST_Delete(), cgame_import_t::LIST_GetByIdx(), LIST_GetByIdx(), cgame_import_t::LIST_GetPointer(), LIST_GetPointer(), cgame_import_t::LIST_GetRandom(), LIST_GetRandom(), LIST_IsEmpty(), LIST_PrependString(), LIST_Remove(), LIST_RemoveEntry(), LIST_Sort(), cgame_import_t::NET_Connect(), NET_Connect(), NET_DatagramBroadcast(), NET_DatagramSocketClose(), cgame_import_t::NET_DatagramSocketNew(), NET_DatagramSocketNew(), NET_ReadByte(), NET_ReadLong(), cgame_import_t::NET_ReadMsg(), NET_ReadMsg(), NET_ReadShort(), NET_ReadString(), NET_ReadStringLine(), NET_SockaddrToStrings(), NET_StreamFree(), cgame_import_t::NET_StreamGetData(), NET_StreamGetData(), cgame_import_t::NET_StreamPeerToName(), NET_StreamPeerToName(), NET_StreamSetCallback(), NET_StreamSetData(), NET_WriteByte(), NET_WriteShort(), cgame_import_t::PoolStrDup(), R_Color(), R_Draw2DMapMarkers(), R_Draw3DMapMarkers(), R_DrawBloom(), R_DrawFill(), R_DrawImageCentered(), R_DrawLine(), R_DrawLineStrip(), R_DrawRect(), R_ImageExists(), R_LoadImage(), cgame_import_t::r_radarPic, geoscapeData_t::r_radarPic, cgame_import_t::r_radarSourcePic, geoscapeData_t::r_radarSourcePic, R_SoftenTexture(), R_UploadAlpha_(), cgame_import_t::r_xviAlpha, geoscapeData_t::r_xviAlpha, S_SetSampleRepeatRate(), S_StartLocalSample(), SV_Shutdown(), SV_ShutdownWhenEmpty(), Sys_Error(), cgame_import_t::UI_AddOption(), UI_AddOption(), UI_ContainerNodeUpdateEquipment(), UI_DisplayNotice(), UI_DrawFill(), UI_DrawNormImageByName_(), UI_DrawRect(), UI_DrawString_(), UI_DrawTooltip(), UI_ExecuteConfunc(), cgame_import_t::UI_GetActiveWindowName(), UI_GetActiveWindowName(), cgame_import_t::UI_GetFontFromNode(), UI_GetFontFromNode(), UI_GetNodeAbsPos(), cgame_import_t::UI_GetNodeByPath(), UI_GetNodeByPath(), cgame_import_t::UI_GetOption(), UI_GetOption(), cgame_import_t::UI_GetSpriteByName(), UI_GetSpriteByName(), cgame_import_t::UI_InitOptionIteratorAtIndex(), UI_InitOptionIteratorAtIndex(), UI_InitStack(), cgame_import_t::ui_inventory, ui_inventory, UI_MessageAddStack(), cgame_import_t::UI_MessageGetStack(), UI_MessageGetStack(), UI_MessageResetStack(), cgame_import_t::UI_OptionIteratorNextOption(), UI_OptionIteratorNextOption(), UI_PopupButton(), cgame_import_t::UI_PopupList(), UI_PopupList(), UI_PopWindow(), UI_PushWindow_(), UI_RegisterLinkedListText(), UI_RegisterOption(), UI_RegisterText(), UI_ResetData(), UI_SortOptions(), UI_TextNodeSelectLine(), UI_TextScrollEnd(), UI_UpdateInvisOptions(), XML_AddBool(), XML_AddBoolValue(), XML_AddByte(), XML_AddByteValue(), XML_AddDate(), XML_AddDouble(), XML_AddDoubleValue(), XML_AddFloat(), XML_AddFloatValue(), XML_AddInt(), XML_AddIntValue(), XML_AddLong(), XML_AddLongValue(), cgame_import_t::XML_AddNode(), XML_AddNode(), XML_AddPos2(), XML_AddPos3(), XML_AddShort(), XML_AddShortValue(), XML_AddString(), XML_AddStringValue(), XML_GetBool(), cgame_import_t::XML_GetDate(), XML_GetDate(), XML_GetDouble(), XML_GetFloat(), XML_GetInt(), XML_GetLong(), cgame_import_t::XML_GetNextNode(), XML_GetNextNode(), cgame_import_t::XML_GetNextPos2(), XML_GetNextPos2(), cgame_import_t::XML_GetNextPos3(), XML_GetNextPos3(), cgame_import_t::XML_GetNode(), XML_GetNode(), cgame_import_t::XML_GetPos2(), XML_GetPos2(), cgame_import_t::XML_GetPos3(), XML_GetPos3(), XML_GetShort(), cgame_import_t::XML_GetString(), XML_GetString(), cgame_import_t::XML_Parse(), and XML_Parse().

Referenced by GAME_GetCGameAPI(), and GAME_GetImportData().

◆ GAME_GetModelForItem()

const char * GAME_GetModelForItem ( const objDef_t * od,
uiModel_t ** uiModel )

Get a model for an item.

Parameters
[in]odThe object definition to get the model from.
[out]uiModelThe menu model pointer.
Returns
The model path for the item. Never nullptr.

Definition at line 1534 of file cl_game.cpp.

References GAME_GetCurrentType(), GAME_GetModelForItem(), cgame_export_t::GetModelForItem(), objDef_t::id, objDef_t::model, and UI_GetUIModel().

Referenced by uiItemNode::draw(), GAME_GetModelForItem(), GAME_GetModelForItem(), and UI_DrawItem().

◆ GAME_GetNextUniqueCharacterNumber()

int GAME_GetNextUniqueCharacterNumber ( void )
static

◆ 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_InitializeBattlescape()

void GAME_InitializeBattlescape ( linkedList_t * team)
static

This is called if actors are spawned (or at least the spawning commands were send to the server). This callback can e.g. be used to set initial actor states. E.g. request crouch and so on. These events are executed without consuming time.

Definition at line 1346 of file cl_game.cpp.

References ACTOR_HAND_NOT_SET, cl, clc_initactorstates, cls, GAME_GetCurrentType(), GAME_InitializeBattlescape(), i, lengthof, LIST_Count(), LIST_Foreach, NET_WriteByte(), NET_WriteMsg(), NET_WriteShort(), client_static_t::netStream, NONE, STATE_REACTION, clientBattleScape_t::teamList, and UI_ExecuteConfunc().

Referenced by GAME_InitializeBattlescape(), and GAME_StartMatch().

◆ 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_NET_OOB_Printf()

void GAME_NET_OOB_Printf ( struct net_stream * s,
const char * format,
... )
static

Definition at line 393 of file cl_game.cpp.

References format(), GAME_NET_OOB_Printf(), NET_OOB_Printf(), and Q_vsnprintf().

Referenced by GAME_GetImportData(), and GAME_NET_OOB_Printf().

◆ GAME_NET_OOB_Printf2()

void GAME_NET_OOB_Printf2 ( const char * format,
... )
static

◆ GAME_NetSendCharacter()

◆ GAME_NetSendInventory()

◆ GAME_NetSendItem()

void GAME_NetSendItem ( dbuffer * buf,
const Item * item,
containerIndex_t container,
int x,
int y )
static
See also
G_WriteItem
G_ReadItem
Note
The amount of the Item should not be needed here - because the amount is only valid for CID_FLOOR and CID_EQUIP

Definition at line 1150 of file cl_game.cpp.

References Item::ammoDef(), CL_GetEvent(), Com_DPrintf(), DEBUG_CLIENT, Item::def(), EV_INV_TRANSFER, eventRegister_t::formatString, GAME_NetSendItem(), Item::getAmmoLeft(), Item::getAmount(), objDef_t::id, objDef_t::idx, NET_WriteFormat(), NONE, and Item::rotated.

Referenced by GAME_NetSendInventory(), and GAME_NetSendItem().

◆ GAME_NotifyEvent()

void GAME_NotifyEvent ( event_t eventType)

◆ GAME_ParseModes()

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

◆ GAME_PoolStrDup()

char * GAME_PoolStrDup ( const char * in,
memPool_t * pool,
const int tagNum )
static

Definition at line 448 of file cl_game.cpp.

References GAME_PoolStrDup(), and Mem_PoolStrDup.

Referenced by GAME_GetImportData(), and GAME_PoolStrDup().

◆ GAME_ReloadMode()

◆ GAME_RemoveFromInventory()

bool GAME_RemoveFromInventory ( Inventory *const i,
const invDef_t * container,
Item * fItem )
static

◆ GAME_ResetCharacters()

void GAME_ResetCharacters ( void )

◆ GAME_SendCurrentTeamSpawningInfo()

void GAME_SendCurrentTeamSpawningInfo ( dbuffer * buf,
linkedList_t * team )
static

Stores a team-list (chr-list) info to buffer (which might be a network buffer, too).

See also
G_ClientTeamInfo
MP_SaveTeamMultiplayerInfo
Note
Called in CL_Precache_f to send the team info to server

Definition at line 1232 of file cl_game.cpp.

References clc_teaminfo, GAME_NetSendCharacter(), GAME_NetSendInventory(), GAME_SendCurrentTeamSpawningInfo(), LIST_Count(), LIST_Foreach, NET_WriteByte(), and Inventory::resetTempContainers().

Referenced by GAME_SendCurrentTeamSpawningInfo(), and GAME_SpawnSoldiers().

◆ GAME_SetMode()

◆ GAME_SetMode_f()

void GAME_SetMode_f ( void )
static

Decides which game mode should be set - takes the menu as reference.

Definition at line 1078 of file cl_game.cpp.

References cgameTypes, Cmd_Argc(), Cmd_Argv(), Com_Printf(), GAME_GetCGameAPI_(), GAME_SetMode(), GAME_SetMode_f(), GAME_UnloadGame(), i, numCGameTypes, Q_streq, UI_GetActiveWindowName(), and cgameType_t::window.

Referenced by GAME_InitStartup(), and GAME_SetMode_f().

◆ GAME_SetNextUniqueCharacterNumber()

void GAME_SetNextUniqueCharacterNumber ( int ucn)
static

◆ GAME_SetServerInfo()

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

◆ GAME_Shutdown()

◆ GAME_Spawn()

◆ 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_StrDup()

char * GAME_StrDup ( const char * string)
static

Definition at line 428 of file cl_game.cpp.

References cl_genericPool, GAME_StrDup(), and Mem_PoolStrDup.

Referenced by GAME_GetImportData(), and GAME_StrDup().

◆ GAME_SwitchCurrentSelectedMap()

◆ GAME_TeamIsKnown()

bool GAME_TeamIsKnown ( const teamDef_t * teamDef)

◆ GAME_UI_Popup()

void GAME_UI_Popup ( const char * title,
const char * format,
... )
static

Definition at line 417 of file cl_game.cpp.

References format(), GAME_UI_Popup(), popupText, Q_vsnprintf(), and UI_Popup().

Referenced by GAME_GetImportData(), and GAME_UI_Popup().

◆ GAME_UnloadGame()

◆ GAME_WebDelete()

void GAME_WebDelete ( int category,
const char * filename )
static

Definition at line 473 of file cl_game.cpp.

References GAME_GetCurrentName(), GAME_WebDelete(), and WEB_CGameDelete().

Referenced by GAME_GetImportData(), and GAME_WebDelete().

◆ GAME_WebDownloadFromUser()

void GAME_WebDownloadFromUser ( int category,
const char * filename,
int userId )
static

◆ GAME_WebListForUser()

void GAME_WebListForUser ( int category,
int userId )
static

◆ GAME_WebUpload()

void GAME_WebUpload ( int category,
const char * filename )
static

Definition at line 468 of file cl_game.cpp.

References GAME_GetCurrentName(), GAME_WebUpload(), and WEB_CGameUpload().

Referenced by GAME_GetImportData(), and GAME_WebUpload().

◆ R_DrawImageCentered()

void R_DrawImageCentered ( int x,
int y,
const char * name )
static

◆ R_UploadAlpha_()

void R_UploadAlpha_ ( const char * name,
const byte * alphaData )
static

Definition at line 564 of file cl_game.cpp.

References Com_Printf(), name, R_GetImage(), R_UploadAlpha(), and R_UploadAlpha_().

Referenced by GAME_GetImportData(), and R_UploadAlpha_().

◆ UI_DrawNormImageByName_()

void UI_DrawNormImageByName_ ( bool flip,
float x,
float y,
float w,
float h,
float sh,
float th,
float sl,
float tl,
const char * name )
static

◆ UI_DrawString_()

int UI_DrawString_ ( const char * fontID,
align_t align,
int x,
int y,
const char * c )
static

Definition at line 549 of file cl_game.cpp.

References UI_DrawString(), and UI_DrawString_().

Referenced by GAME_GetImportData(), and UI_DrawString_().

◆ UI_PushWindow_()

void UI_PushWindow_ ( const char * name)
static

Definition at line 554 of file cl_game.cpp.

References name, UI_PushWindow(), and UI_PushWindow_().

Referenced by GAME_GetImportData(), and UI_PushWindow_().

Variable Documentation

◆ cgame_vals

const value_t cgame_vals[]
static
Initial value:
= {
{"window", V_STRING, offsetof(cgameType_t, window), 0},
{"name", V_STRING, offsetof(cgameType_t, name), 0},
{"equipments", V_LIST, offsetof(cgameType_t, equipmentList), 0},
{nullptr, V_NULL, 0, 0}
}
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
@ V_NULL
Definition scripts.h:49
@ V_LIST
Definition scripts.h:78
@ V_STRING
Definition scripts.h:58

Valid equipment definition values from script files.

Definition at line 991 of file cl_game.cpp.

Referenced by GAME_ParseModes().

◆ cgameTypes

cgameType_t cgameTypes[MAX_CGAMETYPES]
static

Definition at line 60 of file cl_game.cpp.

Referenced by GAME_InitUIData(), GAME_ParseModes(), GAME_SetMode_f(), and GAME_Shutdown().

◆ characters

character_t characters[MAX_ACTIVETEAM]
static

static character array that can be used by a game mode to store the needed character values.

Definition at line 186 of file cl_game.cpp.

Referenced by GAME_GetCharacter(), GAME_GetCharacterArraySize(), GAME_GetCharacterByUCN(), GAME_ResetCharacters(), and GAME_Shutdown().

◆ equipDefStandard

equipDef_t equipDefStandard
static

Definition at line 181 of file cl_game.cpp.

Referenced by GAME_GetEquipmentDefinition(), and GAME_Shutdown().

◆ geoscapeData

geoscapeData_t geoscapeData

Definition at line 147 of file cl_game.cpp.

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

◆ inventoryImport

◆ numCGameTypes

int numCGameTypes
static

Definition at line 61 of file cl_game.cpp.

Referenced by GAME_InitUIData(), GAME_ParseModes(), GAME_SetMode_f(), and GAME_Shutdown().

◆ TAG_INVENTORY