UFO: Alien Invasion
|
Go to the source code of this file.
Macros | |
#define | UFO_GetGeoscapeIDX(ufo) ((ufo) - ccs.ufos) |
Enumerations | |
enum | { UFO_IS_NO_TARGET, UFO_IS_TARGET_OF_MISSILE, UFO_IS_TARGET_OF_LASER } |
Functions | |
const char * | UFO_TypeToName (const ufoType_t type) |
Translate UFO type to name. More... | |
const technology_t * | UFO_GetTechnologyFromType (const ufoType_t type) |
Get the technology for a given UFO type. More... | |
const aircraft_t * | UFO_GetByType (const ufoType_t type) |
Get the aircraft template for a given UFO type. More... | |
bool | UFO_ShouldAppearOnGeoscape (const ufoType_t type) |
Some UFOs may only appear if after some interest level in the current running campaign is reached. More... | |
bool | UFO_CanDoMission (const ufoType_t uType, const char *mType) |
Check if the UFO type is available for the given mission type. More... | |
int | UFO_GetAvailableUFOsForMission (const interestCategory_t missionType, ufoType_t *ufoTypes, bool checkInterest=true) |
Fill an array with available UFOs for the mission type. More... | |
int | UFO_GetOneAvailableUFOForMission (const interestCategory_t missionType, bool checkInterest=true) |
Get a suitable UFO for the mission type. More... | |
const char * | UFO_GetName (const aircraft_t *ufocraft) |
Returns name of the UFO if UFO has been researched. More... | |
void | UFO_SetRandomDest (aircraft_t *ufo) |
Give a random destination to the given UFO, and make him to move there. More... | |
void | UFO_SetRandomDestAround (aircraft_t *ufocraft, const vec2_t pos) |
Give a random destination to the given UFO close to a position, and make him to move there. More... | |
void | UFO_FleePhalanxAircraft (aircraft_t *ufo, const vec2_t v) |
void | UFO_CheckShootBack (const campaign_t *campaign, aircraft_t *ufo, aircraft_t *phalanxAircraft) |
Check if the ufo can shoot back at phalanx aircraft. More... | |
void | UFO_CampaignRunUFOs (const campaign_t *campaign, int dt) |
Make the UFOs run. More... | |
void | UFO_UpdateAlienInterestForAllBasesAndInstallations (void) |
Update alien interest for all PHALANX bases. More... | |
void | UFO_DetectNewUFO (aircraft_t *ufocraft) |
Perform actions when a new UFO is detected. More... | |
bool | UFO_CampaignCheckEvents (void) |
Check events for UFOs: Appears or disappears on radars. More... | |
aircraft_t * | UFO_AddToGeoscape (ufoType_t ufotype, const vec2_t destination, struct mission_s *mission) |
Add a UFO to geoscape. More... | |
void | UFO_RemoveFromGeoscape (aircraft_t *ufo) |
Remove the specified ufo from geoscape. More... | |
void | UFO_SendToDestination (aircraft_t *ufo, const vec2_t dest) |
Make the specified UFO go to destination. More... | |
bool | UFO_SendPursuingAircraft (aircraft_t *ufo, aircraft_t *aircraft) |
Make the specified UFO pursue a phalanx aircraft. More... | |
void | UFO_NotifyPhalanxAircraftRemoved (const aircraft_t *const aircraft) |
Notify to UFOs that a Phalanx aircraft has been destroyed. More... | |
bool | UFO_IsUFOSeenOnGeoscape (const aircraft_t *ufo) |
Check if an aircraft should be seen on geoscape. More... | |
aircraft_t * | UFO_GetByIDX (const int idx) |
returns the UFO on the geoscape with a certain index More... | |
aircraft_t * | UFO_GetNext (aircraft_t *lastUFO) |
Iterates through the UFOs. More... | |
aircraft_t * | UFO_GetNextOnGeoscape (aircraft_t *lastUFO) |
const aircraft_t * | UFO_GetTemplate (ufoType_t ufoType) |
Get the template data for the given ufo type. More... | |
aircraft_t * | UFO_CreateFromTemplate (const aircraft_t *ufoTemplate) |
Creates a new ufo on the geoscape from the given aircraft template. More... | |
void | UFO_InitStartup (void) |
Init actions for ufo-subsystem. More... | |
void | UFO_Shutdown (void) |
Closing actions for ufo-subsystem. More... | |
#define UFO_GetGeoscapeIDX | ( | ufo | ) | ((ufo) - ccs.ufos) |
Definition at line 33 of file cp_ufo.h.
Referenced by AIR_SaveAircraftXML(), AIRFIGHT_SaveXML(), GEO_Click(), and GEO_UpdateGeoscapeDock().
anonymous enum |
aircraft_t* UFO_AddToGeoscape | ( | ufoType_t | ufoType, |
const vec2_t | destination, | ||
mission_t * | mission | ||
) |
Add a UFO to geoscape.
[in] | ufoType | The type of ufo (fighter, scout, ...). |
[in] | destination | Position where the ufo should go. nullptr is randomly chosen |
[in] | mission | Pointer to the mission the UFO is involved in |
Definition at line 773 of file cp_ufo.cpp.
References AII_ReloadAircraftWeapons(), AII_UpdateAircraftStats(), AIR_STATS_DAMAGE, aircraft_s::damage, aircraft_s::detected, aircraft_s::landed, aircraft_s::mission, aircraft_s::stats, UFO_CreateFromTemplate(), UFO_GetTemplateForGeoscape(), UFO_SendToDestination(), UFO_SetRandomDest(), and UFO_SetRandomPos().
Referenced by CP_MissionBegin(), CP_SupplyMissionCreate(), and TEST_F().
bool UFO_CampaignCheckEvents | ( | void | ) |
Check events for UFOs: Appears or disappears on radars.
Definition at line 867 of file cp_ufo.cpp.
References _, AIR_AircraftsUFODisappear(), AIR_Foreach, AIR_IsAircraftOnGeoscape(), aircraft_s::aircraftTarget, B_GetBuildingStatus(), B_GetNext(), B_POWER, aircraft_s::detected, GEO_NotifyUFODisappear(), GetDistanceOnGlobe(), INS_Foreach, aircraft_s::landed, MAX_VAR, MSG_UFOLOST, MSG_UFOSPOTTED, MSO_CheckAddNewMessage(), base_s::name, aircraft_s::name, NT_UFO_ATTACKING, NT_UFO_SIGNAL_LOST, NT_UFO_SPOTTED, base_s::pos, aircraft_s::pos, Q_strncpyz(), base_s::radar, RADAR_CheckUFOSensored(), RADAR_DeactivateRadarOverlay(), UFO_DetectNewUFO(), UFO_GetName(), UFO_GetNext(), and va().
Referenced by CP_CampaignFunctionPeriodicCall().
void UFO_CampaignRunUFOs | ( | const campaign_t * | campaign, |
int | deltaTime | ||
) |
Make the UFOs run.
[in] | campaign | The campaign data structure |
[in] | deltaTime | The time passed since last call |
Definition at line 601 of file cp_ufo.cpp.
References AIR_AircraftMakeMove(), AIR_STATS_FUELSIZE, AIR_UFO, mission_s::missionData_t::aircraft, ccs, CP_CheckNextStageDestination(), mission_s::data, aircraftSlot_s::delayNextShot, aircraft_s::fuel, GEO_CheckPositionBoundaries(), aircraft_s::landed, aircraft_s::maxWeapons, aircraft_s::mission, mapline_s::numPoints, ccs_s::numUFOs, mapline_s::point, mission_s::pos, aircraft_s::pos, aircraft_s::route, mission_s::stage, STAGE_INTERCEPT, aircraft_s::stats, aircraft_s::status, UFO_GetByIDX(), UFO_SearchAircraftTarget(), UFO_SetRandomDest(), UFO_SetRandomDestAround(), Vector2Copy, and aircraft_s::weapons.
Referenced by CP_CampaignFunctionPeriodicCall(), and TEST_F().
bool UFO_CanDoMission | ( | const ufoType_t | uType, |
const char * | mType | ||
) |
Check if the UFO type is available for the given mission type.
uType | The UFO type to check |
mType | The mission type to check |
Definition at line 137 of file cp_ufo.cpp.
References cgi, cgame_import_s::LIST_ContainsString(), aircraft_s::missionTypes, and UFO_GetByType().
Referenced by CP_InterceptMissionSet(), and UFO_GetAvailableUFOsForMission().
void UFO_CheckShootBack | ( | const campaign_t * | campaign, |
aircraft_t * | ufo, | ||
aircraft_t * | phalanxAircraft | ||
) |
Check if the ufo can shoot back at phalanx aircraft.
[in] | campaign | The campaign data structure |
[in,out] | ufo | The ufo to check the shotting for |
[in,out] | phalanxAircraft | The possible target |
Definition at line 578 of file cp_ufo.cpp.
References AIR_IsAircraftOnGeoscape(), aircraft_s::aircraftTarget, AIRFIGHT_ExecuteActions(), CP_UFOProceedMission(), and UFO_SendPursuingAircraft().
Referenced by AIRFIGHT_ExecuteActions(), TEST_F(), and UFO_SearchAircraftTarget().
aircraft_t* UFO_CreateFromTemplate | ( | const aircraft_t * | ufoTemplate | ) |
Creates a new ufo on the geoscape from the given aircraft template.
ufoTemplate | The aircraft template to create the ufo from. |
nullptr
if the max allowed amount of ufos are already on the geoscape, otherwise the newly created ufo pointer Definition at line 741 of file cp_ufo.cpp.
References AIR_IsUFO, ccs, aircraft_s::idx, MAX_UFOONGEOSCAPE, ccs_s::numUFOs, and UFO_GetByIDX().
Referenced by CP_AttackUFOCarrier_f(), and UFO_AddToGeoscape().
void UFO_DetectNewUFO | ( | aircraft_t * | ufocraft | ) |
Perform actions when a new UFO is detected.
[in] | ufocraft | Pointer to the UFO that has just been detected. |
Definition at line 842 of file cp_ufo.cpp.
References ccs_s::campaignStats, ccs, cgi, cgame_import_s::Com_UFOTypeToShortName(), CP_TriggerEvent(), ccs_s::date, aircraft_s::detected, aircraft_s::detectionIdx, GEO_IsRadarOverlayActivated(), GEO_SetOverlay(), GEO_UpdateGeoscapeDock(), aircraft_s::getUfoType(), aircraft_s::lastSpotted, UFO_DETECTION, and stats_s::ufosDetected.
Referenced by AIRFIGHT_ExecuteActions(), CP_CheckNewMissionDetectedOnGeoscape(), and UFO_CampaignCheckEvents().
void UFO_FleePhalanxAircraft | ( | aircraft_t * | ufo, |
const vec2_t | v | ||
) |
int UFO_GetAvailableUFOsForMission | ( | const interestCategory_t | missionType, |
ufoType_t * | ufoTypes, | ||
bool | checkInterest | ||
) |
Fill an array with available UFOs for the mission type.
[in] | missionType | The kind ofmission we are currently creating. |
[out] | ufoTypes | Array of ufoType_t that may be used for this mission. |
[in] | checkInterest | Do a UFO_ShouldAppearOnGeoscape check if true (default) |
ufoTypes
Definition at line 153 of file cp_ufo.cpp.
References cgi, i, INTERESTCATEGORY_BASE_ATTACK, INTERESTCATEGORY_BUILDING, INTERESTCATEGORY_HARVEST, INTERESTCATEGORY_INTERCEPT, INTERESTCATEGORY_INTERCEPTBOMBING, INTERESTCATEGORY_RECON, INTERESTCATEGORY_SUBVERT, INTERESTCATEGORY_SUPPLY, INTERESTCATEGORY_TERROR_ATTACK, INTERESTCATEGORY_XVI, UFO_CanDoMission(), and UFO_ShouldAppearOnGeoscape().
Referenced by CP_MissionChooseUFO(), NAT_ScriptSanityCheck(), TEST_F(), and UFO_GetOneAvailableUFOForMission().
aircraft_t* UFO_GetByIDX | ( | const int | idx | ) |
returns the UFO on the geoscape with a certain index
[in] | idx | Index of the UFO |
Definition at line 85 of file cp_ufo.cpp.
References ccs, MAX_UFOONGEOSCAPE, and ccs_s::ufos.
Referenced by AIR_LoadXML(), AIR_SaveXML(), AIRFIGHT_LoadXML(), B_LoadBaseSlotsXML(), UFO_CampaignRunUFOs(), UFO_CreateFromTemplate(), UFO_GeoSelectUFO_f(), and UFO_NotifyPhalanxAircraftRemoved().
const aircraft_t* UFO_GetByType | ( | const ufoType_t | type | ) |
Get the aircraft template for a given UFO type.
type | The UFO type to get the template for |
Definition at line 109 of file cp_ufo.cpp.
References ccs_s::aircraftTemplates, ccs, cgi, ERR_DROP, aircraft_s::getUfoType(), i, ccs_s::numAircraftTemplates, and type.
Referenced by TEST_F(), UFO_CanDoMission(), and UFO_ShouldAppearOnGeoscape().
const char* UFO_GetName | ( | const aircraft_t * | ufocraft | ) |
Returns name of the UFO if UFO has been researched.
[in] | ufocraft | Pointer to the UFO. |
Definition at line 243 of file cp_ufo.cpp.
References _, aircraft_s::detectionIdx, aircraft_s::name, RS_IsResearched_ptr(), aircraft_s::tech, and va().
Referenced by BDEF_BaseDefenceMenuUpdate_f(), CP_CreateBattleParameters(), GEO_Click(), GEO_GetUFOText(), INS_FillUFOYardData_f(), MIS_GetName(), UFO_CampaignCheckEvents(), UR_DialogStartStore_f(), UR_ProcessActive(), and US_SelectStoredUfo_f().
aircraft_t* UFO_GetNext | ( | aircraft_t * | lastUFO | ) |
Iterates through the UFOs.
[in] | lastUFO | Pointer of the aircraft to iterate from. call with nullptr to get the first one. |
Definition at line 41 of file cp_ufo.cpp.
References ccs, ccs_s::numUFOs, and ccs_s::ufos.
Referenced by AIR_PostLoadInitMissions(), RADAR_SetRadarAfterLoading(), UFO_CampaignCheckEvents(), UFO_GetNextOnGeoscape(), and UFO_UpdateAlienInterestForAllBasesAndInstallations().
aircraft_t* UFO_GetNextOnGeoscape | ( | aircraft_t * | lastUFO | ) |
Definition at line 66 of file cp_ufo.cpp.
References cgi, UFO_GetNext(), and UFO_IsUFOSeenOnGeoscape().
Referenced by BDEF_AutoTarget(), GEO_Click(), GEO_DrawMarkers(), GEO_GetGeoscapeAngle(), GEO_GetUFOAngle(), GEO_UpdateGeoscapeDock(), TEST_F(), and UFO_SearchAircraftTarget().
int UFO_GetOneAvailableUFOForMission | ( | const interestCategory_t | missionType, |
bool | checkInterest | ||
) |
Get a suitable UFO for the mission type.
[in] | missionType | The kind of mission we are currently creating. |
[in] | checkInterest | Do a UFO_ShouldAppearOnGeoscape check if true (default) |
Definition at line 217 of file cp_ufo.cpp.
References UFO_GetAvailableUFOsForMission(), UFO_MAX, and UFO_NONE.
const technology_t* UFO_GetTechnologyFromType | ( | const ufoType_t | type | ) |
Get the technology for a given UFO type.
type | UFO type to get the technology for |
nullptr
. Definition at line 97 of file cp_ufo.cpp.
References cgi, cgame_import_s::Com_UFOTypeToShortName(), and RS_GetTechByProvided().
Referenced by UFO_TypeToName().
const aircraft_t* UFO_GetTemplate | ( | ufoType_t | ufoType | ) |
Get the template data for the given ufo type.
ufoType | The ufo type to search the template for. |
nullptr
in case the ufoType wasn't found, or the pointer to the ufo template. Definition at line 695 of file cp_ufo.cpp.
References AIR_IsUFO, ccs_s::aircraftTemplates, ccs, aircraft_s::getUfoType(), and ccs_s::numAircraftTemplates.
Referenced by CP_AttackUFOCarrier_f().
Init actions for ufo-subsystem.
Definition at line 1011 of file cp_ufo.cpp.
References cgi, CVAR_DEVELOPER, cgame_import_s::Cvar_Get(), and UFO_InitCallbacks().
Referenced by CP_InitStartup().
bool UFO_IsUFOSeenOnGeoscape | ( | const aircraft_t * | ufo | ) |
Check if an aircraft should be seen on geoscape.
Definition at line 989 of file cp_ufo.cpp.
References cgi, aircraft_s::detected, ERR_DROP, aircraft_s::id, aircraft_s::landed, and aircraft_s::notOnGeoscape.
Referenced by AIRFIGHT_BaseShoot(), AIRFIGHT_InstallationShoot(), GEO_DrawRadarInMap(), UFO_GetNextOnGeoscape(), and UFO_SearchAircraftTarget().
void UFO_NotifyPhalanxAircraftRemoved | ( | const aircraft_t *const | aircraft | ) |
Notify to UFOs that a Phalanx aircraft has been destroyed.
[in] | aircraft | Pointer to the Phalanx aircraft that has been removed. |
Definition at line 972 of file cp_ufo.cpp.
References aircraft_s::aircraftTarget, ccs, ccs_s::numUFOs, and UFO_GetByIDX().
Referenced by AIRFIGHT_ActionsAfterAirfight(), and B_MoveAircraftOnGeoscapeToOtherBases().
void UFO_RemoveFromGeoscape | ( | aircraft_t * | ufo | ) |
Remove the specified ufo from geoscape.
Definition at line 817 of file cp_ufo.cpp.
References ccs, cgi, DEBUG_CLIENT, aircraft_s::id, ccs_s::numUFOs, REMOVE_ELEM_ADJUST_IDX, and ccs_s::ufos.
Referenced by AIR_LoadXML(), AIR_PostLoadInitMissions(), CP_UFORemoveFromGeoscape(), and TEST_F().
bool UFO_SendPursuingAircraft | ( | aircraft_t * | ufo, |
aircraft_t * | aircraft | ||
) |
Make the specified UFO pursue a phalanx aircraft.
[in,out] | ufo | Pointer to the UFO. |
[in,out] | aircraft | Pointer to the target aircraft. |
Definition at line 532 of file cp_ufo.cpp.
References AIR_GetDestinationWhilePursuing(), AIR_TRANSIT, AIR_UFO, aircraft_s::aircraftTarget, AIRFIGHT_ChooseWeapon(), AIRFIGHT_WEAPON_CAN_NEVER_SHOOT, dest, GEO_CalcLine(), aircraft_s::maxWeapons, aircraft_s::point, aircraft_s::pos, aircraft_s::route, aircraft_s::status, aircraft_s::time, and aircraft_s::weapons.
Referenced by AIRFIGHT_ExecuteActions(), UFO_CheckShootBack(), and UFO_SearchAircraftTarget().
void UFO_SendToDestination | ( | aircraft_t * | ufo, |
const vec2_t | dest | ||
) |
Make the specified UFO go to destination.
[in,out] | ufo | Pointer to the UFO. |
[in] | dest | Destination. |
Definition at line 562 of file cp_ufo.cpp.
References AIR_TRANSIT, GEO_CalcLine(), aircraft_s::point, aircraft_s::pos, aircraft_s::route, aircraft_s::status, and aircraft_s::time.
Referenced by CP_BaseAttackGoToBase(), CP_BuildBaseGoToBase(), CP_HarvestMissionGo(), CP_InterceptGoToInstallation(), CP_ReconMissionGroundGo(), CP_SupplyGoToBase(), CP_TerrorMissionGo(), CP_UFOProceedMission(), TEST_F(), UFO_AddToGeoscape(), UFO_SetRandomDest(), and UFO_SetRandomDestAround().
void UFO_SetRandomDest | ( | aircraft_t * | ufocraft | ) |
Give a random destination to the given UFO, and make him to move there.
[in] | ufocraft | Pointer to the UFO which destination will be changed. |
Definition at line 259 of file cp_ufo.cpp.
References CP_GetRandomPosOnGeoscape(), and UFO_SendToDestination().
Referenced by CP_BaseAttackMissionLeave(), CP_BuildBaseGovernmentLeave(), CP_BuildBaseMissionLeave(), CP_InterceptMissionLeave(), CP_LeaveRescueMission(), CP_ReconMissionLeave(), CP_SupplyMissionLeave(), CP_UFOProceedMission(), UFO_AddToGeoscape(), and UFO_CampaignRunUFOs().
void UFO_SetRandomDestAround | ( | aircraft_t * | ufocraft, |
const vec2_t | pos | ||
) |
Give a random destination to the given UFO close to a position, and make him to move there.
[in] | ufocraft | Pointer to the UFO which destination will be changed. |
[in] | pos | The position the UFO should around. |
Definition at line 274 of file cp_ufo.cpp.
References dest, gaussrand(), UFO_SendToDestination(), and Vector2Set.
Referenced by CP_InterceptAttackInstallation(), and UFO_CampaignRunUFOs().
bool UFO_ShouldAppearOnGeoscape | ( | const ufoType_t | type | ) |
Some UFOs may only appear if after some interest level in the current running campaign is reached.
type | The UFO type to check the interest level for |
true
if the UFO may appear on geoscape, false
otherwise Definition at line 125 of file cp_ufo.cpp.
References ccs, ccs_s::overallInterest, UFO_GetByType(), and aircraft_s::ufoInterestOnGeoscape.
Referenced by UFO_GetAvailableUFOsForMission().
Closing actions for ufo-subsystem.
Definition at line 1023 of file cp_ufo.cpp.
References cgi, and UFO_ShutdownCallbacks().
Referenced by CP_Shutdown().
const char* UFO_TypeToName | ( | const ufoType_t | type | ) |
Translate UFO type to name.
[in] | type | UFO type in ufoType_t. |
Definition at line 231 of file cp_ufo.cpp.
References _, cgi, ERR_DROP, technology_s::name, and UFO_GetTechnologyFromType().
Referenced by PR_DisassemblyInfo(), PR_FinishDisassembly(), PR_GetName(), and PR_UpdateProductionList().
Update alien interest for all PHALANX bases.
DETECTION_INTERVAL
Definition at line 437 of file cp_ufo.cpp.
References B_GetNext(), INS_Foreach, aircraft_s::landed, UFO_GetNext(), UFO_UpdateAlienInterestForOneBase(), and UFO_UpdateAlienInterestForOneInstallation().
Referenced by CP_CampaignFunctionPeriodicCall().