Changeset 10791 for code/branches/fabienHS15/src
- Timestamp:
- Nov 9, 2015, 5:55:42 PM (9 years ago)
- Location:
- code/branches/fabienHS15/src
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc
r10739 r10791 73 73 this->textOverlayLeft_ = new OverlayText(this->getContext()); 74 74 assert(this->textOverlayLeft_.get()); 75 this->textOverlayLeft_->setCaption("? ??");75 this->textOverlayLeft_->setCaption("?"); 76 76 textOverlayLeft_->setPickPoint(Vector2(0.0f,0.0f)); 77 77 textOverlayLeft_->setVisible(true); … … 83 83 84 84 this->textOverlayRight_ = new OverlayText(this->getContext()); 85 assert(this->textOverlay Left_.get());86 this->textOverlayRight_->setCaption("? ??");85 assert(this->textOverlayRight_.get()); 86 this->textOverlayRight_->setCaption("?"); 87 87 textOverlayRight_->setPickPoint(Vector2(0.0f,0.0f)); 88 88 textOverlayRight_->setVisible(true); … … 93 93 textOverlayRight_->setZOrder(600); 94 94 95 materialNameState_ = "Orxonox/WSHUD_ Reloading";95 materialNameState_ = "Orxonox/WSHUD_Empty"; 96 96 97 97 overlayElementReplenish_->setMaterialName("Orxonox/WSHUD_Replenish"); … … 155 155 materialNameState_ = "Orxonox/WSHUD_Empty"; 156 156 } 157 } 158 159 if (munition->isA(Class(ReplenishingMunition)))160 {161 ReplenishingMunition* replenishingMunition = dynamic_cast<ReplenishingMunition*>(munition); 162 163 if (replenishingMunition->canAddMunition(1))164 {165 float progress = 1.0f - replenishingMunition->getProgress();166 overlayElementReplenish_->setDimensions(1.0f,progress);167 }168 else169 {170 overlayElementReplenish_->setDimensions(1.0f,1.0f);157 158 if (munition->isA(Class(ReplenishingMunition))) 159 { 160 ReplenishingMunition* replenishingMunition = dynamic_cast<ReplenishingMunition*>(munition); 161 162 if (replenishingMunition->canAddMunition(1)) 163 { 164 float progress = 1.0f - replenishingMunition->getProgress(); 165 overlayElementReplenish_->setDimensions(1.0f,progress); 166 } 167 else 168 { 169 overlayElementReplenish_->setDimensions(1.0f,1.0f); 170 } 171 171 } 172 172 } -
code/branches/fabienHS15/src/modules/weapons/munitions/FusionMunition.cc
r10713 r10791 34 34 #include "FusionMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h" 36 37 37 38 namespace orxonox … … 56 57 this->reloadTime_ = 0.5f; 57 58 } 59 60 void FusionMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 61 { 62 SUPER(FusionMunition, XMLPort, xmlelement, mode); 63 } 58 64 } -
code/branches/fabienHS15/src/modules/weapons/munitions/FusionMunition.h
r9667 r10791 53 53 FusionMunition(Context* context); 54 54 virtual ~FusionMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 56 }; 56 57 } -
code/branches/fabienHS15/src/modules/weapons/munitions/GravityBombMunition.cc
r10713 r10791 7 7 #include "GravityBombMunition.h" 8 8 #include "core/CoreIncludes.h" 9 #include "core/XMLPort.h" 9 10 10 11 namespace orxonox … … 27 28 } 28 29 30 void GravityBombMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 31 { 32 SUPER(GravityBombMunition, XMLPort, xmlelement, mode); 33 } 29 34 } 30 35 -
code/branches/fabienHS15/src/modules/weapons/munitions/GravityBombMunition.h
r10622 r10791 28 28 GravityBombMunition(Context* context); 29 29 virtual ~GravityBombMunition() {} 30 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 30 31 }; 31 32 -
code/branches/fabienHS15/src/modules/weapons/munitions/IceMunition.cc
r10715 r10791 34 34 #include "IceMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h" 36 37 37 38 namespace orxonox … … 54 55 this->reloadTime_ = 0.5f; 55 56 } 57 58 void IceMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 59 { 60 SUPER(IceMunition, XMLPort, xmlelement, mode); 61 } 56 62 } -
code/branches/fabienHS15/src/modules/weapons/munitions/IceMunition.h
r10629 r10791 53 53 IceMunition(Context* context); 54 54 virtual ~IceMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 56 }; 56 57 } -
code/branches/fabienHS15/src/modules/weapons/munitions/LaserMunition.cc
r10724 r10791 34 34 #include "LaserMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h" 36 37 37 38 namespace orxonox … … 53 54 54 55 this->replenishInterval_ = 0.5f; 55 this->replenish MunitionAmount_ = 1;56 this->replenishAmount_ = 1; 56 57 57 58 this->reloadTime_ = 0.5f; 58 59 } 60 61 void LaserMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 62 { 63 SUPER(LaserMunition, XMLPort, xmlelement, mode); 64 } 59 65 } -
code/branches/fabienHS15/src/modules/weapons/munitions/LaserMunition.h
r10688 r10791 53 53 LaserMunition(Context* context); 54 54 virtual ~LaserMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 56 }; 56 57 } -
code/branches/fabienHS15/src/modules/weapons/munitions/LightningMunition.cc
r10713 r10791 34 34 #include "LightningMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h" 36 37 37 38 namespace orxonox … … 54 55 this->reloadTime_ = 0.5f; 55 56 } 57 58 void LightningMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 59 { 60 SUPER(LightningMunition, XMLPort, xmlelement, mode); 61 } 56 62 } -
code/branches/fabienHS15/src/modules/weapons/munitions/LightningMunition.h
r10688 r10791 53 53 LightningMunition(Context* context); 54 54 virtual ~LightningMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 56 }; 56 57 } -
code/branches/fabienHS15/src/modules/weapons/munitions/RocketMunition.cc
r10715 r10791 34 34 #include "RocketMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h" 36 37 37 38 namespace orxonox … … 54 55 this->reloadTime_ = 0.5f; 55 56 } 57 58 void RocketMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 59 { 60 SUPER(RocketMunition, XMLPort, xmlelement, mode); 61 } 56 62 } -
code/branches/fabienHS15/src/modules/weapons/munitions/RocketMunition.h
r9667 r10791 53 53 RocketMunition(Context* context); 54 54 virtual ~RocketMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 56 }; 56 57 } -
code/branches/fabienHS15/src/modules/weapons/munitions/SplitMunition.cc
r10715 r10791 34 34 #include "SplitMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h" 36 37 37 38 namespace orxonox … … 54 55 this->reloadTime_ = 0.5f; 55 56 } 57 58 void SplitMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 59 { 60 SUPER(SplitMunition, XMLPort, xmlelement, mode); 61 } 56 62 } -
code/branches/fabienHS15/src/modules/weapons/munitions/SplitMunition.h
r10629 r10791 53 53 SplitMunition(Context* context); 54 54 virtual ~SplitMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 56 }; 56 57 } -
code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.cc
r10724 r10791 24 24 * Fabian 'x3n' Landau 25 25 * Co-authors: 26 * ...26 * Fabien Vultier 27 27 * 28 28 */ … … 32 32 #include "core/CoreIncludes.h" 33 33 #include "core/command/Executor.h" 34 #include "core/XMLPort.h" 34 35 35 36 namespace orxonox … … 58 59 for (std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it) 59 60 delete it->second; 61 } 62 63 void Munition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 64 { 65 SUPER(Munition, XMLPort, xmlelement, mode); 66 67 XMLPortParam(Munition, "initialmagazines", setNumMagazines, getNumMagazines, xmlelement, mode); 68 XMLPortParam(Munition, "maxmagazines", setMaxMagazines, getMaxMagazines, xmlelement, mode); 69 XMLPortParam(Munition, "munitionpermagazine", setMaxMunitionPerMagazine, getMaxMunitionPerMagazine, xmlelement, mode); 60 70 } 61 71 … … 121 131 } 122 132 133 void Munition::setNumMagazines(unsigned int numMagazines) 134 { 135 this->magazines_ = numMagazines; 136 } 137 123 138 unsigned int Munition::getMaxMunition() const 124 139 { … … 138 153 // If we stack munition, we don't care about the current magazine - we just need enough munition in total 139 154 if (deployment_ == MunitionDeployment::Stack) 155 { 140 156 munition += this->maxMunitionPerMagazine_ * this->magazines_; 157 } 141 158 142 159 if (munition == 0) 160 { 143 161 // Absolutely no munition - no chance to take munition 144 162 return false; 163 } 145 164 else if (this->bAllowMultiMunitionRemovementUnderflow_) 165 { 146 166 // We're not empty AND we allow underflow, so this will always work 147 167 return true; 168 } 148 169 else 170 { 149 171 // We don't allow underflow, so we have to check the amount 150 172 return (munition >= amount); 173 } 174 151 175 } 152 176 return false; … … 200 224 { 201 225 // As long as we have enough magazines (and don't stack munition) we can reload 202 return (this->magazines_ > 0 && !deployment_ == MunitionDeployment::Stack);226 return (this->magazines_ > 0 && deployment_ != MunitionDeployment::Stack); 203 227 } 204 228 … … 236 260 237 261 // If we don't use separate magazines, set user to 0 238 if (!deployment_ == MunitionDeployment::Separate) 239 user = 0; 262 if (deployment_ != MunitionDeployment::Separate) 263 { 264 user = NULL; 265 } 240 266 241 267 // Remove the current magazine for the given user … … 289 315 { 290 316 // Stacking munition means, if a magazine gets full, the munition adds to a new magazine 291 Magazine* magazine = this->getMagazine( 0);317 Magazine* magazine = this->getMagazine(NULL); 292 318 if (magazine) 293 319 { … … 386 412 387 413 // 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) 388 if (needed_magazines <= 0 && !deployment_ == MunitionDeployment::Stack)414 if (needed_magazines <= 0 && deployment_ != MunitionDeployment::Stack) 389 415 return false; 390 416 … … 470 496 471 497 // If we don't use separate magazines, set user to 0 472 if ( !deployment_ == MunitionDeployment::Separate)473 user = 0;498 if (deployment_ != MunitionDeployment::Separate) 499 user = NULL; 474 500 475 501 // Remove the current magazine for the given user -
code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.h
r10724 r10791 24 24 * Fabian 'x3n' Landau 25 25 * Co-authors: 26 * ...26 * Fabien Vultier 27 27 * 28 28 */ … … 68 68 Munition(Context* context); 69 69 virtual ~Munition(); 70 71 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 70 72 71 73 unsigned int getNumMunition(WeaponMode* user) const; … … 118 120 private: 119 121 Magazine* getMagazine(WeaponMode* user) const; 122 inline void setMaxMagazines(unsigned int maxMagazines) 123 { this->maxMagazines_ = maxMagazines; } 124 inline void setMaxMunitionPerMagazine(unsigned int maxMunitionPerMagazine) 125 { this->maxMunitionPerMagazine_ = maxMunitionPerMagazine; } 126 void setNumMagazines(unsigned int numMagazines); 120 127 }; 121 128 } -
code/branches/fabienHS15/src/orxonox/weaponsystem/ReplenishingMunition.cc
r10688 r10791 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/command/Executor.h" 38 #include "core/XMLPort.h" 38 39 39 40 namespace orxonox … … 46 47 47 48 this->replenishInterval_ = 1.0f; 48 this->replenish MunitionAmount_ = 1;49 this->replenishAmount_ = 1; 49 50 50 51 // Use the timer to initialize itself after the first tick (because the real values for … … 53 54 this->replenishingTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&ReplenishingMunition::initializeTimer, this))); 54 55 } 56 57 void ReplenishingMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 58 { 59 SUPER(ReplenishingMunition, XMLPort, xmlelement, mode); 60 61 XMLPortParam(ReplenishingMunition, "replenishamount", setReplenishAmount, getReplenishAmount, xmlelement, mode); 62 XMLPortParam(ReplenishingMunition, "replenishinterval", setReplenishInterval, getReplenishInterval, xmlelement, mode); 63 } 55 64 56 65 float ReplenishingMunition::getProgress() … … 67 76 void ReplenishingMunition::replenish() 68 77 { 69 if (this->canAddMunition(this->replenish MunitionAmount_))78 if (this->canAddMunition(this->replenishAmount_)) 70 79 { 71 80 // Make a temporary copy of bAllowMunitionRefilling_, because this might be disallowed in every … … 75 84 76 85 // Replenish munition 77 this->addMunition(this->replenish MunitionAmount_);86 this->addMunition(this->replenishAmount_); 78 87 79 88 // Write back the temporary value -
code/branches/fabienHS15/src/orxonox/weaponsystem/ReplenishingMunition.h
r10688 r10791 53 53 ReplenishingMunition(Context* context); 54 54 virtual ~ReplenishingMunition() {} 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 57 55 58 virtual float getProgress(); 56 inline float getReplenishingMunitionAmount() const 57 { return replenishMunitionAmount_; } 59 inline float getReplenishAmount() const 60 { return replenishAmount_; } 61 inline float getReplenishInterval() const 62 { return replenishInterval_; } 58 63 59 64 protected: 60 65 float replenishInterval_; //!< The interval in which the munition is replenished. 61 unsigned int replenish MunitionAmount_; //!< The amount by which it is replenished.66 unsigned int replenishAmount_; //!< The amount by which it is replenished. 62 67 63 68 private: … … 66 71 67 72 Timer replenishingTimer_; //!< Timer to do the replenishing. 73 74 inline void setReplenishAmount(unsigned int replenishAmount) 75 { this->replenishAmount_ = replenishAmount; } 76 inline void setReplenishInterval(float replenishInterval) 77 { this->replenishInterval_ = replenishInterval; } 68 78 }; 69 79 } -
code/branches/fabienHS15/src/orxonox/weaponsystem/Weapon.cc
r10688 r10791 155 155 it->second->setWeapon(this); 156 156 } 157 158 void Weapon::updateMunition() 159 { 160 for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it) 161 it->second->updateMunition(); 162 } 157 163 } -
code/branches/fabienHS15/src/orxonox/weaponsystem/Weapon.h
r10688 r10791 79 79 inline WeaponSlot * getWeaponSlot() const 80 80 { return this->weaponSlot_; } 81 void updateMunition(); 81 82 82 83 private: -
code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponMode.cc
r10688 r10791 243 243 } 244 244 else 245 this->munition_ = 0; 245 { 246 this->munition_ = NULL; 247 } 246 248 } 247 249 -
code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponMode.h
r10688 r10791 153 153 { return this->hudImageString_; } 154 154 155 void updateMunition(); 155 156 protected: 156 157 virtual void fire() = 0; … … 171 172 std::string hudImageString_; 172 173 173 private: 174 void updateMunition(); 174 private: 175 175 void reloaded(); 176 176 … … 189 189 190 190 WorldSound* defSndWpnFire_; 191 bool 191 bool bSoundAttached_; 192 192 }; 193 193 } -
code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponPack.cc
r10688 r10791 161 161 (*it)->setWeaponPack(this); 162 162 } 163 164 void WeaponPack::updateMunition() 165 { 166 for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it) 167 (*it)->updateMunition(); 168 } 163 169 } -
code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponPack.h
r10688 r10791 66 66 inline WeaponSystem * getWeaponSystem() const 67 67 { return this->weaponSystem_; } 68 void updateMunition(); 68 69 69 70 private: -
code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponSystem.cc
r10688 r10791 315 315 return it->second; 316 316 } 317 else if (identifier->getIdentifier()->isA(Class(Munition)))318 {319 Munition* munition = identifier->fabricate(this->getContext());320 this->munitions_[identifier->getIdentifier()] = munition;321 return munition;322 }323 317 else 324 318 { 325 return 0; 319 return NULL; 320 } 321 } 322 323 void WeaponSystem::addMunition(Munition* munition) 324 { 325 if (munition == NULL) 326 { 327 return; 328 } 329 330 SubclassIdentifier<Munition> identifier = munition->getIdentifier(); 331 332 if (identifier) 333 { 334 this->munitions_[identifier] = munition; 335 updateMunition(); 336 } 337 else 338 { 339 orxout(internal_warning) << "Adding munition failed. identifier == NULL " << endl; 340 } 341 } 342 343 void WeaponSystem::updateMunition() 344 { 345 for (std::vector<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it) 346 { 347 (*it)->updateMunition(); 326 348 } 327 349 } -
code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponSystem.h
r10688 r10791 77 77 78 78 Munition * getMunition(SubclassIdentifier<Munition> * identifier); 79 void addMunition(Munition* munition); 79 80 80 81 inline void setPawn(Pawn * pawn) … … 96 97 97 98 private: 99 void updateMunition(); 100 98 101 std::map<unsigned int, WeaponSet *> weaponSets_; 99 102 std::vector<WeaponSlot *> weaponSlots_; -
code/branches/fabienHS15/src/orxonox/worldentities/MobileEntity.h
r10437 r10791 47 47 linear velocity. Then the linear velocity is multiplied by the time since the last call of tick and then added to the position. The same happens with 48 48 the angular acceleration and velocity. With this procedure MobileEntities can change their position and orientation with time. 49 50 A MobileEntity can only have the collisition type WorldEntity::None, WorldEntity::Dynamic or WorldEntity::Kinematic. The collsion type WorldEntity::Static is illegal. 49 51 */ 50 52 -
code/branches/fabienHS15/src/orxonox/worldentities/StaticEntity.h
r10437 r10791 44 44 it is called StaticEntity. It will keep the same position (always with respect to its parent) forever unless you call the 45 45 function @see setPosition to changee it. 46 47 A StaticEntity can only have the collisition type WorldEntity::None or WorldEntity::Static. The collsion types WorldEntity::Dynamic and WorldEntity::Kinematic are illegal. 46 48 */ 47 49 -
code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc
r10746 r10791 46 46 #include "weaponsystem/WeaponPack.h" 47 47 #include "weaponsystem/WeaponSet.h" 48 #include "weaponsystem/Munition.h" 48 49 #include "sound/WorldSound.h" 49 50 … … 139 140 XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode); 140 141 XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode); 141 XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode); 142 XMLPortObject(Pawn, WeaponPack, "weaponpacks", addWeaponPackXML, getWeaponPack, xmlelement, mode); 143 XMLPortObject(Pawn, Munition, "munition", addMunitionXML, getMunitionXML, xmlelement, mode); 142 144 143 145 XMLPortParam(Pawn, "reloadrate", setShieldRechargeRate, getShieldRechargeRate, xmlelement, mode).defaultValues(0); … … 557 559 } 558 560 561 void Pawn::addMunitionXML(Munition* munition) 562 { 563 if (this->weaponSystem_ && munition) 564 { 565 this->weaponSystem_->addMunition(munition); 566 } 567 } 568 569 Munition* Pawn::getMunitionXML() const 570 { 571 return NULL; 572 } 573 559 574 Munition* Pawn::getMunition(SubclassIdentifier<Munition> * identifier) 560 575 { … … 570 585 void Pawn::startLocalHumanControl() 571 586 { 572 // SUPER(ControllableEntity, changedPlayer());587 // SUPER(ControllableEntity, startLocalHumanControl()); 573 588 ControllableEntity::startLocalHumanControl(); 574 589 this->isHumanShip_ = true; -
code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h
r10746 r10791 151 151 WeaponPack * getWeaponPack(unsigned int index) const; 152 152 std::vector<WeaponPack *> * getAllWeaponPacks(); 153 154 void addMunitionXML(Munition* munition); 155 Munition* getMunitionXML() const; 153 156 154 Munition 157 Munition* getMunition(SubclassIdentifier<Munition> * identifier); 155 158 156 159 virtual void addedWeaponPack(WeaponPack* wPack) {} -
code/branches/fabienHS15/src/orxonox/worldentities/pawns/SpaceShip.h
r10746 r10791 54 54 - The <b>boost shaking</b>, when the SpaceShip boosts, the camera shakes to create a more immersive effect. Two parameters can be used to adjust the effect. The <b>shakeFrequency</b> is the frequency with which the camera shakes. And the <b>shakeAmplitude</b> is the amount with which the camera shakes. Again these parameters must bee non-negative. 55 55 - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again two parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated. 56 57 A spaceship always needs to have the collision type "dynamic". Other collision types are illegal. 56 58 57 59 As mentioned @ref orxonox::Engine Engines can be mounted on the SpaceShip. Here is a (primitive) example of a SpaceShip defined in XML:
Note: See TracChangeset
for help on using the changeset viewer.