cp_missions.c File Reference

Campaign missions code. More...

#include "../cl_shared.h"
#include "../cl_renderer.h"
#include "../cl_team.h"
#include "../cl_game.h"
#include "../ui/ui_main.h"
#include "cp_campaign.h"
#include "cp_map.h"
#include "cp_ufo.h"
#include "cp_alienbase.h"
#include "cp_alien_interest.h"
#include "cp_missions.h"
#include "cp_time.h"
#include "cp_xvi.h"
#include "save/save_missions.h"
#include "save/save_interest.h"
Include dependency graph for cp_missions.c:

Go to the source code of this file.

Functions

void CP_SetMissionVars (const mission_t *mission)
 Set some needed cvars from mission definition.
void CP_StartMissionMap (mission_t *mission)
 Select the mission type and start the map from mission definition.
static qboolean CP_IsAlienTeamForCategory (const alienTeamCategory_t const *cat, const interestCategory_t missionCat)
 Check if an alien team category may be used for a mission category.
static void CP_SetAlienTeamByInterest (const mission_t *mission)
 Sets the alien races used for a mission.
static qboolean CP_IsAlienEquipmentSelectable (const mission_t *mission, const equipDef_t *equip)
 Check if an alien equipment may be used with a mission.
static void CP_SetAlienEquipmentByInterest (const mission_t *mission)
 Set alien equipment for a mission (depends on the interest values).
static void CP_CreateAlienTeam (mission_t *mission)
 Set number of aliens in mission.
static void CP_CreateCivilianTeam (const mission_t *mission)
 Create civilian team.
void CP_CreateBattleParameters (mission_t *mission, battleParam_t *param)
 Create parameters needed for battle. This is the data that is used for starting the tactical part of the mission.
mission_tCP_GetMissionByIDSilent (const char *missionId)
 Get a mission in ccs.missions by Id without error messages.
mission_tCP_GetMissionByID (const char *missionId)
 Get a mission in ccs.missions by Id.
mission_tMAP_GetMissionByIDX (int id)
 Find mission corresponding to idx.
int MAP_GetIDXByMission (const mission_t *mis)
 Find idx corresponding to mission.
const char * CP_MissionToTypeString (const mission_t *mission)
 Return the type of mission.
int CP_CountMission (void)
 Count the number of mission created.
int CP_CountMissionActive (void)
 Count the number of mission created and active.
int CP_CountMissionOnGeoscape (void)
 Count the number of mission active and displayed on geoscape.
const char * MAP_GetMissionModel (const mission_t *mission)
 Get mission model that should be shown on the geoscape.
static missionDetectionStatus_t CP_CheckMissionVisibleOnGeoscape (const mission_t const *mission)
 Check if a mission should be visible on geoscape.
void CP_MissionRemoveFromGeoscape (mission_t *mission)
 Removes a mission from geoscape: make it non visible and call notify functions.
static messageType_t CP_MissionGetMessageLevel (const mission_t *mission)
 Decides which message level to take for the given mission.
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_MissionAddToGeoscape (mission_t *mission, qboolean force)
 Add a mission to geoscape: make it visible and stop time.
qboolean CP_CheckNewMissionDetectedOnGeoscape (void)
 Check if mission has been detected by radar.
void CP_UpdateMissionVisibleOnGeoscape (void)
 Update all mission visible on geoscape (in base radar range).
void CP_UFORemoveFromGeoscape (mission_t *mission, qboolean 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_MissionDisableTimeLimit (mission_t *mission)
 Disable time limit for given mission.
qboolean CP_CheckMissionLimitedInTime (const mission_t *mission)
 Check if mission should end because of limited time.
void CP_MissionNotifyBaseDestroyed (const base_t *base)
 Notify that a base has been removed.
void CP_MissionNotifyInstallationDestroyed (const installation_t const *installation)
 Notify missions that an installation has been destroyed.
void CP_MissionStageEnd (mission_t *mission)
 Determine what action should be performed when a mission stage ends.
void CP_MissionIsOver (mission_t *mission)
 Mission is finished because Phalanx team won it.
void CP_MissionIsOverByUFO (aircraft_t *ufocraft)
 Mission is finished because Phalanx team ended it.
static qboolean CP_TransferOfAliensToOtherBaseNeeded (const base_t *base, const missionResults_t *missionResults)
 Checks whether aliens can be stored on a base or should be transfered to another.
void CP_MissionEndActions (mission_t *mission, aircraft_t *aircraft, qboolean won)
 Actions to be done after mission finished.
void CP_MissionEnd (mission_t *mission, qboolean won)
qboolean CP_CheckNextStageDestination (aircraft_t *ufocraft)
 Check if a stage mission is over when UFO reached destination.
void CP_UFOProceedMission (aircraft_t *ufo)
 Make UFO proceed with its mission when the fight with another aircraft is over (and UFO survived).
void CP_SpawnCrashSiteMission (aircraft_t *ufo)
 Spawn a new crash site after a UFO has been destroyed.
void CP_SpawnRescueMission (aircraft_t *aircraft, aircraft_t *ufo)
 Spawn a new rescue mission for a crashed aircraft.
qboolean CP_MissionBegin (mission_t *mission)
 mission begins: UFO arrive on earth.
ufoType_t CP_MissionChooseUFO (const mission_t *mission)
 Choose UFO type for a given mission category.
static void CP_SetMissionName (mission_t *mission)
 Set mission name.
mission_tCP_CreateNewMission (interestCategory_t category, qboolean beginNow)
 Create a new mission of given category.
static int CP_SelectNewMissionType (void)
 Select new mission type.
void CP_SpawnNewMissions (void)
 Spawn new missions.
void CP_InitializeSpawningDelay (void)
 Initialize spawning delay.
qboolean CP_SaveMissionsXML (mxml_node_t *parent)
 Save callback for savegames in XML Format.
qboolean CP_LoadMissionsXML (mxml_node_t *parent)
 Load callback for savegames in XML Format.
void CP_MissionsInit (void)

Variables

const int MAX_POS_LOOP = 10
static const float MIN_CRASHEDUFO_CONDITION = 0.2f
static const float MAX_CRASHEDUFO_CONDITION = 0.81f

Detailed Description

Campaign missions code.

Definition in file cp_missions.c.


Function Documentation

qboolean CP_CheckMissionLimitedInTime ( const mission_t mission  ) 

Check if mission should end because of limited time.

Note:
This function is used for better readibility.
See also:
CP_MissionDisableTimeLimit
Returns:
qtrue if function should end after finalDate

Definition at line 982 of file cp_missions.c.

References date_s::day, and mission_s::finalDate.

Referenced by CP_CheckMissionEnd().

static missionDetectionStatus_t CP_CheckMissionVisibleOnGeoscape ( const mission_t const *  mission  )  [static]
qboolean CP_CheckNewMissionDetectedOnGeoscape ( void   ) 

Check if mission has been detected by radar.

Note:
called every DETECTION_INTERVAL.
See also:
RADAR_CheckUFOSensored
Returns:
True if a new mission was detected.

Definition at line 816 of file cp_missions.c.

References ccs, CP_CheckMissionVisibleOnGeoscape(), CP_MissionAddToGeoscape(), linkedList_s::data, aircraft_s::detected, DETECTION_INTERVAL, frand(), MAP_IsRadarOverlayActivated(), MAP_SetOverlay(), MISDET_MAY_BE_DETECTED, ccs_s::missions, linkedList_s::next, mission_s::onGeoscape, qfalse, qtrue, and mission_s::ufo.

Referenced by CL_CampaignFunctionPeriodicCall().

qboolean CP_CheckNextStageDestination ( aircraft_t ufocraft  ) 

Check if a stage mission is over when UFO reached destination.

Parameters:
[in] ufocraft Pointer to the ufo that reached destination.
See also:
UFO_CampaignRunUFOs
Returns:
True if UFO is removed from global array (and therefore pointer ufocraft can't be used anymore).

Definition at line 1288 of file cp_missions.c.

References CP_MissionStageEnd(), aircraft_s::mission, qfalse, qtrue, mission_s::stage, STAGE_COME_FROM_ORBIT, STAGE_MISSION_GOTO, and STAGE_RETURN_TO_ORBIT.

Referenced by UFO_CampaignRunUFOs().

int CP_CountMission ( void   ) 

Count the number of mission created.

Returns:
Number of created mission
See also:
CP_CountMissionActive
CP_CountMissionOnGeoscape

Definition at line 562 of file cp_missions.c.

References ccs, Com_Printf(), linkedList_s::data, ccs_s::missions, linkedList_s::next, mission_s::stage, and STAGE_OVER.

Referenced by CP_MissionRemove().

int CP_CountMissionActive ( void   ) 

Count the number of mission created and active.

Returns:
Number of active mission
See also:
CP_CountMission
CP_CountMissionOnGeoscape

Definition at line 593 of file cp_missions.c.

References ccs, Com_DPrintf(), linkedList_s::data, DEBUG_CLIENT, ccs_s::missions, linkedList_s::next, mission_s::stage, STAGE_NOT_ACTIVE, and STAGE_OVER.

int CP_CountMissionOnGeoscape ( void   ) 

Count the number of mission active and displayed on geoscape.

Returns:
Number of active mission visible on geoscape
See also:
CP_CountMission
CP_CountMissionActive

Definition at line 618 of file cp_missions.c.

References ccs, linkedList_s::data, ccs_s::missions, linkedList_s::next, mission_s::onGeoscape, mission_s::stage, STAGE_NOT_ACTIVE, and STAGE_OVER.

Referenced by MAP_GetGeoscapeAngle().

static void CP_CreateAlienTeam ( mission_t mission  )  [static]

Set number of aliens in mission.

Parameters:
[in] mission Pointer to the mission that generates the battle.
See also:
CP_SetAlienTeamByInterest

Definition at line 273 of file cp_missions.c.

References battleParam_s::aliens, ccs_s::battleParameters, ccs, CP_SetAlienEquipmentByInterest(), CP_SetAlienTeamByInterest(), mission_s::mapDef, mapDef_s::maxAliens, aircraft_s::maxTeamSize, ccs_s::overallInterest, mission_s::posAssigned, and mission_s::ufo.

Referenced by CP_CreateBattleParameters().

void CP_CreateBattleParameters ( mission_t mission,
battleParam_t param 
)
static void CP_CreateCivilianTeam ( const mission_t mission  )  [static]

Create civilian team.

Parameters:
[in] mission Pointer to the mission that generates the battle

Todo:
There should always be a nation, no? Otherwise the mission was placed wrong.

Definition at line 295 of file cp_missions.c.

References ccs_s::battleParameters, ccs, battleParam_s::civilians, battleParam_s::civTeam, nation_s::id, MAP_GetCivilianNumberByPosition(), MAP_GetNation(), battleParam_s::nation, mission_s::pos, mission_s::posAssigned, and Q_strncpyz().

Referenced by CP_CreateBattleParameters().

mission_t* CP_CreateNewMission ( interestCategory_t  category,
qboolean  beginNow 
)
mission_t* CP_GetMissionByID ( const char *  missionId  ) 

Get a mission in ccs.missions by Id.

Parameters:
[in] missionId Unique string id for the mission
Returns:
pointer to the mission or NULL if Id was NULL or mission not found

Definition at line 407 of file cp_missions.c.

References Com_Printf(), and CP_GetMissionByIDSilent().

Referenced by AIR_PostLoadInitMissions().

mission_t* CP_GetMissionByIDSilent ( const char *  missionId  ) 

Get a mission in ccs.missions by Id without error messages.

Parameters:
[in] missionId Unique string id for the mission
Returns:
pointer to the mission or NULL if Id was NULL or mission not found

Definition at line 386 of file cp_missions.c.

References ccs, linkedList_s::data, mission_s::id, ccs_s::missions, and linkedList_s::next.

Referenced by CP_GetMissionByID(), and CP_SetMissionName().

void CP_InitializeSpawningDelay ( void   ) 

Initialize spawning delay.

See also:
CP_SpawnNewMissions
Note:
only called when new game is started, in order to spawn new event on the beginning of the game.

Definition at line 1715 of file cp_missions.c.

References ccs, CP_SpawnNewMissions(), DELAY_BETWEEN_MISSION_SPAWNING, and ccs_s::lastMissionSpawnedDelay.

Referenced by CP_CampaignInit().

static qboolean CP_IsAlienEquipmentSelectable ( const mission_t mission,
const equipDef_t equip 
) [static]

Check if an alien equipment may be used with a mission.

Parameters:
[in] mission Pointer to the mission.
[in] equip Pointer to the alien equipment to check.
Returns:
True if equipment definition is selectable.

Definition at line 209 of file cp_missions.c.

References ccs_s::alienCategories, battleParam_s::alienTeamGroup, ccs_s::battleParameters, alienTeamGroup_s::categoryIdx, ccs, linkedList_s::data, alienTeamCategory_s::equipment, mission_s::initialOverallInterest, equipDef_s::maxInterest, equipDef_s::minInterest, equipDef_s::name, linkedList_s::next, qfalse, and qtrue.

Referenced by CP_SetAlienEquipmentByInterest().

static qboolean CP_IsAlienTeamForCategory ( const alienTeamCategory_t const *  cat,
const interestCategory_t  missionCat 
) [static]

Check if an alien team category may be used for a mission category.

Parameters:
[in] cat Pointer to the alien team category.
[in] missionCat Mission category to check.
Returns:
True if alien Category may be used for this mission category.

Definition at line 151 of file cp_missions.c.

References i, alienTeamCategory_s::missionCategories, alienTeamCategory_s::numMissionCategories, qfalse, and qtrue.

Referenced by CP_SetAlienTeamByInterest().

qboolean CP_LoadMissionsXML ( mxml_node_t parent  ) 

Load callback for savegames in XML Format.

Parameters:
[in] parent XML Node structure, where we get the information from

Definition at line 2017 of file cp_missions.c.

References AB_GetByIDX(), mission_s::active, AIR_AircraftGetFromIDX(), B_GetBaseByIDX(), BASE_UNDER_ATTACK, base_s::baseStatus, byte, BYTES_NONE, mission_s::category, ccs, Com_GetConstIntFromNamespace(), Com_GetMapDefinitionByID(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), CP_BasemissionIsSubvertingGovernmentMission(), mission_s::crashed, mission_s::data, date_s::day, mission_s::finalDate, mission_s::id, mission_s::idx, mission_s::initialIndividualInterest, mission_s::initialOverallInterest, INS_GetInstallationByIDX(), INTERESTCATEGORY_BASE_ATTACK, INTERESTCATEGORY_BUILDING, INTERESTCATEGORY_INTERCEPT, INTERESTCATEGORY_RESCUE, INTERESTCATEGORY_SUPPLY, lengthof, LIST_Add(), mission_s::location, mission_s::mapDef, ccs_s::missions, mxml_GetBool(), mxml_GetDate(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetPos2(), mxml_GetString(), base_s::name, name, mission_s::onGeoscape, mission_s::onlose, mission_s::onwin, mission_s::pos, mission_s::posAssigned, Q_strncpyz(), qfalse, qtrue, SAVE_INTERESTCAT_NAMESPACE, SAVE_MISSIONS, SAVE_MISSIONS_ACTIVE, SAVE_MISSIONS_ALIENBASEINDEX, SAVE_MISSIONS_BASEINDEX, SAVE_MISSIONS_CATEGORY, SAVE_MISSIONS_CRASHED, SAVE_MISSIONS_CRASHED_AIRCRAFT, SAVE_MISSIONS_FINALDATE, SAVE_MISSIONS_ID, SAVE_MISSIONS_INITIALINDIVIDUALINTEREST, SAVE_MISSIONS_INITIALOVERALLINTEREST, SAVE_MISSIONS_INSTALLATIONINDEX, SAVE_MISSIONS_LOCATION, SAVE_MISSIONS_MAPDEF_ID, SAVE_MISSIONS_MAPDEFTIMES, SAVE_MISSIONS_MISSION, SAVE_MISSIONS_MISSION_IDX, SAVE_MISSIONS_ONGEOSCAPE, SAVE_MISSIONS_ONLOSE, SAVE_MISSIONS_ONWIN, SAVE_MISSIONS_POS, SAVE_MISSIONS_POSASSIGNED, SAVE_MISSIONS_STAGE, SAVE_MISSIONS_STARTDATE, SAVE_MISSIONS_UFO, SAVE_MISSIONSTAGE_NAMESPACE, saveInterestConstants, saveMissionConstants, date_s::sec, mission_s::stage, STAGE_BASE_ATTACK, STAGE_BUILD_BASE, STAGE_INTERCEPT, STAGE_MISSION_GOTO, mission_s::startDate, mapDef_s::timesAlreadyUsed, mission_s::ufo, and ccs_s::ufos.

Referenced by SAV_Init().

void CP_MissionAddToGeoscape ( mission_t mission,
qboolean  force 
)
qboolean CP_MissionBegin ( mission_t mission  ) 
ufoType_t CP_MissionChooseUFO ( const mission_t mission  ) 
void CP_MissionDisableTimeLimit ( mission_t mission  ) 
void CP_MissionEnd ( mission_t mission,
qboolean  won 
)
void CP_MissionEndActions ( mission_t mission,
aircraft_t aircraft,
qboolean  won 
)

Actions to be done after mission finished.

Parameters:
[in,out] mission Pointer to the finished mission
[in,out] aircraft Pointer to the dropship done the mission
[in] won Boolean flag if thew mission was successful (from PHALANX's PoV)

Definition at line 1177 of file cp_missions.c.

References _, AIR_AircraftReturnToBase(), AIR_DestroyAircraft(), B_DumpAircraftToHomeBase(), mission_s::category, Com_sprintf(), CP_BaseAttackMissionDestroyBase(), CP_BaseAttackMissionIsFailure(), cp_messageBuffer, CP_MissionIsOver(), mission_s::data, aircraft_s::homebase, INTERESTCATEGORY_RESCUE, MS_AddNewMessage(), MSG_STANDARD, base_s::name, qfalse, mission_s::stage, and STAGE_BASE_ATTACK.

Referenced by CL_GameAutoGo(), and CP_MissionEnd().

static const char* CP_MissionGetMessage ( const mission_t mission  )  [inline, static]

Assembles a message that is send to the gamer once the given mission is added to geoscape.

Parameters:
[in] mission The mission that was added to the geoscape and for that a message should be created
Returns:
The pointer to the static buffer that holds the message.

Definition at line 771 of file cp_missions.c.

References _, mission_s::category, Com_sprintf(), cp_messageBuffer, INTERESTCATEGORY_RESCUE, and mission_s::location.

Referenced by CP_MissionAddToGeoscape().

static messageType_t CP_MissionGetMessageLevel ( const mission_t mission  )  [inline, static]

Decides which message level to take for the given mission.

Parameters:
[in] mission The mission to chose the message level for
Returns:
The message level

Definition at line 750 of file cp_missions.c.

References mission_s::crashed, MSG_BASEATTACK, MSG_CRASHSITE, MSG_STANDARD, MSG_TERRORSITE, mission_s::stage, STAGE_BASE_ATTACK, and STAGE_TERROR_MISSION.

Referenced by CP_MissionAddToGeoscape().

void CP_MissionIsOver ( mission_t mission  ) 
void CP_MissionIsOverByUFO ( aircraft_t ufocraft  ) 

Mission is finished because Phalanx team ended it.

Parameters:
[in] ufocraft Pointer to the UFO involved in this mission

Definition at line 1153 of file cp_missions.c.

References CP_MissionIsOver(), and aircraft_s::mission.

Referenced by AIRFIGHT_ActionsAfterAirfight().

void CP_MissionNotifyBaseDestroyed ( const base_t base  ) 

Notify that a base has been removed.

Definition at line 997 of file cp_missions.c.

References mission_s::category, ccs, CP_BaseAttackMissionLeave(), mission_s::data, linkedList_s::data, INTERESTCATEGORY_BASE_ATTACK, ccs_s::missions, and linkedList_s::next.

Referenced by B_Destroy().

void CP_MissionNotifyInstallationDestroyed ( const installation_t const *  installation  ) 

Notify missions that an installation has been destroyed.

Parameters:
[in] installation Pointer to the installation that has been destroyed.

Definition at line 1018 of file cp_missions.c.

References mission_s::category, ccs, CP_InterceptMissionLeave(), mission_s::data, linkedList_s::data, INTERESTCATEGORY_INTERCEPT, ccs_s::missions, linkedList_s::next, and qfalse.

Referenced by INS_DestroyInstallation().

void CP_MissionRemove ( mission_t mission  ) 

Removes a mission from mission global array.

See also:
UFO_RemoveFromGeoscape

Definition at line 928 of file cp_missions.c.

References ccs_s::battleParameters, ccs, Com_DPrintf(), Com_Printf(), CP_CountMission(), CP_MissionRemoveFromGeoscape(), CP_UFORemoveFromGeoscape(), linkedList_s::data, DEBUG_CLIENT, mission_s::id, LIST_RemoveEntry(), battleParam_s::mission, ccs_s::missions, linkedList_s::next, qtrue, and mission_s::ufo.

Referenced by CP_BaseAttackGoToBase(), CP_BaseAttackMissionIsFailure(), CP_BaseAttackMissionIsSuccess(), CP_BaseAttackMissionNextStage(), CP_BuildBaseMissionBaseDestroyed(), CP_BuildBaseMissionIsFailure(), CP_BuildBaseMissionIsSuccess(), CP_BuildBaseMissionNextStage(), CP_BuildBaseSetUpBase(), CP_HarvestMissionGo(), CP_HarvestMissionIsFailure(), CP_HarvestMissionIsSuccess(), CP_HarvestMissionNextStage(), CP_InterceptGoToInstallation(), CP_InterceptMissionIsFailure(), CP_InterceptMissionIsSuccess(), CP_InterceptNextStage(), CP_MissionBegin(), CP_MissionIsOver(), CP_MissionStageEnd(), CP_ReconMissionGroundGo(), CP_ReconMissionIsFailure(), CP_ReconMissionIsSuccess(), CP_ReconMissionNextStage(), CP_SpawnCrashSiteMission(), CP_SpawnRescueMission(), CP_SupplyGoToBase(), CP_SupplyMissionCreate(), CP_SupplyMissionIsFailure(), CP_SupplyMissionIsSuccess(), CP_SupplyMissionNextStage(), CP_SupplySetStayAtBase(), CP_TerrorMissionGo(), CP_TerrorMissionIsFailure(), CP_TerrorMissionIsSuccess(), CP_TerrorMissionNextStage(), CP_XVIMissionIsFailure(), CP_XVIMissionIsSuccess(), and CP_XVIMissionNextStage().

void CP_MissionRemoveFromGeoscape ( mission_t mission  ) 
void CP_MissionsInit ( void   ) 

Definition at line 2162 of file cp_missions.c.

References Cmd_AddCommand().

Referenced by CP_InitStartup().

void CP_MissionStageEnd ( mission_t mission  ) 
const char* CP_MissionToTypeString ( const mission_t mission  ) 
qboolean CP_SaveMissionsXML ( mxml_node_t parent  ) 

Save callback for savegames in XML Format.

Parameters:
[out] parent XML Node structure, where we write the information to

Definition at line 1937 of file cp_missions.c.

References mission_s::active, mission_s::category, ccs, Com_GetConstVariable(), Com_RegisterConstList(), Com_UnregisterConstList(), mission_s::crashed, mission_s::data, linkedList_s::data, date_s::day, mission_s::finalDate, mapDef_s::id, mission_s::id, alienBase_s::idx, aircraft_s::idx, installation_s::idx, base_s::idx, mission_s::idx, mission_s::initialIndividualInterest, mission_s::initialOverallInterest, INTERESTCATEGORY_BASE_ATTACK, INTERESTCATEGORY_BUILDING, INTERESTCATEGORY_INTERCEPT, INTERESTCATEGORY_RESCUE, INTERESTCATEGORY_SUPPLY, mission_s::location, mission_s::mapDef, ccs_s::missions, mxml_AddBool(), mxml_AddBoolValue(), mxml_AddDate(), mxml_AddInt(), mxml_AddNode(), mxml_AddPos2(), mxml_AddShort(), mxml_AddString(), linkedList_s::next, mission_s::onGeoscape, mission_s::onlose, mission_s::onwin, mission_s::pos, mission_s::posAssigned, qtrue, SAVE_INTERESTCAT_NAMESPACE, SAVE_MISSIONS, SAVE_MISSIONS_ACTIVE, SAVE_MISSIONS_ALIENBASEINDEX, SAVE_MISSIONS_BASEINDEX, SAVE_MISSIONS_CATEGORY, SAVE_MISSIONS_CRASHED, SAVE_MISSIONS_CRASHED_AIRCRAFT, SAVE_MISSIONS_FINALDATE, SAVE_MISSIONS_ID, SAVE_MISSIONS_INITIALINDIVIDUALINTEREST, SAVE_MISSIONS_INITIALOVERALLINTEREST, SAVE_MISSIONS_INSTALLATIONINDEX, SAVE_MISSIONS_LOCATION, SAVE_MISSIONS_MAPDEF_ID, SAVE_MISSIONS_MAPDEFTIMES, SAVE_MISSIONS_MISSION, SAVE_MISSIONS_MISSION_IDX, SAVE_MISSIONS_ONGEOSCAPE, SAVE_MISSIONS_ONLOSE, SAVE_MISSIONS_ONWIN, SAVE_MISSIONS_POS, SAVE_MISSIONS_POSASSIGNED, SAVE_MISSIONS_STAGE, SAVE_MISSIONS_STARTDATE, SAVE_MISSIONS_UFO, SAVE_MISSIONSTAGE_NAMESPACE, saveInterestConstants, saveMissionConstants, date_s::sec, mission_s::stage, STAGE_BASE_ATTACK, STAGE_INTERCEPT, STAGE_MISSION_GOTO, mission_s::startDate, mapDef_s::timesAlreadyUsed, mission_s::ufo, and ccs_s::ufos.

Referenced by SAV_Init().

static int CP_SelectNewMissionType ( void   )  [static]

Select new mission type.

See also:
CP_SpawnNewMissions

Definition at line 1651 of file cp_missions.c.

References ccs, frand(), i, ccs_s::interest, and INTERESTCATEGORY_MAX.

Referenced by CP_SpawnNewMissions().

static void CP_SetAlienEquipmentByInterest ( const mission_t mission  )  [static]

Set alien equipment for a mission (depends on the interest values).

Note:
This function is used to know which equipment pack described in equipment_missions.ufo should be used
Precondition:
Alien team must be already chosen
See also:
CP_SetAlienTeamByInterest

Definition at line 232 of file cp_missions.c.

References battleParam_s::alienEquipment, ccs_s::battleParameters, ccs, Com_DPrintf(), Com_Error(), Com_sprintf(), CP_IsAlienEquipmentSelectable(), csi, DEBUG_CLIENT, csi_s::eds, ERR_DROP, i, mission_s::id, equipDef_s::name, and csi_s::numEDs.

Referenced by CP_CreateAlienTeam().

static void CP_SetAlienTeamByInterest ( const mission_t mission  )  [static]
static void CP_SetMissionName ( mission_t mission  )  [inline, static]

Set mission name.

Note:
that mission name must be unique in mission global array
Parameters:
[out] mission The mission to set the name for
See also:
CP_CreateNewMission

Definition at line 1576 of file cp_missions.c.

References mission_s::category, ccs, Com_sprintf(), CP_GetMissionByIDSilent(), mission_s::id, mission_s::initialOverallInterest, and ccs_s::missions.

Referenced by CP_CreateNewMission().

void CP_SetMissionVars ( const mission_t mission  ) 
void CP_SpawnCrashSiteMission ( aircraft_t ufo  ) 
void CP_SpawnNewMissions ( void   ) 
void CP_SpawnRescueMission ( aircraft_t aircraft,
aircraft_t ufo 
)
void CP_StartMissionMap ( mission_t mission  ) 

Select the mission type and start the map from mission definition.

Parameters:
[in] mission Mission definition to start the map from
See also:
CP_StartSelectedMission
Note:
Also sets the terrain textures
See also:
Mod_LoadTexinfo
B_AssembleMap_f

Note:
set the mapZone - this allows us to replace the ground texture with the suitable terrain texture - just use tex_terrain/dummy for the brushes you want the terrain textures on
See also:
Mod_LoadTexinfo

Definition at line 96 of file cp_missions.c.

References B_AssembleMap(), ccs_s::battleParameters, mission_s::category, Cbuf_AddText(), ccs, cls, Com_Error(), Com_Printf(), client_static_s::currentMD, Cvar_Set(), mission_s::data, ERR_DROP, mapDef_s::hurtAliens, mission_s::id, INTERESTCATEGORY_BASE_ATTACK, mapDef_s::map, MAP_IsNight(), mission_s::mapDef, rendererData_t::mapZone, mapDef_s::param, battleParam_s::param, mission_s::pos, qfalse, qtrue, refdef, SAV_QuickSave(), UI_InitStack(), va(), and battleParam_s::zoneType.

Referenced by CP_StartSelectedMission().

static qboolean CP_TransferOfAliensToOtherBaseNeeded ( const base_t base,
const missionResults_t missionResults 
) [inline, static]

Checks whether aliens can be stored on a base or should be transfered to another.

Parameters:
[in] base Pointer to the base to check if alien contaiment exists and have enough space
[in] missionResults Pointer to the mission result struct to get captured alien numbers

Definition at line 1164 of file cp_missions.c.

References AC_ContainmentAllowed(), AL_CheckAliveFreeSpace(), missionResults_s::aliensKilled, and missionResults_s::aliensStunned.

Referenced by CP_MissionEnd().

void CP_UFOProceedMission ( aircraft_t ufo  ) 
void CP_UFORemoveFromGeoscape ( mission_t mission,
qboolean  destroyed 
)

Removes (temporarily or permanently) a UFO from geoscape: make it land and call notify functions.

Parameters:
[in] mission Pointer to mission.
[in] destroyed True if the UFO has been destroyed, false if it's only landed.
Note:
We don't destroy the UFO if mission is not deleted because we can use it later, e.g. if it takes off.
See also:
UFO_RemoveFromGeoscape

Definition at line 883 of file cp_missions.c.

References AIR_AircraftsNotifyUFORemoved(), ccs, linkedList_s::data, aircraft_s::detected, aircraft_s::landed, MAP_NotifyUFORemoved(), ccs_s::missions, linkedList_s::next, aircraft_s::pos, qtrue, RADAR_CheckRadarSensored(), RADAR_NotifyUFORemoved(), mission_s::ufo, and UFO_RemoveFromGeoscape().

Referenced by CP_BaseAttackStartMission(), CP_BuildBaseSetUpBase(), CP_BuildBaseSubvertGovernment(), CP_HarvestMissionStart(), CP_MissionRemove(), CP_ReconMissionGround(), CP_SpawnCrashSiteMission(), CP_SupplySetStayAtBase(), CP_TerrorMissionStart(), and CP_XVIMissionStart().

void CP_UpdateMissionVisibleOnGeoscape ( void   ) 

Update all mission visible on geoscape (in base radar range).

Note:
you can't see a mission with aircraft radar.
See also:
CP_CheckMissionAddToGeoscape

Definition at line 859 of file cp_missions.c.

References ccs, CP_CheckMissionVisibleOnGeoscape(), CP_MissionAddToGeoscape(), CP_MissionRemoveFromGeoscape(), linkedList_s::data, MISDET_ALWAYS_DETECTED, MISDET_CANT_BE_DETECTED, ccs_s::missions, linkedList_s::next, mission_s::onGeoscape, and qfalse.

Referenced by RADAR_UpdateBaseRadarCoverage_f(), and RADAR_UpdateInstallationRadarCoverage().

int MAP_GetIDXByMission ( const mission_t mis  ) 

Find idx corresponding to mission.

Definition at line 443 of file cp_missions.c.

References mission_s::idx.

Referenced by CL_DisplayPopupAircraft(), and MAP_MapClick().

mission_t* MAP_GetMissionByIDX ( int  id  ) 

Find mission corresponding to idx.

Definition at line 422 of file cp_missions.c.

References ccs, Com_Printf(), linkedList_s::data, mission_s::idx, ccs_s::missions, and linkedList_s::next.

Referenced by CL_PopupAircraftClick_f(), MAP_GetMissionAngle(), and MAP_MultiSelectExecuteAction_f().

const char* MAP_GetMissionModel ( const mission_t mission  ) 

Get mission model that should be shown on the geoscape.

Parameters:
[in] mission Pointer to the mission drawn on geoscape
See also:
MAP_DrawMapMarkers

Todo:
Should be a special story related mission model
Todo:
each category should have a its own model
Todo:
we have two different alienbase models

Definition at line 647 of file cp_missions.c.

References mission_s::category, Com_DPrintf(), Com_Error(), mission_s::crashed, DEBUG_CLIENT, ERR_DROP, mission_s::id, INTERESTCATEGORY_ALIENBASE, INTERESTCATEGORY_BASE_ATTACK, INTERESTCATEGORY_BUILDING, INTERESTCATEGORY_HARVEST, INTERESTCATEGORY_INTERCEPT, INTERESTCATEGORY_MAX, INTERESTCATEGORY_NONE, INTERESTCATEGORY_RECON, INTERESTCATEGORY_RESCUE, INTERESTCATEGORY_SUPPLY, INTERESTCATEGORY_TERROR_ATTACK, INTERESTCATEGORY_XVI, mission_s::mapDef, and mapDef_s::storyRelated.

Referenced by MAP_DrawMapOneMission(), and MAP_UpdateGeoscapeDock().


Variable Documentation

const float MAX_CRASHEDUFO_CONDITION = 0.81f [static]

Definition at line 47 of file cp_missions.c.

Referenced by CP_CreateBattleParameters().

const int MAX_POS_LOOP = 10

Maximum number of loops to choose a mission position (to avoid infinite loops)

Definition at line 43 of file cp_missions.c.

Referenced by CP_HarvestMissionGo(), CP_ReconMissionGroundGo(), and CP_TerrorMissionGo().

const float MIN_CRASHEDUFO_CONDITION = 0.2f [static]

Condition limits for crashed UFOs - used for disassemlies

Definition at line 46 of file cp_missions.c.

Referenced by CP_CreateBattleParameters().


Generated by  doxygen 1.6.2