author | ekku |
Sat, 06 Dec 2008 17:51:19 +0000 | |
changeset 222 | 293ddf4c067d |
parent 221 | fbc5db6fce45 |
child 223 | 2fcaf54ed37b |
permissions | -rw-r--r-- |
198 | 1 |
#ifndef PLAYER_HH |
2 |
#define PLAYER_HH |
|
3 |
||
4 |
class Player; |
|
199 | 5 |
class LocalPlayer; |
6 |
class RemotePlayer; |
|
198 | 7 |
|
199 | 8 |
#include "GameState.hh" |
198 | 9 |
#include "PhysicsObject.hh" |
205 | 10 |
#include "Input.hh" |
212 | 11 |
#include "Weapon.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
|
12 |
//#include "Rope.hh" |
212 | 13 |
#include <vector> |
198 | 14 |
|
15 |
class Player : public PhysicsObject { |
|
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
|
16 |
public: |
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
|
17 |
GameState &state; |
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
|
18 |
|
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
19 |
protected: |
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
20 |
bool visible; |
212 | 21 |
std::vector<Weapon> arsenal; |
22 |
unsigned int selectedWeapon; //unsigned for x%sW not to fail |
|
213 | 23 |
bool changing; |
212 | 24 |
|
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
|
25 |
// Rope rope; |
219 | 26 |
int animation_step; |
27 |
||
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
28 |
// default constructor for use with virtual inheritance... it's not defined |
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
29 |
Player (void); |
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
30 |
Player (GameState &state, Vector position, bool visible); |
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
31 |
|
221 | 32 |
// used by the network code to execute actions for players |
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
33 |
virtual void handleDig (Vector position, float radius); |
221 | 34 |
virtual void handleShoot (Weapon &weapon); |
35 |
||
36 |
/* |
|
37 |
* |
|
38 |
*/ |
|
212 | 39 |
Weapon& getWeapon(); |
40 |
||
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
41 |
public: |
221 | 42 |
/* |
43 |
* Prints random things via Engine::log |
|
44 |
*/ |
|
45 |
void printDebugInfo (); |
|
46 |
||
47 |
/* |
|
48 |
* Overrides PhysicsObject::tick to also advance game state |
|
49 |
*/ |
|
50 |
virtual void tick (TimeMS dt); |
|
220
1c92222af6d3
use Player static vars for texture loading, and load from the PROJECT_DATA_DIR path
terom
parents:
219
diff
changeset
|
51 |
|
1c92222af6d3
use Player static vars for texture loading, and load from the PROJECT_DATA_DIR path
terom
parents:
219
diff
changeset
|
52 |
/* |
1c92222af6d3
use Player static vars for texture loading, and load from the PROJECT_DATA_DIR path
terom
parents:
219
diff
changeset
|
53 |
* Drawing requires the skin texture, which is loaded on-demand when draw is called |
1c92222af6d3
use Player static vars for texture loading, and load from the PROJECT_DATA_DIR path
terom
parents:
219
diff
changeset
|
54 |
*/ |
1c92222af6d3
use Player static vars for texture loading, and load from the PROJECT_DATA_DIR path
terom
parents:
219
diff
changeset
|
55 |
static bool skin_loaded; |
1c92222af6d3
use Player static vars for texture loading, and load from the PROJECT_DATA_DIR path
terom
parents:
219
diff
changeset
|
56 |
static CL_Surface skin_surface; |
215
69de8d9fcc0a
image is working.. well.. run it from build/src folder.
nireco
parents:
213
diff
changeset
|
57 |
virtual void draw(CL_GraphicContext* gc); |
198 | 58 |
}; |
59 |
||
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
60 |
class LocalPlayer : public virtual Player { |
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
61 |
public: |
221 | 62 |
/* |
63 |
* Called to invoke some action on this player that we control, either by Graphics or NetworkServer. |
|
64 |
* |
|
65 |
* NetworkClientLocalPlayer overrides this to send the input to the server, which then handles it |
|
66 |
*/ |
|
67 |
virtual void handleInput (PlayerInput input); |
|
198 | 68 |
}; |
69 |
||
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
70 |
class RemotePlayer : public virtual Player { |
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
71 |
protected: |
198 | 72 |
}; |
73 |
||
74 |
||
75 |
#endif |