cp_airfight.h File Reference

Header file for airfights. More...

This graph shows which files directly or indirectly include this file:

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)

Detailed Description

Header file for airfights.

Definition in file cp_airfight.h.


Define Documentation

#define AIRFIGHT_BASE_CAN_T_FIRE   -1

Definition at line 41 of file cp_airfight.h.

#define AIRFIGHT_WEAPON_CAN_NEVER_SHOOT   -2
#define AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT   -1
#define AIRFIGHT_WEAPON_CAN_SHOOT   0
Note:
0 if the weapon can shoot
-1 if it can't shoot atm
-2 if it will never be able to shoot

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 Documentation

projectile used during fight between two or more aircraft


Function Documentation

void AIRFIGHT_ActionsAfterAirfight ( aircraft_t shooter,
aircraft_t aircraft,
qboolean  phalanxWon 
)

Actions to execute when a fight is done.

Parameters:
[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.
Note:
Some of these mission values are redone (and not reloaded) in CP_Load
shooter may be NULL
See also:
UFO_DestroyAllUFOsOnGeoscape_f
CP_Load
CP_SpawnCrashSiteMission

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  ) 
void AIRFIGHT_CampaignRunProjectiles ( int  dt  ) 
int AIRFIGHT_CheckWeapon ( const aircraftSlot_t slot,
float  distance 
)

Check if the selected weapon can shoot.

Parameters:
[in] slot Pointer to the weapon slot to shoot with.
[in] distance distance between the weapon and the target.
Returns:
0 AIRFIGHT_WEAPON_CAN_SHOOT if the weapon can shoot, -1 AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT if it can't shoot atm, -2 AIRFIGHT_WEAPON_CAN_NEVER_SHOOT if it will never be able to shoot.

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.

Parameters:
[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.
Returns:
indice of the slot to use (in array weapons[]), -1 AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT no weapon to use atm, -2 AIRFIGHT_WEAPON_CAN_NEVER_SHOOT if no weapon to use at all.
See also:
AIRFIGHT_CheckWeapon

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 
)
void AIRFIGHT_InitStartup ( void   ) 
See also:
UI_InitStartup

Definition at line 923 of file cp_airfight.c.

References Cmd_AddCommand().

Referenced by CP_InitStartup().

qboolean AIRFIGHT_LoadXML ( mxml_node_t parent  ) 
qboolean AIRFIGHT_SaveXML ( mxml_node_t parent  ) 

Generated by  doxygen 1.6.2