MenuScreen_Scoreboard.cpp (21223B)
1 /* 2 =========================================================================== 3 4 Doom 3 BFG Edition GPL Source Code 5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 6 7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). 8 9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>. 21 22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. 23 24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 26 =========================================================================== 27 */ 28 #pragma hdrstop 29 #include "../../idLib/precompiled.h" 30 #include "../Game_local.h" 31 32 //*************************************************************** 33 // DEFAULT SCOREBOARD 34 //*************************************************************** 35 static const int MAX_SCOREBOARD_SLOTS = 8; 36 37 /* 38 ======================== 39 idMenuScreen_Scoreboard::Initialize 40 ======================== 41 */ 42 void idMenuScreen_Scoreboard::Initialize( idMenuHandler * data ) { 43 idMenuScreen::Initialize( data ); 44 45 if ( data != NULL ) { 46 menuGUI = data->GetGUI(); 47 } 48 49 SetSpritePath( "sbDefault" ); 50 51 playerList = new (TAG_SWF) idMenuWidget_ScoreboardList(); 52 playerList->SetSpritePath( GetSpritePath(), "info", "playerList" ); 53 playerList->SetNumVisibleOptions( MAX_SCOREBOARD_SLOTS ); 54 playerList->SetWrappingAllowed( true ); 55 while ( playerList->GetChildren().Num() < MAX_SCOREBOARD_SLOTS ) { 56 idMenuWidget_ScoreboardButton * const buttonWidget = new (TAG_SWF) idMenuWidget_ScoreboardButton(); 57 buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, playerList->GetChildren().Num() ); 58 buttonWidget->AddEventAction( WIDGET_EVENT_COMMAND ).Set( WIDGET_ACTION_MUTE_PLAYER, playerList->GetChildren().Num() ); 59 buttonWidget->Initialize( data ); 60 playerList->AddChild( buttonWidget ); 61 } 62 playerList->Initialize( data ); 63 AddChild( playerList ); 64 65 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); 66 AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); 67 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); 68 AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); 69 AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) ); 70 AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) ); 71 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); 72 AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); 73 } 74 75 /* 76 ======================== 77 idMenuScreen_Scoreboard::Update 78 ======================== 79 */ 80 void idMenuScreen_Scoreboard::Update() { 81 82 if ( menuData != NULL ) { 83 idMenuWidget_CommandBar * cmdBar = dynamic_cast< idMenuWidget_CommandBar * const >( menuData->GetChildFromIndex( SCOREBOARD_WIDGET_CMD_BAR ) ); 84 if ( cmdBar != NULL ) { 85 cmdBar->ClearAllButtons(); 86 idMenuWidget_CommandBar::buttonInfo_t * buttonInfo; 87 88 if ( gameLocal.mpGame.GetGameState() != idMultiplayerGame::GAMEREVIEW ) { 89 buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); 90 if ( menuData->GetPlatform() != 2 ) { 91 buttonInfo->label = "#str_01345"; 92 } 93 buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); 94 95 buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_TAB ); 96 buttonInfo->label = ""; 97 buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); 98 } 99 100 buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); 101 if ( menuData->GetPlatform() != 2 ) { 102 buttonInfo->label = "#str_swf_view_profile"; 103 } 104 buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); 105 } 106 } 107 108 idMenuScreen::Update(); 109 } 110 111 /* 112 ======================== 113 idMenuScreen_Scoreboard::ShowScreen 114 ======================== 115 */ 116 void idMenuScreen_Scoreboard::ShowScreen( const mainMenuTransition_t transitionType ) { 117 idMenuScreen::ShowScreen( transitionType ); 118 119 if ( GetSWFObject() ) { 120 idSWFScriptObject & root = GetSWFObject()->GetRootObject(); 121 if ( BindSprite( root ) ) { 122 123 idSWFTextInstance * txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScoreboard" ); 124 if ( txtVal != NULL ) { 125 txtVal->SetText( "#str_02618" ); 126 txtVal->SetStrokeInfo( true, 0.9f, 2.0f ); 127 } 128 129 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtGameType" ); 130 if ( txtVal != NULL ) { 131 idStr mode = idLocalization::GetString( "#str_02376" ); 132 mode.Append( ": " ); 133 const idStrList & modes = common->GetModeDisplayList(); 134 idStr modeName = idLocalization::GetString( modes[ idMath::ClampInt( 0, modes.Num() - 1, gameLocal.gameType ) ] ); 135 mode.Append( idLocalization::GetString( idLocalization::GetString( modeName ) ) ); 136 txtVal->SetText( mode ); 137 txtVal->SetStrokeInfo( true, 0.9f, 1.8f ); 138 } 139 140 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtNameHeading" ); 141 if ( txtVal != NULL ) { 142 txtVal->SetText( "#str_02181" ); 143 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 144 } 145 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScore" ); 146 if ( txtVal != NULL ) { 147 if ( gameLocal.gameType == GAME_LASTMAN ) { 148 txtVal->SetText( idLocalization::GetString( "#str_04242" ) ); 149 } else if ( gameLocal.gameType == GAME_CTF ) { 150 txtVal->SetText( idLocalization::GetString( "#str_11112" ) ); 151 } else { 152 txtVal->SetText( idLocalization::GetString( "#str_04243" ) ); 153 } 154 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 155 } 156 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtWins" ); 157 if ( txtVal != NULL ) { 158 txtVal->SetText( "#str_02619" ); 159 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 160 } 161 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtPing" ); 162 if ( txtVal != NULL ) { 163 txtVal->SetText( "#str_02048" ); 164 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 165 } 166 167 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtNameHeading2" ); 168 if ( txtVal != NULL ) { 169 txtVal->SetText( "#str_02181" ); 170 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 171 } 172 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScore2" ); 173 if ( txtVal != NULL ) { 174 if ( gameLocal.gameType == GAME_LASTMAN ) { 175 txtVal->SetText( idLocalization::GetString( "#str_04242" ) ); 176 } else if ( gameLocal.gameType == GAME_CTF ) { 177 txtVal->SetText( idLocalization::GetString( "#str_11112" ) ); 178 } else { 179 txtVal->SetText( idLocalization::GetString( "#str_04243" ) ); 180 } 181 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 182 } 183 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtWins2" ); 184 if ( txtVal != NULL ) { 185 txtVal->SetText( "#str_02619" ); 186 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 187 } 188 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtPing2" ); 189 if ( txtVal != NULL ) { 190 txtVal->SetText( "#str_02048" ); 191 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 192 } 193 194 } 195 } 196 197 } 198 199 /* 200 ======================== 201 idMenuScreen_Scoreboard::SetPlayerData 202 ======================== 203 */ 204 void idMenuScreen_Scoreboard::SetPlayerData( idList< scoreboardInfo_t, TAG_IDLIB_LIST_MENU > data ) { 205 if ( playerList != NULL ) { 206 for ( int i = 0; i < data.Num(); ++i ) { 207 if ( i < playerList->GetChildren().Num() ) { 208 idMenuWidget_ScoreboardButton * button = dynamic_cast< idMenuWidget_ScoreboardButton * >( &playerList->GetChildByIndex( i ) ); 209 if ( button != NULL ) { 210 button->SetButtonInfo( data[i].index, data[i].values, data[i].voiceState ); 211 } 212 } 213 playerList->Update(); 214 } 215 } 216 } 217 218 /* 219 ======================== 220 idMenuScreen_Scoreboard::UpdateGameInfo 221 ======================== 222 */ 223 void idMenuScreen_Scoreboard::UpdateGameInfo( idStr gameInfo ) { 224 225 if ( GetSWFObject() ) { 226 idSWFScriptObject & root = GetSWFObject()->GetRootObject(); 227 if ( BindSprite( root ) ) { 228 229 idSWFTextInstance * txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtGameInfo" ); 230 if ( txtVal != NULL ) { 231 txtVal->SetText( gameInfo ); 232 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 233 } 234 } 235 } 236 } 237 238 /* 239 ======================== 240 idMenuScreen_Scoreboard::UpdateSpectating 241 ======================== 242 */ 243 void idMenuScreen_Scoreboard::UpdateSpectating( idStr spectating, idStr follow ) { 244 245 if ( GetSWFObject() ) { 246 idSWFScriptObject & root = GetSWFObject()->GetRootObject(); 247 if ( BindSprite( root ) ) { 248 249 idSWFTextInstance * txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtSpectating" ); 250 if ( txtVal != NULL ) { 251 txtVal->tooltip = true; 252 txtVal->SetText( spectating ); 253 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 254 } 255 256 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtFollow" ); 257 if ( txtVal != NULL ) { 258 txtVal->SetText( follow ); 259 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 260 } 261 } 262 } 263 } 264 265 /* 266 ======================== 267 idMenuScreen_Scoreboard::UpdateTeamScores 268 ======================== 269 */ 270 void idMenuScreen_Scoreboard::UpdateTeamScores( int r, int b ) { 271 272 if ( GetSWFObject() ) { 273 idSWFScriptObject & root = GetSWFObject()->GetRootObject(); 274 if ( BindSprite( root ) ) { 275 276 idSWFTextInstance * txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtRedScore" ); 277 if ( txtVal != NULL ) { 278 txtVal->SetText( va( "%i", r ) ); 279 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 280 } 281 282 txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtBlueScore" ); 283 if ( txtVal != NULL ) { 284 txtVal->SetText( va( "%i", b ) ); 285 txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); 286 } 287 } 288 } 289 } 290 291 /* 292 ======================== 293 idMenuScreen_Scoreboard::UpdateHighlight 294 ======================== 295 */ 296 void idMenuScreen_Scoreboard::UpdateHighlight() { 297 298 if ( playerList == NULL || menuData == NULL ) { 299 return; 300 } 301 302 idMenuHandler_Scoreboard * data = dynamic_cast< idMenuHandler_Scoreboard * >( menuData ); 303 304 int curIndex = playerList->GetViewIndex(); 305 int newIndex = playerList->GetViewIndex(); 306 int numRed = data->GetNumPlayers( 0 ); 307 int numBlue = data->GetNumPlayers( 1 ); 308 309 if ( numBlue == 0 ) { 310 if ( curIndex >= numRed ) { 311 newIndex = numRed - 1; 312 } 313 } else { 314 if ( curIndex > 3 + numBlue ) { 315 newIndex = 3 + numBlue; 316 } else if ( curIndex <= 3 ) { 317 if ( numRed == 0 ) { 318 newIndex = 4; 319 } else { 320 if ( curIndex >= numRed ) { 321 newIndex = numRed - 1; 322 } 323 } 324 } 325 } 326 327 // newIndex can be -1 if all players are spectating ( no rankedplayers ) 328 if ( newIndex != curIndex && newIndex != -1 ) { 329 playerList->SetViewIndex( newIndex ); 330 playerList->SetFocusIndex( newIndex ); 331 } 332 } 333 334 /* 335 ======================== 336 idMenuScreen_Scoreboard::HandleAction 337 ======================== 338 */ 339 bool idMenuScreen_Scoreboard::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) { 340 341 if ( menuData == NULL ) { 342 return true; 343 } 344 345 widgetAction_t actionType = action.GetType(); 346 const idSWFParmList & parms = action.GetParms(); 347 348 switch ( actionType ) { 349 case WIDGET_ACTION_GO_BACK: { 350 menuData->SetNextScreen( SCOREBOARD_AREA_INVALID, MENU_TRANSITION_SIMPLE ); 351 return true; 352 } 353 case WIDGET_ACTION_MUTE_PLAYER: { 354 355 if ( parms.Num() != 1 ) { 356 return true; 357 } 358 359 idMenuHandler_Scoreboard * data = dynamic_cast< idMenuHandler_Scoreboard * >( menuData ); 360 361 if ( !data ) { 362 return true; 363 } 364 int index = parms[0].ToInteger(); 365 data->MutePlayer( index ); 366 367 return true; 368 } 369 case WIDGET_ACTION_PRESS_FOCUSED: { 370 371 if ( playerList == NULL ) { 372 return true; 373 } 374 375 int selectionIndex = playerList->GetViewIndex(); 376 if ( parms.Num() == 1 ) { 377 selectionIndex = parms[0].ToInteger(); 378 } 379 380 if ( selectionIndex != playerList->GetFocusIndex() ) { 381 playerList->SetViewIndex( playerList->GetViewOffset() + selectionIndex ); 382 playerList->SetFocusIndex( selectionIndex ); 383 } 384 385 idMenuHandler_Scoreboard * data = dynamic_cast< idMenuHandler_Scoreboard * >( menuData ); 386 387 if ( !data ) { 388 return true; 389 } 390 391 int numRed = data->GetNumPlayers( 0 ); 392 int numBlue = data->GetNumPlayers( 1 ); 393 394 if ( selectionIndex >= 4 && numBlue != 0 ) { 395 int index = numRed + ( selectionIndex - 4 ); 396 data->ViewPlayerProfile( index ); 397 } else { 398 data->ViewPlayerProfile( selectionIndex ); 399 } 400 401 402 return true; 403 } 404 case WIDGET_ACTION_SCROLL_VERTICAL_VARIABLE: { 405 406 if ( parms.Num() == 0 ) { 407 return true; 408 } 409 410 if ( playerList ) { 411 412 int dir = parms[ 0 ].ToInteger(); 413 int scroll = 0; 414 int curIndex = playerList->GetFocusIndex(); 415 416 idMenuHandler_Scoreboard * data = dynamic_cast< idMenuHandler_Scoreboard * >( menuData ); 417 418 if ( !data ) { 419 return true; 420 } 421 422 int numRed = data->GetNumPlayers( 0 ); 423 int numBlue = data->GetNumPlayers( 1 ); 424 425 if ( numRed + numBlue <= 1 ) { 426 return true; 427 } 428 429 if ( dir > 0 ) { 430 if ( numBlue == 0 ) { 431 if ( curIndex + 1 >= numRed ) { 432 scroll = MAX_SCOREBOARD_SLOTS - curIndex; 433 } else { 434 scroll = dir; 435 } 436 } else { 437 if ( curIndex < 4 ) { 438 if ( curIndex + 1 >= numRed ) { 439 scroll = ( MAX_SCOREBOARD_SLOTS * 0.5f ) - curIndex; 440 } else { 441 scroll = dir; 442 } 443 } else { 444 if ( curIndex - 3 >= numBlue ) { 445 scroll = MAX_SCOREBOARD_SLOTS - curIndex; 446 } else { 447 scroll = dir; 448 } 449 } 450 } 451 } else if ( dir < 0 ) { 452 if ( numBlue == 0 ) { 453 if ( curIndex - 1 < 0 ) { 454 scroll = numRed - 1; 455 } else { 456 scroll = dir; 457 } 458 } else { 459 if ( curIndex < 4 ) { 460 if ( curIndex - 1 < 0 ) { 461 scroll = ( ( MAX_SCOREBOARD_SLOTS * 0.5f ) + numBlue ) - 1; 462 } else { 463 scroll = dir; 464 } 465 } else { 466 if ( curIndex - 1 < 4 ) { 467 scroll = -( ( MAX_SCOREBOARD_SLOTS * 0.5f ) - ( numRed - 1 ) ); 468 } else { 469 scroll = dir; 470 } 471 } 472 } 473 } 474 475 if ( scroll != 0 ) { 476 playerList->Scroll( scroll ); 477 } 478 } 479 return true; 480 } 481 } 482 483 return idMenuWidget::HandleAction( action, event, widget, forceHandled ); 484 } 485 486 //*************************************************************** 487 // CTF SCOREBOARD 488 //*************************************************************** 489 490 /* 491 ======================== 492 idMenuScreen_Scoreboard_CTF::Initialize 493 ======================== 494 */ 495 void idMenuScreen_Scoreboard_CTF::Initialize( idMenuHandler * data ) { 496 idMenuScreen::Initialize( data ); 497 498 if ( data != NULL ) { 499 menuGUI = data->GetGUI(); 500 } 501 502 SetSpritePath( "sbCTF" ); 503 504 playerList = new (TAG_SWF) idMenuWidget_ScoreboardList(); 505 playerList->SetSpritePath( GetSpritePath(), "info", "playerList" ); 506 playerList->SetNumVisibleOptions( MAX_SCOREBOARD_SLOTS ); 507 playerList->SetWrappingAllowed( true ); 508 while ( playerList->GetChildren().Num() < MAX_SCOREBOARD_SLOTS ) { 509 idMenuWidget_ScoreboardButton * const buttonWidget = new (TAG_SWF) idMenuWidget_ScoreboardButton(); 510 buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, playerList->GetChildren().Num() ); 511 buttonWidget->AddEventAction( WIDGET_EVENT_COMMAND ).Set( WIDGET_ACTION_MUTE_PLAYER, playerList->GetChildren().Num() ); 512 buttonWidget->Initialize( data ); 513 playerList->AddChild( buttonWidget ); 514 } 515 playerList->Initialize( data ); 516 AddChild( playerList ); 517 518 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); 519 AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); 520 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); 521 AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); 522 AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) ); 523 AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) ); 524 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); 525 AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); 526 527 } 528 529 //*************************************************************** 530 // TEAM SCOREBOARD 531 //*************************************************************** 532 533 /* 534 ======================== 535 idMenuScreen_Scoreboard_Team::Initialize 536 ======================== 537 */ 538 void idMenuScreen_Scoreboard_Team::Initialize( idMenuHandler * data ) { 539 idMenuScreen::Initialize( data ); 540 541 if ( data != NULL ) { 542 menuGUI = data->GetGUI(); 543 } 544 545 SetSpritePath( "sbTeam" ); 546 547 playerList = new (TAG_SWF) idMenuWidget_ScoreboardList(); 548 playerList->SetSpritePath( GetSpritePath(), "info", "playerList" ); 549 playerList->SetNumVisibleOptions( MAX_SCOREBOARD_SLOTS ); 550 playerList->SetWrappingAllowed( true ); 551 while ( playerList->GetChildren().Num() < MAX_SCOREBOARD_SLOTS ) { 552 idMenuWidget_ScoreboardButton * const buttonWidget = new (TAG_SWF) idMenuWidget_ScoreboardButton(); 553 buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, playerList->GetChildren().Num() ); 554 buttonWidget->AddEventAction( WIDGET_EVENT_COMMAND ).Set( WIDGET_ACTION_MUTE_PLAYER, playerList->GetChildren().Num() ); 555 buttonWidget->Initialize( data ); 556 playerList->AddChild( buttonWidget ); 557 } 558 playerList->Initialize( data ); 559 AddChild( playerList ); 560 561 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); 562 AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); 563 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); 564 AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); 565 AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) ); 566 AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) ); 567 AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); 568 AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); 569 570 }