Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11153


Ignore:
Timestamp:
Mar 24, 2016, 3:56:35 PM (9 years ago)
Author:
sagerj
Message:

added release functions in various classes: weaponmode, weaponsystem, humancontroller, newhumancontroller, discharger

Location:
code/branches/sagerjFS16
Files:
11 edited

Legend:

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

    r10622 r11153  
    122122KeyStop=
    123123KeySystemRequest="printScreen"
    124 KeyT="onpress fire 3"
     124KeyT= onpress fire 3 | onrelease release 3
    125125KeyTab="NewHumanController changeMode"
    126126KeyU=""
     
    132132KeyVolumeDown=
    133133KeyVolumeUp=
    134 KeyW="scale 1 moveFrontBack"
     134KeyW="scale 1 moveFrontBack "
    135135KeyWake=
    136136KeyWebBack=
     
    142142KeyWebStop=
    143143KeyX="selectClosest"
    144 KeyY="onpress fire 4"
     144KeyY= onpress fire 4 | onrelease release 4
    145145KeyYen=
    146146KeyZ="selectNext"
     
    152152Button6=
    153153Button7=
    154 Left="fire 0"
    155 Middle="fire 2"
    156 Right= fire 1 | unfire
     154Left= fire 0 | release 0
     155Middle= fire 2 | release 2
     156Right= fire 1 | release 1
    157157Wheel1Down="NewHumanController decelerate"
    158158Wheel1Up="NewHumanController accelerate"
  • code/branches/sagerjFS16/data/gui/scripts/KeyBindMenu.lua

    r8232 r11153  
    77
    88    commandList = {}
    9     table.insert(commandList, "fire 0")
    10     table.insert(commandList, "fire 1 | unfire")
    11     table.insert(commandList, "onpress fire 2")
    12     table.insert(commandList, "onpress fire 3")
     9    table.insert(commandList, "fire 0" | "release 0")
     10    table.insert(commandList, "fire 1" | "release 1")
     11    table.insert(commandList, "onpress fire 2" | "onrelease release 2")
     12    table.insert(commandList, "onpress fire 3" | "onrelease release 3")
    1313    table.insert(commandList, "scale 1 moveFrontBack")
    1414    table.insert(commandList, "scale -1 moveFrontBack")
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc

    r11142 r11153  
    5252
    5353        this->reloadTime_ = 0.1f;
    54         this->damage_ = 9000.1f;
    55         this->speed_ = 9000.1f;
     54        this->damage_ = 9000.1f*loaded_;
     55        this->speed_ = 9000.1f*loaded_;
    5656
    5757        this->setMunitionName("dEnergy");
     
    6868    void Discharger::fire()
    6969    {
    70 
    71     }
    72     void Discharger::unfire()
    73     {
    74         BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
     70        /*BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
    7571
    7672        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
     
    8278        projectile->setDamage(this->getDamage());
    8379        projectile->setShieldDamage(this->getShieldDamage());
    84         projectile->setHealthDamage(this->getHealthDamage());
     80        projectile->setHealthDamage(this->getHealthDamage());*/
     81        extern unsigned int beginLoad_ = time;
     82    }
     83    void Discharger::release()
     84    {
     85        extern unsigned int endLoad_ = time;
     86        extern unsigned int loaded_ = endLoad_ - beginLoad_;
     87
    8588    }
    8689}
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h

    r11142 r11153  
    5555
    5656            virtual void fire() override;
    57             virtual void unfire() override;
     57            virtual void release() override;
    5858
    5959        private:
    6060            float speed_; //!< The speed of the fired projectile.
     61            float loaded_; // The time how long the weapon charged
     62            float beginLoad_;
     63            float endLoad_;
    6164    };
    6265}
  • code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc

    r11071 r11153  
    4242    extern const std::string __CC_fire_name = "fire";
    4343    extern const std::string __CC_suicide_name = "suicide";
     44    extern const std::string __CC_release_name = "release";
    4445
    4546    SetConsoleCommand("HumanController", "moveFrontBack",          &HumanController::moveFrontBack ).addShortcut().setAsInputCommand();
     
    5253    SetConsoleCommand("HumanController", "FFChangeMode",           &HumanController::FFChangeMode).addShortcut().keybindMode(KeybindMode::OnPress);
    5354    SetConsoleCommand("HumanController", __CC_fire_name,           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
     55    SetConsoleCommand("HumanController", __CC_release_name,        &HumanController::release       ).addShortcut().keybindMode(KeybindMode::OnRelease);
    5456    SetConsoleCommand("HumanController", "reload",                 &HumanController::reload        ).addShortcut();
    5557    SetConsoleCommand("HumanController", "boost",                  &HumanController::boost         ).addShortcut().setAsInputCommand().keybindMode(KeybindMode::OnPressAndRelease);
     
    167169            HumanController::localController_s->controllableEntity_->fire(firemode);
    168170            //if human fires, set slaves free. See FormationController::forceFreeSlaves()
     171            if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL)
     172            {
     173                HumanController::localController_s->forceFreeSlaves();
     174            }
     175        }
     176    }
     177
     178    void HumanController::release(unsigned int firemode)
     179    {
     180        if (HumanController::localController_s)
     181            HumanController::localController_s->doRelease(firemode);
     182    }
     183
     184    void HumanController::doRelease(unsigned int firemode)
     185    {
     186        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     187        {
     188            HumanController::localController_s->controllableEntity_->release(firemode);
     189            //if human releases, set slaves free. See FormationController::forceFreeSlaves()
    169190            if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL)
    170191            {
  • code/branches/sagerjFS16/src/orxonox/controllers/HumanController.h

    r11071 r11153  
    6464            virtual void doFire(unsigned int firemode);
    6565            static void reload();
     66            static void release(unsigned int firemode);
     67            virtual void doRelease(unsigned int firemode);
    6668
    6769            static void boost(const Vector2& value); // Static method, controls boosting.
  • code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc

    r11142 r11153  
    5454    SetConsoleCommand("NewHumanController", "accelerate", &NewHumanController::accelerate).keybindMode(KeybindMode::OnPress);
    5555    SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress);
    56     SetConsoleCommand("NewHumanController", "unfire",     &NewHumanController::unfire    ).keybindMode(KeybindMode::OnRelease).addShortcut();
     56    SetConsoleCommand("NewHumanController", "release",    &NewHumanController::release    ).keybindMode(KeybindMode::OnRelease).addShortcut();
    5757
    5858    RegisterUnloadableClass(NewHumanController);
     
    344344    }
    345345
    346     void NewHumanController::unfire()
     346    void NewHumanController::release(unsigned int firemode)
    347347    {
    348348        if (NewHumanController::localController_s)
    349             NewHumanController::localController_s->doUnfire();
    350         orxout() << "unfire" << endl;
    351     }
    352 
    353     void NewHumanController::doUnfire()
    354     {
    355         this->firemode_ = -1;
    356         hideArrows();
     349            NewHumanController::localController_s->doRelease();
     350        orxout() << "Trigger" << endl;
     351    }
     352
     353    void NewHumanController::doRelease(unsigned int firemode)
     354    {
     355        // this->firemode_ = -1; (outdated code from unfire)
     356        // hideArrows();
     357        if (!this->controllableEntity_)
     358            return;
     359
     360        this->firemode_ = firemode;
     361
     362        HumanController::doRelease(firemode); //call for formationflight
    357363    }
    358364
  • code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h

    r11071 r11153  
    5858            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override;
    5959
    60             static void unfire();
    61             virtual void doUnfire();
     60            static void release(unsigned int firemode);
     61            virtual void doRelease(unsigned int firemode);
    6262
    6363            void centerCursor();
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc

    r11108 r11153  
    169169    }
    170170
     171    void WeaponMode::release()
     172
    171173    bool WeaponMode::reload()
    172174    {
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc

    r11099 r11153  
    294294    }
    295295
     296    void WeaponSystem::release(unsigned int firemode)
     297    {
     298        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
     299        if (it != this->weaponSets_.end() && it->second)
     300            it->second->release();
     301    }
     302
    296303    void WeaponSystem::reload()
    297304    {
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.h

    r11071 r11153  
    7676            void fire(unsigned int firemode);
    7777            void reload();
     78            void release(unsigned int firemode);
    7879
    7980            Munition * getMunition(SubclassIdentifier<Munition> * identifier);
Note: See TracChangeset for help on using the changeset viewer.