dlgevadatatab.cpp 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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/dlgevadatatab.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 11/21/01 12:14p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "dlgevadatatab.h"
  36. #include "string_ids.h"
  37. #include "translatedb.h"
  38. #include "objectives.h"
  39. #include "player.h"
  40. #include "cnetwork.h"
  41. #include "imagectrl.h"
  42. ////////////////////////////////////////////////////////////////
  43. // Local constants
  44. ////////////////////////////////////////////////////////////////
  45. ////////////////////////////////////////////////////////////////
  46. //
  47. // EvaDataTabClass
  48. //
  49. ////////////////////////////////////////////////////////////////
  50. EvaDataTabClass::EvaDataTabClass (void) :
  51. ChildDialogClass (IDD_ENCYCLOPEDIA_DATA_TAB)
  52. {
  53. return ;
  54. }
  55. ////////////////////////////////////////////////////////////////
  56. //
  57. // On_Init_Dialog
  58. //
  59. ////////////////////////////////////////////////////////////////
  60. void
  61. EvaDataTabClass::On_Init_Dialog (void)
  62. {
  63. Fill_Statistics_List ();
  64. ChildDialogClass::On_Init_Dialog ();
  65. return ;
  66. }
  67. ////////////////////////////////////////////////////////////////
  68. //
  69. // Fill_Statistics_List
  70. //
  71. ////////////////////////////////////////////////////////////////
  72. void
  73. EvaDataTabClass::Fill_Statistics_List (void)
  74. {
  75. //
  76. // Get a pointer to the list control
  77. //
  78. //ListCtrlClass *list_ctrl = (ListCtrlClass *)Get_Dlg_Item (IDC_LISTCTRL);
  79. //if (list_ctrl == NULL) {
  80. //return ;
  81. //}
  82. ((ImageCtrlClass *)Get_Dlg_Item (IDC_GAME_TIME_IMAGE))->Set_Texture ("if_GameTime.tga");
  83. ((ImageCtrlClass *)Get_Dlg_Item (IDC_WEAPONS_IMAGE))->Set_Texture ("if_Weapons.tga");
  84. ((ImageCtrlClass *)Get_Dlg_Item (IDC_POWERUPS_IMAGE))->Set_Texture ("if_PowerUps.tga");
  85. ((ImageCtrlClass *)Get_Dlg_Item (IDC_FRIENDLIES_IMAGE))->Set_Texture ("if_casualties.tga");
  86. ((ImageCtrlClass *)Get_Dlg_Item (IDC_SHOTS_FIRED_IMAGE))->Set_Texture ("if_Ammo.tga");
  87. ((ImageCtrlClass *)Get_Dlg_Item (IDC_ACCURACY_IMAGE))->Set_Texture ("if_Percentage.tga");
  88. ((ImageCtrlClass *)Get_Dlg_Item (IDC_ENEMIES_KILLED_IMAGE))->Set_Texture ("if_NodKills.tga");
  89. ((ImageCtrlClass *)Get_Dlg_Item (IDC_VEHICLE_TIME_IMAGE))->Set_Texture ("if_VehicleTime.tga");
  90. ((ImageCtrlClass *)Get_Dlg_Item (IDC_VEHICLE_KILLS_IMAGE))->Set_Texture ("if_VehiclesKill.tga");
  91. ((ImageCtrlClass *)Get_Dlg_Item (IDC_VEHICLE_SQUISHES_IMAGE))->Set_Texture ("if_RunOvers.tga");
  92. ((ImageCtrlClass *)Get_Dlg_Item (IDC_VEHICLES_DESTROYED_IMAGE))->Set_Texture ("if_KillVehicles.tga");
  93. ((ImageCtrlClass *)Get_Dlg_Item (IDC_BUILDINGS_DESTROYED_IMAGE))->Set_Texture ("if_buildingsKill.tga");
  94. ((ImageCtrlClass *)Get_Dlg_Item (IDC_HIT_MAP_IMAGE))->Set_Texture ("if_NodHits128.tga");
  95. cPlayer *player = cNetwork::Get_My_Player_Object ();
  96. if (player != NULL) {
  97. Set_Dlg_Item_Int (IDC_WEAPONS_TEXT, player->Get_Weapon_Fired_Count ());
  98. Set_Dlg_Item_Int (IDC_POWERUPS_TEXT, player->Get_Powerups_Collected ());
  99. Set_Dlg_Item_Int (IDC_FRIENDLIES_TEXT, player->Get_Allies_Killed ());
  100. Set_Dlg_Item_Int (IDC_SHOTS_FIRED_TEXT, player->Get_Shots_Fired ());
  101. Set_Dlg_Item_Int (IDC_ENEMIES_KILLED_TEXT, player->Get_Enemies_Killed ());
  102. Set_Dlg_Item_Int (IDC_VEHICLE_KILLS_TEXT, player->Get_Kills_From_Vehicle ());
  103. Set_Dlg_Item_Int (IDC_VEHICLE_SQUISHES_TEXT, player->Get_Squishes ());
  104. Set_Dlg_Item_Int (IDC_VEHICLES_KILLED_TEXT, player->Get_Vehiclies_Destroyed ());
  105. Set_Dlg_Item_Int (IDC_BUILDINGS_KILLED_TEXT, player->Get_Building_Destroyed ());
  106. Set_Dlg_Item_Int (IDC_HEAD_SHOT_TEXT, player->Get_Head_Shots ());
  107. Set_Dlg_Item_Int (IDC_TORSO_SHOT_TEXT, player->Get_Torso_Shots ());
  108. Set_Dlg_Item_Int (IDC_ARM_SHOT_TEXT, player->Get_Arm_Shots ());
  109. Set_Dlg_Item_Int (IDC_CROTCH_SHOT_TEXT, player->Get_Crotch_Shots ());
  110. Set_Dlg_Item_Int (IDC_LEG_SHOT_TEXT, player->Get_Leg_Shots ());
  111. //
  112. // Total up the number of shots and hits this player has mode
  113. //
  114. int total_shots = player->Get_Shots_Fired ();
  115. int total_hits = player->Get_Head_Shots ();
  116. total_hits += player->Get_Torso_Shots ();
  117. total_hits += player->Get_Arm_Shots ();
  118. total_hits += player->Get_Leg_Shots ();
  119. total_hits += player->Get_Crotch_Shots ();
  120. float accuracy = 100.0F;
  121. if (total_shots > 0) {
  122. accuracy = (total_hits * 100.0F) / (float)total_shots;
  123. }
  124. Set_Dlg_Item_Float (IDC_ACCURACY_TEXT, accuracy);
  125. //
  126. // Format the time in vehicles text
  127. //
  128. WideStringClass time_string;
  129. float time = player->Get_Vehicle_Time ();
  130. int hours = int(time / 3600.0F);
  131. time -= hours * 3600.0F;
  132. int minutes = int(time / 60.0F);
  133. time -= minutes * 60.0F;
  134. int seconds = (int)time;
  135. if (hours > 0) {
  136. time_string.Format (L"%.01d:%.02d:%.2d", hours, minutes, seconds);
  137. } else {
  138. time_string.Format (L"%.02d:%.2d", minutes, seconds);
  139. }
  140. Set_Dlg_Item_Text (IDC_VEHICLES_TIME_TEXT, time_string);
  141. //
  142. // Format the time in game text
  143. //
  144. time = player->Get_Game_Time ();
  145. hours = int(time / 3600.0F);
  146. time -= hours * 3600.0F;
  147. minutes = int(time / 60.0F);
  148. time -= minutes * 60.0F;
  149. seconds = (int)time;
  150. time_string.Format (L"%.02d", hours);
  151. Set_Dlg_Item_Text (IDC_GAME_TIME_HOURS_TEXT, time_string);
  152. time_string.Format (L"%.02d", minutes);
  153. Set_Dlg_Item_Text (IDC_GAME_TIME_MINS_TEXT, time_string);
  154. time_string.Format (L"%.02d", seconds);
  155. Set_Dlg_Item_Text (IDC_GAME_TIME_SECS_TEXT, time_string);
  156. /*WideStringClass entry;
  157. entry.Format (TRANSLATE (IDS_EVA_DATA_GAME_TIME), / 60.0F);
  158. list_ctrl->Insert_Entry (0xFF, entry);
  159. entry.Format (TRANSLATE (IDS_EVA_DATA_HEAD_HIT), player->Get_Head_Hit ());
  160. list_ctrl->Insert_Entry (0xFF, entry);
  161. entry.Format (TRANSLATE (IDS_EVA_DATA_TORSO_HIT), player->Get_Torso_Hit ());
  162. list_ctrl->Insert_Entry (0xFF, entry);
  163. entry.Format (TRANSLATE (IDS_EVA_DATA_ARM_HIT), player->Get_Arm_Hit ());
  164. list_ctrl->Insert_Entry (0xFF, entry);
  165. entry.Format (TRANSLATE (IDS_EVA_DATA_LEG_HIT), player->Get_Leg_Hit ());
  166. list_ctrl->Insert_Entry (0xFF, entry);
  167. entry.Format (TRANSLATE (IDS_EVA_DATA_CROTCH_HIT), player->Get_Crotch_Hit ());
  168. list_ctrl->Insert_Entry (0xFF, entry);
  169. */
  170. }
  171. return ;
  172. }