Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 14, 2016, 4:02:00 PM (9 years ago)
Author:
sagerj
Message:

today I got pawn'ed

Location:
code/branches/sagerjFS16/src/orxonox
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc

    r11164 r11166  
    159159    void HumanController::fire(unsigned int firemode)
    160160    {
     161        orxout() << "fire hc " << firemode << endl;
    161162        if (HumanController::localController_s)
    162163            HumanController::localController_s->doFire(firemode);
     
    165166    void HumanController::doFire(unsigned int firemode)
    166167    {
     168        orxout() << "do fire hc " << firemode << endl;
    167169        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    168170        {
     
    178180    void HumanController::release(unsigned int firemode)
    179181    {
    180         orxout() << "HumanController " << firemode << endl;
     182        orxout() << "release hc " << firemode << endl;
    181183        if (HumanController::localController_s)
    182184            HumanController::localController_s->doRelease(firemode);
     
    185187    void HumanController::doRelease(unsigned int firemode)
    186188    {
     189        orxout() << "do release hc " << firemode << endl;
    187190        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    188191        {
  • code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc

    r11164 r11166  
    5454    SetConsoleCommand("NewHumanController", "accelerate", &NewHumanController::accelerate).keybindMode(KeybindMode::OnPress);
    5555    SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress);
    56     //SetConsoleCommand("NewHumanController", "release",    &NewHumanController::release   ).keybindMode(KeybindMode::OnRelease).addShortcut();
    5756
    5857    RegisterUnloadableClass(NewHumanController);
     
    286285        if (firemode == 1 && this->controlMode_ == 1)
    287286        {
     287            orxout() << "do fire nhc if " << firemode << endl;
    288288            //unlocked steering, steer on right mouse click
    289289            HumanController::yaw(Vector2(this->currentYaw_, 0));
     
    291291        }
    292292        else
     293        {
     294            orxout() << "do fire nhc else " << firemode << endl;
    293295            HumanController::doFire(firemode); //call for formationflight
    294     }
    295 
    296     /*void NewHumanController::release(unsigned int firemode)
    297     {
    298         if (NewHumanController::localController_s)
    299             NewHumanController::localController_s->doRelease(firemode);
    300         orxout() << "Trigger " << firemode << endl;
    301     }
    302 
    303     /void NewHumanController::doRelease(unsigned int firemode)
    304     {
    305         // this->firemode_ = -1; (outdated code from unfire)
    306         // hideArrows();
     296        }
     297    }
     298
     299    void NewHumanController::doRelease(unsigned int firemode)
     300    {
     301        orxout() << "do release nhc" << firemode << endl;
    307302        if (!this->controllableEntity_)
    308303            return;
     
    311306
    312307        HumanController::doRelease(firemode); //call for formationflight
    313     }*/
     308    }
    314309
    315310    void NewHumanController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
  • code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h

    r11164 r11166  
    5555
    5656            virtual void doFire(unsigned int firemode) override;
    57             /*virtual void release(unsigned int firemode);
    58             virtual void doRelease(unsigned int firemode);*/
     57            virtual void doRelease(unsigned int firemode) override;
    5958
    6059            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override;
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc

    r11164 r11166  
    114114        // Note: The reloading of each WeaponMode is internally handled by each A, B and C.
    115115        //       The reloading of the weapon is only performed to avoid firing with different modes at the same time.
     116        orxout() << "fire weapon " << mode << endl;
    116117        if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
    117118            return;
     
    135136
    136137    void Weapon::release(unsigned int mode)
    137     {orxout() << "release weapon " << mode << endl;}
     138    {
     139        orxout() << "release weapon " << mode << endl;
     140        if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
     141            return;
     142
     143        std::multimap<unsigned int, WeaponMode*>::iterator start = this->weaponmodes_.lower_bound(mode);
     144        std::multimap<unsigned int, WeaponMode*>::iterator end   = this->weaponmodes_.upper_bound(mode);
     145
     146        for (std::multimap<unsigned int, WeaponMode*>::iterator it = start; it != end; ++it)
     147        {
     148            float reloading_time = 0;
     149            if (it->second->release(&reloading_time))
     150            {
     151                this->bReloading_ = true;
     152                this->reloadingWeaponmode_ = mode;
     153
     154                this->reloadTimer_.setInterval(reloading_time);
     155                this->reloadTimer_.startTimer();
     156            }
     157        }
     158    }
    138159
    139160    /**
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc

    r11164 r11166  
    121121    {
    122122        (*reloadTime) = this->reloadTime_;
    123        
     123        orxout() << "fire wm " << reloadTime << endl;
    124124        // Fireing is only possible if this weapon mode is not reloading and there is enough munition
    125125        if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this))
     
    169169    }
    170170
    171     void WeaponMode::release(float* reloadTime)
    172     {orxout() << "release wmode " << reloadTime << endl;}
     171    bool WeaponMode::release(float* reloadTime)
     172    {
     173        orxout() << "release wm " << reloadTime << endl;
     174        return false;
     175    }
    173176
    174177    bool WeaponMode::reload()
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h

    r11164 r11166  
    5858
    5959            virtual bool fire(float* reloadTime);
    60             virtual void release(float* reloadTime);
     60            virtual bool release(float* reloadTime);
    6161            bool reload();
    6262
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc

    r11164 r11166  
    7676    void WeaponPack::fire(unsigned int weaponmode)
    7777    {
     78        orxout() << "fire wp " << weaponmode << endl;
    7879        for (Weapon* weapon : this->weapons_)
    7980            weapon->fire(weaponmode);
     
    8283    void WeaponPack::release(unsigned int weaponmode)
    8384    {
     85        orxout() << "release wp " << weaponmode << endl;
    8486        for (Weapon* weapon : this->weapons_)
    8587            weapon->release(weaponmode);
    86         orxout() << "release wpack " << weaponmode << endl;
    8788    }
    8889
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc

    r11164 r11166  
    6363    {
    6464        // Fire all WeaponPacks with their defined weaponmode
     65        orxout() << "fire wset " << endl;
    6566        for (const auto& mapEntry : this->weaponpacks_)
    6667            if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
     
    7071    void WeaponSet::release()
    7172    {
    72        
    7373        // Fire all WeaponPacks with their defined weaponmode
     74        orxout() << "release wset " << endl;
    7475        for (const auto& mapEntry : this->weaponpacks_)
    7576            if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
    7677                mapEntry.first->release(mapEntry.second);
    77         orxout() << "release wset " << endl;
    78        
    7978    }
    8079
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc

    r11164 r11166  
    289289    void WeaponSystem::fire(unsigned int firemode)
    290290    {
     291        orxout() << "fire wsys " << firemode << endl;
    291292        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
    292293        if (it != this->weaponSets_.end() && it->second)
     
    296297    void WeaponSystem::release(unsigned int firemode)
    297298    {
     299        orxout() << "release wsys " << firemode << endl;
    298300        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
    299301        if (it != this->weaponSets_.end() && it->second)
    300302            it->second->release();
    301         orxout() << "release wsys " << firemode << endl;
    302303    }
    303304
  • code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc

    r11164 r11166  
    303303        if(GameMode::isMaster())
    304304        {
    305             orxout() << "f CE IF " << firemode << endl;
     305            orxout() << "fire ce if " << firemode << endl;
    306306            this->fired(firemode);
    307307        }
    308308        else
    309309        {
    310             orxout() << "f CE EL " << firemode << endl;
     310            orxout() << "fire ce else " << firemode << endl;
    311311            callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode);
    312312        }
     
    317317        if(GameMode::isMaster())
    318318        {
    319             orxout() << "r CE IF " << firemode << endl;
     319            orxout() << "release ce if " << firemode << endl;
    320320            this->released(firemode);
    321321        }
    322322        else
    323323        {
    324             orxout() << "r CE EL " << firemode << endl;
     324            orxout() << "release ce else " << firemode << endl;
    325325            callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode);
    326326        }
  • code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.cc

    r11099 r11166  
    430430    void Pawn::fired(unsigned int firemode)
    431431    {
     432        orxout() << "fired pawn " << firemode << endl;
    432433        if (this->weaponSystem_)
    433434            this->weaponSystem_->fire(firemode);
     435    }
     436
     437    void Pawn::released(unsigned int firemode)
     438    {
     439        orxout() << "released pawn " << firemode << endl;
     440        if (this->weaponSystem_)
     441            this->weaponSystem_->release(firemode);
    434442    }
    435443
  • code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.h

    r11071 r11166  
    158158
    159159            virtual void fired(unsigned int firemode) override;
     160            virtual void released(unsigned int firemode) override;
    160161            virtual void postSpawn();
    161162
Note: See TracChangeset for help on using the changeset viewer.