cWeapon Class Reference

#include <cWeapon.h>

Inheritance diagram for cWeapon:
cExplosion cHomingMissile cMachineGun cPlasmaGun cRaybeam cSparkGun

List of all members.

Public Member Functions

void playSource ()
void playSourceIfNotPlaying ()
virtual float fit (OID target)
virtual bool ready ()
virtual void fire (OID target)=0
virtual void animate (float spf)
virtual void transform ()
virtual void drawSolid ()
virtual void drawEffect ()
virtual void drawHUD ()
int damageByParticle (float *worldpos, float radius, int roles, float damage)

Public Attributes

cObjectweaponOwner
 Object whielding the weapon (normaly not damaged by weapon).
float * weaponBasefv
 Points To Current Vehicle Base Matrix of owner.
float * weaponMountfv
 Mounting Base Matrix relative to Vehicle Base Matrix or owner.
float weaponPosef [16]
 Current Matrix indicating world pos & orientation (pose) of this weapon.
float weaponScale
 Relative size and power of the weapon, 1.0 default mechscale weapon.
float timeReloading
 Remaining reload time until next firing is possible.
float timeReadying
 Remaining readying time for bringing up the weapon (unused).
float timeFiring
 Remaining firing time when firing takes more than an instant time.
short remainingAmmo
 Remaining shots until reloading another clip (negative == infinitive?).
short remainingClips
 Remaining clips (negative == infinitive?).
short clipSize
 Maximum amount of Ammo inside a clip.
short depotSize
 Maximum amount of clips.
unsigned soundSource
 OpenAL sound source for this weapon's sounds.
std::list< cParticle * > shrapnelParticles
 Particle container with variable meaning.
std::list< cParticle * > castoffParticles
 Particle container with variable meaning.
std::list< cParticle * > missileParticles
 Particle container with variable meaning.
std::list< cParticle * > damageParticles
 Particle container for particles with induce damage.

Static Public Attributes

static int sInstances = 0
 Instance counter.
static std::map< int, long > sTextures
 Texture Binds shared between instances.

Detailed Description

Base-Class of all weapons. Defines "all you need" for designing different kinds of weapons and their visual effects. Note that weapons are themselves responsible for drawing themselves, their bullets, missiles, dust, smoke and other particles.


Member Function Documentation

virtual void cWeapon::animate ( float  spf  )  [inline, virtual]

Update weapon animation cycles, particle trajectories and timers.

Reimplemented in cMachineGun, cPlasmaGun, cSparkGun, cRaybeam, cHomingMissile, and cExplosion.

int cWeapon::damageByParticle ( float *  worldpos,
float  radius,
int  roles,
float  damage 
)

Returns amount of damaged objects (currently just one at most).

virtual void cWeapon::drawEffect (  )  [inline, virtual]

Draw translucent effects like weapon flares and particles.

Reimplemented in cMachineGun, cPlasmaGun, cSparkGun, cRaybeam, cHomingMissile, and cExplosion.

virtual void cWeapon::drawHUD (  )  [inline, virtual]

Paints an iconic display of the weapon type and state into ortho [0..1,0..1] view.

Reimplemented in cMachineGun, cPlasmaGun, cSparkGun, cRaybeam, and cHomingMissile.

virtual void cWeapon::drawSolid (  )  [inline, virtual]

Draw the weapon model itself and non-translucent particles.

Reimplemented in cMachineGun, cPlasmaGun, cSparkGun, cRaybeam, cHomingMissile, and cExplosion.

virtual void cWeapon::fire ( OID  target  )  [pure virtual]

Fire Weapon at target, target may be 0.

Implemented in cMachineGun, cPlasmaGun, cSparkGun, cRaybeam, cHomingMissile, and cExplosion.

virtual float cWeapon::fit ( OID  target  )  [inline, virtual]

"Eignungsbeurteilung"

Fuzzy-Value [0,1] indicating usability or fittness of this weapon to be fired right now (not considering weapon state). May sum up (depends on Weapon) (future): +Ability/Possibility to hit target (may roll some dice). +Possible damage on target. +Possible damage on other enemy units (owner's enemies). -Possible self-damage. -Possible ally-damage. +In (optimal) Firerange. -Out of (optimal) Firerange.

void cWeapon::playSource (  ) 

Start playback of audio source.

void cWeapon::playSourceIfNotPlaying (  ) 

Start playback of audio source if it isn't playing anymore.

virtual bool cWeapon::ready (  )  [inline, virtual]

Considering weapon state, true when weapon is at hand, ready-loaded and unlocked.

void cWeapon::transform (  )  [virtual]

Calculate transformations for painting called between animate and draw*. Calculates current pose according to owners Base and Mount matrices and sets position of sound-source.


The documentation for this class was generated from the following files:
Generated on Fri Aug 27 16:01:36 2010 for Linwarrior 3D by  doxygen 1.6.3