Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9110 in orxonox.OLD for trunk/src/util


Ignore:
Timestamp:
Jul 4, 2006, 11:18:41 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the Presentation back

Location:
trunk/src/util
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/multiplayer_team_deathmatch.cc

    r9059 r9110  
    455455  ClassID playableClassId = getPlayableClassId( userId, stats.getPreferedTeamId() );
    456456  std::string playableModel = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId );
     457  std::string playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId );
    457458
    458459  BaseObject * bo = Factory::fabricate( playableClassId );
     
    463464  Playable & playable = *(dynamic_cast<Playable*>(bo));
    464465
    465   playable.loadModel( playableModel );
     466  if ( playableTexture != "" )
     467    playable.loadMD2Texture( playableTexture );
     468  if ( playableModel != "" )
     469    playable.loadModel( playableModel );
    466470  playable.setOwner( userId );
    467471  playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
     
    537541      this->hideStats();
    538542    }
    539     if ( !this->statsBox && event.bPressed )
     543    else if ( !this->statsBox && event.bPressed )
    540544    {
    541545      PRINTF(0)("show stats\n");
     
    612616{
    613617  statsBox = new OrxGui::GLGuiBox();
    614   statsBox->setAbsCoor2D( 300, 100 );
    615 
    616   this->table = new OrxGui::GLGuiTable(5,5);
     618  statsBox->setAbsCoor2D( 100, 100 );
     619
     620  this->table = new OrxGui::GLGuiTable(10,5);
    617621
    618622  statsBox->pack( this->table );
     
    642646
    643647  std::vector<std::string> headers;
     648  headers.push_back("Blue Team");
     649  headers.push_back("");
     650  headers.push_back("");
    644651  headers.push_back("Red Team");
    645652  headers.push_back("");
    646   headers.push_back("");
    647   headers.push_back("Blue Team");
    648   headers.push_back("");
    649653  this->table->setHeader(headers);
    650654
    651   std::map<int,std::string> fragsTeam0;
    652   std::map<int,std::string> fragsTeam1;
    653 
    654   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
    655 
    656   if ( !list )
    657     return;
    658 
    659   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    660   {
    661     PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
    662 
    663     if ( stats.getTeamId() == 0 || stats.getTeamId() == 1 )
    664     {
    665       if ( stats.getTeamId() == 0 )
    666         fragsTeam0[stats.getScore()] = stats.getNickName();
    667       else
    668         fragsTeam1[stats.getScore()] = stats.getNickName();
    669     }
    670   }
     655  ScoreList scoreList = PlayerStats::getScoreList();
    671656
    672657  char st[10];
    673658  int i = 0;
    674 
    675 
     659 
    676660  i = 2;
    677   for ( std::map<int,std::string>::const_iterator it = fragsTeam0.begin(); it != fragsTeam0.end(); it++ )
    678   {
    679     this->table->setEntry( 0, i, it->second );
    680     snprintf( st, 10, "%d", it->first );
    681     this->table->setEntry( 1, i, st );
    682     this->table->setEntry( 2, i, "" );
     661  for ( TeamScoreList::const_iterator it = scoreList[0].begin(); it != scoreList[0].end(); it++ )
     662  {
     663    this->table->setEntry( i, 0, it->name );
     664    snprintf( st, 10, "%d", it->score );
     665    this->table->setEntry( i, 1, st );
     666    this->table->setEntry( i, 2, "" );
    683667    i++;
    684668  }
    685669
    686670  i = 2;
    687   for ( std::map<int,std::string>::const_iterator it = fragsTeam1.begin(); it != fragsTeam1.end(); it++ )
    688   {
    689     this->table->setEntry( 3, i, it->second );
    690     snprintf( st, 10, "%d", it->first );
    691     this->table->setEntry( 4, i, st );
     671  for ( TeamScoreList::const_iterator it = scoreList[1].begin(); it != scoreList[1].end(); it++ )
     672  {
     673    this->table->setEntry( i, 3, it->name );
     674    snprintf( st, 10, "%d", it->score );
     675    this->table->setEntry( i, 4, st );
    692676    i++;
    693677  }
     678
    694679}
    695680
     
    797782}
    798783
     784std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, ClassID classId )
     785{
     786  if ( classId == CL_FPS_PLAYER )
     787  {
     788    return "maps/doom_guy.png";
     789  }
     790 
     791  return "";
     792}
     793
  • trunk/src/util/multiplayer_team_deathmatch.h

    r9059 r9110  
    3939    virtual int getTeamForNewUser();
    4040    virtual ClassID getPlayableClassId( int userId, int team );
     41    virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId );
    4142    virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
    4243
  • trunk/src/util/network_game_rules.cc

    r8623 r9110  
    4040}
    4141
     42
     43std::string NetworkGameRules::getPlayableModelTextureFileName( int userId, int team, ClassID classId )
     44{
     45  return "";
     46}
     47
    4248std::string NetworkGameRules::getPlayableModelFileName( int uesrId, int team, ClassID classId )
    4349{
  • trunk/src/util/network_game_rules.h

    r8623 r9110  
    2323    virtual ClassID getPlayableClassId( int userId, int team );
    2424    virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
     25    virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId );
    2526   
    2627    virtual PlayerStats * getNewPlayerStats( int userId ){ return new PlayerStats( userId ); }
  • trunk/src/util/signal_handler.h

    r8623 r9110  
    4444  public:
    4545    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
     46    ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
    4647
    4748    void registerCallback( SignalCallback cb, void * someData );
Note: See TracChangeset for help on using the changeset viewer.