UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_radar.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  radar_t

Macros

#define MAX_UFOONGEOSCAPE   8

Functions

void RADAR_UpdateStaticRadarCoverage (void)
 Update every static radar drawing (radar that don't move: base and installation radar).
void RADAR_UpdateWholeRadarOverlay (void)
 Update radar overlay of base, installation and aircraft range.
void RADAR_DeactivateRadarOverlay (void)
 Deactivate Radar overlay if there is no more UFO on geoscape.
void RADAR_NotifyUFORemoved (const struct aircraft_s *ufo, bool destroyed)
void RADAR_Initialise (radar_t *radar, float range, float trackingRange, float level, bool updateSourceRadarMap)
 Set radar range to new value.
void RADAR_InitialiseUFOs (radar_t *radar)
 Reset UFO sensored on radar.
void RADAR_UpdateBaseRadarCoverage_f (void)
 Update radar coverage when building/destroying new radar.
void RADAR_UpdateInstallationRadarCoverage (struct installation_s *installation, const float radarRange, const float trackingRadarRange)
void RADAR_AddDetectedUFOToEveryRadar (const struct aircraft_s *ufo)
bool RADAR_CheckRadarSensored (const vec2_t pos)
 Check if the specified position is within base radar range.
bool RADAR_CheckUFOSensored (radar_t *radar, const vec2_t posRadar, const struct aircraft_s *ufo, bool detected)
void RADAR_SetRadarAfterLoading (void)
 Set radar to proper values after loading.

Variables

bool radarOverlayWasSet
const float RADAR_BASERANGE
const float RADAR_BASETRACKINGRANGE

Macro Definition Documentation

◆ MAX_UFOONGEOSCAPE

#define MAX_UFOONGEOSCAPE   8

Function Documentation

◆ RADAR_AddDetectedUFOToEveryRadar()

void RADAR_AddDetectedUFOToEveryRadar ( const struct aircraft_s * ufo)

◆ RADAR_CheckRadarSensored()

bool RADAR_CheckRadarSensored ( const vec2_t pos)

Check if the specified position is within base radar range.

Note
aircraft radars are not checked (and this is intended)
Returns
true if the position is inside one of the base radar range

Definition at line 377 of file cp_radar.cpp.

References B_GetNext(), GetDistanceOnGlobe(), INS_Foreach, base_t::pos, and radar.

Referenced by AIRFIGHT_ExecuteActions(), CP_CheckMissionVisibleOnGeoscape(), and CP_UFORemoveFromGeoscape().

◆ RADAR_CheckUFOSensored()

bool RADAR_CheckUFOSensored ( radar_t * radar,
const vec2_t posRadar,
const struct aircraft_s * ufo,
bool detected )

References radar.

◆ RADAR_DeactivateRadarOverlay()

void RADAR_DeactivateRadarOverlay ( void )

Deactivate Radar overlay if there is no more UFO on geoscape.

Todo
Is aircraft->radar cleared for crashed aircraft?

Definition at line 106 of file cp_radar.cpp.

References AIR_Foreach, B_GetNext(), GEO_IsRadarOverlayActivated(), GEO_SetOverlay(), INS_Foreach, base_t::radar, and radarOverlayWasSet.

Referenced by RADAR_NotifyUFORemovedFromOneRadar(), RADAR_RemoveUFO(), and UFO_CampaignCheckEvents().

◆ RADAR_Initialise()

void RADAR_Initialise ( radar_t * radar,
float range,
float trackingRange,
float level,
bool updateSourceRadarMap )

Set radar range to new value.

Parameters
[in,out]radarThe radar to update/initialize
[in]rangeNew range of the radar
[in]trackingRangeNew tracking range of the radar
[in]levelThe tech level of the radar
[in]updateSourceRadarMapif the radar overlay should be updated.

Definition at line 239 of file cp_radar.cpp.

References DETECTION_INTERVAL, EQUAL, level, radar, RADAR_UpdateStaticRadarCoverage(), RADAR_UpdateWholeRadarOverlay(), and RADAR_UPGRADE_MULTIPLIER.

Referenced by AIR_LoadAircraftXML(), AIR_NewAircraft(), B_Build(), B_LoadXML(), INS_Build(), INS_LoadXML(), RADAR_UpdateBaseRadarCoverage_f(), and RADAR_UpdateInstallationRadarCoverage().

◆ RADAR_InitialiseUFOs()

void RADAR_InitialiseUFOs ( radar_t * radar)

Reset UFO sensored on radar.

Parameters
[out]radarThe radar to initialize.

Definition at line 265 of file cp_radar.cpp.

References OBJZERO, and radar.

Referenced by AIR_LoadAircraftXML(), AIR_ParseAircraft(), B_AircraftReturnedToHomeBase(), B_Build(), B_LoadXML(), and INS_LoadXML().

◆ RADAR_NotifyUFORemoved()

void RADAR_NotifyUFORemoved ( const struct aircraft_s * ufo,
bool destroyed )

References level, and radar.

◆ RADAR_SetRadarAfterLoading()

void RADAR_SetRadarAfterLoading ( void )

Set radar to proper values after loading.

Note
numUFOs is not saved, so we must calculate it.
should be called after loading.

Definition at line 453 of file cp_radar.cpp.

References aircraft_t::detected, GEO_UpdateGeoscapeDock(), RADAR_AddDetectedUFOToEveryRadar(), and UFO_GetNext().

Referenced by SAV_GameActionsAfterLoad().

◆ RADAR_UpdateBaseRadarCoverage_f()

void RADAR_UpdateBaseRadarCoverage_f ( void )

Update radar coverage when building/destroying new radar.

Note
This must be called on each radar build/destruction because radar facilities may have different level.
This must also be called when radar installation become inactive or active (due to dependencies)
called with update_base_radar_coverage

Definition at line 277 of file cp_radar.cpp.

References B_GetFoundedBaseByIDX(), B_GetMaxBuildingLevel(), B_RADAR, cgi, CP_UpdateMissionVisibleOnGeoscape(), level, MAX_BASES, base_t::radar, RADAR_BASERANGE, RADAR_BASETRACKINGRANGE, and RADAR_Initialise().

◆ RADAR_UpdateInstallationRadarCoverage()

void RADAR_UpdateInstallationRadarCoverage ( struct installation_s * installation,
const float radarRange,
const float trackingRadarRange )

◆ RADAR_UpdateStaticRadarCoverage()

void RADAR_UpdateStaticRadarCoverage ( void )

Update every static radar drawing (radar that don't move: base and installation radar).

Note
This is only called when radar range of bases change.

Definition at line 49 of file cp_radar.cpp.

References B_GetNext(), CP_AddRadarCoverage(), CP_InitializeRadarOverlay(), CP_UploadRadarCoverage(), INS_Foreach, INSTALLATION_WORKING, base_t::pos, and base_t::radar.

Referenced by RADAR_Initialise().

◆ RADAR_UpdateWholeRadarOverlay()

void RADAR_UpdateWholeRadarOverlay ( void )

Update radar overlay of base, installation and aircraft range.

Definition at line 89 of file cp_radar.cpp.

References AIR_Foreach, AIR_IsAircraftOnGeoscape(), CP_InitializeRadarOverlay(), CP_UploadRadarCoverage(), and RADAR_DrawCoverage().

Referenced by AIR_CampaignRun(), AIR_DeleteAircraft(), GEO_SetOverlay(), and RADAR_Initialise().

Variable Documentation

◆ RADAR_BASERANGE

const float RADAR_BASERANGE
extern

Definition at line 39 of file cp_radar.cpp.

Referenced by B_Build(), and RADAR_UpdateBaseRadarCoverage_f().

◆ RADAR_BASETRACKINGRANGE

const float RADAR_BASETRACKINGRANGE
extern

Definition at line 40 of file cp_radar.cpp.

Referenced by B_Build(), and RADAR_UpdateBaseRadarCoverage_f().

◆ radarOverlayWasSet

bool radarOverlayWasSet
extern

used to store the previous configuration of overlay before radar is automatically turned on (e.g when creating base or when UFO appears)

Definition at line 36 of file cp_radar.cpp.

Referenced by CP_LoadXML(), CP_SaveXML(), GEO_ResetAction(), GEO_SetOverlay_f(), and RADAR_DeactivateRadarOverlay().