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

cObjectmOwner
 Object whielding the weapon (normaly not damaged by weapon).
float * mBasefv
 Points To Current Vehicle Base Matrix of owner.
float * mMountfv
 Mounting Base Matrix relative to Vehicle Base Matrix or owner.
float mPosef [16]
 Current Matrix indicating world pos & orientation (pose) of this weapon.
float mScale
 Relative size and power of the weapon, 1.0 default mechscale weapon (unused).
float mReloading
 Remaining reload time until next firing is possible.
float mReadying
 Remaining readying time for bringing up the weapon (unused).
float mFiring
 Remaining firing time when firing takes more than an instant time.
short mAmmo
 Remaining shots until reloading another clip (negative == infinitive?).
short mClips
 Remaining clips (negative == infinitive?).
short mClipsize
 Maximum amount of Ammo inside a clip.
short mDepotsize
 Maximum amount of clips.
unsigned mSoundSource
 OpenAL sound source for this weapon's sounds.
std::list< cParticle * > mShrapnels
std::list< cParticle * > mCastoff
std::list< cParticle * > mMissiles
std::list< cParticle * > mDamages

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.

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 Tue Feb 16 18:32:39 2010 for Linwarrior 3D by  doxygen 1.6.1