cp_ufo.h File Reference

This graph shows which files directly or indirectly include this file:

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_tUFO_GetTechnologyFromType (const ufoType_t type)
 Get the technology for a given UFO type.
const aircraft_tUFO_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_tUFO_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_tUFO_GetByIDX (const int idx)
 returns the UFO on the geoscape with a certain index

Detailed Description

Definition in file cp_ufo.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
UFO_IS_NO_TARGET 
UFO_IS_TARGET_OF_MISSILE 
UFO_IS_TARGET_OF_LASER 

Definition at line 28 of file cp_ufo.h.


Function Documentation

aircraft_t* UFO_AddToGeoscape ( ufoType_t  ufoType,
vec2_t  destination,
mission_t mission 
)

Add a UFO to geoscape.

Parameters:
[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
See also:
UFO_RemoveFromGeoscape
UFO_RemoveFromGeoscape_f

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.

Parameters:
[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   ) 
void UFO_CampaignRunUFOs ( int  deltaTime  ) 
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.

Parameters:
[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

Parameters:
[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.

Parameters:
type The UFO type to get the template for
Returns:
The aircraft template of the UFO - always returns a value

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.

Parameters:
type UFO type to get the technology for
Returns:
The technology for the given UFO. If no technology was found for the UFO id this might return NULL.

Definition at line 51 of file cp_ufo.c.

References Com_UFOTypeToShortName(), and RS_GetTechByProvided().

Referenced by UFO_TypeToName().

void UFO_InitStartup ( void   ) 
See also:
UI_InitStartup

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.

Returns:
true or false wether UFO should be seen or not 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.

Note:
this actually relies on valid mission results.

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.

Parameters:
[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.

See also:
CP_MissionRemove
Note:
Keep in mind that you have to update the ufo pointers after you called this function

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.

Parameters:
[in] ufo Pointer to the UFO.
[in] aircraft Pointer to the target aircraft.
See also:
UFO_SendAttackBase

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 
)
void UFO_SetRandomDest ( aircraft_t ufocraft  ) 

Give a random destination to the given UFO, and make him to move there.

Parameters:
[in] ufocraft Pointer to the UFO which destination will be changed.
See also:
UFO_SetRandomPos

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.

Parameters:
[in] ufocraft Pointer to the UFO which destination will be changed.
[in] pos The position the UFO should around.
See also:
UFO_SetRandomPos

Definition at line 152 of file cp_ufo.c.

References dest, gaussrand(), UFO_SendToDestination(), and Vector2Set.

Referenced by CP_InterceptAttackInstallation(), and UFO_CampaignRunUFOs().

qboolean UFO_ShouldAppearOnGeoscape ( const ufoType_t  type  ) 

Some UFOs may only appear if after some interest level in the current running campaign is reached.

Parameters:
type The UFO type to check the interest level for
Returns:
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.

Parameters:
[in] type UFO type in ufoType_t.
Returns:
Translated UFO name.
See also:
Com_UFOTypeToShortName
Com_UFOShortNameToID

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   ) 

Generated by  doxygen 1.6.2