UFO: Alien Invasion
Loading...
Searching...
No Matches
cl_game.h
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#pragma once
27
28#include "../cl_shared.h"
29#include "../ui/ui_main.h"
30
31#include "cgame.h"
32
34struct cgame_export_s;
35
36#define GAME_IsSingleplayer() (!GAME_IsMultiplayer())
37bool GAME_IsMultiplayer(void);
38void GAME_ParseModes(const char* name, const char** text);
39void GAME_InitStartup(void);
40void GAME_Shutdown(void);
41void GAME_InitUIData(void);
42void GAME_UnloadGame(void);
43void GAME_SetMode(const struct cgame_export_s* gametype);
44void GAME_ReloadMode(void);
45void GAME_Init(bool load);
46void GAME_DisplayItemInfo(uiNode_t* node, const char* string);
47bool GAME_ItemIsUseable(const objDef_t* od);
48void GAME_HandleResults(dbuffer* msg, int winner, int* numSpawned, int* numAlive, int numKilled[][MAX_TEAMS], int numStunned[][MAX_TEAMS], bool nextmap);
49void GAME_SpawnSoldiers(void);
50void GAME_StartMatch(void);
51const char* GAME_GetRelativeSavePath(char* buf, size_t bufSize);
52const char* GAME_GetAbsoluteSavePath(char* buf, size_t bufSize);
54bool GAME_HandleServerCommand(const char* command, dbuffer* msg);
55void GAME_AddChatMessage(const char* format, ...);
56void GAME_CharacterCvars(const character_t* chr);
60const char* GAME_GetCurrentName(void);
61void GAME_ResetCharacters(void);
62void GAME_GenerateTeam(const char* teamDefID, const equipDef_t* ed, int teamMembers);
63void GAME_AppendTeamMember(int memberIndex, const char* teamDefID, const equipDef_t* ed);
64void GAME_StartBattlescape(bool isTeamPlay);
65void GAME_InitMissionBriefing(const char* title);
66void GAME_EndBattlescape(void);
67void GAME_EndRoundAnnounce(int playerNum, int team);
68bool GAME_TeamIsKnown(const teamDef_t* teamDef);
69void GAME_NotifyEvent(event_t eventType);
70const char* GAME_GetTeamDef(void);
71void GAME_Drop(void);
72void GAME_Frame(void);
73void GAME_DrawBaseLayout(int baseIdx, int x, int y, int totalMarge, int w, int h, int padding, const vec4_t bgcolor, const vec4_t color);
74void GAME_DrawBaseLayoutTooltip(int baseIdx, int x, int y);
75const char* GAME_GetModelForItem(const objDef_t* od, struct uiModel_s** menuModel);
78bool GAME_IsTeamEmpty(void);
79int GAME_GetCurrentTeam(void);
82void GAME_MapClick(uiNode_t* node, int x, int y, const vec2_t pos);
83void GAME_SetServerInfo(const char* server, const char* serverport);
85int GAME_GetChrMaxLoad(const character_t* chr);
86
87const equipDef_t* GAME_ChangeEquip(const linkedList_t* equipmentList, changeEquipType_t changeType, const char* equipID);
88
89#ifndef HARD_LINKED_CGAME
90/* this is only here so the functions in the shared code can link */
91#define CGAME_HARD_LINKED_FUNCTIONS \
92void Sys_Error (const char* error, ...) \
93{ \
94 va_list argptr; \
95 char text[1024]; \
96 va_start(argptr, error); \
97 Q_vsnprintf(text, sizeof(text), error, argptr); \
98 va_end(argptr); \
99 cgi->Sys_Error("%s", text); \
100} \
101\
102void Com_Printf (const char* msg, ...) \
103{ \
104 va_list argptr; \
105 char text[1024]; \
106 va_start(argptr, msg); \
107 Q_vsnprintf(text, sizeof(text), msg, argptr); \
108 va_end(argptr); \
109 cgi->Com_Printf("%s", text); \
110} \
111\
112void Com_DPrintf (int level, const char* msg, ...) \
113{ \
114 va_list argptr; \
115 char text[1024]; \
116 va_start(argptr, msg); \
117 Q_vsnprintf(text, sizeof(text), msg, argptr); \
118 va_end(argptr); \
119 cgi->Com_DPrintf(level, "%s", text); \
120}
121#else
122#define CGAME_HARD_LINKED_FUNCTIONS
123#endif
Client game mode interface.
changeEquipType_t
Definition cgame.h:92
geoscapeData_t geoscapeData
Definition cl_game.cpp:147
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.
Definition cl_game.cpp:1592
void GAME_InitStartup(void)
Definition cl_game.cpp:1669
void GAME_EndRoundAnnounce(int playerNum, int team)
Send end round announcements.
Definition cl_game.cpp:325
void GAME_StartMatch(void)
Definition cl_game.cpp:1399
character_t * GAME_GetSelectedChr(void)
Returns the currently selected character.
Definition cl_game.cpp:1555
void GAME_AddChatMessage(const char *format,...)
Definition cl_game.cpp:370
character_t * GAME_GetCharacterByUCN(int ucn)
Returns a character that can be used to store the game type specific character values.
Definition cl_game.cpp:211
equipDef_t * GAME_GetEquipmentDefinition(void)
Definition cl_game.cpp:1423
bool GAME_ItemIsUseable(const objDef_t *od)
Definition cl_game.cpp:1104
bool GAME_IsTeamEmpty(void)
Definition cl_game.cpp:388
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)
Definition cl_game.cpp:1508
void GAME_Frame(void)
Called every frame and allows us to hook into the current running game mode.
Definition cl_game.cpp:1496
void GAME_DisplayItemInfo(uiNode_t *node, const char *string)
Shows game type specific item information (if it's not resolvable via objDef_t).
Definition cl_game.cpp:338
void GAME_DrawMap(geoscapeData_t *data)
Definition cl_game.cpp:931
void GAME_NotifyEvent(event_t eventType)
Definition cl_game.cpp:1432
void GAME_SwitchCurrentSelectedMap(int step)
Definition cl_game.cpp:912
void GAME_AppendTeamMember(int memberIndex, const char *teamDefID, const equipDef_t *ed)
Definition cl_game.cpp:252
void GAME_Shutdown(void)
Definition cl_game.cpp:1690
void GAME_UnloadGame(void)
Definition cl_game.cpp:900
const char * GAME_GetAbsoluteSavePath(char *buf, size_t bufSize)
Definition cl_game.cpp:1417
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.
Definition cl_game.cpp:1135
void GAME_InitMissionBriefing(const char *title)
Definition cl_game.cpp:1311
size_t GAME_GetCharacterArraySize(void)
Definition cl_game.cpp:227
void GAME_GenerateTeam(const char *teamDefID, const equipDef_t *ed, int teamMembers)
Definition cl_game.cpp:276
void GAME_DrawMapMarkers(uiNode_t *node)
Definition cl_game.cpp:938
void GAME_SpawnSoldiers(void)
Called during startup of mission to send team info.
Definition cl_game.cpp:1378
bool GAME_IsMultiplayer(void)
Definition cl_game.cpp:299
void GAME_MapClick(uiNode_t *node, int x, int y, const vec2_t pos)
Definition cl_game.cpp:945
character_t * GAME_GetCharacter(int index)
Returns a character that can be used to store the game type specific character values.
Definition cl_game.cpp:197
void GAME_ParseModes(const char *name, const char **text)
Definition cl_game.cpp:999
void GAME_DrawBaseLayoutTooltip(int baseIdx, int x, int y)
Cgame callback to draw tooltip for baselayout UI node.
Definition cl_game.cpp:1521
int GAME_GetChrMaxLoad(const character_t *chr)
Returns the max weight the given character can carry.
Definition cl_game.cpp:1577
void GAME_Init(bool load)
const char * GAME_GetTeamDef(void)
Definition cl_game.cpp:1251
void GAME_ResetCharacters(void)
Reset all characters in the static character array.
Definition cl_game.cpp:244
bool GAME_TeamIsKnown(const teamDef_t *teamDef)
Definition cl_game.cpp:1439
void GAME_InitUIData(void)
Fills the game mode list entries with the parsed values from the script.
Definition cl_game.cpp:1649
const mapDef_t * GAME_GetCurrentSelectedMap(void)
Definition cl_game.cpp:921
const char * GAME_GetCurrentName(void)
Definition cl_game.cpp:232
const char * GAME_GetRelativeSavePath(char *buf, size_t bufSize)
Definition cl_game.cpp:1411
void GAME_EndBattlescape(void)
This is called when a client quits the battlescape.
Definition cl_game.cpp:314
bool GAME_HandleServerCommand(const char *command, dbuffer *msg)
Definition cl_game.cpp:361
void GAME_SetServerInfo(const char *server, const char *serverport)
Definition cl_game.cpp:347
int GAME_GetCurrentTeam(void)
Definition cl_game.cpp:926
void GAME_StartBattlescape(bool isTeamPlay)
Called when the server sends the EV_START event.
Definition cl_game.cpp:1296
void GAME_ReloadMode(void)
Definition cl_game.cpp:290
void GAME_Drop(void)
Definition cl_game.cpp:1467
const char * GAME_GetModelForItem(const objDef_t *od, struct uiModel_s **menuModel)
void GAME_CharacterCvars(const character_t *chr)
Definition cl_game.cpp:1451
void GAME_SetMode(const struct cgame_export_s *gametype)
Share stuff between the different cgame implementations.
#define MAX_TEAMS
Definition defines.h:98
voidpf void * buf
Definition ioapi.h:42
event_t
Possible event values.
Definition q_shared.h:79
void format(__printf__, 1, 2)))
QGL_EXTERN GLsizei const GLvoid * data
Definition r_gl.h:89
QGL_EXTERN GLuint index
Definition r_gl.h:110
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
QGL_EXTERN GLuint GLsizei bufSize
Definition r_gl.h:110
Describes a character with all its attributes.
Definition chr_shared.h:388
Defines all attributes of objects used in the inventory.
Definition inv_shared.h:264
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
vec_t vec4_t[4]
Definition ufotypes.h:40
vec_t vec2_t[2]
Definition ufotypes.h:38