Game Development Reference
In-Depth Information
typedef enum {
WEAPON_PISTOL,
WEAPON_SHOTGUN,
WEAPON_MACHINEGUN,
WEAPON_ROCKETS
} WEAPON_TYPE;
The header of CWeapon is self-explanatory. (For space purposes, I have cut out
the constructor, destructor, and the usual ā€œget and setā€? accessor functions.)
class CWeapon
{
public:
//[Ctor/Dtor snipped for spaceā€¦]
//[Accessors snipped for spaceā€¦]
///////////////////
// Accuracy and Damage Calculations
///////////////////
double GetAccuracy( USHORT Dist = 0, double Modifier = 0.0 );
double GetDamage( USHORT Dist = 0, double Modifier = 0.0 );
private:
///////////////////
// Member Variables
///////////////////
char* mName; // Name
USHORT mMaxRange; // Max range
USHORT mBaseDamage; // Base (max) damage
double mDmgDecayExp; // Decay formula exponent
USHORT mDmgDecayDiv; // Decay formula divisor
USHORT mDmgDecayShift; // Decay formula shift (horiz.)
Search WWH ::




Custom Search