1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Fabian 'x3n' Landau |
---|
24 | * Co-authors: |
---|
25 | * Benjamin Knecht |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _SpaceShip_H__ |
---|
30 | #define _SpaceShip_H__ |
---|
31 | #include <string> |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | #include <OgrePrerequisites.h> |
---|
34 | |
---|
35 | #include "util/Math.h" |
---|
36 | #include "Camera.h" |
---|
37 | #include "Model.h" |
---|
38 | #include "RadarViewable.h" |
---|
39 | #include "tools/BillboardSet.h" |
---|
40 | |
---|
41 | namespace orxonox |
---|
42 | { |
---|
43 | class _OrxonoxExport SpaceShip : public Model, public RadarViewable |
---|
44 | { |
---|
45 | public: |
---|
46 | static SpaceShip *getLocalShip(); |
---|
47 | |
---|
48 | SpaceShip(); |
---|
49 | ~SpaceShip(); |
---|
50 | virtual bool create(); |
---|
51 | void registerAllVariables(); |
---|
52 | void init(); |
---|
53 | void setConfigValues(); |
---|
54 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
55 | virtual void tick(float dt); |
---|
56 | virtual void changedVisibility(); |
---|
57 | virtual void changedActivity(); |
---|
58 | |
---|
59 | void setCamera(const std::string& camera = ""); |
---|
60 | void setMaxSpeed(float value); |
---|
61 | void setMaxSideAndBackSpeed(float value); |
---|
62 | void setMaxRotation(float value); |
---|
63 | void setTransAcc(float value); |
---|
64 | void setRotAcc(float value); |
---|
65 | void setTransDamp(float value); |
---|
66 | void setRotDamp(float value); |
---|
67 | void getFocus(); |
---|
68 | |
---|
69 | inline float getMaxSpeed() const |
---|
70 | { return this->maxSpeed_; } |
---|
71 | inline float getMaxSideAndBackSpeed() const |
---|
72 | { return this->maxSideAndBackSpeed_; } |
---|
73 | inline float getMaxRotation() const |
---|
74 | { return this->maxRotation_; } |
---|
75 | inline float getTransAcc() const |
---|
76 | { return this->translationAcceleration_; } |
---|
77 | inline float getRotAcc() const |
---|
78 | { return this->rotationAcceleration_; } |
---|
79 | inline float getTransDamp() const |
---|
80 | { return this->translationDamping_; } |
---|
81 | inline float getRotDamp() const |
---|
82 | { return this->rotationDamping_; } |
---|
83 | |
---|
84 | static std::string whereAmI(); |
---|
85 | static void setMaxSpeedTest(float value) |
---|
86 | { SpaceShip::instance_s->setMaxSpeed(value); } |
---|
87 | |
---|
88 | static void movePitch(float value); |
---|
89 | static void moveYaw(float value); |
---|
90 | static void moveRoll(float value); |
---|
91 | static void moveLongitudinal(float value); |
---|
92 | static void moveLateral(float value); |
---|
93 | static void fire(); |
---|
94 | void setMovePitch(float value); |
---|
95 | void setMoveYaw(float value); |
---|
96 | void setMoveRoll(float value); |
---|
97 | void setMoveLongitudinal(float value); |
---|
98 | void setMoveLateral(float value); |
---|
99 | void doFire(); |
---|
100 | |
---|
101 | virtual float getReloadTime() { return this->reloadTime_; } |
---|
102 | virtual bool hasSpecialEffects() { return false; } |
---|
103 | |
---|
104 | inline const Vector3& getDir() const |
---|
105 | { return this->currentDir_; } |
---|
106 | inline const Vector3& getInitialDir() const |
---|
107 | { return this->initialDir_; } |
---|
108 | inline const Vector3& getOrth() const |
---|
109 | { return this->currentOrth_; } |
---|
110 | inline const Vector3& getInitialOrth() const |
---|
111 | { return this->initialOrth_; } |
---|
112 | |
---|
113 | Camera* getCamera(); |
---|
114 | |
---|
115 | int getTeamNr() const |
---|
116 | { return this->teamNr_; } |
---|
117 | float getHealth() const |
---|
118 | { return this->health_; } |
---|
119 | |
---|
120 | bool getMyShip(){return myShip_;} |
---|
121 | |
---|
122 | protected: |
---|
123 | void setTeamNr(int teamNr) |
---|
124 | { this->teamNr_ = teamNr; } |
---|
125 | |
---|
126 | private: |
---|
127 | void createCamera(); |
---|
128 | virtual ColourValue getProjectileColour() const |
---|
129 | { return ColourValue(1.0, 1.0, 0.5); } |
---|
130 | |
---|
131 | Vector3 testvector_; |
---|
132 | Vector3 initialDir_; |
---|
133 | Vector3 currentDir_; |
---|
134 | Vector3 initialOrth_; |
---|
135 | Vector3 currentOrth_; |
---|
136 | bool bInvertYAxis_; |
---|
137 | bool bLMousePressed_; |
---|
138 | bool bRMousePressed_; |
---|
139 | |
---|
140 | Ogre::SceneNode* camNode_; |
---|
141 | Camera* cam_; |
---|
142 | std::string camName_; |
---|
143 | |
---|
144 | ParticleInterface* tt1_; |
---|
145 | ParticleInterface* tt2_; |
---|
146 | BillboardSet leftThrusterFlare_; |
---|
147 | BillboardSet rightThrusterFlare_; |
---|
148 | |
---|
149 | Backlight* backlight_; |
---|
150 | |
---|
151 | BillboardSet redBillboard_; |
---|
152 | BillboardSet greenBillboard_; |
---|
153 | Ogre::SceneNode* redNode_; |
---|
154 | Ogre::SceneNode* greenNode_; |
---|
155 | float blinkTime_; |
---|
156 | |
---|
157 | ParticleSpawner* smoke_; |
---|
158 | ParticleSpawner* fire_; |
---|
159 | |
---|
160 | BillboardSet crosshairNear_; |
---|
161 | BillboardSet crosshairFar_; |
---|
162 | Ogre::SceneNode* chNearNode_; |
---|
163 | Ogre::SceneNode* chFarNode_; |
---|
164 | |
---|
165 | float timeToReload_; |
---|
166 | float reloadTime_; |
---|
167 | |
---|
168 | float maxSideAndBackSpeed_; |
---|
169 | float maxSpeed_; |
---|
170 | float maxRotation_; |
---|
171 | float translationAcceleration_; |
---|
172 | float rotationAcceleration_; |
---|
173 | float translationDamping_; |
---|
174 | float rotationDamping_; |
---|
175 | |
---|
176 | Radian maxRotationRadian_; |
---|
177 | Radian rotationAccelerationRadian_; |
---|
178 | Radian rotationDampingRadian_; |
---|
179 | Radian zeroRadian_; |
---|
180 | Radian mouseXRotation_; |
---|
181 | Radian mouseYRotation_; |
---|
182 | |
---|
183 | float mouseX_; |
---|
184 | float mouseY_; |
---|
185 | |
---|
186 | protected: |
---|
187 | bool myShip_; |
---|
188 | |
---|
189 | int teamNr_; |
---|
190 | float health_; |
---|
191 | |
---|
192 | static SpaceShip* instance_s; |
---|
193 | }; |
---|
194 | } |
---|
195 | |
---|
196 | #endif /* _SpaceShip_H__ */ |
---|