25 #include "../../cl_shared.h"
26 #include "../../cl_team.h"
27 #include "../cl_game.h"
28 #include "../../ui/ui_dataids.h"
80 cgi->Cvar_SetValue(
"ai_singleplayeraliens", battleParameters->
aliens);
81 cgi->Cvar_SetValue(
"ai_numcivilians", battleParameters->
civilians);
117 cgi->Cmd_ExecuteString(
"game_quicksave");
131 cgi->Com_Printf(
"Baseattack map on non-baseattack mission! (id=%s, category=%d)\n", mission->
id, mission->
category);
134 cgi->Com_Error(
ERR_DROP,
"Baseattack map without base!");
138 B_AssembleMap(maps,
sizeof(maps), coords,
sizeof(coords), base);
140 cgi->Cbuf_AddText(
"map %s \"%s\" \"%s\"\n", (
GEO_IsNight(base->
pos) ?
"night" :
"day"), maps, coords);
147 cgi->Cvar_Delete(
"g_difficulty");
151 cgi->Cbuf_AddText(
"map %s %s %s\n", (
GEO_IsNight(mission->
pos) ?
"night" :
"day"),
178 const int MAX_AVAILABLE_GROUPS = 4;
180 int numAvailableGroup = 0;
200 if (!numAvailableGroup) {
202 cgi->Com_Error(
ERR_DROP,
"CP_SetAlienTeamByInterest: no available alien team for mission '%s': interest = %i -- category = %i",
207 int pick = rand() % numAvailableGroup;
244 int i, availableEquipDef = 0;
255 cgi->Com_DPrintf(
DEBUG_CLIENT,
"CP_SetAlienEquipmentByInterest: %i available equipment packs for mission %s\n", availableEquipDef, mission->
id);
257 if (!availableEquipDef)
258 cgi->Com_Error(
ERR_DROP,
"CP_SetAlienEquipmentByInterest: no available alien equipment for mission '%s'", mission->
id);
261 const int randomNum = rand() % availableEquipDef;
263 availableEquipDef = 0;
267 if (availableEquipDef == randomNum) {
293 const int diff = max - min;
295 numAliens = min + rand() % (diff + 1);
296 numAliens = std::max(1, numAliens);
301 battleParam->
aliens = numAliens;
348 param->
param =
nullptr;
367 const char* shortUFOType;
384 Com_sprintf(mission->
onwin,
sizeof(mission->
onwin),
"ui_push popup_uforecovery \"%s\" \"%s\" \"%s\" \"%s\" %3.2f",
420 if (
Q_streq(mission->id, missionId))
437 cgi->Com_Printf(
"CP_GetMissionByID: missionId was nullptr!\n");
439 cgi->Com_Printf(
"CP_GetMissionByID: Could not find mission %s\n", missionId);
450 if (mission->idx ==
id)
478 switch (mission->
stage) {
483 return _(
"Alien terror");
488 return _(
"Base attack");
491 return va(
_(
"Alien base in %s"),
_(nation->
name));
493 return _(
"Alien base");
510 return va(
_(
"Alien activity in %s"),
_(nation->
name));
512 return _(
"Alien activity");
520 static const char* CP_MissionStageToName (
const missionStage_t stage)
524 return "Not active yet";
526 return "UFO coming from orbit";
528 return "Aerial recon underway";
530 return "Going to mission position";
532 return "Ground recon mission underway";
534 return "Terror mission underway";
536 return "Building base";
538 return "Attacking a base";
540 return "Subverting a government";
544 return "Spreading XVI";
546 return "Intercepting or attacking installation";
548 return "Leaving earth";
550 return "Base visible";
554 return "Mission over";
568 int counterVisibleMission = 0;
571 if (mission->onGeoscape) {
572 counterVisibleMission++;
576 return counterVisibleMission;
595 return "geoscape/ufocrash";
598 return "geoscape/icon_story";
603 return "geoscape/icon_rescue";
606 return "geoscape/icon_build_alien_base";
609 return "geoscape/alienbase";
611 return "geoscape/icon_recon";
613 return "geoscape/icon_xvi";
615 return "geoscape/icon_harvest";
617 return "geoscape/icon_ufocarrier";
619 return "geoscape/icon_terror";
622 return "geoscape/base2";
630 cgi->Com_Error(
ERR_DROP,
"Unknown mission interest category");
653 switch (mission->
stage) {
701 switch (mission->
stage) {
750 if (mission->
ufo && ((fabs(mission->
ufo->
pos[0] - mission->
pos[0]) > 1.0f) || (fabs(mission->
ufo->
pos[1] - mission->
pos[1]) > 1.0f))) {
751 cgi->Com_Printf(
"Error: mission (stage: %s) spawned is not at the same location as UFO\n", CP_MissionStageToName(mission->
stage));
775 bool newDetection =
false;
785 assert(!mission->ufo || !mission->ufo->detected);
787 if (
frand() <= missionDetectionProbability) {
829 assert(mission->
ufo);
846 if (removedMission->ufo && (removedMission->ufo > mission->
ufo))
847 removedMission->ufo--;
851 mission->
ufo =
nullptr;
884 cgi->Com_Error(
ERR_DROP,
"CP_MissionRemove: Could not find mission '%s' to remove.\n", mission->
id);
924 if (base == mission->data.base) {
940 if (mission->data.installation == installation)
966 if (!
cgi->LIST_IsEmpty(md->
ufos))
968 }
else if (!
cgi->LIST_IsEmpty(md->
ufos)) {
1000 int countMinimal = 0;
1001 int minMapDefAppearance = -1;
1008 if (minMapDefAppearance < 0 || md->timesAlreadyUsed < minMapDefAppearance) {
1018 if (countMinimal == 0) {
1024 cgi->Com_Error(
ERR_DROP,
"Could not find mapdef: rescue");
1032 cgi->Com_Error(
ERR_DROP,
"Could not find mapdef: ufocrash");
1037 cgi->Com_Printf(
"CP_ChooseMap: Could not find map with required conditions:\n");
1042 cgi->Com_Printf(
"(%.02f, %.02f)\n", pos[0], pos[1]);
1044 cgi->Com_Printf(
"none\n");
1049 int randomNum = rand() % countMinimal;
1060 if (randomNum == 0) {
1071 cgi->Com_Printf(
"Selected map '%s' (among %i possible maps)\n", mission->
mapDef->
id, countMinimal);
1073 cgi->Com_DPrintf(
DEBUG_CLIENT,
"Selected map '%s' (among %i possible maps)\n", mission->
mapDef->
id, countMinimal);
1085 cgi->Com_DPrintf(
DEBUG_CLIENT,
"Ending mission category %i, stage %i (time: %i day, %i sec)\n",
1130 cgi->Com_Printf(
"CP_MissionStageEnd: Invalid type of mission (%i), remove mission '%s'\n", mission->
category, mission->
id);
1192 cgi->Com_Printf(
"CP_MissionIsOver: Invalid type of mission (%i), remove mission\n", mission->
category);
1253 int numberOfSoldiers = 0;
1285 if (employee->isHiredInBase(base) && (employee->chr.HP <= 0))
1288 cgi->Com_DPrintf(
DEBUG_CLIENT,
"CP_MissionEnd - num %i\n", numberOfSoldiers);
1308 switch (mission->
stage) {
1355 const date_t minCrashDelay = {7, 0};
1357 const date_t crashDelay = {14, 0};
1362 cgi->Com_Error(
ERR_DROP,
"CP_SpawnCrashSiteMission: No mission correspond to ufo '%s'", ufo->
id);
1367 mission->
mapDef =
nullptr;
1369 cgi->Com_Printf(
"CP_SpawnCrashSiteMission: No map found, remove mission.\n");
1404 if (!pilotSurvived) {
1439 cgi->Com_Printf(
"CP_SpawnRescueMission: UFO was also destroyed.\n");
1445 if (survivors == 0) {
1453 cgi->Com_Error(
ERR_DROP,
"CP_SpawnRescueMission: mission could not be created");
1456 mission->
mapDef =
nullptr;
1458 cgi->Com_Printf(
"CP_SpawnRescueMission: Cannot set mapDef for mission %s, removing.\n", mission->
id);
1467 oldMission->
ufo =
nullptr;
1514 cgi->Com_Error(
ERR_DROP,
"MIS_IsSpawnedFromGround: Wrong mission category %i", mission->
category);
1518 const float XVI_PARAM = 10.0
f;
1519 float groundProbability;
1520 float randNumber =
frand();
1524 groundProbability = std::max(0.1
f, groundProbability);
1526 return randNumber < groundProbability;
1541 mission->
ufo =
nullptr;
1551 if (!mission->
ufo) {
1552 cgi->Com_Printf(
"CP_MissionBegin: Could not add UFO '%s', remove mission %s\n",
1616 cgi->Com_Error(
ERR_DROP,
"CP_MissionChooseUFO: Wrong mission category %i", mission->
category);
1619 const short ufoIdsNum =
cgi->Com_GetUFOIdsNum();
1620 if (numTypes > ufoIdsNum)
1621 cgi->Com_Error(
ERR_DROP,
"CP_MissionChooseUFO: Too many values UFOs (%i/%i)", numTypes, ufoIdsNum);
1627 const float randNumber =
frand();
1630 int idx = (
int) (numTypes * randNumber);
1631 if (idx >= numTypes) {
1635 return ufoTypes[idx];
1676 const date_t minNextSpawningDate = {0, 0};
1677 const date_t nextSpawningDate = {3, 0};
1690 mission.
ufo =
nullptr;
1720 int i, randomNumber;
1725 randomNumber = (
int) (
frand() * (float) sum);
1727 for (i = 0; randomNumber >= 0; i++)
1745 spawn_delay = (
int) (spawn_delay / 3);
1749 float nonOccurrence;
1770 for (
int i = 0;
i < newMissionNum;
i++) {
1771 if (
frand() > nonOccurrence) {
1804 static void MIS_SpawnNewMissions_f (
void)
1809 if (
cgi->Cmd_Argc() < 2) {
1810 cgi->Com_Printf(
"Usage: %s <category> [<type>]\n",
cgi->
Cmd_Argv(0));
1813 cgi->Com_Printf(
"...%i: %s", category, INT_InterestCategoryToName(category));
1815 cgi->Com_Printf(
" <0:Random, 1:Aerial, 2:Ground>");
1817 cgi->Com_Printf(
" <0:Subverse Government, 1:Build Base>");
1819 cgi->Com_Printf(
" <0:Intercept aircraft, 1:Attack installation>");
1820 cgi->Com_Printf(
"\n");
1825 if (
cgi->Cmd_Argc() >= 3)
1830 if (category == INTERESTCATEGORY_MAX)
1840 cgi->Com_Printf(
"CP_BuildBaseSetUpBase: could not create base\n");
1849 cgi->Com_Printf(
"No base yet\n");
1855 cgi->Com_Printf(
"No aircraft in base\n");
1864 cgi->Com_Printf(
"CP_SpawnNewMissions_f: Could not add mission, abort\n");
1874 if (type == 1 && mission->
ufo)
1898 cgi->Com_Printf(
"Type is not implemented for this category.\n");
1901 cgi->Com_Printf(
"Spawned mission with id '%s'\n", mission->
id);
1907 static void MIS_MissionSetMap_f (
void)
1911 if (
cgi->Cmd_Argc() < 3) {
1912 cgi->Com_Printf(
"Usage: %s <missionid> <mapdef>\n",
cgi->
Cmd_Argv(0));
1917 if (mapDef ==
nullptr) {
1918 cgi->Com_Printf(
"Could not find mapdef for %s\n",
cgi->
Cmd_Argv(2));
1921 mission->
mapDef = mapDef;
1928 static void MIS_MissionList_f (
void)
1930 bool noMission =
true;
1933 cgi->Com_Printf(
"mission: '%s'\n", mission->
id);
1934 cgi->Com_Printf(
"...category %i. '%s' -- stage %i. '%s'\n", mission->
category,
1935 INT_InterestCategoryToName(mission->
category), mission->
stage, CP_MissionStageToName(mission->
stage));
1936 cgi->Com_Printf(
"...mapDef: '%s'\n", mission->
mapDef ? mission->
mapDef->
id :
"No mapDef defined");
1937 cgi->Com_Printf(
"...start (day = %i, sec = %i), ends (day = %i, sec = %i)\n",
1939 cgi->Com_Printf(
"...pos (%.02f, %.02f)%s -- mission %son Geoscape\n", mission->
pos[0], mission->
pos[1], mission->
posAssigned ?
"(assigned Pos)" :
"", mission->
onGeoscape ?
"" :
"not ");
1943 cgi->Com_Printf(
"...UFO: no UFO\n");
1947 cgi->Com_Printf(
"No mission currently in game.\n");
1954 static void MIS_DeleteMissions_f (
void)
1961 cgi->Com_Printf(
"CP_DeleteMissions_f: Error, there are still %i UFO in game afer removing all missions. Force removal.\n",
ccs.
numUFOs);
1971 static void MIS_DeleteMission_f (
void)
1975 if (
cgi->Cmd_Argc() < 2) {
2076 bool defaultAssigned =
false;
2084 if (mission.
idx <= 0) {
2085 cgi->Com_Printf(
"mission has invalid or no index\n");
2090 if (name && name[0] !=
'\0') {
2093 cgi->Com_Printf(
"Warning: mapdef \"%s\" for mission \"%s\" doesn't exist. Removing mission!\n", name, mission.
id);
2097 mission.
mapDef =
nullptr;
2101 cgi->Com_Printf(
"Invalid mission category '%s'\n", categoryId);
2106 cgi->Com_Printf(
"Invalid mission stage '%s'\n", stageId);
2126 cgi->Com_Printf(
"......warning: base %i (%s) is supposedly under attack but base status doesn't match!\n", base->
idx, base->
name);
2129 cgi->Com_Printf(
"......warning: Missing BaseIndex\n");
2138 cgi->Com_Printf(
"Mission on non-existent installation\n");
2148 cgi->Com_Printf(
"Error while loading rescue mission (missionidx %i, aircraftidx: %i, category: %i, stage: %i)\n",
2167 cgi->Com_Printf(
"Error loading Alien Base mission (missionidx %i, baseidx: %i, category: %i, stage: %i): no such base\n",
2184 if (mission.
pos[0] > 0.001 || mission.
pos[1] > 0.001)
2185 defaultAssigned =
true;
2198 {
"debug_missionsetmap", MIS_MissionSetMap_f,
"Changes the map for a spawned mission"},
2199 {
"debug_missionadd", MIS_SpawnNewMissions_f,
"Add a new mission"},
2200 {
"debug_missiondeleteall", MIS_DeleteMissions_f,
"Remove all missions from global array"},
2201 {
"debug_missiondelete", MIS_DeleteMission_f,
"Remove mission by a given name"},
2202 {
"debug_missionlist", MIS_MissionList_f,
"Debug function to show all missions"},
2204 {
nullptr,
nullptr,
nullptr}
2213 cgi->Cmd_TableAddList(debugMissionCmds);
2224 cgi->Cmd_TableRemoveList(debugMissionCmds);
void AIR_AircraftsNotifyUFORemoved(const aircraft_t *const ufo, bool destroyed)
Notify that a UFO has been removed.
static const float MAX_CRASHEDUFO_CONDITION
aircraft_t ufos[MAX_UFOONGEOSCAPE]
int CP_GetAverageXVIRate(void)
Return the average XVI rate.
void GEO_UpdateGeoscapeDock(void)
Will add missions and UFOs to the geoscape dock panel.
alienTeamCategory_t alienCategories[ALIENCATEGORY_MAX]
void CP_TerrorMissionNextStage(mission_t *mission)
Determine what action should be performed when a Terror attack mission stage ends.
bool CP_CheckNewMissionDetectedOnGeoscape(void)
Check if mission has been detected by radar.
#define AIRFIGHT_WEAPON_CAN_NEVER_SHOOT
int UFO_GetOneAvailableUFOForMission(const interestCategory_t missionType, bool checkInterest)
Get a suitable UFO for the mission type.
void CP_BuildBaseMissionOnSpawn(void)
Run when the mission is spawned.
#define GEO_SetSelectedAircraft(aircraft)
void CP_InterceptMissionIsFailure(mission_t *mission)
Intercept mission is over and is a failure: change interest values.
void UFO_SetRandomDest(aircraft_t *ufocraft)
Give a random destination to the given UFO, and make him to move there.
alien team category definition
void MIS_Shutdown(void)
Closing actions for missions-subsystem.
Header file for character (soldier, alien) related campaign functions.
Campaign mission headers.
A installation with all it's data.
QGL_EXTERN GLint GLenum type
bool CP_CheckMissionLimitedInTime(const mission_t *mission)
Check if mission should end because of limited time.
bool CP_CheckNextStageDestination(const campaign_t *campaign, aircraft_t *ufocraft)
Check if a stage mission is over when UFO reached destination.
static const constListEntry_t saveInterestConstants[]
void CP_MissionStageEnd(const campaign_t *campaign, mission_t *mission)
Determine what action should be performed when a mission stage ends.
#define DELAY_BETWEEN_MISSION_SPAWNING
The length of a single mission spawn cycle.
bool CP_ChooseMap(mission_t *mission, const vec2_t pos)
Choose a map for given mission.
#define SAVE_INTERESTCAT_NAMESPACE
missionSpawnFunction_t missionSpawnCallback
void CP_InterceptNextStage(mission_t *mission)
Determine what action should be performed when a Intercept mission stage ends.
void CP_SupplyMissionNextStage(mission_t *mission)
Determine what action should be performed when a Supply mission stage ends.
void CP_HarvestMissionNextStage(mission_t *mission)
Determine what action should be performed when a Harvesting mission stage ends.
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
void CP_BuildBaseMissionIsFailure(mission_t *mission)
Build Base mission is over and is a failure (from an alien point of view): change interest values...
void CAP_AddCurrent(base_t *base, baseCapacities_t capacity, int value)
Changes the current (used) capacity on a base.
#define E_Foreach(employeeType, var)
const aircraft_t * AIR_IsEmployeeInAircraft(const Employee *employee, const aircraft_t *aircraft)
Tells you if an employee is assigned to an aircraft.
header file UI callbacks for missions.
#define MIS_Foreach(var)
iterates through missions
void CP_ReconMissionGroundGo(mission_t *mission)
Set ground mission, and go to ground mission pos.
void *IMPORT * LIST_GetRandom(linkedList_t *list)
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
#define B_IsUnderAttack(base)
void AB_SetAlienBasePosition(vec2_t pos)
Set new base position.
linkedList_t * populations
void CP_BaseAttackMissionLeave(mission_t *mission)
Base attack mission ends: UFO leave earth.
const teamDef_t * alienTeams[MAX_TEAMS_PER_MISSION]
#define SAVE_MISSIONS_INITIALINDIVIDUALINTEREST
ufoType_t getUfoType() const
mission_t * CP_GetMissionByID(const char *missionId)
Get a mission in ccs.missions by Id.
const char * getWeather(const byte *const color)
Translate color value to terrain type to random weather code.
int initialIndividualInterest
void CHAR_UpdateData(linkedList_t *updateCharacters)
Transforms the battlescape values to the character.
static bool CP_IsAlienEquipmentSelectable(const mission_t *mission, const equipDef_t *equip, linkedList_t *equipPack)
Check if an alien equipment may be used with a mission.
void INT_ChangeIndividualInterest(float interestFactor, interestCategory_t category)
Change individual interest value.
static void CP_SetAlienTeamByInterest(mission_t *mission, battleParam_t *battleParameters)
Sets the alien races used for a mission.
void GEO_NotifyMissionRemoved(const mission_t *mission)
Notify that a mission has been removed.
aircraft_t * AIR_AircraftGetFromIDX(int aircraftIdx)
Returns aircraft for a given global index.
void CP_RescueNextStage(mission_t *mission)
Determine what action should be performed when a Rescue mission stage ends.
equipDef_t eds[MAX_EQUIPDEFS]
Campaign mission headers.
Campaign mission headers.
aircraft_t * UFO_AddToGeoscape(ufoType_t ufoType, const vec2_t destination, mission_t *mission)
Add a UFO to geoscape.
void CP_HarvestMissionIsFailure(mission_t *mission)
Harvesting mission is over and is a failure: change interest values.
void AIR_AircraftsNotifyMissionRemoved(const mission_t *const mission)
Notify aircraft that a mission has been removed.
const byte * GEO_GetColor(const vec2_t pos, mapType_t type, bool *coast)
Returns the color value from geoscape of a certain mask (terrain, culture or population) at a given p...
static bool MIS_IsSpawnedFromGround(const mission_t *mission)
Decides if the mission should be spawned from the ground (without UFO)
#define SAVE_MISSIONSTAGE_NAMESPACE
void CP_SpawnCrashSiteMission(aircraft_t *ufo)
Spawn a new crash site after a UFO has been destroyed.
#define SAVE_MISSIONS_INITIALOVERALLINTEREST
void CP_ReconMissionIsFailure(mission_t *mission)
Recon mission is over and is a failure: change interest values.
installation_t * installation
int AB_GetAlienBaseNumber(void)
Check number of alien bases.
#define SAVE_MISSIONS_CRASHED
void CP_SpawnNewMissions(void)
Spawn new missions.
int CP_CountMissionOnGeoscape(void)
Count the number of mission active and displayed on geoscape.
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
void CP_SupplyMissionIsSuccess(mission_t *mission)
Supply mission is over and is a success (from an alien point of view): change interest values...
const char * UFO_GetName(const aircraft_t *ufocraft)
Returns name of the UFO if UFO has been researched.
void CP_MissionNotifyBaseDestroyed(const base_t *base)
Notify that a base has been removed.
static void MIS_CreateAlienTeam(mission_t *mission, battleParam_t *battleParam)
Set number of aliens in mission.
static void CP_CreateCivilianTeam(const mission_t *mission, battleParam_t *param)
Create civilian team.
#define SAVE_MISSIONS_ONLOSE
void CP_EndRescueMission(mission_t *mission, aircraft_t *aircraft, bool won)
Actions to be done when rescue mission finished/expired.
bool RADAR_CheckRadarSensored(const vec2_t pos)
Check if the specified position is within base radar range.
baseCapacities_t AIR_GetHangarCapacityType(const aircraft_t *aircraft)
Returns capacity type needed for an aircraft.
alienTeamGroup_t alienTeamGroups[MAX_ALIEN_GROUP_PER_CATEGORY]
uiMessageListNodeMessage_t * MS_AddNewMessage(const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup, bool playSound)
Adds a new message to message stack.
struct mission_s * mission
#define SAVE_MISSIONS_ACTIVE
void CP_BuildBaseMissionNextStage(const campaign_t *campaign, mission_t *mission)
Determine what action should be performed when a Build Base mission stage ends.
memPool_t * cp_campaignPool
void CP_GameTimeStop(void)
Stop game time speed.
void BATTLE_Start(mission_t *mission, const battleParam_t *battleParameters)
Select the mission type and start the map from mission definition.
void CP_MissionEndActions(mission_t *mission, aircraft_t *aircraft, bool won)
Actions to be done after mission finished.
void CP_InitializeSpawningDelay(void)
Initialize spawning delay.
A base with all it's data.
base_t * B_GetFoundedBaseByIDX(int baseIdx)
Array bound check for the base index.
void CP_HandleNationData(float minHappiness, mission_t *mis, const nation_t *affectedNation, const missionResults_t *results, bool won)
Updates each nation's happiness. Should be called at the completion or expiration of every mission...
void BATTLE_SetVars(const battleParam_t *battleParameters)
Set some needed cvars from a battle definition.
int GEO_GetCivilianNumberByPosition(const vec2_t pos)
Get number of civilian on a map at given position.
const linkedList_t *IMPORT * LIST_ContainsString(const linkedList_t *list, const char *string)
const char *IMPORT * Com_UFOCrashedTypeToShortName(ufoType_t type)
const teamDef_t * alienTeams[MAX_TEAMS_PER_MISSION]
bool E_DeleteEmployee(Employee *employee)
Removes the employee completely from the game (buildings + global list).
void CP_InterceptMissionLeave(mission_t *mission, bool destroyed)
Intercept mission ends: UFO leave earth.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
void setUfoType(ufoType_t ufoT)
const chrTemplate_t * alienChrTemplates[MAX_TEAMS_PER_MISSION]
xmlNode_t *IMPORT * XML_GetDate(xmlNode_t *parent, const char *name, int *day, int *sec)
static const char * CP_MissionGetMessage(const mission_t *mission)
Assembles a message that is send to the gamer once the given mission is added to geoscape.
void CP_XVIMissionIsSuccess(mission_t *mission)
XVI Spreading mission is over and is a success: change interest values.
cvar_t *IMPORT * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
static missionDetectionStatus_t CP_CheckMissionVisibleOnGeoscape(const mission_t *mission)
Check if a mission should be visible on geoscape.
void CP_InterceptAircraftMissionSet(mission_t *mission)
Set Intercept mission: UFO looks for new aircraft target.
aircraft_t * aircraftCurrent
Campaign mission headers.
#define SAVE_MISSIONS_STARTDATE
struct mission_s * mission
Campaign mission triggers.
int AIRFIGHT_ChooseWeapon(const aircraftSlot_t *slot, int maxSlot, const vec2_t pos, const vec2_t targetPos)
Choose the weapon an attacking aircraft will use to fire on a target.
void B_DumpAircraftToHomeBase(aircraft_t *aircraft)
Will unload all cargo to the homebase.
void CP_TerrorMissionIsFailure(mission_t *mission)
Terror attack mission is over and is a failure: change interest values.
#define SAVE_MISSIONS_MISSION
Campaign mission headers.
void GEO_NotifyUFORemoved(const aircraft_t *ufo, bool destroyed)
Notify that a UFO has been removed.
int UFO_GetAvailableUFOsForMission(const interestCategory_t missionType, ufoType_t *ufoTypes, bool checkInterest)
Fill an array with available UFOs for the mission type.
aircraft_t * AIR_GetFirstFromBase(const base_t *b)
Iterates through the aircraft of a base.
battleParam_t battleParameters
int MIS_GetIdx(const mission_t *mis)
Find idx corresponding to mission.
bool AIR_PilotSurvivedCrash(const aircraft_t *aircraft)
Determine if an aircraft's pilot survived a crash, based on his piloting skill (and a bit of randomne...
void AIR_AircraftReturnToBase(aircraft_t *aircraft)
Calculates the way back to homebase for given aircraft and returns it.
mapDef_t *IMPORT * Com_GetMapDefinitionByID(const char *mapDefID)
void CP_ExecuteMissionTrigger(const mission_t *mission, bool won)
Executes console commands after a mission.
void CP_InterceptGoToInstallation(mission_t *mission)
Set Intercept mission: UFO chooses an installation an flies to it.
ufoType_t CP_MissionChooseUFO(const mission_t *mission)
Choose UFO type for a given mission category.
Campaign missions headers.
void CP_XVIMissionNextStage(mission_t *mission)
Determine what action should be performed when a XVI Spreading mission stage ends.
void CP_BaseAttackMissionIsFailure(mission_t *mission)
Base attack mission is over and is a failure (from an alien point of view): change interest values...
#define SAVE_MISSIONS_BASEINDEX
static messageType_t CP_MissionGetMessageLevel(const mission_t *mission)
Decides which message level to take for the given mission.
const cgame_import_t * cgi
bool CP_MissionBegin(mission_t *mission)
mission begins: UFO arrive on earth.
#define SAVE_MISSIONS_ONWIN
static const cmdList_t debugMissionCmds[]
bool GEO_PositionFitsTCPNTypes(const vec2_t pos, const linkedList_t *terrainTypes, const linkedList_t *cultureTypes, const linkedList_t *populationTypes, const linkedList_t *nations)
Checks for a given location, if it fulfills all criteria given via parameters (terrain, culture, population, nation type)
const char *IMPORT * Com_UFOTypeToShortName(ufoType_t type)
void CP_MissionRemove(mission_t *mission)
Removes a mission from mission global array.
char alienEquipment[MAX_VAR]
void RADAR_NotifyUFORemoved(const aircraft_t *ufo, bool destroyed)
Notify to every radar that the specified ufo has been removed from geoscape.
void CP_MissionAddToGeoscape(mission_t *mission, bool force)
Add a mission to geoscape: make it visible and stop time.
const char *IMPORT * Com_GetConstVariable(const char *space, int value)
bool CP_BasemissionIsSubvertingGovernmentMission(const mission_t *mission)
char const * Q_strstart(char const *str, char const *start)
Matches the start of a string.
void CP_SupplyMissionIsFailure(mission_t *mission)
Supply mission is over and is a failure (from an alien point of view): change interest values...
Engine-side time information in the game.
enum missionStage_s missionStage_t
void CP_UFOProceedMission(const campaign_t *campaign, aircraft_t *ufo)
Make UFO proceed with its mission when the fight with another aircraft is over (and UFO survived)...
Employee * AIR_GetPilot(const aircraft_t *aircraft)
Get pilot of an aircraft.
missionDetectionStatus_s
possible mission detection status
void CP_MissionEnd(const campaign_t *campaign, mission_t *mission, const battleParam_t *battleParameters, bool won)
Closing actions after fighting a battle.
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 ...
static const float MIN_CRASHEDUFO_CONDITION
void MIS_InitStartup(void)
Init actions for missions-subsystem.
base_t * B_GetBaseByIDX(int baseIdx)
Array bound check for the base index. Will also return unfounded bases as long as the index is in the...
Campaign geoscape time header.
void CP_UFOCarrierNextStage(mission_t *mission)
Determine what action should be performed when a UFOCarriering mission stage ends.
alien team group definition.
#define MapDef_ForeachSingleplayerCampaign(var)
aircraftSlot_t weapons[MAX_AIRCRAFTSLOT]
date_t Date_Add(date_t a, const date_t &b)
Add two dates and return the result.
Header for Geoscape management.
void CP_UpdateMissionVisibleOnGeoscape(void)
Update all mission visible on geoscape (in base radar range).
static bool CP_MapIsSelectable(const mission_t *mission, const mapDef_t *md, const vec2_t pos)
Check if a map may be selected for mission.
bool MIS_SaveXML(xmlNode_t *parent)
Save callback for savegames in XML Format.
int initialOverallInterest
#define GEO_GetMissionAircraft()
char cp_messageBuffer[MAX_MESSAGE_TEXT]
void CP_InterceptMissionIsSuccess(mission_t *mission)
Intercept mission is over and is a success: change interest values.
void CP_ReconMissionNextStage(mission_t *mission)
Determine what action should be performed when a Recon mission stage ends.
const GLuint *typedef void(APIENTRY *GenRenderbuffersEXT_t)(GLsizei
void CP_BaseAttackMissionDestroyBase(mission_t *mission)
Base attack mission ends: UFO leave earth.
bool GEO_IsNight(const vec2_t pos)
Check whether given position is Day or Night.
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
#define SAVE_MISSIONS_ONGEOSCAPE
Campaign mission headers.
linkedList_t * updateCharacters
void CP_MissionIsOverByUFO(aircraft_t *ufocraft)
Mission is finished because Phalanx team ended it.
static bool CP_IsAlienTeamForCategory(const alienTeamCategory_t *cat, const interestCategory_t missionCat)
Check if an alien team category may be used for a mission category.
baseCapacities_t
All possible capacities in base.
Structure of all stats collected for an actor over time.
union mission_s::missionData_t data
void AIR_DestroyAircraft(aircraft_t *aircraft, bool killPilot)
Removes an aircraft from its base and the game.
#define SAVE_MISSIONS_ALIENBASEINDEX
void CP_SpawnRescueMission(aircraft_t *aircraft, aircraft_t *ufo)
Spawn a new rescue mission for a crashed (phalanx) aircraft.
#define SAVE_MISSIONS_CATEGORY
xmlNode_t *IMPORT * XML_GetPos2(xmlNode_t *parent, const char *name, vec2_t pos)
const char *IMPORT * Com_GetRandomMapAssemblyNameForCraft(const char *craftID)
Campaign mission headers.
enum interestCategory_s interestCategory_t
#define SAVE_MISSIONS_MISSION_IDX
float frand(void)
Return random values between 0 and 1.
void CP_BaseAttackMissionNextStage(mission_t *mission)
Determine what action should be performed when a Base Attack mission stage ends.
void MIS_InitCallbacks(void)
Init UI callbacks for missions-subsystem.
#define FINAL_OVERALL_INTEREST
xmlNode_t *IMPORT * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
void CP_MissionNotifyInstallationDestroyed(const installation_t *installation)
Notify missions that an installation has been destroyed.
const char *IMPORT * Com_GetRandomMapAssemblyNameForCrashedCraft(const char *craftID)
interestCategory_t category
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
void CP_CheckLostCondition(const campaign_t *campaign)
Checks whether the player has lost the campaign.
alienBase_t * AB_GetByIDX(int baseIDX)
Get Alien Base per Idx.
#define SAVE_MISSIONS_FINALDATE
#define MAX_TEAMS_PER_MISSION
void CP_SpawnAlienBaseMission(alienBase_t *alienBase)
Spawn a new alien base mission after it has been discovered.
void CP_TerrorMissionOnSpawn(void)
Run when the mission is spawned.
#define SAVE_MISSIONS_INSTALLATIONINDEX
void UFO_DetectNewUFO(aircraft_t *ufocraft)
Perform actions when a new UFO is detected.
const int DETECTION_INTERVAL
delay between actions that must be executed independently of time scale
static void CP_SetMissionName(mission_t *mission)
Set mission name.
alienBase_t * AB_BuildBase(const vec2_t pos)
Build a new alien base.
void CP_UFORemoveFromGeoscape(mission_t *mission, bool destroyed)
Removes (temporarily or permanently) a UFO from geoscape: make it land and call notify functions...
#define MapIsWater(color)
#define SAVE_MISSIONS_CRASHED_AIRCRAFT
missionResults_t missionResults
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
#define Vector2Copy(src, dest)
Header file for single player campaign control.
void UFO_SendToDestination(aircraft_t *ufo, const vec2_t dest)
Make the specified UFO go to destination.
static const constListEntry_t saveMissionConstants[]
xmlNode_t *IMPORT * XML_AddNode(xmlNode_t *parent, const char *name)
void CP_BuildBaseMissionBaseDestroyed(mission_t *mission)
Alien base has been destroyed: change interest values.
Campaign mission headers.
bool B_AssembleMap(char *maps, size_t mapsLength, char *coords, size_t coordsLength, const base_t *base)
Perform the base assembling in case of an alien attack.
#define SAVE_MISSIONS_POS
const chrTemplate_t * alienChrTemplates[MAX_TEAMS_PER_MISSION]
#define SAVE_MISSIONS_STAGE
static void CP_SetAlienEquipmentByInterest(const mission_t *mission, linkedList_t *equipPack, battleParam_t *battleParameters)
Set alien equipment for a mission (depends on the interest values)
void CP_ReconMissionAerial(mission_t *mission)
Set aerial mission.
const char * MIS_GetName(const mission_t *mission)
Returns a short translated name for a mission.
char *IMPORT * PoolStrDup(const char *in, memPool_t *pool, const int tagNum)
date_t Date_Random(date_t minFrame, date_t maxFrame)
Return a random relative date which lies between a lower and upper limit.
An aircraft with all it's data.
city_t * CITY_GetByPos(vec2_t pos)
Finds a city by it's geoscape coordinates.
void CHAR_UpdateStats(const base_t *base, const aircraft_t *aircraft)
Update employees stats after mission.
int lastMissionSpawnedDelay
XML tag constants for savegame.
void CP_BaseAttackMissionIsSuccess(mission_t *mission)
Base attack mission is over and is a success (from an alien point of view): change interest values...
void UFO_RemoveFromGeoscape(aircraft_t *ufo)
Remove the specified ufo from geoscape.
#define EARLY_UFO_RUSH_INTEREST
Determines the early game period during which DELAY_BETWEEN_MISSION_SPAWNING is halved.
void MIS_ShutdownCallbacks(void)
Close UI callbacks for missions-subsystem.
mission_t * CP_GetMissionByIDSilent(const char *missionId)
Get a mission in ccs.missions by Id without error messages.
void CP_XVIMissionIsFailure(mission_t *mission)
XVI Spreading mission is over and is a failure: change interest values.
void CP_MissionRemoveFromGeoscape(mission_t *mission)
Removes a mission from geoscape: make it non visible and call notify functions.
mission_t * MIS_GetByIdx(int id)
Find mission corresponding to idx.
enum missionDetectionStatus_s missionDetectionStatus_t
possible mission detection status
void CP_MissionDisableTimeLimit(mission_t *mission)
Disable time limit for given mission.
nation_t * GEO_GetNation(const vec2_t pos)
Translate nation map color to nation.
const char *IMPORT * Cmd_Argv(int n)
alienTeamGroup_t * alienTeamGroup
interestCategory_t missionCategories[INTERESTCATEGORY_MAX]
#define SAVE_MISSIONS_POSASSIGNED
static interestCategory_t CP_SelectNewMissionType(void)
Select new mission type.
const char *IMPORT * XML_GetString(xmlNode_t *parent, const char *name)
xmlNode_t *IMPORT * XML_GetNode(xmlNode_t *parent, const char *name)
void AIRFIGHT_RemoveProjectileAimingAircraft(const aircraft_t *aircraft)
Set all projectile aiming a given aircraft to an idle destination.
void CP_BaseAttackMissionOnSpawn(void)
Run when the mission is spawned.
const char * MIS_GetModel(const mission_t *mission)
Get mission model that should be shown on the geoscape.
#define SAVE_MISSIONS_MAPDEF_ID
mission_t * CP_CreateNewMission(interestCategory_t category, bool beginNow)
Create a new mission of given category.
void CP_BuildBaseMissionIsSuccess(mission_t *mission)
Build Base mission is over and is a success (from an alien point of view): change interest values...
bool MIS_LoadXML(xmlNode_t *parent)
Load callback for savegames in XML Format.
int interest[INTERESTCATEGORY_MAX]
void CP_MissionIsOver(mission_t *mission)
Mission is finished because Phalanx team won it.
#define GEO_IsAircraftSelected(aircraft)
XML tag constants for savegame.
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.
Describes a character with all its attributes.
const char * getTerrainName(const byte *const color) const
Translate color value to terrain type.