UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_mission_xvi.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 "cp_mission_xvi.h"
27#include "../../../DateTime.h"
28#include "../../../cl_shared.h"
29#include "../cp_campaign.h"
30#include "../cp_missions.h"
31#include "../cp_time.h"
33#include "../cp_ufo.h"
34#include "cp_mission_recon.h"
35#include "cp_mission_harvest.h"
36
49
62
67static void CP_XVIMissionStart (mission_t* mission)
68{
69 mission->stage = STAGE_SPREAD_XVI;
70
71 if (mission->ufo) {
72 const DateTime minMissionDelay(2, 0);
73 const DateTime maxMissionDelay(3, 0);
74 mission->finalDate = ccs.date + Date_Random(minMissionDelay, maxMissionDelay);
75 /* ufo becomes invisible on geoscape, but don't remove it from ufo global array (may reappear)*/
76 CP_UFORemoveFromGeoscape(mission, false);
77 } else {
78 /* Go to next stage on next frame */
79 mission->finalDate = ccs.date;
80 }
81
82 /* mission appear on geoscape, player can go there */
83 CP_MissionAddToGeoscape(mission, false);
84}
85
91{
92 switch (mission->stage) {
94 /* Create XVI Spreading mission */
95 CP_MissionBegin(mission);
96 break;
98 /* Go to mission */
99 CP_HarvestMissionGo(mission);
100 break;
102 /* just arrived on a new XVI Spreading mission: start it */
103 CP_XVIMissionStart(mission);
104 break;
105 case STAGE_SPREAD_XVI:
106 /* Leave earth */
107 CP_ReconMissionLeave(mission);
108 break;
110 /* mission is over, remove mission */
111 CP_XVIMissionIsSuccess(mission);
112 break;
113 default:
114 cgi->Com_Printf("CP_XVIMissionNextStage: Unknown stage: %i, removing mission.\n", mission->stage);
115 CP_MissionRemove(mission);
116 break;
117 }
118}
DateTime class definition.
Share stuff between the different cgame implementations.
Class describing a point of time.
Definition DateTime.h:31
void INT_ChangeIndividualInterest(float interestFactor, interestCategory_t category)
Change individual interest value.
Alien interest header.
@ INTERESTCATEGORY_BASE_ATTACK
@ INTERESTCATEGORY_BUILDING
@ INTERESTCATEGORY_XVI
@ INTERESTCATEGORY_TERROR_ATTACK
@ INTERESTCATEGORY_INTERCEPT
@ INTERESTCATEGORY_HARVEST
ccs_t ccs
Header file for single player campaign control.
const cgame_import_t * cgi
void CP_HarvestMissionGo(mission_t *mission)
Set Harvest mission, and go to mission pos.
Campaign mission headers.
void CP_ReconMissionLeave(mission_t *mission)
Recon mission ends: UFO leave earth.
Campaign mission headers.
void CP_XVIMissionIsFailure(mission_t *mission)
XVI Spreading mission is over and is a failure: change interest values.
void CP_XVIMissionNextStage(mission_t *mission)
Determine what action should be performed when a XVI Spreading mission stage ends.
static void CP_XVIMissionStart(mission_t *mission)
Start XVI Spreading mission.
void CP_XVIMissionIsSuccess(mission_t *mission)
XVI Spreading mission is over and is a success: change interest values.
Campaign mission header.
bool CP_MissionBegin(mission_t *mission)
mission begins: UFO arrive on earth.
void CP_UFORemoveFromGeoscape(mission_t *mission, bool destroyed)
Removes (temporarily or permanently) a UFO from geoscape: make it land and call notify functions.
void CP_MissionRemove(mission_t *mission)
Removes a mission from mission global array.
void CP_MissionAddToGeoscape(mission_t *mission, bool force)
Add a mission to geoscape: make it visible and stop time.
Campaign missions headers.
@ STAGE_RETURN_TO_ORBIT
Definition cp_missions.h:51
@ STAGE_MISSION_GOTO
Definition cp_missions.h:39
@ STAGE_SPREAD_XVI
Definition cp_missions.h:46
@ STAGE_NOT_ACTIVE
Definition cp_missions.h:35
@ STAGE_COME_FROM_ORBIT
Definition cp_missions.h:36
DateTime Date_Random(const DateTime &minFrame, const DateTime &maxFrame)
Return a random relative date which lies between a lower and upper limit.
Definition cp_time.cpp:239
Campaign geoscape time header.
mission definition
Definition cp_missions.h:86
aircraft_t * ufo
missionStage_t stage
Definition cp_missions.h:99
class DateTime finalDate