Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 21, 2016, 4:47:39 PM (9 years ago)
Author:
sagerj
Message:

everything beneath weaponmode changed to push/release - wm modified only need to implement timer/ticker

Location:
code/branches/sagerjFS16/src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc

    r11170 r11174  
    5454        this->damage_ = 90.01f;
    5555        this->speed_ = 90.01f;
    56         this->charges_ = 0;
     56        this->chargeable_ = 0;
    5757
    5858        this->setMunitionName("LaserMunition");
     
    6565    void Discharger::fire()
    6666    {
    67         charges_ += 1;
    68         orxout() << "c = " << charges_ << endl;
    69     }
    70    
    71     void Discharger::release()
    72     {
    73         orxout() << "release c = " << charges_ << endl;
     67        orxout() << "release" << cTime_ << endl;
    7468        BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
    7569
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h

    r11170 r11174  
    4848    @ingroup WeaponsWeaponModes
    4949    */
     50
    5051    class _WeaponsExport Discharger : public WeaponMode
    5152    {
     
    5556
    5657            virtual void fire() override;
    57             virtual void release() override;
    5858
    5959        private:
    60             float speed_; // The speed of the fired projectile.
    61             unsigned int charges_; // An indicator of how much you charged up.
     60            bool chargeable_;       // An indicator that this weapon type is chargeable.
     61            float speed_;           // The speed of the fired projectile.
     62            float ctime_;           // time the weapon has charged.
    6263    };
    6364}
  • code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc

    r11170 r11174  
    4040namespace orxonox
    4141{
    42     extern const std::string __CC_fire_name = "fire";
     42    extern const std::string __CC_push_name = "push";
    4343    extern const std::string __CC_suicide_name = "suicide";
    4444    extern const std::string __CC_release_name = "release";
     
    5252    SetConsoleCommand("HumanController", "toggleFormationFlight",  &HumanController::toggleFormationFlight).addShortcut().keybindMode(KeybindMode::OnPress);
    5353    SetConsoleCommand("HumanController", "FFChangeMode",           &HumanController::FFChangeMode).addShortcut().keybindMode(KeybindMode::OnPress);
    54     SetConsoleCommand("HumanController", __CC_fire_name,           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
     54    SetConsoleCommand("HumanController", __CC_push_name,           &HumanController::push          ).addShortcut().keybindMode(KeybindMode::OnHold);
    5555    SetConsoleCommand("HumanController", __CC_release_name,        &HumanController::release       ).addShortcut().keybindMode(KeybindMode::OnRelease);
    5656    SetConsoleCommand("HumanController", "reload",                 &HumanController::reload        ).addShortcut();
     
    157157    }
    158158
    159     void HumanController::fire(unsigned int firemode)
    160     {
    161         if (HumanController::localController_s)
    162             HumanController::localController_s->doFire(firemode);
    163     }
    164 
    165     void HumanController::doFire(unsigned int firemode)
    166     {
    167         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    168         {
    169             HumanController::localController_s->controllableEntity_->fire(firemode);
     159    void HumanController::push(unsigned int firemode)
     160    {
     161        if (HumanController::localController_s)
     162            HumanController::localController_s->doPush(firemode);
     163    }
     164
     165    void HumanController::doPush(unsigned int firemode)
     166    {
     167        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     168        {
     169            HumanController::localController_s->controllableEntity_->push(firemode);
    170170            //if human fires, set slaves free. See FormationController::forceFreeSlaves()
    171171            if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL)
  • code/branches/sagerjFS16/src/orxonox/controllers/HumanController.h

    r11164 r11174  
    6161            virtual void pitch(const Vector2& value);
    6262
    63             static void fire(unsigned int firemode);
    64             virtual void doFire(unsigned int firemode);
     63            static void push(unsigned int firemode);
     64            virtual void doPush(unsigned int firemode);
    6565            static void release(unsigned int firemode);
    6666            virtual void doRelease(unsigned int firemode);
  • code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc

    r11170 r11174  
    276276    }
    277277
    278     void NewHumanController::doFire(unsigned int firemode)
     278    void NewHumanController::doPush(unsigned int firemode)
    279279    {
    280280        if (!this->controllableEntity_)
     
    291291        else
    292292        {
    293             HumanController::doFire(firemode); //call for formationflight
     293            HumanController::doPush(firemode); //call for formationflight
    294294        }
    295295    }
  • code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h

    r11166 r11174  
    5454            static void decelerate();
    5555
    56             virtual void doFire(unsigned int firemode) override;
     56            virtual void doPush(unsigned int firemode) override;
    5757            virtual void doRelease(unsigned int firemode) override;
    5858
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc

    r11170 r11174  
    9999        Fire this Weapon with the the WeaponMode defined by @param mode
    100100    */
    101     void Weapon::fire(unsigned int mode)
     101    void Weapon::push(unsigned int mode)
    102102    {
    103103        // To avoid firing with more than one mode at the same time, we lock the weapon (reloading) for
     
    125125        {
    126126            float reloading_time = 0;
    127             if (it->second->fire(&reloading_time))
     127            if (it->second->push(&reloading_time))
    128128            {
    129129                this->bReloading_ = true;
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.h

    r11164 r11174  
    5252            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5353
    54             void fire(unsigned int mode);
     54            void push(unsigned int mode);
    5555            void release(unsigned int mode);
    5656            void reload();
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc

    r11170 r11174  
    168168    }
    169169
     170    bool WeaponMode::push(float* reloadTime)
     171    {
     172        if( this->chargeable_)
     173        {
     174            // setting up a timer for knowing how long the weapon was charged
     175            // and passes the value to this->cTime_
     176        } else {
     177            return fire(reloadTime);
     178        }
     179       
     180    }
     181
    170182    bool WeaponMode::release(float* reloadTime)
    171183    {
    172         this->release();
    173         return false;
     184        if( this->chargeable_)
     185        {
     186            return fire(reloadTime);
     187        }
    174188    }
    175189
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h

    r11170 r11174  
    5757            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5858
     59            virtual bool push(float* reloadTime);
     60            virtual bool release(float* reloadTime);
    5961            virtual bool fire(float* reloadTime);
    60             virtual bool release(float* reloadTime);
    6162            bool reload();
    6263
     
    165166
    166167            virtual void fire() = 0;
    167             virtual void release() {};
    168168
    169169            unsigned int initialMunition_;
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc

    r11170 r11174  
    7474        Fire all weapons in this WeaponSet with the defined weaponmode.
    7575    */
    76     void WeaponPack::fire(unsigned int weaponmode)
     76    void WeaponPack::push(unsigned int weaponmode)
    7777    {
    7878        for (Weapon* weapon : this->weapons_)
    79             weapon->fire(weaponmode);
     79            weapon->push(weaponmode);
    8080    }
    8181
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.h

    r11164 r11174  
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    48             void fire(unsigned int weaponmode);
     48            void push(unsigned int weaponmode);
    4949            void release(unsigned int weaponmode);
    5050            void reload();
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc

    r11170 r11174  
    6060    }
    6161
    62     void WeaponSet::fire()
     62    void WeaponSet::push()
    6363    {
    6464        // Fire all WeaponPacks with their defined weaponmode
    6565        for (const auto& mapEntry : this->weaponpacks_)
    6666            if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
    67                 mapEntry.first->fire(mapEntry.second);
     67                mapEntry.first->push(mapEntry.second);
    6868    }
    6969
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.h

    r11164 r11174  
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    48             void fire();
     48            void push();
    4949            void release();
    5050            void reload();
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc

    r11170 r11174  
    287287        Fires the @ref orxonox::WeaponSet with the specified firemode.
    288288    */
    289     void WeaponSystem::fire(unsigned int firemode)
     289    void WeaponSystem::push(unsigned int firemode)
    290290    {
    291291        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
    292292        if (it != this->weaponSets_.end() && it->second)
    293             it->second->fire();
     293            it->second->push();
    294294    }
    295295
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.h

    r11164 r11174  
    7474            void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode);
    7575
    76             void fire(unsigned int firemode);
     76            void push(unsigned int firemode);
    7777            void release(unsigned int firemode);
    7878            void reload();
  • code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc

    r11170 r11174  
    299299    }
    300300
    301     void ControllableEntity::fire(unsigned int firemode)
     301    void ControllableEntity::push(unsigned int firemode)
    302302    {
    303303        if(GameMode::isMaster())
    304304        {
    305             this->fired(firemode);
     305            this->pushed(firemode);
    306306        }
    307307        else
  • code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.h

    r11164 r11174  
    9696                { this->rotateRoll(Vector2(value, 0)); }
    9797
    98             void fire(unsigned int firemode);
     98            void push(unsigned int firemode);
    9999            void release(unsigned int firemode);
    100             virtual void fired(unsigned int firemode) {}
     100            virtual void pushed(unsigned int firemode) {}
    101101            virtual void released(unsigned int firemode) {}
    102102            virtual void reload() {}
  • code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.cc

    r11170 r11174  
    428428    */
    429429
    430     void Pawn::fired(unsigned int firemode)
    431     {
    432         if (this->weaponSystem_)
    433             this->weaponSystem_->fire(firemode);
     430    void Pawn::pushed(unsigned int firemode)
     431    {
     432        if (this->weaponSystem_)
     433            this->weaponSystem_->push(firemode);
    434434    }
    435435
  • code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.h

    r11166 r11174  
    157157            virtual void kill();
    158158
    159             virtual void fired(unsigned int firemode) override;
     159            virtual void pushed(unsigned int firemode) override;
    160160            virtual void released(unsigned int firemode) override;
    161161            virtual void postSpawn();
Note: See TracChangeset for help on using the changeset viewer.