#ifndef PLAYER_HH
#define PLAYER_HH
class Player;
class LocalPlayer;
class RemotePlayer;
#include "Weapon.hh"
#include "GameState.hh"
#include "PhysicsObject.hh"
#include "Input.hh"
#include "Rope.hh"
#include "GraphicsPointer.hh"
#include <vector>
class Player : public PhysicsObject {
friend class Rope;
public:
GameState &state;
protected:
bool visible;
std::vector<Weapon*> weapons;
unsigned int selectedWeapon; //unsigned for x%sW not to fail
bool changing;
Rope rope;
int animation_step;
// default constructor for use with virtual inheritance... it's not defined
Player (void);
Player (GameState &state, Vector position, bool visible);
// used by the network code to execute actions for players
virtual void handleDig (Vector position, float radius);
virtual void handleCreateProjectile (Weapon *weapon, Vector position, Vector velocity);
/*
* The currently selected weapon
*/
Weapon* getCurrentWeapon();
public:
/*
* Prints random things via Engine::log
*/
void printDebugInfo ();
/*
* Overrides PhysicsObject::tick to also advance game state
*/
virtual void tick (TimeMS dt);
/*
* Drawing requires the skin texture, which is loaded on-demand when draw is called
*/
static bool skin_loaded;
static CL_Surface skin_surface;
virtual void draw (Graphics *g);
};
class LocalPlayer : public virtual Player {
private:
/*
* Calculates projectil position/velocity and calls handleCreateProjectile
*/
void fireWeapon (Weapon *weapon);
public:
/*
* Called to invoke some action on this player that we control, either by Graphics or NetworkServer.
*
* NetworkClientLocalPlayer overrides this to send the input to the server, which then handles it
*/
virtual void handleInput (PlayerInput input);
/*
* As Player, but also draws the current weapon name if displayWeapon
*/
virtual void draw (Graphics *g, bool displayWeapon);
};
class RemotePlayer : public virtual Player {
protected:
};
#endif