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 | ObjectListDeclaration(SpaceShip); |
---|
22 | |
---|
23 | public: |
---|
24 | SpaceShip(const std::string& fileName); |
---|
25 | SpaceShip(const TiXmlElement* root = NULL); |
---|
26 | virtual ~SpaceShip(); |
---|
27 | |
---|
28 | virtual void loadParams(const TiXmlElement* root); |
---|
29 | |
---|
30 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); |
---|
31 | |
---|
32 | virtual void enter(); |
---|
33 | virtual void leave(); |
---|
34 | |
---|
35 | virtual void reset(); |
---|
36 | |
---|
37 | virtual void postSpawn(); |
---|
38 | virtual void leftWorld(); |
---|
39 | |
---|
40 | virtual void destroy(WorldEntity* killer); |
---|
41 | virtual void respawn(); |
---|
42 | |
---|
43 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
44 | virtual void tick(float time); |
---|
45 | virtual void draw() const; |
---|
46 | |
---|
47 | virtual void process(const Event &event); |
---|
48 | |
---|
49 | private: |
---|
50 | void init(); |
---|
51 | |
---|
52 | void calculateVelocity(float time); |
---|
53 | |
---|
54 | |
---|
55 | int shield //!< current shield |
---|
56 | int shieldMax //!< maximum shield |
---|
57 | float shieldEnergyShare //!< percentage of reactor output |
---|
58 | |
---|
59 | int armor //!< current armor |
---|
60 | int armorMax //!< maximum armor |
---|
61 | |
---|
62 | int electronic //!< current electronic |
---|
63 | int electronicMax //!< maximum electronic |
---|
64 | |
---|
65 | int engineSpeed //!< speed output |
---|
66 | int enginePowerConsume //!< energy needed |
---|
67 | float engineEnergyShare //!< percentage of reactor output |
---|
68 | |
---|
69 | int weaponEnergySlot //!< number of energy weapon slots |
---|
70 | int weaponEnergyUsed |
---|
71 | float weaponEnergyShare |
---|
72 | int weaponSpecialSlot //!< number of special weapon slots |
---|
73 | int weaponSpecialUsed |
---|
74 | |
---|
75 | int reactorOutput //!< reactor output |
---|
76 | int reactorCapacity //!< reactor capacity |
---|
77 | |
---|
78 | bool bUp; //!< up button pressed. |
---|
79 | bool bDown; //!< down button pressed. |
---|
80 | bool bLeft; //!< left button pressed. |
---|
81 | bool bRight; //!< right button pressed. |
---|
82 | bool bAscend; //!< ascend button pressed. |
---|
83 | bool bDescend; //!< descend button presses. |
---|
84 | // bool bFire; //!< fire button pressed.(moved to playable) |
---|
85 | bool bRollL; //!< rolling button pressed (left) |
---|
86 | bool bRollR; //!< rolling button pressed (right) |
---|
87 | |
---|
88 | float xMouse; //!< mouse moved in x-Direction |
---|
89 | float yMouse; //!< mouse moved in y-Direction |
---|
90 | float mouseSensitivity; //!< the mouse sensitivity |
---|
91 | int yInvert; |
---|
92 | int controlVelocityX; |
---|
93 | int controlVelocityY; |
---|
94 | // float cycle; //!< hovercycle |
---|
95 | |
---|
96 | Vector velocity; //!< the velocity of the player. |
---|
97 | Vector oldVelocity; //!< the velocity the player had last synced |
---|
98 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
99 | Quaternion oldMouseDir; //!< the direction where the player wanted to fly |
---|
100 | float shipInertia; //!< the inertia of the ship(how fast the ship reacts to a mouse input) |
---|
101 | Quaternion rotQuat; |
---|
102 | Quaternion pitchDir; |
---|
103 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
104 | float acceleration; //!< the acceleration of the player. |
---|
105 | |
---|
106 | float airViscosity; |
---|
107 | |
---|
108 | byte oldMask; //!< used for synchronisation |
---|
109 | |
---|
110 | ParticleEmitter* burstEmitter; |
---|
111 | ParticleSystem* burstSystem; |
---|
112 | }; |
---|
113 | |
---|
114 | #endif /* _SPACE_SHIPS_H */ |
---|