1 | /*! |
---|
2 | * @file space_ship.h |
---|
3 | * Implements the Control of a Spaceship |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _SPACE_SHIP_H |
---|
7 | #define _SPACE_SHIP_H |
---|
8 | |
---|
9 | #include "playable.h" |
---|
10 | #include "extendable.h" |
---|
11 | |
---|
12 | // Forward Declaration |
---|
13 | template<class T> class tList; |
---|
14 | class Vector; |
---|
15 | class Event; |
---|
16 | class ParticleEmitter; |
---|
17 | class ParticleSystem; |
---|
18 | |
---|
19 | class SpaceShip : public Playable |
---|
20 | { |
---|
21 | |
---|
22 | public: |
---|
23 | SpaceShip(const char* fileName); |
---|
24 | SpaceShip(const TiXmlElement* root = NULL); |
---|
25 | virtual ~SpaceShip(); |
---|
26 | |
---|
27 | virtual void loadParams(const TiXmlElement* root); |
---|
28 | |
---|
29 | virtual void setAbsDirPlay(const Quaternion& rot); |
---|
30 | |
---|
31 | virtual void enter(); |
---|
32 | virtual void leave(); |
---|
33 | |
---|
34 | virtual void reset(); |
---|
35 | |
---|
36 | virtual void postSpawn(); |
---|
37 | virtual void leftWorld(); |
---|
38 | |
---|
39 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
40 | virtual void tick(float time); |
---|
41 | virtual void draw() const; |
---|
42 | |
---|
43 | virtual void process(const Event &event); |
---|
44 | |
---|
45 | virtual int writeBytes(const byte* data, int length, int sender); |
---|
46 | virtual int readBytes(byte* data, int maxLength, int * reciever); |
---|
47 | |
---|
48 | //HACK HACK HACK HACK make this private or remove it |
---|
49 | void doCollideNetwork( float energy ); |
---|
50 | std::list<float> networkCollisionList; |
---|
51 | |
---|
52 | private: |
---|
53 | void init(); |
---|
54 | |
---|
55 | void calculateVelocity(float time); |
---|
56 | |
---|
57 | bool bUp; //!< up button pressed. |
---|
58 | bool bDown; //!< down button pressed. |
---|
59 | bool bLeft; //!< left button pressed. |
---|
60 | bool bRight; //!< right button pressed. |
---|
61 | bool bAscend; //!< ascend button pressed. |
---|
62 | bool bDescend; //!< descend button presses. |
---|
63 | // bool bFire; //!< fire button pressed.(moved to playable) |
---|
64 | bool bRollL; //!< rolling button pressed (left) |
---|
65 | bool bRollR; //!< rolling button pressed (right) |
---|
66 | |
---|
67 | float xMouse; //!< mouse moved in x-Direction |
---|
68 | float yMouse; //!< mouse moved in y-Direction |
---|
69 | float mouseSensitivity; //!< the mouse sensitivity |
---|
70 | int yInvert; |
---|
71 | int controlVelocityX; |
---|
72 | int controlVelocityY; |
---|
73 | // float cycle; //!< hovercycle |
---|
74 | |
---|
75 | Vector velocity; //!< the velocity of the player. |
---|
76 | Vector oldVelocity; //!< the velocity the player had last synced |
---|
77 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
78 | Quaternion oldMouseDir; //!< the direction where the player wanted to fly |
---|
79 | float shipInertia; //!< the inertia of the ship(how fast the ship reacts to a mouse input) |
---|
80 | Quaternion rotQuat; |
---|
81 | Quaternion pitchDir; |
---|
82 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
83 | float acceleration; //!< the acceleration of the player. |
---|
84 | |
---|
85 | float airViscosity; |
---|
86 | |
---|
87 | byte oldMask; //!< used for synchronisation |
---|
88 | |
---|
89 | ParticleEmitter* burstEmitter; |
---|
90 | ParticleSystem* burstSystem; |
---|
91 | }; |
---|
92 | |
---|
93 | #endif /* _SPACE_SHIPS_H */ |
---|