Header file for airfights. More...
Go to the source code of this file.
Data Structures | |
struct | aircraftProjectile_s |
projectile used during fight between two or more aircraft More... | |
Defines | |
#define | BULLETS_PER_SHOT 1 |
#define | MAX_MULTIPLE_PROJECTILES 10 |
#define | AIRFIGHT_WEAPON_CAN_SHOOT 0 |
#define | AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT -1 |
#define | AIRFIGHT_WEAPON_CAN_NEVER_SHOOT -2 |
#define | AIRFIGHT_BASE_CAN_T_FIRE -1 |
Typedefs | |
typedef struct aircraftProjectile_s | aircraftProjectile_t |
projectile used during fight between two or more aircraft | |
Functions | |
void | AIRFIGHT_ExecuteActions (aircraft_t *air, aircraft_t *ufo) |
Decide what an attacking aircraft can do. | |
void | AIRFIGHT_ActionsAfterAirfight (aircraft_t *shooter, aircraft_t *aircraft, qboolean phalanxWon) |
Actions to execute when a fight is done. | |
void | AIRFIGHT_CampaignRunProjectiles (int dt) |
Update values of projectiles. | |
void | AIRFIGHT_CampaignRunBaseDefence (int dt) |
Run base defences. | |
int | AIRFIGHT_CheckWeapon (const aircraftSlot_t *slot, float distance) |
Check if the selected weapon can shoot. | |
int | AIRFIGHT_ChooseWeapon (const aircraftSlot_t const *slot, int maxSlot, const vec3_t pos, const vec3_t targetPos) |
Choose the weapon an attacking aircraft will use to fire on a target. | |
qboolean | AIRFIGHT_BaseCanTargetUFO (const struct base_s *base, const aircraft_t *ufo) |
qboolean | AIRFIGHT_SaveXML (mxml_node_t *parent) |
Save callback for savegames in XML Format. | |
qboolean | AIRFIGHT_LoadXML (mxml_node_t *parent) |
Load callback for savegames in XML Format. | |
void | AIRFIGHT_InitStartup (void) |
Header file for airfights.
Definition in file cp_airfight.h.
#define AIRFIGHT_BASE_CAN_T_FIRE -1 |
Definition at line 41 of file cp_airfight.h.
#define AIRFIGHT_WEAPON_CAN_NEVER_SHOOT -2 |
Definition at line 39 of file cp_airfight.h.
Referenced by AII_WeaponsCanShoot(), AIRFIGHT_BaseShoot(), AIRFIGHT_CheckWeapon(), AIRFIGHT_ChooseWeapon(), AIRFIGHT_InstallationShoot(), BDEF_AutoTarget(), CL_DisplayPopupInterceptUFO(), CP_InterceptNextStage(), CP_UFOProceedMission(), and UFO_SendPursuingAircraft().
#define AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT -1 |
Definition at line 38 of file cp_airfight.h.
Referenced by AIRFIGHT_BaseShoot(), AIRFIGHT_CheckWeapon(), AIRFIGHT_ChooseWeapon(), AIRFIGHT_ExecuteActions(), AIRFIGHT_InstallationShoot(), and BDEF_AutoTarget().
#define AIRFIGHT_WEAPON_CAN_SHOOT 0 |
Definition at line 37 of file cp_airfight.h.
Referenced by AIRFIGHT_CheckWeapon(), AIRFIGHT_ChooseWeapon(), and AIRFIGHT_ExecuteActions().
#define BULLETS_PER_SHOT 1 |
Definition at line 29 of file cp_airfight.h.
#define MAX_MULTIPLE_PROJECTILES 10 |
Definition at line 30 of file cp_airfight.h.
Referenced by AIRFIGHT_LoadXML().
typedef struct aircraftProjectile_s aircraftProjectile_t |
projectile used during fight between two or more aircraft
void AIRFIGHT_ActionsAfterAirfight | ( | aircraft_t * | shooter, | |
aircraft_t * | aircraft, | |||
qboolean | phalanxWon | |||
) |
Actions to execute when a fight is done.
[in] | shooter | Pointer to the aircraft that fired the projectile. |
[in] | aircraft | Pointer to the aircraft which was destroyed (alien or phalanx). |
[in] | phalanxWon | qtrue if PHALANX won, qfalse if UFO won. |
Definition at line 409 of file cp_airfight.c.
References _, AIR_DestroyAircraft(), AIRFIGHT_RemoveProjectileAimingAircraft(), AIRFIGHT_UpdateProjectileForDestroyedAircraft(), byte, Com_DPrintf(), CP_MissionIsOverByUFO(), CP_SpawnCrashSiteMission(), CP_SpawnRescueMission(), CP_UFOProceedMission(), DEBUG_CLIENT, MAP_GetColor(), MAP_GetTerrainType(), MapIsWater, MAPTYPE_TERRAIN, MS_AddNewMessage(), MSG_DEATH, MSG_STANDARD, aircraft_s::pos, qfalse, and UFO_NotifyPhalanxAircraftRemoved().
Referenced by AIRFIGHT_ProjectileHits().
qboolean AIRFIGHT_BaseCanTargetUFO | ( | const struct base_s * | base, | |
const aircraft_t * | ufo | |||
) |
void AIRFIGHT_CampaignRunBaseDefence | ( | int | dt | ) |
Run base defences.
[in] | dt | Time elapsed since last call of this function. |
Definition at line 751 of file cp_airfight.c.
References AII_BaseCanShoot(), AII_InstallationCanShoot(), AII_ReloadWeapon(), AIRFIGHT_BaseShoot(), AIRFIGHT_InstallationShoot(), aircraftSlot_s::ammoLeft, B_DEFENCE_LASER, B_DEFENCE_MISSILE, B_GetBuildingStatus(), B_GetFoundedBaseByIDX(), BASE_UNDER_ATTACK, base_s::baseStatus, installation_s::batteries, base_s::batteries, aircraftSlot_s::delayNextShot, INS_GetFoundedInstallationByIDX(), installation_s::installationTemplate, base_s::lasers, MAX_BASES, MAX_INSTALLATIONS, installationTemplate_s::maxBatteries, base_s::numBatteries, base_s::numLasers, and baseWeapon_s::slot.
Referenced by CL_CampaignFunctionPeriodicCall().
void AIRFIGHT_CampaignRunProjectiles | ( | int | dt | ) |
Update values of projectiles.
[in] | dt | Time elapsed since last call of this function. |
Definition at line 592 of file cp_airfight.c.
References aircraftProjectile_s::aimedAircraft, aircraftProjectile_s::aircraftItem, AIRFIGHT_GetNextPointInPath(), AIRFIGHT_ProjectileHits(), AIRFIGHT_ProjectileReachedTarget(), AIRFIGHT_RemoveProjectile(), aircraftProjectile_s::angle, ccs, objDef_s::craftitem, aircraftProjectile_s::hasMoved, aircraftProjectile_s::idleTarget, aircraftProjectile_s::numInterpolationPoints, ccs_s::numProjectiles, aircraft_s::pos, aircraftProjectile_s::pos, aircraftProjectile_s::projectedPos, ccs_s::projectiles, qtrue, SECONDS_PER_HOUR, aircraftProjectile_s::time, VectorCopy, and craftitem_s::weaponSpeed.
Referenced by CL_CampaignFunctionPeriodicCall().
int AIRFIGHT_CheckWeapon | ( | const aircraftSlot_t * | slot, | |
float | distance | |||
) |
Check if the selected weapon can shoot.
[in] | slot | Pointer to the weapon slot to shoot with. |
[in] | distance | distance between the weapon and the target. |
Definition at line 194 of file cp_airfight.c.
References AIR_STATS_WRANGE, AIRFIGHT_WEAPON_CAN_NEVER_SHOOT, AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT, AIRFIGHT_WEAPON_CAN_SHOOT, aircraftSlot_s::ammo, aircraftSlot_s::ammoLeft, objDef_s::craftitem, aircraftSlot_s::delayNextShot, aircraftSlot_s::installationTime, aircraftSlot_s::item, and craftitem_s::stats.
Referenced by AII_WeaponsCanShoot(), AIRFIGHT_BaseShoot(), AIRFIGHT_ChooseWeapon(), AIRFIGHT_InstallationShoot(), and BDEF_AutoTarget().
int AIRFIGHT_ChooseWeapon | ( | const aircraftSlot_t const * | slot, | |
int | maxSlot, | |||
const vec3_t | pos, | |||
const vec3_t | targetPos | |||
) |
Choose the weapon an attacking aircraft will use to fire on a target.
[in] | slot | Pointer to the first weapon slot of attacking base or aircraft. |
[in] | maxSlot | maximum number of weapon slots in attacking base or aircraft. |
[in] | pos | position of attacking base or aircraft. |
[in] | targetPos | Pointer to the aimed aircraft. |
Definition at line 228 of file cp_airfight.c.
References AIRFIGHT_CheckWeapon(), AIRFIGHT_WEAPON_CAN_NEVER_SHOOT, AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT, AIRFIGHT_WEAPON_CAN_SHOOT, and GetDistanceOnGlobe().
Referenced by AIRFIGHT_ExecuteActions(), CL_DisplayPopupInterceptUFO(), CP_InterceptNextStage(), CP_UFOProceedMission(), and UFO_SendPursuingAircraft().
void AIRFIGHT_ExecuteActions | ( | aircraft_t * | shooter, | |
aircraft_t * | target | |||
) |
Decide what an attacking aircraft can do.
[in] | shooter | The aircraft we attack with. |
[in] | target | The ufo we are going to attack. |
Definition at line 304 of file cp_airfight.c.
References _, AIR_AircraftReturnToBase(), AIR_SendAircraftPursuingUFO(), AIRCRAFT_UFO, aircraft_s::aircraftTarget, AIRFIGHT_AddProjectile(), AIRFIGHT_ChooseWeapon(), AIRFIGHT_MissTarget(), AIRFIGHT_ProbabilityToHit(), AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT, AIRFIGHT_WEAPON_CAN_SHOOT, aircraftSlot_s::ammo, ccs, CP_UFOProceedMission(), objDef_s::craftitem, aircraftSlot_s::delayNextShot, aircraft_s::detected, frand(), aircraft_s::maxWeapons, MS_AddNewMessage(), MSG_STANDARD, MSO_CheckAddNewMessage(), aircraft_s::name, NT_UFO_ATTACKING, ccs_s::numProjectiles, aircraft_s::pos, ccs_s::projectiles, qfalse, RADAR_AddDetectedUFOToEveryRadar(), RADAR_CheckRadarSensored(), aircraft_s::type, UFO_CheckShootBack(), UFO_DetectNewUFO(), UFO_SendPursuingAircraft(), va(), craftitem_s::weaponDelay, and aircraft_s::weapons.
Referenced by CL_CampaignRunAircraft(), UFO_CheckShootBack(), and UFO_SearchAircraftTarget().
void AIRFIGHT_InitStartup | ( | void | ) |
Definition at line 923 of file cp_airfight.c.
References Cmd_AddCommand().
Referenced by CP_InitStartup().
qboolean AIRFIGHT_LoadXML | ( | mxml_node_t * | parent | ) |
Load callback for savegames in XML Format.
[in] | parent | XML Node structure, where we get the information from |
Definition at line 866 of file cp_airfight.c.
References aircraftProjectile_s::aimedAircraft, AIR_AircraftGetFromIDX(), AIRCRAFT_INVALID, aircraftProjectile_s::aircraftItem, aircraftProjectile_s::angle, aircraftProjectile_s::attackingAircraft, aircraftProjectile_s::beam, aircraftProjectile_s::bullets, ccs, Com_Printf(), aircraftProjectile_s::idleTarget, INVSH_GetItemByID(), MAX_MULTIPLE_PROJECTILES, MAX_PROJECTILESONGEOSCAPE, mxml_GetBool(), mxml_GetFloat(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNextPos2(), mxml_GetNode(), mxml_GetPos2(), mxml_GetPos3(), mxml_GetString(), ccs_s::numProjectiles, aircraftProjectile_s::numProjectiles, aircraftProjectile_s::pos, ccs_s::projectiles, technology_s::provides, qfalse, qtrue, RS_GetTechByProvided(), SAVE_AIRFIGHT_AIMEDAIRCRAFT, SAVE_AIRFIGHT_AIRCRAFTIDX, SAVE_AIRFIGHT_ANGLE, SAVE_AIRFIGHT_ATTACKINGAIRCRAFT, SAVE_AIRFIGHT_BEAM, SAVE_AIRFIGHT_BULLET, SAVE_AIRFIGHT_IDLETARGET, SAVE_AIRFIGHT_ISUFO, SAVE_AIRFIGHT_ITEMID, SAVE_AIRFIGHT_POS, SAVE_AIRFIGHT_PROJECTILE, SAVE_AIRFIGHT_TIME, aircraftProjectile_s::time, and ccs_s::ufos.
Referenced by AIR_LoadXML().
qboolean AIRFIGHT_SaveXML | ( | mxml_node_t * | parent | ) |
Save callback for savegames in XML Format.
[out] | parent | XML Node structure, where we write the information to |
Definition at line 819 of file cp_airfight.c.
References aircraftProjectile_s::aimedAircraft, AIRCRAFT_UFO, aircraftProjectile_s::aircraftItem, aircraftProjectile_s::angle, aircraftProjectile_s::attackingAircraft, aircraftProjectile_s::beam, aircraftProjectile_s::bullets, ccs, objDef_s::id, aircraftProjectile_s::idleTarget, aircraft_s::idx, mxml_AddBoolValue(), mxml_AddFloat(), mxml_AddInt(), mxml_AddNode(), mxml_AddPos2(), mxml_AddPos3(), mxml_AddString(), aircraftProjectile_s::numProjectiles, ccs_s::numProjectiles, aircraftProjectile_s::pos, ccs_s::projectiles, qtrue, SAVE_AIRFIGHT_AIMEDAIRCRAFT, SAVE_AIRFIGHT_AIRCRAFTIDX, SAVE_AIRFIGHT_ANGLE, SAVE_AIRFIGHT_ATTACKINGAIRCRAFT, SAVE_AIRFIGHT_BEAM, SAVE_AIRFIGHT_BULLET, SAVE_AIRFIGHT_IDLETARGET, SAVE_AIRFIGHT_ISUFO, SAVE_AIRFIGHT_ITEMID, SAVE_AIRFIGHT_POS, SAVE_AIRFIGHT_PROJECTILE, SAVE_AIRFIGHT_TIME, aircraftProjectile_s::time, aircraft_s::type, and ccs_s::ufos.
Referenced by AIR_SaveXML().