Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7062


Ignore:
Timestamp:
May 31, 2010, 4:55:05 PM (15 years ago)
Author:
jo
Message:

coloured messages, different spaceships in one level, with bug

Location:
code/branches/presentation3
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/data/levels/gametype_dynamicmatch.oxw

    r7031 r7062  
    33  include("stats.oxo")
    44  include("templates/spaceship_assff.oxt")
    5   include("templates/spaceship_H2.oxt")
     5  include("templates/spaceship_ghost.oxt")
    66  include("dynamicmatchhud.oxo")
     7  include("templates/lodinformation.oxt")
    78?>
    89
     
    1213 gametype     = "Dynamicmatch"
    1314>
     15  <templates>
     16    <Template link=lodtemplate_default />
     17  </templates>
     18
    1419  <Scene
    1520   ambientlight = "0.5, 0.5, 0.5"
     
    5257                createSpaceStationPar(0,2,1,2,1,4,1,50)
    5358              ?>
    54                 <TeamSpawnPoint team=2 position="20,20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
    55                 <TeamSpawnPoint team=2 position="-20,-20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
    56                 <TeamSpawnPoint team=2 position="-10,10,20" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
     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/>
    5762            </attached>
    5863          </StaticEntity>
  • code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc

    r7031 r7062  
    4949    }
    5050
    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)
    5252    {
    5353    if (this->owner_ && this->owner_->getGametypeInfo() == gtinfo)
     54    {
     55        this->setColour(colour);
    5456        this->setCaption(message);
     57    }
    5558    }
    5659
  • code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h

    r7031 r7062  
    4848            virtual void changedOwner();
    4949
    50             void staticmessage(const GametypeInfo* gtinfo, const std::string& message);
     50            void staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour);
    5151           
    5252        private:
  • code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc

    r7031 r7062  
    8282        this->pointsPerTime=0.0f;
    8383        this->setHUDTemplate("DynamicmatchHUD");
    84 
     84        this->allowDeath=false;
     85        this->notYet=true;
    8586    }
    8687
     
    119120                playerParty_[victim->getPlayer()]=piggy;        //victim's new party: pig
    120121                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
    122130                    if(tutorial)                                //announce party switch
    123131                    {
     
    125133                         if (it2 != this->players_.end())
    126134                         {
    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]);
    128136                              this->gtinfo_->sendFadingMessage("You're now a victim.",it2->first->getClientID());
    129137                         }
     
    135143                        setPlayerColour(originator->getPlayer());               //originator's new colour
    136144                        numberOf[killer]++;
     145                        allowDeath=true;
     146                        originator->kill(); //new ship for killer
    137147                        if(tutorial)                            //announce party switch
    138148                        {
     
    140150                             if (it3 != this->players_.end())
    141151                             {
    142                                   this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID());
     152                                  this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID(), partyColours_[chaser]);
    143153                                  this->gtinfo_->sendFadingMessage("You're now a killer.",it3->first->getClientID());
    144154                             }
     
    160170            else if (notEnoughKillers)
    161171            {
    162                 numberOf[target]--;     //decrease numberof victims's party
    163                 playerParty_[victim->getPlayer()]=killer;       //victim's new party: killer
    164                 setPlayerColour(victim->getPlayer());           //victim colour
     172                numberOf[source]--;     //decrease numberof originator's party
     173                playerParty_[originator->getPlayer()]=killer;   //originator's new party: killer
     174                setPlayerColour(originator->getPlayer());       //originator colour
    165175                numberOf[killer]++;                             //party switch: number of players is not affected (decrease and increase)
     176
     177                allowDeath=true;
     178                originator->kill(); //new ship
    166179                if(tutorial)                            //announce party switch
    167180                {
     
    169182                     if (it3 != this->players_.end())
    170183                     {
    171                           this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID());
     184                          this->gtinfo_->sendStaticMessage("Take the chasers down.",it3->first->getClientID(),partyColours_[chaser]);
    172185                          this->gtinfo_->sendFadingMessage("You're now a killer.",it3->first->getClientID());
    173186                     }
     
    182195                setPlayerColour(victim->getPlayer());           //victim colour
    183196                numberOf[chaser]++;                             //party switch: number of players is not affected (decrease and increase)
     197               
     198                allowDeath=true;
     199                victim->kill(); //new ship
     200
    184201                if(tutorial)                                    //announce party switch
    185202                {
     
    188205                     {
    189206                          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]);
    191208                             
    192209                          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]);
    194211                          this->gtinfo_->sendFadingMessage("You're now a chaser.",it3->first->getClientID());
    195212                     }
     
    231248                     {   
    232249                          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]);
    234251                          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]);
    236253                          this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    237254                     }
     
    239256                     if (it2 != this->players_.end())
    240257                     {
    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]);
    242259                          this->gtinfo_->sendFadingMessage("You're now a victim.",it2->first->getClientID());
    243260                     }
     
    261278            setPlayerColour(victim->getPlayer());               //victim colour
    262279            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
    264287            if(tutorial) //Announce pary switch
    265288            {
     
    267290                 if (it != this->players_.end())
    268291                 {
    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]);
    270293                      this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    271294                 }
     
    273296                 if (it2 != this->players_.end())
    274297                 {
    275                       this->gtinfo_->sendStaticMessage("Take the chasers down.",it2->first->getClientID());
     298                      this->gtinfo_->sendStaticMessage("Take the chasers down.",it2->first->getClientID(),partyColours_[chaser]);
    276299                      this->gtinfo_->sendFadingMessage("You're now a killer.",it2->first->getClientID());
    277300                 }
     
    295318    bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator)
    296319    {   
     320        if (allowDeath)//Hack for Ghost-Spaceship
     321        {
     322          if (notYet)
     323          {allowDeath=false;}
     324          else
     325          {notYet=true;}
     326         return true;
     327        }
    297328        //killers can kill chasers and killers can be killed by chasers
    298329        if ((playerParty_[originator->getPlayer()] == killer && playerParty_[victim->getPlayer()] == chaser)||(playerParty_[victim->getPlayer()] == killer &&
     
    411442        }
    412443    }
    413     void Dynamicmatch::setPlayerColour(PlayerInfo* player) // sets a players colour
     444    void Dynamicmatch::setPlayerColour(PlayerInfo* player) // sets a player's colour
    414445    {
    415446        std::map<PlayerInfo*, int>::const_iterator it_player = this->playerParty_.find(player);
     
    445476                    if (it->first->getClientID() == CLIENTID_UNKNOWN)
    446477                        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));
    448479                }
    449480            }
     
    463494                       {
    464495                           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]);
    466497                           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]);
    468499                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    469500                       }
    470501                       else if (it->second==piggy)
    471502                       {
    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]);
    473504                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    474505                       }
    475506                       else if (it->second==killer)
    476507                       {
    477                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID());
     508                           this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
    478509                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    479510                       }
     
    494525                    if (it->first->getClientID() == CLIENTID_UNKNOWN)
    495526                        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));
    497528                }
    498529            }
     
    512543                       {
    513544                           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]);
    515546                           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]);
    517548                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    518549                       }
    519550                       else if (it->second==piggy)
    520551                       {
    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]);
    522553                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    523554                       }
    524555                       else if (it->second==killer)
    525556                       {
    526                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID());
     557                           this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[piggy]);
    527558                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    528559                       }
     
    544575                    if (it->first->getClientID() == CLIENTID_UNKNOWN)
    545576                        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));
    547578                }
    548579            }
     
    562593                       {
    563594                           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]);
    565596                           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]);
    567598                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    568599                       }
    569600                       else if (it->second==piggy)
    570601                       {
    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]);
    572603                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    573604                       }
    574605                       else if (it->second==killer)
    575606                       {
    576                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID());
     607                           this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
    577608                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    578609                       }
     
    625656                if (it->first->getClientID() == CLIENTID_UNKNOWN)
    626657                    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));
    628659            }
    629660        }
     
    651682        COUT(0) << message << std::endl;
    652683        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                     else
    661                         this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
    662                 }*/
    663684    }
    664685    SpawnPoint* Dynamicmatch::getBestSpawnPoint(PlayerInfo* player) const
  • code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h

    r7031 r7062  
    7979        protected:
    8080
     81            bool allowDeath;
     82            bool notYet;
    8183            std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here
    8284            std::vector<ColourValue> partyColours_; //aus TeamDeathmatch
  • code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc

    r7031 r7062  
    112112    }
    113113
    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)
    115115    {
    116116        if (GameMode::isMaster())
    117117        {
    118118            if (clientID == CLIENTID_SERVER)
    119                 this->dispatchStaticMessage(message);
     119                this->dispatchStaticMessage(message, colour);
    120120            else
    121                 callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message);
     121                callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message, colour);
    122122        }
    123123    }
     
    152152    }
    153153
    154      void GametypeInfo::dispatchStaticMessage(const std::string& message)
     154     void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour)
    155155    {
    156156        for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
    157             it->staticmessage(this, message);
     157            it->staticmessage(this, message, colour);
    158158    }
    159159   
  • code/branches/presentation3/src/orxonox/infos/GametypeInfo.h

    r7031 r7062  
    6464            void sendKillMessage(const std::string& message, unsigned int clientID);
    6565            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);
    6767            void sendFadingMessage(const std::string& message, unsigned int clientID);
    6868
     
    7070            void dispatchKillMessage(const std::string& message);
    7171            void dispatchDeathMessage(const std::string& message);
    72             void dispatchStaticMessage(const std::string& message);
     72            void dispatchStaticMessage(const std::string& message,const ColourValue& colour);
    7373            void dispatchFadingMessage(const std::string& message);
    7474
  • code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h

    r7031 r7062  
    4444            virtual void killmessage(const GametypeInfo* gtinfo, const std::string& message) {}
    4545            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) {}
    4747            virtual void fadingmessage(const GametypeInfo* gtinfo, const std::string& message) {}
    4848    };
Note: See TracChangeset for help on using the changeset viewer.