scorescreen.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Commando/scorescreen.cpp $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 1/24/02 11:20a $*
  29. * *
  30. * $Revision:: 27 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "scorescreen.h"
  36. #include "campaign.h"
  37. #include "resource.h"
  38. #include "translatedb.h"
  39. #include "string_ids.h"
  40. #include "imagectrl.h"
  41. #include "debug.h"
  42. #include "wwstring.h"
  43. #include "gamedata.h"
  44. #include "combat.h"
  45. #include "playerdata.h"
  46. #include "cheatmgr.h"
  47. #include "objectives.h"
  48. #include "dlgloadspgame.h"
  49. #include "savegame.h"
  50. #define NUM_MISSIONS 13
  51. /*
  52. **
  53. */
  54. void ScoreScreenGameModeClass::Init()
  55. {
  56. START_DIALOG( ScoreScreenDialogClass );
  57. }
  58. float _SSStats_play_time = 0;
  59. int _SSStats_mission_number = 0;
  60. int _SSStats_reload_count = 0;
  61. bool _SSStats_cheated = 0;
  62. int _SSStats_secondary_objectives = 0;
  63. int _SSStats_completed_secondary_objectives = 0;
  64. int _SSStats_tertiary_objectives = 0;
  65. int _SSStats_completed_tertiary_objectives = 0;
  66. int _SSStats_building_destroyed = 0;
  67. int _SSStats_vehicles_destroyed = 0;
  68. int _SSStats_enemies_killed = 0;
  69. int _SSStats_head_hit = 0;
  70. int _SSStats_torso_hit = 0;
  71. int _SSStats_arm_hit = 0;
  72. int _SSStats_crotch_hit = 0;
  73. int _SSStats_leg_hit = 0;
  74. StringClass _SSStats_map_name;
  75. /*
  76. ** We save all the stats before the combat is shutdown
  77. */
  78. void ScoreScreenGameModeClass::Save_Stats( void )
  79. {
  80. _SSStats_play_time = 100000;
  81. _SSStats_building_destroyed = 0;
  82. _SSStats_vehicles_destroyed = 0;
  83. _SSStats_enemies_killed = 0;
  84. _SSStats_head_hit = 0;
  85. _SSStats_torso_hit = 0;
  86. _SSStats_arm_hit = 0;
  87. _SSStats_crotch_hit = 0;
  88. _SSStats_leg_hit = 0;
  89. if ( COMBAT_STAR ) {
  90. PlayerDataClass * player_data = COMBAT_STAR->Get_Player_Data();
  91. if ( player_data != NULL ) {
  92. _SSStats_play_time = player_data->Get_Game_Time();
  93. _SSStats_building_destroyed = player_data->Get_Building_Destroyed();
  94. _SSStats_vehicles_destroyed = player_data->Get_Vehiclies_Destroyed();
  95. _SSStats_enemies_killed = player_data->Get_Enemies_Killed();
  96. _SSStats_head_hit = player_data->Get_Head_Shots();
  97. _SSStats_torso_hit = player_data->Get_Torso_Shots();
  98. _SSStats_arm_hit = player_data->Get_Arm_Shots();
  99. _SSStats_crotch_hit = player_data->Get_Crotch_Shots();
  100. _SSStats_leg_hit = player_data->Get_Leg_Shots();
  101. }
  102. }
  103. // Save the map name
  104. _SSStats_map_name = The_Game()->Get_Map_Name();
  105. StringClass map_name(0,true);
  106. if (SaveGameManager::Peek_Map_Name (_SSStats_map_name, map_name)) {
  107. _SSStats_map_name = map_name;
  108. }
  109. WWASSERT(PTheGameData != NULL);
  110. _SSStats_mission_number = cGameData::Get_Mission_Number_From_Map_Name( _SSStats_map_name );
  111. // Oh, this is just terrible!!! Byon
  112. #define TUTORIAL_LOAD_MENU_NUMBER 90
  113. if ( _SSStats_mission_number == TUTORIAL_LOAD_MENU_NUMBER ) {
  114. _SSStats_mission_number = 0;
  115. }
  116. if ( _SSStats_mission_number > NUM_MISSIONS ) {
  117. _SSStats_mission_number = NUM_MISSIONS;
  118. }
  119. if ( _SSStats_mission_number < 0 ) {
  120. _SSStats_mission_number = 0;
  121. }
  122. _SSStats_reload_count = CombatManager::Get_Reload_Count();
  123. _SSStats_cheated = CheatMgrClass::Get_Instance()->Was_Cheat_Used( CheatMgrClass::ALL_CHEATS );
  124. _SSStats_secondary_objectives = ObjectiveManager::Get_Num_Objectives( ObjectiveManager::TYPE_SECONDARY );
  125. _SSStats_completed_secondary_objectives = ObjectiveManager::Get_Num_Completed_Objectives( ObjectiveManager::TYPE_SECONDARY );
  126. _SSStats_tertiary_objectives = ObjectiveManager::Get_Num_Objectives( ObjectiveManager::TYPE_TERTIARY );
  127. _SSStats_completed_tertiary_objectives = ObjectiveManager::Get_Num_Completed_Objectives( ObjectiveManager::TYPE_TERTIARY );
  128. }
  129. ////////////////////////////////////////////////////////////////
  130. //
  131. // ScoreScreenDialogClass
  132. //
  133. ////////////////////////////////////////////////////////////////
  134. ScoreScreenDialogClass::ScoreScreenDialogClass (void) :
  135. MenuDialogClass (IDD_SCORE_SCREEN)
  136. {
  137. ScoreScreenActive = true;
  138. return ;
  139. }
  140. ////////////////////////////////////////////////////////////////
  141. //
  142. // On_Init_Dialog
  143. //
  144. ////////////////////////////////////////////////////////////////
  145. void
  146. ScoreScreenDialogClass::On_Init_Dialog (void)
  147. {
  148. MenuDialogClass::On_Init_Dialog ();
  149. int time_to_finish_stars = Get_Time_To_Finish_Stars();
  150. int level_of_play_stars = Get_Level_Of_Play_Stars();
  151. int saves_loaded_stars = Get_Saves_Loaded_Stars();
  152. int secondary_missions_stars = Get_Secondary_Missions_Stars();
  153. int overall_stars = (time_to_finish_stars + level_of_play_stars +
  154. saves_loaded_stars + secondary_missions_stars) / 4;
  155. // Update the ranking
  156. LoadSPGameMenuClass::Set_Game_Rank( _SSStats_map_name, overall_stars );
  157. /*
  158. ** Setup Star Textures
  159. */
  160. #define BIG_STAR_TEXTURE "IF_LrgStar.tga"
  161. #define SMALL_STAR_TEXTURE "IF_LrgStar.tga"
  162. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SS_BACKGROUND ))->Set_Texture( "if_missioncomp.tga" );
  163. ((ImageCtrlClass*)Get_Dlg_Item( IDC_MISSION_EVAL_STAR_1 ))->Set_Texture( BIG_STAR_TEXTURE );
  164. ((ImageCtrlClass*)Get_Dlg_Item( IDC_MISSION_EVAL_STAR_2 ))->Set_Texture( BIG_STAR_TEXTURE );
  165. ((ImageCtrlClass*)Get_Dlg_Item( IDC_MISSION_EVAL_STAR_3 ))->Set_Texture( BIG_STAR_TEXTURE );
  166. ((ImageCtrlClass*)Get_Dlg_Item( IDC_MISSION_EVAL_STAR_4 ))->Set_Texture( BIG_STAR_TEXTURE );
  167. ((ImageCtrlClass*)Get_Dlg_Item( IDC_MISSION_EVAL_STAR_5 ))->Set_Texture( BIG_STAR_TEXTURE );
  168. ((ImageCtrlClass*)Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_1 ))->Set_Texture( SMALL_STAR_TEXTURE );
  169. ((ImageCtrlClass*)Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_2 ))->Set_Texture( SMALL_STAR_TEXTURE );
  170. ((ImageCtrlClass*)Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_3 ))->Set_Texture( SMALL_STAR_TEXTURE );
  171. ((ImageCtrlClass*)Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_4 ))->Set_Texture( SMALL_STAR_TEXTURE );
  172. ((ImageCtrlClass*)Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_5 ))->Set_Texture( SMALL_STAR_TEXTURE );
  173. ((ImageCtrlClass*)Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_1 ))->Set_Texture( SMALL_STAR_TEXTURE );
  174. ((ImageCtrlClass*)Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_2 ))->Set_Texture( SMALL_STAR_TEXTURE );
  175. ((ImageCtrlClass*)Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_3 ))->Set_Texture( SMALL_STAR_TEXTURE );
  176. ((ImageCtrlClass*)Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_4 ))->Set_Texture( SMALL_STAR_TEXTURE );
  177. ((ImageCtrlClass*)Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_5 ))->Set_Texture( SMALL_STAR_TEXTURE );
  178. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SAVES_LOADED_STAR_1 ))->Set_Texture( SMALL_STAR_TEXTURE );
  179. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SAVES_LOADED_STAR_2 ))->Set_Texture( SMALL_STAR_TEXTURE );
  180. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SAVES_LOADED_STAR_3 ))->Set_Texture( SMALL_STAR_TEXTURE );
  181. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SAVES_LOADED_STAR_4 ))->Set_Texture( SMALL_STAR_TEXTURE );
  182. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SAVES_LOADED_STAR_5 ))->Set_Texture( SMALL_STAR_TEXTURE );
  183. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_1 ))->Set_Texture( SMALL_STAR_TEXTURE );
  184. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_2 ))->Set_Texture( SMALL_STAR_TEXTURE );
  185. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_3 ))->Set_Texture( SMALL_STAR_TEXTURE );
  186. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_4 ))->Set_Texture( SMALL_STAR_TEXTURE );
  187. ((ImageCtrlClass*)Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_5 ))->Set_Texture( SMALL_STAR_TEXTURE );
  188. Get_Dlg_Item( IDC_MISSION_EVAL_STAR_1 )->Show( overall_stars >= 1 );
  189. Get_Dlg_Item( IDC_MISSION_EVAL_STAR_2 )->Show( overall_stars >= 2 );
  190. Get_Dlg_Item( IDC_MISSION_EVAL_STAR_3 )->Show( overall_stars >= 3 );
  191. Get_Dlg_Item( IDC_MISSION_EVAL_STAR_4 )->Show( overall_stars >= 4 );
  192. Get_Dlg_Item( IDC_MISSION_EVAL_STAR_5 )->Show( overall_stars >= 5 );
  193. Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_1 )->Show( time_to_finish_stars >= 1 );
  194. Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_2 )->Show( time_to_finish_stars >= 2 );
  195. Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_3 )->Show( time_to_finish_stars >= 3 );
  196. Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_4 )->Show( time_to_finish_stars >= 4 );
  197. Get_Dlg_Item( IDC_TIME_TO_FINISH_STAR_5 )->Show( time_to_finish_stars >= 5 );
  198. Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_1 )->Show( level_of_play_stars >= 1 );
  199. Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_2 )->Show( level_of_play_stars >= 2 );
  200. Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_3 )->Show( level_of_play_stars >= 3 );
  201. Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_4 )->Show( level_of_play_stars >= 4 );
  202. Get_Dlg_Item( IDC_LEVEL_OF_PLAY_STAR_5 )->Show( level_of_play_stars >= 5 );
  203. Get_Dlg_Item( IDC_SAVES_LOADED_STAR_1 )->Show( saves_loaded_stars >= 1 );
  204. Get_Dlg_Item( IDC_SAVES_LOADED_STAR_2 )->Show( saves_loaded_stars >= 2 );
  205. Get_Dlg_Item( IDC_SAVES_LOADED_STAR_3 )->Show( saves_loaded_stars >= 3 );
  206. Get_Dlg_Item( IDC_SAVES_LOADED_STAR_4 )->Show( saves_loaded_stars >= 4 );
  207. Get_Dlg_Item( IDC_SAVES_LOADED_STAR_5 )->Show( saves_loaded_stars >= 5 );
  208. Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_1 )->Show( secondary_missions_stars >= 1 );
  209. Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_2 )->Show( secondary_missions_stars >= 2 );
  210. Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_3 )->Show( secondary_missions_stars >= 3 );
  211. Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_4 )->Show( secondary_missions_stars >= 4 );
  212. Get_Dlg_Item( IDC_SECONDARY_MISSIONS_STAR_5 )->Show( secondary_missions_stars >= 5 );
  213. bool cheater = _SSStats_cheated;
  214. // Build Rank Text
  215. int rank_ids[5] = { IDS_SS_RANK_1, IDS_SS_RANK_2, IDS_SS_RANK_3, IDS_SS_RANK_4, IDS_SS_RANK_5 };
  216. WideStringClass rank_name = L"";
  217. rank_name += TRANSLATE( rank_ids[ overall_stars-1 ] );
  218. if ( cheater ) {
  219. rank_name += TRANSLATE( IDS_SS_CHEATER );
  220. }
  221. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_RANK, rank_name );
  222. // Build Rank Image
  223. const char * rank_images[5] = { "IF_private.tga", "IF_sargent.tga", "IF_leutenant.tga", "IF_major.tga", "IF_general.tga" };
  224. const char * rank_image = "IF_cheatgod.tga";
  225. if ( !cheater ) {
  226. rank_image = rank_images[ overall_stars-1 ];
  227. }
  228. ((ImageCtrlClass*)Get_Dlg_Item( IDC_RANK_IMAGE ))->Set_Texture( rank_image );
  229. WideStringClass wstr;
  230. wstr.Format( L"%d", _SSStats_building_destroyed );
  231. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_BUILDING_COUNT, wstr );
  232. wstr.Format( L"%d", _SSStats_vehicles_destroyed );
  233. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_VEHICLE_COUNT, wstr );
  234. wstr.Format( L"%d", _SSStats_enemies_killed );
  235. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_ENEMY_COUNT, wstr );
  236. wstr.Format( L"%d", _SSStats_enemies_killed );
  237. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_ENEMY_COUNT, wstr );
  238. wstr.Format( L"%d", _SSStats_head_hit );
  239. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_HEAD_COUNT, wstr );
  240. wstr.Format( L"%d", _SSStats_torso_hit );
  241. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_TORSO_COUNT, wstr );
  242. wstr.Format( L"%d", _SSStats_arm_hit );
  243. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_ARM_COUNT, wstr );
  244. wstr.Format( L"%d", _SSStats_crotch_hit );
  245. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_CROTCH_COUNT, wstr );
  246. wstr.Format( L"%d", _SSStats_leg_hit );
  247. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_LEG_COUNT, wstr );
  248. WideStringClass text;
  249. text.Format( TRANSLATE( IDS_SS_X_OF_N ), _SSStats_completed_tertiary_objectives, _SSStats_tertiary_objectives );
  250. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_BONUS, text );
  251. int mission_names[ NUM_MISSIONS+1 ] = {
  252. IDS_LoadScreen_Tutorial_Item_00_Title,
  253. IDS_Enc_Miss_Title_M01_01,
  254. IDS_Enc_Miss_Title_M02_01,
  255. IDS_Enc_Miss_Title_M03_01,
  256. IDS_Enc_Miss_Title_M04_01,
  257. IDS_Enc_Miss_Title_M05_01,
  258. IDS_Enc_Miss_Title_M06_01,
  259. IDS_Enc_Miss_Title_M07_01,
  260. IDS_Enc_Miss_Title_M08_01,
  261. IDS_Enc_Miss_Title_M09_01,
  262. IDS_Enc_Miss_Title_M10_01,
  263. IDS_Enc_Miss_Title_M11_01,
  264. IDS_LoadScreen_MX0_Title, // 12
  265. IDS_LoadScreen_MX0_Title, // 13 (m00)
  266. };
  267. int id = mission_names[_SSStats_mission_number];
  268. Set_Dlg_Item_Text( IDC_SS_MISSION_NAME, TRANSLATE( id ) );
  269. return ;
  270. }
  271. ////////////////////////////////////////////////////////////////
  272. //
  273. // On_Init_Dialog
  274. //
  275. ////////////////////////////////////////////////////////////////
  276. void
  277. ScoreScreenDialogClass::On_Destroy (void)
  278. {
  279. MenuDialogClass::On_Destroy ();
  280. if ( ScoreScreenActive ) {
  281. ScoreScreenActive = false;
  282. CampaignManager::Continue();
  283. }
  284. return ;
  285. }
  286. ////////////////////////////////////////////////////////////////
  287. //
  288. // On_Command
  289. //
  290. ////////////////////////////////////////////////////////////////
  291. void
  292. ScoreScreenDialogClass::On_Command (int ctrl_id, int mesage_id, DWORD param)
  293. {
  294. switch (ctrl_id)
  295. {
  296. case IDCANCEL:
  297. case IDOK:
  298. End_Dialog();
  299. break;
  300. default:
  301. MenuDialogClass::On_Command (ctrl_id, mesage_id, param);
  302. break;
  303. }
  304. return ;
  305. }
  306. /*
  307. **
  308. */
  309. float level_star_times[] = {
  310. /* STARS 2 3 4 5 */
  311. /* 0 */ 10,
  312. /* 1 */ 20,
  313. /* 2 */ 40,
  314. /* 3 */ 20,
  315. /* 4 */ 25,
  316. /* 5 */ 30,
  317. /* 6 */ 20,
  318. /* 7 */ 35,
  319. /* 8 */ 20,
  320. /* 9 */ 25,
  321. /* 10 */ 35,
  322. /* 11 */ 25,
  323. /* 12 */ 10,
  324. /* 13 */ 10, // Mission 0
  325. };
  326. int ScoreScreenDialogClass::Get_Time_To_Finish_Stars( void )
  327. {
  328. int mission = _SSStats_mission_number;
  329. float time = (_SSStats_play_time+59.0f) / 60.0f;
  330. float par_time = level_star_times[mission];
  331. int stars = 1;
  332. if ( time <= par_time * 1.5f ) {
  333. stars = 2;
  334. }
  335. if ( time <= par_time * 1.3f ) {
  336. stars = 3;
  337. }
  338. if ( time <= par_time * 1.1f ) {
  339. stars = 4;
  340. }
  341. if ( time <= par_time ) {
  342. stars = 5;
  343. }
  344. int minutes = time;
  345. WideStringClass wtime;
  346. wtime.Format( TRANSLATE( IDS_SS_HOURS_MINUTES ), minutes / 60, minutes % 60 );
  347. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_PLAYTIME, wtime );
  348. // Debug_Say(( "Time %f Mission %d = Stars %d\n", time, mission, stars ));
  349. return stars;
  350. }
  351. /*
  352. **
  353. */
  354. int ScoreScreenDialogClass::Get_Level_Of_Play_Stars( void )
  355. {
  356. if ( CombatManager::Get_Difficulty_Level() >= 2 ) {
  357. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_DIFFICULTY, TRANSLATE( IDS_MENU_TEXT065 ) );
  358. return 5;
  359. }
  360. if ( CombatManager::Get_Difficulty_Level() >= 1 ) {
  361. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_DIFFICULTY, TRANSLATE( IDS_MENU_TEXT064 ) );
  362. return 3;
  363. }
  364. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_DIFFICULTY, TRANSLATE( IDS_MENU_TEXT063 ) );
  365. return 1;
  366. }
  367. /*
  368. **
  369. */
  370. int ScoreScreenDialogClass::Get_Saves_Loaded_Stars( void )
  371. {
  372. WideStringClass text;
  373. text.Format( TRANSLATE( IDS_SS_RELOADS ), _SSStats_reload_count );
  374. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_LOADS, text );
  375. if ( _SSStats_reload_count == 0 ) {
  376. return 5;
  377. }
  378. if ( _SSStats_reload_count <= 2 ) {
  379. return 4;
  380. }
  381. if ( _SSStats_reload_count <= 5 ) {
  382. return 3;
  383. }
  384. if ( _SSStats_reload_count <= 9 ) {
  385. return 2;
  386. }
  387. return 1;
  388. }
  389. /*
  390. **
  391. */
  392. int ScoreScreenDialogClass::Get_Secondary_Missions_Stars( void )
  393. {
  394. WideStringClass text;
  395. text.Format( TRANSLATE( IDS_SS_X_OF_N ), _SSStats_completed_secondary_objectives, _SSStats_secondary_objectives );
  396. Set_Dlg_Item_Text( IDC_SCORE_SCREEN_SECONDARY, text );
  397. float ratio = 1.0f;
  398. if ( _SSStats_secondary_objectives != 0 ) {
  399. ratio = (float)_SSStats_completed_secondary_objectives / (float)_SSStats_secondary_objectives;
  400. }
  401. if ( ratio >= 1.0f ) {
  402. return 5;
  403. }
  404. if ( ratio >= 0.9f ) {
  405. return 4;
  406. }
  407. if ( ratio >= 0.7f ) {
  408. return 3;
  409. }
  410. if ( ratio >= 0.5f ) {
  411. return 2;
  412. }
  413. return 1;
  414. }