| author | terom |
| Sun, 07 Dec 2008 20:07:28 +0000 | |
| changeset 255 | 99431fdb0dc8 |
| parent 253 | 747b1037d83e |
| child 258 | 833ad8d7db8b |
| permissions | -rw-r--r-- |
| 212 | 1 |
#ifndef WEAPON_HH |
2 |
#define WEAPON_HH |
|
3 |
||
| 221 | 4 |
// forward-declare |
5 |
class Weapon; |
|
6 |
||
7 |
#include "GameState.hh" |
|
|
222
293ddf4c067d
reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents:
221
diff
changeset
|
8 |
#include "Projectile.hh" |
| 212 | 9 |
#include "Timer.hh" |
10 |
#include <string> |
|
11 |
||
12 |
class Weapon {
|
|
| 221 | 13 |
protected: |
14 |
std::string name; |
|
| 212 | 15 |
float velocity; |
16 |
float explosionRadius; |
|
17 |
int reloadTime; //in ms |
|
|
251
6a6208e5c7a1
Added recoil parameter for weapons, but it is not used yet.
saiam
parents:
236
diff
changeset
|
18 |
float recoil; |
| 212 | 19 |
|
20 |
int clipSize; |
|
21 |
||
| 221 | 22 |
bool visible; |
23 |
TickCount age; |
|
24 |
int reloadTimer; |
|
| 212 | 25 |
|
| 221 | 26 |
public: |
|
253
747b1037d83e
Added recoil to weapon constructor. Recoil still not used.
saiam
parents:
251
diff
changeset
|
27 |
Weapon (TickCount age, float velocity, float recoil, float explosionRadius, int reloadTime, std::string name); |
| 221 | 28 |
|
29 |
// advance the reload timer |
|
30 |
void tickReload (TimeMS dt); |
|
31 |
||
32 |
// can the weapon be fired (not reloading, have a clip, etc) |
|
33 |
bool canShoot (void); |
|
34 |
||
| 223 | 35 |
// get weapon parameters |
|
233
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
223
diff
changeset
|
36 |
std::string getName (void) { return name; }
|
| 235 | 37 |
float getSpeed (void) { return velocity; }
|
| 223 | 38 |
float getExplosionRadius (void) { return explosionRadius; }
|
39 |
TickCount getExpireTicks (void) { return age; }
|
|
40 |
||
41 |
// start reloading |
|
42 |
void reload (void); |
|
| 212 | 43 |
}; |
44 |
||
45 |
#endif |