UFO: Alien Invasion
Doxygen documentation generating
cp_missions.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2023 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 "../../DateTime.h"
29 #include "cp_campaign.h"
30 
31 extern const int MAX_POS_LOOP;
32 
34 typedef enum missionStage_s {
55 
56 typedef enum {
59 
61 typedef struct missionResults_s {
62  const struct mission_s* mission;
64  bool recovery;
65  bool crashsite;
67  float ufoCondition;
68  int itemTypes;
69  int itemAmount;
73  int ownKilled;
81 
86 typedef struct mission_s {
87  int idx;
88  char id[MAX_VAR];
90  bool active;
91  union missionData_t {
97  } data;
102  class DateTime startDate;
103  class DateTime finalDate;
107  bool onGeoscape;
108  bool crashed;
110  char onwin[256];
111  char onlose[256];
112  bool posAssigned;
114 } mission_t;
115 
119 #define MIS_Foreach(var) LIST_Foreach(ccs.missions, mission_t, var)
120 
121 const char* MIS_GetName(const mission_t* mission);
122 
123 void BATTLE_SetVars(const battleParam_t* battleParameters);
124 void CP_CreateBattleParameters(mission_t* mission, battleParam_t* param, const aircraft_t* aircraft);
125 void BATTLE_Start(mission_t* mission, const battleParam_t* battleParameters);
126 mission_t* CP_GetMissionByIDSilent(const char* missionId);
127 mission_t* CP_GetMissionByID(const char* missionId);
128 int MIS_GetIdx(const mission_t* mis);
129 mission_t* MIS_GetByIdx(int id);
130 mission_t* CP_CreateNewMission(interestCategory_t category, bool beginNow);
131 void CP_UFOProceedMission(const struct campaign_s* campaign, struct aircraft_s* ufocraft);
132 void CP_MissionRemove(mission_t* mission);
133 bool CP_MissionBegin(mission_t* mission);
135 bool CP_CheckMissionLimitedInTime(const mission_t* mission);
137 void CP_MissionNotifyBaseDestroyed(const base_t* base);
138 void CP_MissionNotifyInstallationDestroyed(const installation_t* installation);
139 const char* MIS_GetModel(const mission_t* mission);
141 void CP_MissionAddToGeoscape(mission_t* mission, bool force);
142 void CP_UFORemoveFromGeoscape(mission_t* mission, bool destroyed);
144 void CP_SpawnRescueMission(aircraft_t* aircraft, aircraft_t* ufo);
145 ufoType_t CP_MissionChooseUFO(const mission_t* mission);
146 void CP_MissionStageEnd(const campaign_t* campaign, mission_t* mission);
147 void CP_InitializeSpawningDelay(void);
148 void CP_SpawnNewMissions(void);
149 void CP_MissionIsOver(mission_t* mission);
150 void CP_MissionIsOverByUFO(aircraft_t* ufocraft);
151 void CP_MissionEnd(const campaign_t* campaign, mission_t* mission, const battleParam_t* battleParameters, bool won);
152 void CP_MissionEndActions(mission_t* mission, aircraft_t* aircraft, bool won);
153 bool CP_ChooseMap(mission_t* mission, const vec2_t pos);
154 bool CP_CheckNextStageDestination(const struct campaign_s* campaign, struct aircraft_s* ufo);
155 int CP_CountMissionOnGeoscape(void);
157 
158 void MIS_InitStartup(void);
159 void MIS_Shutdown(void);
int ownKilledFriendlyFire
Definition: cp_missions.h:75
mission_t * MIS_GetByIdx(int id)
Find mission corresponding to idx.
Class describing a point of time.
Definition: DateTime.h:30
bool CP_CheckMissionLimitedInTime(const mission_t *mission)
Check if mission should end because of limited time.
missionStage_t stage
Definition: cp_missions.h:99
mission definition
Definition: cp_missions.h:86
const struct mission_s * mission
Definition: cp_missions.h:62
bool CP_CheckNextStageDestination(const struct campaign_s *campaign, struct aircraft_s *ufo)
interestCategory_t
int civiliansKilledFriendlyFire
Definition: cp_missions.h:78
A base with all it's data.
Definition: cp_base.h:84
interestCategory_t category
Definition: cp_missions.h:98
void CP_CreateBattleParameters(mission_t *mission, battleParam_t *param, const aircraft_t *aircraft)
Create parameters needed for battle. This is the data that is used for starting the tactical part of ...
short ufoType_t
Definition: scripts.h:145
void CP_SpawnRescueMission(aircraft_t *aircraft, aircraft_t *ufo)
Spawn a new rescue mission for a crashed (phalanx) aircraft.
void CP_MissionNotifyBaseDestroyed(const base_t *base)
Notify that a base has been removed.
void CP_SpawnNewMissions(void)
Spawn new missions.
void CP_MissionAddToGeoscape(mission_t *mission, bool force)
Add a mission to geoscape: make it visible and stop time.
QGL_EXTERN GLsizei const GLvoid * data
Definition: r_gl.h:89
const char * MIS_GetModel(const mission_t *mission)
Get mission model that should be shown on the geoscape.
void CP_MissionRemoveFromGeoscape(mission_t *mission)
Removes a mission from geoscape: make it non visible and call notify functions.
void MIS_Shutdown(void)
Closing actions for missions-subsystem.
A installation with all it's data.
void CP_MissionDisableTimeLimit(mission_t *mission)
Disable time limit for given mission.
void MIS_InitStartup(void)
Init actions for missions-subsystem.
City definition.
Definition: cp_nation.h:70
void CP_MissionIsOverByUFO(aircraft_t *ufocraft)
Mission is finished because Phalanx team ended it.
bool CP_CheckNewMissionDetectedOnGeoscape(void)
Check if mission has been detected by radar.
void CP_MissionStageEnd(const campaign_t *campaign, mission_t *mission)
Determine what action should be performed when a mission stage ends.
bool CP_ChooseMap(mission_t *mission, const vec2_t pos)
Choose a map for given mission.
bool CP_MissionBegin(mission_t *mission)
mission begins: UFO arrive on earth.
bool onGeoscape
Definition: cp_missions.h:107
void CP_SpawnCrashSiteMission(aircraft_t *ufo)
Spawn a new crash site after a UFO has been destroyed.
#define MAX_VAR
Definition: shared.h:36
void CP_UpdateMissionVisibleOnGeoscape(void)
Update all mission visible on geoscape (in base radar range).
int MIS_GetIdx(const mission_t *mis)
Find idx corresponding to mission.
const int MAX_POS_LOOP
Definition: cp_missions.cpp:62
int CP_CountMissionOnGeoscape(void)
Count the number of mission active and displayed on geoscape.
void CP_UFORemoveFromGeoscape(mission_t *mission, bool destroyed)
Removes (temporarily or permanently) a UFO from geoscape: make it land and call notify functions...
void BATTLE_Start(mission_t *mission, const battleParam_t *battleParameters)
Select the mission type and start the map from mission definition.
void CP_InitializeSpawningDelay(void)
Initialize spawning delay.
vec2_t pos
Definition: cp_missions.h:105
bool active
Definition: cp_missions.h:90
void CP_MissionNotifyInstallationDestroyed(const installation_t *installation)
Notify missions that an installation has been destroyed.
void BATTLE_SetVars(const battleParam_t *battleParameters)
Set some needed cvars from a battle definition.
Definition: cp_missions.cpp:79
mission_t * CP_GetMissionByIDSilent(const char *missionId)
Get a mission in ccs.missions by Id without error messages.
int initialIndividualInterest
Definition: cp_missions.h:101
alienBase_t * alienBase
Definition: cp_missions.h:95
An aircraft with all it's data.
Definition: cp_aircraft.h:115
ufoType_t CP_MissionChooseUFO(const mission_t *mission)
Choose UFO type for a given mission category.
void CP_UFOProceedMission(const struct campaign_s *campaign, struct aircraft_s *ufocraft)
void CP_MissionIsOver(mission_t *mission)
Mission is finished because Phalanx team won it.
installation_t * installation
Definition: cp_missions.h:94
const char * MIS_GetName(const mission_t *mission)
Returns a short translated name for a mission.
bool crashed
Definition: cp_missions.h:108
mission_t * CP_GetMissionByID(const char *missionId)
Get a mission in ccs.missions by Id.
vec_t vec2_t[2]
Definition: ufotypes.h:38
Header file for single player campaign control.
void CP_MissionEndActions(mission_t *mission, aircraft_t *aircraft, bool won)
Actions to be done after mission finished.
missionResults_t missionResults
Definition: cp_missions.h:113
bool posAssigned
Definition: cp_missions.h:112
void CP_MissionRemove(mission_t *mission)
Removes a mission from mission global array.
Alien Base.
Definition: cp_alienbase.h:28
aircraft_t * ufo
Definition: cp_missions.h:106
int initialOverallInterest
Definition: cp_missions.h:100
void CP_MissionEnd(const campaign_t *campaign, mission_t *mission, const battleParam_t *battleParameters, bool won)
Closing actions after fighting a battle.
missionState_t
Definition: cp_missions.h:56
ufoType_t ufotype
Definition: cp_missions.h:66
missionState_t state
Definition: cp_missions.h:63
mapDef_t * mapDef
Definition: cp_missions.h:89
Structure with mission info needed to create results summary at menu won.
Definition: cp_missions.h:61
missionStage_t
Definition: cp_missions.h:34
mission_t * CP_CreateNewMission(interestCategory_t category, bool beginNow)
Create a new mission of given category.