Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8574


Ignore:
Timestamp:
May 25, 2011, 6:23:51 PM (13 years ago)
Author:
dafrick
Message:

Reverting boost changes.

Location:
code/branches/gameimmersion
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gameimmersion/data/defaultConfig/keybindings.ini

    r8541 r8574  
    2121KeyDown="scale -1 moveFrontBack"
    2222KeyE="scale -1 rotateRoll"
    23 KeyEnd=
     23KeyEnd="boost"
    2424KeyEquals=
    2525KeyEscape="keyESC"
     
    120120KeySlash=
    121121KeySleep=
    122 KeySpace=startBoost | stopBoost
     122KeySpace="boost"
    123123KeyStop=
    124124KeySystemRequest=
  • code/branches/gameimmersion/src/orxonox/controllers/HumanController.cc

    r8541 r8574  
    5252    SetConsoleCommand("HumanController", __CC_fire_name,           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
    5353    SetConsoleCommand("HumanController", "reload",                 &HumanController::reload        ).addShortcut();
    54     //SetConsoleCommand("HumanController", __CC_boost_name,          &HumanController::toggleBoost   ).addShortcut().keybindMode(KeybindMode::OnPress);
    55     SetConsoleCommand("HumanController", "startBoost",             &HumanController::startBoost    ).addShortcut().keybindMode(KeybindMode::OnPress);
    56     SetConsoleCommand("HumanController", "stopBoost",              &HumanController::stopBoost     ).addShortcut().keybindMode(KeybindMode::OnRelease);
     54    SetConsoleCommand("HumanController", __CC_boost_name,          &HumanController::toggleBoost   ).addShortcut().keybindMode(KeybindMode::OnPress);
    5755    SetConsoleCommand("HumanController", "greet",                  &HumanController::greet         ).addShortcut();
    5856    SetConsoleCommand("HumanController", "switchCamera",           &HumanController::switchCamera  ).addShortcut();
     
    173171    /*static*/ void HumanController::toggleBoost()
    174172    {
    175         COUT(0) << "Toggling boost!";
     173        COUT(3) << "Toggling boost!" << endl; // TODO: Remove!
    176174        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    177175            HumanController::localController_s->toggleBoosting();
     
    185183    void HumanController::toggleBoosting(void)
    186184    {
    187             /*
    188185        this->boosting_ = !this->boosting_;
    189186       
     
    194191            ModifyConsoleCommand(__CC_boost_name).keybindMode(KeybindMode::OnPress);
    195192
    196         this->controllableEntity_->boost(this->boosting_);*/
    197     }
    198    
    199     void HumanController::startBoost()
    200     {
    201             COUT(0) << "Starting boost" << std::endl;
    202             if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    203                     HumanController::localController_s->setBoost(true);
    204     }
    205    
    206     void HumanController::stopBoost()
    207     {
    208             COUT(0) << "Stopping boost" << std::endl;
    209             if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    210                     HumanController::localController_s->setBoost(false);
    211     }
    212    
    213     void HumanController::setBoost(bool bBoost)
    214     {
    215             this->controllableEntity_->boost(bBoost);
    216     }       
     193        this->controllableEntity_->boost(this->boosting_);
     194    }
    217195
    218196    void HumanController::greet()
  • code/branches/gameimmersion/src/orxonox/controllers/HumanController.h

    r8541 r8574  
    6464            static void reload();
    6565
    66             static void startBoost();
    67             static void stopBoost();
    68             static void toggleBoost(); // Static method,toggles boosting.
    69             void setBoost(bool);
     66            static void toggleBoost(); // Static method, toggles boosting.
    7067            /**
    7168            @brief Check whether the HumanController is in boosting mode.
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8541 r8574  
    7878        this->setConfigValues();
    7979        this->registerVariables();
    80        
    81         Camera* c = CameraManager::getInstance().getActiveCamera();
    82         this->cameraOriginalPosition = c->getPosition();
    83         this->cameraOriginalOrientation = c->getOrientation();
    84 
    85         this->shakeFrequency_ = 15;
    86         this->shakeAmplitude_ = 5;
    87         this->shakeDt_ = 0;
     80       
     81        Camera* c = CameraManager::getInstance().getActiveCamera();
     82        this->cameraOriginalPosition = c->getPosition();
     83        this->cameraOriginalOrientation = c->getOrientation();
     84
     85        this->shakeFrequency_ = 15;
     86        this->shakeAmplitude_ = 5;
     87        this->shakeDt_ = 0;
    8888    }
    8989
     
    106106        XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode);
    107107        XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode);
    108         XMLPortParamVariable(SpaceShip, "shakeFrequency", shakeFrequency_, xmlelement, mode);
     108        XMLPortParamVariable(SpaceShip, "shakeFrequency", shakeFrequency_, xmlelement, mode);
    109109    }
    110110
     
    118118        registerVariable(this->boostRate_, VariableDirection::ToClient);
    119119        registerVariable(this->boostCooldownDuration_, VariableDirection::ToClient);
    120         registerVariable(this->shakeFrequency_, VariableDirection::ToClient);
     120        registerVariable(this->shakeFrequency_, VariableDirection::ToClient);
    121121    }
    122122
     
    144144        if (this->hasLocalController())
    145145        {
    146                
     146
    147147/*
    148148            this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
     
    176176                    this->bBoostCooldown_ = true;
    177177                    this->timer_.setTimer(this->boostCooldownDuration_, false, createExecutor(createFunctor(&SpaceShip::boostCooledDown, this)));
    178                    
     178
    179179                }
    180                
    181                 shakeCamera(dt);               
     180
     181                shakeCamera(dt);   
    182182            }
    183183        }
     
    234234    */
    235235    void SpaceShip::boost(bool bBoost)
    236     {   
     236    {
    237237        if(bBoost && !this->bBoostCooldown_)
    238         {
    239             //COUT(0) << "Boost startet!\n";
     238        {
     239            //COUT(0) << "Boost startet!\n";
    240240            this->bBoost_ = true;
    241         }
     241        }
    242242        if(!bBoost)
    243         {
    244             //COUT(0) << "Boost stoppt\n";
    245             this->resetCamera();
     243        {
     244            //COUT(0) << "Boost stoppt\n";
     245            this->resetCamera();
    246246            this->bBoost_ = false;
    247         }
     247        }
    248248    }
    249249   
    250250    void SpaceShip::boostCooledDown(void)
    251251    {
    252             this->bBoostCooldown_ = false;
     252        this->bBoostCooldown_ = false;
    253253    }
    254254   
    255255    void SpaceShip::shakeCamera(float dt)
    256256    {
    257             //make sure the ship is only shaking if it's moving
    258             if (this->getVelocity().squaredLength() > 80)
    259             {
    260                     this->shakeDt_ += dt;
    261                    
    262                     int frequency = this->shakeFrequency_ * (this->getVelocity().squaredLength());
    263                    
    264                     if (this->shakeDt_ >= 1 /(frequency))
    265                     {
    266                             this->shakeDt_ -= 1/(frequency);
    267                     }
    268                    
    269                     Degree angle = Degree(sin(this->shakeDt_ * 2* math::pi * frequency) * this->shakeAmplitude_);
    270                        
    271 //                  COUT(0) << "Angle: " << angle << std::endl;
    272                     Camera* c = this->getCamera();
    273 
    274                         //Shaking Camera effect
    275                     if (c != 0)
    276                     {
    277                             c->setOrientation(Vector3::UNIT_X, angle);
    278                     }
    279             }
     257        //make sure the ship is only shaking if it's moving
     258        if (this->getVelocity().squaredLength() > 80)
     259        {
     260            this->shakeDt_ += dt;
     261   
     262            int frequency = this->shakeFrequency_ * (this->getVelocity().squaredLength());
     263   
     264            if (this->shakeDt_ >= 1 /(frequency))
     265            {
     266                this->shakeDt_ -= 1/(frequency);
     267            }
     268   
     269            Degree angle = Degree(sin(this->shakeDt_ * 2* math::pi * frequency) * this->shakeAmplitude_);
     270   
     271            //COUT(0) << "Angle: " << angle << std::endl;
     272            Camera* c = this->getCamera();
     273
     274            //Shaking Camera effect
     275            if (c != 0)
     276            {
     277                c->setOrientation(Vector3::UNIT_X, angle);
     278            }
     279        }
    280280    }
    281281   
    282282    void SpaceShip::resetCamera()
    283283    {
    284            
    285 //          COUT(0) << "Resetting camera\n";
    286             Camera *c = this->getCamera();
    287          
    288             if (c == 0)
    289             {
    290                     COUT(2) << "Failed to reset camera!";
    291                     return;
    292             }
    293            
    294             shakeDt_ = 0;
    295             //     
    296             c->setPosition(this->cameraOriginalPosition);
    297             c->setOrientation(this->cameraOriginalOrientation);
     284   
     285        //COUT(0) << "Resetting camera\n";
     286        Camera *c = this->getCamera();
     287   
     288        if (c == 0)
     289        {
     290            COUT(2) << "Failed to reset camera!";
     291            return;
     292        }
     293   
     294        shakeDt_ = 0;
     295        //
     296        c->setPosition(this->cameraOriginalPosition);
     297        c->setOrientation(this->cameraOriginalOrientation);
    298298    }
    299299
Note: See TracChangeset for help on using the changeset viewer.