cp_missions.h File Reference

Campaign missions headers. More...

#include "missions/cp_mission_baseattack.h"
#include "missions/cp_mission_buildbase.h"
#include "missions/cp_mission_harvest.h"
#include "missions/cp_mission_intercept.h"
#include "missions/cp_mission_recon.h"
#include "missions/cp_mission_supply.h"
#include "missions/cp_mission_terror.h"
#include "missions/cp_mission_xvi.h"
Include dependency graph for cp_missions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define UFO_EPSILON   0.00001f

Functions

void CP_SetMissionVars (const mission_t *mission)
 Set some needed cvars from mission definition.
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.
void CP_StartMissionMap (mission_t *mission)
 Select the mission type and start the map from mission definition.
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.
const char * CP_MissionToTypeString (const mission_t *mission)
 Return the type of mission.
int MAP_GetIDXByMission (const mission_t *mis)
 Find idx corresponding to mission.
mission_tMAP_GetMissionByIDX (int id)
 Find mission corresponding to idx.
void CP_MissionRemove (mission_t *mission)
 Removes a mission from mission global array.
qboolean CP_MissionBegin (mission_t *mission)
 mission begins: UFO arrive on earth.
qboolean CP_CheckNewMissionDetectedOnGeoscape (void)
 Check if mission has been detected by radar.
qboolean CP_CheckMissionLimitedInTime (const mission_t *mission)
 Check if mission should end because of limited time.
void CP_MissionDisableTimeLimit (mission_t *mission)
 Disable time limit for given mission.
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.
const char * MAP_GetMissionModel (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 CP_MissionAddToGeoscape (mission_t *mission, qboolean force)
 Add a mission to geoscape: make it visible and stop time.
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_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.
ufoType_t CP_MissionChooseUFO (const mission_t *mission)
 Choose UFO type for a given mission category.
void CP_MissionStageEnd (mission_t *mission)
 Determine what action should be performed when a mission stage ends.
void CP_InitializeSpawningDelay (void)
 Initialize spawning delay.
void CP_MissionsInit (void)
void CP_SpawnNewMissions (void)
 Spawn new missions.
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.
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.

Variables

const int MAX_POS_LOOP

Detailed Description

Campaign missions headers.

Definition in file cp_missions.h.


Define Documentation

#define UFO_EPSILON   0.00001f

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().

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().

void CP_CreateBattleParameters ( mission_t mission,
battleParam_t param 
)
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().

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().

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  ) 
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().

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().

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 int MAX_POS_LOOP

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().


Generated by  doxygen 1.6.2