UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_game_campaign.cpp
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 #include "../../cl_shared.h"
27 #include "../cl_game.h"
28 #include "cp_cgame_callbacks.h"
29 #include "cl_game_campaign.h"
30 
31 extern void GEO_Draw(geoscapeData_t* data);
32 extern void GEO_DrawMarkers(const uiNode_t* node);
33 extern bool GEO_Click(const uiNode_t* node, int x, int y, const vec2_t pos);
34 
36 
37 #ifndef HARD_LINKED_CGAME
38 /* These are here to allow common code to link */
39 linkedList_t* LIST_Add (linkedList_t** listDest, void const* data, size_t length)
40 {
41  return cgi->LIST_Add(listDest, data, length);
42 }
44 {
45  cgi->FS_CloseFile(f);
46 }
47 /* Used by macros */
48 void LIST_Sort (linkedList_t** list, linkedListSort_t sorter, const void* userData)
49 {
50  cgi->LIST_Sort(list, sorter, userData);
51 }
53 {
54  return cgi->LIST_CopyStructure(src);
55 }
56 void* _Mem_Alloc (size_t size, bool zeroFill, memPool_t* pool, const int tagNum, const char* fileName, const int fileLine)
57 {
58  return cgi->Alloc(size, zeroFill, pool, tagNum, fileName, fileLine);
59 }
61 {
62  return cgi->csi->numMDs;
63 }
65 {
66  return &cgi->csi->mds[index];
67 }
68 
70 #else
71 const cgame_export_t* GetCGameCampaignAPI (const cgame_import_t* import)
72 #endif
73 {
74  static cgame_export_t e;
75 
76  OBJZERO(e);
77 
78  e.name = "Campaign mode";
79  e.menu = "campaign";
80  e.Init = GAME_CP_InitStartup;
81  e.Shutdown = GAME_CP_Shutdown;
82  e.Spawn = GAME_CP_Spawn;
83  e.Results = GAME_CP_Results;
84  e.IsItemUseable = GAME_CP_ItemIsUseable;
87  e.UpdateCharacterValues = GAME_CP_CharacterCvars;
88  e.IsTeamKnown = GAME_CP_TeamIsKnown;
90  e.Drop = GAME_CP_Drop;
91  e.InitializeBattlescape = GAME_CP_InitializeBattlescape;
92  e.InitMissionBriefing = GAME_CP_InitMissionBriefing;
93  e.RunFrame = GAME_CP_Frame;
94  e.DrawBaseLayout = GAME_CP_DrawBaseLayout;
95  e.DrawBaseLayoutTooltip = GAME_CP_DrawBaseLayoutTooltip;
97  e.MapDraw = GEO_Draw;
98  e.MapDrawMarkers = GEO_DrawMarkers;
99  e.MapClick = GEO_Click;
100 
101  cgi = import;
102 
103  return &e;
104 }
void *IMPORT * Alloc(size_t size, bool zeroFill, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine)
void GAME_CP_InitMissionBriefing(const char **title, linkedList_t **victoryConditionsMsgIDs, linkedList_t **missionBriefingMsgIDs)
mapDef_t mds[MAX_MAPDEFS]
Definition: q_shared.h:571
int numMDs
Definition: q_shared.h:572
void * _Mem_Alloc(size_t size, bool zeroFill, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine)
void GAME_CP_Drop(void)
int(* linkedListSort_t)(linkedList_t *entry1, linkedList_t *entry2, const void *userData)
Definition: list.h:36
csi_t * csi
Definition: cgame.h:100
const char *EXPORT * GetModelForItem(const char *string)
void GEO_Draw(geoscapeData_t *data)
Draw the geoscape.
#define CGAME_HARD_LINKED_FUNCTIONS
Definition: cl_game.h:91
void GAME_CP_Results(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.
bool GEO_Click(const uiNode_t *node, int x, int y, const vec2_t pos)
Click on the map/geoscape.
GLsizei size
Definition: r_gl.h:152
void GAME_CP_DrawBaseLayout(int baseIdx, int x1, int y1, int totalMarge, int w, int h, int padding, const vec4_t bgcolor, const vec4_t color)
#define OBJZERO(obj)
Definition: shared.h:178
QGL_EXTERN GLuint GLsizei GLsizei * length
Definition: r_gl.h:110
mapDef_t * Com_GetMapDefByIDX(int index)
void LIST_Sort(linkedList_t **list, linkedListSort_t sorter, const void *userData)
character_t *EXPORT * GetSelectedChr(void)
const cgame_import_t * cgi
Singleplayer campaign game type headers.
void GAME_CP_Frame(float secondsSinceLastFrame)
void GAME_CP_InitializeBattlescape(dbuffer *msg, const linkedList_t *team)
Changes some actor states for a campaign game.
void FS_CloseFile(qFILE *f)
linkedList_t * LIST_CopyStructure(linkedList_t *src)
bool GAME_CP_Spawn(linkedList_t **chrList)
linkedList_t *IMPORT * LIST_CopyStructure(linkedList_t *src)
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
const char * GAME_CP_GetTeamDef(void)
equipDef_t * GAME_CP_GetEquipmentDefinition(void)
void GEO_DrawMarkers(const uiNode_t *node)
Draws all ufos, aircraft, bases and so on to the geoscape map (2D and 3D)
void GAME_CP_InitStartup(void)
QGL_EXTERN GLuint index
Definition: r_gl.h:110
bool GAME_CP_TeamIsKnown(const teamDef_t *teamDef)
Checks whether the team is known at this stage already.
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
void GAME_CP_CharacterCvars(const character_t *chr)
QGL_EXTERN GLfloat f
Definition: r_gl.h:114
const char * GAME_CP_GetItemModel(const char *string)
const cgame_export_t * GetCGameAPI(const cgame_import_t *import)
bool GAME_CP_ItemIsUseable(const objDef_t *od)
void GAME_CP_Shutdown(void)
int Com_GetMapDefNumber(void)
vec_t vec2_t[2]
Definition: ufotypes.h:38
void GAME_CP_DrawBaseLayoutTooltip(int baseIdx, int x, int y)
Draws basename as tooltip for baselayout widget.
const char * menu
Definition: cgame.h:39
equipDef_t *EXPORT * GetEquipmentDefinition(void)
GLsizei const GLvoid * data
Definition: r_gl.h:152
linkedList_t *IMPORT * LIST_Add(linkedList_t **list, void const *data, size_t length)
const char * name
Definition: cgame.h:38
character_t * GAME_CP_GetSelectedChr(void)
Returns the currently selected character.
const char *EXPORT * GetTeamDef(void)