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