CWeapon Class Reference

Define a weapon. Owned by GameEntity. More...

#include <weapon.h>

List of all members.

Public Types

enum  eState {
  kUndef = -1, kEmpty = 0, kReady, kReloading,
  kFiring
}
 Current weapon state enum. More...

Public Member Functions

void update ()
 Update the weapon.
Create methods
 CWeapon ()
 Create with default values.
 CWeapon (int i)
 Create with an index into the WeaponDefPool.
 ~CWeapon ()
Info methods
eState state ()
 
Returns:
Current state of the weapon

Weapon Def methods
bool def (int index)
 Set CWeaponDef index.
CWeaponDefweaponDef () const
 
Returns:
Pointer to the Weapon Def data (or NULL if not valid).

Action methods
bool fire (const CVector3D &v, const CAngle3D &a)
 Try to fire the weapon.
int reload (int ammo)
 Try to reload the weapon.
Info methods
int ammo () const
 
Returns:
Number of rounds currently in this weapon.

int ammotype () const
 
Returns:
The ammo type used by this weapon.

const CVector3Dhit_pos () const
 
Returns:
Last position hit (undef if nothing was hit during the last fire).

unit damage () const
 
Returns:
Damage value.

unit range () const
 
Returns:
Range value.

int def () const
 
Returns:
Weapon Def index.


Detailed Description

Define a weapon. Owned by GameEntity.

(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 CWeapon::eState

Current weapon state enum.

Enumerator:
kUndef  Undefined.
kEmpty  Empty.
kReady  Ready to fire.
kReloading  Reloading.
kFiring  Firing (cycle in new round).


Member Function Documentation

bool CWeapon::def ( int  index  )  [inline]

Set CWeaponDef index.

Parameters:
index Index of CWeaponDef we want to use (from pool).
Note:
The index gets set even if it isn't valid (since the pool may be defined later).
Returns:
true if the index is valid with the current pool.

bool CWeapon::fire ( const CVector3D v,
const CAngle3D a 
)

Try to fire the weapon.

Note:
(ev->my) MUST be set to the firing entity or NULL before calling this method.
Parameters:
v Vector we are firing from.
a Angle we are firing along.
Returns:
true if the weapon could be used, otherwise false.

int CWeapon::reload ( int  ammo  ) 

Try to reload the weapon.

Parameters:
ammo Max number of rounds that can be used to load this weapon.
Returns:
Number of rounds it took to load.


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