Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10688


Ignore:
Timestamp:
Oct 24, 2015, 10:51:18 PM (9 years ago)
Author:
fvultier
Message:

There is now a HUD that shows the status of the weapon system: all weapons, weapon modes and their munition. Progress bars show the progress of replenishing munition.

Location:
code/branches/fabienHS15
Files:
10 added
2 deleted
38 edited

Legend:

Unmodified
Added
Removed
  • code/branches/fabienHS15/data/levels/includes/weaponSettingsAssff.oxi

    r10677 r10688  
    2424            <Model mesh="hs-w01_reduced.mesh" roll="90" pitch="-76" yaw="-90" position="-1.5,1,0.3" scale=0.6 />
    2525          </attached>
    26           <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" />
    27           <HsW01 mode=0 munitionpershot=0 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" />
     26          <HsW01 mode=0 munitionpershot=1 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" />
     27          <HsW01 mode=0 munitionpershot=1 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" />
    2828          <LightningGun mode=1 munitionpershot=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20 />
    2929        </Weapon>
     
    3434            <Model mesh="hs-w01_reduced.mesh" roll="90" pitch="-104" yaw="-90" position="0,1.3,0.3" scale=0.6 />
    3535          </attached>
    36           <HsW01 mode=0 munitionpershot=0 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" />
    37           <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" />
     36          <HsW01 mode=0 munitionpershot=1 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" />
     37          <HsW01 mode=0 munitionpershot=1 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" />
    3838          <LightningGun mode=1 munitionpershot=1 muzzleoffset="0,0,0" damage=23 />
    3939        </Weapon>
  • code/branches/fabienHS15/data/levels/includes/weaponSettingsAssff2.oxi

    r10677 r10688  
    2323            <BlinkingBillboard position="-1.9, -.5, -5.5" material="PE/lensflare" colour="0.128, 0.28, 1" amplitude=0.25 frequency=16 quadratic=0 />
    2424          </attached>
    25           <HsW01 mode=0 munitionpershot=0 delay=0.125 healthamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6,1.3,-2.0" />
    26           <HsW01 mode=0 munitionpershot=0 delay=0 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6,1.3,-2.0" />
     25          <HsW01 mode=0 munitionpershot=1 delay=0.125 healthamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6,1.3,-2.0" />
     26          <HsW01 mode=0 munitionpershot=1 delay=0 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6,1.3,-2.0" />
    2727          <LightningGun mode=1 munitionpershot=1 muzzleoffset="0,0,0" shielddamage=23 />
    2828        </Weapon>
     
    3232            <BlinkingBillboard position="1.9, -.5, -5.5" material="PE/lensflare" colour="0.128, 0.28, 1" amplitude=0.25 frequency=16 quadratic=0 />
    3333          </attached>
    34           <HsW01 mode=0 munitionpershot=0 delay=0 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 1.6,1.3,-2.0" />
    35           <HsW01 mode=0 munitionpershot=0 delay=0.125 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1,1.6,-2.0" />
     34          <HsW01 mode=0 munitionpershot=1 delay=0 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 1.6,1.3,-2.0" />
     35          <HsW01 mode=0 munitionpershot=1 delay=0.125 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1,1.6,-2.0" />
    3636          <LightningGun mode=1 munitionpershot=1 muzzleoffset="0,0,0" shielddamage=23 />
    3737        </Weapon>
  • code/branches/fabienHS15/data/levels/includes/weaponSettingsSwallow.oxi

    r10629 r10688  
    22      <WeaponSlot position=" 8,1.66,-17.5" />
    33      <WeaponSlot position="-8,1.66,-17.5" />
     4      <WeaponSlot position="0,1.66,-17.5" />
    45    </weaponslots>
    56    <weaponsets>
     
    1415        </links>
    1516        <Weapon>
    16           <SplitGun mode=0 munitionpershot=0 damage=6.0 muzzleoffset="0.5,0.6,1.7" splittime=0.2 numberofsplits=2 numberofchilds=3 spread=0.1 damagereduction=2.0 />
     17          <SplitGun mode=0 munitionpershot=1 damage=6.0 muzzleoffset="0.5,0.6,1.7" splittime=0.2 numberofsplits=2 numberofchilds=3 spread=0.1 damagereduction=2.0 />
     18          <LaserFire mode=1 munitionpershot=0 damage=10.0 muzzleoffset="0.5,0.6,1.7" />
    1719        </Weapon>
    1820        <Weapon>
    19           <SplitGun mode=0 munitionpershot=0 damage=6.0 muzzleoffset="-0.5,0.6,1.7" splittime=0.2 numberofsplits=2 numberofchilds=3 spread=0.1 damagereduction=2.0 />
    20         </Weapon>
     21          <SplitGun mode=0 munitionpershot=1 damage=6.0 muzzleoffset="-0.5,0.6,1.7" splittime=0.2 numberofsplits=2 numberofchilds=3 spread=0.1 damagereduction=2.0 />
     22          <LaserFire mode=1 munitionpershot=0 damage=10.0 muzzleoffset="-0.5,0.6,1.7" />
     23        </Weapon>       
    2124      </WeaponPack>
    2225    </weapons>
  • code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo

    r10292 r10688  
    127127     mapAngle3D                         = 0.6435011
    128128    />
     129
     130    <HUDWeaponSystem
     131     name                   = "WeaponSystem"
     132     correctaspect          = false
     133     size                   = "0.6, 0.1"
     134     position               = "0.0, 0.0"
     135     pickpoint              = "0, 0"
     136     visible                = "true"
     137    />
    129138   
    130139    <HUDTimer
  • code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt

    r9939 r10688  
    88  HUDTimer.cc
    99  HUDEnemyHealthBar.cc
     10  HUDWeaponMode.cc
     11  HUDWeapon.cc
     12  HUDWeaponSystem.cc
    1013  ChatOverlay.cc
    1114  AnnounceMessage.cc
  • code/branches/fabienHS15/src/modules/weapons/munitions/CMakeLists.txt

    r10629 r10688  
    11ADD_SOURCE_FILES(WEAPONS_SRC_FILES
    2   ReplenishingMunition.cc
    32  LaserMunition.cc
     3  LightningMunition.cc
    44  FusionMunition.cc
    55  RocketMunition.cc
  • code/branches/fabienHS15/src/modules/weapons/munitions/FusionMunition.cc

    r9667 r10688  
    2828
    2929/**
    30     @file FusionMunition.h
     30    @file FusionMunition.cc
    3131    @brief Implementation of the FusionMunition class.
    3232*/
     
    4747        this->magazines_ = 10;
    4848
    49         this->bUseSeparateMagazines_ = true;
    50         this->bStackMunition_ = false;
     49        this->deployment_ = DEPLOYMENT_SEPARATE;
     50
    5151        this->reloadTime_ = 1.0f;
    5252
    5353        this->bAllowMunitionRefilling_ = true;
    5454        this->bAllowMultiMunitionRemovementUnderflow_ = true;
     55
     56        this->reloadTime_ = 0.5f;
    5557    }
    5658}
  • code/branches/fabienHS15/src/modules/weapons/munitions/GravityBombMunition.cc

    r10622 r10688  
    1919        this->magazines_ = 15;
    2020
    21         this->bUseSeparateMagazines_ = false;
    22         this->bStackMunition_ = true;
     21        this->deployment_ = DEPLOYMENT_STACK;
    2322
    2423        this->bAllowMunitionRefilling_ = true;
    2524        this->bAllowMultiMunitionRemovementUnderflow_ = false;
     25
     26        this->reloadTime_ = 0.0f;
    2627    }
    2728
  • code/branches/fabienHS15/src/modules/weapons/munitions/IceMunition.cc

    r10629 r10688  
    2828
    2929/**
    30     @file IceMunition.h
     30    @file IceMunition.cc
    3131    @brief Implementation of the IceMunition class.
    3232*/
     
    4747        this->magazines_ = 25;
    4848
    49         this->bUseSeparateMagazines_ = false;
    50         this->bStackMunition_ = true;
     49        this->deployment_ = DEPLOYMENT_STACK;
    5150
    5251        this->bAllowMunitionRefilling_ = false;
    5352        this->bAllowMultiMunitionRemovementUnderflow_ = false;
     53
     54        this->reloadTime_ = 0.5f;
    5455    }
    5556}
  • code/branches/fabienHS15/src/modules/weapons/munitions/LaserMunition.cc

    r9667 r10688  
    2828
    2929/**
    30     @file LaserMunition.h
     30    @file LaserMunition.cc
    3131    @brief Implementation of the LaserMunition class.
    3232*/
     
    4343        RegisterObject(LaserMunition);
    4444
    45         this->maxMunitionPerMagazine_ = 20;
    46         this->maxMagazines_ = 1;
    47         this->magazines_ = 1;
     45        this->maxMunitionPerMagazine_ = 10;
     46        this->maxMagazines_ = 10;
     47        this->magazines_ = 10;
    4848
    49         this->bUseSeparateMagazines_ = false;
    50         this->bStackMunition_ = true;
     49        this->deployment_ = DEPLOYMENT_SEPARATE;
    5150
    5251        this->bAllowMunitionRefilling_ = true;
     
    5554        this->replenishInterval_ = 0.5f;
    5655        this->replenishMunitionAmount_ = 1;
     56
     57        this->reloadTime_ = 0.8f;
    5758    }
    5859}
  • code/branches/fabienHS15/src/modules/weapons/munitions/LaserMunition.h

    r9667 r10688  
    3636
    3737#include "weapons/WeaponsPrereqs.h"
    38 #include "ReplenishingMunition.h"
     38#include "weaponsystem/ReplenishingMunition.h"
    3939
    4040namespace orxonox
  • code/branches/fabienHS15/src/modules/weapons/munitions/RocketMunition.cc

    r9667 r10688  
    2828
    2929/**
    30     @file RocketMunition.h
     30    @file RocketMunition.cc
    3131    @brief Implementation of the RocketMunition class.
    3232*/
     
    4747        this->magazines_ = 10;
    4848
    49         this->bUseSeparateMagazines_ = false;
    50         this->bStackMunition_ = true;
     49        this->deployment_ = DEPLOYMENT_STACK;
    5150
    5251        this->bAllowMunitionRefilling_ = false;
    5352        this->bAllowMultiMunitionRemovementUnderflow_ = false;
     53
     54        this->reloadTime_ = 0.5f;
    5455    }
    5556}
  • code/branches/fabienHS15/src/modules/weapons/munitions/SplitMunition.cc

    r10629 r10688  
    2828
    2929/**
    30     @file SplitMunition.h
     30    @file SplitMunition.cc
    3131    @brief Implementation of the SplitMunition class.
    3232*/
     
    4747        this->magazines_ = 25;
    4848
    49         this->bUseSeparateMagazines_ = false;
    50         this->bStackMunition_ = true;
     49        this->deployment_ = DEPLOYMENT_STACK;
    5150
    5251        this->bAllowMunitionRefilling_ = true;
    5352        this->bAllowMultiMunitionRemovementUnderflow_ = false;
     53
     54        this->reloadTime_ = 0.5f;
    5455    }
    5556}
  • code/branches/fabienHS15/src/modules/weapons/projectiles/GravityBombField.cc

    r10622 r10688  
    164164        if (lifetime_ <= -4)
    165165        {
    166             orxout(debug_output) << "Timeout. Destroying field." << endl;
    167166            this->destroy();
    168167        }
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/EnergyDrink.cc

    r10622 r10688  
    6363        this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&EnergyDrink::shot, this)));
    6464        this->delayTimer_.stopTimer();
     65
     66        hudImageString_ = "Orxonox/WSHUD_WM_EnergyDrink";
    6567    }
    6668
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/FusionFire.cc

    r10622 r10688  
    5858
    5959        this->setMunitionName("FusionMunition");
     60
     61        hudImageString_ = "Orxonox/WSHUD_WM_FusionFire";
    6062    }
    6163
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/GravityBombFire.cc

    r10622 r10688  
    3131        this->setMunitionName("GravityBombMunition");
    3232        this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.8);    ///< sets sound of the bomb as it is fired.
     33
     34        hudImageString_ = "Orxonox/WSHUD_WM_GravityBombFire";
    3335    }
    3436
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/HsW01.cc

    r10296 r10688  
    6969
    7070        this->setDefaultSound(this->sound_);
     71
     72        hudImageString_ = "Orxonox/WSHUD_WM_HsW01";
    7173    }
    7274
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/IceGun.cc

    r10629 r10688  
    5959        this->setFreezeFactor(0.5);
    6060
    61         this->setMunitionName("LaserMunition");
     61        this->setMunitionName("IceMunition");
    6262        this->setDefaultSound("sounds/Weapon_LightningGun.ogg");
     63
     64        hudImageString_ = "Orxonox/WSHUD_WM_IceGun";
    6365    }
    6466
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/LaserFire.cc

    r10622 r10688  
    5656
    5757        this->setMunitionName("LaserMunition");
     58
     59        hudImageString_ = "Orxonox/WSHUD_WM_LaserFire";
    5860    }
    5961
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/LightningGun.cc

    r10296 r10688  
    5454        this->speed_ = 750.0f;
    5555
    56         this->setMunitionName("LaserMunition");
     56        this->setMunitionName("LightningMunition");
    5757        this->setDefaultSound("sounds/Weapon_LightningGun.ogg");
     58
     59        hudImageString_ = "Orxonox/WSHUD_WM_LightningGun";
    5860    }
    5961
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/RocketFire.cc

    r10296 r10688  
    5959        this->setMunitionName("RocketMunition");
    6060        // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
     61
     62        hudImageString_ = "Orxonox/WSHUD_WM_RocketFire";
    6163    }
    6264
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/RocketFireOld.cc

    r10622 r10688  
    5959        this->setMunitionName("RocketMunition");
    6060        // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
     61
     62        hudImageString_ = "Orxonox/WSHUD_WM_SimpleRocketFire";
    6163    }
    6264
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/SimpleRocketFire.cc

    r9667 r10688  
    6464        this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.4f);
    6565        // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
     66
     67        hudImageString_ = "Orxonox/WSHUD_WM_SimpleRocketFire";
    6668    }
    6769
     
    8991
    9092        WorldEntity* pawn = static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
    91         if (pawn) controller->setTarget(pawn);
     93        if (pawn)
     94            controller->setTarget(pawn);
    9295    }
    9396}
  • code/branches/fabienHS15/src/modules/weapons/weaponmodes/SplitGun.cc

    r10629 r10688  
    6262        this->setMunitionName("SplitMunition");
    6363        this->setDefaultSound("sounds/Weapon_LightningGun.ogg");
     64
     65        hudImageString_ = "Orxonox/WSHUD_WM_SplitGun";
    6466    }
    6567
  • code/branches/fabienHS15/src/orxonox/weaponsystem/CMakeLists.txt

    r5781 r10688  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  Munition.cc
     3  ReplenishingMunition.cc
    34  Weapon.cc
    45  WeaponMode.cc
  • code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.cc

    r9667 r10688  
    4545        this->magazines_ = 10;
    4646
    47         this->bUseSeparateMagazines_ = false;
    48         this->bStackMunition_ = true;
     47        this->deployment_ = DEPLOYMENT_STACK;
    4948        this->bAllowMunitionRefilling_ = true;
    5049        this->bAllowMultiMunitionRemovementUnderflow_ = true;
    5150
    52         this->reloadTime_ = 0;
     51        this->reloadTime_ = 0.5f;
    5352    }
    5453
     
    6160    Munition::Magazine* Munition::getMagazine(WeaponMode* user) const
    6261    {
    63         if (this->bUseSeparateMagazines_)
     62        if (deployment_ == DEPLOYMENT_SEPARATE)
    6463        {
    6564            // For separated magazines we definitively need a given user
     
    8786        if (magazine)
    8887        {
    89             if (this->bStackMunition_)
     88            if (deployment_ == DEPLOYMENT_STACK)
    9089                // With stacked munition every magazine contributes to the total amount
    9190                return this->maxMunitionPerMagazine_ * this->magazines_ + magazine->munition_;
     
    109108    unsigned int Munition::getNumMagazines() const
    110109    {
    111         if (this->bStackMunition_)
     110        if (deployment_ == DEPLOYMENT_STACK)
    112111        {
    113112            // If we stack munition and the current magazine is still full, it counts too
     
    122121    unsigned int Munition::getMaxMunition() const
    123122    {
    124         if (this->bStackMunition_)
     123        if (deployment_ == DEPLOYMENT_STACK)
    125124            return this->maxMunitionPerMagazine_ * this->maxMagazines_;
    126125        else
     
    135134            unsigned int munition = magazine->munition_;
    136135
    137             // If we stack munition, we con't care about the current magazine - we just need enough munition in total
    138             if (this->bStackMunition_)
     136            // If we stack munition, we don't care about the current magazine - we just need enough munition in total
     137            if (deployment_ == DEPLOYMENT_STACK)
    139138                munition += this->maxMunitionPerMagazine_ * this->magazines_;
    140139
     
    169168            {
    170169                // Not enough munition
    171                 if (this->bStackMunition_)
     170                if (deployment_ == DEPLOYMENT_STACK)
    172171                {
    173172                    // We stack munition, so just take what we can and then load the next magazine
     
    199198    {
    200199        // As long as we have enough magazines (and don't stack munition) we can reload
    201         return (this->magazines_ > 0 && !this->bStackMunition_);
     200        return (this->magazines_ > 0 && !deployment_ == DEPLOYMENT_STACK);
    202201    }
    203202
     
    207206        if (magazine)
    208207        {
    209             if (this->bStackMunition_)
     208            if (deployment_ == DEPLOYMENT_STACK)
    210209                // With stacked munition, we never have to reload
    211210                return false;
     
    231230
    232231        // If we use separate magazines for each user, we definitively need a user given
    233         if (this->bUseSeparateMagazines_ && !user)
     232        if (deployment_ == DEPLOYMENT_SEPARATE && !user)
    234233            return false;
    235234
    236235        // If we don't use separate magazines, set user to 0
    237         if (!this->bUseSeparateMagazines_)
     236        if (!deployment_ == DEPLOYMENT_SEPARATE)
    238237            user = 0;
    239238
     
    260259            return false;
    261260
    262         if (this->bStackMunition_)
     261        if (deployment_ == DEPLOYMENT_STACK)
    263262        {
    264263            // If we stack munition, we can always add munition until we reach the limit
     
    281280            return false;
    282281
    283         if (this->bStackMunition_)
     282        if (deployment_ == DEPLOYMENT_STACK)
    284283        {
    285284            // Stacking munition means, if a magazine gets full, the munition adds to a new magazine
     
    340339        // TODO: 'amount' is not used
    341340
    342         if (this->bStackMunition_)
     341        if (deployment_ == DEPLOYMENT_STACK)
    343342            // If we stack munition, we can always add new magazines because they contribute directly to the munition
    344343            return (this->getNumMunition(0) < this->getMaxMunition());
     
    357356
    358357        // If zero or less magazines are needed, we definitively don't need more magazines (unless we stack munition - then a magazine contributes directly to the munition)
    359         if (needed_magazines <= 0 && !this->bStackMunition_)
     358        if (needed_magazines <= 0 && !deployment_ == DEPLOYMENT_STACK)
    360359            return false;
    361360
     
    369368            // We get more magazines than we need, so just add the needed amount
    370369            this->magazines_ += needed_magazines;
    371             if (this->bStackMunition_)
     370            if (deployment_ == DEPLOYMENT_STACK)
    372371            {
    373372                // We stack munition, so the additional amount contributes directly to the munition of the current magazine
     
    383382    bool Munition::canRemoveMagazines(unsigned int amount) const
    384383    {
    385         if (this->bStackMunition_)
     384        if (deployment_ == DEPLOYMENT_STACK)
    386385        {
    387386            if (this->magazines_ >= amount)
     
    422421            this->magazines_ -= amount;
    423422        }
    424         else if (this->bStackMunition_)
     423        else if (deployment_ == DEPLOYMENT_STACK)
    425424        {
    426425            // We don't have enough magazines, but we're stacking munition, so additionally remove the bullets from the current magazine
     
    437436    {
    438437        // If we use separate magazines, we need a user
    439         if (this->bUseSeparateMagazines_ && !user)
     438        if (deployment_ == DEPLOYMENT_SEPARATE && !user)
    440439            return false;
    441440
    442441        // If we don't use separate magazines, set user to 0
    443         if (!this->bUseSeparateMagazines_)
     442        if (!deployment_ == DEPLOYMENT_SEPARATE)
    444443            user = 0;
    445444
     
    465464        this->bLoaded_ = false;
    466465
    467         if (bUseReloadTime && munition->reloadTime_ > 0 && !munition->bStackMunition_)
     466        if (bUseReloadTime && munition->reloadTime_ > 0 && !munition->deployment_ == DEPLOYMENT_STACK)
    468467        {
    469468            const ExecutorPtr& executor = createExecutor(createFunctor(&Magazine::loaded, this));
  • code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.h

    r9667 r10688  
    3939namespace orxonox
    4040{
     41    enum Deployment
     42    {
     43        DEPLOYMENT_SHARE,
     44        DEPLOYMENT_STACK,
     45        DEPLOYMENT_SEPARATE
     46    };
     47
     48
    4149    class _OrxonoxExport Munition : public BaseObject
    42     {
     50    {       
    4351        struct Magazine
    4452        {
     
    6876            inline unsigned int getMaxMunitionPerMagazine() const
    6977                { return this->maxMunitionPerMagazine_; }
     78            inline bool getUseSeparateMagazines() const
     79                { return deployment_ == DEPLOYMENT_SEPARATE; }
     80            inline bool getStackMunition() const
     81                { return deployment_ == DEPLOYMENT_STACK; }
    7082
    7183            bool canTakeMunition(unsigned int amount, WeaponMode* user) const;
     
    95107            std::map<WeaponMode*, Magazine*> currentMagazines_;
    96108
    97             bool bUseSeparateMagazines_;
    98             bool bStackMunition_;
     109            Deployment deployment_;
     110
    99111            bool bAllowMunitionRefilling_;
    100112            bool bAllowMultiMunitionRemovementUnderflow_;
  • code/branches/fabienHS15/src/orxonox/weaponsystem/Weapon.cc

    r10650 r10688  
    134134    }
    135135
     136    /**
     137    @brief
     138        Reload all @ref orxonox::WeaponMode weapon modes of this weapon.
     139    */
    136140    void Weapon::reload()
    137141    {
  • code/branches/fabienHS15/src/orxonox/weaponsystem/Weapon.h

    r10650 r10688  
    5757            void addWeaponmode(WeaponMode* weaponmode);
    5858            WeaponMode* getWeaponmode(unsigned int index) const;
     59            inline std::multimap<unsigned int, WeaponMode*>* getAllWeaponmodes()
     60                { return &weaponmodes_; }
     61            inline int getNumWeaponModes() const
     62                { return weaponmodes_.size(); }
    5963
    6064            /**
  • code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponMode.cc

    r10650 r10688  
    7575        this->muzzleOrientation_ = Quaternion::IDENTITY;
    7676
     77        hudImageString_ = "WSHUD_WM_Unknown";
     78
    7779        if( GameMode::isMaster() )
    7880        {
     
    125127            this->bSoundAttached_ = true;
    126128        }
    127 
     129       
     130        // Fireing is only possible if this weapon mode is not reloading and there is enough munition
    128131        if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this))
    129132        {
     
    134137                if (this->munition_->reload(this))
    135138                {
     139                    // If true, the weapon reloads in parallel to the magazine reloading
    136140                    if (this->bParallelReload_)
     141                    {
     142                        // The time needed to reload is the maximum of the reload time of the weapon mode and the magazine.
    137143                        tempReloadtime = std::max(this->reloadTime_, this->munition_->getReloadTime());
     144                    }                       
    138145                    else
     146                    {
     147                        // The time needed to reload is the sum of the reload time of the weapon mode and the magazine.
    139148                        tempReloadtime = this->reloadTime_ + this->munition_->getReloadTime();
     149                    }                       
    140150                }
    141151            }
    142152
     153            // Mark this weapon mode as reloading and start the reload timer
    143154            this->bReloading_ = true;
    144155            this->reloadTimer_.setInterval(tempReloadtime);
     
    283294    }
    284295
    285     void WeaponMode::setDefaultSoundWithVolume(const std::string& soundPath, const float soundVolume){
    286         if (this->defSndWpnFire_) {
     296    void WeaponMode::setDefaultSoundWithVolume(const std::string& soundPath, const float soundVolume)
     297    {
     298        if (this->defSndWpnFire_)
     299        {
    287300            this->defSndWpnFire_->setSource(soundPath);
    288301            this->defSndWpnFire_->setVolume(soundVolume);
  • code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponMode.h

    r10650 r10688  
    3838#include "core/class/SubclassIdentifier.h"
    3939#include "tools/Timer.h"
     40#include "Munition.h"
    4041
    4142namespace orxonox
     
    104105            inline bool getParallelReload() const
    105106                { return this->bParallelReload_; }
     107            inline bool getReloading() const
     108                { return this->bReloading_; }
    106109
    107110
     
    147150            Vector3 getTarget();
    148151
     152            inline const std::string& getHUDImageString() const
     153                { return this->hudImageString_; }           
     154
    149155        protected:
    150156            virtual void fire() = 0;
     
    155161
    156162            float reloadTime_;
    157             bool bAutoReload_;
    158             bool bParallelReload_;
     163            bool bAutoReload_; // If true, the weapon reloads the magazine automatically.
     164            bool bParallelReload_; // If true, the weapon reloads in parallel to the magazine reloading.
    159165
    160166            float damage_;
     
    162168            float shielddamage_;
    163169            Vector3 muzzleOffset_;
     170
     171            std::string hudImageString_;
    164172
    165173        private:
     
    175183
    176184            Timer reloadTimer_;
    177             bool bReloading_;
     185            bool bReloading_; // If true, this weapon mode is marked as reloading.
    178186
    179187            Vector3 muzzlePosition_;
  • code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponPack.cc

    r10650 r10688  
    124124    }
    125125
     126    std::vector<Weapon*>* WeaponPack::getAllWeapons()
     127    {
     128        return &weapons_;       
     129    }   
     130
    126131    void WeaponPack::addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link)
    127132    {
  • code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponPack.h

    r9667 r10688  
    5252            void removeWeapon(Weapon * weapon);
    5353            Weapon * getWeapon(unsigned int index) const;
     54            std::vector<Weapon*>* getAllWeapons();
    5455
    5556            inline size_t getNumWeapons() const
  • code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponSystem.cc

    r10650 r10688  
    240240    }
    241241
     242    std::vector<WeaponPack *> * WeaponSystem::getAllWeaponPacks()
     243    {
     244        return &weaponPacks_;
     245    }   
     246
    242247    bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2)
    243248    {
  • code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponSystem.h

    r10650 r10688  
    6767            void removeWeaponPack(WeaponPack * wPack);
    6868            WeaponPack * getWeaponPack(unsigned int index) const;
     69            std::vector<WeaponPack *> * getAllWeaponPacks();
    6970
    7071            // configure slots and firemodes
  • code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc

    r10650 r10688  
    554554    }
    555555
     556    std::vector<WeaponPack *> * Pawn::getAllWeaponPacks()
     557    {
     558        if (this->weaponSystem_)
     559            return this->weaponSystem_->getAllWeaponPacks();
     560        else
     561            return 0;       
     562    }   
     563
    556564    //Tell the Map (RadarViewable), if this is a playership
    557565    void Pawn::startLocalHumanControl()
  • code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h

    r10437 r10688  
    154154            void addWeaponPackXML(WeaponPack * wPack);
    155155            WeaponPack * getWeaponPack(unsigned int index) const;
     156            std::vector<WeaponPack *> * getAllWeaponPacks();
    156157
    157158            virtual void addedWeaponPack(WeaponPack* wPack) {}
Note: See TracChangeset for help on using the changeset viewer.