Header file for aircraft stuff. More...
Go to the source code of this file.
Data Structures | |
struct | mapline_s |
A path on the map described by 2D points. More... | |
struct | aliensTmp_s |
struct | aircraftSlot_s |
slot of aircraft More... | |
struct | itemsTmp_s |
A cargo of items collected after mission. More... | |
struct | aircraft_s |
An aircraft with all it's data. More... | |
Defines | |
#define | MAX_CARGO 32 |
#define | MAX_AIRCRAFT 64 |
#define | LINE_MAXSEG 64 |
#define | LINE_MAXPTS (LINE_MAXSEG + 2) |
#define | LINE_DPHI (M_PI / LINE_MAXSEG) |
#define | AIRCRAFT_INVALID -1 |
#define | AIRCRAFT_INBASE_INVALID -1 |
#define | AIRCRAFT_REFUEL_FACTOR 16 |
#define | AIR_IsUFO(aircraft) ((aircraft)->ufotype != UFO_MAX) |
#define | MAX_HUMAN_AIRCRAFT_TYPE AIRCRAFT_INTERCEPTOR |
#define | MAX_AIRCRAFTITEMS 64 |
#define | MAX_AIRCRAFTSLOT 4 |
Typedefs | |
typedef struct mapline_s | mapline_t |
A path on the map described by 2D points. | |
typedef struct aliensTmp_s | aliensTmp_t |
typedef struct aircraftSlot_s | aircraftSlot_t |
slot of aircraft | |
typedef struct itemsTmp_s | itemsTmp_t |
A cargo of items collected after mission. | |
typedef enum aircraftStatus_s | aircraftStatus_t |
typedef struct aircraft_s | aircraft_t |
An aircraft with all it's data. | |
Enumerations | |
enum | aircraftType_t { AIRCRAFT_TRANSPORTER, AIRCRAFT_INTERCEPTOR, AIRCRAFT_UFO } |
All different types of aircraft. More... | |
enum | aircraftSize_t { AIRCRAFT_SMALL = 1, AIRCRAFT_LARGE = 2 } |
All different size of aircraft. More... | |
enum | aircraftHangarType_t { AIRCRAFT_HANGAR_NONE = 0, AIRCRAFT_HANGAR_SMALL = 1, AIRCRAFT_HANGAR_BIG = 2, AIRCRAFT_HANGAR_ERROR } |
All different Hangar size. More... | |
enum | itemWeight_t { ITEM_LIGHT, ITEM_MEDIUM, ITEM_HEAVY } |
different weight for aircraft items More... | |
enum | itemPos_t { AIR_NOSE_LEFT, AIR_NOSE_CENTER, AIR_NOSE_RIGHT, AIR_WING_LEFT, AIR_WING_RIGHT, AIR_REAR_LEFT, AIR_REAR_CENTER, AIR_REAR_RIGHT, AIR_POSITIONS_MAX } |
different positions for aircraft items More... | |
enum | aircraft_notifications_t { AIR_CANNOT_REFUEL, MAX_AIR_NOTIFICATIONS } |
notification signals for aircraft events More... | |
enum | aircraftStatus_s { AIR_NONE, AIR_REFUEL, AIR_HOME, AIR_IDLE, AIR_TRANSIT, AIR_MISSION, AIR_UFO, AIR_DROP, AIR_INTERCEPT, AIR_TRANSFER, AIR_CRASHED, AIR_RETURNING } |
Functions | |
aircraft_t * | AIR_Add (struct base_s *base, const aircraft_t *aircraftTemplate) |
Adds a new aircraft from a given aircraft template to the base and sets the homebase for the new aircraft to the given base. | |
qboolean | AIR_Delete (struct base_s *base, const aircraft_t *aircraft) |
Will remove the given aircraft from the base. | |
aircraft_t * | AIR_GetNextFromBase (const struct base_s *base, aircraft_t *lastAircraft) |
aircraft_t * | AIR_GetByIDX (int idx) |
qboolean | AIR_BaseHasAircraft (const struct base_s *base) |
int | AIR_GetAircraftIDXInBase (const aircraft_t *aircraft) |
Returns the index of the aircraft in the base->aircraft array. | |
aircraft_t * | AIR_GetAircraftFromBaseByIDXSafe (struct base_s *base, int index) |
const char * | AIR_AircraftStatusToName (const aircraft_t *aircraft) |
Translates the aircraft status id to a translatable string. | |
qboolean | AIR_IsAircraftInBase (const aircraft_t *aircraft) |
Checks whether given aircraft is in its homebase. | |
qboolean | AIR_IsAircraftOnGeoscape (const aircraft_t *aircraft) |
Checks whether given aircraft is on geoscape. | |
void | AIR_DeleteAircraft (aircraft_t *aircraft) |
Removes an aircraft from its base and the game. | |
void | AIR_DestroyAircraft (aircraft_t *aircraft) |
Removes an aircraft from its base and the game. | |
qboolean | AIR_MoveAircraftIntoNewHomebase (aircraft_t *aircraft, struct base_s *base) |
Moves a given aircraft to a new base (also the employees and inventory). | |
void | AIR_ResetAircraftTeam (aircraft_t *aircraft) |
Resets team in given aircraft. | |
qboolean | AIR_AddToAircraftTeam (aircraft_t *aircraft, struct employee_s *employee) |
Adds given employee to given aircraft. | |
qboolean | AIR_RemoveFromAircraftTeam (aircraft_t *aircraft, const struct employee_s *employee) |
qboolean | AIR_IsInAircraftTeam (const aircraft_t *aircraft, const struct employee_s *employee) |
int | AIR_GetTeamSize (const aircraft_t *aircraft) |
Counts the number of soldiers in given aircraft. | |
void | CL_CampaignRunAircraft (int dt, qboolean updateRadarOverlay) |
Handles aircraft movement and actions in geoscape mode. | |
aircraft_t * | AIR_GetAircraftSilent (const char *name) |
Searches the global array of aircraft types for a given aircraft. | |
aircraft_t * | AIR_GetAircraft (const char *name) |
Searches the global array of aircraft types for a given aircraft. | |
aircraft_t * | AIR_AircraftGetFromIDX (int idx) |
Returns aircraft for a given global index. | |
qboolean | AIR_AircraftMakeMove (int dt, aircraft_t *aircraft) |
Moves given aircraft. | |
void | AIR_ParseAircraft (const char *name, const char **text, qboolean assignAircraftItems) |
Parses all aircraft that are defined in our UFO-scripts. | |
qboolean | AIR_AircraftHasEnoughFuel (const aircraft_t *aircraft, const vec2_t destination) |
check if aircraft has enough fuel to go to destination, and then come back home | |
qboolean | AIR_AircraftHasEnoughFuelOneWay (const aircraft_t *aircraft, const vec2_t destination) |
void | AIR_AircraftReturnToBase (aircraft_t *aircraft) |
Calculates the way back to homebase for given aircraft and returns it. | |
qboolean | AIR_SendAircraftToMission (aircraft_t *aircraft, struct mission_s *mission) |
Sends the specified aircraft to specified mission. | |
void | AIR_GetDestinationWhilePursuing (const aircraft_t const *shooter, const aircraft_t const *target, vec2_t *dest) |
Calculates the point where aircraft should go to intecept a moving target. | |
qboolean | AIR_SendAircraftPursuingUFO (aircraft_t *aircraft, aircraft_t *ufo) |
Make the specified aircraft purchasing a UFO. | |
void | AIR_AircraftsNotifyUFORemoved (const aircraft_t *const ufo, qboolean destroyed) |
Notify that a UFO has been removed. | |
void | AIR_AircraftsUFODisappear (const aircraft_t *const ufo) |
Notify that a UFO disappear from radars. | |
void | AIR_UpdateHangarCapForAll (struct base_s *base) |
Updates current capacities for hangars in given base. | |
qboolean | AIR_ScriptSanityCheck (void) |
Checks the parsed aircraft for errors. | |
int | AIR_CalculateHangarStorage (const aircraft_t *aircraft, const struct base_s *base, int used) __attribute__((nonnull(1 |
int int | CL_AircraftMenuStatsValues (const int value, const int stat) |
Some of the aircraft values needs special calculations when they are shown in the menus. | |
int | AIR_CountTypeInBase (const struct base_s *base, aircraftType_t aircraftType) |
const char * | AIR_GetAircraftString (aircraftType_t aircraftType) |
Returns the string that matches the given aircraft type. | |
int | AIR_GetAircraftWeaponRanges (const aircraftSlot_t *slot, int maxSlot, float *weaponRanges) |
Get the all the unique weapon ranges of this aircraft. | |
int | AIR_GetCapacityByAircraftWeight (const aircraft_t *aircraft) |
const char * | AIR_CheckMoveIntoNewHomebase (const aircraft_t *aircraft, const struct base_s *base, const int capacity) |
void | AII_CollectItem (aircraft_t *aircraft, const objDef_t *item, int amount) |
Add an item to aircraft inventory. | |
void | AII_CollectingItems (aircraft_t *aircraft, int won) |
Collect items from the battlefield. | |
void | AIR_AutoAddPilotToAircraft (struct base_s *base, struct employee_s *pilot) |
Adds the pilot to the first available aircraft at the specified base. | |
void | AIR_RemovePilotFromAssignedAircraft (struct base_s *base, const struct employee_s *pilot) |
void | AIR_RemoveEmployees (aircraft_t *aircraft) |
Removes all soldiers from an aircraft. | |
qboolean | AIR_RemoveEmployee (struct employee_s *employee, aircraft_t *aircraft) |
Removes a soldier from an aircraft. | |
const aircraft_t * | AIR_IsEmployeeInAircraft (const struct employee_s *employee, const aircraft_t *aircraft) |
void | AIR_MoveEmployeeInventoryIntoStorage (const aircraft_t *aircraft, equipDef_t *equip) |
Move all the equipment carried by the team on the aircraft into the given equipment. | |
void | AIM_AddEmployeeFromMenu (aircraft_t *aircraft, const int num) |
Adds or removes a soldier to/from an aircraft. | |
void | AIR_AssignInitial (aircraft_t *aircraft) |
Assigns initial team of soldiers to aircraft. | |
qboolean | AIR_CanIntercept (const aircraft_t *aircraft) |
int | AIR_GetOperationRange (const aircraft_t *aircraft) |
Calculates the range an aircraft can fly on the geoscape. | |
int | AIR_GetRemainingRange (const aircraft_t *aircraft) |
Calculates the remaining range the aircraft can fly. |
Header file for aircraft stuff.
Definition in file cp_aircraft.h.
#define AIR_IsUFO | ( | aircraft | ) | ((aircraft)->ufotype != UFO_MAX) |
Definition at line 42 of file cp_aircraft.h.
Referenced by AII_ReloadWeapon(), AIRFIGHT_MissTarget(), PR_UpdateProductionList(), and UP_AircraftDescription().
#define AIRCRAFT_INBASE_INVALID -1 |
Invalid aircraft index in base-list of aircraft.
Definition at line 37 of file cp_aircraft.h.
Referenced by AIR_GetAircraftIDXInBase(), and B_LoadXML().
#define AIRCRAFT_INVALID -1 |
Invalid aircraft index (global index).
Definition at line 35 of file cp_aircraft.h.
Referenced by AIRFIGHT_LoadXML().
#define AIRCRAFT_REFUEL_FACTOR 16 |
factor to speed up refuelling
Definition at line 40 of file cp_aircraft.h.
Referenced by AIR_Refuel().
#define LINE_DPHI (M_PI / LINE_MAXSEG) |
Definition at line 32 of file cp_aircraft.h.
#define LINE_MAXPTS (LINE_MAXSEG + 2) |
Definition at line 31 of file cp_aircraft.h.
Referenced by AIR_LoadRouteXML(), MAP_3DMapDrawLine(), MAP_MapCalcLine(), and MAP_MapDrawLine().
#define LINE_MAXSEG 64 |
Definition at line 30 of file cp_aircraft.h.
Referenced by MAP_MapCalcLine().
#define MAX_AIRCRAFT 64 |
Definition at line 29 of file cp_aircraft.h.
Referenced by AIR_ParseAircraft(), B_RemoveAircraftExceedingCapacity(), TR_NotifyAircraftRemoved(), TR_TransferListSelect_f(), and TR_TransferSelect().
#define MAX_AIRCRAFTITEMS 64 |
Definition at line 86 of file cp_aircraft.h.
#define MAX_AIRCRAFTSLOT 4 |
Definition at line 116 of file cp_aircraft.h.
Referenced by AII_InitialiseAircraftSlots(), AII_SetAircraftInSlots(), AIR_DeleteAircraft(), AIR_GetAircraftWeaponRanges(), and AIR_GetSlotItems().
#define MAX_CARGO 32 |
Definition at line 28 of file cp_aircraft.h.
Referenced by AII_CollectingItems(), AIR_LoadAircraftXML(), AL_GetCargoIndexForTeamDefintion(), CL_AutoMissionAlienCollect(), TR_CargoList(), TR_CargoListSelect_f(), and TR_CountStunnedAliensInCargo().
#define MAX_HUMAN_AIRCRAFT_TYPE AIRCRAFT_INTERCEPTOR |
Definition at line 59 of file cp_aircraft.h.
Referenced by BaseSummary_Init().
typedef struct aircraft_s aircraft_t |
An aircraft with all it's data.
typedef struct aircraftSlot_s aircraftSlot_t |
slot of aircraft
typedef enum aircraftStatus_s aircraftStatus_t |
possible aircraft states
typedef struct aliensTmp_s aliensTmp_t |
alien cargo in aircraft_t, carrying aliens and bodies from a mission to base
typedef struct itemsTmp_s itemsTmp_t |
A cargo of items collected after mission.
notification signals for aircraft events
Definition at line 103 of file cp_aircraft.h.
enum aircraftHangarType_t |
All different Hangar size.
Definition at line 70 of file cp_aircraft.h.
enum aircraftSize_t |
All different size of aircraft.
Definition at line 62 of file cp_aircraft.h.
enum aircraftStatus_s |
possible aircraft states
Definition at line 147 of file cp_aircraft.h.
enum aircraftType_t |
All different types of aircraft.
Definition at line 53 of file cp_aircraft.h.
enum itemPos_t |
different positions for aircraft items
AIR_NOSE_LEFT | |
AIR_NOSE_CENTER | |
AIR_NOSE_RIGHT | |
AIR_WING_LEFT | |
AIR_WING_RIGHT | |
AIR_REAR_LEFT | |
AIR_REAR_CENTER | |
AIR_REAR_RIGHT | |
AIR_POSITIONS_MAX |
Definition at line 89 of file cp_aircraft.h.
enum itemWeight_t |
different weight for aircraft items
Definition at line 80 of file cp_aircraft.h.
void AII_CollectingItems | ( | aircraft_t * | aircraft, | |
int | won | |||
) |
Collect items from the battlefield.
Definition at line 349 of file cp_aircraft.c.
References item_s::a, AII_CarriedItems(), AII_CollectingAmmo(), AII_CollectItem(), itemsTmp_s::amount, ARMOUR, ccs, cls, Com_DPrintf(), DEBUG_CLIENT, FLOOR, i, itemsTmp_s::item, invList_s::item, missionResults_s::itemAmount, aircraft_s::itemcargo, missionResults_s::itemTypes, aircraft_s::itemTypes, LE_GetNextInUse(), LE_IsActor(), LE_IsDead, LE_IsItem, MAX_CARGO, ccs_s::missionResults, objDef_s::name, invList_s::next, objDef_s::reload, item_s::t, client_static_s::team, and le_s::team.
Referenced by GAME_CP_Results().
void AII_CollectItem | ( | aircraft_t * | aircraft, | |
const objDef_t * | item, | |||
int | amount | |||
) |
Add an item to aircraft inventory.
[in,out] | aircraft | Aircraft to load to |
[in] | item | Item to add |
amount | Number of items to add |
Definition at line 286 of file cp_aircraft.c.
References itemsTmp_s::amount, Com_DPrintf(), DEBUG_CLIENT, i, objDef_s::idx, itemsTmp_s::item, aircraft_s::itemcargo, aircraft_s::itemTypes, and objDef_s::name.
Referenced by AII_CollectingAmmo(), AII_CollectingItems(), and AL_AddAliens().
void AIM_AddEmployeeFromMenu | ( | aircraft_t * | aircraft, | |
const int | num | |||
) |
Adds or removes a soldier to/from an aircraft.
[in,out] | aircraft | Aircraft to add to/remove from |
[in] | num | Index of Soldier (in menu) to add/remove |
Definition at line 3208 of file cp_aircraft.c.
References AIR_AddEmployee(), AIR_IsEmployeeInAircraft(), AIR_RemoveEmployee(), Com_DPrintf(), Com_Error(), DEBUG_CLIENT, E_GetEmployeeByMenuIndex(), ERR_DROP, and employee_s::idx.
Referenced by AIR_AssignInitial(), and CL_AssignSoldier_f().
aircraft_t* AIR_Add | ( | base_t * | base, | |
const aircraft_t * | aircraftTemplate | |||
) |
Adds a new aircraft from a given aircraft template to the base and sets the homebase for the new aircraft to the given base.
[out] | base | The base to add the aircraft to |
[in] | aircraftTemplate | The template to create the new aircraft from |
Definition at line 759 of file cp_aircraft.c.
References base_s::aircraft, byte, ccs, data, aircraft_s::homebase, LIST_Add(), and ccs_s::numAircraft.
Referenced by AIR_LoadXML(), AIR_MoveAircraftIntoNewHomebase(), and AIR_NewAircraft().
qboolean AIR_AddToAircraftTeam | ( | aircraft_t * | aircraft, | |
employee_t * | employee | |||
) |
Adds given employee to given aircraft.
[in] | aircraft | Pointer to an aircraft, to which we will add employee. |
[in] | employee | The employee to add to the aircraft. |
Definition at line 2180 of file cp_aircraft.c.
References aircraft_s::acTeam, AIR_GetTeamSize(), Com_DPrintf(), DEBUG_CLIENT, employee_s::idx, LIST_AddPointer(), aircraft_s::maxTeamSize, qfalse, and qtrue.
Referenced by AIR_AddEmployee(), and CP_BaseAttackStartMission().
aircraft_t* AIR_AircraftGetFromIDX | ( | int | idx | ) |
Returns aircraft for a given global index.
[in] | idx | Global aircraft index. |
Definition at line 1318 of file cp_aircraft.c.
References AIR_GetNextFromBase(), B_GetFoundedBaseByIDX(), ccs, Com_DPrintf(), DEBUG_CLIENT, base_s::idx, aircraft_s::idx, base_s::name, and ccs_s::numBases.
Referenced by AIR_LoadAircraftXML(), AIRFIGHT_LoadXML(), CP_LoadMissionsXML(), MAP_MultiSelectExecuteAction_f(), PR_UpdateProductionList(), TR_AircraftListSelect(), TR_CargoList(), TR_CheckAircraft(), TR_EmptyTransferCargo(), TR_TransferAliensFromMission_f(), TR_TransferListSelect_f(), TR_TransferSelect(), and TR_TransferStart().
qboolean AIR_AircraftHasEnoughFuel | ( | const aircraft_t * | aircraft, | |
const vec2_t | destination | |||
) |
check if aircraft has enough fuel to go to destination, and then come back home
[in] | aircraft | Pointer to the aircraft |
[in] | destination | Pointer to the position the aircraft should go to |
Definition at line 592 of file cp_aircraft.c.
References AIR_GetRemainingRange(), GetDistanceOnGlobe(), aircraft_s::homebase, base_s::pos, aircraft_s::pos, and SECONDS_PER_HOUR.
Referenced by AIR_SendAircraftPursuingUFO(), AIR_SendAircraftToMission(), CL_CampaignRunAircraft(), CL_DisplayPopupInterceptUFO(), and MAP_MapClick().
qboolean AIR_AircraftHasEnoughFuelOneWay | ( | const aircraft_t * | aircraft, | |
const vec2_t | destination | |||
) |
qboolean AIR_AircraftMakeMove | ( | int | dt, | |
aircraft_t * | aircraft | |||
) |
Moves given aircraft.
[in] | dt | time delta |
[in] | aircraft | Pointer to aircraft on its way. |
Definition at line 1108 of file cp_aircraft.c.
References AIR_STATS_SPEED, mapline_s::distance, aircraft_s::fuel, aircraft_s::hasMoved, int(), MAP_CheckPositionBoundaries(), aircraft_s::numInterpolationPoints, mapline_s::numPoints, mapline_s::point, aircraft_s::point, aircraft_s::pos, aircraft_s::projectedPos, qfalse, qtrue, aircraft_s::route, SECONDS_PER_HOUR, aircraft_s::stats, aircraft_s::time, and VectorSet.
Referenced by AIR_Move(), and UFO_CampaignRunUFOs().
void AIR_AircraftReturnToBase | ( | aircraft_t * | aircraft | ) |
Calculates the way back to homebase for given aircraft and returns it.
[in] | aircraft | Pointer to aircraft, which should return to base. |
Definition at line 636 of file cp_aircraft.c.
References AIR_IsAircraftOnGeoscape(), AIR_RETURNING, Com_DPrintf(), DEBUG_CLIENT, aircraft_s::homebase, aircraft_s::id, aircraft_s::idx, MAP_MapCalcLine(), aircraft_s::mission, base_s::name, aircraft_s::point, base_s::pos, aircraft_s::pos, aircraft_s::route, aircraft_s::status, and aircraft_s::time.
Referenced by AIM_AircraftReturnToBase_f(), AIR_AircraftsNotifyMissionRemoved(), AIR_AircraftsNotifyUFORemoved(), AIR_AircraftsUFODisappear(), AIR_MoveAircraftIntoNewHomebase(), AIR_SendAircraftPursuingUFO(), AIRFIGHT_ExecuteActions(), AIRFIGHT_MissTarget(), CL_CampaignRunAircraft(), CL_PopupAircraftClick_f(), and CP_MissionEndActions().
void AIR_AircraftsNotifyUFORemoved | ( | const aircraft_t *const | ufo, | |
qboolean | destroyed | |||
) |
Notify that a UFO has been removed.
[in] | ufo | Pointer to UFO that has been removed. |
[in] | destroyed | True if the UFO has been destroyed, false if it only landed. |
Definition at line 1832 of file cp_aircraft.c.
References AIR_AircraftReturnToBase(), AIR_GetNextFromBase(), AIR_UFO, aircraft_s::aircraftTarget, B_GetFoundedBaseByIDX(), base_s::batteries, base_s::lasers, base_s::numBatteries, base_s::numLasers, aircraft_s::status, and baseWeapon_s::target.
Referenced by CP_UFORemoveFromGeoscape().
const char* AIR_AircraftStatusToName | ( | const aircraft_t * | aircraft | ) |
Translates the aircraft status id to a translatable string.
[in] | aircraft | Aircraft to translate the status of |
Definition at line 429 of file cp_aircraft.c.
References _, AIR_CRASHED, AIR_DROP, AIR_HOME, AIR_IDLE, AIR_INTERCEPT, AIR_IsAircraftInBase(), AIR_MISSION, AIR_NONE, AIR_REFUEL, AIR_RETURNING, AIR_TRANSFER, AIR_TRANSIT, AIR_UFO, BASE_UNDER_ATTACK, base_s::baseStatus, Com_Error(), ERR_DROP, aircraft_s::homebase, and aircraft_s::status.
Referenced by AIR_AircraftSelect(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), and MAP_GetAircraftText().
void AIR_AircraftsUFODisappear | ( | const aircraft_t *const | ufo | ) |
Notify that a UFO disappear from radars.
[in] | ufo | Pointer to a UFO that has disappeared. |
Definition at line 1875 of file cp_aircraft.c.
References AIR_AircraftReturnToBase(), AIR_GetNextFromBase(), AIR_UFO, aircraft_s::aircraftTarget, B_GetBaseByIDX(), and aircraft_s::status.
Referenced by UFO_CampaignCheckEvents().
void AIR_AssignInitial | ( | aircraft_t * | aircraft | ) |
Assigns initial team of soldiers to aircraft.
[in,out] | aircraft | soldiers to add to |
Definition at line 3236 of file cp_aircraft.c.
References AIM_AddEmployeeFromMenu(), Com_Printf(), E_GenerateHiredEmployeesList(), aircraft_s::homebase, and aircraft_s::maxTeamSize.
Referenced by B_SetUpFirstBase().
void AIR_AutoAddPilotToAircraft | ( | base_t * | base, | |
employee_t * | pilot | |||
) |
Adds the pilot to the first available aircraft at the specified base.
[in] | base | Which base has aircraft to add the pilot to. |
[in] | pilot | Which pilot to add. |
Definition at line 2277 of file cp_aircraft.c.
References AIR_GetNextFromBase(), and aircraft_s::pilot.
Referenced by E_HireEmployee().
int AIR_CalculateHangarStorage | ( | const aircraft_t * | aircraft, | |
const struct base_s * | base, | |||
int | used | |||
) |
qboolean AIR_CanIntercept | ( | const aircraft_t * | aircraft | ) |
aircraft | The aircraft to check |
true
if the given aircraft can go on interceptions Definition at line 2914 of file cp_aircraft.c.
References AIRCRAFT_LARGE, AIRCRAFT_SMALL, B_GetBuildingStatus(), B_HANGAR, B_SMALL_HANGAR, aircraft_s::homebase, aircraft_s::pilot, qfalse, qtrue, and aircraft_s::size.
Referenced by CL_DisplayPopupInterceptMission(), and CL_DisplayPopupInterceptUFO().
const char* AIR_CheckMoveIntoNewHomebase | ( | const aircraft_t * | aircraft, | |
const struct base_s * | base, | |||
const int | capacity | |||
) |
int AIR_CountTypeInBase | ( | const struct base_s * | base, | |
aircraftType_t | aircraftType | |||
) |
qboolean AIR_Delete | ( | base_t * | base, | |
const aircraft_t * | aircraft | |||
) |
Will remove the given aircraft from the base.
[out] | base | The base to remove the aircraft from |
aircraft | The aircraft to remove |
true
if the aircraft was removed, false
otherwise Definition at line 774 of file cp_aircraft.c.
References base_s::aircraft, ccs, LIST_Remove(), and ccs_s::numAircraft.
Referenced by AIR_DeleteAircraft(), and AIR_MoveAircraftIntoNewHomebase().
void AIR_DeleteAircraft | ( | aircraft_t * | aircraft | ) |
Removes an aircraft from its base and the game.
[in] | aircraft | Pointer to aircraft that should be removed. |
Definition at line 1020 of file cp_aircraft.c.
References AII_RemoveItemFromSlot(), AIR_BaseHasAircraft(), AIR_Delete(), AIR_GetNextFromBase(), AIR_IsAircraftOnGeoscape(), AIR_RemoveEmployees(), AIR_UpdateHangarCapForAll(), base_s::aircraftCurrent, Cmd_ExecuteString(), Cvar_Set(), Cvar_SetValue(), aircraft_s::electronics, aircraft_s::homebase, i, MAP_NotifyAircraftRemoved(), MAX_AIRCRAFTSLOT, qfalse, RADAR_UpdateWholeRadarOverlay(), aircraft_s::shield, TR_NotifyAircraftRemoved(), and aircraft_s::weapons.
Referenced by AIR_DestroyAircraft(), B_RemoveAircraftExceedingCapacity(), BS_SellAircraft_f(), and TR_EmptyTransferCargo().
void AIR_DestroyAircraft | ( | aircraft_t * | aircraft | ) |
Removes an aircraft from its base and the game.
[in] | aircraft | Pointer to aircraft that should be removed. |
Definition at line 1078 of file cp_aircraft.c.
References aircraft_s::acTeam, AIR_DeleteAircraft(), Com_Error(), linkedList_s::data, E_DeleteEmployee(), E_RemoveInventoryFromStorage(), ERR_DROP, aircraft_s::id, linkedList_s::next, aircraft_s::pilot, and employee_s::type.
Referenced by AIRFIGHT_ActionsAfterAirfight(), B_MoveAircraftOnGeoscapeToOtherBases(), and CP_MissionEndActions().
aircraft_t* AIR_GetAircraft | ( | const char * | name | ) |
Searches the global array of aircraft types for a given aircraft.
[in] | name | Aircraft id. |
Definition at line 724 of file cp_aircraft.c.
References AIR_GetAircraftSilent(), Com_Error(), and ERR_DROP.
Referenced by AIR_LoadAircraftXML(), AIR_NewAircraft(), AIR_ParseAircraft(), B_SetUpFirstBase(), BS_InitMarket(), CL_CampaignRunMarket(), PR_LoadXML(), RS_AssignTechLinks(), UFO_MissionResultToString(), UP_AircraftDescription(), UR_DialogInit_f(), and US_LoadXML().
aircraft_t* AIR_GetAircraftFromBaseByIDXSafe | ( | base_t * | base, | |
int | index | |||
) |
base | The base to get the aircraft from | |
index | The index of the aircraft in the given base |
NULL
if there is no such aircraft in the given base, or the aircraft pointer that belongs to the given index. Definition at line 683 of file cp_aircraft.c.
References AIR_GetNextFromBase(), and i.
Referenced by AIM_SelectAircraft_f().
int AIR_GetAircraftIDXInBase | ( | const aircraft_t * | aircraft | ) |
Returns the index of the aircraft in the base->aircraft array.
[in] | aircraft | The aircraft to get the index for. |
Definition at line 655 of file cp_aircraft.c.
References AIR_GetNextFromBase(), AIRCRAFT_INBASE_INVALID, aircraft_s::homebase, and i.
Referenced by AIR_RemoveFromAircraftTeam(), and B_SaveXML().
aircraft_t* AIR_GetAircraftSilent | ( | const char * | name | ) |
Searches the global array of aircraft types for a given aircraft.
[in] | name | Aircraft id. |
Definition at line 705 of file cp_aircraft.c.
References ccs_s::aircraftTemplates, ccs, i, aircraft_s::id, and ccs_s::numAircraftTemplates.
Referenced by AIR_GetAircraft(), and GAME_CP_DisplayItemInfo().
const char* AIR_GetAircraftString | ( | aircraftType_t | aircraftType | ) |
Returns the string that matches the given aircraft type.
Definition at line 531 of file cp_aircraft.c.
References _, AIRCRAFT_INTERCEPTOR, AIRCRAFT_TRANSPORTER, and AIRCRAFT_UFO.
Referenced by BaseSummary_Init().
int AIR_GetAircraftWeaponRanges | ( | const aircraftSlot_t * | slot, | |
int | maxSlot, | |||
float * | weaponRanges | |||
) |
Get the all the unique weapon ranges of this aircraft.
[in] | slot | Pointer to the aircrafts weapon slot list. |
[in] | maxSlot | maximum number of weapon slots in aircraft. |
[out] | weaponRanges | An array containing a unique list of weapons ranges. |
Definition at line 2316 of file cp_aircraft.c.
References AIR_STATS_WRANGE, aircraftSlot_s::ammo, objDef_s::craftitem, MAX_AIRCRAFTSLOT, Q_FloatSort(), and craftitem_s::stats.
aircraft_t* AIR_GetByIDX | ( | int | idx | ) |
int AIR_GetCapacityByAircraftWeight | ( | const aircraft_t * | aircraft | ) |
Definition at line 831 of file cp_aircraft.c.
References AIRCRAFT_LARGE, AIRCRAFT_SMALL, CAP_AIRCRAFT_BIG, CAP_AIRCRAFT_SMALL, Com_Error(), ERR_DROP, and aircraft_s::size.
Referenced by AIR_CalculateHangarStorage(), AIR_MoveAircraftIntoNewHomebase(), and CL_DisplayHomebasePopup().
void AIR_GetDestinationWhilePursuing | ( | const aircraft_t const * | shooter, | |
const aircraft_t const * | target, | |||
vec2_t * | dest | |||
) |
Calculates the point where aircraft should go to intecept a moving target.
[in] | shooter | Pointer to shooting aircraft. |
[in] | target | Pointer to target aircraft. |
[out] | dest | Destination that shooting aircraft should aim to intercept target aircraft. |
In the following, we note S the position of the shooter, T the position of the target, D the destination of the target and I the interception point where shooter should reach target O is the center of earth. A, B and C are the angles TSI, STI and SIT a, b, and c are the angles TOI, SOI and SOT
According to geometry on a sphere, the values defined above must be solutions of both equations: sin(A) / sin(a) = sin(B) / sin(b) cos(a) = cos(b) * cos(c) + sin(b) * sin(c) * cos(A) And we have another equation, given by the fact that shooter and target must reach I at the same time: shooterSpeed * a = targetSpeed * b We the want to find and equation linking a, c and B (we know the last 2 values). We therefore eliminate b, then A, to get the equation we need to solve: pow(cos(a) - cos(speedRatio * a) * cos(c), 2.)
Definition at line 2040 of file cp_aircraft.c.
References AIR_GetDestinationFindRoot(), AIR_STATS_SPEED, Com_DPrintf(), CrossProduct(), DEBUG_CLIENT, DotProduct, f, GetDistanceOnGlobe(), mapline_s::numPoints, mapline_s::point, PolarToVec(), aircraft_s::pos, RotatePointAroundVector(), aircraft_s::route, aircraft_s::stats, todeg, torad, VecToPolar(), Vector2Copy, and VectorNormalize().
Referenced by AIR_SendAircraftPursuingUFO(), and UFO_SendPursuingAircraft().
aircraft_t* AIR_GetNextFromBase | ( | const struct base_s * | base, | |
aircraft_t * | lastAircraft | |||
) |
int AIR_GetOperationRange | ( | const aircraft_t * | aircraft | ) |
Calculates the range an aircraft can fly on the geoscape.
aircraft | The aircraft to calculate the range for |
Definition at line 568 of file cp_aircraft.c.
References AIR_STATS_FUELSIZE, AIR_STATS_SPEED, f, int(), KILOMETER_PER_DEGREE, SECONDS_PER_HOUR, and aircraft_s::stats.
Referenced by AIR_AircraftSelect(), and UP_AircraftDescription().
int AIR_GetRemainingRange | ( | const aircraft_t * | aircraft | ) |
Calculates the remaining range the aircraft can fly.
aircraft | The aircraft to calculate the remaining range for |
Definition at line 580 of file cp_aircraft.c.
References AIR_STATS_SPEED, aircraft_s::fuel, and aircraft_s::stats.
Referenced by AIR_AircraftHasEnoughFuel(), and AIR_AircraftHasEnoughFuelOneWay().
int AIR_GetTeamSize | ( | const aircraft_t * | aircraft | ) |
Counts the number of soldiers in given aircraft.
[in] | aircraft | Pointer to the aircraft, for which we return the amount of soldiers. |
Definition at line 2266 of file cp_aircraft.c.
References aircraft_s::acTeam, and LIST_Count().
Referenced by AIR_AddEmployee(), AIR_AddToAircraftTeam(), AIR_IsInAircraftTeam(), AIR_LoadAircraftXML(), AIR_MoveEmployeeInventoryIntoStorage(), AIR_RemoveEmployees(), AIR_RemoveFromAircraftTeam(), AIR_SendAircraftToMission(), BS_SellAircraft_f(), CL_CleanupAircraftCrew(), CL_DisplayPopupAircraft(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), CL_GameAutoGo(), CL_UpdateActorAircraftVar(), CL_UpdateEquipmentMenuParameters_f(), CP_BaseAttackStartMission(), CP_GetWinProbabilty(), CP_StartSelectedMission(), and MAP_GetAircraftText().
qboolean AIR_IsAircraftInBase | ( | const aircraft_t * | aircraft | ) |
Checks whether given aircraft is in its homebase.
[in] | aircraft | Pointer to an aircraft. |
Definition at line 474 of file cp_aircraft.c.
References AIR_HOME, AIR_REFUEL, qfalse, qtrue, and aircraft_s::status.
Referenced by AII_ReloadWeapon(), AII_RepairAircraft(), AII_UpdateInstallationDelay(), AIM_AircraftStart_f(), AIR_AircraftSelect(), AIR_AircraftStatusToName(), AIR_SendAircraftPursuingUFO(), AIR_SendAircraftToMission(), AIRFIGHT_ProjectileHits(), B_RemoveAircraftExceedingCapacity(), BS_SellAircraft_f(), CL_EquipSoldierState(), E_IsAwayFromBase(), MAP_DrawMap(), and TR_AircraftListSelect().
qboolean AIR_IsAircraftOnGeoscape | ( | const aircraft_t * | aircraft | ) |
Checks whether given aircraft is on geoscape.
[in] | aircraft | Pointer to an aircraft. |
Definition at line 488 of file cp_aircraft.c.
References AIR_CRASHED, AIR_DROP, AIR_HOME, AIR_IDLE, AIR_INTERCEPT, AIR_MISSION, AIR_NONE, AIR_REFUEL, AIR_RETURNING, AIR_TRANSFER, AIR_TRANSIT, AIR_UFO, Com_Error(), ERR_FATAL, qfalse, qtrue, and aircraft_s::status.
Referenced by AB_UpdateStealthForAllBase(), AIR_AircraftReturnToBase(), AIR_DeleteAircraft(), B_MoveAircraftOnGeoscapeToOtherBases(), B_RemoveAircraftExceedingCapacity(), CL_CampaignRunAircraft(), MAP_DrawMapMarkers(), MAP_GetGeoscapeAngle(), MAP_MapClick(), RADAR_AddDetectedUFOToEveryRadar(), RADAR_UpdateWholeRadarOverlay(), UFO_CampaignCheckEvents(), UFO_CheckShootBack(), and UFO_SearchAircraftTarget().
const aircraft_t* AIR_IsEmployeeInAircraft | ( | const struct employee_s * | employee, | |
const aircraft_t * | aircraft | |||
) |
qboolean AIR_IsInAircraftTeam | ( | const aircraft_t * | aircraft, | |
const struct employee_s * | employee | |||
) |
qboolean AIR_MoveAircraftIntoNewHomebase | ( | aircraft_t * | aircraft, | |
base_t * | base | |||
) |
Moves a given aircraft to a new base (also the employees and inventory).
[in] | aircraft | The aircraft to move into a new base |
[in] | base | The base to move the aircraft into |
Definition at line 934 of file cp_aircraft.c.
References aircraft_s::acTeam, AIR_Add(), AIR_AircraftReturnToBase(), AIR_CheckMoveIntoNewHomebase(), AIR_Delete(), AIR_GetCapacityByAircraftWeight(), AIR_GetNextFromBase(), AIR_HOME, AIR_RETURNING, AIR_TRANSFER, AIR_TransferItemsCarriedByCharacterToBase(), aircraftSlot_s::aircraft, base_s::aircraftCurrent, base_s::capacities, employee_s::chr, Com_DPrintf(), cap_maxcur_s::cur, linkedList_s::data, DEBUG_CLIENT, E_MoveIntoNewBase(), aircraft_s::electronics, aircraft_s::homebase, i, aircraft_s::id, MAP_SelectAircraft(), aircraft_s::maxElectronics, aircraft_s::maxWeapons, base_s::name, linkedList_s::next, aircraft_s::pilot, aircraft_s::pos, base_s::pos, qfalse, qtrue, aircraft_s::shield, aircraft_s::status, VectorCopy, and aircraft_s::weapons.
Referenced by B_MoveAircraftOnGeoscapeToOtherBases(), CL_PopupChangeHomebase_f(), and TR_EmptyTransferCargo().
void AIR_MoveEmployeeInventoryIntoStorage | ( | const aircraft_t * | aircraft, | |
equipDef_t * | ed | |||
) |
Move all the equipment carried by the team on the aircraft into the given equipment.
[in] | aircraft | The craft with the team (and thus equipment) onboard. |
[out] | ed | The equipment definition which will receive all the stuff from the aircraft-team. |
Definition at line 3126 of file cp_aircraft.c.
References item_s::a, aircraft_s::acTeam, AIR_GetTeamSize(), objDef_s::ammo, employee_s::chr, Com_DPrintf(), Com_Printf(), CONTAINER, csi, linkedList_s::data, DEBUG_CLIENT, objDef_s::idx, INVDEF, invList_s::item, item_s::m, invList_s::next, next, linkedList_s::next, csi_s::numIDs, equipDef_s::numItems, equipDef_s::numItemsLoose, objDef_s::reload, item_s::t, and type.
Referenced by B_PackInitialEquipment().
void AIR_ParseAircraft | ( | const char * | name, | |
const char ** | text, | |||
qboolean | assignAircraftItems | |||
) |
Parses all aircraft that are defined in our UFO-scripts.
Definition at line 1468 of file cp_aircraft.c.
References AC_ITEM_ELECTRONICS, AC_ITEM_WEAPON, AII_InitialiseAircraftSlots(), AIR_GetAircraft(), AIR_HOME, AIR_POSITIONS_MAX, air_slot_type_strings, AIR_STATS_FUELSIZE, AIR_STATS_SPEED, AIRCRAFT_INTERCEPTOR, AIRCRAFT_LARGE, AIRCRAFT_SMALL, AIRCRAFT_TRANSPORTER, AIRCRAFT_UFO, ccs_s::aircraftTemplates, aircraftSlot_s::ammo, ccs, cl_genericPool, Com_DPrintf(), Com_EParse(), Com_EParseValue(), Com_Error(), Com_Parse(), Com_Printf(), Com_UFOShortNameToID(), DEBUG_CLIENT, aircraft_s::electronics, ERR_DROP, f, FS_SkipBlock(), i, aircraft_s::id, int(), INVSH_GetItemByID(), aircraftSlot_s::item, ITEM_HEAVY, ITEM_LIGHT, ITEM_MEDIUM, MAX_ACITEMS, MAX_AIRCRAFT, aircraft_s::maxElectronics, aircraft_s::maxWeapons, Mem_PoolStrDup, Mem_PoolStrDupTo, MEMBER_SIZEOF, aircraft_s::name, ccs_s::numAircraftTemplates, value_s::ofs, aircraftSlot_s::pos, technology_s::provides, Q_strncpyz(), aircraft_s::radar, RADAR_InitialiseUFOs(), RS_GetTechByID(), SECONDS_PER_HOUR, aircraft_s::shield, aircraft_s::size, value_s::size, aircraftSlot_s::size, aircraft_s::stats, aircraft_s::status, value_s::string, Sys_Error(), aircraft_s::tpl, value_s::type, aircraft_s::type, UFO_MAX, aircraft_s::ufotype, V_CLIENT_HUNK_STRING, V_INT, V_TRANSLATION_STRING, and aircraft_s::weapons.
Referenced by CL_ParseScriptFirst(), and CL_ParseScriptSecond().
qboolean AIR_RemoveEmployee | ( | employee_t * | employee, | |
aircraft_t * | aircraft | |||
) |
Removes a soldier from an aircraft.
[in,out] | employee | The soldier to be removed from the aircraft. |
[in,out] | aircraft | The aircraft to remove the soldier from. Use NULL to remove the soldier from any aircraft. |
Definition at line 3012 of file cp_aircraft.c.
References AIR_GetNextFromBase(), AIR_IsEmployeeInAircraft(), AIR_RemoveFromAircraftTeam(), B_GetFoundedBaseByIDX(), ccs, employee_s::chr, cls, Com_DPrintf(), DEBUG_CLIENT, inventoryInterface_s::DestroyInventory, aircraft_s::homebase, character_s::i, client_static_s::i, aircraft_s::idx, base_s::idx, ccs_s::numBases, and qfalse.
Referenced by AIM_AddEmployeeFromMenu(), AIR_RemoveEmployees(), CP_SpawnRescueMission(), and E_RemoveEmployeeFromBuildingOrAircraft().
void AIR_RemoveEmployees | ( | aircraft_t * | aircraft | ) |
Removes all soldiers from an aircraft.
[in,out] | aircraft | The aircraft to remove the soldiers from. |
Definition at line 3099 of file cp_aircraft.c.
References aircraft_s::acTeam, AIR_GetTeamSize(), AIR_RemoveEmployee(), Com_Error(), linkedList_s::data, ERR_DROP, linkedList_s::next, and aircraft_s::pilot.
Referenced by AIR_DeleteAircraft(), and TR_TransferStart().
qboolean AIR_RemoveFromAircraftTeam | ( | aircraft_t * | aircraft, | |
const struct employee_s * | employee | |||
) |
void AIR_RemovePilotFromAssignedAircraft | ( | struct base_s * | base, | |
const struct employee_s * | pilot | |||
) |
void AIR_ResetAircraftTeam | ( | aircraft_t * | aircraft | ) |
Resets team in given aircraft.
[in] | aircraft | Pointer to an aircraft, where the team will be reset. |
Definition at line 2169 of file cp_aircraft.c.
References aircraft_s::acTeam, and LIST_Delete().
Referenced by AIR_NewAircraft().
qboolean AIR_ScriptSanityCheck | ( | void | ) |
Checks the parsed aircraft for errors.
Definition at line 2933 of file cp_aircraft.c.
References AII_GetItemWeightBySize(), AIRCRAFT_UFO, ccs_s::aircraftTemplates, ccs, Com_Printf(), aircraft_s::defaultName, aircraft_s::electronics, error(), objDef_s::id, aircraft_s::id, aircraftSlot_s::item, aircraft_s::maxElectronics, aircraft_s::maxWeapons, aircraft_s::name, ccs_s::numAircraftTemplates, aircraftSlot_s::pos, aircraftSlot_s::size, aircraft_s::type, and aircraft_s::weapons.
qboolean AIR_SendAircraftPursuingUFO | ( | aircraft_t * | aircraft, | |
aircraft_t * | ufo | |||
) |
Make the specified aircraft purchasing a UFO.
[in] | aircraft | Pointer to an aircraft which will hunt for a UFO. |
[in] | ufo | Pointer to a UFO. |
Definition at line 2125 of file cp_aircraft.c.
References _, AII_ReloadAircraftWeapons(), AIR_AircraftHasEnoughFuel(), AIR_AircraftReturnToBase(), AIR_GetDestinationWhilePursuing(), AIR_IsAircraftInBase(), AIR_UFO, aircraft_s::aircraftTarget, ccs, Com_DPrintf(), DEBUG_CLIENT, dest, aircraft_s::homebase, MAP_MapCalcLine(), MS_AddNewMessage(), MSG_STANDARD, base_s::name, aircraft_s::name, ccs_s::numUFOs, aircraft_s::point, aircraft_s::pos, qfalse, qtrue, aircraft_s::route, aircraft_s::status, aircraft_s::time, ccs_s::ufos, va(), and Vector2Copy.
Referenced by AIRFIGHT_ExecuteActions(), and CL_PopupInterceptClick_f().
qboolean AIR_SendAircraftToMission | ( | aircraft_t * | aircraft, | |
mission_t * | mission | |||
) |
Sends the specified aircraft to specified mission.
[in] | aircraft | Pointer to aircraft to send to mission. |
[in] | mission | Pointer to given mission. |
Definition at line 1350 of file cp_aircraft.c.
void AIR_UpdateHangarCapForAll | ( | base_t * | base | ) |
Updates current capacities for hangars in given base.
[in,out] | base | The base we want to update. |
Definition at line 135 of file cp_aircraft.c.
References AIR_GetNextFromBase(), AIR_UpdateHangarCapForOne(), CAP_AIRCRAFT_BIG, CAP_AIRCRAFT_SMALL, base_s::capacities, Com_DPrintf(), cap_maxcur_s::cur, DEBUG_CLIENT, aircraft_s::id, base_s::name, and aircraft_s::tpl.
Referenced by AIR_DeleteAircraft(), B_ResetAllStatusAndCapacities(), and CP_SpawnRescueMission().
int int CL_AircraftMenuStatsValues | ( | const int | value, | |
const int | stat | |||
) |
Some of the aircraft values needs special calculations when they are shown in the menus.
Definition at line 549 of file cp_aircraft.c.
References AIR_STATS_FUELSIZE, AIR_STATS_MAXSPEED, AIR_STATS_SPEED, f, and int().
Referenced by AIR_AircraftSelect(), MAP_GetAircraftText(), MAP_GetUFOText(), UP_AircraftDescription(), and UP_AircraftItemDescription().
void CL_CampaignRunAircraft | ( | int | dt, | |
qboolean | updateRadarOverlay | |||
) |
Handles aircraft movement and actions in geoscape mode.
[in] | dt | time delta (may be 0 if radar overlay should be updated but no aircraft moves) |
[in] | updateRadarOverlay | True if radar overlay should be updated (not needed if geoscape isn't updated) |
Definition at line 1250 of file cp_aircraft.c.
References _, AII_ReloadWeapon(), AIR_AircraftHasEnoughFuel(), AIR_AircraftReturnToBase(), AIR_GetNextFromBase(), AIR_IDLE, AIR_IsAircraftOnGeoscape(), AIR_Move(), AIR_Refuel(), AIR_REFUEL, AIR_RETURNING, AIR_UFO, aircraft_s::aircraftTarget, AIRFIGHT_ExecuteActions(), aircraftSlot_s::ammoLeft, B_GetBaseByIDX(), aircraftSlot_s::delayNextShot, aircraft_s::fuel, aircraft_s::homebase, MAP_IsRadarOverlayActivated(), aircraft_s::maxWeapons, MS_AddNewMessage(), MSG_STANDARD, aircraft_s::name, aircraft_s::pos, qfalse, qtrue, RADAR_UpdateWholeRadarOverlay(), aircraft_s::status, va(), and aircraft_s::weapons.
Referenced by CL_CampaignFunctionPeriodicCall().