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
Line 
1/*!
2 * @file player.h
3 * Implements a basic controllable WorldEntity
4 */
5
6#ifndef _PLAYER_H
7#define _PLAYER_H
8
9#include "world_entity.h"
10#include "physics_interface.h"
11#include "event_listener.h"
12
13template<class T>
14class tList;
15class Weapon;
16class WeaponManager;
17class Vector;
18class Event;
19
20//! Basic controllable WorldEntity
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*/
26class Player : public WorldEntity, public EventListener
27{
28    friend class World;
29
30  public:
31    Player();
32    Player(const char* fileName);
33    Player(const TiXmlElement* root);
34    virtual ~Player();
35
36    void init();
37    void loadParams(const TiXmlElement* root);
38
39    void addWeapon(Weapon* weapon);
40    void removeWeapon(Weapon* weapon);
41
42    /* WorldEntity functions */
43    virtual void postSpawn();
44    virtual void leftWorld();
45
46    virtual void collidesWith(WorldEntity* entity, const Vector& location);
47    virtual void tick(float time);
48    virtual void draw() const;
49
50    virtual void process(const Event &event);
51
52    /* Synchronizeable functions */
53    virtual void writeBytes(const byte* data, int length);
54    virtual int readBytes(byte* data);
55
56  private:
57    void move(float time);
58    void weaponAction();
59
60    /* Synchronizeable functions */
61    virtual void writeDebug() const;
62    virtual void readDebug() const;
63
64    // !! temporary !!
65    void ADDWEAPON();
66
67  private:
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.
75
76    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
77
78    Vector                velocity;           //!< the velocity of the player.
79    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
80    float                 acceleration;       //!< the acceleration of the player.
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
91};
92
93#endif /* _PLAYER_H */
Note: See TracBrowser for help on using the repository browser.