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 "tools/BillboardSet.h" |
---|
39 | |
---|
40 | namespace orxonox |
---|
41 | { |
---|
42 | class _OrxonoxExport SpaceShip : public Model |
---|
43 | { |
---|
44 | public: |
---|
45 | static SpaceShip *getLocalShip(); |
---|
46 | |
---|
47 | SpaceShip(); |
---|
48 | ~SpaceShip(); |
---|
49 | virtual bool create(); |
---|
50 | void registerAllVariables(); |
---|
51 | void init(); |
---|
52 | void setConfigValues(); |
---|
53 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
54 | virtual void tick(float dt); |
---|
55 | |
---|
56 | void setCamera(const std::string& camera = ""); |
---|
57 | void setMaxSpeed(float value); |
---|
58 | void setMaxSideAndBackSpeed(float value); |
---|
59 | void setMaxRotation(float value); |
---|
60 | void setTransAcc(float value); |
---|
61 | void setRotAcc(float value); |
---|
62 | void setTransDamp(float value); |
---|
63 | void setRotDamp(float value); |
---|
64 | void getFocus(); |
---|
65 | |
---|
66 | inline float getMaxSpeed() const |
---|
67 | { return this->maxSpeed_; } |
---|
68 | inline float getMaxSideAndBackSpeed() const |
---|
69 | { return this->maxSideAndBackSpeed_; } |
---|
70 | inline float getMaxRotation() const |
---|
71 | { return this->maxRotation_; } |
---|
72 | inline float getTransAcc() const |
---|
73 | { return this->translationAcceleration_; } |
---|
74 | inline float getRotAcc() const |
---|
75 | { return this->rotationAcceleration_; } |
---|
76 | inline float getTransDamp() const |
---|
77 | { return this->translationDamping_; } |
---|
78 | inline float getRotDamp() const |
---|
79 | { return this->rotationDamping_; } |
---|
80 | |
---|
81 | static std::string whereAmI(); |
---|
82 | static void setMaxSpeedTest(float value) |
---|
83 | { SpaceShip::instance_s->setMaxSpeed(value); } |
---|
84 | |
---|
85 | static void movePitch(float value); |
---|
86 | static void moveYaw(float value); |
---|
87 | static void moveRoll(float value); |
---|
88 | static void moveLongitudinal(float value); |
---|
89 | static void moveLateral(float value); |
---|
90 | static void fire(); |
---|
91 | void setMovePitch(float value); |
---|
92 | void setMoveYaw(float value); |
---|
93 | void setMoveRoll(float value); |
---|
94 | void setMoveLongitudinal(float value); |
---|
95 | void setMoveLateral(float value); |
---|
96 | void doFire(); |
---|
97 | |
---|
98 | inline const Vector3& getDir() const |
---|
99 | { return this->currentDir_; } |
---|
100 | inline const Vector3& getInitialDir() const |
---|
101 | { return this->initialDir_; } |
---|
102 | inline const Vector3& getOrth() const |
---|
103 | { return this->currentOrth_; } |
---|
104 | inline const Vector3& getInitialOrth() const |
---|
105 | { return this->initialOrth_; } |
---|
106 | |
---|
107 | Camera* getCamera(); |
---|
108 | |
---|
109 | int getTeamNr() const |
---|
110 | { return this->teamNr_; } |
---|
111 | float getHealth() const |
---|
112 | { return this->health_; } |
---|
113 | |
---|
114 | bool getMyShip(){return myShip_;} |
---|
115 | |
---|
116 | protected: |
---|
117 | void setTeamNr(int teamNr) |
---|
118 | { this->teamNr_ = teamNr; } |
---|
119 | |
---|
120 | private: |
---|
121 | void createCamera(); |
---|
122 | virtual ColourValue getProjectileColour() const |
---|
123 | { return ColourValue(1.0, 1.0, 0.5); } |
---|
124 | |
---|
125 | Vector3 testvector_; |
---|
126 | Vector3 initialDir_; |
---|
127 | Vector3 currentDir_; |
---|
128 | Vector3 initialOrth_; |
---|
129 | Vector3 currentOrth_; |
---|
130 | bool bInvertYAxis_; |
---|
131 | bool setMouseEventCallback_; |
---|
132 | bool bLMousePressed_; |
---|
133 | bool bRMousePressed_; |
---|
134 | |
---|
135 | Ogre::SceneNode* camNode_; |
---|
136 | Camera* cam_; |
---|
137 | std::string camName_; |
---|
138 | |
---|
139 | ParticleInterface* tt1_; |
---|
140 | ParticleInterface* tt2_; |
---|
141 | |
---|
142 | BillboardSet redBillboard_; |
---|
143 | BillboardSet greenBillboard_; |
---|
144 | Ogre::SceneNode* redNode_; |
---|
145 | Ogre::SceneNode* greenNode_; |
---|
146 | float blinkTime_; |
---|
147 | |
---|
148 | BillboardSet crosshairNear_; |
---|
149 | BillboardSet crosshairFar_; |
---|
150 | Ogre::SceneNode* chNearNode_; |
---|
151 | Ogre::SceneNode* chFarNode_; |
---|
152 | |
---|
153 | float timeToReload_; |
---|
154 | float reloadTime_; |
---|
155 | |
---|
156 | float maxSideAndBackSpeed_; |
---|
157 | float maxSpeed_; |
---|
158 | float maxRotation_; |
---|
159 | float translationAcceleration_; |
---|
160 | float rotationAcceleration_; |
---|
161 | float translationDamping_; |
---|
162 | float rotationDamping_; |
---|
163 | |
---|
164 | Radian maxRotationRadian_; |
---|
165 | Radian rotationAccelerationRadian_; |
---|
166 | Radian rotationDampingRadian_; |
---|
167 | Radian zeroRadian_; |
---|
168 | Radian mouseXRotation_; |
---|
169 | Radian mouseYRotation_; |
---|
170 | |
---|
171 | float mouseX_; |
---|
172 | float mouseY_; |
---|
173 | |
---|
174 | protected: |
---|
175 | bool myShip_; |
---|
176 | |
---|
177 | int teamNr_; |
---|
178 | float health_; |
---|
179 | |
---|
180 | static SpaceShip* instance_s; |
---|
181 | }; |
---|
182 | } |
---|
183 | |
---|
184 | #endif /* _SpaceShip_H__ */ |
---|