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