MenuScreen_Scoreboard.cpp 21 KB

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