Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11175 for code/branches


Ignore:
Timestamp:
Apr 28, 2016, 3:09:26 PM (9 years ago)
Author:
sagerj
Message:

overwritten many fire functions now only need to implement timer/charges

Location:
code/branches/sagerjFS16
Files:
25 edited

Legend:

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

    r11153 r11175  
    122122KeyStop=
    123123KeySystemRequest="printScreen"
    124 KeyT= onpress fire 3 | onrelease release 3
     124KeyT= onpress push 3 | onrelease release 3
    125125KeyTab="NewHumanController changeMode"
    126126KeyU=""
     
    142142KeyWebStop=
    143143KeyX="selectClosest"
    144 KeyY= onpress fire 4 | onrelease release 4
     144KeyY= onpress push 4 | onrelease release 4
    145145KeyYen=
    146146KeyZ="selectNext"
     
    152152Button6=
    153153Button7=
    154 Left= fire 0 | release 0
    155 Middle= fire 2 | release 2
    156 Right= fire 1 | release 1
     154Left= push 0 | release 0
     155Middle= push 2 | release 2
     156Right= push 1 | release 1
    157157Wheel1Down="NewHumanController decelerate"
    158158Wheel1Up="NewHumanController accelerate"
  • code/branches/sagerjFS16/src/modules/invader/InvaderEnemyShooter.cc

    r11083 r11175  
    7171    void InvaderEnemyShooter::shoot()
    7272    {
    73         ControllableEntity::fire(0);
     73        ControllableEntity::push(0);
    7474    }
    7575
  • code/branches/sagerjFS16/src/modules/invader/InvaderShip.cc

    r11071 r11175  
    9191        // shoot!
    9292        if (isFireing)
    93             ControllableEntity::fire(0);
     93            ControllableEntity::push(0);
    9494
    9595        // Camera
  • code/branches/sagerjFS16/src/modules/jump/JumpFigure.cc

    r11071 r11175  
    398398    }
    399399
    400     void JumpFigure::fire(unsigned int firemode)
    401     {
    402 
    403     }
    404 
    405     void JumpFigure::fired(unsigned int firemode)
     400    void JumpFigure::push(unsigned int firemode)
     401    {
     402
     403    }
     404
     405    void JumpFigure::pushed(unsigned int firemode)
    406406    {
    407407        firePressed_ = true;
  • code/branches/sagerjFS16/src/modules/jump/JumpFigure.h

    r11105 r11175  
    4747            virtual void rotatePitch(const Vector2& value) override;
    4848            virtual void rotateRoll(const Vector2& value) override;
    49             void fire(unsigned int firemode);
    50             virtual void fired(unsigned int firemode) override;
     49            void push(unsigned int firemode);
     50            virtual void pushed(unsigned int firemode) override;
    5151            virtual void JumpFromPlatform(JumpPlatform* platform);
    5252            virtual void JumpFromSpring(JumpSpring* spring);
  • code/branches/sagerjFS16/src/modules/objects/controllers/TurretController.cc

    r11071 r11175  
    198198            {
    199199
    200                 this->getControllableEntity()->fire(0);
     200                this->getControllableEntity()->push(0);
    201201            }
    202202        }
  • code/branches/sagerjFS16/src/modules/towerdefense/TowerDefenseSelecter.cc

    r11071 r11175  
    146146    }
    147147
    148     void TowerDefenseSelecter::fire(unsigned int firemode)
     148    void TowerDefenseSelecter::push(unsigned int firemode)
    149149    {
    150150    }
    151151
    152     void TowerDefenseSelecter::fired(unsigned int firemode)
     152    void TowerDefenseSelecter::pushed(unsigned int firemode)
    153153    {
    154154       
  • code/branches/sagerjFS16/src/modules/towerdefense/TowerDefenseSelecter.h

    r11071 r11175  
    4747            virtual void rotatePitch(const Vector2& value) override;
    4848            virtual void rotateRoll(const Vector2& value) override;
    49             void fire(unsigned int firemode);
    50             virtual void fired(unsigned int firemode) override;
     49            void push(unsigned int firemode);
     50            virtual void pushed(unsigned int firemode) override;
    5151            virtual void boost(bool bBoost) override;
    5252            virtual void setSelectedPosition(TDCoordinate* newPos);
  • code/branches/sagerjFS16/src/modules/weapons/projectiles/Rocket.cc

    r11071 r11175  
    218218        Destroys the Rocket upon pressing "fire".
    219219    */
    220     void Rocket::fired(unsigned int firemode)
     220    void Rocket::pushed(unsigned int firemode)
    221221    {
    222222        this->destroyObject();
  • code/branches/sagerjFS16/src/modules/weapons/projectiles/Rocket.h

    r11071 r11175  
    116116            virtual void setShooter(Pawn* shooter) override;
    117117
    118             virtual void fired(unsigned int firemode) override;
     118            virtual void pushed(unsigned int firemode) override;
    119119
    120120            /**
  • code/branches/sagerjFS16/src/modules/weapons/projectiles/RocketOld.cc

    r11071 r11175  
    218218        Destroys the RocketOld upon pressing "fire".
    219219    */
    220     void RocketOld::fired(unsigned int firemode)
     220    void RocketOld::pushed(unsigned int firemode)
    221221    {
    222222        this->destroyObject();
  • code/branches/sagerjFS16/src/modules/weapons/projectiles/RocketOld.h

    r11071 r11175  
    116116            virtual void setShooter(Pawn* shooter) override;
    117117
    118             virtual void fired(unsigned int firemode) override;
     118            virtual void pushed(unsigned int firemode) override;
    119119
    120120        private:
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc

    r11174 r11175  
    5454        this->damage_ = 90.01f;
    5555        this->speed_ = 90.01f;
    56         this->chargeable_ = 0;
     56        this->chargeable_ = true;
    5757
    5858        this->setMunitionName("LaserMunition");
     
    6565    void Discharger::fire()
    6666    {
    67         orxout() << "release" << cTime_ << endl;
     67        // orxout() << "release" << cTime_ << endl;
    6868        BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
    6969
     
    7171        projectile->setOrientation(this->getMuzzleOrientation());
    7272        projectile->setPosition(this->getMuzzlePosition());
    73         projectile->setVelocity(this->getMuzzleDirection() * this->speed_ * charges_);
     73        projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
    7474
    7575        projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7676        projectile->setDamage(this->getDamage() * charges_);
    77         projectile->setShieldDamage(this->getShieldDamage() * charges_);
    78         projectile->setHealthDamage(this->getHealthDamage() * charges_);
    79         this->charges_ = 0;
     77        projectile->setShieldDamage(this->getShieldDamage());
     78        projectile->setHealthDamage(this->getHealthDamage());
     79        //  this->charges_ = 0;
    8080    }
    8181}
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h

    r11174 r11175  
    5858
    5959        private:
    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.
    63     };
     60            //bool chargeable_;     // An indicator that this weapon type is chargeable.
     61            int charges_;
     62            float speed_;                  // The speed of the fired projectile.
     63            float ctime_;                  // time the weapon has charged.
     64    };
    6465}
    6566
  • code/branches/sagerjFS16/src/orxonox/controllers/AIController.cc

    r11071 r11175  
    197197                    if (this->bHasTargetPosition_)
    198198                        this->moveToTargetPosition();
    199                     this->doFire();
     199                    this->doPush();
    200200                }
    201201
     
    227227                    this->moveToTargetPosition();
    228228
    229                     this->doFire();
     229                    this->doPush();
    230230            }
    231231        }
     
    241241                    if((timeout_< 0)||(!target_))//Check if the timeout is over or target died.
    242242                    {
    243                        controllable->fire(0);//kill the rocket
     243                       controllable->push(0);//kill the rocket
    244244                       this->setPreviousMode();//get out of rocket mode
    245245                    }
  • code/branches/sagerjFS16/src/orxonox/controllers/ArtificialController.cc

    r11099 r11175  
    132132        @brief DoFire is called when a bot should shoot and decides which weapon is used and whether the bot shoots at all.
    133133    */
    134     void ArtificialController::doFire()
     134    void ArtificialController::doPush()
    135135    {
    136136        if(!this->bSetupWorked)//setup: find out which weapons are active ! hard coded: laser is "0", lens flare is "1", ...
     
    144144            if (this->isCloseAtTarget(130) && (firemode = getFiremode("LightningGun")) > -1 )
    145145            {//LENSFLARE: short range weapon
    146                 this->getControllableEntity()->fire(firemode); //ai uses lens flare if they're close enough to the target
     146                this->getControllableEntity()->push(firemode); //ai uses lens flare if they're close enough to the target
    147147            }
    148148            else if( this->isCloseAtTarget(400) && (random < this->botlevel_) && (firemode = getFiremode("RocketFire")) > -1 )
    149149            {//ROCKET: mid range weapon
    150150                this->mode_ = ROCKET; //Vector-implementation: mode_.push_back(ROCKET);
    151                 this->getControllableEntity()->fire(firemode); //launch rocket
     151                this->getControllableEntity()->push(firemode); //launch rocket
    152152                if(this->getControllableEntity() && this->target_) //after fire(3) is called, getControllableEntity() refers to the rocket!
    153153                {
     
    161161            }
    162162            else if ((firemode = getFiremode("HsW01")) > -1 ) //LASER: default weapon
    163                 this->getControllableEntity()->fire(firemode);
     163                this->getControllableEntity()->push(firemode);
    164164        }
    165165    }
  • code/branches/sagerjFS16/src/orxonox/controllers/ArtificialController.h

    r11071 r11175  
    4848            virtual void changedControllableEntity() override;
    4949
    50             virtual void doFire();
     50            virtual void doPush();
    5151            void setBotLevel(float level=1.0f);
    5252            inline float getBotLevel() const
  • code/branches/sagerjFS16/src/orxonox/controllers/DroneController.cc

    r11071 r11175  
    130130                       this->aimAtTarget();
    131131                       if(!this->friendlyFire())
    132                            this->getDrone()->fire(0);
     132                           this->getDrone()->push(0);
    133133                    }
    134134               }
  • code/branches/sagerjFS16/src/orxonox/controllers/FightingController.cc

    r11083 r11175  
    318318        }
    319319             
    320         this->getControllableEntity()->fire(firemode);
     320        this->getControllableEntity()->push(firemode);
    321321       
    322322    }
  • code/branches/sagerjFS16/src/orxonox/controllers/WaypointPatrolController.cc

    r11071 r11175  
    6969
    7070            if (this->getControllableEntity() && this->isCloseAtTarget(this->attackradius_) && this->isLookingAtTarget(math::pi / 20.0f))
    71                 this->getControllableEntity()->fire(0);
     71                this->getControllableEntity()->push(0);
    7272        }
    7373        else
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc

    r11174 r11175  
    6363        this->bAutoReload_ = true;
    6464        this->bParallelReload_ = true;
     65        this->chargeable_ = false;
    6566
    6667        this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&WeaponMode::reloaded, this)));
     
    120121    bool WeaponMode::fire(float* reloadTime)
    121122    {
     123        orxout() << "--- " << endl;
    122124        (*reloadTime) = this->reloadTime_;
    123125        // Fireing is only possible if this weapon mode is not reloading and there is enough munition
     
    170172    bool WeaponMode::push(float* reloadTime)
    171173    {
     174        orxout() << "push " << chargeable_ << endl;
    172175        if( this->chargeable_)
    173176        {
    174177            // setting up a timer for knowing how long the weapon was charged
    175178            // and passes the value to this->cTime_
     179            orxout() << "if " << endl;
     180            return false;
    176181        } else {
     182            orxout() << "else " << endl;
    177183            return fire(reloadTime);
    178184        }
    179        
    180185    }
    181186
    182187    bool WeaponMode::release(float* reloadTime)
    183188    {
     189        orxout() << "release " << endl;
    184190        if( this->chargeable_)
    185         {
     191        {
     192            orxout() << "if " << endl;
    186193            return fire(reloadTime);
     194        }else{
     195            orxout() << "else " << endl;
     196            return false;
    187197        }
    188198    }
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h

    r11174 r11175  
    174174            bool bAutoReload_; // If true, the weapon reloads the magazine automatically.
    175175            bool bParallelReload_; // If true, the weapon reloads in parallel to the magazine reloading.
     176            bool chargeable_; // If true, the weapon fires at release instead at push(where he charges up)
    176177
    177178            float damage_;
  • code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc

    r11174 r11175  
    4949    RegisterClass(ControllableEntity);
    5050
    51     registerMemberNetworkFunction( ControllableEntity, fire );
     51    registerMemberNetworkFunction( ControllableEntity, push );
    5252    registerMemberNetworkFunction( ControllableEntity, setTargetInternal );
    5353
     
    307307        else
    308308        {
    309             callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode);
     309            callMemberNetworkFunction(&ControllableEntity::push, this->getObjectID(), 0, firemode);
    310310        }
    311311    }
     
    319319        else
    320320        {
    321             callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode);
     321            callMemberNetworkFunction(&ControllableEntity::release, this->getObjectID(), 0, firemode);
    322322        }
    323323    }
  • code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Spectator.cc

    r11071 r11175  
    4242namespace orxonox
    4343{
    44     extern const std::string __CC_fire_name;
     44    extern const std::string __CC_push_name;
    4545    extern const std::string __CC_suicide_name;
    4646
     
    162162
    163163        // change keybind mode of fire command to OnPress to avoid firing after respawn
    164         ModifyConsoleCommand(__CC_fire_name).keybindMode(KeybindMode::OnPress);
     164        ModifyConsoleCommand(__CC_push_name).keybindMode(KeybindMode::OnPress);
    165165
    166166        // disable suicide
     
    177177        // change fire command to a helper function and change keybind mode to OnPress
    178178        // as soon as the player releases and presses the button again, the helper function will be called which changes the keybind mode back to OnHold
    179         ModifyConsoleCommand(__CC_fire_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress);
     179        ModifyConsoleCommand(__CC_push_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress);
    180180
    181181        // enable suicide
     
    188188    void Spectator::resetFireCommand(unsigned int firemode)
    189189    {
    190         ModifyConsoleCommand(__CC_fire_name).popFunction().keybindMode(KeybindMode::OnHold); // pop this helper function and change keybind mode
    191 
    192         CommandExecutor::execute(__CC_fire_name + " " + multi_cast<std::string>(firemode)); // call the fire command again, this time with the real function
     190        ModifyConsoleCommand(__CC_push_name).popFunction().keybindMode(KeybindMode::OnHold); // pop this helper function and change keybind mode
     191
     192        CommandExecutor::execute(__CC_push_name + " " + multi_cast<std::string>(firemode)); // call the fire command again, this time with the real function
    193193    }
    194194
     
    229229    }
    230230
    231     void Spectator::fired(unsigned int firemode)
     231    void Spectator::pushed(unsigned int firemode)
    232232    {
    233233        if (this->getPlayer())
  • code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Spectator.h

    r9667 r11175  
    5454            virtual void rotateRoll(const Vector2& value);
    5555
    56             virtual void fired(unsigned int firemode);
     56            virtual void pushed(unsigned int firemode);
    5757            virtual void greet();
    5858            virtual void mouseLook() {}
Note: See TracChangeset for help on using the changeset viewer.