Public Member Functions | |
gMenuItemPlayer (uMenu *M, ePlayerNetID *p, const tOutput &help) | |
virtual void | Render (REAL x, REAL y, REAL alpha=1, bool selected=0) |
virtual void | Enter () |
Private Attributes | |
ePlayerNetID * | player |
Definition at line 209 of file gTeam.cpp.
gMenuItemPlayer::gMenuItemPlayer | ( | uMenu * | M, | |
ePlayerNetID * | p, | |||
const tOutput & | help | |||
) | [inline] |
virtual void gMenuItemPlayer::Render | ( | REAL | x, | |
REAL | y, | |||
REAL | alpha = 1 , |
|||
bool | selected = 0 | |||
) | [inline, virtual] |
Reimplemented from uMenuItem.
Definition at line 220 of file gTeam.cpp.
References uMenuItem::DisplayTextSpecial(), ePlayerNetID::GetName(), and player.
00221 { 00222 DisplayTextSpecial( x, y, player->GetName(), selected, alpha ); 00223 }
virtual void gMenuItemPlayer::Enter | ( | ) | [inline, virtual] |
Reimplemented from uMenuItem.
Definition at line 225 of file gTeam.cpp.
References con, ePlayerNetID::CurrentTeam(), uMenu::Enter(), ePlayerNetID::GetName(), GrowingArrayBase::Len(), MAX_PLAYERS, ePlayer::name, ePlayerNetID::NextTeam(), NULL, eTeam::NumHumanPlayers(), player, ePlayer::PlayerConfig(), ePlayer::PlayerIsInGame(), eTeam::PlayerMayJoin(), tOutput::SetTemplateParameter(), ePlayer::spectate, eTeam::teams, tNEW, and ePlayerNetID::Update().
00226 { 00227 tOutput title; 00228 title.SetTemplateParameter( 1, player->GetName() ); 00229 title << "$team_menu_player_title"; 00230 uMenu playerMenu( title ); 00231 tArray<uMenuItem*> items; 00232 00233 // quit from spectator mode, the player would be trown out of the team again otherwise 00234 int i; 00235 for ( i = MAX_PLAYERS; i>=0; --i ) 00236 { 00237 if ( ePlayer::PlayerIsInGame(i)) 00238 { 00239 ePlayer* localPlayer = ePlayer::PlayerConfig( i ); 00240 ePlayerNetID* pni = localPlayer->netPlayer; 00241 if ( pni == this->player && localPlayer->spectate ) 00242 { 00243 localPlayer->spectate = false; 00244 con << tOutput("$player_toggle_spectator_off", localPlayer->name ); 00245 ePlayerNetID::Update(); 00246 } 00247 } 00248 } 00249 00250 if ( player->NextTeam()!=NULL) 00251 { 00252 items[items.Len()] = tNEW(gMenuItemSpectate) (&playerMenu, player); 00253 } 00254 00255 // first pass add teams who probably can't be joined 00256 for ( i = 0; i<eTeam::teams.Len(); i++ ) 00257 { 00258 eTeam *team = eTeam::teams(i); 00259 if ( team && team != player->NextTeam() && !team->PlayerMayJoin( player ) ) 00260 { 00261 items[ items.Len() ] = tNEW( gMenuItemPlayerTeam ) ( &playerMenu, player, team ); 00262 } 00263 } 00264 // second pass add teams who probably can be joined 00265 // Note: these will appear above the unjoinable ones. 00266 for ( i = 0; i<eTeam::teams.Len(); i++ ) 00267 { 00268 eTeam *team = eTeam::teams(i); 00269 if ( team && team != player->NextTeam() && team->PlayerMayJoin( player )) 00270 items[ items.Len() ] = tNEW( gMenuItemPlayerTeam ) ( &playerMenu, player, team ); 00271 } 00272 00273 items[items.Len()] = tNEW(gMenuItemAutoSelect) (&playerMenu, player); 00274 00275 if ( /* eTeam::NewTeamAllowed() && */ 00276 !( player->NextTeam() && player->NextTeam()->NumHumanPlayers() == 1 && 00277 player->CurrentTeam() && player->CurrentTeam()->NumHumanPlayers() == 1 ) 00278 ) 00279 { 00280 items[ items.Len() ] = tNEW( gMenuItemNewTeam ) ( &playerMenu, player ); 00281 00282 } 00283 00284 items[items.Len()] = tNEW ( gMenuItemSpacer ) ( &playerMenu ); 00285 items[items.Len()] = tNEW ( gMenuItemStatus ) ( &playerMenu, player, false); 00286 items[items.Len()] = tNEW ( gMenuItemStatus ) ( &playerMenu, player, true); 00287 00288 playerMenu.Enter(); 00289 00290 for ( i = items.Len()-1; i>=0; --i ) 00291 { 00292 delete items(i); 00293 } 00294 }
ePlayerNetID* gMenuItemPlayer::player [private] |