naev 0.12.6
pilot_weapon.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "pilot.h"
7
8#include "target.h"
9
10#define WEAPSET_INRANGE_PLAYER_DEF \
11 0
12
13/* Freedom. */
14void pilot_weapSetFree( Pilot *p );
15
16/* Shooting. */
18int pilot_shootWeapon( Pilot *p, PilotOutfitSlot *w, const Target *target,
19 double time, int aim );
20void pilot_stopBeam( const Pilot *p, PilotOutfitSlot *w );
21void pilot_getRateMod( double *rate_mod, double *energy_mod, const Pilot *p,
22 const Outfit *o );
23double pilot_weapFlyTime( const Outfit *o, const Pilot *parent, const vec2 *pos,
24 const vec2 *vel );
25
26/* Updating. */
30int pilot_weapSetPress( Pilot *p, int id, int type );
31void pilot_weapSetUpdate( Pilot *p );
32
33/* Weapon Set. */
35const char *pilot_weapSetName( Pilot *p, int id );
36const char *pilot_weapSetTypeName( WeaponSetType t );
37void pilot_weapSetAdd( Pilot *p, int id, const PilotOutfitSlot *o );
38void pilot_weapSetRm( Pilot *p, int id, const PilotOutfitSlot *o );
39void pilot_weapSetClear( Pilot *p, int id );
40int pilot_weapSetInSet( Pilot *p, int id, const PilotOutfitSlot *o );
41int pilot_weapSetCheck( Pilot *p, int id, const PilotOutfitSlot *o );
42double pilot_weapSetRangeMin( Pilot *p, int id );
43double pilot_weapSetRange( Pilot *p, int id );
44double pilot_weapSetSpeed( Pilot *p, int id );
45double pilot_weapSetAmmo( Pilot *p, int id );
46void pilot_weapSetCleanup( Pilot *p, int id );
48void pilot_weapSetCopy( PilotWeaponSet *dest, const PilotWeaponSet *src );
49
50/* Properties. */
51int pilot_weapSetTypeCheck( Pilot *p, int id );
52void pilot_weapSetType( Pilot *p, int id, WeaponSetType type );
53int pilot_weapSetInrangeCheck( Pilot *p, int id );
54void pilot_weapSetInrange( Pilot *p, int id, int inrange );
55int pilot_weapSetManualCheck( Pilot *p, int id );
56void pilot_weapSetManual( Pilot *p, int id, int manual );
57int pilot_weapSetVolleyCheck( Pilot *p, int id );
58void pilot_weapSetVolley( Pilot *p, int id, int volley );
59
60/* High level. */
61void pilot_weaponClear( Pilot *p );
62void pilot_weaponAuto( Pilot *p );
63void pilot_weaponSafe( Pilot *p );
64int pilot_afterburn( Pilot *p );
65void pilot_afterburnOver( Pilot *p );
66int pilot_outfitOff( Pilot *p, PilotOutfitSlot *o, int natural );
70
71/* Weaponset stuff. */
72void ws_copy( PilotWeaponSet dest[PILOT_WEAPON_SETS],
73 const PilotWeaponSet src[PILOT_WEAPON_SETS] );
74void ws_free( PilotWeaponSet ws[PILOT_WEAPON_SETS] );
void pilot_weapSetAdd(Pilot *p, int id, const PilotOutfitSlot *o)
Adds an outfit to a weapon set.
int pilot_weapSetTypeCheck(Pilot *p, int id)
Checks the current weapon set type.
void pilot_getRateMod(double *rate_mod, double *energy_mod, const Pilot *p, const Outfit *o)
Gets applicable fire rate and energy modifications for a pilot's weapon.
void pilot_weapSetInrange(Pilot *p, int id, int inrange)
Changes the weapon set inrange property.
int pilot_afterburn(Pilot *p)
Activate the afterburner.
void pilot_weaponSafe(Pilot *p)
Sets the weapon set as safe.
void pilot_weapSetManual(Pilot *p, int id, int manual)
Changes the weapon set manual property.
void pilot_afterburnOver(Pilot *p)
Deactivates the afterburner.
void pilot_weapSetCleanup(Pilot *p, int id)
Cleans up a weapon set.
void pilot_weapSetVolley(Pilot *p, int id, int volley)
Changes the weapon set volley property.
int pilot_weapSetManualCheck(Pilot *p, int id)
Checks the current weapon set manual property.
void pilot_stopBeam(const Pilot *p, PilotOutfitSlot *w)
Stops a beam outfit and sets delay as appropriate.
void pilot_weapSetRm(Pilot *p, int id, const PilotOutfitSlot *o)
Removes a slot from a weapon set.
void pilot_weaponClear(Pilot *p)
Clears the pilots weapon settings.
void ws_copy(PilotWeaponSet dest[PILOT_WEAPON_SETS], const PilotWeaponSet src[PILOT_WEAPON_SETS])
Copies a weapon set over.
void ws_free(PilotWeaponSet ws[PILOT_WEAPON_SETS])
Frees a weapon set.
double pilot_weapSetRangeMin(Pilot *p, int id)
Gets the minimum range of the current pilot weapon set.
int pilot_weapSetVolleyCheck(Pilot *p, int id)
Checks the current weapon set volley property.
double pilot_weapFlyTime(const Outfit *o, const Pilot *parent, const vec2 *pos, const vec2 *vel)
Computes an estimation of ammo flying time.
void pilot_weapSetAIClear(Pilot *p)
Useful function for AI, clears activeness of all weapon sets.
PilotWeaponSet * pilot_weapSet(Pilot *p, int id)
Gets a weapon set from id.
Pilot * pilot_weaponTarget(Pilot *p, Target *wt)
Gets the weapon target of a pilot.
void pilot_weapSetUpdate(Pilot *p)
Updates the pilot's weapon sets.
int pilot_weapSetInSet(Pilot *p, int id, const PilotOutfitSlot *o)
Checks to see if a slot is in a weapon set.
int pilot_outfitOffAll(Pilot *p)
Disables all active outfits for a pilot.
double pilot_weapSetSpeed(Pilot *p, int id)
Gets the speed of the current pilot weapon set.
double pilot_weapSetAmmo(Pilot *p, int id)
Gets the ammo of the current pilot weapon set.
int pilot_weapSetCheck(Pilot *p, int id, const PilotOutfitSlot *o)
Checks to see if a slot is in a weapon set and usable.
PilotWeaponSetOutfit * pilot_weapSetList(Pilot *p, int id)
Lists the items in a pilot weapon set.
int pilot_outfitOn(Pilot *p, PilotOutfitSlot *pos)
Enable a given active outfit.
int pilot_outfitOff(Pilot *p, PilotOutfitSlot *o, int natural)
Disables a given active outfit.
void pilot_weapSetUpdateOutfitState(Pilot *p)
Updates the local state of all the pilot's outfits based on the weapon sets.
double pilot_weapSetRange(Pilot *p, int id)
Gets the range of the current pilot weapon set.
int pilot_shootWeapon(Pilot *p, PilotOutfitSlot *w, const Target *target, double time, int aim)
Actually handles the shooting, how often the player.p can shoot and such.
int pilot_outfitOffAllStealth(Pilot *p)
Disables all active outfits for a pilot.
void pilot_weapSetClear(Pilot *p, int id)
Clears a weapon set.
void pilot_weaponAuto(Pilot *p)
Tries to automatically set and create the pilot's weapon set.
int pilot_weapSetInrangeCheck(Pilot *p, int id)
Checks the current weapon set inrange property.
void pilot_weapSetFree(Pilot *p)
Frees a pilot's weapon sets.
int pilot_weapSetPress(Pilot *p, int id, int type)
Handles a weapon set press.
const char * pilot_weapSetName(Pilot *p, int id)
Gets the name of a weapon set.
void pilot_weapSetType(Pilot *p, int id, WeaponSetType type)
Changes the weapon sets mode.
void pilot_weapSetUpdateStats(Pilot *p)
Update the weapon sets given pilot stat changes.
A ship outfit, depends radically on the type.
Definition outfit.h:372
Stores an outfit the pilot has.
Definition pilot.h:145
A pilot Weapon Set Outfit.
Definition pilot.h:187
A weapon set represents a set of weapons that have an action.
Definition pilot.h:207
The representation of an in-game pilot.
Definition pilot.h:263
Represents a weapon target.
Definition target.h:19
Represents a 2d vector.
Definition vec2.h:45