Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10715


Ignore:
Timestamp:
Oct 27, 2015, 9:08:40 PM (9 years ago)
Author:
fvultier
Message:
 
Location:
code/branches/fabienHS15
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt

    r10692 r10715  
    212212    activationType = "immediate"
    213213    durationType = "once"
    214     amount = 10
    215     munitiontype = "LightningMunition"
    216   />
     214  >
     215    <munitioncontainers>
     216        <MunitionContainer munitiontype="LaserMunition" munitionamount=16 magazinesamount=0 />
     217        <MunitionContainer munitiontype="FusionMunition" munitionamount=8 magazinesamount=0 />
     218        <MunitionContainer munitiontype="LightningMunition" munitionamount=8 magazinesamount=0 />
     219    </munitioncontainers>
     220  </MunitionPickup>
    217221</Template>
    218222
     
    238242    activationType = "immediate"
    239243    durationType = "once"
    240     amount = 20
    241     munitiontype = "LightningMunition"
    242   />
    243 </Template>
     244  >
     245    <munitioncontainers>
     246        <MunitionContainer munitiontype="LaserMunition" munitionamount=32 magazinesamount=0 />
     247        <MunitionContainer munitiontype="FusionMunition" munitionamount=16 magazinesamount=0 />
     248        <MunitionContainer munitiontype="LightningMunition" munitionamount=16 magazinesamount=0 />       
     249        <MunitionContainer munitiontype="SplitMunition" munitionamount=8 magazinesamount=0 />
     250        <MunitionContainer munitiontype="RocketMunition" munitionamount=0 magazinesamount=2 />
     251    </munitioncontainers>
     252  </MunitionPickup></Template>
    244253
    245254<Template name=hugemunitionpickupRepresentation>
     
    264273    activationType = "immediate"
    265274    durationType = "once"
    266     amount = 30
    267     munitiontype = "LightningMunition"
    268   />
     275  >
     276    <munitioncontainers>
     277        <MunitionContainer munitiontype="LaserMunition" munitionamount=64 magazinesamount=0 />
     278        <MunitionContainer munitiontype="FusionMunition" munitionamount=32 magazinesamount=0 />
     279        <MunitionContainer munitiontype="LightningMunition" munitionamount=32 magazinesamount=0 />       
     280        <MunitionContainer munitiontype="SplitMunition" munitionamount=16 magazinesamount=0 />
     281        <MunitionContainer munitiontype="RocketMunition" munitionamount=0 magazinesamount=10 />
     282        <MunitionContainer munitiontype="IceMunition" munitionamount=0 magazinesamount=10 />
     283        <MunitionContainer munitiontype="GravityBombMunition" munitionamount=0 magazinesamount=10 />
     284    </munitioncontainers>
     285  </MunitionPickup>
    269286</Template>
    270287
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc

    r10688 r10715  
    7575    {
    7676        SUPER(HUDWeapon, tick, dt);
    77 
    78         if (this->owner_)
    79         {
    80 
    81         }
    8277    }   
    8378
     
    10196    {
    10297        SUPER(HUDWeapon, changedOverlayGroup);
    103 
    104         //this->getOverlayGroup()->addElement(this->textOverlay_.get());
    10598    }   
    10699
     
    108101    {
    109102        SUPER(HUDWeapon, changedVisibility);
    110 
    111         //this->textOverlay_->setVisible(this->isVisible());
    112103    }
    113104
     
    115106    {
    116107        SUPER(HUDWeapon, changedName);
    117 
    118         //this->textOverlay_->setName(this->getName() + "text");
    119108    }
    120109
  • code/branches/fabienHS15/src/modules/pickup/PickupPrereqs.h

    r9348 r10715  
    8585    class ShrinkPickup;
    8686    class DamageBoostPickup;
     87    class MunitionPickup;
     88    class MunitionContainer;
    8789}
    8890
  • code/branches/fabienHS15/src/modules/pickup/items/CMakeLists.txt

    r10692 r10715  
    99  DamageBoostPickup.cc
    1010  MunitionPickup.cc
     11  MunitionContainer.cc
    1112)
  • code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc

    r10692 r10715  
    3838#include "core/XMLPort.h"
    3939
    40 #include "worldentities/pawns/SpaceShip.h"
     40#include "worldentities/pawns/Pawn.h"
    4141
    4242namespace orxonox
     
    7171        //Defines who is allowed to pick up the pickup.
    7272        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
    73         munitionAmount_ = 1;
    74         setMunitionName("LaserMunition");
    7573    }
    7674
     
    8381        SUPER(MunitionPickup, XMLPort, xmlelement, mode);
    8482
    85         XMLPortParam(MunitionPickup, "amount", setMunitionAmount, getMunitionAmount, xmlelement, mode);
    86         XMLPortParam(MunitionPickup, "munitiontype", setMunitionName, getMunitionName, xmlelement, mode);
     83        XMLPortObject(MunitionPickup, MunitionContainer, "munitioncontainers", addMunitionContainer, getMunitionContainer, xmlelement, mode);
     84    }
     85
     86    void MunitionPickup::addMunitionContainer(MunitionContainer* munitionContainer)
     87    {
     88        OrxAssert(munitionContainer != NULL, "The munitionContainer cannot be NULL.");
     89        this->munitionContainers_.push_back(munitionContainer);
     90    }
     91
     92    MunitionContainer* MunitionPickup::getMunitionContainer(unsigned int index)
     93    {
     94        if(this->munitionContainers_.size() >= index)
     95            return NULL;
     96        else
     97            return this->munitionContainers_[index];
    8798    }
    8899
     
    104115        if(this->isUsed())
    105116        {
    106             //Get pointer to the appropriate munition
    107             Munition* munition = pawn->getMunition(&munitionType_);
    108             if (munition)
     117            for(std::vector<MunitionContainer*>::iterator it = this->munitionContainers_.begin(); it != this->munitionContainers_.end(); ++it)
    109118            {
    110                 // Add munition
    111                 munition->addMunition(munitionAmount_);
    112                 // This will destroy the pickp
    113                 this->setUsed(false);
    114             }           
     119                //Get pointer to the appropriate munition
     120                SubclassIdentifier<Munition> identifier = (*it)->getMunitionType();
     121                Munition* munition = pawn->getMunition(&identifier);
     122                if (munition)
     123                {
     124                    // Add munition and magzines
     125                    munition->addMunition((*it)->getMunitionAmount());
     126                    munition->addMagazines((*it)->getMagazinesAmount());
     127                }
     128                (*it)->destroy();
     129            }
     130            // This will destroy the pickp
     131            this->setUsed(false);
    115132        }
    116133        else
     
    118135            this->Pickupable::destroy();
    119136        }       
    120     }
     137    }   
    121138
    122139    /**
     
    136153        }
    137154        return pawn;
    138     }
    139 
    140     void MunitionPickup::setMunitionName(const std::string& munitionname)
    141     {
    142         Identifier* identifier = ClassByString(munitionname);
    143         if (identifier)
    144         {
    145             this->munitionType_ = identifier;
    146         }
    147         else
    148         {
    149             orxout(internal_warning) << "No munition class defined in MunitionPickup." << endl;
    150         }
    151     }
    152 
    153     void MunitionPickup::setMunitionAmount(int munitionAmount)
    154     {
    155         if (munitionAmount > 0)
    156         {
    157             munitionAmount_ = munitionAmount;
    158         }
    159         else
    160         {
    161             munitionAmount = 0;
    162         }
    163     }
     155    }     
    164156}
    165157
  • code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.h

    r10692 r10715  
    3939
    4040#include <string>
     41#include <vector>
    4142
    4243#include "pickup/Pickup.h"
     44#include "pickup/items/MunitionContainer.h"
    4345#include "core/class/SubclassIdentifier.h"
    4446#include "weaponsystem/Munition.h"
     
    5860            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    5961
    60         protected:
    61             void setMunitionName(const std::string& munitionname);
    62             inline const std::string& getMunitionName() const
    63                 { return this->munitionname_; }
    64             void setMunitionAmount(int munitionAmount);
    65             inline int getMunitionAmount() const
    66                 { return this->munitionAmount_; }
     62            virtual void addMunitionContainer(MunitionContainer* munitionContainer);
     63            MunitionContainer* getMunitionContainer(unsigned int index);
    6764
    6865        private:           
    6966            void initialize(void); //!< Initializes the member variables.
    7067            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    71 
    72             SubclassIdentifier<Munition> munitionType_; //!< Indentifier of the munition type.
    73             std::string munitionname_; //!< String containing the class name of the munition type (e.g. "LaserMunition")
    74             int munitionAmount_; //!< The amount of munition added if the pickup is used
     68           
     69            std::vector<MunitionContainer*> munitionContainers_;
    7570
    7671    };
  • code/branches/fabienHS15/src/modules/weapons/munitions/IceMunition.cc

    r10713 r10715  
    4949        this->deployment_ = MunitionDeployment::Stack;
    5050
    51         this->bAllowMunitionRefilling_ = false;
     51        this->bAllowMunitionRefilling_ = true;
    5252        this->bAllowMultiMunitionRemovementUnderflow_ = false;
    5353
  • code/branches/fabienHS15/src/modules/weapons/munitions/RocketMunition.cc

    r10713 r10715  
    4949        this->deployment_ = MunitionDeployment::Stack;
    5050
    51         this->bAllowMunitionRefilling_ = false;
     51        this->bAllowMunitionRefilling_ = true;
    5252        this->bAllowMultiMunitionRemovementUnderflow_ = false;
    5353
  • code/branches/fabienHS15/src/modules/weapons/munitions/SplitMunition.cc

    r10713 r10715  
    4343        RegisterObject(SplitMunition);
    4444
    45         this->maxMunitionPerMagazine_ = 1;
    46         this->maxMagazines_ = 100;
    47         this->magazines_ = 25;
     45        this->maxMunitionPerMagazine_ = 5;
     46        this->maxMagazines_ = 10;
     47        this->magazines_ = 5;
    4848
    49         this->deployment_ = MunitionDeployment::Stack;
     49        this->deployment_ = MunitionDeployment::Share;
    5050
    5151        this->bAllowMunitionRefilling_ = true;
Note: See TracChangeset for help on using the changeset viewer.