Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

orxonox/trunk: merged the Presentation back

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.