Changeset 7062 for code/branches/presentation3
- Timestamp:
- May 31, 2010, 4:55:05 PM (14 years ago)
- Location:
- code/branches/presentation3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw
r7031 r7062 3 3 include("stats.oxo") 4 4 include("templates/spaceship_assff.oxt") 5 include("templates/spaceship_ H2.oxt")5 include("templates/spaceship_ghost.oxt") 6 6 include("dynamicmatchhud.oxo") 7 include("templates/lodinformation.oxt") 7 8 ?> 8 9 … … 12 13 gametype = "Dynamicmatch" 13 14 > 15 <templates> 16 <Template link=lodtemplate_default /> 17 </templates> 18 14 19 <Scene 15 20 ambientlight = "0.5, 0.5, 0.5" … … 52 57 createSpaceStationPar(0,2,1,2,1,4,1,50) 53 58 ?> 54 <TeamSpawnPoint team=2 position="20,20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>55 <TeamSpawnPoint team=2 position="-20,-20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>56 <TeamSpawnPoint team=2 position="-10,10,20" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>59 <TeamSpawnPoint team=2 position="20,20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipghost/> 60 <TeamSpawnPoint team=2 position="-20,-20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipghost/> 61 <TeamSpawnPoint team=2 position="-10,10,20" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipghost/> 57 62 </attached> 58 63 </StaticEntity> -
code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc
r7031 r7062 49 49 } 50 50 51 void GametypeStaticMessage::staticmessage(const GametypeInfo* gtinfo, const std::string& message )51 void GametypeStaticMessage::staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour) 52 52 { 53 53 if (this->owner_ && this->owner_->getGametypeInfo() == gtinfo) 54 { 55 this->setColour(colour); 54 56 this->setCaption(message); 57 } 55 58 } 56 59 -
code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h
r7031 r7062 48 48 virtual void changedOwner(); 49 49 50 void staticmessage(const GametypeInfo* gtinfo, const std::string& message );50 void staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour); 51 51 52 52 private: -
code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc
r7031 r7062 82 82 this->pointsPerTime=0.0f; 83 83 this->setHUDTemplate("DynamicmatchHUD"); 84 84 this->allowDeath=false; 85 this->notYet=true; 85 86 } 86 87 … … 119 120 playerParty_[victim->getPlayer()]=piggy; //victim's new party: pig 120 121 setPlayerColour(victim->getPlayer()); //victim's new colour 121 numberOf[piggy]++; //party switch: number of players is not affected (decrease and increase) 122 numberOf[piggy]++; //party switch: number of players is not affected (decrease and increase) 123 124 if (target == killer) 125 { 126 allowDeath=true; 127 victim->kill(); //new ship 128 } 129 122 130 if(tutorial) //announce party switch 123 131 { … … 125 133 if (it2 != this->players_.end()) 126 134 { 127 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it2->first->getClientID() );135 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it2->first->getClientID(), partyColours_[chaser]); 128 136 this->gtinfo_->sendFadingMessage("You're now a victim.",it2->first->getClientID()); 129 137 } … … 135 143 setPlayerColour(originator->getPlayer()); //originator's new colour 136 144 numberOf[killer]++; 145 allowDeath=true; 146 originator->kill(); //new ship for killer 137 147 if(tutorial) //announce party switch 138 148 { … … 140 150 if (it3 != this->players_.end()) 141 151 { 142 this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID() );152 this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID(), partyColours_[chaser]); 143 153 this->gtinfo_->sendFadingMessage("You're now a killer.",it3->first->getClientID()); 144 154 } … … 160 170 else if (notEnoughKillers) 161 171 { 162 numberOf[ target]--; //decrease numberof victims's party163 playerParty_[ victim->getPlayer()]=killer; //victim's new party: killer164 setPlayerColour( victim->getPlayer()); //victimcolour172 numberOf[source]--; //decrease numberof originator's party 173 playerParty_[originator->getPlayer()]=killer; //originator's new party: killer 174 setPlayerColour(originator->getPlayer()); //originator colour 165 175 numberOf[killer]++; //party switch: number of players is not affected (decrease and increase) 176 177 allowDeath=true; 178 originator->kill(); //new ship 166 179 if(tutorial) //announce party switch 167 180 { … … 169 182 if (it3 != this->players_.end()) 170 183 { 171 this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID() );184 this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID(),partyColours_[chaser]); 172 185 this->gtinfo_->sendFadingMessage("You're now a killer.",it3->first->getClientID()); 173 186 } … … 182 195 setPlayerColour(victim->getPlayer()); //victim colour 183 196 numberOf[chaser]++; //party switch: number of players is not affected (decrease and increase) 197 198 allowDeath=true; 199 victim->kill(); //new ship 200 184 201 if(tutorial) //announce party switch 185 202 { … … 188 205 { 189 206 if (numberOf[killer]>0) 190 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it3->first->getClientID() );207 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it3->first->getClientID(),partyColours_[piggy]); 191 208 192 209 else 193 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it3->first->getClientID() );210 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it3->first->getClientID(),partyColours_[piggy]); 194 211 this->gtinfo_->sendFadingMessage("You're now a chaser.",it3->first->getClientID()); 195 212 } … … 231 248 { 232 249 if (numberOf[killer]>0) 233 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID() );250 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(), partyColours_[piggy]); 234 251 else 235 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID() );252 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]); 236 253 this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 237 254 } … … 239 256 if (it2 != this->players_.end()) 240 257 { 241 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it2->first->getClientID() );258 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it2->first->getClientID(),partyColours_[chaser]); 242 259 this->gtinfo_->sendFadingMessage("You're now a victim.",it2->first->getClientID()); 243 260 } … … 261 278 setPlayerColour(victim->getPlayer()); //victim colour 262 279 setPlayerColour(originator->getPlayer()); //originator colour 263 280 281 notYet=false; 282 allowDeath=true; 283 victim->kill(); //new ship 284 originator->kill(); //new ship 285 286 264 287 if(tutorial) //Announce pary switch 265 288 { … … 267 290 if (it != this->players_.end()) 268 291 { 269 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID() );292 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]); 270 293 this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 271 294 } … … 273 296 if (it2 != this->players_.end()) 274 297 { 275 this->gtinfo_->sendStaticMessage("Take the chasers down.",it2->first->getClientID() );298 this->gtinfo_->sendStaticMessage("Take the chasers down.",it2->first->getClientID(),partyColours_[chaser]); 276 299 this->gtinfo_->sendFadingMessage("You're now a killer.",it2->first->getClientID()); 277 300 } … … 295 318 bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator) 296 319 { 320 if (allowDeath)//Hack for Ghost-Spaceship 321 { 322 if (notYet) 323 {allowDeath=false;} 324 else 325 {notYet=true;} 326 return true; 327 } 297 328 //killers can kill chasers and killers can be killed by chasers 298 329 if ((playerParty_[originator->getPlayer()] == killer && playerParty_[victim->getPlayer()] == chaser)||(playerParty_[victim->getPlayer()] == killer && … … 411 442 } 412 443 } 413 void Dynamicmatch::setPlayerColour(PlayerInfo* player) // sets a player s colour444 void Dynamicmatch::setPlayerColour(PlayerInfo* player) // sets a player's colour 414 445 { 415 446 std::map<PlayerInfo*, int>::const_iterator it_player = this->playerParty_.find(player); … … 445 476 if (it->first->getClientID() == CLIENTID_UNKNOWN) 446 477 continue; 447 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID() );478 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 448 479 } 449 480 } … … 463 494 { 464 495 if (numberOf[killer]>0) 465 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID() );496 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]); 466 497 else 467 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID() );498 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]); 468 499 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 469 500 } 470 501 else if (it->second==piggy) 471 502 { 472 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID() );503 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]); 473 504 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 474 505 } 475 506 else if (it->second==killer) 476 507 { 477 this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID() );508 this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]); 478 509 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 479 510 } … … 494 525 if (it->first->getClientID() == CLIENTID_UNKNOWN) 495 526 continue; 496 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID() );527 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 497 528 } 498 529 } … … 512 543 { 513 544 if (numberOf[killer]>0) 514 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID() );545 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]); 515 546 else 516 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID() );547 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]); 517 548 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 518 549 } 519 550 else if (it->second==piggy) 520 551 { 521 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID() );552 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[piggy]); 522 553 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 523 554 } 524 555 else if (it->second==killer) 525 556 { 526 this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID() );557 this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[piggy]); 527 558 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 528 559 } … … 544 575 if (it->first->getClientID() == CLIENTID_UNKNOWN) 545 576 continue; 546 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID() );577 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 547 578 } 548 579 } … … 562 593 { 563 594 if (numberOf[killer]>0) 564 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID() );595 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]); 565 596 else 566 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID() );597 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]); 567 598 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 568 599 } 569 600 else if (it->second==piggy) 570 601 { 571 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID() );602 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]); 572 603 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 573 604 } 574 605 else if (it->second==killer) 575 606 { 576 this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID() );607 this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]); 577 608 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 578 609 } … … 625 656 if (it->first->getClientID() == CLIENTID_UNKNOWN) 626 657 continue; 627 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID() );658 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 628 659 } 629 660 } … … 651 682 COUT(0) << message << std::endl; 652 683 Host::Broadcast(message); 653 /*for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)654 {655 if (it->first->getClientID() == CLIENTID_UNKNOWN)656 continue;657 658 if (it->second == 1)659 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());660 else661 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());662 }*/663 684 } 664 685 SpawnPoint* Dynamicmatch::getBestSpawnPoint(PlayerInfo* player) const -
code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h
r7031 r7062 79 79 protected: 80 80 81 bool allowDeath; 82 bool notYet; 81 83 std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here 82 84 std::vector<ColourValue> partyColours_; //aus TeamDeathmatch -
code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc
r7031 r7062 112 112 } 113 113 114 void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID )114 void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour) 115 115 { 116 116 if (GameMode::isMaster()) 117 117 { 118 118 if (clientID == CLIENTID_SERVER) 119 this->dispatchStaticMessage(message );119 this->dispatchStaticMessage(message, colour); 120 120 else 121 callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message );121 callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message, colour); 122 122 } 123 123 } … … 152 152 } 153 153 154 void GametypeInfo::dispatchStaticMessage(const std::string& message )154 void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour) 155 155 { 156 156 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) 157 it->staticmessage(this, message );157 it->staticmessage(this, message, colour); 158 158 } 159 159 -
code/branches/presentation3/src/orxonox/infos/GametypeInfo.h
r7031 r7062 64 64 void sendKillMessage(const std::string& message, unsigned int clientID); 65 65 void sendDeathMessage(const std::string& message, unsigned int clientID); 66 void sendStaticMessage(const std::string& message, unsigned int clientID );66 void sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour); 67 67 void sendFadingMessage(const std::string& message, unsigned int clientID); 68 68 … … 70 70 void dispatchKillMessage(const std::string& message); 71 71 void dispatchDeathMessage(const std::string& message); 72 void dispatchStaticMessage(const std::string& message );72 void dispatchStaticMessage(const std::string& message,const ColourValue& colour); 73 73 void dispatchFadingMessage(const std::string& message); 74 74 -
code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h
r7031 r7062 44 44 virtual void killmessage(const GametypeInfo* gtinfo, const std::string& message) {} 45 45 virtual void deathmessage(const GametypeInfo* gtinfo, const std::string& message) {} 46 virtual void staticmessage(const GametypeInfo* gtinfo, const std::string& message ) {}46 virtual void staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour) {} 47 47 virtual void fadingmessage(const GametypeInfo* gtinfo, const std::string& message) {} 48 48 };
Note: See TracChangeset
for help on using the changeset viewer.