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