Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11166 for code


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

today I got pawn'ed

Location:
code/branches/sagerjFS16
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sagerjFS16/data/levels/includes/weaponSettingsEscort.oxi

    r11052 r11166  
    11    <weaponslots>
    22      <WeaponSlot position="-9.2,2,-13" />
    3       <WeaponSlot position=" 9.2,2,-13" />
     3
    44    </weaponslots>
    55    <weaponsets>
    66      <WeaponSet firemode=0 />
    7       <WeaponSet firemode=1 />
     7
    88    </weaponsets>
    99    <weaponpacks>
     
    1111        <links>
    1212          <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
    13           <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
     13
    1414        </links>
    1515        <Weapon>
    16           <HsW01 mode=0 munitionpershot=1 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="LaserBeam2.mesh" />
     16          <Discharger mode=0 munitionpershot=1 delay=0     damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="LaserBeam2.mesh" />
    1717        </Weapon>
    18         <Weapon>
    19           <HsW01 mode=0 munitionpershot=1 delay=0     damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="LaserBeam2.mesh" />
    20         </Weapon>
     18   
    2119      </WeaponPack>
    22       <WeaponPack>
    23         <links>
    24           <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
    25         </links>
    26       </WeaponPack>
     20
    2721    </weaponpacks>
    2822    <munition>
  • code/branches/sagerjFS16/src/modules/weapons/WeaponsPrereqs.h

    r11052 r11166  
    107107    class SimpleRocketFire;
    108108    class GravityBombFire;
     109    class Discharger;
    109110}
    110111
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/CMakeLists.txt

    r11108 r11166  
    1313  GravityBombFire.cc
    1414  MineGun.cc
     15  Discharger.cc
    1516)
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc

    r11153 r11166  
    5151        RegisterObject(Discharger);
    5252
    53         this->reloadTime_ = 0.1f;
    54         this->damage_ = 9000.1f*loaded_;
    55         this->speed_ = 9000.1f*loaded_;
    56 
    57         this->setMunitionName("dEnergy");
    58         this->setFireSound("sounds/Weapon_Discharger.ogg");
    59         this->setReloadSound("sounds/Reload_Discharger.ogg", 0.8);
     53        this->setMunitionName("LaserMunition");
    6054
    6155        hudImageString_ = "Orxonox/WSHUD_WM_LaserFire";
    6256    }
    6357
    64     /**
    65     @brief
    66         Fires the weapon. Creates a projectile and fires it.
    67     */
    6858    void Discharger::fire()
    6959    {
    70         /*BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
    71 
    72         this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    73         projectile->setOrientation(this->getMuzzleOrientation());
    74         projectile->setPosition(this->getMuzzlePosition());
    75         projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
    76 
    77         projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    78         projectile->setDamage(this->getDamage());
    79         projectile->setShieldDamage(this->getShieldDamage());
    80         projectile->setHealthDamage(this->getHealthDamage());*/
    81         extern unsigned int beginLoad_ = time;
     60        orxout() << "fire dis " << endl;
    8261    }
    83     void Discharger::release()
     62   
     63    bool Discharger::fire(float* reloadTime)
    8464    {
    85         extern unsigned int endLoad_ = time;
    86         extern unsigned int loaded_ = endLoad_ - beginLoad_;
    87 
     65        orxout() << "fire Discharger " << endl;
     66        return false;
     67    }
     68    bool Discharger::release(float* reloadTime)
     69    {
     70        orxout() << "release Discharger " << endl;
     71        return false;
    8872    }
    8973}
  • code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h

    r11153 r11166  
    5555
    5656            virtual void fire() override;
    57             virtual void release() override;
     57            virtual bool fire(float* reloadTime) override;
     58            virtual bool release(float* reloadTime) override;
    5859
    5960        private:
    60             float speed_; //!< The speed of the fired projectile.
    61             float loaded_; // The time how long the weapon charged
    62             float beginLoad_;
    63             float endLoad_;
    6461    };
    6562}
  • 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.