24typedef enum WeaponStatus_ {
25 WEAPON_STATUS_LOCKING,
27 WEAPON_STATUS_UNJAMMED,
29 WEAPON_STATUS_JAMMED_SLOWED,
33#define WEAPON_FLAG_DESTROYED (1<<0)
34#define WEAPON_FLAG_HITTABLE (1<<1)
35#define WEAPON_FLAG_ONLYHITTARGET (1<<2)
36#define WEAPON_FLAG_AIM (1<<3)
37#define weapon_isFlag(w,f) ((w)->flags & (f))
38#define weapon_setFlag(w,f) ((w)->flags |= (f))
39#define weapon_rmFlag(w,f) ((w)->flags &= ~(f))
40#define weapon_isSmart(w) (outfit_isSeeker(w->outfit))
47typedef struct Weapon_ {
80 void (*think)(
struct Weapon_*, double);
90 double dir,
const vec2* pos,
const vec2* vel,
91 const Pilot *parent,
const Target *target,
double time,
int aim );
99 double dir,
const vec2* pos,
const vec2* vel,
100 const Pilot *parent,
const Target *target,
int aim );
105const IntList *weapon_collideQuery(
int x1,
int y1,
int x2,
int y2 );
106void weapon_collideQueryIL(
IntList *il,
int x1,
int y1,
int x2,
int y2 );
A ship outfit, depends radically on the type.
Stores an outfit the pilot has.
The representation of an in-game pilot.
Represents a solid in the game.
Represents a weapon target.
A trail generated by a ship or an ammo.
In-game representation of a weapon.
void weapons_update(double dt)
Updates all the weapons.
double weapon_targetFlyTime(const Outfit *o, const Pilot *p, const Target *t)
Gets the fly time for a weapon target.
unsigned int beam_start(PilotOutfitSlot *po, double dir, const vec2 *pos, const vec2 *vel, const Pilot *parent, const Target *target, int aim)
Starts a beam weapon.
Weapon * weapon_add(PilotOutfitSlot *po, const Outfit *ref, double dir, const vec2 *pos, const vec2 *vel, const Pilot *parent, const Target *target, double time, int aim)
Creates a new weapon.
Weapon * weapon_getID(unsigned int id)
Gets a weapon by ID.
void weapons_updatePurge(void)
Purges unnecessary weapons.
void weapon_clear(void)
Clears all the weapons, does NOT free the layers.
void weapons_updateCollide(double dt)
Handles weapon collisions.
void weapon_hitAI(Pilot *p, const Pilot *shooter, double dmg)
Informs the AI if needed that it's been hit.
int weapon_inArc(const Outfit *o, const Pilot *parent, const Target *target, const vec2 *pos, const vec2 *vel, double dir, double time)
Gets the aim position of a turret weapon.
Weapon * weapon_getStack(void)
Gets the weapon stack. Do not manipulate directly.
void weapon_exit(void)
Destroys all the weapons and frees it all.
void weapons_render(const WeaponLayer layer, double dt)
Renders all the weapons in a layer.
void weapon_init(void)
Initializes the weapon stuff.
void weapon_newSystem(void)
Sets up collision stuff for a new system.
void beam_end(unsigned int beam)
Ends a beam weapon.