dialogtests.cpp 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883
  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/dialogtests.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 3/18/02 2:52p $*
  29. * *
  30. * $Revision:: 96 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "dialogtests.h"
  36. #include "dialogresource.h"
  37. #include "dialogcontrol.h"
  38. #include "tabctrl.h"
  39. #include "combatchunkid.h"
  40. #include "basecontroller.h"
  41. #include "building.h"
  42. #include "resource.h"
  43. #include "combat.h"
  44. #include "soldier.h"
  45. #include "playertype.h"
  46. #include "definition.h"
  47. #include "definitionmgr.h"
  48. #include "vendor.h"
  49. #include "assetmgr.h"
  50. #include "rendobj.h"
  51. #include "scene.h"
  52. #include "menubackdrop.h"
  53. #include "hanim.h"
  54. #include "gamedata.h"
  55. #include "gametype.h"
  56. #include "checkboxctrl.h"
  57. #include "editctrl.h"
  58. #include "comboboxctrl.h"
  59. #include "gdcnc.h"
  60. #include "useroptions.h"
  61. #include "cnetwork.h"
  62. #include "listctrl.h"
  63. #include "gamechannel.h"
  64. #include "gamechanlist.h"
  65. #include "gamemode.h"
  66. #include "wolgmode.h"
  67. #include "langmode.h"
  68. #include "dlgcontrolslisttab.h"
  69. #include "campaign.h"
  70. #include "gameinitmgr.h"
  71. #include "dialogmgr.h"
  72. #include "god.h"
  73. #include "shortcutbarctrl.h"
  74. #include "treectrl.h"
  75. #include "wheelvehicle.h"
  76. #include "trackedvehicle.h"
  77. #include "useroptions.h"
  78. #include "DlgMPConnect.h"
  79. #include "translatedb.h"
  80. #include "string_ids.h"
  81. #include "dlgcharacteroptions.h"
  82. #include "dlgmultiplayoptions.h"
  83. #include "WWAudio.h"
  84. #include "dlgmplanhostoptions.h"
  85. #include "shellapi.h"
  86. #include "gamespyadmin.h"
  87. #include "dlgmpwolmain.h"
  88. #include "specialbuilds.h"
  89. #include "gamespy_qnr.h"
  90. #include <WWUI\ImageCtrl.h>
  91. #include "bandwidthcheck.h"
  92. ////////////////////////////////////////////////////////////////
  93. // Static member initialization
  94. ////////////////////////////////////////////////////////////////
  95. QuitVerificationDialogClass * QuitVerificationDialogClass::_TheInstance = NULL;
  96. bool SplashIntroMenuDialogClass::IsComplete = false;
  97. ////////////////////////////////////////////////////////////////
  98. //
  99. // SplashIntroMenuDialogClass
  100. //
  101. ////////////////////////////////////////////////////////////////
  102. SplashIntroMenuDialogClass::SplashIntroMenuDialogClass (void) :
  103. // Timer (4.0F),
  104. Timer (0.0F),
  105. MenuDialogClass (IDD_MENU_SPLASH1)
  106. {
  107. return ;
  108. }
  109. ////////////////////////////////////////////////////////////////
  110. //
  111. // ~SplashIntroMenuDialogClass
  112. //
  113. ////////////////////////////////////////////////////////////////
  114. SplashIntroMenuDialogClass::~SplashIntroMenuDialogClass (void)
  115. {
  116. return ;
  117. }
  118. ////////////////////////////////////////////////////////////////
  119. //
  120. // On_Init_Dialog
  121. //
  122. ////////////////////////////////////////////////////////////////
  123. void
  124. SplashIntroMenuDialogClass::On_Init_Dialog (void)
  125. {
  126. MenuDialogClass::On_Init_Dialog ();
  127. int count = cUserOptions::SplashCount.Get();
  128. if (count == 0) {
  129. Timer = 4.0F;
  130. } else {
  131. Timer = 0.0001F;
  132. }
  133. cUserOptions::SplashCount.Set(count+1);
  134. //
  135. // Configure the image
  136. //
  137. if (Get_Dlg_Item (IDC_IMAGE_CTRL) != NULL) {
  138. ((ImageCtrlClass*)Get_Dlg_Item (IDC_IMAGE_CTRL))->Set_Texture ("multisplash01.tga");
  139. }
  140. return ;
  141. }
  142. ////////////////////////////////////////////////////////////////
  143. //
  144. // On_Frame_Update
  145. //
  146. ////////////////////////////////////////////////////////////////
  147. void
  148. SplashIntroMenuDialogClass::On_Frame_Update (void)
  149. {
  150. MenuDialogClass::On_Frame_Update ();
  151. //
  152. // Check to see if time has elapsed
  153. //
  154. if (Timer > 0) {
  155. Timer -= TimeManager::Get_Frame_Seconds ();
  156. if (Timer <= 0) {
  157. //
  158. // Time has elapsed, so move onto the main menu dialog
  159. //
  160. RenegadeDialogMgrClass::Goto_Location (RenegadeDialogMgrClass::LOC_MAIN_MENU);
  161. End_Dialog ();
  162. IsComplete = true;
  163. }
  164. }
  165. return ;
  166. }
  167. ////////////////////////////////////////////////////////////////
  168. //
  169. // On_Command
  170. //
  171. ////////////////////////////////////////////////////////////////
  172. void
  173. SplashIntroMenuDialogClass::On_Command (int ctrl_id, int mesage_id, DWORD param)
  174. {
  175. return ;
  176. }
  177. ////////////////////////////////////////////////////////////////
  178. //
  179. // SplashOutroMenuDialogClass
  180. //
  181. ////////////////////////////////////////////////////////////////
  182. SplashOutroMenuDialogClass::SplashOutroMenuDialogClass (void) :
  183. Timer (5.0F),
  184. MenuDialogClass (IDD_MENU_SPLASH2)
  185. {
  186. return ;
  187. }
  188. ////////////////////////////////////////////////////////////////
  189. //
  190. // ~SplashOutroMenuDialogClass
  191. //
  192. ////////////////////////////////////////////////////////////////
  193. SplashOutroMenuDialogClass::~SplashOutroMenuDialogClass (void)
  194. {
  195. return ;
  196. }
  197. ////////////////////////////////////////////////////////////////
  198. //
  199. // On_Init_Dialog
  200. //
  201. ////////////////////////////////////////////////////////////////
  202. void
  203. SplashOutroMenuDialogClass::On_Init_Dialog (void)
  204. {
  205. MenuDialogClass::Get_BackDrop ()->Remove_Model ();
  206. MenuDialogClass::On_Init_Dialog ();
  207. //
  208. // Configure the image
  209. //
  210. if (Get_Dlg_Item (IDC_IMAGE_CTRL) != NULL) {
  211. ((ImageCtrlClass*)Get_Dlg_Item (IDC_IMAGE_CTRL))->Set_Texture ("multisplash02.tga");
  212. }
  213. return ;
  214. }
  215. ////////////////////////////////////////////////////////////////
  216. //
  217. // On_Frame_Update
  218. //
  219. ////////////////////////////////////////////////////////////////
  220. void
  221. SplashOutroMenuDialogClass::On_Frame_Update (void)
  222. {
  223. MenuDialogClass::On_Frame_Update ();
  224. //
  225. // Check to see if time has elapsed
  226. //
  227. /*if (Timer > 0) {
  228. Timer -= TimeManager::Get_Frame_Seconds ();
  229. if (Timer <= 0) {
  230. //
  231. // Time has elapsed, so exit the game...
  232. //
  233. extern void Stop_Main_Loop (int);
  234. Stop_Main_Loop (EXIT_SUCCESS);
  235. }
  236. }*/
  237. return ;
  238. }
  239. extern void Stop_Main_Loop (int);
  240. ////////////////////////////////////////////////////////////////
  241. //
  242. // On_Command
  243. //
  244. ////////////////////////////////////////////////////////////////
  245. void
  246. SplashOutroMenuDialogClass::On_Command (int ctrl_id, int mesage_id, DWORD param)
  247. {
  248. switch (ctrl_id)
  249. {
  250. case IDC_BUY_RENEGADE:
  251. ::ShellExecute (NULL, "open", "http://www.ea.com/storeEntry.jsp?sDestinationURL=DETAIL&sSku=14180W&sEntryPoint=EXPSITE", NULL, NULL, SW_SHOW);
  252. Stop_Main_Loop (EXIT_SUCCESS);
  253. break;
  254. case IDC_VISIT_WEB_BUTTON:
  255. ::ShellExecute (NULL, "open", "http://www.westwood.com/games/ccuniverse/renegade", NULL, NULL, SW_SHOW);
  256. Stop_Main_Loop (EXIT_SUCCESS);
  257. break;
  258. case IDC_EXIT_BUTTON:
  259. Stop_Main_Loop (EXIT_SUCCESS);
  260. break;
  261. }
  262. return ;
  263. }
  264. ////////////////////////////////////////////////////////////////
  265. //
  266. // QuitVerificationDialogClass
  267. //
  268. ////////////////////////////////////////////////////////////////
  269. QuitVerificationDialogClass::QuitVerificationDialogClass (void) :
  270. PopupDialogClass (IDD_QUIT_TO_DESKTOP)
  271. {
  272. _TheInstance = this;
  273. //
  274. // TSS092501
  275. //
  276. if (cUserOptions::SkipQuitConfirmDialog.Is_True())
  277. {
  278. extern void Stop_Main_Loop (int);
  279. Stop_Main_Loop(EXIT_SUCCESS);
  280. }
  281. return ;
  282. }
  283. ////////////////////////////////////////////////////////////////
  284. //
  285. // QuitVerificationDialogClass
  286. //
  287. ////////////////////////////////////////////////////////////////
  288. QuitVerificationDialogClass::~QuitVerificationDialogClass (void)
  289. {
  290. _TheInstance = NULL;
  291. return ;
  292. }
  293. //GAMESPY
  294. ////////////////////////////////////////////////////////////////
  295. // Static member initialization
  296. ////////////////////////////////////////////////////////////////
  297. GameSpyMainDialogClass * GameSpyMainDialogClass::_TheInstance = NULL;
  298. bool GameSpyMainDialogClass::DetectingBandwidth = false;
  299. ////////////////////////////////////////////////////////////////
  300. //
  301. // On_Frame_Update
  302. //
  303. ////////////////////////////////////////////////////////////////
  304. void
  305. GameSpyMainDialogClass::On_Frame_Update (void)
  306. {
  307. Enable_Dlg_Item(IDC_MENU_GAMESPY_HOST, !BandwidthCheckerClass::Is_Thread_Running());
  308. MenuDialogClass::On_Frame_Update ();
  309. return ;
  310. }
  311. ////////////////////////////////////////////////////////////////
  312. //
  313. // GameSpyMainDialogClass
  314. //
  315. ////////////////////////////////////////////////////////////////
  316. GameSpyMainDialogClass::GameSpyMainDialogClass (void) :
  317. MenuDialogClass (IDD_MENU_GAMESPY_MAIN)
  318. {
  319. _TheInstance = this;
  320. cGameSpyAdmin::Reset();
  321. cGameSpyAdmin::Set_Is_Under_Gamespy_Menuing(true);
  322. return ;
  323. }
  324. ////////////////////////////////////////////////////////////////
  325. //
  326. // ~GameSpyMainDialogClass
  327. //
  328. ////////////////////////////////////////////////////////////////
  329. GameSpyMainDialogClass::~GameSpyMainDialogClass (void)
  330. {
  331. _TheInstance = NULL;
  332. cGameSpyAdmin::Set_Is_Under_Gamespy_Menuing(false);
  333. return ;
  334. }
  335. ////////////////////////////////////////////////////////////////
  336. //
  337. // On_Init_Dialog
  338. //
  339. ////////////////////////////////////////////////////////////////
  340. void
  341. GameSpyMainDialogClass::On_Init_Dialog (void)
  342. {
  343. MenuDialogClass::On_Init_Dialog ();
  344. //
  345. // Init the gamespy logo
  346. //
  347. if (Get_Dlg_Item(IDC_GAMESPY_ICON) != NULL) {
  348. ((ImageCtrlClass*)Get_Dlg_Item(IDC_GAMESPY_ICON))->Set_Texture("GAMESPYLOGO.TGA");
  349. }
  350. }
  351. ////////////////////////////////////////////////////////////////
  352. //
  353. // On_Last_Menu_Ending
  354. //
  355. ////////////////////////////////////////////////////////////////
  356. void
  357. GameSpyMainDialogClass::On_Last_Menu_Ending (void)
  358. {
  359. RenegadeDialogMgrClass::Goto_Location (RenegadeDialogMgrClass::LOC_MAIN_MENU);
  360. return ;
  361. }
  362. /******************************************************************************
  363. *
  364. * NAME
  365. * DlgWOLSettings::HandleNotification(DlgWOLWaitEvent)
  366. *
  367. * DESCRIPTION
  368. *
  369. * INPUTS
  370. *
  371. * RESULT
  372. * NONE
  373. *
  374. ******************************************************************************/
  375. void GameSpyMainDialogClass::HandleNotification(DlgWOLWaitEvent& event)
  376. {
  377. if (WaitCondition::ConditionMet == event.Result())
  378. {
  379. if (DetectingBandwidth) {
  380. DetectingBandwidth = false;
  381. cUserOptions::Set_Bandwidth_Type(BANDWIDTH_AUTO);
  382. Release_Ref();
  383. Host_Game();
  384. }
  385. } else if (WaitCondition::Waiting != event.Result()) {
  386. DetectingBandwidth = false;
  387. Release_Ref();
  388. }
  389. }
  390. ////////////////////////////////////////////////////////////////
  391. //
  392. // On_Command
  393. //
  394. ////////////////////////////////////////////////////////////////
  395. void
  396. GameSpyMainDialogClass::On_Command (int ctrl_id, int mesage_id, DWORD param)
  397. {
  398. switch (ctrl_id)
  399. {
  400. case IDC_MENU_GAMESPY_JOIN:
  401. {
  402. GameSpyQnR.LaunchArcade();
  403. extern void Stop_Main_Loop (int);
  404. Stop_Main_Loop(EXIT_SUCCESS);
  405. break;
  406. }
  407. case IDC_MENU_GAMESPY_HOST:
  408. {
  409. if (!DetectingBandwidth) {
  410. RefPtr<SerialWait> serverWait = SerialWait::Create();
  411. WWASSERT(serverWait.IsValid());
  412. DetectingBandwidth = true;
  413. Add_Ref();
  414. RefPtr<WaitCondition> bandwidth_wait = BandwidthCheckerClass::Detect();
  415. DlgWOLWait::DoDialog(TRANSLATE (IDS_MENU_DETECTING_BANDWIDTH), bandwidth_wait, this);
  416. }
  417. }
  418. break;
  419. case IDC_MENU_GAMESPY_OPTIONS:
  420. START_DIALOG (GameSpyOptionsDialogClass);
  421. break;
  422. }
  423. MenuDialogClass::On_Command (ctrl_id, mesage_id, param);
  424. return ;
  425. }
  426. ////////////////////////////////////////////////////////////////
  427. // Static member initialization
  428. ////////////////////////////////////////////////////////////////
  429. void GameSpyMainDialogClass::Host_Game(void) {
  430. GameInitMgrClass::Initialize_LAN();
  431. /*
  432. //
  433. // Set the new nickname
  434. //
  435. WideStringClass nickname = Get_Dlg_Item_Text (IDC_NICKNAME_EDIT);
  436. cNetInterface::Set_Nickname (nickname);
  437. */
  438. //
  439. // Enable GameSpy Code
  440. //
  441. cGameSpyAdmin::Set_Is_Server_Gamespy_Listed(true);
  442. GameSpyQnR.Enable_Reporting(TRUE);
  443. //
  444. // Create the new game data
  445. //
  446. PTheGameData = cGameData::Create_Game_Of_Type (cGameData::GAME_TYPE_CNC);
  447. WWASSERT(PTheGameData != NULL);
  448. The_Game()->Load_From_Server_Config ();
  449. //
  450. // Gamespy games are not quickmatchable
  451. //
  452. The_Game()->Set_QuickMatch_Server(false);
  453. /*
  454. //
  455. // Gamespy games are not passwordable
  456. //
  457. The_Game()->IsPassworded.Set(false);
  458. The_Game()->Set_Password(L"");
  459. */
  460. START_DIALOG (MPLanHostOptionsMenuClass);
  461. }
  462. ////////////////////////////////////////////////////////////////
  463. // Static member initialization
  464. ////////////////////////////////////////////////////////////////
  465. GameSpyOptionsDialogClass * GameSpyOptionsDialogClass::_TheInstance = NULL;
  466. ////////////////////////////////////////////////////////////////
  467. //
  468. // GameSpyOptionsDialogClass
  469. //
  470. ////////////////////////////////////////////////////////////////
  471. GameSpyOptionsDialogClass::GameSpyOptionsDialogClass (void) :
  472. MenuDialogClass (IDD_MENU_GAMESPY_OPTIONS)
  473. {
  474. _TheInstance = this;
  475. return ;
  476. }
  477. ////////////////////////////////////////////////////////////////
  478. //
  479. // ~GameSpyOptionsDialogClass
  480. //
  481. ////////////////////////////////////////////////////////////////
  482. GameSpyOptionsDialogClass::~GameSpyOptionsDialogClass (void)
  483. {
  484. _TheInstance = NULL;
  485. return ;
  486. }
  487. ////////////////////////////////////////////////////////////////
  488. //
  489. // On_Init_Dialog
  490. //
  491. ////////////////////////////////////////////////////////////////
  492. void
  493. GameSpyOptionsDialogClass::On_Init_Dialog (void)
  494. {
  495. // Init_Connection_Speed_Combo();
  496. //
  497. // Put the nickname into the nickname edit control
  498. //
  499. EditCtrlClass * name_edit = (EditCtrlClass *) Get_Dlg_Item(IDC_NICKNAME_EDIT);
  500. WWASSERT(name_edit != NULL);
  501. name_edit->Set_Text_Limit(30);
  502. name_edit->Set_Text(cNetInterface::Get_Nickname());
  503. // Initialize the GameSpy Game Port
  504. EditCtrlClass * port_edit = (EditCtrlClass *) Get_Dlg_Item(IDC_PORT_EDIT1);
  505. port_edit->Set_Text_Limit(5);
  506. port_edit->Set_Int(cUserOptions::GameSpyGamePort.Get());
  507. // Initialize the GameSpy Query Port
  508. EditCtrlClass * gsport_edit = (EditCtrlClass *) Get_Dlg_Item(IDC_PORT_EDIT2);
  509. gsport_edit->Set_Text_Limit(5);
  510. gsport_edit->Set_Int(cUserOptions::GameSpyQueryPort.Get());
  511. MenuDialogClass::On_Init_Dialog ();
  512. }
  513. ////////////////////////////////////////////////////////////////
  514. //
  515. // Init_Connection_Speed_Combo
  516. //
  517. ////////////////////////////////////////////////////////////////
  518. void GameSpyOptionsDialogClass::Init_Connection_Speed_Combo(void)
  519. {
  520. ComboBoxCtrlClass* connectCombo = (ComboBoxCtrlClass*)Get_Dlg_Item(IDC_CONNECTION_SPEED_COMBO);
  521. if (connectCombo) {
  522. connectCombo->Reset_Content();
  523. connectCombo->Add_String(TRANSLATE(IDS_MP_CONNECTION_288));
  524. connectCombo->Add_String(TRANSLATE(IDS_MP_CONNECTION_336));
  525. connectCombo->Add_String(TRANSLATE(IDS_MP_CONNECTION_56));
  526. connectCombo->Add_String(TRANSLATE(IDS_MP_CONNECTION_ISDN));
  527. connectCombo->Add_String(TRANSLATE(IDS_MP_CONNECTION_CABLE));
  528. connectCombo->Add_String(TRANSLATE(IDS_MP_CONNECTION_T1));
  529. //
  530. // Set the current selection
  531. //
  532. //connectCombo->Set_Curr_Sel(cUserOptions::Get_Bandwidth_Type() - BANDWIDTH_FIRST);
  533. connectCombo->Set_Curr_Sel(cUserOptions::GameSpyBandwidthType.Get() - BANDWIDTH_FIRST);
  534. connectCombo->Set_Dirty(true);
  535. }
  536. }
  537. /*
  538. ////////////////////////////////////////////////////////////////
  539. //
  540. // On_Last_Menu_Ending
  541. //
  542. ////////////////////////////////////////////////////////////////
  543. void
  544. GameSpyOptionsDialogClass::On_Last_Menu_Ending (void)
  545. {
  546. RenegadeDialogMgrClass::Goto_Location (RenegadeDialogMgrClass::LOC_GAMESPY_MAIN);
  547. return ;
  548. }
  549. */
  550. ////////////////////////////////////////////////////////////////
  551. //
  552. // On_Command
  553. //
  554. ////////////////////////////////////////////////////////////////
  555. void
  556. GameSpyOptionsDialogClass::On_Command (int ctrl_id, int mesage_id, DWORD param)
  557. {
  558. switch (ctrl_id)
  559. {
  560. case IDCANCEL:
  561. case IDOK:
  562. case IDC_MENU_BACK_BUTTON:
  563. {
  564. //
  565. // Save the settings
  566. //
  567. /* ComboBoxCtrlClass* connectCombo = (ComboBoxCtrlClass*)Get_Dlg_Item(IDC_CONNECTION_SPEED_COMBO);
  568. if (connectCombo != NULL) {
  569. int selection = connectCombo->Get_Curr_Sel();
  570. if (selection >= 0) {
  571. BANDWIDTH_TYPE_ENUM bandwidth =
  572. (BANDWIDTH_TYPE_ENUM)(selection + BANDWIDTH_FIRST);
  573. //cUserOptions::Set_Bandwidth_Type(bandwidth);
  574. cUserOptions::GameSpyBandwidthType.Set(bandwidth);
  575. }
  576. } */
  577. //
  578. // Set the new nickname
  579. //
  580. WideStringClass nickname = Get_Dlg_Item_Text(IDC_NICKNAME_EDIT);
  581. cNetInterface::Set_Nickname(nickname);
  582. //
  583. // Set the GameSpy Game Port
  584. //
  585. EditCtrlClass * port_edit = (EditCtrlClass *) Get_Dlg_Item(IDC_PORT_EDIT1);
  586. cUserOptions::GameSpyGamePort.Set(port_edit->Get_Int());
  587. //
  588. // Set the GameSpy Query Port
  589. //
  590. port_edit = (EditCtrlClass *) Get_Dlg_Item(IDC_PORT_EDIT2);
  591. cUserOptions::GameSpyQueryPort.Set(port_edit->Get_Int());
  592. break;
  593. }
  594. }
  595. MenuDialogClass::On_Command (ctrl_id, mesage_id, param);
  596. return ;
  597. }
  598. ////////////////////////////////////////////////////////////////
  599. // Static member initialization
  600. ////////////////////////////////////////////////////////////////
  601. InternetMainDialogClass * InternetMainDialogClass::_TheInstance = NULL;
  602. ////////////////////////////////////////////////////////////////
  603. //
  604. // InternetMainDialogClass
  605. //
  606. ////////////////////////////////////////////////////////////////
  607. InternetMainDialogClass::InternetMainDialogClass (void) :
  608. MenuDialogClass (IDD_MENU_MAIN_MULTIPLAY)
  609. {
  610. _TheInstance = this;
  611. return ;
  612. }
  613. ////////////////////////////////////////////////////////////////
  614. //
  615. // ~InternetMainDialogClass
  616. //
  617. ////////////////////////////////////////////////////////////////
  618. InternetMainDialogClass::~InternetMainDialogClass (void)
  619. {
  620. _TheInstance = NULL;
  621. return ;
  622. }
  623. /*
  624. ////////////////////////////////////////////////////////////////
  625. //
  626. // On_Last_Menu_Ending
  627. //
  628. ////////////////////////////////////////////////////////////////
  629. void
  630. InternetMainDialogClass::On_Last_Menu_Ending (void)
  631. {
  632. RenegadeDialogMgrClass::Goto_Location (RenegadeDialogMgrClass::LOC_MAIN_MENU);
  633. return ;
  634. }
  635. */
  636. ////////////////////////////////////////////////////////////////
  637. //
  638. // On_Init_Dialog
  639. //
  640. ////////////////////////////////////////////////////////////////
  641. void
  642. InternetMainDialogClass::On_Init_Dialog (void)
  643. {
  644. #ifdef MULTIPLAYERDEMO
  645. Get_Dlg_Item(IDC_MENU_MP_INTERNET_WOL)->Enable(false);
  646. #endif // MULTIPLAYERDEMO
  647. #ifdef BETACLIENT
  648. Get_Dlg_Item(IDC_MENU_MP_INTERNET_GAMESPY)->Enable(false);
  649. #endif // BETACLIENT
  650. MenuDialogClass::On_Init_Dialog ();
  651. }
  652. ////////////////////////////////////////////////////////////////
  653. //
  654. // On_Command
  655. //
  656. ////////////////////////////////////////////////////////////////
  657. void
  658. InternetMainDialogClass::On_Command (int ctrl_id, int mesage_id, DWORD param)
  659. {
  660. switch (ctrl_id)
  661. {
  662. case IDC_MENU_MP_INTERNET_WOL:
  663. {
  664. GameInitMgrClass::Initialize_WOL ();
  665. START_DIALOG (MPWolMainMenuClass);
  666. break;
  667. }
  668. case IDC_MENU_MP_INTERNET_GAMESPY:
  669. {
  670. START_DIALOG (GameSpyMainDialogClass);
  671. break;
  672. }
  673. }
  674. MenuDialogClass::On_Command (ctrl_id, mesage_id, param);
  675. return ;
  676. }
  677. ////////////////////////////////////////////////////////////////
  678. //
  679. // StartSPGameDialogClass
  680. //
  681. ////////////////////////////////////////////////////////////////
  682. StartSPGameDialogClass::StartSPGameDialogClass (void) :
  683. MenuDialogClass (IDD_MENU_START_SP)
  684. {
  685. return ;
  686. }
  687. ////////////////////////////////////////////////////////////////
  688. //
  689. // DifficultyMenuClass
  690. //
  691. ////////////////////////////////////////////////////////////////
  692. DifficultyMenuClass::DifficultyMenuClass (void) :
  693. CurrSel (-1),
  694. MenuDialogClass (IDD_MENU_DIFFICULTY)
  695. {
  696. return ;
  697. }
  698. ////////////////////////////////////////////////////////////////
  699. //
  700. // On_Init_Dialog
  701. //
  702. ////////////////////////////////////////////////////////////////
  703. void
  704. MPLanMenuClass::On_Init_Dialog (void)
  705. {
  706. GameInitMgrClass::Initialize_LAN ();
  707. DialogControlClass *edit_ctrl = Get_Dlg_Item (IDC_NICKNAME_EDIT);
  708. if (edit_ctrl != NULL) {
  709. //
  710. // Set the text of the nick name control
  711. //
  712. /*
  713. const char *nick_name = cNetInterface::Get_Nickname ();
  714. WideStringClass wide_nick_name;
  715. wide_nick_name.Convert_From (nick_name);
  716. edit_ctrl->Set_Text (wide_nick_name);
  717. */
  718. edit_ctrl->Set_Text (cNetInterface::Get_Nickname ());
  719. }
  720. //
  721. // Set the default focus
  722. //
  723. DialogMgrClass::Set_Focus (Get_Dlg_Item (IDC_MENU_MP_START_SERVER_BUTTON));
  724. MenuDialogClass::On_Init_Dialog ();
  725. return ;
  726. }
  727. ////////////////////////////////////////////////////////////////
  728. //
  729. // On_Command
  730. //
  731. ////////////////////////////////////////////////////////////////
  732. void
  733. MPLanMenuClass::On_Command (int ctrl_id, int mesage_id, DWORD param)
  734. {
  735. //
  736. // Shutdown the LAN interface (if necessary)
  737. //
  738. switch (ctrl_id)
  739. {
  740. case IDCANCEL:
  741. case IDC_MENU_BACK_BUTTON:
  742. {
  743. GameInitMgrClass::Shutdown ();
  744. break;
  745. }
  746. case IDC_MENU_MP_START_SERVER_BUTTON:
  747. case IDC_MENU_MP_JOIN_GAME_BUTTON:
  748. {
  749. DialogControlClass *edit_ctrl = Get_Dlg_Item (IDC_NICKNAME_EDIT);
  750. if (edit_ctrl != NULL) {
  751. //
  752. // Pass the nickname onto the network interface
  753. //
  754. WideStringClass wide_nick_name = edit_ctrl->Get_Text ();
  755. if (wide_nick_name.Get_Length () > 0) {
  756. cNetInterface::Set_Nickname(wide_nick_name);
  757. PLC->Save_Lan_Registry_Keys ();
  758. }
  759. }
  760. break;
  761. }
  762. }
  763. MenuDialogClass::On_Command (ctrl_id, mesage_id, param);
  764. return ;
  765. }
  766. ////////////////////////////////////////////////////////////////
  767. //
  768. // On_Destroy
  769. //
  770. ////////////////////////////////////////////////////////////////
  771. void
  772. MPLanMenuClass::On_Destroy (void)
  773. {
  774. MenuDialogClass::On_Destroy ();
  775. return ;
  776. }
  777. ////////////////////////////////////////////////////////////////
  778. //
  779. // On_Init_Dialog
  780. //
  781. ////////////////////////////////////////////////////////////////
  782. void
  783. MPMainMenuClass::On_Init_Dialog (void)
  784. {
  785. //cSingleData::Set_Is_Single_Player (false);
  786. cGameType::Set_Game_Type(GAMETYPE_NONE);
  787. MenuDialogClass::On_Init_Dialog ();
  788. return ;
  789. }
  790. ////////////////////////////////////////////////////////////////
  791. //
  792. // Add_Folders
  793. //
  794. ////////////////////////////////////////////////////////////////
  795. /*void
  796. Add_Folders (const char *path, TreeCtrlClass *tree_ctrl, TreeItemClass *parent_item)
  797. {
  798. WIN32_FIND_DATA find_info = { 0 };
  799. BOOL keep_going = TRUE;
  800. HANDLE file_find = NULL;
  801. StringClass full_path = path;
  802. full_path += "\\*.*";
  803. //
  804. // Build a list of all the maps we know about
  805. //
  806. for (file_find = ::FindFirstFile (full_path, &find_info);
  807. (file_find != INVALID_HANDLE_VALUE) && keep_going;
  808. keep_going = ::FindNextFile (file_find, &find_info))
  809. {
  810. //
  811. // Only do directories
  812. //
  813. if ((find_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
  814. if (find_info.cFileName[0] != '.') {
  815. WideStringClass display_name;
  816. display_name.Convert_From (find_info.cFileName);
  817. TreeItemClass *new_item = tree_ctrl->Insert_Item (display_name, TreeCtrlClass::ICON_FOLDER,
  818. TreeCtrlClass::ICON_FOLDER_OPEN, parent_item);
  819. new_item->Set_Needs_Children (true);
  820. }
  821. }
  822. }
  823. if (file_find != INVALID_HANDLE_VALUE) {
  824. ::FindClose (file_find);
  825. }
  826. //
  827. // Sort the immediate children...
  828. //
  829. tree_ctrl->Sort_Children_Alphabetically (parent_item);
  830. return ;
  831. }*/
  832. ////////////////////////////////////////////////////////////////
  833. //
  834. // On_Init_Dialog
  835. //
  836. ////////////////////////////////////////////////////////////////
  837. void
  838. StartSPGameDialogClass::On_Init_Dialog (void)
  839. {
  840. //TreeCtrlClass *tree_ctrl = (TreeCtrlClass *)Get_Dlg_Item (IDC_TREE_CTRL);
  841. //_level = 0;
  842. //Add_Folders ("c:", tree_ctrl, NULL);
  843. MenuDialogClass::On_Init_Dialog ();
  844. return ;
  845. }
  846. ////////////////////////////////////////////////////////////////
  847. //
  848. // On_TreeCtrl_Needs_Children
  849. //
  850. ////////////////////////////////////////////////////////////////
  851. /*void
  852. StartSPGameDialogClass::On_TreeCtrl_Needs_Children (TreeCtrlClass *tree_ctrl, int ctrl_id, TreeItemClass *parent_item)
  853. {
  854. if (parent_item == NULL) {
  855. return ;
  856. }
  857. WideStringClass full_path = parent_item->Get_Name ();
  858. TreeItemClass *curr_parent = parent_item;
  859. while ((curr_parent = curr_parent->Get_Parent ()) != NULL) {
  860. WideStringClass temp_path = curr_parent->Get_Name ();
  861. temp_path += L"\\";
  862. temp_path += full_path;
  863. full_path = temp_path;
  864. }
  865. WideStringClass temp_path = L"c:\\";
  866. temp_path += full_path;
  867. full_path = temp_path;
  868. StringClass ascii_full_path;
  869. full_path.Convert_To (ascii_full_path);
  870. Add_Folders (ascii_full_path, tree_ctrl, parent_item);
  871. parent_item->Set_Needs_Children (false);
  872. return ;
  873. }*/
  874. ////////////////////////////////////////////////////////////////
  875. //
  876. // On_Command
  877. //
  878. ////////////////////////////////////////////////////////////////
  879. void
  880. StartSPGameDialogClass::On_Command (int ctrl_id, int message_id, DWORD param)
  881. {
  882. //
  883. // Does the user wish to start the tutorial?
  884. ///
  885. if (ctrl_id == IDC_MENU_START_TUTORIAL_BUTTON) {
  886. const char *TUTORIAL_MAP_NAME = "M00_Tutorial.mix";
  887. #define TUTORIAL_LOAD_MENU_NUMBER 90
  888. //
  889. // Simply load the map
  890. //
  891. cGod::Reset_Inventory();
  892. CampaignManager::Reset();
  893. CampaignManager::Select_Backdrop_Number( TUTORIAL_LOAD_MENU_NUMBER );
  894. GameInitMgrClass::Initialize_SP ();
  895. GameInitMgrClass::Start_Game (TUTORIAL_MAP_NAME, -1, 0);
  896. } else {
  897. CampaignManager::Select_Backdrop_Number( 0 ); // Use default load number
  898. }
  899. MenuDialogClass::On_Command (ctrl_id, message_id, param);
  900. return ;
  901. }
  902. /*
  903. ////////////////////////////////////////////////////////////////
  904. //
  905. // On_Init_Dialog
  906. //
  907. ////////////////////////////////////////////////////////////////
  908. void
  909. MPServerStartMenuClass::On_Init_Dialog (void)
  910. {
  911. //
  912. // Enable or disable the controls
  913. //
  914. //Get_Dlg_Item (IDC_TEAM_STATIC)->Enable (The_Game ()->IsTeamChangingAllowed.Is_True () == false);
  915. //Get_Dlg_Item (IDC_TEAM_COMBO)->Enable (The_Game ()->IsTeamChangingAllowed.Is_True () == false);
  916. //
  917. // Configure the combobox
  918. //
  919. //ComboBoxCtrlClass *type_combo = (ComboBoxCtrlClass *)Get_Dlg_Item (IDC_TEAM_COMBO);
  920. //type_combo->Add_String (L"GDI");
  921. //type_combo->Add_String (L"NOD");
  922. //
  923. // Set the default focus
  924. //
  925. DialogMgrClass::Set_Focus (Get_Dlg_Item (IDC_MENU_MP_START_BUTTON));
  926. MenuDialogClass::On_Init_Dialog ();
  927. return ;
  928. }
  929. ////////////////////////////////////////////////////////////////
  930. //
  931. // Start_Game
  932. //
  933. ////////////////////////////////////////////////////////////////
  934. void
  935. MPServerStartMenuClass::Start_Game (void)
  936. {
  937. //
  938. // Read the player's team choice from the combo
  939. //
  940. //if (The_Game ()->IsTeamChangingAllowed.Is_True () == false) {
  941. // ComboBoxCtrlClass *type_combo = (ComboBoxCtrlClass *)Get_Dlg_Item (IDC_TEAM_COMBO);
  942. // if (type_combo->Get_Curr_Sel () == 0) {
  943. // cUserOptions::Set_Team_Choice (PLAYERTYPE_GDI);
  944. // } else {
  945. // cUserOptions::Set_Team_Choice (PLAYERTYPE_NOD);
  946. // }
  947. //}
  948. //
  949. // Check to ensure the settings are playable
  950. //
  951. if (The_Game ()->Is_Valid_Settings ()) {
  952. //
  953. // Handle a dedicated server (if necessary)
  954. //
  955. GameInitMgrClass::Set_Is_Client_Required (true);
  956. GameInitMgrClass::Set_Is_Server_Required (false);
  957. CampaignManager::Select_Backdrop_Number_By_MP_Type( The_Game()->Get_Game_Type() );
  958. //
  959. // Start the game!
  960. //
  961. GameInitMgrClass::Start_Game (The_Game ()->Get_Map_Name ());
  962. }
  963. return ;
  964. }
  965. ////////////////////////////////////////////////////////////////
  966. //
  967. // On_Command
  968. //
  969. ////////////////////////////////////////////////////////////////
  970. void
  971. MPServerStartMenuClass::On_Command (int ctrl_id, int message_id, DWORD param)
  972. {
  973. //if (ctrl_id == IDC_MP_PASSWORD_VALID_COMMAND) {
  974. // Start_Game ();
  975. //} else if (ctrl_id == IDC_MENU_MP_START_BUTTON) {
  976. //
  977. // //
  978. // // Prompt the user for the password (if necessary)
  979. // //
  980. // if (IsServer == false && The_Game ()->IsPassworded.Is_True ()) {
  981. // MPGamePasswordPopupClass *dialog = new MPGamePasswordPopupClass;
  982. // dialog->Notify_Dialog (this);
  983. // dialog->Start_Dialog ();
  984. // REF_PTR_RELEASE (dialog);
  985. // } else {
  986. //
  987. // //
  988. // // Otherwise, simply start the game
  989. // //
  990. // Start_Game ();
  991. // }
  992. //}
  993. //
  994. // TSS092501 force user to proceed pass this dialog, later on remove it properly
  995. //
  996. //if (ctrl_id == IDC_MENU_MP_START_BUTTON) {
  997. // Start_Game ();
  998. //}
  999. Start_Game();
  1000. MenuDialogClass::On_Command (ctrl_id, message_id, param);
  1001. return ;
  1002. }
  1003. */
  1004. ////////////////////////////////////////////////////////////////
  1005. //
  1006. // On_Init_Dialog
  1007. //
  1008. ////////////////////////////////////////////////////////////////
  1009. void
  1010. MPJoinMenuClass::On_Init_Dialog (void)
  1011. {
  1012. #if(1)
  1013. assert(!"NEW_WWONLINE: Denzil look here!");
  1014. #else
  1015. if (WolGameModeClass::PWolChat != NULL) {
  1016. WolGameModeClass::PWolChat->Go_To_GameList ();
  1017. }
  1018. #endif
  1019. //
  1020. // Get a pointer to the list control
  1021. //
  1022. ListCtrlClass *list_ctrl = (ListCtrlClass *)Get_Dlg_Item (IDC_GAME_LIST);
  1023. if (list_ctrl != NULL) {
  1024. //
  1025. // Configure the columns
  1026. //
  1027. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_TYPE), 0.4F, Vector3 (1, 1, 1));
  1028. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_HOST), 0.4F, Vector3 (1, 1, 1));
  1029. list_ctrl->Add_Column (TRANSLATE (IDS_MENU_PLAYERS), 0.2F, Vector3 (1, 1, 1));
  1030. Update_Game_List ();
  1031. }
  1032. MenuDialogClass::On_Init_Dialog ();
  1033. return ;
  1034. }
  1035. ////////////////////////////////////////////////////////////////
  1036. //
  1037. // On_Command
  1038. //
  1039. ////////////////////////////////////////////////////////////////
  1040. void
  1041. MPJoinMenuClass::On_Command (int ctrl_id, int message_id, DWORD param)
  1042. {
  1043. if (ctrl_id == IDC_MENU_MP_JOING_BUTTON) {
  1044. ListCtrlClass *list_ctrl = (ListCtrlClass *)Get_Dlg_Item (IDC_GAME_LIST);
  1045. int index = list_ctrl->Get_Curr_Sel ();
  1046. if (index >= 0) {
  1047. cGameChannel *channel = (cGameChannel *)list_ctrl->Get_Entry_Data (index, 0);
  1048. if (channel != NULL) {
  1049. if (PTheGameData != NULL) {
  1050. delete PTheGameData;
  1051. PTheGameData = NULL;
  1052. }
  1053. PTheGameData = cGameData::Create_Game_Of_Type (channel->Get_Game_Data()->Get_Game_Type());
  1054. WWASSERT(PTheGameData != NULL);
  1055. *PTheGameData = *channel->Get_Game_Data ();
  1056. cNetwork::Init_Client();
  1057. //
  1058. // Display the "connecting" dialog
  1059. //
  1060. DlgMPConnect::DoDialog(-1, 0);
  1061. }
  1062. }
  1063. }
  1064. MenuDialogClass::On_Command (ctrl_id, message_id, param);
  1065. return ;
  1066. }
  1067. ////////////////////////////////////////////////////////////////
  1068. //
  1069. // On_Frame_Update
  1070. //
  1071. ////////////////////////////////////////////////////////////////
  1072. void
  1073. MPJoinMenuClass::On_Frame_Update (void)
  1074. {
  1075. static int _LastUpdate = 0;
  1076. //
  1077. // Update the list every 5 seconds
  1078. //
  1079. int curr_time = WW3D::Get_Sync_Time ();
  1080. if ((curr_time - _LastUpdate) > 5000) {
  1081. Update_Game_List ();
  1082. _LastUpdate = curr_time;
  1083. }
  1084. MenuDialogClass::On_Frame_Update ();
  1085. return ;
  1086. }
  1087. ////////////////////////////////////////////////////////////////
  1088. //
  1089. // Update_Game_List
  1090. //
  1091. ////////////////////////////////////////////////////////////////
  1092. void
  1093. MPJoinMenuClass::Update_Game_List (void)
  1094. {
  1095. ListCtrlClass *list_ctrl = (ListCtrlClass *)Get_Dlg_Item (IDC_GAME_LIST);
  1096. if (list_ctrl == NULL) {
  1097. return ;
  1098. }
  1099. //
  1100. // Start fresh
  1101. //
  1102. list_ctrl->Delete_All_Entries ();
  1103. #if(1)
  1104. assert(!"NEW_WWONLINE: Denzil look here!");
  1105. #else
  1106. //
  1107. // Update the channel list
  1108. //
  1109. if (GameModeManager::Find("WOL")->Is_Active()) {
  1110. WolGameModeClass::PWolChat->My_Request_Channel_List(true);
  1111. }
  1112. #endif
  1113. //
  1114. // Build the game list
  1115. //
  1116. int index = 0;
  1117. SLNode<cGameChannel> * objnode;
  1118. for (objnode = cGameChannelList::Get_Chan_List()->Head(); objnode; objnode = objnode->Next()) {
  1119. cGameChannel * p_channel = objnode->Data();
  1120. WWASSERT(p_channel != NULL);
  1121. if (GameModeManager::Find("WOL")->Is_Active()) {
  1122. WWASSERT(p_channel->Get_Wol_Channel() != NULL);
  1123. p_channel->Get_Game_Data()->Set_Current_Players(p_channel->Get_Wol_Channel()->currentUsers);
  1124. }
  1125. int player_count = p_channel->Get_Game_Data()->Get_Current_Players ();
  1126. int player_count_max = p_channel->Get_Game_Data()->Get_Max_Players ();
  1127. WideStringClass wide_players_string;
  1128. wide_players_string.Format (L"%d/%d", player_count, player_count_max);
  1129. WideStringClass wide_owner_name;
  1130. WideStringClass wide_game_name;
  1131. //wide_owner_name.Convert_From (p_channel->Get_Game_Data()->Get_Owner ());
  1132. wide_owner_name = p_channel->Get_Game_Data()->Get_Owner ();
  1133. //wide_game_name.Convert_From (p_channel->Get_Game_Data()->Get_Game_Name ());
  1134. wide_game_name = p_channel->Get_Game_Data()->Get_Game_Name ();
  1135. //
  1136. // Insert the entry
  1137. //
  1138. int item_index = list_ctrl->Insert_Entry (index++, wide_game_name);
  1139. if (item_index >= 0) {
  1140. list_ctrl->Set_Entry_Text (item_index, 1, wide_owner_name);
  1141. list_ctrl->Set_Entry_Text (item_index, 2, wide_players_string);
  1142. list_ctrl->Set_Entry_Data (item_index, 0, (uint32)p_channel);
  1143. }
  1144. //
  1145. // Is there something wrong with the connection?
  1146. //
  1147. if (p_channel->Get_Game_Data()->Get_Version_Number() != cNetwork::Get_Exe_Key()) {
  1148. WideStringClass error_string;
  1149. if (p_channel->Get_Game_Data()->Do_Exe_Versions_Match() == false) {
  1150. error_string = TRANSLATE (IDS_MENU_EXE_MISMATCH);
  1151. } else if (p_channel->Get_Game_Data()->Do_String_Versions_Match() == false) {
  1152. error_string = TRANSLATE (IDS_MENU_STRINGS_MISMATCH);
  1153. }
  1154. //
  1155. // Notify the user that they can't join this game
  1156. //
  1157. if (item_index >= 0) {
  1158. list_ctrl->Set_Entry_Text (item_index, 0, error_string);
  1159. list_ctrl->Set_Entry_Color (item_index, 0, Vector3 (0.5F, 0.5F, 0.5F));
  1160. list_ctrl->Set_Entry_Color (item_index, 1, Vector3 (0.5F, 0.5F, 0.5F));
  1161. list_ctrl->Set_Entry_Color (item_index, 2, Vector3 (0.5F, 0.5F, 0.5F));
  1162. list_ctrl->Set_Entry_Data (item_index, 0, 0);
  1163. }
  1164. }
  1165. }
  1166. //
  1167. // Select the first entry by default
  1168. //
  1169. if (list_ctrl->Get_Entry_Count () > 0) {
  1170. list_ctrl->Set_Curr_Sel (0);
  1171. }
  1172. return ;
  1173. }
  1174. ////////////////////////////////////////////////////////////////
  1175. //
  1176. // On_Frame_Update
  1177. //
  1178. ////////////////////////////////////////////////////////////////
  1179. void
  1180. DifficultyMenuClass::On_Frame_Update (void)
  1181. {
  1182. int curr_sel = -1;
  1183. DialogControlClass *curr_focus = DialogMgrClass::Get_Focus ();
  1184. //
  1185. // Determine which control has the focus
  1186. //
  1187. if (curr_focus == Get_Dlg_Item (IDC_MENU_DIFFCULTY01_BUTTON)) {
  1188. curr_sel = 0;
  1189. } else if (curr_focus == Get_Dlg_Item (IDC_MENU_DIFFCULTY02_BUTTON)) {
  1190. curr_sel = 1;
  1191. } else if (curr_focus == Get_Dlg_Item (IDC_MENU_DIFFCULTY03_BUTTON)) {
  1192. curr_sel = 2;
  1193. }
  1194. //
  1195. // Did something change?
  1196. //
  1197. if (curr_sel != CurrSel) {
  1198. CurrSel = curr_sel;
  1199. if (CurrSel == -1) {
  1200. Set_Dlg_Item_Text (IDC_AIM_TEXT, TRANSLATE (IDS_MENU_NA));
  1201. Set_Dlg_Item_Text (IDC_PLAYER_HEALTH_TEXT, TRANSLATE (IDS_MENU_NA));
  1202. Set_Dlg_Item_Text (IDC_SUPPLIES_TEXT, TRANSLATE (IDS_MENU_NA));
  1203. Set_Dlg_Item_Text (IDC_REINFORCEMENTS_TEXT, TRANSLATE (IDS_MENU_NA));
  1204. Set_Dlg_Item_Text (IDC_BODY_ARMOR_TEXT, TRANSLATE (IDS_MENU_NA));
  1205. } else if (CurrSel == 0) {
  1206. Set_Dlg_Item_Text (IDC_AIM_TEXT, TRANSLATE (IDS_MENU_ON));
  1207. Set_Dlg_Item_Text (IDC_PLAYER_HEALTH_TEXT, TRANSLATE (IDS_MENU_MAXIMUM));
  1208. Set_Dlg_Item_Text (IDC_SUPPLIES_TEXT, TRANSLATE (IDS_MENU_PLENTIFUL));
  1209. Set_Dlg_Item_Text (IDC_REINFORCEMENTS_TEXT, TRANSLATE (IDS_MENU_FEW));
  1210. Set_Dlg_Item_Text (IDC_BODY_ARMOR_TEXT, TRANSLATE (IDS_MENU_LIGHT));
  1211. } else if (CurrSel == 1) {
  1212. Set_Dlg_Item_Text (IDC_AIM_TEXT, TRANSLATE (IDS_MENU_OFF));
  1213. Set_Dlg_Item_Text (IDC_PLAYER_HEALTH_TEXT, TRANSLATE (IDS_MENU_ENHANCED));
  1214. Set_Dlg_Item_Text (IDC_SUPPLIES_TEXT, TRANSLATE (IDS_MENU_SUFFICIENT));
  1215. Set_Dlg_Item_Text (IDC_REINFORCEMENTS_TEXT, TRANSLATE (IDS_MENU_MANY));
  1216. Set_Dlg_Item_Text (IDC_BODY_ARMOR_TEXT, TRANSLATE (IDS_MENU_STANDARD));
  1217. } else if (CurrSel == 2) {
  1218. Set_Dlg_Item_Text (IDC_AIM_TEXT, TRANSLATE (IDS_MENU_OFF));
  1219. Set_Dlg_Item_Text (IDC_PLAYER_HEALTH_TEXT, TRANSLATE (IDS_MENU_NORMAL));
  1220. Set_Dlg_Item_Text (IDC_SUPPLIES_TEXT, TRANSLATE (IDS_MENU_SCARCE));
  1221. Set_Dlg_Item_Text (IDC_REINFORCEMENTS_TEXT, TRANSLATE (IDS_MENU_MAXIMUM));
  1222. Set_Dlg_Item_Text (IDC_BODY_ARMOR_TEXT, TRANSLATE (IDS_MENU_HEAVY));
  1223. }
  1224. }
  1225. MenuDialogClass::On_Frame_Update ();
  1226. return ;
  1227. }
  1228. ////////////////////////////////////////////////////////////////
  1229. //
  1230. // On_Menu_Activate
  1231. //
  1232. ////////////////////////////////////////////////////////////////
  1233. void
  1234. DifficultyMenuClass::On_Menu_Activate (bool onoff)
  1235. {
  1236. MenuDialogClass::On_Menu_Activate (onoff);
  1237. return ;
  1238. }
  1239. ////////////////////////////////////////////////////////////////
  1240. //
  1241. // On_Command
  1242. //
  1243. ////////////////////////////////////////////////////////////////
  1244. void
  1245. DifficultyMenuClass::On_Command (int ctrl_id, int message_id, DWORD param)
  1246. {
  1247. switch (ctrl_id)
  1248. {
  1249. case IDC_MENU_DIFFCULTY01_BUTTON:
  1250. case IDC_MENU_DIFFCULTY02_BUTTON:
  1251. case IDC_MENU_DIFFCULTY03_BUTTON:
  1252. case IDC_MENU_DIFFCULTY04_BUTTON:
  1253. {
  1254. int difficulty = ctrl_id - IDC_MENU_DIFFCULTY01_BUTTON;
  1255. if ( ReplayFilename.Is_Empty() ) {
  1256. GameInitMgrClass::Initialize_SP();
  1257. CampaignManager::Start_Campaign( difficulty );
  1258. } else {
  1259. WWDEBUG_SAY(( "REPLAY %d\n", difficulty ));
  1260. //
  1261. // End the current game before we load the new one (CODE REMOVED FROM LOADSPGAME)
  1262. //
  1263. if (GameModeManager::Find ("Combat")->Is_Suspended ()) {
  1264. GameInitMgrClass::End_Game();
  1265. GameModeManager::Safely_Deactivate ();
  1266. }
  1267. GameInitMgrClass::Initialize_SP ();
  1268. CampaignManager::Replay_Level( ReplayFilename, difficulty );
  1269. }
  1270. break;
  1271. }
  1272. }
  1273. MenuDialogClass::On_Command (ctrl_id, message_id, param);
  1274. return ;
  1275. }
  1276. ////////////////////////////////////////////////////////////////
  1277. //
  1278. // On_Init_Dialog
  1279. //
  1280. ////////////////////////////////////////////////////////////////
  1281. void
  1282. DeathOptionsPopupClass::On_Init_Dialog ( void )
  1283. {
  1284. // IML: Ensure that there are no sound effects lingering on any playlist.
  1285. WWAudioClass::Get_Instance ()->Flush_Playlist();
  1286. PopupDialogClass::On_Init_Dialog ();
  1287. #if 01
  1288. //
  1289. // Activate the menu game mode (if necessary)
  1290. //
  1291. GameModeClass *menu_game_mode = GameModeManager::Find ("Menu");
  1292. if (menu_game_mode != NULL && menu_game_mode->Is_Active () == false) {
  1293. menu_game_mode->Activate ();
  1294. }
  1295. GameModeManager::Find ("Combat")->Suspend();
  1296. #endif
  1297. return ;
  1298. }
  1299. ////////////////////////////////////////////////////////////////
  1300. //
  1301. // On_Command
  1302. //
  1303. ////////////////////////////////////////////////////////////////
  1304. void
  1305. DeathOptionsPopupClass::On_Command (int ctrl_id, int message_id, DWORD param)
  1306. {
  1307. bool do_default = true;
  1308. switch (ctrl_id)
  1309. {
  1310. case IDCANCEL:
  1311. case IDC_DEATH_OPTION_QUIT:
  1312. GameInitMgrClass::Continue_Game();
  1313. GameInitMgrClass::End_Game ();
  1314. GameInitMgrClass::Display_End_Game_Menu ();
  1315. End_Dialog ();
  1316. do_default = false;
  1317. break;
  1318. case IDC_DEATH_OPTION_RESTART:
  1319. GameInitMgrClass::Continue_Game();
  1320. cGod::Restart();
  1321. End_Dialog();
  1322. break;
  1323. case IDC_DEATH_OPTION_LOAD:
  1324. GameInitMgrClass::Continue_Game();
  1325. cGod::Load_Game();
  1326. End_Dialog();
  1327. break;
  1328. }
  1329. if (do_default) {
  1330. PopupDialogClass::On_Command (ctrl_id, message_id, param);
  1331. }
  1332. return ;
  1333. }
  1334. ////////////////////////////////////////////////////////////////
  1335. //
  1336. // On_Init_Dialog
  1337. //
  1338. ////////////////////////////////////////////////////////////////
  1339. void
  1340. FailedOptionsPopupClass::On_Init_Dialog ( void )
  1341. {
  1342. // IML: Ensure that there are no sound effects lingering on any playlist.
  1343. WWAudioClass::Get_Instance ()->Flush_Playlist();
  1344. PopupDialogClass::On_Init_Dialog ();
  1345. #if 01
  1346. //
  1347. // Activate the menu game mode (if necessary)
  1348. //
  1349. GameModeClass *menu_game_mode = GameModeManager::Find ("Menu");
  1350. if (menu_game_mode != NULL && menu_game_mode->Is_Active () == false) {
  1351. menu_game_mode->Activate ();
  1352. }
  1353. GameModeManager::Find ("Combat")->Suspend();
  1354. #endif
  1355. return ;
  1356. }
  1357. ////////////////////////////////////////////////////////////////
  1358. //
  1359. // On_Command
  1360. //
  1361. ////////////////////////////////////////////////////////////////
  1362. void
  1363. FailedOptionsPopupClass::On_Command (int ctrl_id, int message_id, DWORD param)
  1364. {
  1365. bool allow_default_processing = true;
  1366. switch (ctrl_id)
  1367. {
  1368. case IDC_FAILED_OPTION_RESTART:
  1369. GameInitMgrClass::Continue_Game();
  1370. cGod::Restart();
  1371. End_Dialog();
  1372. break;
  1373. case IDC_FAILED_OPTION_LOAD:
  1374. GameInitMgrClass::Continue_Game();
  1375. cGod::Load_Game();
  1376. End_Dialog();
  1377. break;
  1378. case IDCANCEL:
  1379. allow_default_processing = false;
  1380. break;
  1381. case IDC_MENU_MAIN_MENU_BUTTON:
  1382. {
  1383. GameInitMgrClass::Continue_Game();
  1384. GameInitMgrClass::End_Game();
  1385. GameInitMgrClass::Display_End_Game_Menu();
  1386. //
  1387. // Close the dialog
  1388. //
  1389. End_Dialog ();
  1390. allow_default_processing = false;
  1391. break;
  1392. }
  1393. }
  1394. if (allow_default_processing) {
  1395. PopupDialogClass::On_Command (ctrl_id, message_id, param);
  1396. }
  1397. return ;
  1398. }
  1399. ////////////////////////////////////////////////////////////////
  1400. //
  1401. // EditWheeledVehicleDialogClass
  1402. //
  1403. ////////////////////////////////////////////////////////////////
  1404. EditWheeledVehicleDialogClass::EditWheeledVehicleDialogClass(WheeledVehicleDefClass * def,float wheel_radius) :
  1405. PopupDialogClass(IDD_EDIT_WHEELED_VEHICLE),
  1406. VehicleDef(def),
  1407. WheelRadius(wheel_radius)
  1408. {
  1409. }
  1410. EditWheeledVehicleDialogClass::~EditWheeledVehicleDialogClass(void)
  1411. {
  1412. }
  1413. void
  1414. EditWheeledVehicleDialogClass::On_Init_Dialog (void)
  1415. {
  1416. if (VehicleDef != NULL) {
  1417. Set_Dlg_Item_Float(IDC_MASS_EDIT,VehicleDef->Get_Mass());
  1418. Set_Dlg_Item_Float(IDC_GRAVSCALE_EDIT,VehicleDef->Get_Grav_Scale());
  1419. Set_Dlg_Item_Float(IDC_AERODRAG_EDIT,VehicleDef->Get_Aerodynamic_Drag());
  1420. Set_Dlg_Item_Float(IDC_SPRING_CONSTANT_EDIT,VehicleDef->Get_Spring_Constant());
  1421. Set_Dlg_Item_Float(IDC_DAMPING_CONSTANT_EDIT,VehicleDef->Get_Damping_Constant());
  1422. Set_Dlg_Item_Float(IDC_SPRING_LENGTH_EDIT,VehicleDef->Get_Spring_Length());
  1423. Set_Dlg_Item_Float(IDC_LATERAL_MOMENT_ARM_EDIT,VehicleDef->Get_Lateral_Moment_Arm());
  1424. Set_Dlg_Item_Float(IDC_TRACTIVE_MOMENT_ARM_EDIT,VehicleDef->Get_Tractive_Moment_Arm());
  1425. Set_Dlg_Item_Float(IDC_MAX_ENGINE_TORQUE_EDIT,VehicleDef->Get_Max_Engine_Torque());
  1426. Set_Dlg_Item_Int(IDC_GEAR_COUNT_EDIT, VehicleDef->Get_Gear_Count());
  1427. Set_Dlg_Item_Float(IDC_GEAR_RATIO1_EDIT, VehicleDef->Get_Gear_Ratio(0));
  1428. Set_Dlg_Item_Float(IDC_GEAR_RATIO2_EDIT, VehicleDef->Get_Gear_Ratio(1));
  1429. Set_Dlg_Item_Float(IDC_GEAR_RATIO3_EDIT, VehicleDef->Get_Gear_Ratio(2));
  1430. Set_Dlg_Item_Float(IDC_GEAR_RATIO4_EDIT, VehicleDef->Get_Gear_Ratio(3));
  1431. Set_Dlg_Item_Float(IDC_GEAR_RATIO5_EDIT, VehicleDef->Get_Gear_Ratio(4));
  1432. Set_Dlg_Item_Float(IDC_MAX_STEERING_ANGLE_EDIT, VehicleDef->Get_Max_Steering_Angle());
  1433. Set_Dlg_Item_Float(IDC_SHIFT_UP_RPM_EDIT, VehicleDef->Get_Shift_Up_Rpm());
  1434. Set_Dlg_Item_Float(IDC_SHIFT_DOWN_RPM_EDIT, VehicleDef->Get_Shift_Down_Rpm());
  1435. WideStringClass radius_text;
  1436. radius_text.Format(L"%10.4f",WheelRadius);
  1437. Set_Dlg_Item_Text(IDC_WHEEL_RADIUS,radius_text);
  1438. } else {
  1439. Set_Controls_Hidden(true);
  1440. /*
  1441. Enable_Dlg_Item(IDC_MASS_EDIT,false);
  1442. Enable_Dlg_Item(IDC_GRAVSCALE_EDIT,false);
  1443. Enable_Dlg_Item(IDC_AERODRAG_EDIT,false);
  1444. Enable_Dlg_Item(IDC_SPRING_CONSTANT_EDIT,false);
  1445. Enable_Dlg_Item(IDC_DAMPING_CONSTANT_EDIT,false);
  1446. Enable_Dlg_Item(IDC_SPRING_LENGTH_EDIT,false);
  1447. Enable_Dlg_Item(IDC_MAX_ENGINE_TORQUE_EDIT,false);
  1448. Enable_Dlg_Item(IDC_GEAR_COUNT_EDIT, false);
  1449. Enable_Dlg_Item(IDC_GEAR_RATIO1_EDIT, false);
  1450. Enable_Dlg_Item(IDC_GEAR_RATIO2_EDIT, false);
  1451. Enable_Dlg_Item(IDC_GEAR_RATIO3_EDIT, false);
  1452. Enable_Dlg_Item(IDC_GEAR_RATIO4_EDIT, false);
  1453. Enable_Dlg_Item(IDC_GEAR_RATIO5_EDIT, false);
  1454. Enable_Dlg_Item(IDC_MAX_STEERING_ANGLE_EDIT, false);
  1455. */
  1456. }
  1457. PopupDialogClass::On_Init_Dialog ();
  1458. }
  1459. void
  1460. EditWheeledVehicleDialogClass::On_Command (int ctrl_id, int message_id, DWORD param)
  1461. {
  1462. switch (ctrl_id)
  1463. {
  1464. case IDOK:
  1465. if (VehicleDef != NULL) {
  1466. VehicleDef->Set_Mass(Get_Dlg_Item_Float(IDC_MASS_EDIT));
  1467. VehicleDef->Set_Grav_Scale(Get_Dlg_Item_Float(IDC_GRAVSCALE_EDIT));
  1468. VehicleDef->Set_Aerodynamic_Drag(Get_Dlg_Item_Float(IDC_AERODRAG_EDIT));
  1469. VehicleDef->Set_Spring_Constant(Get_Dlg_Item_Float(IDC_SPRING_CONSTANT_EDIT));
  1470. VehicleDef->Set_Damping_Constant(Get_Dlg_Item_Float(IDC_DAMPING_CONSTANT_EDIT));
  1471. VehicleDef->Set_Spring_Length(Get_Dlg_Item_Float(IDC_SPRING_LENGTH_EDIT));
  1472. VehicleDef->Set_Lateral_Moment_Arm(Get_Dlg_Item_Float(IDC_LATERAL_MOMENT_ARM_EDIT));
  1473. VehicleDef->Set_Tractive_Moment_Arm(Get_Dlg_Item_Float(IDC_TRACTIVE_MOMENT_ARM_EDIT));
  1474. VehicleDef->Set_Max_Engine_Torque(Get_Dlg_Item_Float(IDC_MAX_ENGINE_TORQUE_EDIT));
  1475. VehicleDef->Set_Gear_Count(Get_Dlg_Item_Int(IDC_GEAR_COUNT_EDIT));
  1476. VehicleDef->Set_Gear_Ratio(0,Get_Dlg_Item_Float(IDC_GEAR_RATIO1_EDIT));
  1477. VehicleDef->Set_Gear_Ratio(1,Get_Dlg_Item_Float(IDC_GEAR_RATIO2_EDIT));
  1478. VehicleDef->Set_Gear_Ratio(2,Get_Dlg_Item_Float(IDC_GEAR_RATIO3_EDIT));
  1479. VehicleDef->Set_Gear_Ratio(3,Get_Dlg_Item_Float(IDC_GEAR_RATIO4_EDIT));
  1480. VehicleDef->Set_Gear_Ratio(4,Get_Dlg_Item_Float(IDC_GEAR_RATIO5_EDIT));
  1481. VehicleDef->Set_Max_Steering_Angle(Get_Dlg_Item_Float(IDC_MAX_STEERING_ANGLE_EDIT));
  1482. VehicleDef->Set_Shift_Up_Rpm(Get_Dlg_Item_Float(IDC_SHIFT_UP_RPM_EDIT));
  1483. VehicleDef->Set_Shift_Down_Rpm(Get_Dlg_Item_Float(IDC_SHIFT_DOWN_RPM_EDIT));
  1484. PhysicsSceneClass * pscene = PhysicsSceneClass::Get_Instance();
  1485. if (pscene) {
  1486. RefPhysListIterator iterator = pscene->Get_Dynamic_Object_Iterator();
  1487. while (!iterator.Is_Done()) {
  1488. if ( (iterator.Peek_Obj() != NULL) &&
  1489. (iterator.Peek_Obj()->Get_Definition() == VehicleDef))
  1490. {
  1491. iterator.Peek_Obj()->Definition_Changed();
  1492. }
  1493. iterator.Next();
  1494. }
  1495. }
  1496. }
  1497. End_Dialog();
  1498. break;
  1499. }
  1500. PopupDialogClass::On_Command (ctrl_id, message_id, param);
  1501. return ;
  1502. }
  1503. ////////////////////////////////////////////////////////////////
  1504. //
  1505. // EditTrackedVehicleDialogClass
  1506. //
  1507. ////////////////////////////////////////////////////////////////
  1508. EditTrackedVehicleDialogClass::EditTrackedVehicleDialogClass(TrackedVehicleDefClass * def,float wheel_radius) :
  1509. PopupDialogClass(IDD_EDIT_TRACKED_VEHICLE),
  1510. VehicleDef(def),
  1511. WheelRadius(wheel_radius)
  1512. {
  1513. }
  1514. EditTrackedVehicleDialogClass::~EditTrackedVehicleDialogClass(void)
  1515. {
  1516. }
  1517. void
  1518. EditTrackedVehicleDialogClass::On_Init_Dialog (void)
  1519. {
  1520. if (VehicleDef != NULL) {
  1521. Set_Dlg_Item_Float(IDC_MASS_EDIT,VehicleDef->Get_Mass());
  1522. Set_Dlg_Item_Float(IDC_GRAVSCALE_EDIT,VehicleDef->Get_Grav_Scale());
  1523. Set_Dlg_Item_Float(IDC_AERODRAG_EDIT,VehicleDef->Get_Aerodynamic_Drag());
  1524. Set_Dlg_Item_Float(IDC_SPRING_CONSTANT_EDIT,VehicleDef->Get_Spring_Constant());
  1525. Set_Dlg_Item_Float(IDC_DAMPING_CONSTANT_EDIT,VehicleDef->Get_Damping_Constant());
  1526. Set_Dlg_Item_Float(IDC_SPRING_LENGTH_EDIT,VehicleDef->Get_Spring_Length());
  1527. Set_Dlg_Item_Float(IDC_LATERAL_MOMENT_ARM_EDIT,VehicleDef->Get_Lateral_Moment_Arm());
  1528. Set_Dlg_Item_Float(IDC_TRACTIVE_MOMENT_ARM_EDIT,VehicleDef->Get_Tractive_Moment_Arm());
  1529. Set_Dlg_Item_Float(IDC_MAX_ENGINE_TORQUE_EDIT,VehicleDef->Get_Max_Engine_Torque());
  1530. Set_Dlg_Item_Float(IDC_TRACK_U_SCALE_FACTOR_EDIT, VehicleDef->Get_Track_U_Scale_Factor());
  1531. Set_Dlg_Item_Float(IDC_TRACK_V_SCALE_FACTOR_EDIT, VehicleDef->Get_Track_V_Scale_Factor());
  1532. Set_Dlg_Item_Float(IDC_TURN_TORQUE_SCALE_FACTOR_EDIT, VehicleDef->Get_Turn_Torque_Scale_Factor());
  1533. WideStringClass radius_text;
  1534. radius_text.Format(L"%10.4f",WheelRadius);
  1535. Set_Dlg_Item_Text(IDC_WHEEL_RADIUS,radius_text);
  1536. } else {
  1537. Set_Controls_Hidden(true);
  1538. }
  1539. PopupDialogClass::On_Init_Dialog ();
  1540. }
  1541. void
  1542. EditTrackedVehicleDialogClass::On_Command (int ctrl_id, int message_id, DWORD param)
  1543. {
  1544. switch (ctrl_id)
  1545. {
  1546. case IDOK:
  1547. if (VehicleDef != NULL) {
  1548. VehicleDef->Set_Mass(Get_Dlg_Item_Float(IDC_MASS_EDIT));
  1549. VehicleDef->Set_Grav_Scale(Get_Dlg_Item_Float(IDC_GRAVSCALE_EDIT));
  1550. VehicleDef->Set_Aerodynamic_Drag(Get_Dlg_Item_Float(IDC_AERODRAG_EDIT));
  1551. VehicleDef->Set_Spring_Constant(Get_Dlg_Item_Float(IDC_SPRING_CONSTANT_EDIT));
  1552. VehicleDef->Set_Damping_Constant(Get_Dlg_Item_Float(IDC_DAMPING_CONSTANT_EDIT));
  1553. VehicleDef->Set_Spring_Length(Get_Dlg_Item_Float(IDC_SPRING_LENGTH_EDIT));
  1554. VehicleDef->Set_Lateral_Moment_Arm(Get_Dlg_Item_Float(IDC_LATERAL_MOMENT_ARM_EDIT));
  1555. VehicleDef->Set_Tractive_Moment_Arm(Get_Dlg_Item_Float(IDC_TRACTIVE_MOMENT_ARM_EDIT));
  1556. VehicleDef->Set_Max_Engine_Torque(Get_Dlg_Item_Float(IDC_MAX_ENGINE_TORQUE_EDIT));
  1557. VehicleDef->Set_Track_U_Scale_Factor(Get_Dlg_Item_Float(IDC_TRACK_U_SCALE_FACTOR_EDIT));
  1558. VehicleDef->Set_Track_V_Scale_Factor(Get_Dlg_Item_Float(IDC_TRACK_V_SCALE_FACTOR_EDIT));
  1559. VehicleDef->Set_Turn_Torque_Scale_Factor(Get_Dlg_Item_Float(IDC_TURN_TORQUE_SCALE_FACTOR_EDIT));
  1560. PhysicsSceneClass * pscene = PhysicsSceneClass::Get_Instance();
  1561. if (pscene) {
  1562. RefPhysListIterator iterator = pscene->Get_Dynamic_Object_Iterator();
  1563. while (!iterator.Is_Done()) {
  1564. if ( (iterator.Peek_Obj() != NULL) &&
  1565. (iterator.Peek_Obj()->Get_Definition() == VehicleDef))
  1566. {
  1567. iterator.Peek_Obj()->Definition_Changed();
  1568. }
  1569. iterator.Next();
  1570. }
  1571. }
  1572. }
  1573. End_Dialog();
  1574. break;
  1575. }
  1576. PopupDialogClass::On_Command (ctrl_id, message_id, param);
  1577. return ;
  1578. }
  1579. ////////////////////////////////////////////////////////////////
  1580. //
  1581. // On_Command
  1582. //
  1583. ////////////////////////////////////////////////////////////////
  1584. void
  1585. MultiplayOptionsMainMenuClass::On_Command (int ctrl_id, int message_id, DWORD param)
  1586. {
  1587. switch (ctrl_id)
  1588. {
  1589. case IDC_MP_OPTIONS_BUTTON:
  1590. START_DIALOG (MultiplayOptionsMenuClass);
  1591. break;
  1592. case IDC_SKIN_SELECTION_BUTTON:
  1593. START_DIALOG (CharacterOptionsMenuClass);
  1594. break;
  1595. }
  1596. MenuDialogClass::On_Command (ctrl_id, message_id, param);
  1597. return ;
  1598. }