/*! * @file player.h * Implements a basic controllable WorldEntity */ #ifndef _PLAYER_H #define _PLAYER_H #include "world_entity.h" #include "physics_interface.h" #include "event_listener.h" template class tList; class Weapon; class WeaponManager; class Vector; class Event; //! Basic controllable WorldEntity /** * this is the debug player - actualy we would have to make a new class derivated from Player for each player. for now, we just use the player.cc for debug also */ class Player : public WorldEntity, public EventListener { friend class World; public: Player(); Player(const char* fileName); Player(const TiXmlElement* root); virtual ~Player(); void init(); void loadParams(const TiXmlElement* root); void addWeapon(Weapon* weapon); void removeWeapon(Weapon* weapon); /* WorldEntity functions */ virtual void postSpawn(); virtual void leftWorld(); virtual void collidesWith(WorldEntity* entity, const Vector& location); virtual void tick(float time); virtual void draw() const; virtual void process(const Event &event); /* Synchronizeable functions */ virtual void writeBytes(const byte* data, int length); virtual int readBytes(byte* data); private: void move(float time); void weaponAction(); /* Synchronizeable functions */ virtual void writeDebug() const; virtual void readDebug() const; // !! temporary !! void ADDWEAPON(); private: bool bUp; //!< up button pressed. bool bDown; //!< down button pressed. bool bLeft; //!< left button pressed. bool bRight; //!< right button pressed. bool bAscend; //!< ascend button pressed. bool bDescend; //!< descend button presses. bool bFire; //!< fire button pressed. WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping Vector velocity; //!< the velocity of the player. float travelSpeed; //!< the current speed of the player (to make soft movement) float acceleration; //!< the acceleration of the player. byte* inData; int inLength; int inBufferLength; int recLength; byte* outData; int outLength; int outBufferLength; int sentLength; }; #endif /* _PLAYER_H */