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 | |
---|
13 | template<class T> class tList; |
---|
14 | class Vector; |
---|
15 | class Event; |
---|
16 | |
---|
17 | class SpaceShip : public Playable |
---|
18 | { |
---|
19 | |
---|
20 | public: |
---|
21 | |
---|
22 | SpaceShip(); |
---|
23 | SpaceShip(const char* fileName); |
---|
24 | SpaceShip(const TiXmlElement* root); |
---|
25 | virtual ~SpaceShip(); |
---|
26 | |
---|
27 | void init(); |
---|
28 | virtual void loadParams(const TiXmlElement* root); |
---|
29 | |
---|
30 | virtual void enter(); |
---|
31 | virtual void leave(); |
---|
32 | |
---|
33 | virtual void postSpawn(); |
---|
34 | virtual void leftWorld(); |
---|
35 | |
---|
36 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
37 | virtual void tick(float time); |
---|
38 | virtual void draw() const; |
---|
39 | |
---|
40 | virtual void process(const Event &event); |
---|
41 | |
---|
42 | virtual int writeBytes(const byte* data, int length, int sender); |
---|
43 | virtual int readBytes(byte* data, int maxLength, int * reciever); |
---|
44 | |
---|
45 | |
---|
46 | private: |
---|
47 | |
---|
48 | void calculateVelocity(float time); |
---|
49 | void weaponAction(); |
---|
50 | |
---|
51 | // !! temporary !! |
---|
52 | void ADDWEAPON(); |
---|
53 | |
---|
54 | bool bUp; //!< up button pressed. |
---|
55 | bool bDown; //!< down button pressed. |
---|
56 | bool bLeft; //!< left button pressed. |
---|
57 | bool bRight; //!< right button pressed. |
---|
58 | bool bAscend; //!< ascend button pressed. |
---|
59 | bool bDescend; //!< descend button presses. |
---|
60 | bool bFire; //!< fire button pressed. |
---|
61 | bool bRollL; //!< rolling button pressed (left) |
---|
62 | bool bRollR; //!< rolling button pressed (right) |
---|
63 | |
---|
64 | float xMouse; //!< mouse moved in x-Direction |
---|
65 | float yMouse; //!< mouse moved in y-Direction |
---|
66 | float mouseSensitivity; //!< the mouse sensitivity |
---|
67 | int yInvert; |
---|
68 | int controlVelocityX; |
---|
69 | int controlVelocityY; |
---|
70 | // float cycle; //!< hovercycle |
---|
71 | |
---|
72 | Vector velocity; //!< the velocity of the player. |
---|
73 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
74 | float shipInertia; //!< the inertia of the ship(how fast the ship reacts to a mouse input) |
---|
75 | Quaternion rotQuat; |
---|
76 | Quaternion pitchDir; |
---|
77 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
78 | float acceleration; //!< the acceleration of the player. |
---|
79 | |
---|
80 | float airViscosity; |
---|
81 | |
---|
82 | int oldMask; |
---|
83 | |
---|
84 | }; |
---|
85 | |
---|
86 | #endif /* _SPACE_SHIPS_H */ |
---|