author | Tero Marttila <terom@fixme.fi> |
Wed, 21 Jan 2009 03:33:35 +0200 | |
branch | new_graphics |
changeset 411 | 106aaf6eadfe |
parent 393 | 5dd4d782cf3a |
child 412 | 721c60072091 |
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 |
|
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:
228
diff
changeset
|
8 |
#include "Weapon.hh" |
308
60f4b55d5713
Calculates kills and deaths. You get frags by killing yourself \o/
saiam
parents:
306
diff
changeset
|
9 |
#include "Projectile.hh" |
199 | 10 |
#include "GameState.hh" |
198 | 11 |
#include "PhysicsObject.hh" |
205 | 12 |
#include "Input.hh" |
225 | 13 |
#include "Rope.hh" |
296
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
14 |
#include "Types.hh" |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
15 |
#include "Graphics/Drawable.hh" |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
16 |
|
212 | 17 |
#include <vector> |
198 | 18 |
|
283
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
19 |
/** |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
20 |
* A Player is a PhysicsObject that represents a player - a remote client on the server, a local singleplayer player, a |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
21 |
* local network-client player, a remote network-client player, etc. |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
22 |
*/ |
198 | 23 |
class Player : public PhysicsObject { |
228 | 24 |
friend class Rope; |
25 |
||
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
26 |
public: |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
27 |
GameState &state; |
212 | 28 |
|
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
29 |
protected: |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
30 |
// XXX: not used |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
31 |
bool visible; |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
32 |
|
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
33 |
// our weapons |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
34 |
std::vector<Weapon*> weapons; |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
35 |
|
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
36 |
// the index of the currently selected weapon |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
37 |
unsigned int selectedWeapon; |
239
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
237
diff
changeset
|
38 |
|
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
39 |
// we have a rope |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
40 |
Rope rope; |
296
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
41 |
|
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
42 |
/** Our current health */ |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
43 |
Health health; |
295 | 44 |
|
300 | 45 |
/** Our respawn-timer */ |
46 |
Timer respawn_timer; |
|
47 |
CL_Slot respawn_slot; |
|
48 |
||
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
325
diff
changeset
|
49 |
// XXX: updated where? |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
50 |
int animation_step; |
219 | 51 |
|
306 | 52 |
//Player stats |
53 |
uint16_t kills; |
|
54 |
uint16_t deaths; |
|
55 |
||
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
56 |
/** |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
57 |
* Default constructor for use with virtual inheritance... it's not defined, and must not be called |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
58 |
*/ |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
59 |
Player (void); |
274
c35307e8645c
add comments, move addPlayer/removePlayer to Player.cc, and refactor Network code to inherit from NetworkObject
terom
parents:
255
diff
changeset
|
60 |
|
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
61 |
/** |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
62 |
* Initialize params, and add ourselves to GameState |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
63 |
*/ |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
64 |
Player (GameState &state, Vector position, bool visible); |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
65 |
|
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
66 |
/** |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
67 |
* Remove player from state players list |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
68 |
*/ |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
69 |
~Player (void); |
300 | 70 |
|
71 |
/** |
|
72 |
* Move the worm to the given position, removeGround to dig a hole there, and enable ourselves |
|
73 |
*/ |
|
74 |
virtual void spawn (Vector position); |
|
75 |
||
76 |
/** |
|
77 |
* We die. Disable and prepare respawn_timer |
|
78 |
*/ |
|
302 | 79 |
virtual void die (bool start_timer = true); |
300 | 80 |
|
81 |
/** |
|
82 |
* Calculate a new position for the worm, and respawn there. Also set health back to 100% |
|
83 |
*/ |
|
302 | 84 |
virtual void respawn (TimeMS dt); |
236 | 85 |
|
295 | 86 |
/** |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
87 |
* Used by the network code to execute various actions |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
88 |
*/ |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
89 |
virtual void handleDig (Vector position, float radius); |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
90 |
virtual void handleFireWeapon (Weapon *weapon, Vector position, Vector velocity); |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
91 |
virtual void handleChangeWeapon (unsigned int weaponIndex); |
212 | 92 |
|
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
93 |
// Called by rope to handle state changes, these don't do anything by default |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
94 |
virtual void handleRopeState (RopeState state); |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
95 |
virtual void handleRopeLength (float length); |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
96 |
|
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
97 |
public: |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
98 |
/** |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
99 |
* Called when a weapon is fired, this should apply recoil and reload the weapon |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
100 |
*/ |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
101 |
void weaponFired (Weapon *weapon); |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
102 |
|
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
103 |
/** |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
104 |
* Get the currently selected weapon |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
105 |
* |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
106 |
* @return A pointer to the Weapon object |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
107 |
*/ |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
108 |
Weapon* getCurrentWeapon(); |
221 | 109 |
|
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
110 |
/** |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
111 |
* Get the weapon with the given index |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
112 |
* |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
113 |
* @return A pointer to a Weapon object if found, NULL otherwise |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
114 |
*/ |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
115 |
Weapon* getWeapon (WeaponID id); |
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
275
diff
changeset
|
116 |
|
295 | 117 |
/** |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
118 |
* Prints random things via Engine::log |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
119 |
*/ |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
120 |
void printDebugInfo (); |
220
1c92222af6d3
use Player static vars for texture loading, and load from the PROJECT_DATA_DIR path
terom
parents:
219
diff
changeset
|
121 |
|
295 | 122 |
/** |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
123 |
* Overrides PhysicsObject::tick to also advance game state |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
124 |
*/ |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
125 |
virtual void tick (TimeMS dt); |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
126 |
|
295 | 127 |
/** |
128 |
* This is called when the player collides with the terrain or with some other object. |
|
129 |
*/ |
|
130 |
void onCollision (Vector collisionPoint, PhysicsObject *other); |
|
131 |
||
296
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
132 |
/** |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
133 |
* We have been hit by something, and therefore take some damage. |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
134 |
* |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
135 |
* XXX: should this take the Projectile instead or somesuch? |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
136 |
*/ |
308
60f4b55d5713
Calculates kills and deaths. You get frags by killing yourself \o/
saiam
parents:
306
diff
changeset
|
137 |
void takeDamage (Projectile *source); |
60f4b55d5713
Calculates kills and deaths. You get frags by killing yourself \o/
saiam
parents:
306
diff
changeset
|
138 |
|
60f4b55d5713
Calculates kills and deaths. You get frags by killing yourself \o/
saiam
parents:
306
diff
changeset
|
139 |
/** |
322 | 140 |
* If the player has a pivot calculate the force it causes. |
141 |
*/ |
|
142 |
Vector getPivotForce (void); |
|
143 |
||
144 |
/** |
|
312 | 145 |
* Gives player's health in percents from maximum |
146 |
*/ |
|
147 |
float getHealthPercent() const; |
|
148 |
||
149 |
/** |
|
308
60f4b55d5713
Calculates kills and deaths. You get frags by killing yourself \o/
saiam
parents:
306
diff
changeset
|
150 |
* Increment player killcounter by one. |
60f4b55d5713
Calculates kills and deaths. You get frags by killing yourself \o/
saiam
parents:
306
diff
changeset
|
151 |
*/ |
60f4b55d5713
Calculates kills and deaths. You get frags by killing yourself \o/
saiam
parents:
306
diff
changeset
|
152 |
void addKill (); |
296
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
153 |
|
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
154 |
/* |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
155 |
* Drawing requires the skin texture, which is loaded on-demand when draw is called |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
156 |
*/ |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
157 |
static bool skin_loaded; |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
158 |
static CL_Surface skin_surface; |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
159 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
160 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
161 |
* Draw this player |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
162 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
163 |
virtual void draw (Display *display, PixelCoordinate camera); |
296
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
295
diff
changeset
|
164 |
|
325
a19c78786d7f
kills, deaths and weapon name is displayed in right place
nireco
parents:
322
diff
changeset
|
165 |
uint16_t getKills() { return kills; } |
a19c78786d7f
kills, deaths and weapon name is displayed in right place
nireco
parents:
322
diff
changeset
|
166 |
uint16_t getDeaths() { return deaths; } |
198 | 167 |
}; |
168 |
||
283
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
169 |
/** |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
170 |
* A LocalPlayer is a Player that we handle input for - so this is our own player on the client/singleplayer, or all |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
171 |
* the remote clients on a server - the name is a bit misleading. |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
172 |
* |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
173 |
* This inherits virtually from Player so that subclasses can also define custom behaviour for the base Player class. |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
174 |
*/ |
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
175 |
class LocalPlayer : public virtual Player { |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
176 |
private: |
312 | 177 |
/** |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
178 |
* Calculates projectil position/velocity and calls handleCreateProjectile |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
179 |
*/ |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
180 |
void fireWeapon (Weapon *weapon); |
237 | 181 |
|
312 | 182 |
/** |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
183 |
* Change weapon index, should be negative or positive 1 |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
184 |
*/ |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
185 |
void changeWeapon (int delta); |
223 | 186 |
|
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
187 |
public: |
312 | 188 |
/** |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
189 |
* Called to invoke some action on this player that we control, either by Graphics or NetworkServer. |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
190 |
* |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
191 |
* NetworkClientLocalPlayer overrides this to send the input to the server, which then handles it |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
192 |
*/ |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
193 |
virtual void handleInput (PlayerInput input, TimeMS dt); |
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:
228
diff
changeset
|
194 |
|
312 | 195 |
/** |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
196 |
* As Player, but also draws the current weapon name if displayWeapon |
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
197 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
198 |
virtual void draw (Display *display, bool displayWeapon, PixelCoordinate camera); |
198 | 199 |
}; |
200 |
||
283
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
201 |
/** |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
202 |
* A RemotePlayer is a Player that we don't handle input for - they are a remote client connected to a remote server. |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
203 |
* |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
204 |
* This inherits virtually from Player so that subclasses can also define custom behaviour for the base Player class. |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
205 |
*/ |
7540b0859579
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
terom
parents:
276
diff
changeset
|
206 |
|
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
205
diff
changeset
|
207 |
class RemotePlayer : public virtual Player { |
275
fa44b905bc2e
Tried to take input tick into account in updatePosition but it still doesn't seem to work
saiam
parents:
274
diff
changeset
|
208 |
protected: |
198 | 209 |
}; |
210 |
||
211 |
||
212 |
#endif |