dlgcontroltabs.cpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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 : Combat *
  23. * *
  24. * $Archive:: /Commando/Code/Commando/dlgcontroltabs.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 4/03/02 2:16p $*
  29. * *
  30. * $Revision:: 17 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "dlgcontroltabs.h"
  36. #include "input.h"
  37. #include "sliderctrl.h"
  38. #include "vehicle.h"
  39. #include "comboboxctrl.h"
  40. #include "translatedb.h"
  41. #include "string_ids.h"
  42. #include "useroptions.h"
  43. #include "combat.h"
  44. #include "ccamera.h"
  45. ////////////////////////////////////////////////////////////////
  46. //
  47. // ControlsBasicMvmtTabClass
  48. //
  49. ////////////////////////////////////////////////////////////////
  50. ControlsBasicMvmtTabClass::ControlsBasicMvmtTabClass (void) :
  51. ControlsListTabClass (IDD_CONTROLS_BASIC_MOVMENT_TAB)
  52. {
  53. Add_Function (INPUT_FUNCTION_MOVE_FORWARD, IDC_HOTKEY1, IDC_HOTKEY13);
  54. Add_Function (INPUT_FUNCTION_MOVE_BACKWARD, IDC_HOTKEY2, IDC_HOTKEY14);
  55. Add_Function (INPUT_FUNCTION_MOVE_LEFT, IDC_HOTKEY3, IDC_HOTKEY15);
  56. Add_Function (INPUT_FUNCTION_MOVE_RIGHT, IDC_HOTKEY4, IDC_HOTKEY16);
  57. Add_Function (INPUT_FUNCTION_TURN_LEFT, IDC_HOTKEY5, IDC_HOTKEY17);
  58. Add_Function (INPUT_FUNCTION_TURN_RIGHT, IDC_HOTKEY6, IDC_HOTKEY18);
  59. Add_Function (INPUT_FUNCTION_WALK_MODE, IDC_HOTKEY7, IDC_HOTKEY19);
  60. Add_Function (INPUT_FUNCTION_JUMP, IDC_HOTKEY8, IDC_HOTKEY20);
  61. Add_Function (INPUT_FUNCTION_CROUCH, IDC_HOTKEY9, IDC_HOTKEY21);
  62. Add_Function (INPUT_FUNCTION_ACTION, IDC_HOTKEY10, IDC_HOTKEY22);
  63. Add_Function (INPUT_FUNCTION_TURN_AROUND, IDC_HOTKEY11, IDC_HOTKEY23);
  64. return ;
  65. }
  66. ////////////////////////////////////////////////////////////////
  67. //
  68. // ControlsAttackTabClass
  69. //
  70. ////////////////////////////////////////////////////////////////
  71. ControlsAttackTabClass::ControlsAttackTabClass (void) :
  72. ControlsListTabClass (IDD_CONTROLS_ATTACK_TAB)
  73. {
  74. Add_Function (INPUT_FUNCTION_FIRE_WEAPON_PRIMARY, IDC_HOTKEY1, IDC_HOTKEY13);
  75. Add_Function (INPUT_FUNCTION_FIRE_WEAPON_SECONDARY, IDC_HOTKEY2, IDC_HOTKEY14);
  76. Add_Function (INPUT_FUNCTION_PREV_WEAPON, IDC_HOTKEY3, IDC_HOTKEY15);
  77. Add_Function (INPUT_FUNCTION_NEXT_WEAPON, IDC_HOTKEY4, IDC_HOTKEY16);
  78. Add_Function (INPUT_FUNCTION_RELOAD_WEAPON, IDC_HOTKEY5, IDC_HOTKEY17);
  79. Add_Function (INPUT_FUNCTION_ZOOM_IN, IDC_HOTKEY6, IDC_HOTKEY18);
  80. Add_Function (INPUT_FUNCTION_ZOOM_OUT, IDC_HOTKEY7, IDC_HOTKEY19);
  81. return ;
  82. }
  83. ////////////////////////////////////////////////////////////////
  84. //
  85. // On_Init_Dialog
  86. //
  87. ////////////////////////////////////////////////////////////////
  88. void
  89. ControlsAttackTabClass::On_Init_Dialog (void)
  90. {
  91. ControlsListTabClass::On_Init_Dialog ();
  92. Load_Controls ();
  93. return ;
  94. }
  95. ////////////////////////////////////////////////////////////////
  96. //
  97. // On_Apply
  98. //
  99. ////////////////////////////////////////////////////////////////
  100. bool
  101. ControlsAttackTabClass::On_Apply (void)
  102. {
  103. ControlsListTabClass::On_Apply ();
  104. //
  105. // Read the data from the checkboxes
  106. //
  107. Input::Enable_Damage_Indicators (Is_Dlg_Button_Checked (IDC_DAMAGE_INDICATOR_CHECK));
  108. return true;
  109. }
  110. ////////////////////////////////////////////////////////////////
  111. //
  112. // Load_Controls
  113. //
  114. ////////////////////////////////////////////////////////////////
  115. void
  116. ControlsAttackTabClass::Load_Controls (void)
  117. {
  118. Check_Dlg_Button (IDC_DAMAGE_INDICATOR_CHECK, Input::Are_Damage_Indicators_Enabled ());
  119. return ;
  120. }
  121. ////////////////////////////////////////////////////////////////
  122. //
  123. // On_Reload
  124. //
  125. ////////////////////////////////////////////////////////////////
  126. void
  127. ControlsAttackTabClass::On_Reload (void)
  128. {
  129. ControlsListTabClass::On_Reload ();
  130. Load_Controls ();
  131. return ;
  132. }
  133. ////////////////////////////////////////////////////////////////
  134. //
  135. // ControlsWeaponsTabClass
  136. //
  137. ////////////////////////////////////////////////////////////////
  138. ControlsWeaponsTabClass::ControlsWeaponsTabClass (void) :
  139. ControlsListTabClass (IDD_CONTROLS_WEAPONS_TAB)
  140. {
  141. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_1, IDC_HOTKEY1, IDC_HOTKEY13);
  142. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_2, IDC_HOTKEY2, IDC_HOTKEY14);
  143. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_3, IDC_HOTKEY3, IDC_HOTKEY15);
  144. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_4, IDC_HOTKEY4, IDC_HOTKEY16);
  145. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_5, IDC_HOTKEY5, IDC_HOTKEY17);
  146. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_6, IDC_HOTKEY6, IDC_HOTKEY18);
  147. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_7, IDC_HOTKEY7, IDC_HOTKEY19);
  148. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_8, IDC_HOTKEY8, IDC_HOTKEY20);
  149. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_9, IDC_HOTKEY9, IDC_HOTKEY21);
  150. Add_Function (INPUT_FUNCTION_SELECT_WEAPON_0, IDC_HOTKEY10, IDC_HOTKEY22);
  151. return ;
  152. }
  153. ////////////////////////////////////////////////////////////////
  154. //
  155. // ControlsLookTabClass
  156. //
  157. ////////////////////////////////////////////////////////////////
  158. ControlsLookTabClass::ControlsLookTabClass (void) :
  159. ControlsListTabClass (IDD_CONTROLS_LOOK_TAB)
  160. {
  161. Add_Function (INPUT_FUNCTION_CURSOR_TARGETING, IDC_HOTKEY1, IDC_HOTKEY13);
  162. Add_Function (INPUT_FUNCTION_FIRST_PERSON_TOGGLE, IDC_HOTKEY2, IDC_HOTKEY14);
  163. return ;
  164. }
  165. ////////////////////////////////////////////////////////////////
  166. //
  167. // On_Init_Dialog
  168. //
  169. ////////////////////////////////////////////////////////////////
  170. void
  171. ControlsLookTabClass::On_Init_Dialog (void)
  172. {
  173. ControlsListTabClass::On_Init_Dialog ();
  174. //
  175. // Configure the mouse sensivity slider
  176. //
  177. SliderCtrlClass *slider_ctrl = (SliderCtrlClass *)Get_Dlg_Item (IDC_MOUSE_SENSITIVITY_SLIDER);
  178. if (slider_ctrl != NULL) {
  179. slider_ctrl->Set_Range (0, 100);
  180. }
  181. //
  182. // Configure the steering mode combobox
  183. //
  184. // ComboBoxCtrlClass *combo_box = (ComboBoxCtrlClass *)Get_Dlg_Item (IDC_STEERING_MODE_COMBO);
  185. // if (combo_box != NULL) {
  186. // combo_box->Add_String (TRANSLATE (IDS_STEERING_MODE_NORMAL));
  187. // combo_box->Add_String (TRANSLATE (IDS_STEERING_MODE_TARGET));
  188. // combo_box->Set_Curr_Sel (1);
  189. // }
  190. Load_Controls ();
  191. return ;
  192. }
  193. ////////////////////////////////////////////////////////////////
  194. //
  195. // On_Apply
  196. //
  197. ////////////////////////////////////////////////////////////////
  198. bool
  199. ControlsLookTabClass::On_Apply (void)
  200. {
  201. ControlsListTabClass::On_Apply ();
  202. //
  203. // Read the data from the slider
  204. //
  205. SliderCtrlClass *slider_ctrl = (SliderCtrlClass *)Get_Dlg_Item (IDC_MOUSE_SENSITIVITY_SLIDER);
  206. if (slider_ctrl != NULL) {
  207. Input::Set_Mouse_Sensitivity (slider_ctrl->Get_Pos () / 100.0F);
  208. }
  209. //
  210. // Read the steering mode
  211. //
  212. // Always keyboard steer
  213. VehicleGameObj::Set_Target_Steering (false);
  214. // ComboBoxCtrlClass *combo_box = (ComboBoxCtrlClass *)Get_Dlg_Item (IDC_STEERING_MODE_COMBO);
  215. // if (combo_box != NULL) {
  216. // VehicleGameObj::Set_Target_Steering ((combo_box->Get_Curr_Sel () == 1));
  217. // }
  218. //
  219. // Read the data from the checkboxes
  220. //
  221. Input::Set_Mouse_Invert (Is_Dlg_Button_Checked (IDC_INVERT_MOUSE_CHECK));
  222. Input::Set_Mouse_2D_Invert (Is_Dlg_Button_Checked (IDC_INVERT_CURSOR_TARGETTING_CHECK));
  223. cUserOptions::CameraLockedToTurret.Set(Is_Dlg_Button_Checked (IDC_LOCK_CAMERA_TO_TURRET_CHECK));
  224. //
  225. // Notify combat about the state of the CameraLockedToTurret user option.
  226. //
  227. VehicleGameObj::Set_Camera_Locked_To_Turret(cUserOptions::CameraLockedToTurret.Get());
  228. return true;
  229. }
  230. ////////////////////////////////////////////////////////////////
  231. //
  232. // Load_Controls
  233. //
  234. ////////////////////////////////////////////////////////////////
  235. void
  236. ControlsLookTabClass::Load_Controls (void)
  237. {
  238. //
  239. // Configure the mouse sensivity slider
  240. //
  241. SliderCtrlClass *slider_ctrl = (SliderCtrlClass *)Get_Dlg_Item (IDC_MOUSE_SENSITIVITY_SLIDER);
  242. if (slider_ctrl != NULL) {
  243. slider_ctrl->Set_Pos (Input::Get_Mouse_Sensitivity () * 100);
  244. }
  245. //
  246. // Load the steering mode setting
  247. //
  248. // ComboBoxCtrlClass *combo_box = (ComboBoxCtrlClass *)Get_Dlg_Item (IDC_STEERING_MODE_COMBO);
  249. // if (combo_box != NULL) {
  250. // combo_box->Set_Curr_Sel (VehicleGameObj::Is_Target_Steering ());
  251. // }
  252. //
  253. // Configure the check boxes
  254. //
  255. Check_Dlg_Button (IDC_INVERT_MOUSE_CHECK, Input::Get_Mouse_Invert ());
  256. Check_Dlg_Button (IDC_INVERT_CURSOR_TARGETTING_CHECK, Input::Get_Mouse_2D_Invert ());
  257. Check_Dlg_Button (IDC_LOCK_CAMERA_TO_TURRET_CHECK, cUserOptions::CameraLockedToTurret.Get());
  258. return ;
  259. }
  260. ////////////////////////////////////////////////////////////////
  261. //
  262. // On_Reload
  263. //
  264. ////////////////////////////////////////////////////////////////
  265. void
  266. ControlsLookTabClass::On_Reload (void)
  267. {
  268. ControlsListTabClass::On_Reload ();
  269. Load_Controls ();
  270. return ;
  271. }
  272. ////////////////////////////////////////////////////////////////
  273. //
  274. // ControlsMultiPlayTabClass
  275. //
  276. ////////////////////////////////////////////////////////////////
  277. ControlsMultiPlayTabClass::ControlsMultiPlayTabClass (void) :
  278. ControlsListTabClass (IDD_CONTROLS_MULTIPLAYER_TAB)
  279. {
  280. Add_Function (INPUT_FUNCTION_BEGIN_PUBLIC_MESSAGE, IDC_HOTKEY1, IDC_HOTKEY13);
  281. Add_Function (INPUT_FUNCTION_BEGIN_TEAM_MESSAGE, IDC_HOTKEY2, IDC_HOTKEY14);
  282. Add_Function (INPUT_FUNCTION_TEAM_INFO_TOGGLE, IDC_HOTKEY3, IDC_HOTKEY15);
  283. Add_Function (INPUT_FUNCTION_BATTLE_INFO_TOGGLE, IDC_HOTKEY4, IDC_HOTKEY16);
  284. Add_Function (INPUT_FUNCTION_EVA_OBJECTIVES_SCREEN, IDC_HOTKEY5, IDC_HOTKEY17);
  285. Add_Function (INPUT_FUNCTION_EVA_MAP_SCREEN, IDC_HOTKEY6, IDC_HOTKEY18);
  286. return ;
  287. }