| 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 _Engine_H__ | 
|---|
| 30 | #define _Engine_H__ | 
|---|
| 31 |  | 
|---|
| 32 | #include "OrxonoxPrereqs.h" | 
|---|
| 33 |  | 
|---|
| 34 | #include "tools/interfaces/Tickable.h" | 
|---|
| 35 | #include "Item.h" | 
|---|
| 36 |  | 
|---|
| 37 | #include "interfaces/PickupCarrier.h" | 
|---|
| 38 |  | 
|---|
| 39 | namespace orxonox | 
|---|
| 40 | { | 
|---|
| 41 |     class _OrxonoxExport Engine : public Item, public Tickable, public PickupCarrier | 
|---|
| 42 |     { | 
|---|
| 43 |         public: | 
|---|
| 44 |             Engine(BaseObject* creator); | 
|---|
| 45 |             virtual ~Engine(); | 
|---|
| 46 |  | 
|---|
| 47 |             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); | 
|---|
| 48 |             void registerVariables(); | 
|---|
| 49 |             void setConfigValues(); | 
|---|
| 50 |  | 
|---|
| 51 |             virtual void tick(float dt); | 
|---|
| 52 |             virtual void changedActivity(); | 
|---|
| 53 |  | 
|---|
| 54 |             virtual void addToSpaceShip(SpaceShip* ship); | 
|---|
| 55 |             inline SpaceShip* getShip() const | 
|---|
| 56 |                 { return this->ship_; } | 
|---|
| 57 |  | 
|---|
| 58 |             inline void setBoostFactor(float factor) | 
|---|
| 59 |                 { this->boostFactor_ = factor; } | 
|---|
| 60 |             inline float getBoostFactor() const | 
|---|
| 61 |                 { return this->boostFactor_; } | 
|---|
| 62 |  | 
|---|
| 63 |             inline void setSpeedFactor(float factor) | 
|---|
| 64 |                 { this->speedFactor_ = factor; } | 
|---|
| 65 |             inline float getSpeedFactor() const | 
|---|
| 66 |                 { return this->speedFactor_; } | 
|---|
| 67 |  | 
|---|
| 68 |             inline void setMaxSpeedFront(float speed) | 
|---|
| 69 |                 { this->maxSpeedFront_ = speed; } | 
|---|
| 70 |             inline void setMaxSpeedBack(float speed) | 
|---|
| 71 |                 { this->maxSpeedBack_ = speed; } | 
|---|
| 72 |             inline void setMaxSpeedLeftRight(float speed) | 
|---|
| 73 |                 { this->maxSpeedLeftRight_ = speed; } | 
|---|
| 74 |             inline void setMaxSpeedUpDown(float speed) | 
|---|
| 75 |                 { this->maxSpeedUpDown_ = speed; } | 
|---|
| 76 |  | 
|---|
| 77 |             inline float getMaxSpeedFront() const | 
|---|
| 78 |                 { return this->maxSpeedFront_; } | 
|---|
| 79 |             inline float getMaxSpeedBack() const | 
|---|
| 80 |                 { return this->maxSpeedBack_; } | 
|---|
| 81 |             inline float getMaxSpeedLeftRight() const | 
|---|
| 82 |                 { return this->maxSpeedLeftRight_; } | 
|---|
| 83 |             inline float getMaxSpeedUpDown() const | 
|---|
| 84 |                 { return this->maxSpeedUpDown_; } | 
|---|
| 85 |  | 
|---|
| 86 |             inline void setAccelerationFront(float acceleration) | 
|---|
| 87 |                 { this->accelerationFront_ = acceleration; } | 
|---|
| 88 |             inline void setAccelerationBrake(float acceleration) | 
|---|
| 89 |                 { this->accelerationBrake_ = acceleration; } | 
|---|
| 90 |             inline void setAccelerationBack(float acceleration) | 
|---|
| 91 |                 { this->accelerationBack_ = acceleration; } | 
|---|
| 92 |             inline void setAccelerationLeftRight(float acceleration) | 
|---|
| 93 |                 { this->accelerationLeftRight_ = acceleration; } | 
|---|
| 94 |             inline void setAccelerationUpDown(float acceleration) | 
|---|
| 95 |                 { this->accelerationUpDown_ = acceleration; } | 
|---|
| 96 |  | 
|---|
| 97 |             inline float getAccelerationFront() const | 
|---|
| 98 |                 { return this->accelerationFront_; } | 
|---|
| 99 |             inline float getAccelerationBrake() const | 
|---|
| 100 |                 { return this->accelerationBrake_; } | 
|---|
| 101 |             inline float getAccelerationBack() const | 
|---|
| 102 |                 { return this->accelerationBack_; } | 
|---|
| 103 |             inline float getAccelerationLeftRight() const | 
|---|
| 104 |                 { return this->accelerationLeftRight_; } | 
|---|
| 105 |             inline float getAccelerationUpDown() const | 
|---|
| 106 |                 { return this->accelerationUpDown_; } | 
|---|
| 107 |  | 
|---|
| 108 |             inline float getSpeedAdd(void) | 
|---|
| 109 |                 { return this->speedAdd_; } | 
|---|
| 110 |             inline float getSpeedMultiply(void) | 
|---|
| 111 |                 { return this->speedMultiply_; } | 
|---|
| 112 |  | 
|---|
| 113 |             virtual const Vector3& getDirection() const; | 
|---|
| 114 |  | 
|---|
| 115 |             virtual const Vector3& getCarrierPosition(void); | 
|---|
| 116 |  | 
|---|
| 117 |             //TODO: Move to protected or private. How? | 
|---|
| 118 |             inline void setSpeedAdd(float speedAdd) | 
|---|
| 119 |                 { this->speedAdd_=speedAdd; } | 
|---|
| 120 |             inline void setSpeedMultiply(float speedMultiply) | 
|---|
| 121 |                 { this->speedMultiply_=speedMultiply; } | 
|---|
| 122 |  | 
|---|
| 123 |         protected: | 
|---|
| 124 |             virtual std::vector<PickupCarrier*>* getCarrierChildren(void) | 
|---|
| 125 |                 { return new std::vector<PickupCarrier*>(); } | 
|---|
| 126 |             virtual PickupCarrier* getCarrierParent(void); | 
|---|
| 127 |  | 
|---|
| 128 |         private: | 
|---|
| 129 |             void networkcallback_shipID(); | 
|---|
| 130 |  | 
|---|
| 131 |             SpaceShip* ship_; | 
|---|
| 132 |             unsigned int shipID_; | 
|---|
| 133 |  | 
|---|
| 134 |             float boostFactor_; | 
|---|
| 135 |             float speedFactor_; | 
|---|
| 136 |  | 
|---|
| 137 |             float speedAdd_; | 
|---|
| 138 |             float speedMultiply_; | 
|---|
| 139 |  | 
|---|
| 140 |             float maxSpeedFront_; | 
|---|
| 141 |             float maxSpeedBack_; | 
|---|
| 142 |             float maxSpeedLeftRight_; | 
|---|
| 143 |             float maxSpeedUpDown_; | 
|---|
| 144 |  | 
|---|
| 145 |             float accelerationFront_; | 
|---|
| 146 |             float accelerationBrake_; | 
|---|
| 147 |             float accelerationBack_; | 
|---|
| 148 |             float accelerationLeftRight_; | 
|---|
| 149 |             float accelerationUpDown_; | 
|---|
| 150 |  | 
|---|
| 151 |             Shader* boostBlur_; | 
|---|
| 152 |             float blurStrength_; | 
|---|
| 153 |     }; | 
|---|
| 154 | } | 
|---|
| 155 |  | 
|---|
| 156 | #endif /* _Engine_H__ */ | 
|---|