dlgmultiplayoptions.cpp 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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/dlgmultiplayoptions.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 1/31/02 6:50p $*
  29. * *
  30. * $Revision:: 18 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "dlgmultiplayoptions.h"
  36. #include "useroptions.h"
  37. #include "vector3.h"
  38. #include "listctrl.h"
  39. #include "checkboxctrl.h"
  40. #include "dialogresource.h"
  41. #include "cnetwork.h"
  42. #include "gamemode.h"
  43. #include "netinterface.h"
  44. #include "mpsettingsmgr.h"
  45. #include "registry.h"
  46. #include "_globals.h"
  47. #include "natter.h"
  48. #include "WOLLogonMgr.h"
  49. ////////////////////////////////////////////////////////////////
  50. //
  51. // MultiplayOptionsMenuClass
  52. //
  53. ////////////////////////////////////////////////////////////////
  54. MultiplayOptionsMenuClass::MultiplayOptionsMenuClass (void) :
  55. MenuDialogClass (IDD_MULTIPLAY_OPTIONS)
  56. {
  57. return ;
  58. }
  59. ////////////////////////////////////////////////////////////////
  60. //
  61. // On_Init_Dialog
  62. //
  63. ////////////////////////////////////////////////////////////////
  64. void
  65. MultiplayOptionsMenuClass::On_Init_Dialog (void)
  66. {
  67. //
  68. // Configure the checkboxes
  69. //
  70. Check_Dlg_Button (IDC_DISPLAY_PLAYER_NAMES_CHECK, cUserOptions::ShowNamesOnSoldier.Is_True ());
  71. //
  72. // Configure the internet options
  73. //
  74. Check_Dlg_Button (IDC_ALLOW_PAGES_CHECK, MPSettingsMgrClass::Get_Option_Flag (MPSettingsMgrClass::OPTION_ALLOW_PAGES));
  75. Check_Dlg_Button (IDC_LANGUAGE_FILTER_CHECK, MPSettingsMgrClass::Get_Option_Flag (MPSettingsMgrClass::OPTION_LANGUAGE_FILTER));
  76. Check_Dlg_Button (IDC_ALLOW_FIND_CHECK, MPSettingsMgrClass::Get_Option_Flag (MPSettingsMgrClass::OPTION_ALLOW_FIND));
  77. Check_Dlg_Button (IDC_DISPLAY_ASIAN_CHECK, MPSettingsMgrClass::Get_Option_Flag (MPSettingsMgrClass::OPTION_DISPLAY_ASIAN));
  78. Check_Dlg_Button (IDC_DISPLAY_NONASIAN_CHECK, MPSettingsMgrClass::Get_Option_Flag (MPSettingsMgrClass::OPTION_DISPLAY_NONASIAN));
  79. Check_Dlg_Button (IDC_SHOW_BUDDIES_CHAT_CHECK, MPSettingsMgrClass::Get_Option_Flag (MPSettingsMgrClass::OPTION_BUDDY_CHAT_ONLY));
  80. Check_Dlg_Button (IDC_SHOW_CLAN_CHAT_CHECK, MPSettingsMgrClass::Get_Option_Flag (MPSettingsMgrClass::OPTION_CLAN_CHAT_ONLY));
  81. //
  82. // Get the firewall options
  83. //
  84. bool is_send_delay = false;
  85. int port_number = 0;
  86. WOLNATInterface.Get_Config(NULL, port_number, is_send_delay);
  87. //
  88. // Configure the firewall options
  89. //
  90. Check_Dlg_Button (IDC_SEND_DELAY_CHECK, is_send_delay);
  91. Set_Dlg_Item_Int (IDC_PORT_EDIT, port_number);
  92. MenuDialogClass::On_Init_Dialog ();
  93. return ;
  94. }
  95. ////////////////////////////////////////////////////////////////
  96. //
  97. // On_Command
  98. //
  99. ////////////////////////////////////////////////////////////////
  100. void
  101. MultiplayOptionsMenuClass::On_Command (int ctrl_id, int message_id, DWORD param)
  102. {
  103. switch (ctrl_id) {
  104. case IDCANCEL:
  105. case IDC_MENU_BACK_BUTTON:
  106. Save_Settings();
  107. break;
  108. case IDC_DISPLAY_ASIAN_CHECK: {
  109. bool latinChecked = Is_Dlg_Button_Checked(IDC_DISPLAY_NONASIAN_CHECK);
  110. // If filtering asian text then latin text cannot be filtered too.
  111. if (param == 0 && !latinChecked) {
  112. Check_Dlg_Button(IDC_DISPLAY_NONASIAN_CHECK, true);
  113. }
  114. break;
  115. }
  116. case IDC_DISPLAY_NONASIAN_CHECK: {
  117. bool asianChecked = Is_Dlg_Button_Checked(IDC_DISPLAY_ASIAN_CHECK);
  118. // If filtering latin text then asian text cannot be filtered too.
  119. if (param == 0 && !asianChecked) {
  120. Check_Dlg_Button(IDC_DISPLAY_ASIAN_CHECK, true);
  121. }
  122. break;
  123. }
  124. }
  125. MenuDialogClass::On_Command (ctrl_id, message_id, param);
  126. return ;
  127. }
  128. ////////////////////////////////////////////////////////////////
  129. //
  130. // Save_Settings
  131. //
  132. ////////////////////////////////////////////////////////////////
  133. void
  134. MultiplayOptionsMenuClass::Save_Settings (void)
  135. {
  136. cUserOptions::ShowNamesOnSoldier.Set (((CheckBoxCtrlClass *)Get_Dlg_Item (IDC_DISPLAY_PLAYER_NAMES_CHECK))->Get_Check ());
  137. //
  138. // Configure the multiplayer options
  139. //
  140. MPSettingsMgrClass::Set_Option_Flag (MPSettingsMgrClass::OPTION_ALLOW_PAGES, Is_Dlg_Button_Checked (IDC_ALLOW_PAGES_CHECK));
  141. MPSettingsMgrClass::Set_Option_Flag (MPSettingsMgrClass::OPTION_LANGUAGE_FILTER, Is_Dlg_Button_Checked (IDC_LANGUAGE_FILTER_CHECK));
  142. MPSettingsMgrClass::Set_Option_Flag (MPSettingsMgrClass::OPTION_ALLOW_FIND, Is_Dlg_Button_Checked (IDC_ALLOW_FIND_CHECK));
  143. MPSettingsMgrClass::Set_Option_Flag (MPSettingsMgrClass::OPTION_DISPLAY_ASIAN, Is_Dlg_Button_Checked (IDC_DISPLAY_ASIAN_CHECK));
  144. MPSettingsMgrClass::Set_Option_Flag (MPSettingsMgrClass::OPTION_DISPLAY_NONASIAN, Is_Dlg_Button_Checked (IDC_DISPLAY_NONASIAN_CHECK));
  145. MPSettingsMgrClass::Set_Option_Flag (MPSettingsMgrClass::OPTION_BUDDY_CHAT_ONLY, Is_Dlg_Button_Checked (IDC_SHOW_BUDDIES_CHAT_CHECK));
  146. MPSettingsMgrClass::Set_Option_Flag (MPSettingsMgrClass::OPTION_CLAN_CHAT_ONLY, Is_Dlg_Button_Checked (IDC_SHOW_CLAN_CHAT_CHECK));
  147. WOLLogonMgr::ConfigureSession();
  148. //
  149. // Apply the firewall options
  150. //
  151. bool is_send_delay = Is_Dlg_Button_Checked (IDC_SEND_DELAY_CHECK);
  152. int port_number = Get_Dlg_Item_Int (IDC_PORT_EDIT);
  153. WOLNATInterface.Set_Config(NULL, port_number, is_send_delay);
  154. return ;
  155. }