[2072] | 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 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _SpaceShip_H__ |
---|
| 30 | #define _SpaceShip_H__ |
---|
| 31 | |
---|
| 32 | #include "OrxonoxPrereqs.h" |
---|
| 33 | |
---|
[3196] | 34 | #include <string> |
---|
| 35 | #include <LinearMath/btVector3.h> |
---|
| 36 | #include "util/Math.h" |
---|
[2072] | 37 | #include "Pawn.h" |
---|
| 38 | |
---|
| 39 | namespace orxonox |
---|
| 40 | { |
---|
| 41 | class _OrxonoxExport SpaceShip : public Pawn |
---|
| 42 | { |
---|
| 43 | public: |
---|
| 44 | SpaceShip(BaseObject* creator); |
---|
| 45 | virtual ~SpaceShip(); |
---|
| 46 | |
---|
| 47 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
| 48 | virtual void tick(float dt); |
---|
| 49 | void registerVariables(); |
---|
| 50 | void setConfigValues(); |
---|
| 51 | |
---|
| 52 | virtual void moveFrontBack(const Vector2& value); |
---|
| 53 | virtual void moveRightLeft(const Vector2& value); |
---|
| 54 | virtual void moveUpDown(const Vector2& value); |
---|
| 55 | |
---|
| 56 | virtual void rotateYaw(const Vector2& value); |
---|
| 57 | virtual void rotatePitch(const Vector2& value); |
---|
| 58 | virtual void rotateRoll(const Vector2& value); |
---|
| 59 | |
---|
| 60 | virtual void fire(); |
---|
[2662] | 61 | virtual void boost(); |
---|
[2072] | 62 | |
---|
[2662] | 63 | void setEngine(Engine* engine); |
---|
| 64 | inline Engine* getEngine() const |
---|
| 65 | { return this->engine_; } |
---|
[2072] | 66 | |
---|
[2662] | 67 | inline void setSteeringDirection(const Vector3& direction) |
---|
| 68 | { this->steering_ = direction; } |
---|
| 69 | inline const Vector3& getSteeringDirection() const |
---|
| 70 | { return this->steering_; } |
---|
[2072] | 71 | |
---|
[2662] | 72 | inline void setBoost(bool bBoost) |
---|
| 73 | { this->bBoost_ = bBoost; } |
---|
| 74 | inline bool getBoost() const |
---|
| 75 | { return this->bBoost_; } |
---|
| 76 | |
---|
| 77 | inline void setEngineTemplate(const std::string& temp) |
---|
| 78 | { this->enginetemplate_ = temp; this->loadEngineTemplate(); } |
---|
| 79 | inline const std::string& getEngineTemplate() const |
---|
| 80 | { return this->enginetemplate_; } |
---|
| 81 | |
---|
| 82 | inline void setPermanentBoost(bool bPermanent) |
---|
| 83 | { this->bPermanentBoost_ = bPermanent; } |
---|
| 84 | inline bool getPermanentBoost() const |
---|
| 85 | { return this->bPermanentBoost_; } |
---|
| 86 | |
---|
[2072] | 87 | protected: |
---|
| 88 | bool bInvertYAxis_; |
---|
| 89 | |
---|
[2662] | 90 | bool bBoost_; |
---|
| 91 | bool bPermanentBoost_; |
---|
| 92 | Vector3 steering_; |
---|
| 93 | float primaryThrust_; |
---|
| 94 | float auxilaryThrust_; |
---|
| 95 | float rotationThrust_; |
---|
| 96 | btVector3 localLinearAcceleration_; |
---|
| 97 | btVector3 localAngularAcceleration_; |
---|
[2072] | 98 | |
---|
[2662] | 99 | private: |
---|
| 100 | virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const; |
---|
[2072] | 101 | |
---|
[2662] | 102 | private: |
---|
| 103 | void loadEngineTemplate(); |
---|
| 104 | |
---|
| 105 | std::string enginetemplate_; |
---|
| 106 | Engine* engine_; |
---|
[2072] | 107 | }; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | #endif /* _SpaceShip_H__ */ |
---|