Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/world_entities/player.h @ 5829

Last change on this file since 5829 was 5829, checked in by patrick, 18 years ago

network: much work on multiplayability, does not yet work

File size: 2.7 KB
RevLine 
[4780]1/*!
[4885]2 * @file player.h
3 * Implements a basic controllable WorldEntity
[4818]4 */
[3471]5
6#ifndef _PLAYER_H
7#define _PLAYER_H
8
9#include "world_entity.h"
[4382]10#include "physics_interface.h"
[4404]11#include "event_listener.h"
[3471]12
[5829]13template<class T>
14class tList;
[3583]15class Weapon;
[3873]16class WeaponManager;
[3608]17class Vector;
[4404]18class Event;
[3471]19
20//! Basic controllable WorldEntity
[4885]21/**
22  *  this is the debug player - actualy we would have to make a new
23     class derivated from Player for each player. for now, we just use
24     the player.cc for debug also
25*/
[5257]26class Player : public WorldEntity, public EventListener
[3471]27{
[5829]28    friend class World;
[4780]29
[4818]30  public:
31    Player();
[4975]32    Player(const char* fileName);
[4818]33    Player(const TiXmlElement* root);
34    virtual ~Player();
[3583]35
[4818]36    void init();
37    void loadParams(const TiXmlElement* root);
[4780]38
[4818]39    void addWeapon(Weapon* weapon);
40    void removeWeapon(Weapon* weapon);
[4780]41
[5829]42    /* WorldEntity functions */
[4818]43    virtual void postSpawn();
44    virtual void leftWorld();
[3583]45
[5435]46    virtual void collidesWith(WorldEntity* entity, const Vector& location);
[4818]47    virtual void tick(float time);
[5500]48    virtual void draw() const;
[3583]49
[4818]50    virtual void process(const Event &event);
[4780]51
[5829]52    /* Synchronizeable functions */
53    virtual void writeBytes(const byte* data, int length);
54    virtual int readBytes(byte* data);
[3471]55
[4818]56  private:
57    void move(float time);
[4885]58    void weaponAction();
[3755]59
[5829]60    /* Synchronizeable functions */
61    virtual void writeDebug() const;
62    virtual void readDebug() const;
63
[5435]64    // !! temporary !!
65    void ADDWEAPON();
[3583]66
[4818]67  private:
[4885]68    bool                  bUp;                //!< up button pressed.
69    bool                  bDown;              //!< down button pressed.
70    bool                  bLeft;              //!< left button pressed.
71    bool                  bRight;             //!< right button pressed.
72    bool                  bAscend;            //!< ascend button pressed.
73    bool                  bDescend;           //!< descend button presses.
74    bool                  bFire;              //!< fire button pressed.
[4780]75
[4885]76    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
[4780]77
[5212]78    Vector                velocity;           //!< the velocity of the player.
[4885]79    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
80    float                 acceleration;       //!< the acceleration of the player.
[5829]81
82    byte*                 inData;
83    int                   inLength;
84    int                   inBufferLength;
85    int                   recLength;
86    byte*                 outData;
87    int                   outLength;
88    int                   outBufferLength;
89    int                   sentLength;
90
[3471]91};
92
93#endif /* _PLAYER_H */
Note: See TracBrowser for help on using the repository browser.