|
UFO: Alien Invasion
|
Radars / sensor stuff, to detect and track ufos. More...
#include "../../cl_shared.h"#include "cp_campaign.h"#include "cp_overlay.h"#include "cp_geoscape.h"#include "cp_ufo.h"#include "cp_missions.h"
Go to the source code of this file.
Functions | |
| void | RADAR_UpdateStaticRadarCoverage (void) |
| Update every static radar drawing (radar that don't move: base and installation radar). | |
| static void | RADAR_DrawCoverage (const radar_t *radar, const vec2_t pos) |
| Update map radar coverage with moving 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. | |
| static bool | RADAR_IsUFOSensored (const radar_t *radar, const aircraft_t *ufo) |
| Check if UFO is in the sensored list. | |
| static bool | RADAR_AddUFO (radar_t *radar, const aircraft_t *ufo) |
| Add a UFO in the list of sensored UFOs. | |
| static void | RADAR_RemoveUFO (radar_t *radar, const aircraft_t *ufo) |
| UFO will no more be referenced by radar. | |
| static void | RADAR_NotifyUFORemovedFromOneRadar (radar_t *radar, const aircraft_t *ufo, bool destroyed) |
| Notify that the specified ufo has been removed from geoscape to one radar. | |
| void | RADAR_NotifyUFORemoved (const aircraft_t *ufo, bool destroyed) |
| Notify to every radar that the specified ufo has been removed from geoscape. | |
| 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 (installation_t *installation, const float radarRange, const float trackingRadarRange) |
| Update radar coverage when building/destroying new radar. | |
| void | RADAR_AddDetectedUFOToEveryRadar (const aircraft_t *ufo) |
| Adds detected UFO to any radar in range (if not already detected). | |
| 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 aircraft_t *ufo, bool detected) |
| Check if the specified UFO is inside the sensor range of the given radar. | |
| void | RADAR_SetRadarAfterLoading (void) |
| Set radar to proper values after loading. | |
Variables | |
| bool | radarOverlayWasSet |
| const float | RADAR_BASERANGE = 24.0f |
| const float | RADAR_BASETRACKINGRANGE = 34.0f |
| const float | RADAR_INSTALLATIONLEVEL = 1.0f |
| static const float | RADAR_UPGRADE_MULTIPLIER = 0.4f |
| this is the multiplier applied to the radar range when the radar levels up | |
Radars / sensor stuff, to detect and track ufos.
Definition in file cp_radar.cpp.
| void RADAR_AddDetectedUFOToEveryRadar | ( | const aircraft_t * | ufo | ) |
Adds detected UFO to any radar in range (if not already detected).
| [in] | ufo | Pointer to the UFO to check. |
Definition at line 333 of file cp_radar.cpp.
References AIR_Foreach, AIR_IsAircraftOnGeoscape(), B_GetNext(), GetDistanceOnGlobe(), INS_Foreach, aircraft_t::pos, base_t::pos, base_t::radar, radar, RADAR_AddUFO(), and RADAR_IsUFOSensored().
Referenced by AIRFIGHT_ExecuteActions(), RADAR_CheckUFOSensored(), and RADAR_SetRadarAfterLoading().
|
static |
Add a UFO in the list of sensored UFOs.
Definition at line 150 of file cp_radar.cpp.
References cgi, MAX_UFOONGEOSCAPE, radar, and RADAR_IsUFOSensored().
Referenced by RADAR_AddDetectedUFOToEveryRadar(), and RADAR_CheckUFOSensored().
| bool RADAR_CheckRadarSensored | ( | const vec2_t | pos | ) |
Check if the specified position is within 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().
| bool RADAR_CheckUFOSensored | ( | radar_t * | radar, |
| const vec2_t | posRadar, | ||
| const aircraft_t * | ufo, | ||
| bool | detected ) |
Check if the specified UFO is inside the sensor range of the given radar.
| [in,out] | radar | radar that may detect the UFO. |
| [in] | posRadar | Position of radar |
| [in,out] | ufo | aircraft that should be checked. |
| [in] | detected | Is the UFO already detected by another radar? (Beware: this is not the same as ufo->detected) |
Definition at line 408 of file cp_radar.cpp.
References frand(), GetDistanceOnGlobe(), aircraft_t::pos, radar, RADAR_AddDetectedUFOToEveryRadar(), RADAR_AddUFO(), RADAR_IsUFOSensored(), and RADAR_RemoveUFO().
Referenced by TEST_F(), and UFO_CampaignCheckEvents().
Deactivate Radar overlay if there is no more UFO on geoscape.
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().
Update map radar coverage with moving radar.
Definition at line 80 of file cp_radar.cpp.
References CP_AddRadarCoverage(), and radar.
Referenced by RADAR_UpdateWholeRadarOverlay().
| void RADAR_Initialise | ( | radar_t * | radar, |
| float | range, | ||
| float | trackingRange, | ||
| float | level, | ||
| bool | updateSourceRadarMap ) |
Set radar range to new value.
| [in,out] | radar | The radar to update/initialize |
| [in] | range | New range of the radar |
| [in] | trackingRange | New tracking range of the radar |
| [in] | level | The tech level of the radar |
| [in] | updateSourceRadarMap | if 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().
Reset UFO sensored on radar.
| [out] | radar | The 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().
|
static |
Check if UFO is in the sensored list.
Definition at line 138 of file cp_radar.cpp.
Referenced by RADAR_AddDetectedUFOToEveryRadar(), RADAR_AddUFO(), and RADAR_CheckUFOSensored().
| void RADAR_NotifyUFORemoved | ( | const aircraft_t * | ufo, |
| bool | destroyed ) |
Notify to every radar that the specified ufo has been removed from geoscape.
| [in] | ufo | Pointer to UFO to remove. |
| [in] | destroyed | True if the UFO has been destroyed, false if it's only landed. |
Definition at line 213 of file cp_radar.cpp.
References AIR_ForeachFromBase, B_GetNext(), INS_Foreach, INSTALLATION_WORKING, base_t::radar, and RADAR_NotifyUFORemovedFromOneRadar().
Referenced by CP_UFORemoveFromGeoscape().
|
static |
Notify that the specified ufo has been removed from geoscape to one radar.
| [in] | radar | Pointer to the radar where ufo should be removed. |
| [in] | ufo | Pointer to UFO to remove. |
| [in] | destroyed | True if the UFO has been destroyed, false if it's been only set invisible (landed) |
Definition at line 195 of file cp_radar.cpp.
References i, radar, and RADAR_DeactivateRadarOverlay().
Referenced by RADAR_NotifyUFORemoved().
|
static |
UFO will no more be referenced by radar.
Definition at line 171 of file cp_radar.cpp.
References i, MAX_UFOONGEOSCAPE, radar, RADAR_DeactivateRadarOverlay(), and REMOVE_ELEM.
Referenced by RADAR_CheckUFOSensored().
Set radar to proper values 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().
Update radar coverage when building/destroying new radar.
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().
| void RADAR_UpdateInstallationRadarCoverage | ( | installation_t * | installation, |
| const float | radarRange, | ||
| const float | trackingRadarRange ) |
Update radar coverage when building/destroying new radar.
| [in,out] | installation | The radartower to update |
| [in] | radarRange | New range of the radar |
| [in] | trackingRadarRange | New tracking range of the radar |
Definition at line 311 of file cp_radar.cpp.
References cgi, CP_UpdateMissionVisibleOnGeoscape(), ERR_DROP, INSTALLATION_WORKING, installation_t::installationStatus, installation_t::installationTemplate, installation_t::radar, RADAR_Initialise(), RADAR_INSTALLATIONLEVEL, installationTemplate_t::radarRange, and installationTemplate_t::trackingRange.
Referenced by INS_DestroyInstallation(), INS_FinishInstallation(), and INS_LoadXML().
Update every static radar drawing (radar that don't move: base and installation radar).
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().
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().
| const float RADAR_BASERANGE = 24.0f |
Definition at line 39 of file cp_radar.cpp.
Referenced by B_Build(), and RADAR_UpdateBaseRadarCoverage_f().
| const float RADAR_BASETRACKINGRANGE = 34.0f |
Definition at line 40 of file cp_radar.cpp.
Referenced by B_Build(), and RADAR_UpdateBaseRadarCoverage_f().
| const float RADAR_INSTALLATIONLEVEL = 1.0f |
Definition at line 41 of file cp_radar.cpp.
Referenced by RADAR_UpdateInstallationRadarCoverage().
|
static |
this is the multiplier applied to the radar range when the radar levels up
Definition at line 43 of file cp_radar.cpp.
Referenced by RADAR_Initialise().
| bool radarOverlayWasSet |
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().