naev 0.10.4
pilot_weapon.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "pilot.h"
7
8#define WEAPSET_INRANGE_PLAYER_DEF 0
10#define WEAPSET_TYPE_CHANGE 0
11#define WEAPSET_TYPE_WEAPON 1
12#define WEAPSET_TYPE_ACTIVE 2
14/* Freedom. */
15void pilot_weapSetFree( Pilot* p );
16
17/* Shooting. */
18int pilot_shoot( Pilot* p, int level );
19void pilot_shootStop( Pilot* p, int level );
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 );
35void pilot_weapSetRmSlot( Pilot *p, int id, OutfitSlotType type );
36void pilot_weapSetAdd( Pilot* p, int id, PilotOutfitSlot *o, int level );
37void pilot_weapSetRm( Pilot* p, int id, PilotOutfitSlot *o );
38int pilot_weapSetCheck( Pilot* p, int id, PilotOutfitSlot *o );
39double pilot_weapSetRange( Pilot* p, int id, int level );
40double pilot_weapSetSpeed( Pilot* p, int id, int level );
41double pilot_weapSetAmmo( Pilot *p, int id, int level );
42void pilot_weapSetCleanup( Pilot* p, int id );
44void pilot_weapSetCopy( PilotWeaponSet *dest, const PilotWeaponSet *src );
45
46/* Properties. */
47int pilot_weapSetTypeCheck( Pilot* p, int id );
48void pilot_weapSetType( Pilot* p, int id, int type );
49int pilot_weapSetInrangeCheck( Pilot* p, int id );
50void pilot_weapSetInrange( Pilot* p, int id, int inrange );
51int pilot_weapSetManualCheck( Pilot *p, int id );
52void pilot_weapSetManual( Pilot* p, int id, int manual );
53
54/* High level. */
55void pilot_weaponClear( Pilot *p );
56void pilot_weaponAuto( Pilot *p );
58void pilot_weaponSafe( Pilot *p );
59void pilot_afterburn ( Pilot *p );
60void pilot_afterburnOver ( Pilot *p );
64
65/* Weaponset stuff. */
66void ws_copy( PilotWeaponSet dest[PILOT_WEAPON_SETS], const PilotWeaponSet src[PILOT_WEAPON_SETS] );
67void ws_free( PilotWeaponSet ws[PILOT_WEAPON_SETS] );
void pilot_stopBeam(Pilot *p, PilotOutfitSlot *w)
Stops a beam outfit and sets delay as appropriate.
Definition: pilot_weapon.c:839
int pilot_weapSetTypeCheck(Pilot *p, int id)
Checks the current weapon set type.
Definition: pilot_weapon.c:301
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.
Definition: pilot_weapon.c:346
void pilot_weaponSafe(Pilot *p)
Sets the weapon set as safe.
int pilot_shoot(Pilot *p, int level)
Makes the pilot shoot.
Definition: pilot_weapon.c:743
void pilot_weapSetManual(Pilot *p, int id, int manual)
Changes the weapon set manual property.
Definition: pilot_weapon.c:372
void pilot_afterburnOver(Pilot *p)
Deactivates the afterburner.
void pilot_weapSetCleanup(Pilot *p, int id)
Cleans up a weapon set.
Definition: pilot_weapon.c:704
int pilot_weapSetManualCheck(Pilot *p, int id)
Checks the current weapon set manual property.
Definition: pilot_weapon.c:359
void pilot_shootStop(Pilot *p, int level)
Have pilot stop shooting their weapon.
Definition: pilot_weapon.c:769
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.
void pilot_weapSetAdd(Pilot *p, int id, PilotOutfitSlot *o, int level)
Adds an outfit to a weapon set.
Definition: pilot_weapon.c:431
double pilot_weapFlyTime(const Outfit *o, const Pilot *parent, const vec2 *pos, const vec2 *vel)
Computes an estimation of ammo flying time.
Definition: pilot_weapon.c:877
int pilot_weapSetCheck(Pilot *p, int id, PilotOutfitSlot *o)
Checks to see if a slot is in a weapon set.
Definition: pilot_weapon.c:532
void pilot_weapSetAIClear(Pilot *p)
Useful function for AI, clears activeness of all weapon sets.
Definition: pilot_weapon.c:150
void pilot_weapSetRmSlot(Pilot *p, int id, OutfitSlotType type)
Removes slots by type from the weapon set.
Definition: pilot_weapon.c:397
void pilot_weapSetType(Pilot *p, int id, int type)
Changes the weapon sets mode.
Definition: pilot_weapon.c:314
PilotWeaponSet * pilot_weapSet(Pilot *p, int id)
Gets a weapon set from id.
Definition: pilot_weapon.c:58
void pilot_weapSetUpdate(Pilot *p)
Updates the pilot's weapon sets.
Definition: pilot_weapon.c:264
int pilot_outfitOffAll(Pilot *p)
Disables all active outfits for a pilot.
void pilot_weaponSetDefault(Pilot *p)
Gives the pilot a default weapon set.
PilotWeaponSetOutfit * pilot_weapSetList(Pilot *p, int id)
Lists the items in a pilot weapon set.
Definition: pilot_weapon.c:731
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.
Definition: pilot_weapon.c:676
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.
Definition: pilot_weapon.c:333
void pilot_weapSetPress(Pilot *p, int id, int type)
Handles a weapon set press.
Definition: pilot_weapon.c:165
void pilot_weapSetFree(Pilot *p)
Frees a pilot's weapon sets.
Definition: pilot_weapon.c:718
const char * pilot_weapSetName(Pilot *p, int id)
Gets the name of a weapon set.
Definition: pilot_weapon.c:381
double pilot_weapSetSpeed(Pilot *p, int id, int level)
Gets the speed of the current pilot weapon set.
Definition: pilot_weapon.c:654
void pilot_weapSetRm(Pilot *p, int id, PilotOutfitSlot *o)
Removes a slot from a weapon set.
Definition: pilot_weapon.c:495
int pilot_outfitOff(Pilot *p, PilotOutfitSlot *o)
Disables a given active outfit.
double pilot_weapSetRange(Pilot *p, int id, int level)
Gets the range of the current pilot weapon set.
Definition: pilot_weapon.c:632
void pilot_weapSetUpdateStats(Pilot *p)
Update the weapon sets given pilot stat changes.
Definition: pilot_weapon.c:548
A ship outfit, depends radically on the type.
Definition: outfit.h:304
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:158
The representation of an in-game pilot.
Definition: pilot.h:210
Represents a 2d vector.
Definition: vec2.h:32