[Orxonox-commit 3900] r8574 - in code/branches/gameimmersion: data/defaultConfig src/orxonox/controllers src/orxonox/worldentities/pawns
dafrick at orxonox.net
dafrick at orxonox.net
Wed May 25 18:23:51 CEST 2011
Author: dafrick
Date: 2011-05-25 18:23:51 +0200 (Wed, 25 May 2011)
New Revision: 8574
Modified:
code/branches/gameimmersion/data/defaultConfig/keybindings.ini
code/branches/gameimmersion/src/orxonox/controllers/HumanController.cc
code/branches/gameimmersion/src/orxonox/controllers/HumanController.h
code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc
Log:
Reverting boost changes.
Modified: code/branches/gameimmersion/data/defaultConfig/keybindings.ini
===================================================================
--- code/branches/gameimmersion/data/defaultConfig/keybindings.ini 2011-05-25 16:08:21 UTC (rev 8573)
+++ code/branches/gameimmersion/data/defaultConfig/keybindings.ini 2011-05-25 16:23:51 UTC (rev 8574)
@@ -20,7 +20,7 @@
KeyDivide=
KeyDown="scale -1 moveFrontBack"
KeyE="scale -1 rotateRoll"
-KeyEnd=
+KeyEnd="boost"
KeyEquals=
KeyEscape="keyESC"
KeyF="scale -1 moveUpDown"
@@ -119,7 +119,7 @@
KeySemicolon=
KeySlash=
KeySleep=
-KeySpace=startBoost | stopBoost
+KeySpace="boost"
KeyStop=
KeySystemRequest=
KeyT="onpress fire 3"
Modified: code/branches/gameimmersion/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/gameimmersion/src/orxonox/controllers/HumanController.cc 2011-05-25 16:08:21 UTC (rev 8573)
+++ code/branches/gameimmersion/src/orxonox/controllers/HumanController.cc 2011-05-25 16:23:51 UTC (rev 8574)
@@ -51,9 +51,7 @@
SetConsoleCommand("HumanController", "rotateRoll", &HumanController::rotateRoll ).addShortcut().setAsInputCommand();
SetConsoleCommand("HumanController", __CC_fire_name, &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold);
SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut();
- //SetConsoleCommand("HumanController", __CC_boost_name, &HumanController::toggleBoost ).addShortcut().keybindMode(KeybindMode::OnPress);
- SetConsoleCommand("HumanController", "startBoost", &HumanController::startBoost ).addShortcut().keybindMode(KeybindMode::OnPress);
- SetConsoleCommand("HumanController", "stopBoost", &HumanController::stopBoost ).addShortcut().keybindMode(KeybindMode::OnRelease);
+ SetConsoleCommand("HumanController", __CC_boost_name, &HumanController::toggleBoost ).addShortcut().keybindMode(KeybindMode::OnPress);
SetConsoleCommand("HumanController", "greet", &HumanController::greet ).addShortcut();
SetConsoleCommand("HumanController", "switchCamera", &HumanController::switchCamera ).addShortcut();
SetConsoleCommand("HumanController", "mouseLook", &HumanController::mouseLook ).addShortcut();
@@ -172,7 +170,7 @@
*/
/*static*/ void HumanController::toggleBoost()
{
- COUT(0) << "Toggling boost!";
+ COUT(3) << "Toggling boost!" << endl; // TODO: Remove!
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
HumanController::localController_s->toggleBoosting();
}
@@ -184,7 +182,6 @@
*/
void HumanController::toggleBoosting(void)
{
- /*
this->boosting_ = !this->boosting_;
// The keybind mode of the boosting console command is onRelease if in boosting mode and onPress of not in boosting mode.
@@ -193,27 +190,8 @@
else
ModifyConsoleCommand(__CC_boost_name).keybindMode(KeybindMode::OnPress);
- this->controllableEntity_->boost(this->boosting_);*/
+ this->controllableEntity_->boost(this->boosting_);
}
-
- void HumanController::startBoost()
- {
- COUT(0) << "Starting boost" << std::endl;
- if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
- HumanController::localController_s->setBoost(true);
- }
-
- void HumanController::stopBoost()
- {
- COUT(0) << "Stopping boost" << std::endl;
- if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
- HumanController::localController_s->setBoost(false);
- }
-
- void HumanController::setBoost(bool bBoost)
- {
- this->controllableEntity_->boost(bBoost);
- }
void HumanController::greet()
{
Modified: code/branches/gameimmersion/src/orxonox/controllers/HumanController.h
===================================================================
--- code/branches/gameimmersion/src/orxonox/controllers/HumanController.h 2011-05-25 16:08:21 UTC (rev 8573)
+++ code/branches/gameimmersion/src/orxonox/controllers/HumanController.h 2011-05-25 16:23:51 UTC (rev 8574)
@@ -63,10 +63,7 @@
virtual void doFire(unsigned int firemode);
static void reload();
- static void startBoost();
- static void stopBoost();
- static void toggleBoost(); // Static method,toggles boosting.
- void setBoost(bool);
+ static void toggleBoost(); // Static method, toggles boosting.
/**
@brief Check whether the HumanController is in boosting mode.
@return Returns true if it is, false if not.
Modified: code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-05-25 16:08:21 UTC (rev 8573)
+++ code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-05-25 16:23:51 UTC (rev 8574)
@@ -77,14 +77,14 @@
this->setConfigValues();
this->registerVariables();
-
- Camera* c = CameraManager::getInstance().getActiveCamera();
- this->cameraOriginalPosition = c->getPosition();
- this->cameraOriginalOrientation = c->getOrientation();
+
+ Camera* c = CameraManager::getInstance().getActiveCamera();
+ this->cameraOriginalPosition = c->getPosition();
+ this->cameraOriginalOrientation = c->getOrientation();
- this->shakeFrequency_ = 15;
- this->shakeAmplitude_ = 5;
- this->shakeDt_ = 0;
+ this->shakeFrequency_ = 15;
+ this->shakeAmplitude_ = 5;
+ this->shakeDt_ = 0;
}
SpaceShip::~SpaceShip()
@@ -105,7 +105,7 @@
XMLPortParamVariable(SpaceShip, "boostPowerRate", boostPowerRate_, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode);
- XMLPortParamVariable(SpaceShip, "shakeFrequency", shakeFrequency_, xmlelement, mode);
+ XMLPortParamVariable(SpaceShip, "shakeFrequency", shakeFrequency_, xmlelement, mode);
}
void SpaceShip::registerVariables()
@@ -117,7 +117,7 @@
registerVariable(this->boostPowerRate_, VariableDirection::ToClient);
registerVariable(this->boostRate_, VariableDirection::ToClient);
registerVariable(this->boostCooldownDuration_, VariableDirection::ToClient);
- registerVariable(this->shakeFrequency_, VariableDirection::ToClient);
+ registerVariable(this->shakeFrequency_, VariableDirection::ToClient);
}
void SpaceShip::setConfigValues()
@@ -143,7 +143,7 @@
if (this->hasLocalController())
{
-
+
/*
this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
@@ -175,10 +175,10 @@
this->boost(false);
this->bBoostCooldown_ = true;
this->timer_.setTimer(this->boostCooldownDuration_, false, createExecutor(createFunctor(&SpaceShip::boostCooledDown, this)));
-
+
}
-
- shakeCamera(dt);
+
+ shakeCamera(dt);
}
}
}
@@ -233,68 +233,68 @@
Whether to start or stop boosting.
*/
void SpaceShip::boost(bool bBoost)
- {
+ {
if(bBoost && !this->bBoostCooldown_)
- {
- //COUT(0) << "Boost startet!\n";
+ {
+ //COUT(0) << "Boost startet!\n";
this->bBoost_ = true;
- }
+ }
if(!bBoost)
- {
- //COUT(0) << "Boost stoppt\n";
- this->resetCamera();
+ {
+ //COUT(0) << "Boost stoppt\n";
+ this->resetCamera();
this->bBoost_ = false;
- }
+ }
}
void SpaceShip::boostCooledDown(void)
{
- this->bBoostCooldown_ = false;
+ this->bBoostCooldown_ = false;
}
void SpaceShip::shakeCamera(float dt)
{
- //make sure the ship is only shaking if it's moving
- if (this->getVelocity().squaredLength() > 80)
- {
- this->shakeDt_ += dt;
-
- int frequency = this->shakeFrequency_ * (this->getVelocity().squaredLength());
-
- if (this->shakeDt_ >= 1 /(frequency))
- {
- this->shakeDt_ -= 1/(frequency);
- }
-
- Degree angle = Degree(sin(this->shakeDt_ * 2* math::pi * frequency) * this->shakeAmplitude_);
-
-// COUT(0) << "Angle: " << angle << std::endl;
- Camera* c = this->getCamera();
+ //make sure the ship is only shaking if it's moving
+ if (this->getVelocity().squaredLength() > 80)
+ {
+ this->shakeDt_ += dt;
+
+ int frequency = this->shakeFrequency_ * (this->getVelocity().squaredLength());
+
+ if (this->shakeDt_ >= 1 /(frequency))
+ {
+ this->shakeDt_ -= 1/(frequency);
+ }
+
+ Degree angle = Degree(sin(this->shakeDt_ * 2* math::pi * frequency) * this->shakeAmplitude_);
+
+ //COUT(0) << "Angle: " << angle << std::endl;
+ Camera* c = this->getCamera();
- //Shaking Camera effect
- if (c != 0)
- {
- c->setOrientation(Vector3::UNIT_X, angle);
- }
- }
+ //Shaking Camera effect
+ if (c != 0)
+ {
+ c->setOrientation(Vector3::UNIT_X, angle);
+ }
+ }
}
void SpaceShip::resetCamera()
{
-
-// COUT(0) << "Resetting camera\n";
- Camera *c = this->getCamera();
-
- if (c == 0)
- {
- COUT(2) << "Failed to reset camera!";
- return;
- }
-
- shakeDt_ = 0;
- //
- c->setPosition(this->cameraOriginalPosition);
- c->setOrientation(this->cameraOriginalOrientation);
+
+ //COUT(0) << "Resetting camera\n";
+ Camera *c = this->getCamera();
+
+ if (c == 0)
+ {
+ COUT(2) << "Failed to reset camera!";
+ return;
+ }
+
+ shakeDt_ = 0;
+ //
+ c->setPosition(this->cameraOriginalPosition);
+ c->setOrientation(this->cameraOriginalOrientation);
}
void SpaceShip::loadEngineTemplate()
More information about the Orxonox-commit
mailing list