Alien base related functions. More...
#include "../cl_shared.h"
#include "cp_campaign.h"
#include "cp_alienbase.h"
#include "cp_map.h"
#include "cp_missions.h"
#include "save/save_alienbase.h"
Go to the source code of this file.
Defines | |
#define | MAPDEF_ALIENBASE "alienbase" |
#define | ALIENBASE_DISCOVERED_TECH "rs_alien_base_discovered_event" |
Functions | |
void | AB_SetAlienBasePosition (vec2_t pos) |
Set new base position. | |
alienBase_t * | AB_BuildBase (const vec2_t pos) |
Build a new alien base. | |
void | AB_DestroyBase (alienBase_t *base) |
Destroy an alien base. | |
alienBase_t * | AB_GetNext (alienBase_t *lastBase) |
Iterates through the alien bases. | |
alienBase_t * | AB_GetByIDX (int baseIDX) |
Get Alien Base per Idx. | |
void | CP_SpawnAlienBaseMission (alienBase_t *alienBase) |
Spawn a new alien base mission after it has been discovered. | |
static void | AB_UpdateStealthForOneBase (const aircraft_t const *aircraft, alienBase_t *base) |
Update stealth value of one alien base due to one aircraft. | |
void | AB_UpdateStealthForAllBase (void) |
Update stealth value of every base for every aircraft. | |
void | AB_BaseSearchedByNations (void) |
Nations help in searching alien base. | |
qboolean | AB_CheckSupplyMissionPossible (void) |
Check if a supply mission is possible. | |
alienBase_t * | AB_ChooseBaseToSupply (void) |
Choose Alien Base that should be supplied. | |
void | AB_SupplyBase (alienBase_t *base, qboolean decreaseStealth) |
Supply a base. | |
int | AB_GetAlienBaseNumber (void) |
Check number of alien bases. | |
void | AB_InitStartup (void) |
qboolean | AB_LoadXML (mxml_node_t *p) |
Load callback for alien base data. | |
qboolean | AB_SaveXML (mxml_node_t *p) |
Save callback for alien base data. |
Alien base related functions.
Definition in file cp_alienbase.c.
#define ALIENBASE_DISCOVERED_TECH "rs_alien_base_discovered_event" |
Definition at line 34 of file cp_alienbase.c.
Referenced by CP_SpawnAlienBaseMission().
#define MAPDEF_ALIENBASE "alienbase" |
Definition at line 33 of file cp_alienbase.c.
Referenced by CP_SpawnAlienBaseMission().
void AB_BaseSearchedByNations | ( | void | ) |
Nations help in searching alien base.
daysPerWeek
day < delay (in days) between base stealth update
< base probability, will be modified below
< xviInfection value of nation that will divide probability to find alien base by 2
Definition at line 258 of file cp_alienbase.c.
References AB_GetNext(), ccs, ccs_s::date, date_s::day, MAP_GetNation(), alienBase_s::pos, nation_s::stats, alienBase_s::stealth, alienBase_s::supply, and nationInfo_s::xviInfection.
Referenced by CL_CampaignRun().
alienBase_t* AB_BuildBase | ( | const vec2_t | pos | ) |
Build a new alien base.
[in] | pos | Position of the new base. |
< How hard PHALANX will find the base
Definition at line 93 of file cp_alienbase.c.
References ccs_s::alienBases, stats_s::alienBasesBuilt, ccs_s::campaignStats, ccs, data, alienBase_s::idx, LIST_Add(), alienBase_s::pos, alienBase_s::stealth, and Vector2Copy.
Referenced by CP_BuildBaseSetUpBase().
qboolean AB_CheckSupplyMissionPossible | ( | void | ) |
Check if a supply mission is possible.
Definition at line 288 of file cp_alienbase.c.
References AB_Exists.
Referenced by CP_SupplyGoToBase(), CP_SupplyMissionCreate(), and CP_SupplySetStayAtBase().
alienBase_t* AB_ChooseBaseToSupply | ( | void | ) |
Choose Alien Base that should be supplied.
Definition at line 297 of file cp_alienbase.c.
References AB_GetAlienBaseNumber(), and AB_GetByIDX().
Referenced by CP_SupplyGoToBase().
void AB_DestroyBase | ( | alienBase_t * | base | ) |
Destroy an alien base.
[in] | base | Pointer to the alien base. |
Definition at line 110 of file cp_alienbase.c.
References AB_Exists, ccs_s::alienBases, ccs, ccs_s::interest, INTERESTCATEGORY_SUPPLY, and LIST_Remove().
Referenced by CP_BuildBaseMissionBaseDestroyed().
int AB_GetAlienBaseNumber | ( | void | ) |
Check number of alien bases.
Definition at line 323 of file cp_alienbase.c.
References ccs_s::alienBases, ccs, and LIST_Count().
Referenced by AB_ChooseBaseToSupply(), CP_ReconMissionIsSuccess(), CP_SpawnNewMissions(), and STATS_LoadXML().
alienBase_t* AB_GetByIDX | ( | int | baseIDX | ) |
Get Alien Base per Idx.
[in] | baseIDX | The unique IDX of the alien Base. |
Definition at line 135 of file cp_alienbase.c.
References AB_GetNext(), and alienBase_s::idx.
Referenced by AB_ChooseBaseToSupply(), and CP_LoadMissionsXML().
alienBase_t* AB_GetNext | ( | alienBase_t * | lastBase | ) |
Iterates through the alien bases.
[in] | lastBase | Pointer of the alien base to iterate from. call with NULL to get the first one. |
Definition at line 125 of file cp_alienbase.c.
References ccs_s::alienBases, ccs, and LIST_GetNext().
Referenced by AB_BaseSearchedByNations(), AB_GetByIDX(), AB_SaveXML(), AB_SetAlienBasePosition(), and AB_UpdateStealthForAllBase().
void AB_InitStartup | ( | void | ) |
Definition at line 365 of file cp_alienbase.c.
References Cmd_AddCommand().
Referenced by CP_InitStartup().
qboolean AB_LoadXML | ( | mxml_node_t * | p | ) |
Load callback for alien base data.
[in] | p | XML Node structure, where we get the information from |
<
Definition at line 378 of file cp_alienbase.c.
References ccs_s::alienBases, ccs, Com_Printf(), i, alienBase_s::idx, LIST_Add(), mxml_GetFloat(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetPos2(), alienBase_s::pos, qfalse, qtrue, SAVE_ALIENBASE_ALIENBASES, SAVE_ALIENBASE_BASE, SAVE_ALIENBASE_IDX, SAVE_ALIENBASE_POS, SAVE_ALIENBASE_STEALTH, SAVE_ALIENBASE_SUPPLY, alienBase_s::stealth, and alienBase_s::supply.
Referenced by SAV_Init().
qboolean AB_SaveXML | ( | mxml_node_t * | p | ) |
Save callback for alien base data.
[out] | p | XML Node structure, where we write the information to |
Definition at line 413 of file cp_alienbase.c.
References AB_GetNext(), alienBase_s::idx, mxml_AddFloatValue(), mxml_AddInt(), mxml_AddIntValue(), mxml_AddNode(), mxml_AddPos2(), alienBase_s::pos, qtrue, SAVE_ALIENBASE_ALIENBASES, SAVE_ALIENBASE_BASE, SAVE_ALIENBASE_IDX, SAVE_ALIENBASE_POS, SAVE_ALIENBASE_STEALTH, SAVE_ALIENBASE_SUPPLY, alienBase_s::stealth, and alienBase_s::supply.
Referenced by SAV_Init().
void AB_SetAlienBasePosition | ( | vec2_t | pos | ) |
Set new base position.
[out] | pos | Position of the new base. |
maxLoopPosition
random positions, and select among those the one that is the farthest from every other alien bases. This is intended to get a rather uniform distribution of alien bases, while still keeping a random base localisation. < distance between current selected alien base
< Number of random position among which the final one will be selected
Definition at line 43 of file cp_alienbase.c.
References AB_Exists, AB_GetNext(), CP_GetRandomPosOnGeoscape(), GetDistanceOnGlobe(), MAP_PositionCloseToBase(), alienBase_s::pos, qtrue, and Vector2Copy.
Referenced by CP_BuildBaseGoToBase().
void AB_SupplyBase | ( | alienBase_t * | base, | |
qboolean | decreaseStealth | |||
) |
Supply a base.
[in] | base | Pointer to the supplied base. |
[in] | decreaseStealth | If the stealth level of the base should be decreased. |
< How much stealth is reduced because Supply UFO was seen
Definition at line 308 of file cp_alienbase.c.
References alienBase_s::stealth, and alienBase_s::supply.
Referenced by CP_SupplySetStayAtBase().
void AB_UpdateStealthForAllBase | ( | void | ) |
Update stealth value of every base for every aircraft.
DETECTION_INTERVAL
Definition at line 231 of file cp_alienbase.c.
References AB_GetNext(), AB_UpdateStealthForOneBase(), AIR_GetNextFromBase(), AIR_IsAircraftOnGeoscape(), B_GetFoundedBaseByIDX(), and MAX_BASES.
Referenced by CL_CampaignFunctionPeriodicCall().
static void AB_UpdateStealthForOneBase | ( | const aircraft_t const * | aircraft, | |
alienBase_t * | base | |||
) | [static] |
Update stealth value of one alien base due to one aircraft.
[in] | aircraft | Pointer to the aircraft_t. |
[in] | base | Pointer to the alien base. |
radarratio
times radar range. < base probability, will be modified below
< stealth decreases faster if base is inside radarratio times radar range
< factor applied when outside radarratio
times radar range
Definition at line 190 of file cp_alienbase.c.
References CP_SpawnAlienBaseMission(), DETECTION_INTERVAL, GetDistanceOnGlobe(), alienBase_s::pos, aircraft_s::pos, aircraft_s::radar, radar_s::range, alienBase_s::stealth, and alienBase_s::supply.
Referenced by AB_UpdateStealthForAllBase().
void CP_SpawnAlienBaseMission | ( | alienBase_t * | alienBase | ) |
Spawn a new alien base mission after it has been discovered.
Definition at line 149 of file cp_alienbase.c.
References _, ALIENBASE_DISCOVERED_TECH, Cmd_ExecuteString(), Com_DPrintf(), Com_Error(), Com_GetMapDefinitionByID(), Com_Printf(), Com_sprintf(), CP_CreateNewMission(), CP_MissionAddToGeoscape(), CP_MissionDisableTimeLimit(), mission_s::data, DEBUG_CLIENT, ERR_FATAL, INTERESTCATEGORY_ALIENBASE, mission_s::location, mission_s::mapDef, MAPDEF_ALIENBASE, mission_s::pos, alienBase_s::pos, mission_s::posAssigned, qfalse, qtrue, RS_MarkStoryLineEventResearched(), mission_s::stage, STAGE_BASE_DISCOVERED, and Vector2Copy.
Referenced by AB_UpdateStealthForOneBase().