UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_game.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, 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 
34 struct cgame_export_s;
35 
36 #define GAME_IsSingleplayer() (!GAME_IsMultiplayer())
37 bool GAME_IsMultiplayer(void);
38 void GAME_ParseModes(const char* name, const char** text);
39 void GAME_InitStartup(void);
40 void GAME_Shutdown(void);
41 void GAME_InitUIData(void);
42 void GAME_UnloadGame(void);
43 void GAME_SetMode(const struct cgame_export_s* gametype);
44 void GAME_ReloadMode(void);
45 void GAME_Init(bool load);
46 void GAME_DisplayItemInfo(uiNode_t* node, const char* string);
47 bool GAME_ItemIsUseable(const objDef_t* od);
48 void GAME_HandleResults(dbuffer* msg, int winner, int* numSpawned, int* numAlive, int numKilled[][MAX_TEAMS], int numStunned[][MAX_TEAMS], bool nextmap);
49 void GAME_SpawnSoldiers(void);
50 void GAME_StartMatch(void);
51 const char* GAME_GetRelativeSavePath(char* buf, size_t bufSize);
52 const char* GAME_GetAbsoluteSavePath(char* buf, size_t bufSize);
54 bool GAME_HandleServerCommand(const char* command, dbuffer* msg);
55 void GAME_AddChatMessage(const char* format, ...);
56 void GAME_CharacterCvars(const character_t* chr);
59 size_t GAME_GetCharacterArraySize(void);
60 const char* GAME_GetCurrentName(void);
61 void GAME_ResetCharacters(void);
62 void GAME_GenerateTeam(const char* teamDefID, const equipDef_t* ed, int teamMembers);
63 void GAME_AppendTeamMember(int memberIndex, const char* teamDefID, const equipDef_t* ed);
64 void GAME_StartBattlescape(bool isTeamPlay);
65 void GAME_InitMissionBriefing(const char* title);
66 void GAME_EndBattlescape(void);
67 void GAME_EndRoundAnnounce(int playerNum, int team);
68 bool GAME_TeamIsKnown(const teamDef_t* teamDef);
69 void GAME_NotifyEvent(event_t eventType);
70 const char* GAME_GetTeamDef(void);
71 void GAME_Drop(void);
72 void GAME_Frame(void);
73 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);
74 void GAME_DrawBaseLayoutTooltip(int baseIdx, int x, int y);
75 const char* GAME_GetModelForItem(const objDef_t* od, struct uiModel_s** menuModel);
77 void GAME_SwitchCurrentSelectedMap(int step);
78 bool GAME_IsTeamEmpty(void);
79 int GAME_GetCurrentTeam(void);
81 void GAME_DrawMapMarkers(uiNode_t* node);
82 void GAME_MapClick(uiNode_t* node, int x, int y, const vec2_t pos);
83 void GAME_SetServerInfo(const char* server, const char* serverport);
85 int GAME_GetChrMaxLoad(const character_t* chr);
86 
87 const 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 \
92 void 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 \
102 void 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 \
112 void 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
int int int int w
Definition: cgame.h:69
const linkedList_t * team
Definition: cgame.h:66
void GAME_Drop(void)
Definition: cl_game.cpp:1658
size_t GAME_GetCharacterArraySize(void)
Definition: cl_game.cpp:226
void GAME_UnloadGame(void)
Definition: cl_game.cpp:900
bool GAME_IsMultiplayer(void)
Definition: cl_game.cpp:299
int int int int int int const vec4_t bgcolor
Definition: cgame.h:69
#define MAX_TEAMS
Definition: defines.h:98
void GAME_EndBattlescape(void)
This is called when a client quits the battlescape.
Definition: cl_game.cpp:314
void GAME_SetServerInfo(const char *server, const char *serverport)
Definition: cl_game.cpp:347
void GAME_AddChatMessage(const char *format,...)
Definition: cl_game.cpp:370
void GAME_Shutdown(void)
Definition: cl_game.cpp:1884
void GAME_AppendTeamMember(int memberIndex, const char *teamDefID, const equipDef_t *ed)
Definition: cl_game.cpp:251
void GAME_NotifyEvent(event_t eventType)
Definition: cl_game.cpp:1623
void GAME_SetMode(const struct cgame_export_s *gametype)
const char * GAME_GetTeamDef(void)
Definition: cl_game.cpp:1442
void GAME_DrawMap(geoscapeData_t *data)
Definition: cl_game.cpp:931
void GAME_ParseModes(const char *name, const char **text)
Definition: cl_game.cpp:1167
void GAME_SwitchCurrentSelectedMap(int step)
Definition: cl_game.cpp:912
const char * GAME_GetModelForItem(const objDef_t *od, struct uiModel_s **menuModel)
Get a model for an item.
Definition: cl_game.cpp:1725
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:210
int int y
Definition: cgame.h:69
Defines all attributes of objects used in the inventory.
Definition: inv_shared.h:264
void GAME_Frame(void)
Called every frame and allows us to hook into the current running game mode.
Definition: cl_game.cpp:1687
voidpf void * buf
Definition: ioapi.h:42
dbuffer * msg
Definition: cgame.h:77
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
int GAME_GetChrMaxLoad(const character_t *chr)
Returns the max weight the given character can carry.
Definition: cl_game.cpp:1768
void GAME_ResetCharacters(void)
Reset all characters in the static character array.
Definition: cl_game.cpp:243
bool GAME_ItemIsUseable(const objDef_t *od)
Definition: cl_game.cpp:1295
character_t * GAME_GetSelectedChr(void)
Returns the currently selected character.
Definition: cl_game.cpp:1746
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:1783
void GAME_SpawnSoldiers(void)
Called during startup of mission to send team info.
Definition: cl_game.cpp:1569
int int int int int h
Definition: cgame.h:69
event_t
Possible event values.
Definition: q_shared.h:79
changeEquipType_t
Definition: cgame.h:92
void GAME_GenerateTeam(const char *teamDefID, const equipDef_t *ed, int teamMembers)
Definition: cl_game.cpp:276
void GAME_Init(bool load)
int int int int int int const vec4_t const vec4_t color
Definition: cgame.h:69
void GAME_CharacterCvars(const character_t *chr)
Definition: cl_game.cpp:1642
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
void GAME_ReloadMode(void)
Definition: cl_game.cpp:290
int int const vec2_t pos
Definition: cgame.h:81
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:196
const char * GAME_GetCurrentName(void)
Definition: cl_game.cpp:231
bool GAME_TeamIsKnown(const teamDef_t *teamDef)
Definition: cl_game.cpp:1630
void GAME_DrawMapMarkers(uiNode_t *node)
Definition: cl_game.cpp:938
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:1699
QGL_EXTERN GLuint index
Definition: r_gl.h:110
void GAME_InitStartup(void)
Definition: cl_game.cpp:1860
void GAME_EndRoundAnnounce(int playerNum, int team)
Send end round announcements.
Definition: cl_game.cpp:325
bool GAME_IsTeamEmpty(void)
Definition: cl_game.cpp:388
int int int int int int padding
Definition: cgame.h:69
equipDef_t * GAME_GetEquipmentDefinition(void)
Definition: cl_game.cpp:1614
Client game mode interface.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
void GAME_InitUIData(void)
Fills the game mode list entries with the parsed values from the script.
Definition: cl_game.cpp:1840
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:1326
int int bool nextmap
Definition: cgame.h:48
bool GAME_HandleServerCommand(const char *command, dbuffer *msg)
Definition: cl_game.cpp:361
vec_t vec2_t[2]
Definition: ufotypes.h:38
void GAME_DrawBaseLayoutTooltip(int baseIdx, int x, int y)
Cgame callback to draw tooltip for baselayout UI node.
Definition: cl_game.cpp:1712
void GAME_StartBattlescape(bool isTeamPlay)
Called when the server sends the EV_START event.
Definition: cl_game.cpp:1487
void GAME_MapClick(uiNode_t *node, int x, int y, const vec2_t pos)
Definition: cl_game.cpp:945
const char * GAME_GetAbsoluteSavePath(char *buf, size_t bufSize)
Definition: cl_game.cpp:1608
GLsizei const GLvoid * data
Definition: r_gl.h:152
const mapDef_t * GAME_GetCurrentSelectedMap(void)
Definition: cl_game.cpp:921
Model that have more than one part (top and down part of an aircraft)
Definition: ui_node_model.h:47
int GAME_GetCurrentTeam(void)
Definition: cl_game.cpp:926
QGL_EXTERN GLuint GLsizei bufSize
Definition: r_gl.h:110
void GAME_InitMissionBriefing(const char *title)
Definition: cl_game.cpp:1502
void GAME_StartMatch(void)
Definition: cl_game.cpp:1590
geoscapeData_t geoscapeData
Definition: cl_game.cpp:146
void format(__printf__, 1, 2)))
int int int totalMarge
Definition: cgame.h:69
const char * GAME_GetRelativeSavePath(char *buf, size_t bufSize)
Definition: cl_game.cpp:1602
vec_t vec4_t[4]
Definition: ufotypes.h:40
Describes a character with all its attributes.
Definition: chr_shared.h:369