UFO: Alien Invasion
Loading...
Searching...
No Matches
cl_game_campaign.cpp
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#include "../../cl_shared.h"
27#include "../cl_game.h"
28#include "cp_cgame_callbacks.h"
29#include "cl_game_campaign.h"
30
31extern void GEO_Draw(geoscapeData_t* data);
32extern void GEO_DrawMarkers(const uiNode_t* node);
33extern 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 */
39linkedList_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 */
48void 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}
56void* _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
71const 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}
Shared game type headers.
#define CGAME_HARD_LINKED_FUNCTIONS
Definition cl_game.h:91
void GEO_DrawMarkers(const uiNode_t *node)
Draws all ufos, aircraft, bases and so on to the geoscape map (2D and 3D).
bool GEO_Click(const uiNode_t *node, int x, int y, const vec2_t pos)
Click on the map/geoscape.
int Com_GetMapDefNumber(void)
mapDef_t * Com_GetMapDefByIDX(int index)
linkedList_t * LIST_CopyStructure(linkedList_t *src)
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
void LIST_Sort(linkedList_t **list, linkedListSort_t sorter, const void *userData)
void FS_CloseFile(qFILE *f)
void * _Mem_Alloc(size_t size, bool zeroFill, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine)
const cgame_export_t * GetCGameAPI(const cgame_import_t *import)
void GEO_Draw(geoscapeData_t *data)
Draw the geoscape.
Singleplayer campaign game type headers.
Share stuff between the different cgame implementations.
const cgame_import_t * cgi
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)
void GAME_CP_CharacterCvars(const character_t *chr)
const char * GAME_CP_GetTeamDef(void)
void GAME_CP_InitStartup(void)
void GAME_CP_Drop(void)
character_t * GAME_CP_GetSelectedChr(void)
Returns the currently selected character.
equipDef_t * GAME_CP_GetEquipmentDefinition(void)
void GAME_CP_Shutdown(void)
const char * GAME_CP_GetItemModel(const char *string)
void GAME_CP_InitMissionBriefing(const char **title, linkedList_t **victoryConditionsMsgIDs, linkedList_t **missionBriefingMsgIDs)
void GAME_CP_Frame(float secondsSinceLastFrame)
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 GAME_CP_Spawn(linkedList_t **chrList)
bool GAME_CP_TeamIsKnown(const teamDef_t *teamDef)
Checks whether the team is known at this stage already.
void GAME_CP_InitializeBattlescape(dbuffer *msg, const linkedList_t *team)
Changes some actor states for a campaign game.
void GAME_CP_DrawBaseLayoutTooltip(int baseIdx, int x, int y)
Draws basename as tooltip for baselayout widget.
bool GAME_CP_ItemIsUseable(const objDef_t *od)
voidpf void uLong size
Definition ioapi.h:42
int(* linkedListSort_t)(linkedList_t *entry1, linkedList_t *entry2, const void *userData)
Definition list.h:36
QGL_EXTERN GLsizei const GLvoid * data
Definition r_gl.h:89
QGL_EXTERN GLuint GLsizei GLsizei * length
Definition r_gl.h:110
QGL_EXTERN GLuint index
Definition r_gl.h:110
QGL_EXTERN GLfloat f
Definition r_gl.h:114
#define OBJZERO(obj)
Definition shared.h:178
character_t *EXPORT * GetSelectedChr(void)
equipDef_t *EXPORT * GetEquipmentDefinition(void)
const char *EXPORT * GetTeamDef(void)
const char *EXPORT * GetModelForItem(const char *string)
const char * menu
Definition cgame.h:39
const char * name
Definition cgame.h:38
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
vec_t vec2_t[2]
Definition ufotypes.h:38