naev 0.11.5
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 0
12/* Freedom. */
13void pilot_weapSetFree( Pilot* p );
14
15/* Shooting. */
17int pilot_shoot( Pilot* p, int level );
18void pilot_shootStop( Pilot* p, int level );
19int pilot_shootWeapon( Pilot *p, PilotOutfitSlot *w, const Target *target, double time, int aim );
20void pilot_stopBeam( const Pilot *p, PilotOutfitSlot *w );
21void pilot_getRateMod( double *rate_mod, double* energy_mod,
22 const Pilot* p, const Outfit* o );
23double pilot_weapFlyTime( const Outfit *o, const Pilot *parent,
24 const vec2 *pos, const vec2 *vel);
25
26/* Updating. */
29void pilot_weapSetPress( Pilot* p, int id, int type );
30void pilot_weapSetUpdate( Pilot* p );
31
32/* Weapon Set. */
34const char *pilot_weapSetName( Pilot* p, int id );
35const char *pilot_weapSetTypeName( WeaponSetType t );
36void pilot_weapSetAdd( Pilot* p, int id, const PilotOutfitSlot *o, int level );
37void pilot_weapSetRm( Pilot* p, int id, const PilotOutfitSlot *o );
38void pilot_weapSetClear( Pilot* p, int id );
39int pilot_weapSetInSet( Pilot* p, int id, const PilotOutfitSlot *o );
40int pilot_weapSetCheck( Pilot* p, int id, const PilotOutfitSlot *o );
41double pilot_weapSetRange( Pilot* p, int id, int level );
42double pilot_weapSetSpeed( Pilot* p, int id, int level );
43double pilot_weapSetAmmo( Pilot *p, int id, int level );
44void pilot_weapSetCleanup( Pilot* p, int id );
46void pilot_weapSetCopy( PilotWeaponSet *dest, const PilotWeaponSet *src );
47
48/* Properties. */
49int pilot_weapSetTypeCheck( Pilot* p, int id );
50void pilot_weapSetType( Pilot* p, int id, WeaponSetType type );
51int pilot_weapSetInrangeCheck( Pilot* p, int id );
52void pilot_weapSetInrange( Pilot* p, int id, int inrange );
53int pilot_weapSetManualCheck( Pilot *p, int id );
54void pilot_weapSetManual( Pilot* p, int id, int manual );
55int pilot_weapSetVolleyCheck( Pilot *p, int id );
56void pilot_weapSetVolley( Pilot* p, int id, int volley );
57
58/* High level. */
59void pilot_weaponClear( Pilot *p );
60void pilot_weaponAuto( Pilot *p );
62void pilot_weaponSafe( Pilot *p );
63void pilot_afterburn ( Pilot *p );
64void pilot_afterburnOver ( Pilot *p );
68
69/* Weaponset stuff. */
70void ws_copy( PilotWeaponSet dest[PILOT_WEAPON_SETS], const PilotWeaponSet src[PILOT_WEAPON_SETS] );
71void ws_free( PilotWeaponSet ws[PILOT_WEAPON_SETS] );
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.
void pilot_weaponSafe(Pilot *p)
Sets the weapon set as safe.
int pilot_shoot(Pilot *p, int level)
Makes the pilot shoot.
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_shootStop(Pilot *p, int level)
Have pilot stop shooting their weapon.
void pilot_afterburn(Pilot *p)
Activate the afterburner.
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.
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.
void pilot_weaponSetDefault(Pilot *p)
Gives the pilot a default 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 *o)
Enable a given active outfit.
double pilot_weapSetAmmo(Pilot *p, int id, int level)
Gets the ammo 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.
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_weapSetPress(Pilot *p, int id, int type)
Handles a weapon set press.
void pilot_weapSetFree(Pilot *p)
Frees a pilot's weapon sets.
const char * pilot_weapSetName(Pilot *p, int id)
Gets the name of a weapon set.
double pilot_weapSetSpeed(Pilot *p, int id, int level)
Gets the speed of the current pilot weapon set.
int pilot_outfitOff(Pilot *p, PilotOutfitSlot *o)
Disables a given active outfit.
void pilot_weapSetType(Pilot *p, int id, WeaponSetType type)
Changes the weapon sets mode.
double pilot_weapSetRange(Pilot *p, int id, int level)
Gets the range of the current pilot weapon set.
void pilot_weapSetUpdateStats(Pilot *p)
Update the weapon sets given pilot stat changes.
void pilot_weapSetAdd(Pilot *p, int id, const PilotOutfitSlot *o, int level)
Adds an outfit to a weapon set.
A ship outfit, depends radically on the type.
Definition outfit.h:328
Stores an outfit the pilot has.
Definition pilot.h:108
A pilot Weapon Set Outfit.
Definition pilot.h:146
A weapon set represents a set of weapons that have an action.
Definition pilot.h:164
The representation of an in-game pilot.
Definition pilot.h:217
Represents a weapon target.
Definition target.h:19
Represents a 2d vector.
Definition vec2.h:32