src/Weapon.hh
author terom
Sat, 06 Dec 2008 22:47:08 +0000
changeset 233 ff4ecea83cf5
parent 223 2fcaf54ed37b
child 235 0a0c729365ee
permissions -rw-r--r--
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
#ifndef WEAPON_HH
#define WEAPON_HH

// forward-declare
class Weapon;

#include "GameState.hh"
#include "Projectile.hh"
#include "Timer.hh"
#include <string>

class Weapon {
protected:
    GameState &st;
    std::string name;
    float velocity;
    float explosionRadius;
    int reloadTime; //in ms

    int clipSize;

    bool visible;
    TickCount age;
    int reloadTimer;

public:
    Weapon (GameState &st, TickCount age, float velocity, float explosionRadius, int reloadTime, std::string name);
    Weapon (const Weapon& orig);
    Weapon& operator= (const Weapon& orig);
    
    // advance the reload timer
    void tickReload (TimeMS dt);
    
    // can the weapon be fired (not reloading, have a clip, etc)
    bool canShoot (void);
    
    // get weapon parameters
    std::string getName (void) { return name; }
    float getVelocity (void) { return velocity; }
    float getExplosionRadius (void) { return explosionRadius; }
    TickCount getExpireTicks (void) { return age; }
    
    // start reloading
    void reload (void);
};

#endif