Mercurial > mm7
comparison Game/GameMenu.cpp @ 2554:f2a8ed07e921
Game Main Menu separated from Game logic
author | a.parshin |
---|---|
date | Wed, 13 May 2015 11:31:58 +0200 |
parents | |
children | d87bfbd3bb3b |
comparison
equal
deleted
inserted
replaced
2553:48708da03b7f | 2554:f2a8ed07e921 |
---|---|
1 #include "Engine/Engine.h" | |
2 #include "Engine/Timer.h" | |
3 #include "Engine/LOD.h" | |
4 #include "Engine/Party.h" | |
5 #include "Engine/SaveLoad.h" | |
6 #include "Engine/Registry.h" | |
7 #include "Engine/texts.h" | |
8 #include "Engine/Graphics/IRender.h" | |
9 #include "Engine/Graphics/Viewport.h" | |
10 | |
11 #include "IO/Keyboard.h" | |
12 #include "IO/Mouse.h" | |
13 | |
14 #include "GUI/UI/UIGame.h" | |
15 #include "GUI/UI/UISaveLoad.h" | |
16 #include "GUI/UI/UIModal.h" | |
17 | |
18 #include "Media/Audio/AudioPlayer.h" | |
19 #include "Media/Audio/AIL.h" | |
20 | |
21 | |
22 | |
23 extern void DoThatMessageThing(); | |
24 | |
25 | |
26 void Game_StartNewGameWhilePlaying(bool force_start) | |
27 { | |
28 if (dword_6BE138 == 124 || force_start) | |
29 { | |
30 pIcons_LOD->SyncLoadedFilesCount(); | |
31 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
32 DoThatMessageThing(); | |
33 //pGUIWindow_CurrentMenu->Release(); | |
34 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU; | |
35 current_screen_type = SCREEN_GAME; | |
36 viewparams->bRedrawGameUI = 1; | |
37 } | |
38 else | |
39 { | |
40 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2);// "Are you sure? Click again to start a New Game" | |
41 pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0); | |
42 dword_6BE138 = 124; | |
43 } | |
44 } | |
45 | |
46 void Game_QuitGameWhilePlaying(bool force_quit) | |
47 { | |
48 if (dword_6BE138 == 132 || force_quit) | |
49 { | |
50 pIcons_LOD->SyncLoadedFilesCount(); | |
51 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
52 DoThatMessageThing(); | |
53 //pGUIWindow_CurrentMenu->Release(); | |
54 current_screen_type = SCREEN_GAME; | |
55 viewparams->bRedrawGameUI = 1; | |
56 pAudioPlayer->PlaySound(SOUND_WoodDoorClosing, 0, 0, -1, 0, 0, 0, 0); | |
57 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU; | |
58 } | |
59 else | |
60 { | |
61 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit" | |
62 pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0); | |
63 dword_6BE138 = 132; | |
64 } | |
65 } | |
66 | |
67 void Game_OpenLoadGameDialog() | |
68 { | |
69 pIcons_LOD->SyncLoadedFilesCount(); | |
70 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
71 | |
72 DoThatMessageThing(); | |
73 pGUIWindow_CurrentMenu->Release(); | |
74 pGUIWindow_CurrentMenu = nullptr; | |
75 | |
76 //LoadUI_Load(1); | |
77 current_screen_type = SCREEN_LOADGAME; | |
78 pGUIWindow_CurrentMenu = new GUIWindow_Load(true); | |
79 } | |
80 | |
81 | |
82 | |
83 | |
84 void GameMenu_EventLoop() | |
85 { | |
86 while (pMessageQueue_50CBD0->uNumMessages) | |
87 { | |
88 UIMessageType msg; | |
89 int param, param2; | |
90 pMessageQueue_50CBD0->PopMessage(&msg, ¶m, ¶m2); | |
91 | |
92 switch (msg) | |
93 { | |
94 case UIMSG_StartNewGame: Game_StartNewGameWhilePlaying(param); continue; | |
95 case UIMSG_Quit: Game_QuitGameWhilePlaying(param); continue; | |
96 case UIMSG_Game_OpenLoadGameDialog: Game_OpenLoadGameDialog(); continue; | |
97 | |
98 case UIMSG_ArrowUp: | |
99 --pSaveListPosition; | |
100 if (pSaveListPosition < 0) | |
101 pSaveListPosition = 0; | |
102 new OnButtonClick2(215, 199, 17, 17, (int)pBtnArrowUp, 0); | |
103 continue; | |
104 | |
105 case UIMSG_DownArrow: | |
106 ++pSaveListPosition; | |
107 if (pSaveListPosition >= param) | |
108 pSaveListPosition = param - 1; | |
109 new OnButtonClick2(215, 323, 17, 17, (int)pBtnDownArrow, 0); | |
110 continue; | |
111 | |
112 case UIMSG_Cancel: | |
113 new OnCancel(350, 302, 106, 42, (int)pBtnCancel, 0); | |
114 continue; | |
115 | |
116 case UIMSG_SaveLoadBtn: | |
117 new OnSaveLoad(241, 302, 106, 42, (int)pBtnLoadSlot, 0); | |
118 continue; | |
119 case UIMSG_SelectLoadSlot: | |
120 { | |
121 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
122 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
123 | |
124 int v10 = pSaveListPosition + param; | |
125 if (current_screen_type != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != v10) | |
126 { | |
127 if (dword_6BE138 == pSaveListPosition + param) | |
128 { | |
129 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0); | |
130 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); | |
131 } | |
132 uLoadGameUI_SelectedSlot = v10; | |
133 dword_6BE138 = v10; | |
134 } | |
135 else | |
136 { | |
137 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); | |
138 if (strcmp(pSavegameHeader[uLoadGameUI_SelectedSlot].pName, pGlobalTXT_LocalizationStrings[72]))// "Empty" | |
139 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); | |
140 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer); | |
141 } | |
142 } | |
143 continue; | |
144 case UIMSG_LoadGame: | |
145 if (pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) | |
146 { | |
147 LoadGame(uLoadGameUI_SelectedSlot); | |
148 uGameState = GAME_STATE_LOADING_GAME; | |
149 } | |
150 continue; | |
151 case UIMSG_SaveGame: | |
152 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
153 { | |
154 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
155 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pKeyActionMap->pPressedKeysBuffer); | |
156 } | |
157 DoSavegame(uLoadGameUI_SelectedSlot); | |
158 continue; | |
159 case UIMSG_Game_OpenSaveGameDialog: | |
160 { | |
161 pGUIWindow_CurrentMenu->Release(); | |
162 | |
163 current_screen_type = SCREEN_SAVEGAME; | |
164 pGUIWindow_CurrentMenu = new GUIWindow_Save(); //SaveUI_Load(current_screen_type = SCREEN_SAVEGAME); | |
165 continue; | |
166 } | |
167 case UIMSG_Game_OpenOptionsDialog://Open | |
168 { | |
169 DoThatMessageThing(); | |
170 | |
171 pGUIWindow_CurrentMenu->Release(); | |
172 pGUIWindow_CurrentMenu = new GUIWindow_GameOptions();//GameMenuUI_Options_Load(); | |
173 | |
174 viewparams->field_48 = 1; | |
175 current_screen_type = SCREEN_OPTIONS; | |
176 | |
177 continue; | |
178 } | |
179 | |
180 case UIMSG_OpenKeyMappingOptions://Open | |
181 { | |
182 DoThatMessageThing(); | |
183 | |
184 pGUIWindow_CurrentMenu->Release(); | |
185 pGUIWindow_CurrentMenu = new GUIWindow_GameKeyBindings();//GameMenuUI_OptionsKeymapping_Load(); | |
186 | |
187 viewparams->field_48 = 1; | |
188 current_screen_type = SCREEN_KEYBOARD_OPTIONS; | |
189 | |
190 continue; | |
191 } | |
192 | |
193 case UIMSG_ChangeKeyButton: | |
194 { | |
195 if (uGameMenuUI_CurentlySelectedKeyIdx != -1) | |
196 { | |
197 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
198 } | |
199 else | |
200 { | |
201 uGameMenuUI_CurentlySelectedKeyIdx = param; | |
202 if (KeyboardPageNum != 1) | |
203 uGameMenuUI_CurentlySelectedKeyIdx += 14; | |
204 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); | |
205 } | |
206 continue; | |
207 } | |
208 | |
209 case UIMSG_ResetKeyMapping: | |
210 { | |
211 int v197 = 1; | |
212 pKeyActionMap->SetDefaultMapping(); | |
213 for (uint i = 0; i < 28; i++) | |
214 { | |
215 if (pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i]) | |
216 { | |
217 if (v197) | |
218 { | |
219 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 1); | |
220 v197 = 0; | |
221 } | |
222 else | |
223 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 0); | |
224 } | |
225 pPrevVirtualCidesMapping[i] = pKeyActionMap->GetActionVKey((enum InputAction)i); | |
226 GameMenuUI_InvaligKeyBindingsFlags[i] = false; | |
227 } | |
228 pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0, 0, 0); | |
229 continue; | |
230 } | |
231 | |
232 case UIMSG_SelectKeyPage1: | |
233 KeyboardPageNum = 1; | |
234 continue; | |
235 case UIMSG_SelectKeyPage2: | |
236 KeyboardPageNum = 2; | |
237 continue; | |
238 | |
239 case UIMSG_OpenVideoOptions: | |
240 { | |
241 DoThatMessageThing(); | |
242 | |
243 pGUIWindow_CurrentMenu->Release(); | |
244 pGUIWindow_CurrentMenu = new GUIWindow_GameVideoOptions();//GameMenuUI_OptionsVideo_Load(); | |
245 viewparams->field_48 = 1; | |
246 current_screen_type = SCREEN_VIDEO_OPTIONS; | |
247 | |
248 continue; | |
249 } | |
250 | |
251 case UIMSG_1A9: | |
252 __debugbreak(); | |
253 if (param == 4) | |
254 { | |
255 //--uGammaPos; | |
256 if ((uGammaPos-- - 1) < 0) | |
257 { | |
258 uGammaPos = 0; | |
259 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0); | |
260 continue; | |
261 } | |
262 double v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
263 //pEngine->pGammaController->Initialize(v19); | |
264 new OnButtonClick2(21, 161, 0, 0, (int)pBtn_SliderLeft, (char *)1); | |
265 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0); | |
266 continue; | |
267 } | |
268 if (param == 5) | |
269 { | |
270 ++uGammaPos; | |
271 if ((signed int)uGammaPos <= 9) | |
272 { | |
273 double v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
274 //pEngine->pGammaController->Initialize(v21); | |
275 new OnButtonClick2(213, 161, 0, 0, (int)pBtn_SliderRight, (char *)1); | |
276 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0); | |
277 continue; | |
278 } | |
279 uGammaPos = 9; | |
280 } | |
281 else | |
282 { | |
283 POINT a2; | |
284 uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17; | |
285 double v22 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
286 //pEngine->pGammaController->Initialize(v22); | |
287 } | |
288 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0); | |
289 continue; | |
290 case UIMSG_ToggleBloodsplats: | |
291 pEngine->ToggleFlags2(0x20u); | |
292 continue; | |
293 case UIMSG_ToggleColoredLights: | |
294 pRenderer->ToggleColoredLights(); | |
295 continue; | |
296 case UIMSG_ToggleTint: | |
297 pRenderer->ToggleTint(); | |
298 continue; | |
299 case UIMSG_ChangeMusicVolume: | |
300 extern bool use_music_folder; | |
301 if (param == 4)//- | |
302 { | |
303 --uMusicVolimeMultiplier; | |
304 if ((char)uMusicVolimeMultiplier < 1) | |
305 uMusicVolimeMultiplier = 0; | |
306 new OnButtonClick2(243, 216, 0, 0, (int)pBtn_SliderLeft, (char *)1); | |
307 if (uMusicVolimeMultiplier) | |
308 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); | |
309 | |
310 if (use_music_folder) | |
311 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
312 else | |
313 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
314 | |
315 continue; | |
316 } | |
317 if (param == 5)//+ | |
318 { | |
319 ++uMusicVolimeMultiplier; | |
320 if ((char)uMusicVolimeMultiplier > 9) | |
321 uMusicVolimeMultiplier = 9; | |
322 new OnButtonClick2(435, 216, 0, 0, (int)pBtn_SliderRight, (char *)1); | |
323 if (uMusicVolimeMultiplier) | |
324 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); | |
325 if (use_music_folder) | |
326 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
327 else | |
328 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
329 continue; | |
330 } | |
331 | |
332 POINT v202; | |
333 uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//for mouse | |
334 if ((char)uMusicVolimeMultiplier > 9) | |
335 uMusicVolimeMultiplier = 9; | |
336 if (uMusicVolimeMultiplier) | |
337 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); | |
338 if (use_music_folder) | |
339 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
340 else | |
341 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
342 continue; | |
343 case UIMSG_ChangeSoundVolume: | |
344 if (param == 4)//reduce sound level button left | |
345 { | |
346 --uSoundVolumeMultiplier; | |
347 if ((char)uSoundVolumeMultiplier < 1) | |
348 uSoundVolumeMultiplier = 0; | |
349 new OnButtonClick2(243, 162, 0, 0, (int)pBtn_SliderLeft, (char *)1); | |
350 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); | |
351 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0); | |
352 int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook); | |
353 //v = v+1; | |
354 if (v) | |
355 __debugbreak(); | |
356 continue; | |
357 } | |
358 if (param == 5)//Increase sound level button right | |
359 { | |
360 ++uSoundVolumeMultiplier; | |
361 if ((char)uSoundVolumeMultiplier > 8) | |
362 uSoundVolumeMultiplier = 9; | |
363 //v168 = 1; | |
364 //v154 = (int)pBtn_SliderRight; | |
365 new OnButtonClick2(435, 162, 0, 0, (int)pBtn_SliderRight, (char *)1); | |
366 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); | |
367 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0); | |
368 continue; | |
369 } | |
370 | |
371 POINT v207; | |
372 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; | |
373 if ((char)uSoundVolumeMultiplier > 8) | |
374 uSoundVolumeMultiplier = 9; | |
375 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); | |
376 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0); | |
377 continue; | |
378 case UIMSG_ToggleFlipOnExit: | |
379 bFlipOnExit = bFlipOnExit == 0; | |
380 continue; | |
381 case UIMSG_ToggleAlwaysRun: | |
382 bAlwaysRun = bAlwaysRun == 0; | |
383 continue; | |
384 case UIMSG_ToggleWalkSound: | |
385 bWalkSound = bWalkSound == 0; | |
386 continue; | |
387 case UIMSG_ToggleShowDamage: | |
388 bShowDamage = bShowDamage == 0; | |
389 continue; | |
390 case UIMSG_ChangeVoiceVolume: | |
391 if (param == 4) | |
392 { | |
393 --uVoicesVolumeMultiplier; | |
394 if ((char)uVoicesVolumeMultiplier < 1) | |
395 uVoicesVolumeMultiplier = 0; | |
396 new OnButtonClick2(243, 270, 0, 0, (int)pBtn_SliderLeft, (char *)1); | |
397 if (!uVoicesVolumeMultiplier) | |
398 continue; | |
399 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
400 continue; | |
401 } | |
402 if (param == 5) | |
403 { | |
404 ++uVoicesVolumeMultiplier; | |
405 if ((char)uVoicesVolumeMultiplier > 8) | |
406 uVoicesVolumeMultiplier = 9; | |
407 new OnButtonClick2(435, 270, 0, 0, (int)pBtn_SliderRight, (char *)1); | |
408 if (!uVoicesVolumeMultiplier) | |
409 continue; | |
410 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
411 continue; | |
412 } | |
413 | |
414 POINT v205; | |
415 uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17; | |
416 if ((char)uVoicesVolumeMultiplier > 8) | |
417 uVoicesVolumeMultiplier = 9; | |
418 if (!uVoicesVolumeMultiplier) | |
419 continue; | |
420 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
421 continue; | |
422 case UIMSG_SetTurnSpeed: | |
423 if (param) | |
424 pParty->sRotationY = param * pParty->sRotationY / param; | |
425 uTurnSpeed = param; | |
426 continue; | |
427 | |
428 case UIMSG_SetGraphicsMode: | |
429 //if ( !bUseLoResSprites ) | |
430 //{ | |
431 // byte_6BE388_graphicsmode = uMessageParam; | |
432 // MM7Initialization(); | |
433 // continue; | |
434 //} | |
435 //if ( uMessageParam ) | |
436 //{ | |
437 // if ( uMessageParam == 1 ) | |
438 // { | |
439 // byte_6BE388_graphicsmode = 0; | |
440 // } | |
441 // else | |
442 // { | |
443 // if ( uMessageParam != 2 ) | |
444 // continue; | |
445 // byte_6BE388_graphicsmode = 1; | |
446 // } | |
447 // MM7Initialization(); | |
448 // continue; | |
449 //} | |
450 pModalWindow = new GUIWindow_Modal(pNPCTopics[453].pText, UIMSG_0); | |
451 __debugbreak(); // Nomad: graphicsmode as it was now removed | |
452 continue; | |
453 | |
454 case UIMSG_GameMenu_ReturnToGame: | |
455 //pGUIWindow_CurrentMenu->Release(); | |
456 pEventTimer->Resume(); | |
457 current_screen_type = SCREEN_GAME; | |
458 viewparams->bRedrawGameUI = true; | |
459 continue; | |
460 | |
461 | |
462 | |
463 | |
464 case UIMSG_Escape: | |
465 if (pModalWindow) | |
466 { | |
467 pModalWindow->Release(); | |
468 pModalWindow = nullptr; | |
469 continue; | |
470 } | |
471 pRenderer->ClearZBuffer(0, 479); | |
472 viewparams->bRedrawGameUI = true; | |
473 viewparams->field_48 = 1; | |
474 | |
475 if (current_screen_type == SCREEN_MENU) | |
476 { | |
477 pIcons_LOD->SyncLoadedFilesCount(); | |
478 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
479 pIcons_LOD->SyncLoadedFilesCount(); | |
480 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
481 | |
482 current_screen_type = SCREEN_GAME; | |
483 } | |
484 else if (current_screen_type == SCREEN_SAVEGAME || current_screen_type == SCREEN_LOADGAME) | |
485 { | |
486 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
487 //crt_deconstruct_ptr_6A0118(); | |
488 | |
489 pGUIWindow_CurrentMenu->Release(); | |
490 current_screen_type = SCREEN_MENU; | |
491 pGUIWindow_CurrentMenu = new GUIWindow_GameMenu(); | |
492 } | |
493 else if (current_screen_type == SCREEN_OPTIONS) | |
494 { | |
495 options_menu_skin.Relaease(); | |
496 pIcons_LOD->SyncLoadedFilesCount(); | |
497 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); | |
498 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); | |
499 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier); | |
500 WriteWindowsRegistryInt("WalkSound", bWalkSound); | |
501 WriteWindowsRegistryInt("ShowDamage", bShowDamage); | |
502 //WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode); | |
503 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); | |
504 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit); | |
505 if (!uTurnSpeed) | |
506 WriteWindowsRegistryInt("TurnDelta", 3); | |
507 else if (uTurnSpeed == 64) | |
508 WriteWindowsRegistryInt("TurnDelta", 2); | |
509 else if (uTurnSpeed == 128) | |
510 WriteWindowsRegistryInt("TurnDelta", 1); | |
511 | |
512 pGUIWindow_CurrentMenu->Release(); | |
513 current_screen_type = SCREEN_MENU; | |
514 pGUIWindow_CurrentMenu = new GUIWindow_GameMenu(); | |
515 } | |
516 else if (current_screen_type == SCREEN_VIDEO_OPTIONS) | |
517 { | |
518 //if ( pRenderer->pRenderD3D ) | |
519 { | |
520 WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights); | |
521 WriteWindowsRegistryInt("Tinting", pRenderer->bTinting); | |
522 WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pEngine->uFlags2) >> 5) & 1); | |
523 } | |
524 | |
525 pGUIWindow_CurrentMenu->Release(); | |
526 current_screen_type = SCREEN_MENU; | |
527 pGUIWindow_CurrentMenu = new GUIWindow_GameMenu(); | |
528 } | |
529 else if (current_screen_type == SCREEN_KEYBOARD_OPTIONS) | |
530 { | |
531 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 | |
532 int v197 = 1; | |
533 bool pKeyBindingFlag = false; | |
534 | |
535 for (uint i = 0; i < 28; ++i) | |
536 { | |
537 if (GameMenuUI_InvaligKeyBindingsFlags[i]) | |
538 pKeyBindingFlag = true; | |
539 } | |
540 if (!pKeyBindingFlag) | |
541 { | |
542 for (uint i = 0; i < 5; i++) | |
543 { | |
544 if (uTextureID_Optkb[i]) | |
545 pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release(); | |
546 } | |
547 memset(uTextureID_Optkb.data(), 0, 20); | |
548 pIcons_LOD->SyncLoadedFilesCount(); | |
549 for (uint i = 0; i < 28; ++i) | |
550 { | |
551 if (pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i]) | |
552 { | |
553 if (v197) | |
554 { | |
555 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1); | |
556 v197 = 0; | |
557 } | |
558 else | |
559 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0); | |
560 } | |
561 if (i > 3 && i != 25 && i != 26) | |
562 pKeyToggleType = TOGGLE_OneTimePress; | |
563 else | |
564 pKeyToggleType = TOGGLE_Continuously; | |
565 pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType); | |
566 } | |
567 pKeyActionMap->StoreMappings(); | |
568 } | |
569 else | |
570 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
571 | |
572 pGUIWindow_CurrentMenu->Release(); | |
573 current_screen_type = SCREEN_MENU; | |
574 pGUIWindow_CurrentMenu = new GUIWindow_GameMenu(); | |
575 } | |
576 continue; | |
577 } | |
578 } | |
579 } | |
580 | |
581 void GameMenu_Loop() | |
582 { | |
583 pEventTimer->Pause(); | |
584 pAudioPlayer->StopChannels(-1, -1); | |
585 current_screen_type = SCREEN_MENU; | |
586 | |
587 ++pIcons_LOD->uTexturePacksCount; | |
588 if (!pIcons_LOD->uNumPrevLoadedFiles) | |
589 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
590 | |
591 pGUIWindow_CurrentMenu = new GUIWindow_GameMenu(); | |
592 | |
593 viewparams->field_48 = 1; | |
594 | |
595 stru_506E40.Release(); | |
596 pRenderer->SaveScreenshot("gamma.pcx", 155, 117); | |
597 stru_506E40.LoadPCXFile("gamma.pcx", 0); | |
598 | |
599 while (uGameState == GAME_STATE_PLAYING | |
600 && ( | |
601 current_screen_type == SCREEN_MENU | |
602 || current_screen_type == SCREEN_SAVEGAME | |
603 || current_screen_type == SCREEN_LOADGAME | |
604 || current_screen_type == SCREEN_OPTIONS | |
605 || current_screen_type == SCREEN_VIDEO_OPTIONS | |
606 || current_screen_type == SCREEN_KEYBOARD_OPTIONS | |
607 ) | |
608 ) | |
609 { | |
610 MSG msg; | |
611 while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) | |
612 { | |
613 if (msg.message == WM_QUIT) | |
614 Engine_DeinitializeAndTerminate(0); | |
615 TranslateMessage(&msg); | |
616 DispatchMessageW(&msg); | |
617 } | |
618 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) | |
619 { | |
620 WaitMessage(); | |
621 continue; | |
622 } | |
623 | |
624 pRenderer->BeginScene(); | |
625 { | |
626 GameMenu_EventLoop(); | |
627 GUI_UpdateWindows(); | |
628 } | |
629 pRenderer->EndScene(); | |
630 pRenderer->Present(); | |
631 } | |
632 | |
633 pGUIWindow_CurrentMenu->Release(); | |
634 pGUIWindow_CurrentMenu = nullptr; | |
635 | |
636 stru_506E40.Release(); | |
637 } |