Go to the source code of this file.
Enumerations | |
enum | { UFO_IS_NO_TARGET, UFO_IS_TARGET_OF_MISSILE, UFO_IS_TARGET_OF_LASER } |
Functions | |
const char * | UFO_TypeToName (ufoType_t type) |
Translate UFO type to name. | |
const technology_t * | UFO_GetTechnologyFromType (const ufoType_t type) |
Get the technology for a given UFO type. | |
const aircraft_t * | UFO_GetByType (const ufoType_t type) |
Get the aircraft template for a given UFO type. | |
qboolean | UFO_ShouldAppearOnGeoscape (const ufoType_t type) |
Some UFOs may only appear if after some interest level in the current running campaign is reached. | |
const char * | UFO_AircraftToIDOnGeoscape (const aircraft_t *ufocraft) |
Returns names of the UFO is UFO has been researched. | |
const char * | UFO_MissionResultToString (void) |
Returns a status string for recovered ufo used to be displayed in uforecovery and mission result overview. | |
void | UFO_SetRandomDest (aircraft_t *ufo) |
Give a random destination to the given UFO, and make him to move there. | |
void | UFO_SetRandomDestAround (aircraft_t *ufocraft, vec2_t pos) |
Give a random destination to the given UFO close to a position, and make him to move there. | |
void | UFO_FleePhalanxAircraft (aircraft_t *ufo, const vec2_t v) |
void | UFO_CheckShootBack (aircraft_t *ufo, aircraft_t *phalanxAircraft) |
Check if the ufo can shoot back at phalanx aircraft. | |
void | UFO_CampaignRunUFOs (int dt) |
Make the UFOs run. | |
void | UFO_UpdateAlienInterestForAllBasesAndInstallations (void) |
Update alien interest for all PHALANX bases. | |
void | UFO_DetectNewUFO (aircraft_t *ufocraft) |
Perform actions when a new UFO is detected. | |
qboolean | UFO_CampaignCheckEvents (void) |
Check events for UFOs: Appears or disappears on radars. | |
void | UFO_InitStartup (void) |
aircraft_t * | UFO_AddToGeoscape (ufoType_t ufotype, vec2_t destination, mission_t *mission) |
Add a UFO to geoscape. | |
void | UFO_RemoveFromGeoscape (aircraft_t *ufo) |
Remove the specified ufo from geoscape. | |
void | UFO_SendToDestination (aircraft_t *ufo, vec2_t dest) |
Make the specified UFO go to destination. | |
qboolean | UFO_SendPursuingAircraft (aircraft_t *ufo, aircraft_t *aircraft) |
Make the specified UFO pursue a phalanx aircraft. | |
void | UFO_NotifyPhalanxAircraftRemoved (const aircraft_t *const aircraft) |
Notify to UFOs that a Phalanx aircraft has been destroyed. | |
qboolean | UFO_IsUFOSeenOnGeoscape (const aircraft_t const *ufo) |
Check if an aircraft should be seen on geoscape. | |
aircraft_t * | UFO_GetByIDX (const int idx) |
returns the UFO on the geoscape with a certain index |
Definition in file cp_ufo.h.
anonymous enum |
aircraft_t* UFO_AddToGeoscape | ( | ufoType_t | ufoType, | |
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. NULL is randomly chosen |
[in] | mission | Pointer to the mission the UFO is involved in |
Definition at line 585 of file cp_ufo.c.
References AII_ReloadAircraftWeapons(), AII_UpdateAircraftStats(), AIR_STATS_DAMAGE, AIRCRAFT_UFO, ccs_s::aircraftTemplates, ccs, Com_DPrintf(), Com_Printf(), aircraft_s::damage, DEBUG_CLIENT, aircraft_s::detected, aircraft_s::id, aircraft_s::idx, aircraft_s::landed, MAX_UFOONGEOSCAPE, aircraft_s::mission, aircraft_s::notOnGeoscape, ccs_s::numAircraftTemplates, ccs_s::numUFOs, qfalse, aircraft_s::stats, aircraft_s::type, UFO_GetByIDX(), UFO_MAX, UFO_SendToDestination(), UFO_SetRandomDest(), UFO_SetRandomPos(), and aircraft_s::ufotype.
Referenced by CP_MissionBegin(), and CP_SupplyMissionCreate().
const char* UFO_AircraftToIDOnGeoscape | ( | const aircraft_t * | ufocraft | ) |
Returns names of the UFO is UFO has been researched.
[in] | ufocraft | Pointer to the UFO. |
Definition at line 106 of file cp_ufo.c.
References _, aircraft_s::detectionIdx, aircraft_s::name, RS_IsResearched_ptr(), aircraft_s::tech, and va().
Referenced by BDEF_BaseDefenceMenuUpdate_f(), MAP_GetUFOText(), MAP_MapClick(), and UFO_MissionResultToString().
qboolean UFO_CampaignCheckEvents | ( | void | ) |
Check events for UFOs: Appears or disappears on radars.
Definition at line 696 of file cp_ufo.c.
References _, AIR_AircraftsUFODisappear(), AIR_GetNextFromBase(), AIR_IsAircraftOnGeoscape(), aircraft_s::aircraftTarget, B_GetBuildingStatus(), B_GetFoundedBaseByIDX(), B_POWER, ccs, aircraft_s::detected, GetDistanceOnGlobe(), INS_GetFoundedInstallationByIDX(), aircraft_s::landed, MAP_NotifyUFODisappear(), MAX_VAR, MSG_STANDARD, MSG_UFOSPOTTED, MSO_CheckAddNewMessage(), installation_s::name, aircraft_s::name, base_s::name, NT_UFO_ATTACKING, NT_UFO_SIGNAL_LOST, NT_UFO_SPOTTED, ccs_s::numBases, ccs_s::numInstallations, ccs_s::numUFOs, installation_s::pos, aircraft_s::pos, base_s::pos, Q_strncpyz(), qfalse, qtrue, installation_s::radar, aircraft_s::radar, base_s::radar, RADAR_CheckUFOSensored(), RADAR_DeactivateRadarOverlay(), UFO_DetectNewUFO(), ccs_s::ufos, and va().
Referenced by CL_CampaignFunctionPeriodicCall().
void UFO_CampaignRunUFOs | ( | int | deltaTime | ) |
Make the UFOs run.
[in] | deltaTime | The time passed since last call |
Definition at line 477 of file cp_ufo.c.
References AIR_AircraftMakeMove(), AIR_STATS_FUELSIZE, AIR_UFO, ccs, CP_CheckNextStageDestination(), mission_s::data, aircraftSlot_s::delayNextShot, aircraft_s::fuel, aircraft_s::landed, MAP_CheckPositionBoundaries(), 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 CL_CampaignFunctionPeriodicCall().
void UFO_CheckShootBack | ( | aircraft_t * | ufo, | |
aircraft_t * | phalanxAircraft | |||
) |
Check if the ufo can shoot back at phalanx aircraft.
Definition at line 455 of file cp_ufo.c.
References AIR_IsAircraftOnGeoscape(), aircraft_s::aircraftTarget, AIRFIGHT_ExecuteActions(), CP_UFOProceedMission(), and UFO_SendPursuingAircraft().
Referenced by AIRFIGHT_ExecuteActions(), and UFO_SearchAircraftTarget().
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 673 of file cp_ufo.c.
References ccs_s::campaignStats, ccs, ccs_s::date, aircraft_s::detected, aircraft_s::detectionIdx, aircraft_s::lastSpotted, MAP_IsRadarOverlayActivated(), MAP_SetOverlay(), MAP_UpdateGeoscapeDock(), qtrue, and stats_s::ufosDetected.
Referenced by AIRFIGHT_ExecuteActions(), and UFO_CampaignCheckEvents().
void UFO_FleePhalanxAircraft | ( | aircraft_t * | ufo, | |
const vec2_t | v | |||
) |
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 39 of file cp_ufo.c.
References ccs, MAX_UFOONGEOSCAPE, and ccs_s::ufos.
Referenced by AIR_LoadXML(), AIR_PostLoadInitMissions(), AIR_SaveXML(), B_LoadBaseSlotsXML(), RADAR_SetRadarAfterLoading(), UFO_AddToGeoscape(), UFO_CampaignRunUFOs(), UFO_NotifyPhalanxAircraftRemoved(), and UFO_UpdateAlienInterestForAllBasesAndInstallations().
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 63 of file cp_ufo.c.
References ccs_s::aircraftTemplates, ccs, Com_Error(), ERR_DROP, i, ccs_s::numAircraftTemplates, and aircraft_s::ufotype.
Referenced by UFO_ShouldAppearOnGeoscape().
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 |
NULL
. Definition at line 51 of file cp_ufo.c.
References Com_UFOTypeToShortName(), and RS_GetTechByProvided().
Referenced by UFO_TypeToName().
void UFO_InitStartup | ( | void | ) |
Definition at line 835 of file cp_ufo.c.
References Cmd_AddCommand(), CVAR_DEVELOPER, and Cvar_Get().
Referenced by CP_InitStartup().
qboolean UFO_IsUFOSeenOnGeoscape | ( | const aircraft_t const * | ufo | ) |
Check if an aircraft should be seen on geoscape.
Definition at line 823 of file cp_ufo.c.
References Com_Error(), aircraft_s::detected, ERR_DROP, aircraft_s::id, aircraft_s::landed, and aircraft_s::notOnGeoscape.
Referenced by AIRFIGHT_BaseShoot(), AIRFIGHT_InstallationShoot(), BDEF_AutoTarget(), MAP_DrawMapMarkers(), MAP_GetGeoscapeAngle(), MAP_GetUFOAngle(), MAP_MapClick(), MAP_UpdateGeoscapeDock(), RADAR_DrawInMap(), and UFO_SearchAircraftTarget().
const char* UFO_MissionResultToString | ( | void | ) |
Returns a status string for recovered ufo used to be displayed in uforecovery and mission result overview.
Definition at line 121 of file cp_ufo.c.
References _, AIR_GetAircraft(), ccs, Com_UFOTypeToShortName(), missionResults_s::crashsite, ccs_s::missionResults, UFO_AircraftToIDOnGeoscape(), missionResults_s::ufoCondition, missionResults_s::ufotype, and va().
Referenced by CP_InitMissionResults(), UR_DialogInit_f(), and UR_DialogInitStore_f().
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 805 of file cp_ufo.c.
References aircraft_s::aircraftTarget, ccs, ccs_s::numUFOs, and UFO_GetByIDX().
Referenced by AIRFIGHT_ActionsAfterAirfight().
void UFO_RemoveFromGeoscape | ( | aircraft_t * | ufo | ) |
Remove the specified ufo from geoscape.
Definition at line 648 of file cp_ufo.c.
References ccs, Com_DPrintf(), DEBUG_CLIENT, aircraft_s::id, ccs_s::numUFOs, REMOVE_ELEM_ADJUST_IDX, and ccs_s::ufos.
Referenced by AIR_LoadXML(), and CP_UFORemoveFromGeoscape().
qboolean UFO_SendPursuingAircraft | ( | aircraft_t * | ufo, | |
aircraft_t * | aircraft | |||
) |
Make the specified UFO pursue a phalanx aircraft.
[in] | ufo | Pointer to the UFO. |
[in] | aircraft | Pointer to the target aircraft. |
Definition at line 410 of file cp_ufo.c.
References AIR_GetDestinationWhilePursuing(), AIR_TRANSIT, AIR_UFO, aircraft_s::aircraftTarget, AIRFIGHT_ChooseWeapon(), AIRFIGHT_WEAPON_CAN_NEVER_SHOOT, dest, MAP_MapCalcLine(), aircraft_s::maxWeapons, aircraft_s::point, aircraft_s::pos, qfalse, qtrue, 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, | |
vec2_t | dest | |||
) |
Make the specified UFO go to destination.
[in] | ufo | Pointer to the UFO. |
[in] | dest | Destination. |
Definition at line 442 of file cp_ufo.c.
References AIR_TRANSIT, MAP_MapCalcLine(), 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(), 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 137 of file cp_ufo.c.
References CP_GetRandomPosOnGeoscape(), pos, qfalse, and UFO_SendToDestination().
Referenced by CP_BaseAttackMissionLeave(), CP_BuildBaseGovernmentLeave(), CP_BuildBaseMissionLeave(), CP_InterceptMissionLeave(), CP_ReconMissionLeave(), CP_SupplyMissionLeave(), CP_UFOProceedMission(), UFO_AddToGeoscape(), and UFO_CampaignRunUFOs().
void UFO_SetRandomDestAround | ( | aircraft_t * | ufocraft, | |
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 152 of file cp_ufo.c.
References dest, gaussrand(), UFO_SendToDestination(), and Vector2Set.
Referenced by CP_InterceptAttackInstallation(), and UFO_CampaignRunUFOs().
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 81 of file cp_ufo.c.
References ccs, ccs_s::overallInterest, UFO_GetByType(), and aircraft_s::ufoInterestOnGeoscape.
Referenced by CP_BaseAttackMissionAvailableUFOs(), CP_TerrorMissionAvailableUFOs(), and CP_XVIMissionAvailableUFOs().
const char* UFO_TypeToName | ( | ufoType_t | type | ) |
Translate UFO type to name.
[in] | type | UFO type in ufoType_t. |
Definition at line 95 of file cp_ufo.c.
References _, Com_Error(), ERR_DROP, technology_s::name, and UFO_GetTechnologyFromType().
Referenced by BaseSummary_Init(), PR_DisassemblingFrame(), PR_DisassemblyInfo(), PR_UpdateProductionList(), UR_DialogStartSell_f(), UR_DialogStartStore_f(), and UR_ProcessActive().
void UFO_UpdateAlienInterestForAllBasesAndInstallations | ( | void | ) |
Update alien interest for all PHALANX bases.
DETECTION_INTERVAL
Definition at line 317 of file cp_ufo.c.
References B_GetFoundedBaseByIDX(), ccs, INS_GetFoundedInstallationByIDX(), aircraft_s::landed, MAX_BASES, MAX_INSTALLATIONS, ccs_s::numUFOs, UFO_GetByIDX(), UFO_UpdateAlienInterestForOneBase(), and UFO_UpdateAlienInterestForOneInstallation().
Referenced by CL_CampaignFunctionPeriodicCall().