Changeset 11034 for code/branches/presentationHS15/src
- Timestamp:
- Jan 4, 2016, 10:13:21 AM (9 years ago)
- Location:
- code/branches/presentationHS15
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationHS15
- Property svn:mergeinfo changed
/code/branches/fabienHS15 merged: 11027,11033
- Property svn:mergeinfo changed
-
code/branches/presentationHS15/src/libraries/core/input/KeyBinder.cc
r10624 r11034 359 359 /** 360 360 @brief 361 Return the first key name for a specific command in a human readable form 362 */ 363 const std::string& KeyBinder::getBindingReadable(const std::string& commandName) 364 { 365 const std::string& binding = this->getBinding(commandName); 366 367 SubString substring = SubString(binding, "."); 368 std::string name; 369 std::string group; 370 switch(substring.size()) 371 { 372 case 0: 373 return binding; 374 case 1: 375 return binding; 376 case 2: 377 group = substring[0]; 378 default: 379 name = substring.subSet(1).join("."); 380 } 381 382 std::stringstream stream; 383 if(group.compare("Keys") == 0) 384 stream << "Key " << name.substr(3); 385 else if(group.compare("MouseButtons") == 0) 386 stream << "Mouse " << name; 387 else if(group.compare("JoyStickButtons") == 0) 388 stream << "Joystick " << name; 389 else if(group.compare("JoyStickAxes") == 0) 390 stream << "Joystick Axis" << name.substr(5, 6) << name.substr(name.find("Axis")+6); 391 else if(group.compare("MouseAxes") == 0) 392 stream << "Mouse " << name.substr(1,3) << " " << name.substr(0, 1) << "-Axis"; 393 else 394 return binding; 395 396 return *(new std::string(stream.str())); 397 } 398 399 /** 400 @brief 361 401 Get the number of different key bindings of a specific command. 362 402 @param commandName -
code/branches/presentationHS15/src/libraries/core/input/KeyBinder.h
r9978 r11034 68 68 const std::string& getBinding(const std::string& commandName); //tolua_export 69 69 const std::string& getBinding(const std::string& commandName, unsigned int index); //tolua_export 70 const std::string& getBindingReadable(const std::string& commandName); //tolua_export 70 71 unsigned int getNumberOfBindings(const std::string& commandName); //tolua_export 71 72 -
code/branches/presentationHS15/src/modules/notifications/dispatchers/CommandNotification.cc
r9667 r11034 101 101 std::stringstream stream; 102 102 stream << this->getPreMessage(); 103 stream << this->bindingNiceifyer(KeyBinderManager::getInstance().getCurrent()->getBinding(this->getCommand()));103 stream << KeyBinderManager::getInstance().getCurrent()->getBindingReadable(this->getCommand()); 104 104 stream << this->getPostMessage(); 105 105 return *(new std::string(stream.str())); 106 106 } 107 108 /**109 @brief110 Transforms the input binding into a human readable form.111 @param binding112 The binding to be transformed113 @return114 Returns a human readable version of the input binding.115 */116 //TODO: Move to KeyBinderManager...117 const std::string& CommandNotification::bindingNiceifyer(const std::string& binding)118 {119 SubString substring = SubString(binding, ".");120 std::string name;121 std::string group;122 switch(substring.size())123 {124 case 0:125 return binding;126 case 1:127 return binding;128 case 2:129 group = substring[0];130 default:131 name = substring.subSet(1).join(".");132 }133 134 std::stringstream stream;135 if(group.compare("Keys") == 0)136 stream << "Key " << name.substr(3);137 else if(group.compare("MouseButtons") == 0)138 stream << "Mouse " << name;139 else if(group.compare("JoyStickButtons") == 0)140 stream << "Joystick " << name;141 else if(group.compare("JoyStickAxes") == 0)142 stream << "Joystick Axis" << name.substr(5, 6) << name.substr(name.find("Axis")+6);143 else if(group.compare("MouseAxes") == 0)144 stream << "Mouse " << name.substr(1,3) << " " << name.substr(0, 1) << "-Axis";145 else146 return binding;147 148 return *(new std::string(stream.str()));149 }150 151 107 } -
code/branches/presentationHS15/src/modules/notifications/dispatchers/CommandNotification.h
r9667 r11034 122 122 void setPostMessage(const std::string& message) 123 123 { this->postMessage_ = message; } 124 125 const std::string& bindingNiceifyer(const std::string& binding); //!< Transforms the input binding into a human readable form.126 127 124 }; 128 125 -
code/branches/presentationHS15/src/modules/towerdefense/TowerDefenseTower.cc
r10961 r11034 62 62 upgrade++; 63 63 this->setDamageMultiplier((upgrade+1)*2.0f); 64 64 65 //this->setRotationThrust(2*this->getRotationThrust()); 65 66 //this->addTemplate("towerturret1"); -
code/branches/presentationHS15/src/orxonox/weaponsystem/Munition.cc
r10961 r11034 542 542 this->bLoaded_ = false; 543 543 544 if (bUseReloadTime && munition->reloadTime_ > 0 && !munition->deployment_ == MunitionDeployment::Stack)544 if (bUseReloadTime && munition->reloadTime_ > 0 && munition->deployment_ != MunitionDeployment::Stack) 545 545 { 546 546 const ExecutorPtr& executor = createExecutor(createFunctor(&Magazine::loaded, this)); -
code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.cc
r10962 r11034 34 34 #include "core/GameMode.h" 35 35 #include "core/XMLPort.h" 36 #include "core/EventIncludes.h" 36 37 #include "network/NetworkFunction.h" 37 38 … … 62 63 63 64 this->bAlive_ = true; 65 this->bVulnerable_ = true; 64 66 65 67 this->health_ = 0; … … 136 138 XMLPortParam(Pawn, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0); 137 139 140 XMLPortParam(Pawn, "vulnerable", setVulnerable, isVulnerable, xmlelement, mode).defaultValues(true); 141 138 142 XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode); 139 143 XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f); … … 145 149 XMLPortObject(Pawn, Munition, "munition", addMunitionXML, getMunitionXML, xmlelement, mode); 146 150 151 XMLPortObject(Pawn, ExplosionPart, "explosion", addExplosionPart, getExplosionPart, xmlelement, mode); 147 152 XMLPortParam(Pawn, "shieldrechargerate", setShieldRechargeRate, getShieldRechargeRate, xmlelement, mode).defaultValues(0); 148 153 XMLPortParam(Pawn, "shieldrechargewaittime", setShieldRechargeWaitTime, getShieldRechargeWaitTime, xmlelement, mode).defaultValues(1.0f); 149 XMLPortObject(Pawn, ExplosionPart, "explosion", addExplosionPart, getExplosionPart, xmlelement, mode);150 154 151 155 XMLPortParam(Pawn, "explosionSound", setExplosionSound, getExplosionSound, xmlelement, mode); 152 156 153 157 XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode ); 158 } 159 160 void Pawn::XMLEventPort(Element& xmlelement, XMLPort::Mode mode) 161 { 162 SUPER(Pawn, XMLEventPort, xmlelement, mode); 163 164 XMLPortEventState(Pawn, BaseObject, "vulnerability", setVulnerable, xmlelement, mode); 154 165 } 155 166 … … 246 257 } 247 258 259 void Pawn::changedVulnerability() 260 { 261 262 } 263 248 264 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) 249 265 { 266 // A pawn can only get damaged if it is vulnerable 267 if (!isVulnerable()) 268 { 269 return; 270 } 271 250 272 // Applies multiplier given by the DamageBoost Pickup. 251 273 if (originator) -
code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.h
r10970 r11034 64 64 65 65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 66 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); 66 67 virtual void tick(float dt); 67 68 … … 133 134 134 135 virtual void decreaseShieldRechargeCountdownTime(float dt); 136 137 /** @brief Sets the state of the pawns vulnerability. @param bVulnerable */ 138 inline void setVulnerable(bool bVulnerable) 139 { 140 if (this->bVulnerable_ != bVulnerable) 141 { 142 this->bVulnerable_ = bVulnerable; 143 this->changedVulnerability(); 144 } 145 } 146 /** @brief Returns the state of the pawns vulnerability. @return The state of the vulnerability */ 147 inline const bool& isVulnerable() const { return this->bVulnerable_; } 148 /** @brief This function gets called if the vulnerability of the pawn changes. */ 149 virtual void changedVulnerability(); 135 150 136 151 inline ControllableEntity* getLastHitOriginator() const … … 219 234 220 235 bool bAlive_; 236 bool bVulnerable_; ///< If false the pawn may not ged damaged 221 237 222 238 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
Note: See TracChangeset
for help on using the changeset viewer.