[608] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
[1056] | 3 | * > www.orxonox.net < |
---|
[608] | 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: |
---|
[670] | 23 | * Fabian 'x3n' Landau |
---|
[608] | 24 | * Co-authors: |
---|
[1264] | 25 | * Benjamin Knecht |
---|
[608] | 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
[786] | 29 | #include "OrxonoxStableHeaders.h" |
---|
[1039] | 30 | #include "SpaceShip.h" |
---|
[784] | 31 | |
---|
[715] | 32 | #include <string> |
---|
| 33 | |
---|
[708] | 34 | #include <OgreCamera.h> |
---|
| 35 | #include <OgreRenderWindow.h> |
---|
| 36 | #include <OgreParticleSystem.h> |
---|
| 37 | #include <OgreSceneNode.h> |
---|
[608] | 38 | |
---|
[1264] | 39 | #include "CameraHandler.h" |
---|
[1209] | 40 | #include "tinyxml/tinyxml.h" |
---|
[1219] | 41 | #include "ois/OIS.h" |
---|
[1064] | 42 | #include "util/Convert.h" |
---|
[742] | 43 | #include "util/Math.h" |
---|
[1021] | 44 | #include "core/CoreIncludes.h" |
---|
[1052] | 45 | #include "core/ConfigValueIncludes.h" |
---|
[1021] | 46 | #include "core/Debug.h" |
---|
[1032] | 47 | #include "GraphicsEngine.h" |
---|
[1024] | 48 | #include "core/InputManager.h" |
---|
[1021] | 49 | #include "particle/ParticleInterface.h" |
---|
[708] | 50 | #include "Projectile.h" |
---|
[871] | 51 | #include "core/XMLPort.h" |
---|
[1052] | 52 | #include "core/ConsoleCommand.h" |
---|
[1264] | 53 | #include "network/Client.h" |
---|
[608] | 54 | |
---|
| 55 | namespace orxonox |
---|
| 56 | { |
---|
[1052] | 57 | ConsoleCommand(SpaceShip, setMaxSpeedTest, AccessLevel::Debug, false); |
---|
| 58 | ConsoleCommandGeneric(test1, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed", AccessLevel::Debug), false); |
---|
| 59 | ConsoleCommandGeneric(test2, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber", AccessLevel::Debug), false); |
---|
| 60 | ConsoleCommandGeneric(test3, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setRofl", AccessLevel::Debug), false); |
---|
| 61 | |
---|
[608] | 62 | CreateFactory(SpaceShip); |
---|
| 63 | |
---|
[1052] | 64 | SpaceShip* SpaceShip::instance_s; |
---|
| 65 | |
---|
[1318] | 66 | SpaceShip *SpaceShip::getLocalShip(){ |
---|
| 67 | Iterator<SpaceShip> it; |
---|
| 68 | for(it = ObjectList<SpaceShip>::start(); it; ++it){ |
---|
| 69 | if((it)->server_ || ( network::Client::getSingleton() && network::Client::getSingleton()->getShipID()==it->objectID ) ) |
---|
| 70 | return *it; |
---|
| 71 | } |
---|
| 72 | return NULL; |
---|
| 73 | } |
---|
| 74 | |
---|
[1265] | 75 | SpaceShip::SpaceShip() : |
---|
| 76 | //testvector_(0,0,0), |
---|
| 77 | //bInvertYAxis_(false), |
---|
| 78 | setMouseEventCallback_(false), |
---|
| 79 | bLMousePressed_(false), |
---|
| 80 | bRMousePressed_(false), |
---|
| 81 | camNode_(0), |
---|
| 82 | cam_(0), |
---|
| 83 | camName_("CamNode"), |
---|
| 84 | tt_(0), |
---|
[1273] | 85 | redNode_(0), |
---|
[1265] | 86 | greenNode_(0), |
---|
| 87 | blinkTime_(0.0f), |
---|
| 88 | chNearNode_(0), |
---|
| 89 | chFarNode_(0), |
---|
| 90 | timeToReload_(0.0f), |
---|
| 91 | //reloadTime_(0.0f), |
---|
| 92 | maxSideAndBackSpeed_(0.0f), |
---|
| 93 | maxSpeed_(0.0f), |
---|
| 94 | maxRotation_(0.0f), |
---|
| 95 | translationAcceleration_(0.0f), |
---|
| 96 | rotationAcceleration_(0.0f), |
---|
| 97 | translationDamping_(0.0f), |
---|
| 98 | rotationDamping_(0.0f), |
---|
| 99 | maxRotationRadian_(0), |
---|
| 100 | rotationAccelerationRadian_(0), |
---|
| 101 | rotationDampingRadian_(0), |
---|
| 102 | zeroRadian_(0), |
---|
| 103 | mouseXRotation_(0), |
---|
| 104 | mouseYRotation_(0), |
---|
| 105 | mouseX_(0.0f), |
---|
| 106 | mouseY_(0.0f), |
---|
| 107 | emitterRate_(0.0f), |
---|
| 108 | server_(false) |
---|
[608] | 109 | { |
---|
[1264] | 110 | RegisterObject(SpaceShip); |
---|
| 111 | this->registerAllVariables(); |
---|
| 112 | |
---|
[1052] | 113 | SpaceShip::instance_s = this; |
---|
| 114 | |
---|
[1264] | 115 | this->setConfigValues(); |
---|
| 116 | |
---|
[1289] | 117 | |
---|
[647] | 118 | this->setRotationAxis(1, 0, 0); |
---|
| 119 | this->setStatic(false); |
---|
[608] | 120 | |
---|
| 121 | COUT(3) << "Info: SpaceShip was loaded" << std::endl; |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | SpaceShip::~SpaceShip() |
---|
| 125 | { |
---|
[647] | 126 | if (this->tt_) |
---|
| 127 | delete this->tt_; |
---|
[1284] | 128 | if(setMouseEventCallback_) |
---|
| 129 | InputManager::removeMouseHandler("SpaceShip"); |
---|
[1289] | 130 | if (this->cam_) |
---|
| 131 | delete this->cam_; |
---|
[608] | 132 | } |
---|
| 133 | |
---|
[1021] | 134 | bool SpaceShip::create(){ |
---|
| 135 | if(Model::create()) |
---|
| 136 | this->init(); |
---|
| 137 | else |
---|
| 138 | return false; |
---|
| 139 | return true; |
---|
| 140 | } |
---|
[1056] | 141 | |
---|
[1021] | 142 | void SpaceShip::registerAllVariables(){ |
---|
[1264] | 143 | registerVar( &camName_, camName_.length()+1, network::STRING, 0x1); |
---|
| 144 | registerVar( &maxSpeed_, sizeof(maxSpeed_), network::DATA, 0x1); |
---|
| 145 | registerVar( &maxSideAndBackSpeed_, sizeof(maxSideAndBackSpeed_), network::DATA, 0x1); |
---|
| 146 | registerVar( &maxRotation_, sizeof(maxRotation_), network::DATA, 0x1); |
---|
| 147 | registerVar( &translationAcceleration_, sizeof(translationAcceleration_), network::DATA, 0x1); |
---|
| 148 | registerVar( &rotationAcceleration_, sizeof(rotationAcceleration_), network::DATA, 0x1); |
---|
| 149 | registerVar( &rotationAccelerationRadian_, sizeof(rotationAccelerationRadian_), network::DATA, 0x1); |
---|
| 150 | registerVar( &translationDamping_, sizeof(translationDamping_), network::DATA, 0x1); |
---|
| 151 | registerVar( &rotationDamping_, sizeof(rotationDamping_), network::DATA, 0x1); |
---|
| 152 | registerVar( &rotationDampingRadian_, sizeof(rotationDampingRadian_), network::DATA, 0x1); |
---|
[1056] | 153 | |
---|
[1021] | 154 | } |
---|
[1056] | 155 | |
---|
[871] | 156 | void SpaceShip::init() |
---|
[697] | 157 | { |
---|
[1291] | 158 | if ((server_ || ( network::Client::getSingleton() && network::Client::getSingleton()->getShipID()==objectID ) )) |
---|
| 159 | { |
---|
| 160 | if (!setMouseEventCallback_) |
---|
| 161 | { |
---|
| 162 | InputManager::addMouseHandler(this, "SpaceShip"); |
---|
[1299] | 163 | InputManager::enableMouseHandler("SpaceShip"); |
---|
[1291] | 164 | setMouseEventCallback_ = true; |
---|
| 165 | } |
---|
| 166 | } |
---|
[1263] | 167 | |
---|
[633] | 168 | // START CREATING THRUSTER |
---|
[1032] | 169 | this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow"); |
---|
[647] | 170 | this->tt_->getParticleSystem()->setParameter("local_space","true"); |
---|
[978] | 171 | this->tt_->newEmitter(); |
---|
[608] | 172 | /* |
---|
[647] | 173 | this->tt_->setDirection(Vector3(0,0,1)); |
---|
| 174 | this->tt_->setPositionOfEmitter(0, Vector3(20,-1,-15)); |
---|
| 175 | this->tt_->setPositionOfEmitter(1, Vector3(-20,-1,-15)); |
---|
[608] | 176 | */ |
---|
[647] | 177 | this->tt_->setDirection(Vector3(-1,0,0)); |
---|
[978] | 178 | this->tt_->setPositionOfEmitter(0, Vector3(-15,20,-1)); |
---|
| 179 | this->tt_->setPositionOfEmitter(1, Vector3(-15,-20,-1)); |
---|
[647] | 180 | this->tt_->setVelocity(50); |
---|
[608] | 181 | |
---|
[633] | 182 | emitterRate_ = tt_->getRate(); |
---|
[626] | 183 | |
---|
[633] | 184 | Ogre::SceneNode* node2 = this->getNode()->createChildSceneNode(this->getName() + "particle2"); |
---|
| 185 | node2->setInheritScale(false); |
---|
| 186 | tt_->addToSceneNode(node2); |
---|
| 187 | // END CREATING THRUSTER |
---|
[608] | 188 | |
---|
[633] | 189 | // START CREATING BLINKING LIGHTS |
---|
| 190 | this->redBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1); |
---|
| 191 | this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1); |
---|
[608] | 192 | |
---|
[1275] | 193 | this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.3, 4.0, -0.3)); |
---|
[633] | 194 | this->redNode_->setInheritScale(false); |
---|
[1275] | 195 | this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.3, -4.0, -0.3)); |
---|
[633] | 196 | this->greenNode_->setInheritScale(false); |
---|
[608] | 197 | |
---|
[633] | 198 | this->redNode_->attachObject(this->redBillboard_.getBillboardSet()); |
---|
| 199 | this->redNode_->setScale(0.3, 0.3, 0.3); |
---|
[608] | 200 | |
---|
[633] | 201 | this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet()); |
---|
| 202 | this->greenNode_->setScale(0.3, 0.3, 0.3); |
---|
| 203 | // END CREATING BLINKING LIGHTS |
---|
[608] | 204 | |
---|
[661] | 205 | // START of testing crosshair |
---|
| 206 | this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); |
---|
| 207 | this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); |
---|
[608] | 208 | |
---|
[661] | 209 | this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0)); |
---|
| 210 | this->chNearNode_->setInheritScale(false); |
---|
| 211 | this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0)); |
---|
| 212 | this->chFarNode_->setInheritScale(false); |
---|
| 213 | |
---|
| 214 | this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet()); |
---|
| 215 | this->chNearNode_->setScale(0.2, 0.2, 0.2); |
---|
| 216 | |
---|
| 217 | this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet()); |
---|
| 218 | this->chFarNode_->setScale(0.4, 0.4, 0.4); |
---|
| 219 | |
---|
[1264] | 220 | createCamera(); |
---|
[661] | 221 | // END of testing crosshair |
---|
[871] | 222 | } |
---|
[661] | 223 | |
---|
[871] | 224 | void SpaceShip::setConfigValues() |
---|
| 225 | { |
---|
| 226 | SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down)."); |
---|
| 227 | SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds"); |
---|
| 228 | SetConfigValue(testvector_, Vector3()).description("asdfblah"); |
---|
| 229 | } |
---|
| 230 | |
---|
| 231 | void SpaceShip::loadParams(TiXmlElement* xmlElem) |
---|
| 232 | { |
---|
| 233 | Model::loadParams(xmlElem); |
---|
[1021] | 234 | this->create(); |
---|
[1264] | 235 | this->getFocus(); |
---|
[647] | 236 | /* |
---|
[608] | 237 | if (xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft")) |
---|
| 238 | { |
---|
[715] | 239 | std::string forwardStr = xmlElem->Attribute("forward"); |
---|
| 240 | std::string rotateupdownStr = xmlElem->Attribute("rotateupdown"); |
---|
| 241 | std::string rotaterightleftStr = xmlElem->Attribute("rotaterightleft"); |
---|
| 242 | std::string looprightleftStr = xmlElem->Attribute("looprightleft"); |
---|
[608] | 243 | |
---|
| 244 | String2Number<float>(this->maxSpeedForward_, forwardStr); |
---|
| 245 | String2Number<float>(this->maxSpeedRotateUpDown_, rotateupdownStr); |
---|
| 246 | String2Number<float>(this->maxSpeedRotateRightLeft_, rotaterightleftStr); |
---|
| 247 | String2Number<float>(this->maxSpeedLoopRightLeft_, looprightleftStr); |
---|
| 248 | |
---|
| 249 | COUT(4) << "Loader: Initialized spaceship steering with values " << maxSpeedForward_ << " " << maxSpeedRotateUpDown_ << " " << maxSpeedRotateRightLeft_ << " " << maxSpeedLoopRightLeft_ << " " << std::endl; |
---|
[1272] | 250 | } |
---|
[647] | 251 | */ |
---|
| 252 | if (xmlElem->Attribute("maxSpeed") && xmlElem->Attribute("maxSideAndBackSpeed") && xmlElem->Attribute("maxRotation") && xmlElem->Attribute("transAcc") && xmlElem->Attribute("rotAcc") && xmlElem->Attribute("transDamp") && xmlElem->Attribute("rotDamp")) |
---|
| 253 | { |
---|
[608] | 254 | |
---|
[715] | 255 | std::string msStr = xmlElem->Attribute("maxSpeed"); |
---|
| 256 | std::string msabsStr = xmlElem->Attribute("maxSideAndBackSpeed"); |
---|
| 257 | std::string mrStr = xmlElem->Attribute("maxRotation"); |
---|
| 258 | std::string taStr = xmlElem->Attribute("transAcc"); |
---|
| 259 | std::string raStr = xmlElem->Attribute("rotAcc"); |
---|
| 260 | std::string tdStr = xmlElem->Attribute("transDamp"); |
---|
| 261 | std::string rdStr = xmlElem->Attribute("rotDamp"); |
---|
[647] | 262 | |
---|
[1064] | 263 | convertValue<std::string, float>(&this->maxSpeed_, msStr); |
---|
| 264 | convertValue<std::string, float>(&this->maxSideAndBackSpeed_, msabsStr); |
---|
| 265 | convertValue<std::string, float>(&this->maxRotation_, mrStr); |
---|
| 266 | convertValue<std::string, float>(&this->translationAcceleration_, taStr); |
---|
| 267 | convertValue<std::string, float>(&this->rotationAcceleration_, raStr); |
---|
| 268 | convertValue<std::string, float>(&this->translationDamping_, tdStr); |
---|
| 269 | convertValue<std::string, float>(&this->rotationDamping_, rdStr); |
---|
[647] | 270 | |
---|
| 271 | this->maxRotationRadian_ = Radian(this->maxRotation_); |
---|
| 272 | this->rotationAccelerationRadian_ = Radian(this->rotationAcceleration_); |
---|
| 273 | this->rotationDampingRadian_ = Radian(this->rotationDamping_); |
---|
| 274 | |
---|
| 275 | COUT(4) << "Loader: Initialized SpaceShip" << std::endl; |
---|
[1272] | 276 | } |
---|
[647] | 277 | |
---|
[1272] | 278 | if (xmlElem->Attribute("camera")) |
---|
| 279 | { |
---|
| 280 | this->setCamera(); |
---|
| 281 | } |
---|
[871] | 282 | } |
---|
| 283 | |
---|
| 284 | void SpaceShip::setCamera(const std::string& camera) |
---|
| 285 | { |
---|
[1264] | 286 | camName_=camera; |
---|
| 287 | // change camera attributes here, if you want to ;) |
---|
| 288 | } |
---|
| 289 | |
---|
| 290 | void SpaceShip::getFocus(){ |
---|
| 291 | COUT(4) << "requesting focus" << std::endl; |
---|
| 292 | if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID) |
---|
| 293 | CameraHandler::getInstance()->requestFocus(cam_); |
---|
| 294 | |
---|
| 295 | } |
---|
| 296 | |
---|
| 297 | void SpaceShip::createCamera(){ |
---|
| 298 | // COUT(4) << "begin camera creation" << std::endl; |
---|
| 299 | this->camNode_ = this->getNode()->createChildSceneNode(camName_); |
---|
| 300 | COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl; |
---|
[1289] | 301 | this->camNode_->setPosition(Vector3(-50,0,10)); |
---|
| 302 | Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0)); |
---|
| 303 | Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1)); |
---|
| 304 | camNode_->setOrientation(q1*q2); |
---|
[1264] | 305 | COUT(4) << "position: (cam)" << this->camNode_->getPosition() << std::endl; |
---|
| 306 | cam_ = new Camera(this->camNode_); |
---|
[608] | 307 | |
---|
[1264] | 308 | cam_->setTargetNode(this->getNode()); |
---|
[871] | 309 | // cam->setPosition(Vector3(0,-350,0)); |
---|
[1264] | 310 | if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){ |
---|
| 311 | this->setBacksync(true); |
---|
| 312 | CameraHandler::getInstance()->requestFocus(cam_); |
---|
| 313 | } |
---|
[608] | 314 | |
---|
| 315 | } |
---|
| 316 | |
---|
[871] | 317 | void SpaceShip::setMaxSpeed(float value) |
---|
| 318 | { this->maxSpeed_ = value; } |
---|
| 319 | void SpaceShip::setMaxSideAndBackSpeed(float value) |
---|
| 320 | { this->maxSideAndBackSpeed_ = value; } |
---|
| 321 | void SpaceShip::setMaxRotation(float value) |
---|
| 322 | { this->maxRotation_ = value; this->maxRotationRadian_ = Radian(value); } |
---|
| 323 | void SpaceShip::setTransAcc(float value) |
---|
| 324 | { this->translationAcceleration_ = value; } |
---|
| 325 | void SpaceShip::setRotAcc(float value) |
---|
| 326 | { this->rotationAcceleration_ = value; this->rotationAccelerationRadian_ = Radian(value); } |
---|
| 327 | void SpaceShip::setTransDamp(float value) |
---|
| 328 | { this->translationDamping_ = value; } |
---|
| 329 | void SpaceShip::setRotDamp(float value) |
---|
| 330 | { this->rotationDamping_ = value; this->rotationDampingRadian_ = Radian(value); } |
---|
| 331 | |
---|
| 332 | /** |
---|
| 333 | @brief XML loading and saving. |
---|
| 334 | @param xmlelement The XML-element |
---|
| 335 | @param loading Loading (true) or saving (false) |
---|
| 336 | @return The XML-element |
---|
| 337 | */ |
---|
[1052] | 338 | void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
[871] | 339 | { |
---|
[1052] | 340 | Model::XMLPort(xmlelement, mode); |
---|
[871] | 341 | |
---|
[1052] | 342 | XMLPortParamLoadOnly(SpaceShip, "camera", setCamera, xmlelement, mode); |
---|
| 343 | XMLPortParamLoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, mode); |
---|
| 344 | XMLPortParamLoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, mode); |
---|
| 345 | XMLPortParamLoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, mode); |
---|
| 346 | XMLPortParamLoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, mode); |
---|
| 347 | XMLPortParamLoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, mode); |
---|
| 348 | XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode); |
---|
| 349 | XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode); |
---|
[1264] | 350 | server_=true; // TODO: this is only a hack |
---|
| 351 | SpaceShip::create(); |
---|
| 352 | getFocus(); |
---|
[871] | 353 | } |
---|
| 354 | |
---|
[647] | 355 | int sgn(float x) |
---|
| 356 | { |
---|
| 357 | if (x >= 0) |
---|
| 358 | return 1; |
---|
| 359 | else |
---|
| 360 | return -1; |
---|
| 361 | } |
---|
| 362 | |
---|
[1272] | 363 | bool SpaceShip::mouseMoved(const MouseState& state) |
---|
[608] | 364 | { |
---|
[647] | 365 | /* |
---|
[608] | 366 | this->mouseX += e.state.X.rel; |
---|
| 367 | if (this->bInvertMouse_) |
---|
| 368 | this->mouseY += e.state.Y.rel; |
---|
| 369 | else |
---|
| 370 | this->mouseY -= e.state.Y.rel; |
---|
| 371 | |
---|
| 372 | // if(mouseX>maxMouseX) maxMouseX = mouseX; |
---|
| 373 | // if(mouseX<minMouseX) minMouseX = mouseX; |
---|
| 374 | // cout << "mouseX: " << mouseX << "\tmouseY: " << mouseY << endl; |
---|
| 375 | |
---|
| 376 | this->moved = true; |
---|
[647] | 377 | */ |
---|
[644] | 378 | if (this->bRMousePressed_) |
---|
| 379 | { |
---|
[1272] | 380 | this->camNode_->roll(Degree(-state.X.rel * 0.10)); |
---|
| 381 | this->camNode_->yaw(Degree(state.Y.rel * 0.10)); |
---|
[644] | 382 | } |
---|
[647] | 383 | else |
---|
| 384 | { |
---|
[1272] | 385 | float minDimension = state.height; |
---|
| 386 | if (state.width < minDimension) |
---|
| 387 | minDimension = state.width; |
---|
[644] | 388 | |
---|
[1272] | 389 | this->mouseX_ += state.X.rel; |
---|
[647] | 390 | if (this->mouseX_ < -minDimension) |
---|
| 391 | this->mouseX_ = -minDimension; |
---|
| 392 | if (this->mouseX_ > minDimension) |
---|
| 393 | this->mouseX_ = minDimension; |
---|
| 394 | |
---|
[1272] | 395 | this->mouseY_ += state.Y.rel; |
---|
[647] | 396 | if (this->mouseY_ < -minDimension) |
---|
| 397 | this->mouseY_ = -minDimension; |
---|
| 398 | if (this->mouseY_ > minDimension) |
---|
| 399 | this->mouseY_ = minDimension; |
---|
| 400 | |
---|
| 401 | float xRotation = this->mouseX_ / minDimension; |
---|
| 402 | xRotation = xRotation*xRotation * sgn(xRotation); |
---|
| 403 | xRotation *= -this->rotationAcceleration_; |
---|
| 404 | if (xRotation > this->maxRotation_) |
---|
| 405 | xRotation = this->maxRotation_; |
---|
| 406 | if (xRotation < -this->maxRotation_) |
---|
| 407 | xRotation = -this->maxRotation_; |
---|
| 408 | this->mouseXRotation_ = Radian(xRotation); |
---|
| 409 | |
---|
| 410 | float yRotation = this->mouseY_ / minDimension; |
---|
| 411 | yRotation = yRotation*yRotation * sgn(yRotation); |
---|
| 412 | yRotation *= this->rotationAcceleration_; |
---|
| 413 | if (yRotation > this->maxRotation_) |
---|
| 414 | yRotation = this->maxRotation_; |
---|
| 415 | if (yRotation < -this->maxRotation_) |
---|
| 416 | yRotation = -this->maxRotation_; |
---|
| 417 | this->mouseYRotation_ = Radian(yRotation); |
---|
| 418 | } |
---|
| 419 | |
---|
[608] | 420 | return true; |
---|
| 421 | } |
---|
| 422 | |
---|
[1272] | 423 | bool SpaceShip::mouseButtonPressed(const MouseState& state, MouseButton::Enum id) |
---|
[643] | 424 | { |
---|
[1272] | 425 | if (id == MouseButton::Left) |
---|
[644] | 426 | this->bLMousePressed_ = true; |
---|
[1272] | 427 | else if (id == MouseButton::Right) |
---|
[644] | 428 | this->bRMousePressed_ = true; |
---|
[643] | 429 | |
---|
| 430 | return true; |
---|
| 431 | } |
---|
| 432 | |
---|
[1272] | 433 | bool SpaceShip::mouseButtonReleased(const MouseState& state, MouseButton::Enum id) |
---|
[643] | 434 | { |
---|
[1272] | 435 | if (id == MouseButton::Left) |
---|
[644] | 436 | this->bLMousePressed_ = false; |
---|
[1272] | 437 | else if (id == MouseButton::Right) |
---|
[644] | 438 | { |
---|
| 439 | this->bRMousePressed_ = false; |
---|
| 440 | this->camNode_->resetOrientation(); |
---|
| 441 | } |
---|
| 442 | |
---|
| 443 | return true; |
---|
[643] | 444 | } |
---|
| 445 | |
---|
[608] | 446 | void SpaceShip::tick(float dt) |
---|
| 447 | { |
---|
[1289] | 448 | if (this->cam_) |
---|
| 449 | this->cam_->tick(dt); |
---|
| 450 | |
---|
[633] | 451 | if (this->redNode_ && this->greenNode_) |
---|
| 452 | { |
---|
| 453 | this->blinkTime_ += dt; |
---|
| 454 | float redScale = 0.15 + 0.15 * sin(this->blinkTime_ * 10.0); |
---|
| 455 | float greenScale = 0.15 - 0.15 * sin(this->blinkTime_ * 10.0); |
---|
| 456 | this->redNode_->setScale(redScale, redScale, redScale); |
---|
| 457 | this->greenNode_->setScale(greenScale, greenScale, greenScale); |
---|
| 458 | } |
---|
| 459 | |
---|
[643] | 460 | if (this->timeToReload_ > 0) |
---|
| 461 | this->timeToReload_ -= dt; |
---|
| 462 | else |
---|
| 463 | this->timeToReload_ = 0; |
---|
| 464 | |
---|
[644] | 465 | if (this->bLMousePressed_ && this->timeToReload_ <= 0) |
---|
[643] | 466 | { |
---|
[1306] | 467 | |
---|
[1264] | 468 | Projectile *p = new Projectile(this); |
---|
[1306] | 469 | |
---|
[1264] | 470 | p->setBacksync(true); |
---|
[643] | 471 | this->timeToReload_ = this->reloadTime_; |
---|
| 472 | } |
---|
| 473 | |
---|
[608] | 474 | |
---|
[647] | 475 | // ##################################### |
---|
| 476 | // ############# STEERING ############## |
---|
| 477 | // ##################################### |
---|
| 478 | |
---|
| 479 | if (this->velocity_.x > this->maxSpeed_) |
---|
| 480 | this->velocity_.x = this->maxSpeed_; |
---|
| 481 | if (this->velocity_.x < -this->maxSideAndBackSpeed_) |
---|
| 482 | this->velocity_.x = -this->maxSideAndBackSpeed_; |
---|
| 483 | if (this->velocity_.y > this->maxSideAndBackSpeed_) |
---|
| 484 | this->velocity_.y = this->maxSideAndBackSpeed_; |
---|
| 485 | if (this->velocity_.y < -this->maxSideAndBackSpeed_) |
---|
| 486 | this->velocity_.y = -this->maxSideAndBackSpeed_; |
---|
| 487 | if (this->rotationRate_ > this->maxRotationRadian_) |
---|
| 488 | this->rotationRate_ = this->maxRotationRadian_; |
---|
| 489 | if (this->rotationRate_ < -this->maxRotationRadian_) |
---|
| 490 | this->rotationRate_ = -this->maxRotationRadian_; |
---|
| 491 | |
---|
| 492 | if (this->acceleration_.x == 0) |
---|
| 493 | { |
---|
| 494 | if (this->velocity_.x > 0) |
---|
| 495 | { |
---|
| 496 | this->velocity_.x -= (this->translationDamping_ * dt); |
---|
| 497 | if (this->velocity_.x < 0) |
---|
| 498 | this->velocity_.x = 0; |
---|
| 499 | } |
---|
| 500 | else if (this->velocity_.x < 0) |
---|
| 501 | { |
---|
| 502 | this->velocity_.x += (this->translationDamping_ * dt); |
---|
| 503 | if (this->velocity_.x > 0) |
---|
| 504 | this->velocity_.x = 0; |
---|
| 505 | } |
---|
| 506 | } |
---|
| 507 | |
---|
| 508 | if (this->acceleration_.y == 0) |
---|
| 509 | { |
---|
| 510 | if (this->velocity_.y > 0) |
---|
| 511 | { |
---|
| 512 | this->velocity_.y -= (this->translationDamping_ * dt); |
---|
| 513 | if (this->velocity_.y < 0) |
---|
| 514 | this->velocity_.y = 0; |
---|
| 515 | } |
---|
| 516 | else if (this->velocity_.y < 0) |
---|
| 517 | { |
---|
| 518 | this->velocity_.y += (this->translationDamping_ * dt); |
---|
| 519 | if (this->velocity_.y > 0) |
---|
| 520 | this->velocity_.y = 0; |
---|
| 521 | } |
---|
| 522 | } |
---|
| 523 | |
---|
| 524 | if (this->momentum_ == this->zeroRadian_) |
---|
| 525 | { |
---|
| 526 | if (this->rotationRate_ > this->zeroRadian_) |
---|
| 527 | { |
---|
| 528 | this->rotationRate_ -= (this->rotationDampingRadian_ * dt); |
---|
| 529 | if (this->rotationRate_ < this->zeroRadian_) |
---|
| 530 | this->rotationRate_ = 0; |
---|
| 531 | } |
---|
| 532 | else if (this->rotationRate_ < this->zeroRadian_) |
---|
| 533 | { |
---|
| 534 | this->rotationRate_ += (this->rotationDampingRadian_ * dt); |
---|
| 535 | if (this->rotationRate_ > this->zeroRadian_) |
---|
| 536 | this->rotationRate_ = 0; |
---|
| 537 | } |
---|
| 538 | } |
---|
| 539 | |
---|
[1272] | 540 | if( (network::Client::getSingleton() && network::Client::getSingleton()->getShipID() == objectID) || server_ ) |
---|
| 541 | { |
---|
| 542 | COUT(4) << "steering our ship: " << objectID << std::endl; |
---|
| 543 | if (InputManager::isKeyDown(KeyCode::Up) || InputManager::isKeyDown(KeyCode::W)) |
---|
[647] | 544 | this->acceleration_.x = this->translationAcceleration_; |
---|
[1272] | 545 | else if(InputManager::isKeyDown(KeyCode::Down) || InputManager::isKeyDown(KeyCode::S)) |
---|
[647] | 546 | this->acceleration_.x = -this->translationAcceleration_; |
---|
[1264] | 547 | else |
---|
[647] | 548 | this->acceleration_.x = 0; |
---|
| 549 | |
---|
[1272] | 550 | if (InputManager::isKeyDown(KeyCode::Right) || InputManager::isKeyDown(KeyCode::D)) |
---|
[647] | 551 | this->acceleration_.y = -this->translationAcceleration_; |
---|
[1272] | 552 | else if (InputManager::isKeyDown(KeyCode::Left) || InputManager::isKeyDown(KeyCode::A)) |
---|
[647] | 553 | this->acceleration_.y = this->translationAcceleration_; |
---|
[1264] | 554 | else |
---|
[647] | 555 | this->acceleration_.y = 0; |
---|
| 556 | |
---|
[1272] | 557 | if (InputManager::isKeyDown(KeyCode::Delete) || InputManager::isKeyDown(KeyCode::Q)) |
---|
[647] | 558 | this->momentum_ = Radian(-this->rotationAccelerationRadian_); |
---|
[1272] | 559 | else if (InputManager::isKeyDown(KeyCode::PageDown) || InputManager::isKeyDown(KeyCode::E)) |
---|
[647] | 560 | this->momentum_ = Radian(this->rotationAccelerationRadian_); |
---|
[1264] | 561 | else |
---|
[647] | 562 | this->momentum_ = 0; |
---|
[1264] | 563 | }/*else |
---|
| 564 | COUT(4) << "not steering ship: " << objectID << " our ship: " << network::Client::getSingleton()->getShipID() << std::endl;*/ |
---|
[647] | 565 | |
---|
| 566 | WorldEntity::tick(dt); |
---|
| 567 | |
---|
| 568 | this->roll(this->mouseXRotation_ * dt); |
---|
| 569 | if (this->bInvertYAxis_) |
---|
| 570 | this->yaw(Radian(-this->mouseYRotation_ * dt)); |
---|
| 571 | else |
---|
| 572 | this->yaw(Radian(this->mouseYRotation_ * dt)); |
---|
| 573 | |
---|
| 574 | if (this->acceleration_.x > 0) |
---|
| 575 | this->tt_->setRate(emitterRate_); |
---|
| 576 | else |
---|
| 577 | this->tt_->setRate(0); |
---|
| 578 | |
---|
| 579 | /* |
---|
| 580 | if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) |
---|
[608] | 581 | this->moveForward(speed); |
---|
| 582 | else |
---|
| 583 | this->moveForward(0); |
---|
| 584 | |
---|
| 585 | if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S)) |
---|
| 586 | this->brakeForward(speed); |
---|
| 587 | else |
---|
| 588 | this->brakeForward(speed/10); |
---|
| 589 | |
---|
| 590 | if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) |
---|
| 591 | this->loopRight(loop); |
---|
| 592 | else |
---|
| 593 | this->loopRight(0); |
---|
| 594 | |
---|
| 595 | if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A)) |
---|
| 596 | this->loopLeft(loop); |
---|
| 597 | else |
---|
| 598 | this->loopLeft(0); |
---|
| 599 | |
---|
| 600 | if(moved) |
---|
| 601 | { |
---|
| 602 | if (mouseY<=0) |
---|
| 603 | this->rotateUp(-mouseY*rotate); |
---|
| 604 | if (mouseY>0) |
---|
| 605 | this->rotateDown(mouseY*rotate); |
---|
| 606 | if (mouseX>0) |
---|
| 607 | this->rotateRight(mouseX*rotate); |
---|
| 608 | if (mouseX<=0) |
---|
| 609 | this->rotateLeft(-mouseX*rotate); |
---|
| 610 | |
---|
| 611 | mouseY = 0; |
---|
| 612 | mouseX = 0; |
---|
| 613 | moved = false; |
---|
[647] | 614 | }*/ |
---|
| 615 | /* else |
---|
[608] | 616 | { |
---|
| 617 | this->rotateUp(0); |
---|
| 618 | this->rotateDown(0); |
---|
| 619 | this->rotateRight(0); |
---|
| 620 | this->rotateLeft(0); |
---|
[647] | 621 | }*/ |
---|
| 622 | /* |
---|
[608] | 623 | if(moveForward_ > 0) |
---|
| 624 | { |
---|
| 625 | accelerationForward_ = moveForward_; |
---|
| 626 | if(speedForward_ < maxSpeedForward_) |
---|
| 627 | speedForward_ += accelerationForward_*dt; |
---|
| 628 | if(speedForward_ > maxSpeedForward_) |
---|
| 629 | speedForward_ = maxSpeedForward_; |
---|
| 630 | } |
---|
| 631 | |
---|
| 632 | if(moveForward_ <= 0) |
---|
| 633 | { |
---|
[626] | 634 | accelerationForward_ = -brakeForward_; |
---|
[608] | 635 | if(speedForward_ > 0) |
---|
[626] | 636 | speedForward_ += accelerationForward_*dt; |
---|
[608] | 637 | if(speedForward_ < 0) |
---|
| 638 | speedForward_ = 0; |
---|
| 639 | } |
---|
| 640 | |
---|
| 641 | if(rotateUp_ > 0) |
---|
| 642 | { |
---|
| 643 | accelerationRotateUpDown_ = rotateUp_; |
---|
| 644 | if(speedRotateUpDown_ < maxSpeedRotateUpDown_) |
---|
| 645 | speedRotateUpDown_ += accelerationRotateUpDown_*dt; |
---|
| 646 | if(speedRotateUpDown_ > maxSpeedRotateUpDown_) |
---|
| 647 | speedRotateUpDown_ = maxSpeedRotateUpDown_; |
---|
| 648 | } |
---|
| 649 | |
---|
| 650 | if(rotateDown_ > 0) |
---|
| 651 | { |
---|
| 652 | accelerationRotateUpDown_ = rotateDown_; |
---|
| 653 | if(speedRotateUpDown_ > -maxSpeedRotateUpDown_) |
---|
| 654 | speedRotateUpDown_ -= accelerationRotateUpDown_*dt; |
---|
| 655 | if(speedRotateUpDown_ < -maxSpeedRotateUpDown_) |
---|
| 656 | speedRotateUpDown_ = -maxSpeedRotateUpDown_; |
---|
| 657 | } |
---|
| 658 | |
---|
| 659 | if(rotateUp_ == 0 && rotateDown_ == 0) |
---|
| 660 | { |
---|
| 661 | accelerationRotateUpDown_ = brakeRotate_; |
---|
| 662 | if(speedRotateUpDown_ > 0) |
---|
| 663 | speedRotateUpDown_ -= accelerationRotateUpDown_*dt; |
---|
| 664 | if(speedRotateUpDown_ < 0) |
---|
| 665 | speedRotateUpDown_ += accelerationRotateUpDown_*dt; |
---|
| 666 | if(fabs(speedRotateUpDown_) < accelerationRotateUpDown_*dt) |
---|
| 667 | speedRotateUpDown_ = 0; |
---|
| 668 | } |
---|
| 669 | |
---|
| 670 | if(rotateRight_ > 0) |
---|
| 671 | { |
---|
| 672 | accelerationRotateRightLeft_ = rotateRight_; |
---|
| 673 | if(speedRotateRightLeft_ > -maxSpeedRotateRightLeft_) |
---|
| 674 | speedRotateRightLeft_ -= accelerationRotateRightLeft_*dt; |
---|
| 675 | if(speedRotateRightLeft_ < -maxSpeedRotateRightLeft_) |
---|
| 676 | speedRotateRightLeft_ = -maxSpeedRotateRightLeft_; |
---|
| 677 | } |
---|
| 678 | |
---|
| 679 | if(rotateLeft_ > 0) |
---|
| 680 | { |
---|
| 681 | accelerationRotateRightLeft_ = rotateLeft_; |
---|
| 682 | if(speedRotateRightLeft_ < maxSpeedRotateRightLeft_) |
---|
| 683 | speedRotateRightLeft_ += accelerationRotateRightLeft_*dt; |
---|
| 684 | if(speedRotateRightLeft_ > maxSpeedRotateRightLeft_) |
---|
| 685 | speedRotateRightLeft_ = maxSpeedRotateRightLeft_; |
---|
| 686 | } |
---|
| 687 | |
---|
| 688 | if(rotateRight_ == 0 && rotateLeft_ == 0) |
---|
| 689 | { |
---|
| 690 | accelerationRotateRightLeft_ = brakeRotate_; |
---|
| 691 | if(speedRotateRightLeft_ > 0) |
---|
| 692 | speedRotateRightLeft_ -= accelerationRotateRightLeft_*dt; |
---|
| 693 | if(speedRotateRightLeft_ < 0) |
---|
| 694 | speedRotateRightLeft_ += accelerationRotateRightLeft_*dt; |
---|
| 695 | if(fabs(speedRotateRightLeft_) < accelerationRotateRightLeft_*dt) |
---|
| 696 | speedRotateRightLeft_ = 0; |
---|
| 697 | } |
---|
| 698 | |
---|
| 699 | if(loopRight_ > 0) |
---|
| 700 | { |
---|
| 701 | accelerationLoopRightLeft_ = loopRight_; |
---|
| 702 | if(speedLoopRightLeft_ < maxSpeedLoopRightLeft_) |
---|
| 703 | speedLoopRightLeft_ += accelerationLoopRightLeft_*dt; |
---|
| 704 | if(speedLoopRightLeft_ > maxSpeedLoopRightLeft_) |
---|
| 705 | speedLoopRightLeft_ = maxSpeedLoopRightLeft_; |
---|
| 706 | } |
---|
| 707 | |
---|
| 708 | if(loopLeft_ > 0) |
---|
| 709 | { |
---|
| 710 | accelerationLoopRightLeft_ = loopLeft_; |
---|
| 711 | if(speedLoopRightLeft_ > -maxSpeedLoopRightLeft_) |
---|
| 712 | speedLoopRightLeft_ -= accelerationLoopRightLeft_*dt; |
---|
| 713 | if(speedLoopRightLeft_ < -maxSpeedLoopRightLeft_) |
---|
| 714 | speedLoopRightLeft_ = -maxSpeedLoopRightLeft_; |
---|
| 715 | } |
---|
| 716 | |
---|
| 717 | if(loopLeft_ == 0 && loopRight_ == 0) |
---|
| 718 | { |
---|
| 719 | accelerationLoopRightLeft_ = brakeLoop_; |
---|
| 720 | if(speedLoopRightLeft_ > 0) |
---|
| 721 | speedLoopRightLeft_ -= accelerationLoopRightLeft_*dt; |
---|
| 722 | if(speedLoopRightLeft_ < 0) |
---|
| 723 | speedLoopRightLeft_ += accelerationLoopRightLeft_*dt; |
---|
| 724 | if(fabs(speedLoopRightLeft_) < accelerationLoopRightLeft_*dt) |
---|
| 725 | speedLoopRightLeft_ = 0; |
---|
| 726 | } |
---|
| 727 | |
---|
| 728 | Vector3 transVector = Vector3::ZERO; |
---|
[647] | 729 | */ |
---|
[608] | 730 | /* |
---|
| 731 | transVector.z = 1; |
---|
| 732 | this->translate(transVector*speedForward_*dt, Ogre::Node::TS_LOCAL); |
---|
| 733 | this->pitch(Degree(speedRotateUpDown_*dt), Ogre::Node::TS_LOCAL); |
---|
| 734 | this->yaw(Degree(speedRotateRightLeft_*dt), Ogre::Node::TS_LOCAL); |
---|
| 735 | this->roll(Degree(speedLoopRightLeft_*dt), Ogre::Node::TS_LOCAL); |
---|
| 736 | */ |
---|
[647] | 737 | /* |
---|
[608] | 738 | transVector.x = 1; |
---|
| 739 | this->translate(transVector*speedForward_*dt, Ogre::Node::TS_LOCAL); |
---|
| 740 | this->yaw(Degree(speedRotateUpDown_*dt), Ogre::Node::TS_LOCAL); |
---|
| 741 | this->roll(Degree(speedRotateRightLeft_*dt), Ogre::Node::TS_LOCAL); |
---|
| 742 | this->pitch(Degree(speedLoopRightLeft_*dt), Ogre::Node::TS_LOCAL); |
---|
[647] | 743 | */ |
---|
[608] | 744 | } |
---|
[647] | 745 | /* |
---|
[608] | 746 | void SpaceShip::moveForward(float moveForward) { |
---|
| 747 | moveForward_ = moveForward; |
---|
| 748 | } |
---|
| 749 | |
---|
| 750 | void SpaceShip::rotateUp(float rotateUp) { |
---|
| 751 | rotateUp_ = rotateUp; |
---|
| 752 | } |
---|
| 753 | |
---|
| 754 | void SpaceShip::rotateDown(float rotateDown) { |
---|
| 755 | rotateDown_ = rotateDown; |
---|
| 756 | } |
---|
| 757 | |
---|
| 758 | void SpaceShip::rotateLeft(float rotateLeft) { |
---|
| 759 | rotateLeft_ = rotateLeft; |
---|
| 760 | } |
---|
| 761 | |
---|
| 762 | void SpaceShip::rotateRight(float rotateRight) { |
---|
| 763 | rotateRight_ = rotateRight; |
---|
| 764 | } |
---|
| 765 | |
---|
| 766 | void SpaceShip::loopLeft(float loopLeft) { |
---|
| 767 | loopLeft_ = loopLeft; |
---|
| 768 | } |
---|
| 769 | |
---|
| 770 | void SpaceShip::loopRight(float loopRight) { |
---|
| 771 | loopRight_ = loopRight; |
---|
| 772 | } |
---|
| 773 | |
---|
| 774 | void SpaceShip::brakeForward(float brakeForward) { |
---|
| 775 | brakeForward_ = brakeForward; |
---|
| 776 | } |
---|
| 777 | |
---|
| 778 | void SpaceShip::brakeRotate(float brakeRotate) { |
---|
| 779 | brakeRotate_ = brakeRotate; |
---|
| 780 | } |
---|
| 781 | |
---|
| 782 | void SpaceShip::brakeLoop(float brakeLoop) { |
---|
| 783 | brakeLoop_ = brakeLoop; |
---|
| 784 | } |
---|
| 785 | |
---|
| 786 | void SpaceShip::maxSpeedForward(float maxSpeedForward) { |
---|
| 787 | maxSpeedForward_ = maxSpeedForward; |
---|
| 788 | } |
---|
| 789 | |
---|
| 790 | void SpaceShip::maxSpeedRotateUpDown(float maxSpeedRotateUpDown) { |
---|
| 791 | maxSpeedRotateUpDown_ = maxSpeedRotateUpDown; |
---|
| 792 | } |
---|
| 793 | |
---|
| 794 | void SpaceShip::maxSpeedRotateRightLeft(float maxSpeedRotateRightLeft) { |
---|
| 795 | maxSpeedRotateRightLeft_ = maxSpeedRotateRightLeft; |
---|
| 796 | } |
---|
| 797 | |
---|
| 798 | void SpaceShip::maxSpeedLoopRightLeft(float maxSpeedLoopRightLeft) { |
---|
| 799 | maxSpeedLoopRightLeft_ = maxSpeedLoopRightLeft; |
---|
| 800 | } |
---|
[647] | 801 | */ |
---|
[608] | 802 | } |
---|