UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
cp_mission_triggers.cpp
Go to the documentation of this file.
1
5
6
/*
7
Copyright (C) 2002-2025 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 "
../../ui/ui_dataids.h
"
/* TEXT_STANDARD */
28
#include "
cp_campaign.h
"
29
#include "
cp_missions.h
"
30
#include "
cp_mission_triggers.h
"
31
#include "
cp_event_callbacks.h
"
32
41
void
CP_ExecuteMissionTrigger
(
const
mission_t
* mission,
bool
won)
42
{
43
cgi
->Com_DPrintf(
DEBUG_CLIENT
,
"Execute mission triggers\n"
);
44
45
if
(mission ==
nullptr
)
46
return
;
47
48
/* we add them only here - and remove them afterwards to prevent cheating */
49
CP_CampaignTriggerFunctions
(
true
);
50
51
if
(won) {
52
if
(
Q_strvalid
(mission->
onwin
)) {
53
cgi
->Com_DPrintf(
DEBUG_CLIENT
,
"...won - executing '%s'\n"
, mission->
onwin
);
54
cgi
->Cmd_ExecuteString(
"%s"
, mission->
onwin
);
55
}
56
if
(mission->
mapDef
&&
Q_strvalid
(mission->
mapDef
->
onwin
)) {
57
cgi
->Com_DPrintf(
DEBUG_CLIENT
,
"...won - executing '%s'\n"
, mission->
mapDef
->
onwin
);
58
cgi
->Cmd_ExecuteString(
"%s"
, mission->
mapDef
->
onwin
);
59
}
60
}
else
{
61
if
(
Q_strvalid
(mission->
onlose
)) {
62
cgi
->Com_DPrintf(
DEBUG_CLIENT
,
"...lost - executing '%s'\n"
, mission->
onlose
);
63
cgi
->Cmd_ExecuteString(
"%s"
, mission->
onlose
);
64
}
65
if
(mission->
mapDef
&&
Q_strvalid
(mission->
mapDef
->
onlose
)) {
66
cgi
->Com_DPrintf(
DEBUG_CLIENT
,
"...lost - executing '%s'\n"
, mission->
mapDef
->
onlose
);
67
cgi
->Cmd_ExecuteString(
"%s"
, mission->
mapDef
->
onlose
);
68
}
69
}
70
71
CP_CampaignTriggerFunctions
(
false
);
72
}
cl_shared.h
Share stuff between the different cgame implementations.
cp_campaign.h
Header file for single player campaign control.
cgi
const cgame_import_t * cgi
Definition
cp_cgame_callbacks.cpp:39
CP_CampaignTriggerFunctions
void CP_CampaignTriggerFunctions(bool add)
Add/Remove temporary mission trigger functions.
Definition
cp_event_callbacks.cpp:147
cp_event_callbacks.h
CP_ExecuteMissionTrigger
void CP_ExecuteMissionTrigger(const mission_t *mission, bool won)
Executes console commands after a mission.
Definition
cp_mission_triggers.cpp:41
cp_mission_triggers.h
Campaign mission triggers.
cp_missions.h
Campaign missions headers.
DEBUG_CLIENT
#define DEBUG_CLIENT
Definition
defines.h:59
Q_strvalid
#define Q_strvalid(string)
Definition
shared.h:141
mapDef_t::onwin
char * onwin
Definition
q_shared.h:497
mapDef_t::onlose
char * onlose
Definition
q_shared.h:498
mission_t
mission definition
Definition
cp_missions.h:86
mission_t::mapDef
mapDef_t * mapDef
Definition
cp_missions.h:89
mission_t::onwin
char onwin[256]
Definition
cp_missions.h:110
mission_t::onlose
char onlose[256]
Definition
cp_missions.h:111
ui_dataids.h
src
client
cgame
campaign
cp_mission_triggers.cpp
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0