dlgcncwinscreen.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program 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. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : commando *
  23. * *
  24. * $Archive:: /Commando/Code/Commando/dlgcncwinscreen.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 2/24/02 2:10p $*
  29. * *
  30. * $Revision:: 16 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "dlgcncwinscreen.h"
  36. #include "resource.h"
  37. #include "rendobj.h"
  38. #include "pscene.h"
  39. #include "combat.h"
  40. #include "gamedata.h"
  41. #include "playertype.h"
  42. #include "assetmgr.h"
  43. #include "dialogresource.h"
  44. #include "menubackdrop.h"
  45. #include "listctrl.h"
  46. #include "gamemode.h"
  47. #include "wolgmode.h"
  48. #include "translatedb.h"
  49. #include "string_ids.h"
  50. #include "cnetwork.h"
  51. #include "gameinitmgr.h"
  52. #include "gamespyadmin.h"
  53. #include "specialbuilds.h"
  54. #include "dialogtests.h"
  55. #include "dialogmgr.h"
  56. ////////////////////////////////////////////////////////////////
  57. // Static member initialization
  58. ////////////////////////////////////////////////////////////////
  59. CNCWinScreenMenuClass * CNCWinScreenMenuClass::_TheInstance = NULL;
  60. const float CNCWinScreenMenuClass::UpdateIntervalS = 0.2f;
  61. ////////////////////////////////////////////////////////////////
  62. // Constants
  63. ////////////////////////////////////////////////////////////////
  64. enum
  65. {
  66. COL_RANK,
  67. COL_NAME,
  68. COL_SCORE,
  69. COL_KILLS,
  70. COL_LADDER,
  71. };
  72. ////////////////////////////////////////////////////////////////
  73. //
  74. // CNCWinScreenMenuClass
  75. //
  76. ////////////////////////////////////////////////////////////////
  77. CNCWinScreenMenuClass::CNCWinScreenMenuClass (void) :
  78. HeaderModel (NULL),
  79. UpdateTimer (UpdateIntervalS),
  80. ShowLadderPoints(false),
  81. MenuDialogClass (IDD_CNC_WINSCREEN)
  82. {
  83. //
  84. // Configure the blackout renderer
  85. //
  86. StyleMgrClass::Configure_Renderer (&BlackoutRenderer);
  87. BlackoutRenderer.Get_Shader ()->Set_Depth_Compare (ShaderClass::PASS_ALWAYS);
  88. BlackoutRenderer.Add_Quad (Render2DClass::Get_Screen_Resolution (), RGBA_TO_INT32 (0, 0, 0, 200));
  89. WinScreenBackdrop.Clear_Screen (false);
  90. //
  91. // Load the correct banner
  92. //
  93. if (The_Game ()->Get_Winner_ID () == PLAYERTYPE_GDI) {
  94. HeaderModel = WW3DAssetManager::Get_Instance ()->Create_Render_Obj ("HUD_GDIWINBAN");
  95. } else {
  96. HeaderModel = WW3DAssetManager::Get_Instance ()->Create_Render_Obj ("HUD_NODWINBAN");
  97. }
  98. //
  99. // Should we show ladder points?
  100. //
  101. WWASSERT(GameModeManager::Find("WOL") != NULL);
  102. WWASSERT(The_Game() != NULL);
  103. if (GameModeManager::Find("WOL")->Is_Active() && The_Game()->IsLaddered.Is_True()) {
  104. ShowLadderPoints = true;
  105. }
  106. _TheInstance = this;
  107. return ;
  108. }
  109. ////////////////////////////////////////////////////////////////
  110. //
  111. // CNCWinScreenMenuClass
  112. //
  113. ////////////////////////////////////////////////////////////////
  114. CNCWinScreenMenuClass::~CNCWinScreenMenuClass (void)
  115. {
  116. if (HeaderModel != NULL) {
  117. HeaderModel->Remove ();
  118. REF_PTR_RELEASE (HeaderModel);
  119. }
  120. _TheInstance = NULL;
  121. return ;
  122. }
  123. ////////////////////////////////////////////////////////////////
  124. //
  125. // On_Init_Dialog
  126. //
  127. ////////////////////////////////////////////////////////////////
  128. void
  129. CNCWinScreenMenuClass::On_Init_Dialog (void)
  130. {
  131. //
  132. // Get a pointer to the list control
  133. //
  134. ListCtrlClass *list_ctrl = (ListCtrlClass *)Get_Dlg_Item (IDC_WIN1_LIST_CTRL);
  135. if (list_ctrl != NULL) {
  136. //
  137. // Configure the columns
  138. //
  139. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_RANK), 0.15F, Vector3 (1, 1, 1));
  140. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_NAME), 0.3F, Vector3 (1, 1, 1));
  141. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_SCORE), 0.2F, Vector3 (1, 1, 1));
  142. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_KILLS), 0.15F, Vector3 (1, 1, 1));
  143. if (ShowLadderPoints) {
  144. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_LADDER), 0.25F, Vector3 (1, 1, 1));
  145. }
  146. }
  147. list_ctrl = (ListCtrlClass *)Get_Dlg_Item (IDC_LOSE1_LIST_CTRL);
  148. if (list_ctrl != NULL) {
  149. //
  150. // Configure the columns
  151. //
  152. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_RANK), 0.15F, Vector3 (1, 1, 1));
  153. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_NAME), 0.3F, Vector3 (1, 1, 1));
  154. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_SCORE), 0.2F, Vector3 (1, 1, 1));
  155. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_KILLS), 0.15F, Vector3 (1, 1, 1));
  156. if (ShowLadderPoints) {
  157. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_LADDER), 0.25F, Vector3 (1, 1, 1));
  158. }
  159. }
  160. //
  161. // Fill in dialog controls
  162. //
  163. if (The_Game ()->Get_Winner_ID () == PLAYERTYPE_GDI) {
  164. Get_Dlg_Item (IDC_TITLE_TEXT_1)->Set_Text_Color (Vector3 (1.0F, 1.0F, 1.0F));
  165. Get_Dlg_Item (IDC_TITLE_TEXT_2)->Set_Text_Color (Vector3 (1.0F, 1.0F, 1.0F));
  166. Populate_Player_Lists (PLAYERTYPE_GDI, IDC_WIN1_LIST_CTRL);
  167. Populate_Player_Lists (PLAYERTYPE_NOD, IDC_LOSE1_LIST_CTRL);
  168. //
  169. // Display the title
  170. //
  171. Set_Dlg_Item_Text (IDC_TITLE_TEXT_1, TRANSLATE (IDS_MENU_GDI_WINS));
  172. //
  173. // Display the team scores
  174. //
  175. WideStringClass team_score_string;
  176. team_score_string.Format (TRANSLATE (IDS_MENU_GDI_SCORE), (int)cTeamManager::Find_Team (PLAYERTYPE_GDI)->Get_Score ());
  177. Set_Dlg_Item_Text (IDC_WINNER_TEAM_SCORE_TEXT, team_score_string);
  178. team_score_string.Format (TRANSLATE (IDS_MENU_NOD_SCORE), (int)cTeamManager::Find_Team (PLAYERTYPE_NOD)->Get_Score ());
  179. Set_Dlg_Item_Text (IDC_LOSER_TEAM_SCORE_TEXT, team_score_string);
  180. } else {
  181. Get_Dlg_Item (IDC_TITLE_TEXT_1)->Set_Text_Color (Vector3 (1.0F, 0.0F, 0.0F));
  182. Get_Dlg_Item (IDC_TITLE_TEXT_2)->Set_Text_Color (Vector3 (1.0F, 0.0F, 0.0F));
  183. //Get_Dlg_Item (IDC_MVP_TEXT)->Set_Text_Color (Vector3 (1.0F, 0.0F, 0.0F));
  184. //Get_Dlg_Item (IDC_TIME_TEXT)->Set_Text_Color (Vector3 (1.0F, 0.0F, 0.0F));
  185. //Get_Dlg_Item (IDC_WINNER_TEAM_SCORE_TEXT)->Set_Text_Color (Vector3 (1.0F, 0.0F, 0.0F));
  186. //Get_Dlg_Item (IDC_LOSER_TEAM_SCORE_TEXT)->Set_Text_Color (Vector3 (1.0F, 0.0F, 0.0F));
  187. Populate_Player_Lists (PLAYERTYPE_NOD, IDC_WIN1_LIST_CTRL);
  188. Populate_Player_Lists (PLAYERTYPE_GDI, IDC_LOSE1_LIST_CTRL);
  189. //
  190. // Display the title
  191. //
  192. Set_Dlg_Item_Text (IDC_TITLE_TEXT_1, TRANSLATE (IDS_MENU_NOD_WINS));
  193. //
  194. // Display the team scores
  195. //
  196. WideStringClass team_score_string;
  197. team_score_string.Format (TRANSLATE (IDS_MENU_NOD_SCORE), (int)cTeamManager::Find_Team (PLAYERTYPE_NOD)->Get_Score ());
  198. Set_Dlg_Item_Text (IDC_WINNER_TEAM_SCORE_TEXT, team_score_string);
  199. team_score_string.Format (TRANSLATE (IDS_MENU_GDI_SCORE), (int)cTeamManager::Find_Team (PLAYERTYPE_GDI)->Get_Score ());
  200. Set_Dlg_Item_Text (IDC_LOSER_TEAM_SCORE_TEXT, team_score_string);
  201. }
  202. //
  203. // Display the MVP's name and num times consecutive as MVP
  204. //
  205. WideStringClass mvp_text;
  206. mvp_text.Format (TRANSLATE (IDS_MENU_MVP_FORMAT), (const WCHAR *)The_Game ()->Get_Mvp_Name ());
  207. if (!The_Game()->Get_Mvp_Name().Is_Empty() && The_Game()->Get_Mvp_Count() > 1) {
  208. WideStringClass consecutives_text;
  209. consecutives_text.Format(L" * %d", The_Game()->Get_Mvp_Count());
  210. mvp_text += consecutives_text;
  211. }
  212. Set_Dlg_Item_Text (IDC_MVP_TEXT, mvp_text);
  213. //
  214. // Display a description of how the team won
  215. //
  216. cGameData::WinTypeEnum win_type = The_Game ()->Get_Win_Type ();
  217. WideStringClass win_description;
  218. switch (win_type)
  219. {
  220. case cGameData::WIN_TYPE_FORCED:
  221. win_description = TRANSLATE (IDS_MENU_WIN_CONDITION_01);
  222. break;
  223. case cGameData::WIN_TYPE_COWARDICE:
  224. win_description = TRANSLATE (IDS_MENU_WIN_CONDITION_02);
  225. break;
  226. case cGameData::WIN_TYPE_TIME:
  227. win_description = TRANSLATE (IDS_MENU_WIN_CONDITION_03);
  228. break;
  229. case cGameData::WIN_TYPE_BASE_DESTRUCTION:
  230. win_description = TRANSLATE (IDS_MENU_WIN_CONDITION_04);
  231. break;
  232. case cGameData::WIN_TYPE_BEACON:
  233. win_description = TRANSLATE (IDS_MENU_WIN_CONDITION_05);
  234. break;
  235. }
  236. Set_Dlg_Item_Text (IDC_TITLE_TEXT_2, win_description);
  237. WideStringClass game_time_string;
  238. Set_Dlg_Item_Text (IDC_TITLE_TEXT_2, win_description);
  239. //
  240. // Display the game time
  241. //
  242. WideStringClass time_string;
  243. int time = (int)The_Game ()->Get_Game_Duration_S ();
  244. int hours = int(time / 3600);
  245. time -= hours * 3600;
  246. int minutes = int(time / 60);
  247. time -= minutes * 60;
  248. int seconds = (int)time;
  249. if (hours > 0) {
  250. time_string.Format (TRANSLATE (IDS_MENU_GAME_TIME_01), hours, minutes, seconds);
  251. } else {
  252. time_string.Format (TRANSLATE (IDS_MENU_GAME_TIME_02), minutes, seconds);
  253. }
  254. Set_Dlg_Item_Text (IDC_TIME_TEXT, time_string);
  255. //
  256. // Set the text that shows the next map to be played.
  257. //
  258. if (The_Game()->Is_Map_Cycle_Over()) {
  259. Set_Dlg_Item_Text (IDC_MENU_TEXT_NEXT_MAP, L"");
  260. } else {
  261. WideStringClass map_info(TRANSLATE(IDS_MENU_NEXT_MAP), true);
  262. //
  263. // Get a copy of the map name from PTheGameData
  264. //
  265. char map_name[256];
  266. strcpy(map_name, The_Game()->Get_Map_Name());
  267. //
  268. // Strip off the .mix if present.
  269. //
  270. strupr(map_name);
  271. char *dot = strstr(map_name, ".MIX");
  272. strcpy(map_name, The_Game()->Get_Map_Name());
  273. if (dot) {
  274. *dot = 0;
  275. }
  276. map_info += WideStringClass(map_name, true);
  277. Set_Dlg_Item_Text (IDC_MENU_TEXT_NEXT_MAP, map_info);
  278. }
  279. MenuDialogClass::On_Init_Dialog ();
  280. return ;
  281. }
  282. ////////////////////////////////////////////////////////////////
  283. //
  284. // On_Frame_Update
  285. //
  286. ////////////////////////////////////////////////////////////////
  287. void
  288. CNCWinScreenMenuClass::On_Frame_Update (void)
  289. {
  290. UpdateTimer -= TimeManager::Get_Frame_Seconds ();
  291. if (UpdateTimer <= 0) {
  292. cPlayerManager::Sort_Players(false);
  293. //
  294. // Refresh the player lists
  295. //
  296. if (The_Game ()->Get_Winner_ID () == PLAYERTYPE_GDI) {
  297. Populate_Player_Lists (PLAYERTYPE_GDI, IDC_WIN1_LIST_CTRL);
  298. Populate_Player_Lists (PLAYERTYPE_NOD, IDC_LOSE1_LIST_CTRL);
  299. } else {
  300. Populate_Player_Lists (PLAYERTYPE_NOD, IDC_WIN1_LIST_CTRL);
  301. Populate_Player_Lists (PLAYERTYPE_GDI, IDC_LOSE1_LIST_CTRL);
  302. }
  303. //
  304. // Refresh the team scores
  305. //
  306. WideStringClass gdi_score_string;
  307. WideStringClass nod_score_string;
  308. gdi_score_string.Format (TRANSLATE (IDS_MENU_GDI_SCORE), (int)cTeamManager::Find_Team (PLAYERTYPE_GDI)->Get_Score ());
  309. nod_score_string.Format (TRANSLATE (IDS_MENU_NOD_SCORE), (int)cTeamManager::Find_Team (PLAYERTYPE_NOD)->Get_Score ());
  310. if (The_Game ()->Get_Winner_ID () == PLAYERTYPE_GDI) {
  311. Set_Dlg_Item_Text (IDC_WINNER_TEAM_SCORE_TEXT, gdi_score_string);
  312. Set_Dlg_Item_Text (IDC_LOSER_TEAM_SCORE_TEXT, nod_score_string);
  313. } else {
  314. Set_Dlg_Item_Text (IDC_WINNER_TEAM_SCORE_TEXT, nod_score_string);
  315. Set_Dlg_Item_Text (IDC_LOSER_TEAM_SCORE_TEXT, gdi_score_string);
  316. }
  317. UpdateTimer = UpdateIntervalS;
  318. }
  319. MenuDialogClass::On_Frame_Update ();
  320. return ;
  321. }
  322. ////////////////////////////////////////////////////////////////
  323. //
  324. // On_Destroy
  325. //
  326. ////////////////////////////////////////////////////////////////
  327. void
  328. CNCWinScreenMenuClass::On_Destroy (void)
  329. {
  330. MenuDialogClass::On_Destroy ();
  331. return ;
  332. }
  333. ////////////////////////////////////////////////////////////////
  334. //
  335. // Render
  336. //
  337. ////////////////////////////////////////////////////////////////
  338. void
  339. CNCWinScreenMenuClass::Render (void)
  340. {
  341. //
  342. // Don't render if we aren't the active menu
  343. //
  344. if (ActiveMenu == this) {
  345. //
  346. // Render the background scene first
  347. //
  348. BackDrop->Render ();
  349. BlackoutRenderer.Render ();
  350. WinScreenBackdrop.Render ();
  351. //
  352. // Now, let the dialog subsystem render the controls and
  353. // such...
  354. //
  355. DialogBaseClass::Render ();
  356. }
  357. return ;
  358. }
  359. ////////////////////////////////////////////////////////////////
  360. //
  361. // On_Command
  362. //
  363. ////////////////////////////////////////////////////////////////
  364. void
  365. CNCWinScreenMenuClass::On_Command (int ctrl_id, int message_id, DWORD param)
  366. {
  367. switch (ctrl_id)
  368. {
  369. case IDCANCEL:
  370. //
  371. // Close the dialog
  372. //
  373. End_Dialog ();
  374. //
  375. // End the game
  376. //
  377. GameInitMgrClass::End_Game ();
  378. if (cGameSpyAdmin::Get_Is_Launched_From_Gamespy()) {
  379. #ifdef MULTIPLAYERDEMO
  380. DialogMgrClass::Flush_Dialogs ();
  381. START_DIALOG (SplashOutroMenuDialogClass);
  382. #else
  383. extern void Stop_Main_Loop (int);
  384. Stop_Main_Loop(EXIT_SUCCESS);
  385. #endif // MULTIPLAYERDEMO
  386. } else {
  387. GameInitMgrClass::Display_End_Game_Menu ();
  388. }
  389. break;
  390. default:
  391. MenuDialogClass::On_Command (ctrl_id, message_id, param);
  392. break;
  393. }
  394. return ;
  395. }
  396. ////////////////////////////////////////////////////////////////
  397. //
  398. // On_Menu_Activate
  399. //
  400. ////////////////////////////////////////////////////////////////
  401. void
  402. CNCWinScreenMenuClass::On_Menu_Activate (bool onoff)
  403. {
  404. if (HeaderModel != NULL) {
  405. //
  406. // Either add or remove the header from the scene
  407. //
  408. if (onoff) {
  409. if (HeaderModel->Peek_Scene () == NULL) {
  410. WinScreenBackdrop.Peek_Scene ()->Add_Render_Object (HeaderModel);
  411. }
  412. } else {
  413. HeaderModel->Remove ();
  414. }
  415. }
  416. MenuDialogClass::On_Menu_Activate (onoff);
  417. return ;
  418. }
  419. ////////////////////////////////////////////////////////////////
  420. //
  421. // Close_Dialog
  422. //
  423. ////////////////////////////////////////////////////////////////
  424. void
  425. CNCWinScreenMenuClass::Close_Dialog (void)
  426. {
  427. if (_TheInstance != NULL) {
  428. _TheInstance->End_Dialog ();
  429. }
  430. return ;
  431. }
  432. ////////////////////////////////////////////////////////////////
  433. //
  434. // Populate_Player_Lists
  435. //
  436. ////////////////////////////////////////////////////////////////
  437. void
  438. CNCWinScreenMenuClass::Populate_Player_Lists (int team_id, int list_ctrl1_id)
  439. {
  440. //
  441. // Get a pointer to the list control
  442. //
  443. ListCtrlClass *list_ctrl = (ListCtrlClass *)Get_Dlg_Item (list_ctrl1_id);
  444. if (list_ctrl == NULL) {
  445. return ;
  446. }
  447. DynamicVectorClass<cPlayer *> player_list;
  448. //
  449. // Find the player's name that most closely matches the typed name
  450. //
  451. int index = 0;
  452. for ( SLNode<cPlayer> *player_node = cPlayerManager::Get_Player_Object_List ()->Head ();
  453. player_node != NULL;
  454. player_node = player_node->Next ())
  455. {
  456. cPlayer *player = player_node->Data ();
  457. WWASSERT (player != NULL);
  458. if (player->Get_Is_Active().Is_False ()) {
  459. continue;
  460. }
  461. //
  462. // Does this player belong to the same team?
  463. //
  464. if (player->Get_Player_Type () == team_id) {
  465. player_list.Add (player);
  466. }
  467. }
  468. //
  469. // Sort the players
  470. //
  471. if (player_list.Count () > 0) {
  472. ::qsort (&player_list[0], player_list.Count (), sizeof (cPlayer *), ListSortCallback);
  473. }
  474. //
  475. // Start fresh
  476. //
  477. list_ctrl->Delete_All_Entries ();
  478. //
  479. // Add the players to the list control
  480. //
  481. for (index = 0; index < player_list.Count (); index ++) {
  482. cPlayer *player = player_list[index];
  483. //
  484. // Make a new entry for this player
  485. //
  486. int item_index = list_ctrl->Insert_Entry (index, L"");
  487. if (item_index >= 0) {
  488. //
  489. // Fill in the player's name
  490. //
  491. WideStringClass displayName(0, true);
  492. Build_Player_Display_Name(player, displayName);
  493. list_ctrl->Set_Entry_Text (item_index, COL_NAME, (const WCHAR*)displayName);
  494. //
  495. // Fill in information about the player
  496. //
  497. list_ctrl->Set_Entry_Int (item_index, COL_RANK, player->Get_Rung ());
  498. list_ctrl->Set_Entry_Int (item_index, COL_SCORE, player->Get_Score ());
  499. list_ctrl->Set_Entry_Int (item_index, COL_KILLS, player->Get_Kills ());
  500. if (ShowLadderPoints) {
  501. list_ctrl->Set_Entry_Int (item_index, COL_LADDER, player->Get_Ladder_Points ());
  502. }
  503. //
  504. // Put a star by the player's name if this is the local player
  505. //
  506. SmartGameObj *game_obj = player->Get_GameObj ();
  507. if (cNetwork::I_Am_Client() && (game_obj == COMBAT_STAR)) {
  508. list_ctrl->Add_Icon (item_index, COL_NAME, "IF_LRGSTAR.TGA");
  509. list_ctrl->Set_Entry_Color (item_index, COL_RANK, Vector3 (1.0F, 1.0F, 1.0F));
  510. list_ctrl->Set_Entry_Color (item_index, COL_NAME, Vector3 (1.0F, 1.0F, 1.0F));
  511. list_ctrl->Set_Entry_Color (item_index, COL_SCORE, Vector3 (1.0F, 1.0F, 1.0F));
  512. list_ctrl->Set_Entry_Color (item_index, COL_KILLS, Vector3 (1.0F, 1.0F, 1.0F));
  513. if (ShowLadderPoints) {
  514. list_ctrl->Set_Entry_Color (item_index, COL_LADDER, Vector3 (1.0F, 1.0F, 1.0F));
  515. }
  516. }
  517. //
  518. // Set the ranking as this entries user data so we can sort by it...
  519. //
  520. list_ctrl->Set_Entry_Data (item_index, COL_RANK, player->Get_Rung ());
  521. }
  522. }
  523. return ;
  524. }
  525. ////////////////////////////////////////////////////////////////
  526. //
  527. // ListSortCallbackk
  528. //
  529. ////////////////////////////////////////////////////////////////
  530. int __cdecl
  531. CNCWinScreenMenuClass::ListSortCallback
  532. (
  533. const void *elem1,
  534. const void *elem2
  535. )
  536. {
  537. WWASSERT (elem1 != NULL);
  538. WWASSERT (elem2 != NULL);
  539. cPlayer *player1 = *((cPlayer **)elem1);
  540. cPlayer *player2 = *((cPlayer **)elem2);
  541. //
  542. // Sort based on rank
  543. //
  544. int rank1 = (int)player1->Get_Rung ();
  545. int rank2 = (int)player2->Get_Rung ();
  546. return (rank1 - rank2);
  547. }
  548. ////////////////////////////////////////////////////////////////
  549. //
  550. // Build_Player_Display_Name
  551. //
  552. ////////////////////////////////////////////////////////////////
  553. void
  554. CNCWinScreenMenuClass::Build_Player_Display_Name (const cPlayer *player, WideStringClass &outName)
  555. {
  556. // Denzil 02/24/02 Day 1 Patch - Do not show clan abbreviation for now because
  557. // it does not always fit in the space alloted. For now it is better not to
  558. // show it than to have it chopped off.
  559. #if(0)
  560. GameModeClass* gameMode = GameModeManager::Find("WOL");
  561. if (gameMode && gameMode->Is_Active()) {
  562. WolGameModeClass* wolGame = static_cast<WolGameModeClass*>(gameMode);
  563. WWASSERT(wolGame);
  564. RefPtr<WWOnline::UserData> user = wolGame->Get_WOL_User_Data(player->Get_Name());
  565. if (user.IsValid()) {
  566. // Set there clan information
  567. RefPtr<WWOnline::SquadData> clan = user->GetSquad();
  568. if (clan.IsValid()) {
  569. outName.Format(L"%s [%S]", player->Get_Name(), clan->GetAbbr());
  570. return;
  571. }
  572. }
  573. }
  574. #endif
  575. outName = player->Get_Name();
  576. }