Changeset 9720 for code/branches/sfxThilo/src/modules
- Timestamp:
- Oct 28, 2013, 3:58:45 PM (11 years ago)
- Location:
- code/branches/sfxThilo/src/modules/pong
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sfxThilo/src/modules/pong/Pong.cc
r9667 r9720 47 47 #include "PongBot.h" 48 48 #include "PongAI.h" 49 49 50 namespace orxonox 50 51 { … … 117 118 } 118 119 } 120 119 121 } 120 122 -
code/branches/sfxThilo/src/modules/pong/PongBall.cc
r9667 r9720 40 40 41 41 #include "PongBat.h" 42 43 #include "sound/WorldSound.h" //Thilo 44 #include "core/XMLPort.h" 42 45 43 46 namespace orxonox … … 66 69 67 70 this->registerVariables(); 71 72 //Thilo 73 if (GameMode::isMaster()) 74 { 75 this->defScoreSound_ = new WorldSound(this->getContext()); 76 this->defScoreSound_->setLooping(false); 77 this->defBatSound_ = new WorldSound(this->getContext()); 78 this->defBatSound_->setLooping(false); 79 this->defBoundarySound_ = new WorldSound(this->getContext()); 80 this->defBoundarySound_->setLooping(false); 81 } 82 else 83 { 84 this->defScoreSound_ = 0; 85 } 68 86 } 69 87 … … 81 99 delete[] this->batID_; 82 100 } 101 } 102 103 //Thilo 104 void PongBall::XMLPort(Element& xmlelement, XMLPort::Mode mode) 105 { 106 SUPER(PongBall, XMLPort, xmlelement, mode); 107 XMLPortParam(PongBall, "defScoreSound", setDefScoreSound, getDefScoreSound, xmlelement, mode); 108 XMLPortParam(PongBall, "defBatSound", setDefBatSound, getDefBatSound, xmlelement, mode); 109 XMLPortParam(PongBall, "defBoundarySound", setDefBoundarySound, getDefBoundarySound, xmlelement, mode); 83 110 } 84 111 … … 155 182 else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_)) 156 183 { 184 defScoreSound_->play();//Thilo 157 185 if (this->getGametype() && this->bat_[0]) 158 186 { … … 182 210 else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_)) 183 211 { 212 defScoreSound_->play();//Thilo 184 213 if (this->getGametype() && this->bat_[1]) 185 214 { … … 262 291 this->bat_[1] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1])); 263 292 } 293 294 void PongBall::setDefScoreSound(const std::string &pongSound) 295 { 296 if( defScoreSound_ ) 297 defScoreSound_->setSource(pongSound); 298 else 299 assert(0); // This should never happen, because soundpointer is only available on master 300 } 301 302 const std::string& PongBall::getDefScoreSound() 303 { 304 if( defScoreSound_ ) 305 return defScoreSound_->getSource(); 306 else 307 assert(0); 308 return BLANKSTRING; 309 } 310 311 void PongBall::setDefBatSound(const std::string &pongSound) 312 { 313 if( defBatSound_ ) 314 defBatSound_->setSource(pongSound); 315 else 316 assert(0); // This should never happen, because soundpointer is only available on master 317 } 318 319 const std::string& PongBall::getDefBatSound() 320 { 321 if( defBatSound_ ) 322 return defBatSound_->getSource(); 323 else 324 assert(0); 325 return BLANKSTRING; 326 } 327 328 void PongBall::setDefBoundarySound(const std::string &pongSound) 329 { 330 if( defBoundarySound_ ) 331 defBoundarySound_->setSource(pongSound); 332 else 333 assert(0); // This should never happen, because soundpointer is only available on master 334 } 335 336 const std::string& PongBall::getDefBoundarySound() 337 { 338 if( defBoundarySound_ ) 339 return defBoundarySound_->getSource(); 340 else 341 assert(0); 342 return BLANKSTRING; 343 } 264 344 } -
code/branches/sfxThilo/src/modules/pong/PongBall.h
r9667 r9720 42 42 #include "worldentities/MovableEntity.h" 43 43 44 44 45 namespace orxonox 45 46 { … … 63 64 64 65 virtual void tick(float dt); 66 67 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 65 68 66 69 /** … … 123 126 static const float MAX_REL_Z_VELOCITY; 124 127 128 void setDefScoreSound(const std::string& engineSound); //Thilo 129 const std::string& getDefScoreSound(); //Thilo 130 125 131 private: 126 132 void registerVariables(); … … 135 141 unsigned int* batID_; //!< The object IDs of the bats, to be able to synchronize them over the network. 136 142 float relMercyOffset_; //!< Offset, that makes the player not loose, when, in all fairness, he would have. 143 WorldSound* defScoreSound_;//Thilo 137 144 }; 138 145 } -
code/branches/sfxThilo/src/modules/pong/PongScore.cc
r9667 r9720 41 41 42 42 #include "Pong.h" 43 #include "sound/WorldSound.h" ///////////////////////////// 43 44 44 45 namespace orxonox -
code/branches/sfxThilo/src/modules/pong/PongScore.h
r9667 r9720 124 124 WeakPtr<PlayerInfo> player1_; //!< Store information about left player permanently. 125 125 WeakPtr<PlayerInfo> player2_; //!< Same for the right player. To end the game properly. 126 WorldSound* scoreSound_; 127 126 128 }; 127 129 }
Note: See TracChangeset
for help on using the changeset viewer.