CWeaponDef Class Reference

Define common weapon data. More...

#include <weaponDef.h>

List of all members.

Public Types

enum  eType { kTrace, kProj }
 Shot type enums. More...
enum  eFiremode { kSingle, kFullauto, kBurst, kShotgun }
 Fire mode enums. More...
enum  eFxBatchType { kFxShot, kFxHit, kFxMuzzle }
 FX batch type enums. More...

Public Member Functions

Create methods
 CWeaponDef ()
 ~CWeaponDef ()
Get/Set Value methods
void name (std::string name)
 Set name.
const std::string & name ()
 Get name.
void type (eType type)
 Set type.
eType type ()
 Get type.
void firemode (eFiremode type)
 Set firemode.
eFiremode firemode ()
 Get firemode.
void ammotype (int i)
 Set AmmoType.
int ammotype ()
 Get AmmoType.
void range (unit u)
 Set range.
unit range ()
 Get range.
void damage (unit u)
 Set damage.
unit damage ()
 Get damage.
void cycle (unit u)
 Set cycle time between shots.
unit cycle ()
 Get cycle time between shots.
void reload (unit u)
 Set reload time.
unit reload ()
 Get reload time.
void clipsize (int i)
 Set clipsize.
int clipsize ()
 Get clipsize.
void accuracy (unit u)
 Set accuracy adjustment.
unit accuracy ()
 Get accuracy adjustment.
void sound_shot (const std::string &str)
 Set the shot firing sound.
void sound_shot (const CSound &inSnd)
 Set the shot firing sound.
FX methods
bool fx_add (CFxBatch::eType fxType, eFxBatchType batchType)
 Add an FX to the batch type given.
bool fxShot_add (const char *str)
 Add an FX to the fxShot batch.
bool fxHit_add (const char *str)
 Add an FX to the fxHit batch.
bool fxMuzzle_add (const char *str)
 Add an FX to the fxMuzzle batch.
int fx_size (eFxBatchType batchType)
 Get the size of the FX arrays.
void soundShot_play (ENTITY *pEnt=NULL)
 Play the firing sound.
void fxShot_play (const CVector3D &vStart, const CVector3D &vEnd)
 Play FX along shot path.
void fxMuzzle_play (const CVector3D &vStart, const CAngle3D &ang)
 Play FX at muzzle.
void fxHit_play (const CVector3D &vStart, const CVector3D &vNormal)
 Play FX at hit point.


Detailed Description

Define common weapon data.

(c) 2007-2008 oP group Germany GbR. All rights reserved.
This source code is provided "as is" with no warranty and must not be distributed without written permission.

Author:
Doug Poston
Version:
1.3
Date:
12/28/2007

Member Enumeration Documentation

enum CWeaponDef::eType

Shot type enums.

Enumerator:
kTrace  Shot is handled with a single trace command.
kProj  Shot is a projectile that has to travel to the target.

enum CWeaponDef::eFiremode

Fire mode enums.

Enumerator:
kSingle  Fire a single round at a time.
kFullauto  Fire rounds until the trigger is released.
kBurst  Fire 3 rounds at a time.
kShotgun  Multiple rounds at once.

enum CWeaponDef::eFxBatchType

FX batch type enums.

Enumerator:
kFxShot  Emit along firing path (muzzle to target).
kFxHit  Emit at target.
kFxMuzzle  Emit at muzzle.


Member Function Documentation

void CWeaponDef::cycle ( unit  u  )  [inline]

Set cycle time between shots.

Parameters:
u Time in ticks.

void CWeaponDef::reload ( unit  u  )  [inline]

Set reload time.

Parameters:
u Time in ticks.

void CWeaponDef::accuracy ( unit  u  )  [inline]

Set accuracy adjustment.

Parameters:
u Adjustment (0 = dead-aim, >0 less accurate).

void CWeaponDef::sound_shot ( const std::string &  str  ) 

Set the shot firing sound.

Parameters:
str Name of sound file (look in "sound" folder)

void CWeaponDef::sound_shot ( const CSound inSnd  ) 

Set the shot firing sound.

Parameters:
inSnd Sound used as input

bool CWeaponDef::fx_add ( CFxBatch::eType  fxType,
eFxBatchType  batchType 
)

Add an FX to the batch type given.

Parameters:
fxType The type of FX to add.
batchType Which batch to add to
Returns:
false if no effect was added.

bool CWeaponDef::fxShot_add ( const char *  str  ) 

Add an FX to the fxShot batch.

Parameters:
str Name of the effect to add.
Returns:
false If no effect was added.

bool CWeaponDef::fxHit_add ( const char *  str  ) 

Add an FX to the fxHit batch.

Parameters:
str Name of the effect to add.
Returns:
false If no effect was added.

bool CWeaponDef::fxMuzzle_add ( const char *  str  ) 

Add an FX to the fxMuzzle batch.

Parameters:
str Name of the effect to add.
Returns:
false If no effect was added.

void CWeaponDef::soundShot_play ( ENTITY *  pEnt = NULL  ) 

Play the firing sound.

Parameters:
pEnt ENTITY pointer (NULL to just play the sound)

void CWeaponDef::fxShot_play ( const CVector3D vStart,
const CVector3D vEnd 
)

Play FX along shot path.

Parameters:
vStart Starting point.
vEnd Ending point.

void CWeaponDef::fxMuzzle_play ( const CVector3D vStart,
const CAngle3D ang 
)

Play FX at muzzle.

Parameters:
vStart Firing point.
ang Firing angle.

void CWeaponDef::fxHit_play ( const CVector3D vStart,
const CVector3D vNormal 
)

Play FX at hit point.

Parameters:
vStart Hit point.
vNormal Surface normal.


The documentation for this class was generated from the following files:
Generated on Fri Dec 28 12:55:07 2007 for template7 by  doxygen 1.5.4