Mercurial > mm7
annotate Game/Game.cpp @ 2544:c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
author | a.parshin |
---|---|
date | Mon, 11 May 2015 09:51:04 +0200 |
parents | b6140dfeac27 |
children | 4087cbc62706 |
rev | line source |
---|---|
2541 | 1 #include "Engine/Engine.h" |
2 #include "Engine/Party.h" | |
3 #include "Engine/LOD.h" | |
4 #include "Engine/Events.h" | |
5 #include "Engine/Timer.h" | |
6 #include "Engine/texts.h" | |
7 #include "Engine/SaveLoad.h" | |
8 #include "Engine/Registry.h" | |
9 #include "Engine/Objects/Actor.h" | |
10 #include "Engine/Objects/Chest.h" | |
11 #include "Engine/Objects/ObjectList.h" | |
12 #include "Engine/Objects/SpriteObject.h" | |
13 #include "Engine/Graphics/IRender.h" | |
14 #include "Engine/Graphics/Viewport.h" | |
15 #include "Engine/Graphics/Outdoor.h" | |
16 #include "Engine/Graphics/Overlays.h" | |
17 #include "Engine/Graphics/Sprites.h" | |
18 #include "Engine/Graphics/Vis.h" | |
19 #include "Engine/Graphics/PaletteManager.h" | |
20 #include "Engine/Graphics/DecalBuilder.h" | |
21 #include "Engine/Graphics/Level/Decoration.h" | |
22 #include "Engine/Tables/FrameTableInc.h" | |
23 #include "Engine/TurnEngine/TurnEngine.h" | |
24 #include "Engine/Spells/CastSpellInfo.h" | |
25 | |
26 #include "IO/Keyboard.h" | |
27 #include "IO/Mouse.h" | |
28 | |
29 #include "Arcomage/Arcomage.h" | |
30 | |
31 #include "Media/Audio/AudioPlayer.h" | |
32 #include "Media/Audio/AIL.h" | |
33 | |
34 #include "GUI/GUIWindow.h" | |
35 #include "GUI/GUIProgressBar.h" | |
36 #include "GUI/UI/UIHouses.h" | |
37 #include "GUI/UI/UIShops.h" | |
38 #include "GUI/UI/UIPartyCreation.h" | |
39 #include "GUI/UI/UIGame.h" | |
40 | |
41 #include "Game/Game.h" | |
42 | |
43 | |
44 void DoThatMessageThing() | |
45 { | |
46 if (pMessageQueue_50CBD0->uNumMessages) | |
47 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
48 } | |
49 | |
50 | |
51 | |
52 void Game_StartDialogue(unsigned int actor_id) | |
53 { | |
54 if (uActiveCharacter) | |
55 { | |
56 viewparams->field_48 = 1; | |
57 | |
58 DoThatMessageThing(); | |
59 | |
60 dword_5B65D0_dialogue_actor_npc_id = pActors[actor_id].sNPC_ID; | |
61 GameUI_InitializeDialogue(&pActors[actor_id], true); | |
62 } | |
63 } | |
64 | |
65 void Game_StartHirelingDialogue(unsigned int hireling_id) | |
66 { | |
67 if (bNoNPCHiring || current_screen_type != 0) | |
68 return; | |
69 | |
70 DoThatMessageThing(); | |
71 | |
72 uint hireling_slot = 0; | |
73 for (uint i = 0; i < 2; ++i) | |
74 { | |
75 if (pParty->pHirelings[i].pName) | |
76 pTmpBuf[hireling_slot++] = i; | |
77 } | |
78 | |
79 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
80 { | |
81 NPCData *npc = &pNPCStats->pNewNPCData[i]; | |
82 if (npc->Hired() | |
83 && (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) | |
84 && (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName))) | |
85 { | |
86 pTmpBuf[hireling_slot++] = i + 2; | |
87 } | |
88 } | |
89 | |
90 if ((signed int)hireling_id + (signed int)pParty->hirelingScrollPosition < hireling_slot) | |
91 { | |
92 Actor actor; | |
93 memset(&actor, 0, sizeof(actor)); | |
94 actor.sNPC_ID += -1 - pParty->hirelingScrollPosition - hireling_id; | |
95 GameUI_InitializeDialogue(&actor, true); | |
96 } | |
97 } | |
98 | |
99 | |
100 void Game_StartNewGameWhilePlaying(bool force_start) | |
101 { | |
102 if (dword_6BE138 == 124 || force_start) | |
103 { | |
104 pIcons_LOD->SyncLoadedFilesCount(); | |
105 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
106 DoThatMessageThing(); | |
107 pGUIWindow_CurrentMenu->Release(); | |
108 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU; | |
109 current_screen_type = SCREEN_GAME; | |
110 viewparams->bRedrawGameUI = 1; | |
111 } | |
112 else | |
113 { | |
114 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2);// "Are you sure? Click again to start a New Game" | |
115 pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0); | |
116 dword_6BE138 = 124; | |
117 } | |
118 stru_506E40.Release(); | |
119 } | |
120 | |
121 void Game_QuitGameWhilePlaying(bool force_quit) | |
122 { | |
123 if (dword_6BE138 == 132 || force_quit) | |
124 { | |
125 pIcons_LOD->SyncLoadedFilesCount(); | |
126 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
127 DoThatMessageThing(); | |
128 pGUIWindow_CurrentMenu->Release(); | |
129 current_screen_type = SCREEN_GAME; | |
130 viewparams->bRedrawGameUI = 1; | |
131 pAudioPlayer->PlaySound(SOUND_WoodDoorClosing, 0, 0, -1, 0, 0, 0, 0); | |
132 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU; | |
133 } | |
134 else | |
135 { | |
136 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit" | |
137 pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0); | |
138 dword_6BE138 = 132; | |
139 } | |
140 stru_506E40.Release(); | |
141 } | |
142 | |
143 void Game_OpenLoadGameDialog() | |
144 { | |
145 pIcons_LOD->SyncLoadedFilesCount(); | |
146 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
147 DoThatMessageThing(); | |
148 pGUIWindow_CurrentMenu->Release(); | |
149 current_screen_type = SCREEN_LOADGAME; | |
150 LoadUI_Load(1); | |
151 } | |
152 | |
153 | |
154 | |
155 //----- (004304E7) -------------------------------------------------------- | |
156 void Game_EventLoop() | |
157 { | |
158 unsigned int v2; // edx@7 | |
159 Actor *pActor; // ecx@13 | |
160 int v4; // ecx@18 | |
161 unsigned int v10; // ecx@73 | |
162 int v14; // eax@98 | |
163 int v18; // eax@106 | |
164 float v19; // ST64_4@121 | |
165 float v21; // ST64_4@126 | |
166 float v22; // ST64_4@127 | |
167 unsigned int v24; // ecx@149 | |
168 GUIWindow *pWindow2; // ecx@248 | |
169 bool pKeyBindingFlag; // eax@269 | |
170 unsigned int v33; // eax@277 | |
171 int v37; // eax@341 | |
172 int v38; // eax@358 | |
173 SHORT v39; // ax@365 | |
174 char *v41; // eax@380 | |
175 int v42; // eax@396 | |
176 signed int v44; // eax@398 | |
177 int v45; // edx@398 | |
178 signed int v46; // ecx@398 | |
179 char v47; // zf@399 | |
180 char v48; // zf@405 | |
181 BLVFace *pBLVFace; // ecx@410 | |
182 ODMFace *pODMFace; // ecx@412 | |
183 CastSpellInfo *pSpellInfo; // ecx@415 | |
184 __int16 v53; // ax@431 | |
185 int v54; // eax@432 | |
186 int v55; // ecx@432 | |
187 int v56; // edx@432 | |
188 int v57; // eax@432 | |
189 Player *pPlayer; // edx@442 | |
190 unsigned int pMapNum; // eax@445 | |
191 signed int v60; // ST64_4@459 | |
192 __int16 v63; // dx@479 | |
193 unsigned int v64; // eax@486 | |
194 int v65; // ecx@486 | |
195 int v66; // eax@488 | |
196 char *v67; // eax@489 | |
197 __int16 v68; // dx@498 | |
198 char *v69; // eax@512 | |
199 int v70; // eax@525 | |
200 int v71; // edi@527 | |
201 NPCData *pNPCData3; // esi@527 | |
202 char *v73; // ecx@533 | |
203 signed int v74; // edi@535 | |
204 int v75; // eax@535 | |
205 int v76; // esi@535 | |
206 int v77; // eax@537 | |
207 Player *pPlayer2; // ecx@549 | |
208 signed int v81; // eax@552 | |
209 signed int v83; // ecx@554 | |
210 signed int v84; // ecx@554 | |
211 GUIButton *pButton; // eax@578 | |
212 unsigned int v86; // eax@583 | |
213 const char *v87; // ecx@595 | |
214 const char *v88; // ecx@596 | |
215 unsigned int v90; // eax@602 | |
216 int v91; // edx@605 | |
217 int v92; // eax@605 | |
218 int v93; // edx@605 | |
219 int pPlayerNum; // edx@611 | |
220 int v95; // eax@611 | |
221 unsigned int v97; // eax@624 | |
222 int v98; // eax@636 | |
223 int v103; // eax@671 | |
224 Player *pPlayer4; // ecx@718 | |
225 int v105; // eax@718 | |
226 Player *pPlayer5; // ST78_4@758 | |
227 unsigned int v107; // eax@758 | |
228 unsigned int v108; // eax@758 | |
229 unsigned int v115; // eax@764 | |
230 int v116; // eax@776 | |
231 unsigned int v118; // eax@785 | |
232 unsigned int v119; // ecx@786 | |
233 unsigned int v121; // [sp-28h] [bp-624h]@711 | |
234 unsigned int v123; // [sp-24h] [bp-620h]@711 | |
235 unsigned int v125; // [sp-20h] [bp-61Ch]@711 | |
236 int v127; // [sp-1Ch] [bp-618h]@107 | |
237 unsigned int v128; // [sp-1Ch] [bp-618h]@711 | |
238 GUIButton *pButton2; // [sp-4h] [bp-600h]@59 | |
239 const char *v161; // [sp-4h] [bp-600h]@637 | |
240 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 | |
241 char *v173; // [sp+0h] [bp-5FCh]@444 | |
242 char *v174; // [sp+0h] [bp-5FCh]@449 | |
243 const char *v177; // [sp+0h] [bp-5FCh]@629 | |
244 char *v178; // [sp+0h] [bp-5FCh]@637 | |
245 signed int thisb; // [sp+14h] [bp-5E8h]@272 | |
246 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373 | |
247 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377 | |
248 char *pMapName; // [sp+14h] [bp-5E8h]@445 | |
249 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455 | |
250 int thisg; // [sp+14h] [bp-5E8h]@467 | |
251 int thish; // [sp+14h] [bp-5E8h]@528 | |
252 signed int thisi; // [sp+14h] [bp-5E8h]@535 | |
253 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604 | |
254 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641 | |
255 int uMessageParam; // [sp+18h] [bp-5E4h]@7 | |
256 int uAction; // [sp+1Ch] [bp-5E0h]@18 | |
257 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23 | |
258 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18 | |
259 char v197; // [sp+2Bh] [bp-5D1h]@101 | |
260 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7 | |
261 unsigned int v199; // [sp+30h] [bp-5CCh]@7 | |
262 char *v200; // [sp+34h] [bp-5C8h]@518 | |
263 POINT v202; // [sp+40h] [bp-5BCh]@141 | |
264 POINT a2; // [sp+48h] [bp-5B4h]@127 | |
265 POINT v205; // [sp+58h] [bp-5A4h]@171 | |
266 POINT v207; // [sp+68h] [bp-594h]@155 | |
267 POINT v211; // [sp+88h] [bp-574h]@704 | |
268 int v213; // [sp+98h] [bp-564h]@385 | |
269 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380 | |
270 char pOut[32]; // [sp+BCh] [bp-540h]@370 | |
271 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524 | |
272 int v217[9]; // [sp+158h] [bp-4A4h]@652 | |
273 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524 | |
274 char a1[64]; // [sp+1F8h] [bp-404h]@467 | |
275 char Str2[128]; // [sp+238h] [bp-3C4h]@527 | |
276 Actor actor; // [sp+2B8h] [bp-344h]@4 | |
277 int currHour; | |
278 | |
279 dword_50CDC8 = 0; | |
280 if (!pEventTimer->bPaused) | |
281 { | |
282 pParty->sEyelevel = pParty->uDefaultEyelevel; | |
283 pParty->uPartyHeight = pParty->uDefaultPartyHeight; | |
284 } | |
285 if (bDialogueUI_InitializeActor_NPC_ID) | |
286 { | |
287 //Actor::Actor(&actor); | |
288 memset(&actor, 0, 0x344u); | |
289 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID; | |
290 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID; | |
291 GameUI_InitializeDialogue(&actor, false); | |
292 bDialogueUI_InitializeActor_NPC_ID = 0; | |
293 } | |
294 if (pMessageQueue_50CBD0->uNumMessages) | |
295 { | |
296 //v1 = ""; | |
297 while (2) | |
298 { | |
299 if (!pMessageQueue_50CBD0->uNumMessages) | |
300 break; | |
301 | |
302 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199); | |
303 switch (uMessage) | |
304 { | |
305 case UIMSG_ChangeGameState: | |
306 uGameState = GAME_FINISHED; | |
307 continue; | |
308 case UIMSG_PlayArcomage: | |
309 BackToHouseMenu(); | |
310 pArcomageGame->bGameInProgress = 1; | |
311 ArcomageGame::PrepareArcomage(); | |
312 continue; | |
313 | |
314 case UIMSG_StartNPCDialogue: Game_StartDialogue(uMessageParam); continue; | |
315 case UIMSG_StartHireling1Dialogue: | |
316 case UIMSG_StartHireling2Dialogue: Game_StartHirelingDialogue(uMessage - UIMSG_StartHireling1Dialogue); continue; | |
317 case UIMSG_BuyInShop_Identify_Repair: UIShop_Buy_Identify_Repair(); continue; | |
318 case UIMSG_ClickNPCTopic: ClickNPCTopic(uMessageParam); continue; | |
319 case UIMSG_SelectShopDialogueOption: OnSelectShopDialogueOption(uMessageParam); continue; | |
320 case UIMSG_SelectNPCDialogueOption: OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam); continue; | |
321 case UIMSG_ClickHouseNPCPortrait: _4B4224_UpdateNPCTopics(uMessageParam); continue; | |
322 case UIMSG_StartNewGame: Game_StartNewGameWhilePlaying(uMessageParam); continue; | |
323 case UIMSG_Game_OpenLoadGameDialog: Game_OpenLoadGameDialog(); continue; | |
324 case UIMSG_Quit: Game_QuitGameWhilePlaying(uMessageParam); continue; | |
325 case UIMSG_80: | |
326 __debugbreak(); | |
327 pIcons_LOD->SyncLoadedFilesCount(); | |
328 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
329 pGUIWindow_CurrentMenu->Release(); | |
330 current_screen_type = SCREEN_OPTIONS; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
331 __debugbreak();//pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_8, 0, 0); |
2541 | 332 continue; |
333 case UIMSG_ArrowUp: | |
334 --pSaveListPosition; | |
335 if (pSaveListPosition < 0) | |
336 pSaveListPosition = 0; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
337 new OnButtonClick2(215, 199, 17, 17, (int)pBtnArrowUp, 0); |
2541 | 338 continue; |
339 case UIMSG_DownArrow: | |
340 ++pSaveListPosition; | |
341 if (pSaveListPosition >= uMessageParam) | |
342 pSaveListPosition = uMessageParam - 1; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
343 new OnButtonClick2(215, 323, 17, 17, (int)pBtnDownArrow, 0); |
2541 | 344 continue; |
345 case UIMSG_Cancel: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
346 new OnCancel(350, 302, 106, 42, (int)pBtnCancel, 0); |
2541 | 347 continue; |
348 case UIMSG_SaveLoadBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
349 new OnSaveLoad(241, 302, 106, 42, (int)pBtnLoadSlot, 0); |
2541 | 350 continue; |
351 case UIMSG_SelectLoadSlot: | |
352 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
353 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
354 if (current_screen_type != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam) | |
355 { | |
356 v10 = pSaveListPosition + uMessageParam; | |
357 if (dword_6BE138 == pSaveListPosition + uMessageParam) | |
358 { | |
359 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0); | |
360 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); | |
361 } | |
362 uLoadGameUI_SelectedSlot = v10; | |
363 dword_6BE138 = v10; | |
364 } | |
365 else | |
366 { | |
367 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); | |
368 if (strcmp(pSavegameHeader[uLoadGameUI_SelectedSlot].pName, pGlobalTXT_LocalizationStrings[72]))// "Empty" | |
369 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); | |
370 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer); | |
371 } | |
372 continue; | |
373 case UIMSG_LoadGame: | |
374 if (pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) | |
375 { | |
376 LoadGame(uLoadGameUI_SelectedSlot); | |
377 uGameState = GAME_STATE_LOADING_GAME; | |
378 } | |
379 stru_506E40.Release(); | |
380 continue; | |
381 case UIMSG_SaveGame: | |
382 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
383 { | |
384 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
385 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pKeyActionMap->pPressedKeysBuffer); | |
386 } | |
387 DoSavegame(uLoadGameUI_SelectedSlot); | |
388 stru_506E40.Release(); | |
389 continue; | |
390 case UIMSG_Game_OpenSaveGameDialog: | |
391 { | |
392 pGUIWindow_CurrentMenu->Release(); | |
393 pGUIWindow_CurrentMenu = SaveUI_Load(current_screen_type = SCREEN_SAVEGAME); | |
394 continue; | |
395 } | |
396 case UIMSG_Game_OpenOptionsDialog://Open | |
397 { | |
398 DoThatMessageThing(); | |
399 | |
400 pGUIWindow_CurrentMenu->Release(); | |
401 pGUIWindow_CurrentMenu = GameMenuUI_Options_Load(); | |
402 | |
403 viewparams->field_48 = 1; | |
404 current_screen_type = SCREEN_OPTIONS; | |
405 | |
406 continue; | |
407 } | |
408 | |
409 case UIMSG_OpenKeyMappingOptions://Open | |
410 { | |
411 DoThatMessageThing(); | |
412 | |
413 pGUIWindow_CurrentMenu->Release(); | |
414 pGUIWindow_CurrentMenu = GameMenuUI_OptionsKeymapping_Load(); | |
415 | |
416 viewparams->field_48 = 1; | |
417 current_screen_type = SCREEN_KEYBOARD_OPTIONS; | |
418 | |
419 continue; | |
420 } | |
421 | |
422 case UIMSG_ChangeKeyButton: | |
423 { | |
424 if (uGameMenuUI_CurentlySelectedKeyIdx != -1) | |
425 { | |
426 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
427 } | |
428 else | |
429 { | |
430 uGameMenuUI_CurentlySelectedKeyIdx = uMessageParam; | |
431 if (KeyboardPageNum != 1) | |
432 uGameMenuUI_CurentlySelectedKeyIdx += 14; | |
433 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); | |
434 } | |
435 continue; | |
436 } | |
437 | |
438 case UIMSG_ResetKeyMapping: | |
439 { | |
440 v197 = 1; | |
441 pKeyActionMap->SetDefaultMapping(); | |
442 for (uint i = 0; i < 28; i++) | |
443 { | |
444 if (pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i]) | |
445 { | |
446 if (v197) | |
447 { | |
448 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 1); | |
449 v197 = 0; | |
450 } | |
451 else | |
452 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 0); | |
453 } | |
454 pPrevVirtualCidesMapping[i] = pKeyActionMap->GetActionVKey((enum InputAction)i); | |
455 GameMenuUI_InvaligKeyBindingsFlags[i] = false; | |
456 } | |
457 pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0, 0, 0); | |
458 continue; | |
459 } | |
460 | |
461 case UIMSG_SelectKeyPage1: | |
462 KeyboardPageNum = 1; | |
463 continue; | |
464 case UIMSG_SelectKeyPage2: | |
465 KeyboardPageNum = 2; | |
466 continue; | |
467 | |
468 case UIMSG_OpenVideoOptions: | |
469 { | |
470 DoThatMessageThing(); | |
471 | |
472 pGUIWindow_CurrentMenu->Release(); | |
473 pGUIWindow_CurrentMenu = GameMenuUI_OptionsVideo_Load(); | |
474 viewparams->field_48 = 1; | |
475 current_screen_type = SCREEN_VIDEO_OPTIONS; | |
476 | |
477 continue; | |
478 } | |
479 | |
480 case UIMSG_1A9: | |
481 __debugbreak(); | |
482 if (uMessageParam == 4) | |
483 { | |
484 //--uGammaPos; | |
485 if ((uGammaPos-- - 1) < 0) | |
486 { | |
487 uGammaPos = 0; | |
488 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0); | |
489 continue; | |
490 } | |
491 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
492 //pEngine->pGammaController->Initialize(v19); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
493 new OnButtonClick2(21, 161, 0, 0, (int)pBtn_SliderLeft, (char *)1); |
2541 | 494 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0); |
495 continue; | |
496 } | |
497 if (uMessageParam == 5) | |
498 { | |
499 ++uGammaPos; | |
500 if ((signed int)uGammaPos <= 9) | |
501 { | |
502 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
503 //pEngine->pGammaController->Initialize(v21); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
504 new OnButtonClick2(213, 161, 0, 0, (int)pBtn_SliderRight, (char *)1); |
2541 | 505 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0); |
506 continue; | |
507 } | |
508 uGammaPos = 9; | |
509 } | |
510 else | |
511 { | |
512 uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17; | |
513 v22 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
514 //pEngine->pGammaController->Initialize(v22); | |
515 } | |
516 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0); | |
517 continue; | |
518 case UIMSG_ToggleBloodsplats: | |
519 pEngine->ToggleFlags2(0x20u); | |
520 continue; | |
521 case UIMSG_ToggleColoredLights: | |
522 pRenderer->ToggleColoredLights(); | |
523 continue; | |
524 case UIMSG_ToggleTint: | |
525 pRenderer->ToggleTint(); | |
526 continue; | |
527 case UIMSG_ChangeMusicVolume: | |
528 extern bool use_music_folder; | |
529 if (uMessageParam == 4)//- | |
530 { | |
531 --uMusicVolimeMultiplier; | |
532 if ((char)uMusicVolimeMultiplier < 1) | |
533 uMusicVolimeMultiplier = 0; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
534 new OnButtonClick2(243, 216, 0, 0, (int)pBtn_SliderLeft, (char *)1); |
2541 | 535 if (uMusicVolimeMultiplier) |
536 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); | |
537 | |
538 if (use_music_folder) | |
539 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
540 else | |
541 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
542 | |
543 continue; | |
544 } | |
545 if (uMessageParam == 5)//+ | |
546 { | |
547 ++uMusicVolimeMultiplier; | |
548 if ((char)uMusicVolimeMultiplier > 9) | |
549 uMusicVolimeMultiplier = 9; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
550 new OnButtonClick2(435, 216, 0, 0, (int)pBtn_SliderRight, (char *)1); |
2541 | 551 if (uMusicVolimeMultiplier) |
552 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); | |
553 if (use_music_folder) | |
554 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
555 else | |
556 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
557 continue; | |
558 } | |
559 uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//for mouse | |
560 if ((char)uMusicVolimeMultiplier > 9) | |
561 uMusicVolimeMultiplier = 9; | |
562 if (uMusicVolimeMultiplier) | |
563 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); | |
564 if (use_music_folder) | |
565 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
566 else | |
567 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
568 continue; | |
569 case UIMSG_ChangeSoundVolume: | |
570 if (uMessageParam == 4)//reduce sound level button left | |
571 { | |
572 --uSoundVolumeMultiplier; | |
573 if ((char)uSoundVolumeMultiplier < 1) | |
574 uSoundVolumeMultiplier = 0; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
575 new OnButtonClick2(243, 162, 0, 0, (int)pBtn_SliderLeft, (char *)1); |
2541 | 576 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
577 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0); | |
578 int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook); | |
579 //v = v+1; | |
580 if (v) | |
581 __debugbreak(); | |
582 continue; | |
583 } | |
584 if (uMessageParam == 5)//Increase sound level button right | |
585 { | |
586 ++uSoundVolumeMultiplier; | |
587 if ((char)uSoundVolumeMultiplier > 8) | |
588 uSoundVolumeMultiplier = 9; | |
589 //v168 = 1; | |
590 v24 = 435; | |
591 //v154 = (int)pBtn_SliderRight; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
592 new OnButtonClick2(v24, 162, 0, 0, (int)pBtn_SliderRight, (char *)1); |
2541 | 593 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
594 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0); | |
595 continue; | |
596 } | |
597 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; | |
598 if ((char)uSoundVolumeMultiplier > 8) | |
599 uSoundVolumeMultiplier = 9; | |
600 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); | |
601 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0); | |
602 continue; | |
603 case UIMSG_ToggleFlipOnExit: | |
604 bFlipOnExit = bFlipOnExit == 0; | |
605 continue; | |
606 case UIMSG_ToggleAlwaysRun: | |
607 bAlwaysRun = bAlwaysRun == 0; | |
608 continue; | |
609 case UIMSG_ToggleWalkSound: | |
610 bWalkSound = bWalkSound == 0; | |
611 continue; | |
612 case UIMSG_ToggleShowDamage: | |
613 bShowDamage = bShowDamage == 0; | |
614 continue; | |
615 case UIMSG_ChangeVoiceVolume: | |
616 if (uMessageParam == 4) | |
617 { | |
618 --uVoicesVolumeMultiplier; | |
619 if ((char)uVoicesVolumeMultiplier < 1) | |
620 uVoicesVolumeMultiplier = 0; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
621 new OnButtonClick2(243, 270, 0, 0, (int)pBtn_SliderLeft, (char *)1); |
2541 | 622 if (!uVoicesVolumeMultiplier) |
623 continue; | |
624 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
625 continue; | |
626 } | |
627 if (uMessageParam == 5) | |
628 { | |
629 ++uVoicesVolumeMultiplier; | |
630 if ((char)uVoicesVolumeMultiplier > 8) | |
631 uVoicesVolumeMultiplier = 9; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
632 new OnButtonClick2(435, 270, 0, 0, (int)pBtn_SliderRight, (char *)1); |
2541 | 633 if (!uVoicesVolumeMultiplier) |
634 continue; | |
635 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
636 continue; | |
637 } | |
638 uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17; | |
639 if ((char)uVoicesVolumeMultiplier > 8) | |
640 uVoicesVolumeMultiplier = 9; | |
641 if (!uVoicesVolumeMultiplier) | |
642 continue; | |
643 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
644 continue; | |
645 case UIMSG_SetTurnSpeed: | |
646 if (uMessageParam) | |
647 pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam; | |
648 uTurnSpeed = uMessageParam; | |
649 continue; | |
650 | |
651 case UIMSG_SetGraphicsMode: | |
652 /*if ( !bUseLoResSprites ) | |
653 { | |
654 byte_6BE388_graphicsmode = uMessageParam; | |
655 MM7Initialization(); | |
656 continue; | |
657 } | |
658 if ( uMessageParam ) | |
659 { | |
660 if ( uMessageParam == 1 ) | |
661 { | |
662 byte_6BE388_graphicsmode = 0; | |
663 } | |
664 else | |
665 { | |
666 if ( uMessageParam != 2 ) | |
667 continue; | |
668 byte_6BE388_graphicsmode = 1; | |
669 } | |
670 MM7Initialization(); | |
671 continue; | |
672 }*/ | |
673 ModalWindow(pNPCTopics[453].pText, UIMSG_0); | |
674 __debugbreak(); // Nomad: graphicsmode as it was now removed | |
675 continue; | |
676 | |
677 case UIMSG_GameMenu_ReturnToGame: | |
678 pGUIWindow_CurrentMenu->Release(); | |
679 pEventTimer->Resume(); | |
680 current_screen_type = SCREEN_GAME; | |
681 viewparams->bRedrawGameUI = 1; | |
682 stru_506E40.Release(); | |
683 continue; | |
684 case UIMSG_OpenQuestBook: | |
685 DoThatMessageThing(); | |
2542 | 686 if (current_screen_type != SCREEN_GAME) |
2541 | 687 pGUIWindow_CurrentMenu->Release(); |
688 pEventTimer->Pause(); | |
689 pAudioPlayer->StopChannels(-1, -1); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
690 pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
691 pBooksWindow = new GUIWindow_BooksWindow(493u, 355u, 0, 0, (int)pBtn_Quests, 0); |
2541 | 692 bFlashQuestBook = 0; |
693 continue; | |
694 case UIMSG_OpenAutonotes: | |
695 DoThatMessageThing(); | |
2542 | 696 if (current_screen_type != SCREEN_GAME) |
2541 | 697 pGUIWindow_CurrentMenu->Release(); |
698 pEventTimer->Pause(); | |
699 pAudioPlayer->StopChannels(-1, -1); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
700 pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
701 pBooksWindow = new GUIWindow_BooksWindow(527u, 353u, 0, 0, (int)pBtn_Autonotes, 0); |
2541 | 702 bFlashAutonotesBook = 0; |
703 continue; | |
704 case UIMSG_OpenMapBook: | |
705 DoThatMessageThing(); | |
2542 | 706 if (current_screen_type != SCREEN_GAME) |
2541 | 707 pGUIWindow_CurrentMenu->Release(); |
708 pEventTimer->Pause(); | |
709 viewparams->sViewCenterX = pParty->vPosition.x; | |
710 viewparams->sViewCenterY = pParty->vPosition.y; | |
711 pAudioPlayer->StopChannels(-1, -1); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
712 pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
713 pBooksWindow = new GUIWindow_BooksWindow(546, 353, 0, 0, (int)pBtn_Maps, 0); |
2541 | 714 continue; |
715 case UIMSG_OpenCalendar: | |
716 DoThatMessageThing(); | |
2542 | 717 if (current_screen_type != SCREEN_GAME) |
2541 | 718 pGUIWindow_CurrentMenu->Release(); |
719 pEventTimer->Pause(); | |
720 pAudioPlayer->StopChannels(-1, -1); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
721 pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
722 pBooksWindow = new GUIWindow_BooksWindow(570, 354, 0, 0, (int)pBtn_Calendar, 0); |
2541 | 723 continue; |
724 case UIMSG_OpenHistoryBook: | |
725 DoThatMessageThing(); | |
2542 | 726 if (current_screen_type != SCREEN_GAME) |
2541 | 727 pGUIWindow_CurrentMenu->Release(); |
728 pEventTimer->Pause(); | |
729 pAudioPlayer->StopChannels(-1, -1); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
730 pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
731 pBooksWindow = new GUIWindow_BooksWindow(0x258u, 0x169u, 0, 0, (int)pBtn_History, 0); |
2541 | 732 bFlashHistoryBook = 0; |
733 continue; | |
734 case UIMSG_Escape:// нажатие Escape and return to game | |
735 back_to_game(); | |
736 DoThatMessageThing(); | |
737 switch (current_screen_type) | |
738 { | |
739 case SCREEN_E: | |
740 __debugbreak(); | |
741 case SCREEN_NPC_DIALOGUE: | |
742 case SCREEN_CHEST: | |
743 case SCREEN_CHEST_INVENTORY: | |
744 case SCREEN_CHANGE_LOCATION: | |
745 case SCREEN_INPUT_BLV: | |
746 case SCREEN_QUICK_REFERENCE: | |
747 if (dword_50CDC8) | |
748 break; | |
749 CloseWindowBackground(); | |
750 uMessageParam = 1; | |
751 break; | |
752 case SCREEN_HOUSE: | |
753 if (!dword_50CDC8) | |
754 { | |
755 CloseWindowBackground(); | |
756 uMessageParam = 1; | |
757 break; | |
758 } | |
759 break; | |
760 } | |
761 if (!pModalWindow) | |
762 { | |
763 pRenderer->ClearZBuffer(0, 479); | |
764 viewparams->bRedrawGameUI = 1; | |
765 viewparams->field_48 = 1; | |
2542 | 766 if (current_screen_type != SCREEN_GAME) |
2541 | 767 { |
768 if (current_screen_type > SCREEN_67) | |
769 { | |
770 if (current_screen_type == SCREEN_QUICK_REFERENCE) | |
771 { | |
772 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
773 if (pGUIWindow_Settings) | |
774 { | |
775 if (current_screen_type == SCREEN_CHARACTERS) | |
776 pMouse->SetCursorBitmap("MICON2"); | |
777 else | |
778 { | |
779 pGUIWindow_Settings->Release(); | |
780 pGUIWindow_Settings = 0; | |
781 pMouse->SetCursorBitmap("MICON1"); | |
782 GameUI_Footer_TimeLeft = 0; | |
783 _50C9A0_IsEnchantingInProgress = 0; | |
784 back_to_game(); | |
785 } | |
786 } | |
787 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
788 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
789 pGUIWindow_CurrentMenu->Release(); | |
790 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
791 window_SpeakInHouse = 0; | |
792 pGUIWindow_CurrentMenu = 0; | |
793 pEventTimer->Resume(); | |
794 current_screen_type = SCREEN_GAME; | |
795 viewparams->bRedrawGameUI = 1; | |
796 pIcons_LOD->RemoveTexturesFromTextureList(); | |
797 continue; | |
798 } | |
799 } | |
800 else | |
801 { | |
802 if (current_screen_type < SCREEN_64) | |
803 { | |
804 switch (current_screen_type) | |
805 { | |
806 case SCREEN_CASTING: | |
807 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
808 if (some_active_character) | |
809 { | |
810 uActiveCharacter = some_active_character; | |
811 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
812 some_active_character = 0; | |
813 if (pParty->bTurnBasedModeOn) | |
814 pTurnEngine->ApplyPlayerAction(); | |
815 _50C9D0_AfterEnchClickEventId = 0; | |
816 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
817 _50C9D8_AfterEnchClickEventTimeout = 0; | |
818 } | |
819 if (ptr_50C9A4_ItemToEnchant && ptr_50C9A4_ItemToEnchant->uItemID) | |
820 { | |
821 LOBYTE(ptr_50C9A4_ItemToEnchant->uAttributes) &= 0xFu; | |
822 _50C9A8_item_enchantment_timer = 0; | |
823 ptr_50C9A4_ItemToEnchant = nullptr; | |
824 } | |
825 if (pGUIWindow_Settings) | |
826 { | |
827 if (current_screen_type == SCREEN_CHARACTERS) | |
828 pMouse->SetCursorBitmap("MICON2"); | |
829 else | |
830 { | |
831 pGUIWindow_Settings->Release(); | |
832 pGUIWindow_Settings = 0; | |
833 pMouse->SetCursorBitmap("MICON1"); | |
834 GameUI_Footer_TimeLeft = 0; | |
835 _50C9A0_IsEnchantingInProgress = 0; | |
836 back_to_game(); | |
837 } | |
838 } | |
839 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
840 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
841 pGUIWindow_CurrentMenu->Release(); | |
842 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
843 window_SpeakInHouse = 0; | |
844 pGUIWindow_CurrentMenu = 0; | |
845 pEventTimer->Resume(); | |
846 current_screen_type = SCREEN_GAME; | |
847 viewparams->bRedrawGameUI = 1; | |
848 pIcons_LOD->RemoveTexturesFromTextureList(); | |
849 continue; | |
850 case SCREEN_BOOKS: | |
851 pBooksWindow->Release(); | |
852 //crt_deconstruct_ptr_6A0118(); | |
853 pBooksWindow = 0; | |
854 pEventTimer->Resume(); | |
855 if (pGUIWindow_Settings) | |
856 { | |
857 if (current_screen_type == SCREEN_CHARACTERS) | |
858 pMouse->SetCursorBitmap("MICON2"); | |
859 else | |
860 { | |
861 pGUIWindow_Settings->Release(); | |
862 pGUIWindow_Settings = 0; | |
863 pMouse->SetCursorBitmap("MICON1"); | |
864 GameUI_Footer_TimeLeft = 0; | |
865 _50C9A0_IsEnchantingInProgress = 0; | |
866 back_to_game(); | |
867 } | |
868 } | |
869 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
870 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
871 pGUIWindow_CurrentMenu->Release(); | |
872 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
873 window_SpeakInHouse = 0; | |
874 pGUIWindow_CurrentMenu = 0; | |
875 pEventTimer->Resume(); | |
876 current_screen_type = SCREEN_GAME; | |
877 viewparams->bRedrawGameUI = 1; | |
878 pIcons_LOD->RemoveTexturesFromTextureList(); | |
879 continue; | |
880 case SCREEN_SAVEGAME: | |
881 case SCREEN_LOADGAME: | |
882 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
883 //crt_deconstruct_ptr_6A0118(); | |
884 stru_506E40.Release(); | |
885 break; | |
886 case SCREEN_CHEST_INVENTORY: | |
887 current_screen_type = SCREEN_CHEST; | |
888 continue; | |
889 case SCREEN_CHEST: | |
890 pWindow2 = pChestWindow; | |
891 pWindow2->Release(); | |
892 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
893 current_screen_type = SCREEN_GAME; | |
894 viewparams->bRedrawGameUI = 1; | |
895 pEventTimer->Resume(); | |
896 continue; | |
897 case SCREEN_19: | |
898 __debugbreak(); | |
899 pWindow2 = ptr_507BC8; | |
900 pWindow2->Release(); | |
901 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
902 current_screen_type = SCREEN_GAME; | |
903 viewparams->bRedrawGameUI = 1; | |
904 pEventTimer->Resume(); | |
905 continue; | |
906 case SCREEN_OPTIONS://Close | |
907 options_menu_skin.Relaease(); | |
908 pIcons_LOD->SyncLoadedFilesCount(); | |
909 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); | |
910 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); | |
911 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier); | |
912 WriteWindowsRegistryInt("WalkSound", bWalkSound); | |
913 WriteWindowsRegistryInt("ShowDamage", bShowDamage); | |
914 //WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode); | |
915 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); | |
916 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit); | |
917 if (!uTurnSpeed) | |
918 { | |
919 WriteWindowsRegistryInt("TurnDelta", 3); | |
920 stru_506E40.Release(); | |
921 break; | |
922 } | |
923 if (uTurnSpeed == 64) | |
924 { | |
925 WriteWindowsRegistryInt("TurnDelta", 2); | |
926 stru_506E40.Release(); | |
927 break; | |
928 } | |
929 if (uTurnSpeed != 128) | |
930 { | |
931 stru_506E40.Release(); | |
932 break; | |
933 } | |
934 WriteWindowsRegistryInt("TurnDelta", 1); | |
935 stru_506E40.Release(); | |
936 break; | |
937 case SCREEN_MENU: | |
938 pIcons_LOD->SyncLoadedFilesCount(); | |
939 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
940 pIcons_LOD->SyncLoadedFilesCount(); | |
941 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
942 stru_506E40.Release(); | |
943 break; | |
944 case SCREEN_VIDEO_OPTIONS: | |
945 //if ( pRenderer->pRenderD3D ) | |
946 { | |
947 WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights); | |
948 WriteWindowsRegistryInt("Tinting", pRenderer->bTinting); | |
949 WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pEngine->uFlags2) >> 5) & 1); | |
950 } | |
951 | |
952 stru_506E40.Release(); | |
953 break; | |
954 | |
955 case SCREEN_KEYBOARD_OPTIONS://Return to game | |
956 v197 = 1; | |
957 pKeyBindingFlag = false; | |
958 for (uint i = 0; i < 28; ++i) | |
959 { | |
960 if (GameMenuUI_InvaligKeyBindingsFlags[i]) | |
961 pKeyBindingFlag = true; | |
962 } | |
963 if (!pKeyBindingFlag) | |
964 { | |
965 for (uint i = 0; i < 5; i++) | |
966 { | |
967 if (uTextureID_Optkb[i]) | |
968 pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release(); | |
969 } | |
970 memset(&uTextureID_Optkb, 0, 20); | |
971 pIcons_LOD->SyncLoadedFilesCount(); | |
972 for (uint i = 0; i < 28; ++i) | |
973 { | |
974 if (pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i]) | |
975 { | |
976 if (v197) | |
977 { | |
978 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1); | |
979 v197 = 0; | |
980 } | |
981 else | |
982 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0); | |
983 } | |
984 if (i > 3 && i != 25 && i != 26) | |
985 pKeyToggleType = TOGGLE_OneTimePress; | |
986 else | |
987 pKeyToggleType = TOGGLE_Continuously; | |
988 pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType); | |
989 } | |
990 pKeyActionMap->StoreMappings(); | |
991 stru_506E40.Release(); | |
992 break; | |
993 } | |
994 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
995 break; | |
996 case SCREEN_REST://close rest screen | |
2543 | 997 if (_506F14_resting_stage) |
2541 | 998 { |
999 Rest(_506F18_num_minutes_to_sleep); | |
1000 pParty->pPlayers[3].SetAsleep(false); | |
1001 pParty->pPlayers[2].SetAsleep(false); | |
1002 pParty->pPlayers[1].SetAsleep(false); | |
1003 pParty->pPlayers[0].SetAsleep(false); | |
1004 } | |
1005 pTexture_RestUI_CurrentSkyFrame->Release(); | |
1006 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
1007 pTexture_RestUI_CurrentHourglassFrame = 0; | |
1008 pTexture_RestUI_CurrentSkyFrame = 0; | |
1009 pIcons_LOD->SyncLoadedFilesCount(); | |
1010 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1011 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1012 { | |
1013 pOutdoor->UpdateSunlightVectors(); | |
1014 pOutdoor->UpdateFog(); | |
1015 } | |
1016 _506F18_num_minutes_to_sleep = 0; | |
2543 | 1017 _506F14_resting_stage = 0; |
2541 | 1018 if (pGUIWindow_Settings) |
1019 { | |
1020 if (current_screen_type == SCREEN_CHARACTERS) | |
1021 pMouse->SetCursorBitmap("MICON2"); | |
1022 else | |
1023 { | |
1024 pGUIWindow_Settings->Release(); | |
1025 pGUIWindow_Settings = 0; | |
1026 pMouse->SetCursorBitmap("MICON1"); | |
1027 GameUI_Footer_TimeLeft = 0; | |
1028 _50C9A0_IsEnchantingInProgress = 0; | |
1029 back_to_game(); | |
1030 } | |
1031 } | |
1032 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
1033 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1034 pGUIWindow_CurrentMenu->Release(); | |
1035 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
1036 window_SpeakInHouse = 0; | |
1037 pGUIWindow_CurrentMenu = 0; | |
1038 pEventTimer->Resume(); | |
1039 current_screen_type = SCREEN_GAME; | |
1040 viewparams->bRedrawGameUI = 1; | |
1041 pIcons_LOD->RemoveTexturesFromTextureList(); | |
1042 continue; | |
1043 case SCREEN_E: | |
1044 __debugbreak(); | |
1045 pGUIWindow_CurrentMenu->Release(); | |
1046 current_screen_type = SCREEN_HOUSE; | |
1047 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1048 continue; | |
1049 case SCREEN_HOUSE: | |
1050 if (uDialogueType) | |
1051 uDialogueType = 0; | |
1052 if (uGameState == GAME_STATE_CHANGE_LOCATION) | |
1053 { | |
1054 while (HouseDialogPressCloseBtn()) | |
1055 ; | |
1056 } | |
1057 else | |
1058 { | |
1059 if (HouseDialogPressCloseBtn()) | |
1060 continue; | |
1061 } | |
1062 GetHouseGoodbyeSpeech(); | |
1063 pAudioPlayer->PlaySound(SOUND_WoodDoorClosing, 814, 0, -1, 0, 0, 0, 0); | |
1064 pMediaPlayer->Unload(); | |
1065 pGUIWindow_CurrentMenu = window_SpeakInHouse; | |
1066 if (pGUIWindow_Settings) | |
1067 { | |
1068 if (current_screen_type == SCREEN_CHARACTERS) | |
1069 pMouse->SetCursorBitmap("MICON2"); | |
1070 else | |
1071 { | |
1072 pGUIWindow_Settings->Release(); | |
1073 pGUIWindow_Settings = 0; | |
1074 pMouse->SetCursorBitmap("MICON1"); | |
1075 GameUI_Footer_TimeLeft = 0; | |
1076 _50C9A0_IsEnchantingInProgress = 0; | |
1077 back_to_game(); | |
1078 } | |
1079 } | |
1080 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
1081 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1082 pGUIWindow_CurrentMenu->Release(); | |
1083 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
1084 window_SpeakInHouse = 0; | |
1085 pGUIWindow_CurrentMenu = 0; | |
1086 pEventTimer->Resume(); | |
1087 current_screen_type = SCREEN_GAME; | |
1088 viewparams->bRedrawGameUI = true; | |
1089 pIcons_LOD->RemoveTexturesFromTextureList(); | |
1090 continue; | |
1091 case SCREEN_INPUT_BLV://click escape | |
1092 if (uCurrentHouse_Animation == 153) | |
1093 PlayHouseSound(0x99u, HouseSound_Greeting_2); | |
1094 pMediaPlayer->Unload(); | |
1095 if (npcIdToDismissAfterDialogue) | |
1096 { | |
1097 pParty->hirelingScrollPosition = 0; | |
1098 LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu; | |
1099 pParty->CountHirelings(); | |
1100 viewparams->bRedrawGameUI = true; | |
1101 npcIdToDismissAfterDialogue = 0; | |
1102 } | |
1103 DialogueEnding(); | |
1104 current_screen_type = SCREEN_GAME; | |
1105 viewparams->bRedrawGameUI = true; | |
1106 continue; | |
1107 case SCREEN_NPC_DIALOGUE://click escape | |
1108 if (npcIdToDismissAfterDialogue) | |
1109 { | |
1110 pParty->hirelingScrollPosition = 0; | |
1111 LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu; | |
1112 pParty->CountHirelings(); | |
1113 viewparams->bRedrawGameUI = true; | |
1114 npcIdToDismissAfterDialogue = 0; | |
1115 } | |
1116 //goto LABEL_317; | |
1117 DialogueEnding(); | |
1118 current_screen_type = SCREEN_GAME; | |
1119 viewparams->bRedrawGameUI = true; | |
1120 continue; | |
1121 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape | |
1122 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); | |
1123 sub_4452BB(); | |
1124 DialogueEnding(); | |
1125 current_screen_type = SCREEN_GAME; | |
1126 viewparams->bRedrawGameUI = true; | |
1127 continue; | |
1128 case SCREEN_CHANGE_LOCATION://click escape | |
1129 if (pParty->vPosition.x < -22528) | |
1130 pParty->vPosition.x = -22528; | |
1131 if (pParty->vPosition.x > 22528) | |
1132 pParty->vPosition.x = 22528; | |
1133 if (pParty->vPosition.y < -22528) | |
1134 pParty->vPosition.y = -22528; | |
1135 if (pParty->vPosition.y > 22528) | |
1136 pParty->vPosition.y = 22528; | |
1137 DialogueEnding(); | |
1138 current_screen_type = SCREEN_GAME; | |
1139 viewparams->bRedrawGameUI = true; | |
1140 continue; | |
1141 case SCREEN_VIDEO: | |
1142 pMediaPlayer->Unload(); | |
1143 continue; | |
1144 case SCREEN_CHARACTERS: | |
1145 CharacterUI_ReleaseButtons(); | |
1146 ReleaseAwardsScrollBar(); | |
1147 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1148 if (pGUIWindow_Settings) | |
1149 { | |
1150 if (current_screen_type == SCREEN_CHARACTERS) | |
1151 pMouse->SetCursorBitmap("MICON2"); | |
1152 else | |
1153 { | |
1154 pGUIWindow_Settings->Release(); | |
1155 pGUIWindow_Settings = 0; | |
1156 pMouse->SetCursorBitmap("MICON1"); | |
1157 GameUI_Footer_TimeLeft = 0; | |
1158 _50C9A0_IsEnchantingInProgress = 0; | |
1159 back_to_game(); | |
1160 } | |
1161 } | |
1162 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
1163 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1164 pGUIWindow_CurrentMenu->Release(); | |
1165 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
1166 window_SpeakInHouse = 0; | |
1167 pGUIWindow_CurrentMenu = 0; | |
1168 pEventTimer->Resume(); | |
1169 current_screen_type = SCREEN_GAME; | |
1170 viewparams->bRedrawGameUI = true; | |
1171 pIcons_LOD->RemoveTexturesFromTextureList(); | |
1172 continue; | |
1173 default: | |
1174 if (pGUIWindow_Settings) | |
1175 { | |
1176 if (current_screen_type == SCREEN_CHARACTERS) | |
1177 pMouse->SetCursorBitmap("MICON2"); | |
1178 else | |
1179 { | |
1180 pGUIWindow_Settings->Release(); | |
1181 pGUIWindow_Settings = 0; | |
1182 pMouse->SetCursorBitmap("MICON1"); | |
1183 GameUI_Footer_TimeLeft = 0; | |
1184 _50C9A0_IsEnchantingInProgress = 0; | |
1185 back_to_game(); | |
1186 } | |
1187 } | |
1188 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
1189 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1190 pGUIWindow_CurrentMenu->Release(); | |
1191 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
1192 window_SpeakInHouse = 0; | |
1193 pGUIWindow_CurrentMenu = 0; | |
1194 pEventTimer->Resume(); | |
1195 current_screen_type = SCREEN_GAME; | |
1196 viewparams->bRedrawGameUI = 1; | |
1197 pIcons_LOD->RemoveTexturesFromTextureList(); | |
1198 continue; | |
1199 } | |
1200 if (pGUIWindow_Settings) | |
1201 { | |
1202 if (current_screen_type == SCREEN_CHARACTERS) | |
1203 pMouse->SetCursorBitmap("MICON2"); | |
1204 else | |
1205 { | |
1206 pGUIWindow_Settings->Release(); | |
1207 pGUIWindow_Settings = 0; | |
1208 pMouse->SetCursorBitmap("MICON1"); | |
1209 GameUI_Footer_TimeLeft = 0; | |
1210 _50C9A0_IsEnchantingInProgress = 0; | |
1211 back_to_game(); | |
1212 } | |
1213 } | |
1214 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
1215 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1216 pGUIWindow_CurrentMenu->Release(); | |
1217 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
1218 window_SpeakInHouse = 0; | |
1219 pGUIWindow_CurrentMenu = 0; | |
1220 pEventTimer->Resume(); | |
1221 current_screen_type = SCREEN_GAME; | |
1222 viewparams->bRedrawGameUI = true; | |
1223 pIcons_LOD->RemoveTexturesFromTextureList(); | |
1224 continue; | |
1225 } | |
1226 CharacterUI_ReleaseButtons(); | |
1227 ReleaseAwardsScrollBar(); | |
1228 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1229 } | |
1230 if (pGUIWindow_Settings) | |
1231 { | |
1232 if (current_screen_type == SCREEN_CHARACTERS) | |
1233 pMouse->SetCursorBitmap("MICON2"); | |
1234 else | |
1235 { | |
1236 pGUIWindow_Settings->Release(); | |
1237 pGUIWindow_Settings = 0; | |
1238 pMouse->SetCursorBitmap("MICON1"); | |
1239 GameUI_Footer_TimeLeft = 0; | |
1240 _50C9A0_IsEnchantingInProgress = 0; | |
1241 back_to_game(); | |
1242 } | |
1243 } | |
1244 if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4) | |
1245 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1246 pGUIWindow_CurrentMenu->Release(); | |
1247 if (pGUIWindow_CurrentMenu == window_SpeakInHouse) | |
1248 window_SpeakInHouse = 0; | |
1249 pGUIWindow_CurrentMenu = 0; | |
1250 pEventTimer->Resume(); | |
1251 current_screen_type = SCREEN_GAME; | |
1252 viewparams->bRedrawGameUI = true; | |
1253 pIcons_LOD->RemoveTexturesFromTextureList(); | |
1254 continue; | |
1255 } | |
1256 if (!pGUIWindow_Settings)//Draw Menu | |
1257 { | |
1258 dword_6BE138 = -1; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1259 new OnButtonClick2(0x25Au, 0x1C2u, 0, 0, (int)pBtn_GameSettings, (char *)1); |
2541 | 1260 pEventTimer->Pause(); |
1261 pAudioPlayer->StopChannels(-1, -1); | |
1262 current_screen_type = SCREEN_MENU; | |
1263 | |
1264 ++pIcons_LOD->uTexturePacksCount; | |
1265 if (!pIcons_LOD->uNumPrevLoadedFiles) | |
1266 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1267 | |
2542 | 1268 pGUIWindow_CurrentMenu = GameMenuUI_Load(); |
1269 | |
2541 | 1270 viewparams->field_48 = 1; |
1271 | |
1272 stru_506E40.Release(); | |
1273 pRenderer->SaveScreenshot("gamma.pcx", 155, 117); | |
1274 stru_506E40.LoadPCXFile("gamma.pcx", 0); | |
1275 | |
1276 continue; | |
1277 } | |
1278 pGUIWindow_Settings->Release(); | |
1279 pGUIWindow_Settings = 0; | |
1280 pMouse->SetCursorBitmap("MICON1"); | |
1281 GameUI_Footer_TimeLeft = 0; | |
1282 _50C9A0_IsEnchantingInProgress = 0; | |
1283 back_to_game(); | |
1284 continue; | |
1285 } | |
1286 ModalWindow_Release(); | |
1287 continue; | |
2542 | 1288 |
2541 | 1289 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel |
1290 if (uMessageParam) | |
1291 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1292 new OnButtonClick2(626, 179, 0, 0, (int)pBtn_NPCRight, 0); |
2541 | 1293 v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2; |
1294 if (pParty->hirelingScrollPosition < v37) | |
1295 { | |
1296 ++pParty->hirelingScrollPosition;//??? maybe number of the first cell??? | |
1297 if (pParty->hirelingScrollPosition >= v37) | |
1298 pParty->hirelingScrollPosition = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2; | |
1299 } | |
1300 } | |
1301 else | |
1302 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1303 new OnButtonClick2(469, 179, 0, 0, (int)pBtn_NPCLeft, 0); |
2541 | 1304 /*if ( pParty->field_709 ) |
1305 { | |
1306 --pParty->field_709; | |
1307 if ( pParty->field_709 < 1 ) | |
1308 pParty->field_709 = 0; | |
1309 }*/ | |
1310 } | |
1311 GameUI_DrawHiredNPCs(); | |
1312 continue; | |
2542 | 1313 |
2541 | 1314 case UIMSG_TransitionUI_Confirm: |
1315 DoThatMessageThing(); | |
1316 dword_50CDC8 = 1; | |
1317 sub_42FBDD(); | |
1318 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1319 | |
1320 if (pMovie_Track) | |
1321 pMediaPlayer->Unload(); | |
1322 DialogueEnding(); | |
1323 viewparams->bRedrawGameUI = true; | |
1324 if (dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz) | |
1325 { | |
1326 if (dword_59117C_teleportx) | |
1327 { | |
1328 pParty->vPosition.x = dword_59117C_teleportx; | |
1329 _5B65A8_npcdata_uflags_or_other = dword_59117C_teleportx; | |
1330 } | |
1331 if (dword_591178_teleporty) | |
1332 { | |
1333 pParty->vPosition.y = dword_591178_teleporty; | |
1334 _5B65AC_npcdata_fame_or_other = dword_591178_teleporty; | |
1335 } | |
1336 if (dword_591174_teleportz) | |
1337 { | |
1338 pParty->vPosition.z = dword_591174_teleportz; | |
1339 _5B65B0_npcdata_rep_or_other = dword_591174_teleportz; | |
1340 pParty->uFallStartY = dword_591174_teleportz; | |
1341 } | |
1342 if (dword_591170_teleport_directiony) | |
1343 { | |
1344 pParty->sRotationY = dword_591170_teleport_directiony; | |
1345 _5B65B4_npcdata_loword_house_or_other = dword_591170_teleport_directiony; | |
1346 } | |
1347 if (dword_59116C_teleport_directionx) | |
1348 { | |
1349 pParty->sRotationX = dword_59116C_teleport_directionx; | |
1350 _5B65B8_npcdata_hiword_house_or_other = dword_59116C_teleport_directionx; | |
1351 v38 = dword_591168_teleport_speedz; | |
1352 pParty->uFallSpeed = dword_591168_teleport_speedz; | |
1353 dword_5B65BC = dword_591168_teleport_speedz; | |
1354 } | |
1355 else | |
1356 v38 = dword_5B65BC; | |
1357 if (*dword_591164_teleport_map_name != 48) | |
1358 { | |
1359 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)2; | |
1360 dword_5B65C0 = _5B65A8_npcdata_uflags_or_other | _5B65AC_npcdata_fame_or_other | _5B65B0_npcdata_rep_or_other | _5B65B4_npcdata_loword_house_or_other | _5B65B8_npcdata_hiword_house_or_other | v38; | |
1361 OnMapLeave(); | |
1362 Transition_StopSound_Autosave(dword_591164_teleport_map_name, MapStartPoint_Party); | |
1363 } | |
1364 } | |
1365 else | |
1366 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); | |
1367 if (!_stricmp(byte_6BE3B0.data(), "d05.blv")) | |
1368 pParty->uTimePlayed += 1474560i64; | |
1369 continue; | |
1370 case UIMSG_TransitionWindowCloseBtn: | |
1371 CloseWindowBackground(); | |
1372 pMediaPlayer->Unload(); | |
1373 DialogueEnding(); | |
1374 viewparams->bRedrawGameUI = true; | |
1375 continue; | |
1376 case UIMSG_CycleCharacters: | |
1377 v39 = GetAsyncKeyState(VK_SHIFT); | |
1378 uActiveCharacter = CycleCharacter(v39); | |
1379 viewparams->bRedrawGameUI = true; | |
1380 continue; | |
1381 case UIMSG_OnTravelByFoot: | |
1382 DoThatMessageThing(); | |
1383 dword_50CDC8 = 1; | |
1384 sub_42FBDD(); | |
1385 //pNPCData4 = (NPCData *)GetTravelTime(); | |
1386 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); | |
1387 if (bUnderwater != 1 && pParty->bFlying | |
1388 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1) | |
1389 { | |
1390 viewparams->bRedrawGameUI = 1; | |
1391 CloseWindowBackground(); | |
1392 if (pParty->vPosition.x < -22528) | |
1393 pParty->vPosition.x = -22528; | |
1394 if (pParty->vPosition.x > 22528) | |
1395 pParty->vPosition.x = 22528; | |
1396 if (pParty->vPosition.y < -22528) | |
1397 pParty->vPosition.y = -22528; | |
1398 if (pParty->vPosition.y > 22528) | |
1399 pParty->vPosition.y = 22528; | |
1400 DialogueEnding(); | |
1401 current_screen_type = SCREEN_GAME; | |
1402 } | |
1403 else | |
1404 { | |
1405 pParty->field_6E4 = 0; | |
1406 pParty->field_6E0 = 0; | |
1407 CastSpellInfoHelpers::_427D48(); | |
1408 DialogueEnding(); | |
1409 pEventTimer->Pause(); | |
1410 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); | |
1411 ++pGameLoadingUI_ProgressBar->uProgressMax; | |
1412 SaveGame(1, 0); | |
1413 pGameLoadingUI_ProgressBar->Progress(); | |
1414 RestAndHeal(1440 * (signed int)GetTravelTime()); | |
1415 if (pParty->uNumFoodRations) | |
1416 { | |
1417 pParty->RestAndHeal(); | |
1418 if (((pParty->uNumFoodRations - (signed int)GetTravelTime()) & 0x80000000u) != 0) | |
1419 { | |
1420 pPlayer7 = pParty->pPlayers.data(); | |
1421 do | |
1422 { | |
1423 pPlayer7->SetCondition(1, 0); | |
1424 ++pPlayer7; | |
1425 } while ((signed int)pPlayer7 < (signed int)pParty->pHirelings.data()); | |
1426 ++pParty->days_played_without_rest; | |
1427 } | |
1428 Party::TakeFood((unsigned int)GetTravelTime()); | |
1429 } | |
1430 else | |
1431 { | |
1432 pPlayer8 = pParty->pPlayers.data(); | |
1433 do | |
1434 { | |
1435 pPlayer8->SetCondition(1, 0); | |
1436 ++pPlayer8; | |
1437 } while ((signed int)pPlayer8 < (signed int)pParty->pHirelings.data()); | |
1438 ++pParty->days_played_without_rest; | |
1439 } | |
1440 pPaletteManager->ResetNonLocked(); | |
1441 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
1442 strcpy(pCurrentMapName, pOut); | |
1443 strcpy(pLevelName, pCurrentMapName); | |
1444 v41 = strtok(pLevelName, "."); | |
1445 strcpy(pLevelName, v41); | |
1446 Level_LoadEvtAndStr(pLevelName); | |
1447 pDecalBuilder->Reset(0); | |
1448 LoadLevel_InitializeLevelEvt(); | |
1449 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName); | |
1450 bUnderwater = 0; | |
1451 bNoNPCHiring = 0; | |
1452 pEngine->uFlags2 &= 0xFFFFFFF7u; | |
1453 if (Is_out15odm_underwater()) | |
1454 { | |
1455 bUnderwater = 1; | |
1456 pEngine->uFlags2 |= 8u; | |
1457 } | |
1458 if (!_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv")) | |
1459 bNoNPCHiring = 1; | |
1460 PrepareToLoadODM(1u, (ODMRenderParams *)1); | |
1461 pAudioPlayer->SetMapEAX(); | |
1462 bDialogueUI_InitializeActor_NPC_ID = 0; | |
1463 OnMapLoad(); | |
1464 pOutdoor->SetFog(); | |
1465 TeleportToStartingPoint(uLevel_StartingPointType); | |
1466 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0); | |
1467 pParty->uFallStartY = pParty->vPosition.z; | |
1468 _461103_load_level_sub(); | |
1469 pEventTimer->Resume(); | |
1470 viewparams->bRedrawGameUI = 1; | |
1471 current_screen_type = SCREEN_GAME; | |
1472 pGameLoadingUI_ProgressBar->Release(); | |
1473 } | |
1474 viewparams->bRedrawGameUI = 1; | |
1475 continue; | |
1476 case UIMSG_CHANGE_LOCATION_ClickCencelBtn: | |
1477 CloseWindowBackground(); | |
1478 if (pParty->vPosition.x < -22528) | |
1479 pParty->vPosition.x = -22528; | |
1480 if (pParty->vPosition.x > 22528) | |
1481 pParty->vPosition.x = 22528; | |
1482 if (pParty->vPosition.y < -22528) | |
1483 pParty->vPosition.y = -22528; | |
1484 if (pParty->vPosition.y > 22528) | |
1485 pParty->vPosition.y = 22528; | |
1486 DialogueEnding(); | |
1487 current_screen_type = SCREEN_GAME; | |
2542 | 1488 viewparams->bRedrawGameUI = true; |
2541 | 1489 continue; |
1490 case UIMSG_CastSpell_Telekinesis: | |
1491 //if ( pRenderer->pRenderD3D ) | |
1492 LOWORD(v42) = pEngine->pVisInstance->get_picked_object_zbuf_val(); | |
1493 /*else | |
1494 { | |
1495 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | |
1496 pPoint = pMouse->GetCursorPos(&v208); | |
1497 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | |
1498 }*/ | |
1499 v44 = (unsigned __int16)v42; | |
1500 v45 = PID_TYPE(v44); | |
1501 uNumSeconds = v44; | |
1502 v46 = PID_ID(v44); | |
1503 if (v45 == 3) | |
1504 { | |
1505 v47 = pActors[v46].uAIState == Dead; | |
1506 if (!v47) | |
1507 continue; | |
1508 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
1509 pSpellInfo->uFlags &= ~0x40u; | |
1510 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1511 pSpellInfo->spell_target_pid = v44; | |
1512 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1513 pGUIWindow_Settings->Release(); | |
1514 pGUIWindow_Settings = 0; | |
1515 pMouse->SetCursorBitmap("MICON1"); | |
1516 GameUI_Footer_TimeLeft = 0; | |
1517 _50C9A0_IsEnchantingInProgress = 0; | |
1518 back_to_game(); | |
1519 continue; | |
1520 } | |
1521 if (v45 == 2) | |
1522 { | |
1523 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; | |
1524 if (!v47) | |
1525 continue; | |
1526 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
1527 pSpellInfo->uFlags &= ~0x40u; | |
1528 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1529 pSpellInfo->spell_target_pid = v44; | |
1530 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1531 pGUIWindow_Settings->Release(); | |
1532 pGUIWindow_Settings = 0; | |
1533 pMouse->SetCursorBitmap("MICON1"); | |
1534 GameUI_Footer_TimeLeft = 0; | |
1535 _50C9A0_IsEnchantingInProgress = 0; | |
1536 back_to_game(); | |
1537 continue; | |
1538 } | |
1539 if (v45 == 5) | |
1540 { | |
1541 v48 = pLevelDecorations[v46].uEventID == 0; | |
1542 } | |
1543 else | |
1544 { | |
1545 if (v45 != 6) | |
1546 continue; | |
1547 if (uCurrentlyLoadedLevelType != 1) | |
1548 { | |
1549 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; | |
1550 if (!pODMFace->Clickable() || !pODMFace->sCogTriggeredID) | |
1551 continue; | |
1552 v44 = uNumSeconds; | |
1553 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
1554 pSpellInfo->uFlags &= ~0x40u; | |
1555 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1556 pSpellInfo->spell_target_pid = v44; | |
1557 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1558 pGUIWindow_Settings->Release(); | |
1559 pGUIWindow_Settings = 0; | |
1560 pMouse->SetCursorBitmap("MICON1"); | |
1561 GameUI_Footer_TimeLeft = 0; | |
1562 _50C9A0_IsEnchantingInProgress = 0; | |
1563 back_to_game(); | |
1564 continue; | |
1565 } | |
1566 pBLVFace = &pIndoor->pFaces[v46]; | |
1567 if (!pBLVFace->Clickable()) | |
1568 continue; | |
1569 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0; | |
1570 } | |
1571 if (v48) | |
1572 continue; | |
1573 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
1574 pSpellInfo->uFlags &= ~0x40u; | |
1575 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1576 pSpellInfo->spell_target_pid = v44; | |
1577 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1578 pGUIWindow_Settings->Release(); | |
1579 pGUIWindow_Settings = 0; | |
1580 pMouse->SetCursorBitmap("MICON1"); | |
1581 GameUI_Footer_TimeLeft = 0; | |
1582 _50C9A0_IsEnchantingInProgress = 0; | |
1583 back_to_game(); | |
1584 continue; | |
1585 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) | |
1586 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure | |
1587 case UIMSG_HiredNPC_CastSpell: | |
1588 DoThatMessageThing(); | |
1589 if (_50C9A0_IsEnchantingInProgress) | |
1590 { | |
1591 uActiveCharacter = uMessageParam; | |
1592 viewparams->bRedrawGameUI = 1; | |
1593 } | |
1594 else | |
1595 { | |
1596 if (pGUIWindow_Settings) | |
1597 { | |
1598 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
1599 switch (uMessage) | |
1600 { | |
1601 case UIMSG_CastSpell_Character_Big_Improvement: | |
1602 pSpellInfo->uFlags &= ~0x02u; | |
1603 break; | |
1604 case UIMSG_CastSpell_Character_Small_Improvement: | |
1605 pSpellInfo->uFlags &= ~0x0100u; | |
1606 break; | |
1607 case UIMSG_HiredNPC_CastSpell: | |
1608 pSpellInfo->uFlags &= ~0x0200u; | |
1609 break; | |
1610 } | |
1611 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1612 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1613 pGUIWindow_Settings->Release(); | |
1614 pGUIWindow_Settings = 0; | |
1615 pEventTimer->Resume(); | |
1616 pMouse->SetCursorBitmap("MICON1"); | |
1617 GameUI_Footer_TimeLeft = 0; | |
1618 _50C9A0_IsEnchantingInProgress = 0; | |
1619 } | |
1620 } | |
1621 continue; | |
2542 | 1622 |
2541 | 1623 case UIMSG_BF: |
1624 __debugbreak(); | |
1625 dword_50CDC8 = 1; | |
1626 sub_42FBDD(); | |
1627 SaveGame(1, 0); | |
1628 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); | |
1629 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; | |
1630 uGameState = GAME_STATE_CHANGE_LOCATION; | |
1631 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; | |
1632 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; | |
1633 if (v53 < 0) | |
1634 { | |
1635 v54 = abs(v53) - 1; | |
1636 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1637 dword_5B65BC = 0; | |
1638 v55 = dword_4E4560[v54]; | |
1639 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54]; | |
1640 v56 = dword_4E4590[v54]; | |
1641 v57 = dword_4E45A8[v54]; | |
1642 _5B65A8_npcdata_uflags_or_other = v55; | |
1643 _5B65B4_npcdata_loword_house_or_other = v57; | |
1644 _5B65B0_npcdata_rep_or_other = v56; | |
1645 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57; | |
1646 } | |
1647 HouseDialogPressCloseBtn(); | |
1648 //goto LABEL_434; | |
1649 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
1650 { | |
1651 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
1652 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; | |
1653 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1654 ++pMessageQueue_50CBD0->uNumMessages; | |
1655 }*/ | |
1656 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
1657 continue; | |
1658 | |
1659 case UIMSG_OnCastTownPortal: | |
1660 pAudioPlayer->StopChannels(-1, -1); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1661 pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_TownPortal, (char *)uMessageParam); |
2541 | 1662 continue; |
1663 | |
1664 case UIMSG_OnCastLloydsBeacon: | |
1665 pAudioPlayer->StopChannels(-1, -1); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1666 pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_LloydsBeacon, 0); |
2541 | 1667 continue; |
1668 | |
1669 case UIMSG_LloydsBeacon_FlippingBtn: | |
1670 bRecallingBeacon = uMessageParam; | |
1671 v127 = uMessageParam + 204; | |
1672 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); | |
1673 continue; | |
1674 case UIMSG_HintBeaconSlot: | |
1675 if (!pGUIWindow_CurrentMenu) | |
1676 continue; | |
1677 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1]; | |
1678 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; | |
1679 if (bRecallingBeacon) | |
1680 { | |
1681 if (!*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels)) | |
1682 continue; | |
1683 v173 = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName; | |
1684 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" | |
1685 GameUI_SetFooterString(pTmpBuf.data()); | |
1686 continue; | |
1687 } | |
1688 pMapNum = pMapStats->GetMapInfo(pCurrentMapName); | |
1689 pMapName = "Not in Map Stats"; | |
1690 if (pMapNum) | |
1691 pMapName = pMapStats->pInfos[pMapNum].pName; | |
1692 if (!*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels) || !pMapNum) | |
1693 { | |
1694 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], pMapName);// "Set to %s" | |
1695 GameUI_SetFooterString(pTmpBuf.data()); | |
1696 continue; | |
1697 } | |
1698 v174 = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; | |
1699 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], (unsigned int)pMapName, v174);// "Set %s over %s" | |
1700 GameUI_SetFooterString(pTmpBuf.data()); | |
1701 continue; | |
1702 case UIMSG_CloseAfterInstallBeacon: | |
1703 dword_50CDC8 = 1; | |
1704 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1705 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
1706 continue; | |
1707 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
1708 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
1709 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1710 ++pMessageQueue_50CBD0->uNumMessages;*/ | |
1711 continue; | |
1712 case UIMSG_InstallBeacon: | |
1713 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1]; | |
1714 if (!pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime && bRecallingBeacon) | |
1715 continue; | |
1716 byte_506360 = 1; | |
1717 pPlayer9->CanCastSpell(uRequiredMana); | |
1718 if (pParty->bTurnBasedModeOn) | |
1719 { | |
1720 v60 = sRecoveryTime; | |
1721 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; | |
1722 pPlayer9->SetRecoveryTime(v60); | |
1723 pTurnEngine->ApplyPlayerAction(); | |
1724 } | |
1725 else | |
1726 { | |
1727 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
1728 } | |
1729 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[lloyds_beacon_spell_id], 0, 0, -1, 0, lloyds_beacon_sound_id, 0, 0); | |
1730 if (bRecallingBeacon) | |
1731 { | |
1732 if (_stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID])) | |
1733 { | |
1734 SaveGame(1, 0); | |
1735 OnMapLeave(); | |
1736 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); | |
1737 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; | |
1738 uGameState = GAME_STATE_CHANGE_LOCATION; | |
1739 _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; | |
1740 _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | |
1741 _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | |
1742 _5B65B4_npcdata_loword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; | |
1743 _5B65B8_npcdata_hiword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; | |
1744 dword_5B65C0 = 1; | |
1745 } | |
1746 else | |
1747 { | |
1748 pParty->vPosition.x = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; | |
1749 pParty->vPosition.y = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | |
1750 pParty->vPosition.z = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | |
1751 pParty->uFallStartY = pParty->vPosition.z; | |
1752 pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; | |
1753 pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; | |
1754 } | |
1755 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
1756 pBooksWindow->Release(); | |
1757 pGUIWindow_CurrentMenu->Release(); | |
1758 pBooksWindow = 0; | |
1759 pGUIWindow_CurrentMenu = 0; | |
1760 } | |
1761 else | |
1762 { | |
1763 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); | |
1764 pRenderer->SaveScreenshot(a1, 92, 68); | |
1765 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); | |
1766 pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(lloyds_beacon_spell_level << 7) * 0.033333335); | |
1767 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x; | |
1768 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y = pParty->vPosition.y; | |
1769 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z = pParty->vPosition.z; | |
1770 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X = LOWORD(pParty->sRotationY); | |
1771 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX); | |
1772 if ((signed int)pGames_LOD->uNumSubDirs / 2 <= 0) | |
1773 continue; | |
1774 for (thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg) | |
1775 { | |
1776 if (!_stricmp(pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName)) | |
1777 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; | |
1778 } | |
1779 } | |
1780 continue; | |
1781 case UIMSG_ClickTownInTP: | |
1782 if (uMessageParam) | |
1783 { | |
1784 switch (uMessageParam) | |
1785 { | |
1786 case 1: | |
1787 v63 = 208; | |
1788 break; | |
1789 case 2: | |
1790 v63 = 207; | |
1791 break; | |
1792 case 3: | |
1793 v63 = 211; | |
1794 break; | |
1795 case 4: | |
1796 v63 = 209; | |
1797 break; | |
1798 default: | |
1799 if (uMessageParam != 5) | |
1800 { | |
1801 LABEL_486: | |
1802 SaveGame(1, 0); | |
1803 v64 = pMapStats->GetMapInfo(pCurrentMapName); | |
1804 v65 = uMessageParam; | |
1805 if (v64 == TownPortalList[uMessageParam].uMapInfoID) | |
1806 { | |
1807 pParty->vPosition.x = TownPortalList[v65].pos.x; | |
1808 pParty->vPosition.y = TownPortalList[v65].pos.y; | |
1809 pParty->vPosition.z = TownPortalList[v65].pos.z; | |
1810 pParty->uFallStartY = pParty->vPosition.z; | |
1811 pParty->sRotationY = TownPortalList[v65].rot_y; | |
1812 pParty->sRotationX = TownPortalList[v65].rot_x; | |
1813 } | |
1814 else | |
1815 { | |
1816 SaveGame(1, 0); | |
1817 OnMapLeave(); | |
1818 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; | |
1819 uGameState = GAME_STATE_CHANGE_LOCATION; | |
1820 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); | |
1821 dword_5B65C0 = 1; | |
1822 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; | |
1823 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | |
1824 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | |
1825 v66 = TownPortalList[uMessageParam].rot_x; | |
1826 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; | |
1827 _5B65B8_npcdata_hiword_house_or_other = v66; | |
1828 Actor::InitializeActors(); | |
1829 } | |
1830 v67 = (char*)pGUIWindow_CurrentMenu->Hint; | |
1831 if (v67) | |
1832 *((int *)v67 + 17) = 1; | |
1833 else | |
1834 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); | |
2543 | 1835 |
2541 | 1836 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); |
1837 continue; | |
1838 } | |
1839 v63 = 210; | |
1840 break; | |
1841 } | |
1842 } | |
1843 else | |
1844 { | |
1845 v63 = 206; | |
1846 } | |
1847 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63)) | |
1848 return; | |
1849 goto LABEL_486; | |
1850 case UIMSG_HintTownPortal: | |
1851 if (uMessageParam) | |
1852 { | |
1853 switch (uMessageParam) | |
1854 { | |
1855 case 1: | |
1856 v68 = 208; | |
1857 break; | |
1858 case 2: | |
1859 v68 = 207; | |
1860 break; | |
1861 case 3: | |
1862 v68 = 211; | |
1863 break; | |
1864 case 4: | |
1865 v68 = 209; | |
1866 break; | |
1867 default: | |
1868 if (uMessageParam != 5) | |
1869 //goto LABEL_506; | |
1870 { | |
1871 if (uMessageParam) | |
1872 { | |
1873 switch (uMessageParam) | |
1874 { | |
1875 case 1: | |
1876 v69 = pMapStats->pInfos[4].pName; | |
1877 break; | |
1878 case 2: | |
1879 v69 = pMapStats->pInfos[3].pName; | |
1880 break; | |
1881 case 3: | |
1882 v69 = pMapStats->pInfos[10].pName; | |
1883 break; | |
1884 case 4: | |
1885 v69 = pMapStats->pInfos[7].pName; | |
1886 break; | |
1887 default: | |
1888 if (uMessageParam != 5) | |
1889 { | |
1890 __debugbreak(); // warning C4700: uninitialized local variable 'v200' used | |
1891 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); | |
1892 GameUI_SetFooterString(pTmpBuf.data()); | |
1893 continue; | |
1894 } | |
1895 v69 = pMapStats->pInfos[8].pName; | |
1896 break; | |
1897 } | |
1898 } | |
1899 else | |
1900 { | |
1901 v69 = pMapStats->pInfos[21].pName; | |
1902 } | |
1903 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); | |
1904 GameUI_SetFooterString(pTmpBuf.data()); | |
1905 continue; | |
1906 } | |
1907 v68 = 210; | |
1908 break; | |
1909 } | |
1910 } | |
1911 else | |
1912 { | |
1913 v68 = 206; | |
1914 } | |
1915 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68)) | |
1916 { | |
1917 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | |
1918 continue; | |
1919 } | |
1920 //LABEL_506: | |
1921 if (uMessageParam) | |
1922 { | |
1923 switch (uMessageParam) | |
1924 { | |
1925 case 1: | |
1926 v69 = pMapStats->pInfos[4].pName; | |
1927 break; | |
1928 case 2: | |
1929 v69 = pMapStats->pInfos[3].pName; | |
1930 break; | |
1931 case 3: | |
1932 v69 = pMapStats->pInfos[10].pName; | |
1933 break; | |
1934 case 4: | |
1935 v69 = pMapStats->pInfos[7].pName; | |
1936 break; | |
1937 default: | |
1938 if (uMessageParam != 5) | |
1939 //goto LABEL_519; | |
1940 { | |
1941 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); | |
1942 GameUI_SetFooterString(pTmpBuf.data()); | |
1943 continue; | |
1944 } | |
1945 v69 = pMapStats->pInfos[8].pName; | |
1946 break; | |
1947 } | |
1948 } | |
1949 else | |
1950 { | |
1951 v69 = pMapStats->pInfos[21].pName; | |
1952 } | |
1953 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); | |
1954 GameUI_SetFooterString(pTmpBuf.data()); | |
1955 continue; | |
1956 case UIMSG_ShowFinalWindow: | |
1957 sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." | |
1958 pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment." | |
1959 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." | |
1960 ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose); | |
1961 uGameState = GAME_STATE_FINAL_WINDOW; | |
1962 continue; | |
1963 case UIMSG_OnFinalWindowClose: | |
1964 __debugbreak(); | |
1965 uGameState = GAME_STATE_PLAYING; | |
1966 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); | |
1967 __debugbreak(); // missed break/continue? | |
1968 case UIMSG_DD: | |
1969 __debugbreak(); | |
1970 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); | |
1971 memcpy(&v216, txt_file_frametable_parser(pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); | |
1972 if (v216.uPropCount == 1) | |
1973 { | |
1974 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); | |
1975 v70 = atoi(v216.pProperties[0]); | |
1976 if (v70 <= 0 || v70 >= 77) | |
1977 continue; | |
1978 v71 = v70; | |
1979 strcpy(Str2, pMapStats->pInfos[v70].pFilename); | |
1980 pNPCData3 = 0; | |
1981 if ((signed int)pNPCData4 > 0) | |
1982 { | |
1983 thish = 0; | |
1984 do | |
1985 { | |
1986 if (!_stricmp(pGames_LOD->pSubIndices[thish].pFilename, Str2)) | |
1987 break; | |
1988 ++thish; | |
1989 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | |
1990 } while ((signed int)pNPCData3 < (signed int)pNPCData4); | |
1991 if ((signed int)pNPCData3 < (signed int)pNPCData4) | |
1992 { | |
1993 strcpy(pCurrentMapName, pGames_LOD->pSubIndices[(int)pNPCData3].pFilename); | |
1994 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; | |
1995 uGameState = GAME_STATE_CHANGE_LOCATION; | |
1996 OnMapLeave(); | |
1997 continue; | |
1998 } | |
1999 } | |
2000 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); | |
2001 v73 = Str2; | |
2002 } | |
2003 else | |
2004 { | |
2005 if (v216.uPropCount != 3) | |
2006 continue; | |
2007 v74 = atoi(v216.pProperties[0]); | |
2008 thisi = atoi(v216.pProperties[1]); | |
2009 v75 = atoi(v216.pProperties[2]); | |
2010 v76 = v75; | |
2011 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
2012 { | |
2013 if (pIndoor->GetSector(v74, thisi, v75)) | |
2014 { | |
2015 v77 = thisi; | |
2016 pParty->vPosition.x = v74; | |
2017 pParty->vPosition.y = v77; | |
2018 pParty->vPosition.z = v76; | |
2019 pParty->uFallStartY = v76; | |
2020 continue; | |
2021 } | |
2022 } | |
2023 else | |
2024 { | |
2025 if (v74 > -32768) | |
2026 { | |
2027 if (v74 < 32768) | |
2028 { | |
2029 v77 = thisi; | |
2030 if (thisi > -32768) | |
2031 { | |
2032 if (thisi < 32768 && v76 >= 0 && v76 < 10000) | |
2033 { | |
2034 pParty->vPosition.x = v74; | |
2035 pParty->vPosition.y = v77; | |
2036 pParty->vPosition.z = v76; | |
2037 pParty->uFallStartY = v76; | |
2038 continue; | |
2039 } | |
2040 } | |
2041 } | |
2042 } | |
2043 } | |
2044 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2045 v73 = "Can't jump to that location!"; | |
2046 } | |
2047 ShowStatusBarString(v73, 6); | |
2048 continue; | |
2049 case UIMSG_CastQuickSpell: | |
2050 if (bUnderwater == 1) | |
2051 { | |
2052 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
2053 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2054 continue; | |
2055 } | |
2056 if (!uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery)) | |
2057 continue; | |
2058 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); | |
2059 continue; | |
2060 case UIMSG_CastSpell_Monster_Improvement: | |
2061 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, | |
2062 //if ( pRenderer->pRenderD3D ) | |
2063 { | |
2064 v81 = pEngine->pVisInstance->get_picked_object_zbuf_val(); | |
2065 } | |
2066 /*else | |
2067 { | |
2068 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206); | |
2069 pPoint2 = pMouse->GetCursorPos(&v201); | |
2070 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | |
2071 }*/ | |
2072 v83 = v81; | |
2073 v44 = (unsigned __int16)v81; | |
2074 v84 = v83 >> 16; | |
2075 if (PID_TYPE(v44) != 3 || v84 >= 5120) | |
2076 continue; | |
2077 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
2078 if (uMessage == UIMSG_CastSpell_Shoot_Monster) | |
2079 { | |
2080 pSpellInfo->uFlags &= ~0x08; | |
2081 } | |
2082 else | |
2083 { | |
2084 if (uMessage == UIMSG_CastSpell_Monster_Improvement) | |
2085 pSpellInfo->uFlags &= ~0x0100u; | |
2086 else | |
2087 pSpellInfo->uFlags &= ~0x0200u; | |
2088 } | |
2089 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2090 pSpellInfo->spell_target_pid = v44; | |
2091 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2092 pGUIWindow_Settings->Release(); | |
2093 pGUIWindow_Settings = 0; | |
2094 pMouse->SetCursorBitmap("MICON1"); | |
2095 GameUI_Footer_TimeLeft = 0; | |
2096 _50C9A0_IsEnchantingInProgress = 0; | |
2097 back_to_game(); | |
2098 continue; | |
2099 case UIMSG_1C: | |
2100 __debugbreak(); | |
2543 | 2101 if (!uActiveCharacter || current_screen_type != SCREEN_GAME) |
2541 | 2102 continue; |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2103 __debugbreak();//ptr_507BC8 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_68, uMessageParam, 0); |
2541 | 2104 current_screen_type = SCREEN_19; |
2105 pEventTimer->Pause(); | |
2106 continue; | |
2107 case UIMSG_STEALFROMACTOR: | |
2108 if (!uActiveCharacter) | |
2109 continue; | |
2110 if (pParty->bTurnBasedModeOn != 1) | |
2111 { | |
2112 if (pActors[uMessageParam].uAIState == 5) | |
2113 pActors[uMessageParam].LootActor(); | |
2114 else | |
2115 Actor::StealFrom(uMessageParam); | |
2116 continue; | |
2117 } | |
2118 if (pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT) | |
2119 continue; | |
2120 if (!(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS)) | |
2121 { | |
2122 if (pActors[uMessageParam].uAIState == 5) | |
2123 pActors[uMessageParam].LootActor(); | |
2124 else | |
2125 Actor::StealFrom(uMessageParam); | |
2126 } | |
2127 continue; | |
2128 | |
2129 case UIMSG_Attack: | |
2130 if (!uActiveCharacter) | |
2131 continue; | |
2132 if (pParty->bTurnBasedModeOn != 1) | |
2133 { | |
2134 Player::_42ECB5_PlayerAttacksActor(); | |
2135 continue; | |
2136 } | |
2137 if (pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT) | |
2138 continue; | |
2139 if (!(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS)) | |
2140 Player::_42ECB5_PlayerAttacksActor(); | |
2141 continue; | |
2142 case UIMSG_ExitRest: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2143 new OnCancel(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" |
2541 | 2144 continue; |
2145 case UIMSG_Wait5Minutes: | |
2543 | 2146 if (_506F14_resting_stage == 2) |
2541 | 2147 { |
2148 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
2149 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2150 continue; | |
2151 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2152 new OnButtonClick2(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, |
2541 | 2153 (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" |
2543 | 2154 _506F14_resting_stage = 1; |
2541 | 2155 _506F18_num_minutes_to_sleep = 5; |
2156 continue; | |
2157 case UIMSG_Wait1Hour: | |
2543 | 2158 if (_506F14_resting_stage == 2) |
2541 | 2159 { |
2160 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
2161 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2162 continue; | |
2163 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2164 new OnButtonClick2(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, |
2541 | 2165 (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" |
2543 | 2166 _506F14_resting_stage = 1; |
2541 | 2167 _506F18_num_minutes_to_sleep = 60; |
2168 continue; | |
2169 case UIMSG_RentRoom: | |
2543 | 2170 _506F14_resting_stage = 2; |
2171 | |
2172 PrepareToLoadRestUI(); | |
2173 current_screen_type = SCREEN_REST; | |
2174 pGUIWindow_CurrentMenu = RestUI_Load(); | |
2175 | |
2541 | 2176 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; |
2177 _506F18_num_minutes_to_sleep = v86; | |
2178 if (uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116) // 107 = Emerald Isle tavern | |
2179 _506F18_num_minutes_to_sleep = v86 + 12 * 60; | |
2543 | 2180 _506F14_resting_stage = 2; |
2541 | 2181 pParty->RestAndHeal(); |
2182 pParty->days_played_without_rest = 0; | |
2183 pParty->pPlayers[3].SetAsleep(1); | |
2184 pParty->pPlayers[2].SetAsleep(1); | |
2185 pParty->pPlayers[1].SetAsleep(1); | |
2186 pParty->pPlayers[0].SetAsleep(1); | |
2187 continue; | |
2188 case UIMSG_RestWindow: | |
2189 DoThatMessageThing(); | |
2543 | 2190 if (current_screen_type != SCREEN_GAME) |
2541 | 2191 continue; |
2192 if (CheckActors_proximity()) | |
2193 { | |
2194 if (pParty->bTurnBasedModeOn == 1) | |
2195 { | |
2196 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
2197 continue; | |
2198 } | |
2199 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2200 if (pParty->uFlags & 0x88) | |
2201 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
2202 ShowStatusBarString(v88, 2); | |
2203 if (!uActiveCharacter) | |
2204 continue; | |
2205 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); | |
2206 continue; | |
2207 } | |
2208 if (pParty->bTurnBasedModeOn == 1) | |
2209 { | |
2210 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
2211 continue; | |
2212 } | |
2213 if (!(pParty->uFlags & 0x88)) | |
2214 { | |
2543 | 2215 PrepareToLoadRestUI(); |
2216 current_screen_type = SCREEN_REST; | |
2217 pGUIWindow_CurrentMenu = RestUI_Load(); | |
2541 | 2218 continue; |
2219 } | |
2220 if (pParty->bTurnBasedModeOn == 1) | |
2221 { | |
2222 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
2223 continue; | |
2224 } | |
2225 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2226 if (pParty->uFlags & 0x88) | |
2227 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
2543 | 2228 ShowStatusBarString(v88, 2); |
2541 | 2229 if (!uActiveCharacter) |
2230 continue; | |
2543 | 2231 pPlayers[uActiveCharacter]->PlaySound(SPEECH_CantRestHere, 0); |
2541 | 2232 continue; |
2233 case UIMSG_Rest8Hour: | |
2543 | 2234 if (_506F14_resting_stage != 0) |
2541 | 2235 { |
2236 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
2237 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2238 continue; | |
2239 } | |
2240 if (pParty->uNumFoodRations < uRestUI_FoodRequiredToRest) | |
2241 { | |
2543 | 2242 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2);// "You don't have enough food to rest" |
2541 | 2243 if (uActiveCharacter && pPlayers[uActiveCharacter]->CanAct()) |
2543 | 2244 pPlayers[uActiveCharacter]->PlaySound(SPEECH_108, 0); |
2541 | 2245 } |
2246 else | |
2247 { | |
2248 pParty->pPlayers[3].pConditions[Condition_Sleep] = pParty->uTimePlayed; | |
2249 pParty->pPlayers[2].pConditions[Condition_Sleep] = pParty->uTimePlayed; | |
2250 pParty->pPlayers[1].pConditions[Condition_Sleep] = pParty->uTimePlayed; | |
2251 pParty->pPlayers[0].pConditions[Condition_Sleep] = pParty->uTimePlayed; | |
2252 v90 = pMapStats->GetMapInfo(pCurrentMapName); | |
2253 if (!v90) | |
2254 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | |
2255 pMapInfo = &pMapStats->pInfos[v90]; | |
2256 if (rand() % 100 + 1 <= pMapInfo->Encounter_percent) | |
2257 { | |
2258 v91 = rand() % 100; | |
2259 v92 = pMapInfo->EncM1percent; | |
2260 v93 = v91 + 1; | |
2261 if (v93 > v92) | |
2262 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); | |
2263 else | |
2264 pNPCData4 = (NPCData *)1; | |
2265 if (!_45063B_spawn_some_monster(pMapInfo, (int)pNPCData4)) | |
2266 pNPCData4 = 0; | |
2267 if (pNPCData4) | |
2268 { | |
2269 pPlayerNum = rand() % 4; | |
2270 pParty->pPlayers[pPlayerNum].pConditions[Condition_Sleep] = 0; | |
2271 v95 = rand(); | |
2272 Rest(v95 % 6 + 60); | |
2273 _506F18_num_minutes_to_sleep = 0; | |
2543 | 2274 _506F14_resting_stage = 0; |
2275 | |
2541 | 2276 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); |
2277 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" | |
2278 pAudioPlayer->PlaySound(SOUND_encounter, 0, 0, -1, 0, 0, 0, 0); | |
2279 continue; | |
2280 } | |
2281 } | |
2282 Party::TakeFood(uRestUI_FoodRequiredToRest); | |
2283 _506F18_num_minutes_to_sleep = 480; | |
2543 | 2284 _506F14_resting_stage = 2; |
2541 | 2285 pParty->RestAndHeal(); |
2286 pParty->days_played_without_rest = 0; | |
2287 pParty->pPlayers[3].SetAsleep(1); | |
2288 pParty->pPlayers[2].SetAsleep(1); | |
2289 pParty->pPlayers[1].SetAsleep(1); | |
2290 pParty->pPlayers[0].SetAsleep(1); | |
2291 } | |
2292 continue; | |
2293 case UIMSG_AlreadyResting: | |
2543 | 2294 if (_506F14_resting_stage == 2) |
2541 | 2295 { |
2296 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
2297 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2298 continue; | |
2299 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2300 new OnButtonClick2(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, |
2541 | 2301 (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" |
2302 v97 = _494820_training_time(pParty->uCurrentHour); | |
2543 | 2303 _506F14_resting_stage = 1; |
2541 | 2304 _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute; |
2305 continue; | |
2306 case UIMSG_HintSelectRemoveQuickSpellBtn: | |
2307 if (quick_spell_at_page && byte_506550) | |
2308 { | |
2309 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName; | |
2310 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173); | |
2311 } | |
2312 else | |
2313 { | |
2314 if (pPlayers[uActiveCharacter]->uQuickSpell) | |
2315 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell" | |
2316 else | |
2317 v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell" | |
2318 strcpy(pTmpBuf.data(), v177); | |
2319 } | |
2320 GameUI_SetFooterString(pTmpBuf.data()); | |
2321 continue; | |
2322 case UIMSG_SPellbook_ShowHightlightedSpellInfo: | |
2323 if (!uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], | |
2324 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402))) | |
2325 continue; | |
2326 if (sub_4637E0_is_there_popup_onscreen()) | |
2327 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1; | |
2328 v98 = *(char *)(uNumSeconds + 6734); | |
2329 if (quick_spell_at_page - 1 == uMessageParam) | |
2330 { | |
2331 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2332 v161 = pGlobalTXT_LocalizationStrings[485]; | |
2333 } | |
2334 else | |
2335 { | |
2336 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2337 v161 = pGlobalTXT_LocalizationStrings[486]; | |
2338 } | |
2339 sprintfex(pTmpBuf.data(), v161, v178); | |
2340 GameUI_SetFooterString(pTmpBuf.data()); | |
2341 continue; | |
2342 case UIMSG_ClickInstallRemoveQuickSpellBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2343 new OnButtonClick2(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, (int)pBtn_InstallRemoveSpell, 0); |
2541 | 2344 if (!uActiveCharacter) |
2345 continue; | |
2346 pPlayer10 = pPlayers[uActiveCharacter]; | |
2347 if (!byte_506550 || !quick_spell_at_page) | |
2348 { | |
2349 pPlayer10->uQuickSpell = 0; | |
2350 quick_spell_at_page = 0; | |
2351 pAudioPlayer->PlaySound(SOUND_fizzle, 0, 0, -1, 0, 0, 0, 0); | |
2352 continue; | |
2353 } | |
2354 pPlayers[uActiveCharacter]->uQuickSpell = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; | |
2355 AA1058_PartyQuickSpellSound[uActiveCharacter - 1].AddPartySpellSound(pPlayers[uActiveCharacter]->uQuickSpell, uActiveCharacter); | |
2356 if (uActiveCharacter) | |
2357 pPlayer10->PlaySound(SPEECH_12, 0); | |
2358 byte_506550 = 0; | |
2359 continue; | |
2360 case UIMSG_SpellBook_PressTab://перелистывание страниц клавишей Tab | |
2361 { | |
2362 if (!uActiveCharacter) | |
2363 continue; | |
2364 int skill_count = 0; | |
2365 uAction = 0; | |
2366 for (uint i = 0; i < 9; i++) | |
2367 { | |
2368 if (pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_FIRE + i]) | |
2369 { | |
2370 if (pPlayers[uActiveCharacter]->lastOpenedSpellbookPage == i) | |
2371 uAction = skill_count; | |
2372 v217[skill_count++] = i; | |
2373 } | |
2374 } | |
2375 if (!skill_count)//нет скиллов | |
2376 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0); | |
2377 else | |
2378 { | |
2379 if (GetAsyncKeyState(VK_SHIFT)) | |
2380 { | |
2381 --uAction; | |
2382 if (uAction < 0) | |
2383 uAction = skill_count - 1; | |
2384 } | |
2385 else | |
2386 { | |
2387 ++uAction; | |
2388 if (uAction >= skill_count) | |
2389 uAction = 0; | |
2390 } | |
2391 OnCloseSpellBookPage(); | |
2392 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); | |
2393 pGUIWindow_CurrentMenu->OpenSpellBook(); | |
2394 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0); | |
2395 } | |
2396 continue; | |
2397 } | |
2398 case UIMSG_OpenSpellbookPage: | |
2399 if (pTurnEngine->turn_stage == TE_MOVEMENT || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage) | |
2400 continue; | |
2401 OnCloseSpellBookPage(); | |
2402 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; | |
2403 pGUIWindow_CurrentMenu->OpenSpellBook(); | |
2404 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0); | |
2405 continue; | |
2406 case UIMSG_SelectSpell: | |
2407 { | |
2408 if (pTurnEngine->turn_stage == TE_MOVEMENT) | |
2409 continue; | |
2410 if (!uActiveCharacter) | |
2411 continue; | |
2412 | |
2413 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter]; | |
2414 Player* player = pPlayers[uActiveCharacter]; | |
2415 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam]) | |
2416 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) ) | |
2417 { | |
2418 if (quick_spell_at_page - 1 == uMessageParam) | |
2419 { | |
2420 pGUIWindow_CurrentMenu->Release(); | |
2421 pEventTimer->Resume(); | |
2422 viewparams->bRedrawGameUI = 1; | |
2423 current_screen_type = SCREEN_GAME; | |
2424 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2425 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; | |
2426 /*if ( dword_50C9E8 < 40 ) | |
2427 { | |
2428 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; | |
2429 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; | |
2430 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; | |
2431 ++dword_50C9E8; | |
2432 }*/ | |
2433 pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
2434 // pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
2435 } | |
2436 else | |
2437 { | |
2438 byte_506550 = 1; | |
2439 quick_spell_at_page = uMessageParam + 1; | |
2440 } | |
2441 } | |
2442 } | |
2443 continue; | |
2444 | |
2445 case UIMSG_CastSpellFromBook: | |
2446 if (pTurnEngine->turn_stage != TE_MOVEMENT) | |
2447 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); | |
2448 continue; | |
2449 | |
2450 case UIMSG_SpellScrollUse: | |
2451 __debugbreak(); | |
2452 if (pTurnEngine->turn_stage != TE_MOVEMENT) | |
2453 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); | |
2454 continue; | |
2455 case UIMSG_SpellBookWindow: | |
2456 if (pTurnEngine->turn_stage == TE_MOVEMENT) | |
2457 continue; | |
2458 if (bUnderwater == true) | |
2459 { | |
2460 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
2461 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2462 } | |
2463 else | |
2464 { | |
2465 DoThatMessageThing(); | |
2466 if (uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery) | |
2467 { | |
2468 if (current_screen_type == SCREEN_GAME) | |
2469 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2470 new OnButtonClick2(476, 450, 0, 0, (int)pBtn_CastSpell, 0); |
2541 | 2471 current_screen_type = SCREEN_SPELL_BOOK; |
2472 pEventTimer->Pause(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2473 pGUIWindow_CurrentMenu = new GUIWindow_Spellbook(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); |
2541 | 2474 pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0); |
2475 viewparams->field_48 = 1; | |
2476 continue; | |
2477 } | |
2478 if (current_screen_type != SCREEN_REST && current_screen_type != SCREEN_CHARACTERS | |
2479 && (current_screen_type <= SCREEN_63 || current_screen_type > SCREEN_67)) | |
2480 { | |
2481 pGUIWindow_CurrentMenu->Release(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2482 new OnButtonClick2(476, 450, 0, 0, (int)pBtn_CastSpell, 0); |
2541 | 2483 current_screen_type = SCREEN_SPELL_BOOK; |
2484 pEventTimer->Pause(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2485 pGUIWindow_CurrentMenu = new GUIWindow_Spellbook(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); |
2541 | 2486 pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0); |
2487 viewparams->field_48 = 1; | |
2488 continue; | |
2489 } | |
2490 } | |
2491 } | |
2492 continue; | |
2493 case UIMSG_QuickReference: | |
2494 DoThatMessageThing(); | |
2495 if (current_screen_type) | |
2496 pGUIWindow_CurrentMenu->Release(); | |
2497 ++pIcons_LOD->uTexturePacksCount; | |
2498 if (!pIcons_LOD->uNumPrevLoadedFiles) | |
2499 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2500 new OnButtonClick2(0x230u, 0x1C2u, 0, 0, (int)pBtn_QuickReference, 0); |
2541 | 2501 viewparams->bRedrawGameUI = 1; |
2502 pEventTimer->Pause(); | |
2503 pAudioPlayer->StopChannels(-1, -1); | |
2504 current_screen_type = SCREEN_QUICK_REFERENCE; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2505 pGUIWindow_CurrentMenu = new GUIWindow_QuickReference(0, 0, window->GetWidth(), window->GetHeight(), 5, 0); |
2541 | 2506 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); |
2507 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, | |
2508 pGlobalTXT_LocalizationStrings[79],// "Exit" | |
2509 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); | |
2510 continue; | |
2511 case UIMSG_GameMenuButton: | |
2543 | 2512 if (current_screen_type != SCREEN_GAME) |
2541 | 2513 { |
2514 pGUIWindow_CurrentMenu->Release(); | |
2515 pEventTimer->Resume(); | |
2516 current_screen_type = SCREEN_GAME; | |
2517 viewparams->bRedrawGameUI = 1; | |
2518 } | |
2519 | |
2520 stru_506E40.Release(); | |
2521 pRenderer->SaveScreenshot("gamma.pcx", 155, 117); | |
2522 stru_506E40.LoadPCXFile("gamma.pcx", 0); | |
2523 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2524 new OnButtonClick(0x25Au, 0x1C2u, 0, 0, (int)pBtn_GameSettings, 0); |
2541 | 2525 //LABEL_453: |
2526 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
2527 continue; | |
2528 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
2529 //goto LABEL_770; | |
2530 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2531 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2532 ++pMessageQueue_50CBD0->uNumMessages;*/ | |
2533 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
2534 continue; | |
2535 case UIMSG_ClickAwardScrollBar: | |
2536 books_page_number = 1; | |
2537 if (pMouse->GetCursorPos(&v211)->y > 178) | |
2538 books_page_number = -1; | |
2539 continue; | |
2540 case UIMSG_ClickAwardsUpBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2541 new OnButtonClick3(pBtn_Up->uX, pBtn_Up->uY, 0, 0, (int)pBtn_Up, 0); |
2541 | 2542 BtnUp_flag = 1; |
2543 continue; | |
2544 case UIMSG_ClickAwardsDownBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2545 new OnButtonClick3(pBtn_Down->uX, pBtn_Down->uY, 0, 0, (int)pBtn_Down, 0); |
2541 | 2546 BtnDown_flag = 1; |
2547 continue; | |
2548 case UIMSG_ChangeDetaliz: | |
2549 bRingsShownInCharScreen ^= 1; | |
2550 pCharacterScreen_DetalizBtn->Release(); | |
2551 pCharacterScreen_DollBtn->Release(); | |
2552 if (bRingsShownInCharScreen) | |
2553 { | |
2554 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; | |
2555 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; | |
2556 v123 = 445; | |
2557 v121 = 470; | |
2558 } | |
2559 else | |
2560 { | |
2561 v128 = 30; | |
2562 v125 = 30; | |
2563 v123 = 300; | |
2564 v121 = 600; | |
2565 } | |
2566 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, | |
2567 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" | |
2568 0); | |
2569 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); | |
2570 viewparams->bRedrawGameUI = 1; | |
2571 continue; | |
2572 case UIMSG_ClickPaperdoll: | |
2573 OnPaperdollLeftClick(); | |
2574 continue; | |
2575 case UIMSG_ClickStatsBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2576 current_character_screen_window = WINDOW_CharacterWindow_Stats; |
2541 | 2577 CharacterUI_ReleaseButtons(); |
2578 ReleaseAwardsScrollBar(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2579 new OnButtonClick3(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, (int)pCharacterScreen_StatsBtn, 0); |
2541 | 2580 continue; |
2581 case UIMSG_ClickSkillsBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2582 current_character_screen_window = WINDOW_CharacterWindow_Skills; |
2541 | 2583 CharacterUI_ReleaseButtons(); |
2584 ReleaseAwardsScrollBar(); | |
2585 CharacterUI_SkillsTab_CreateButtons(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2586 new OnButtonClick3(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, (int)pCharacterScreen_SkillsBtn, 0); |
2541 | 2587 continue; |
2588 case UIMSG_SkillUp: | |
2589 pPlayer4 = pPlayers[uActiveCharacter]; | |
2590 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; | |
2591 LOWORD(v2) = *(short *)v105; | |
2592 uNumSeconds = v2; | |
2593 if (pPlayer4->uSkillPoints < (v2 & 0x3F) + 1) | |
2594 { | |
2595 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!" | |
2596 } | |
2597 else | |
2598 { | |
2599 if ((uNumSeconds & 0x3F) < 0x3C) | |
2600 { | |
2601 *(short *)v105 = uNumSeconds + 1; | |
2602 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; | |
2603 pPlayer4->PlaySound(SPEECH_14, 0); | |
2604 pAudioPlayer->PlaySound((SoundID)SOUND_quest, 0, 0, -1, 0, 0, 0, 0); | |
2605 continue; | |
2606 } | |
2607 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" | |
2608 } | |
2609 ShowStatusBarString(v87, 2); | |
2610 continue; | |
2611 case UIMSG_ClickInventoryBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2612 current_character_screen_window = WINDOW_CharacterWindow_Inventory; |
2541 | 2613 ReleaseAwardsScrollBar(); |
2614 CharacterUI_ReleaseButtons(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2615 new OnButtonClick3(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, (int)pCharacterScreen_InventoryBtn, 0); |
2541 | 2616 continue; |
2617 case UIMSG_ClickExitCharacterWindowBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2618 new OnCancel2(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, (int)pCharacterScreen_ExitBtn, 0); |
2541 | 2619 continue; |
2620 case UIMSG_ClickAwardsBtn: | |
2621 ReleaseAwardsScrollBar(); | |
2622 CharacterUI_ReleaseButtons(); | |
2623 CreateAwardsScrollBar(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2624 current_character_screen_window = WINDOW_CharacterWindow_Awards; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2625 new OnButtonClick3(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, (int)pCharacterScreen_AwardsBtn, 0); |
2541 | 2626 FillAwardsData(); |
2627 continue; | |
2628 case UIMSG_ClickBooksBtn: | |
2629 switch (uMessageParam) | |
2630 { | |
2631 case 11://Page UP | |
2632 BtnUp_flag = 1; | |
2633 pButton = pBtn_Book_2; | |
2634 break; | |
2635 case 10://Page DOWN | |
2636 BtnDown_flag = 1; | |
2637 pButton = pBtn_Book_1; | |
2638 break; | |
2639 case 0://Zoom plus | |
2640 pButton = pBtn_Book_1; | |
2641 BtnDown_flag = 1; | |
2642 break; | |
2643 case 1://Zoom minus | |
2644 pButton = pBtn_Book_2; | |
2645 BtnUp_flag = 1; | |
2646 break; | |
2647 case 2://Potions | |
2648 Book_PageBtn3_flag = 1; | |
2649 if (dword_506364) | |
2650 continue; | |
2651 pButton = pBtn_Book_3; | |
2652 break; | |
2653 case 3://fountains | |
2654 Book_PageBtn4_flag = 1; | |
2655 if (dword_506364) | |
2656 continue; | |
2657 pButton = pBtn_Book_4; | |
2658 break; | |
2659 case 4://obelisks | |
2660 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag | |
2661 if (dword_506364) | |
2662 continue; | |
2663 pButton = pBtn_Book_5; | |
2664 break; | |
2665 case 5://seer | |
2666 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag | |
2667 if (dword_506364) | |
2668 continue; | |
2669 pButton = pBtn_Book_6; | |
2670 break; | |
2671 case 6://misc | |
2672 pButton = pBtn_Autonotes_Misc; | |
2673 Autonotes_Misc_page_flag = 1; | |
2674 break; | |
2675 case 7://Instructors | |
2676 pButton = pBtn_Autonotes_Instructors; | |
2677 Autonotes_Instructors_page_flag = 1; | |
2678 break; | |
2679 default: | |
2680 continue; | |
2681 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2682 new OnButtonClick(pButton->uX, pButton->uY, 0, 0, (int)pButton, (char *)1); |
2541 | 2683 continue; |
2684 case UIMSG_SelectCharacter: | |
2685 DoThatMessageThing(); | |
2686 GameUI_OnPlayerPortraitLeftClick(uMessageParam); | |
2687 continue; | |
2688 case UIMSG_ShowStatus_Funds: | |
2689 v174 = (char *)pParty->uNumGoldInBank; | |
2690 //v158 = pParty->uNumGold + pParty->uNumGoldInBank; | |
2691 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], pParty->uNumGold + pParty->uNumGoldInBank, v174);// "You have %d total gold, %d in the Bank" | |
2692 GameUI_SetFooterString(pTmpBuf.data()); | |
2693 continue; | |
2694 case UIMSG_ShowStatus_DateTime: | |
2695 currHour = pParty->uCurrentHour; | |
2696 uNumSeconds = 1; | |
2697 if (pParty->uCurrentHour > 12) | |
2698 { | |
2699 if (pParty->uCurrentHour >= 24) | |
2700 uNumSeconds = 0; | |
2701 currHour = (currHour - 12); | |
2702 } | |
2703 else | |
2704 { | |
2705 if (pParty->uCurrentHour < 12) // 12:00 is PM | |
2706 uNumSeconds = 0; | |
2707 if (pParty->uCurrentHour == 0) | |
2708 currHour = 12; | |
2709 } | |
2710 sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", currHour, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], | |
2711 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear); | |
2712 GameUI_SetFooterString(pTmpBuf.data()); | |
2713 continue; | |
2714 case UIMSG_ShowStatus_Food: | |
2715 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food" | |
2716 GameUI_SetFooterString(pTmpBuf.data()); | |
2717 continue; | |
2718 case UIMSG_ShowStatus_Player: | |
2719 pPlayer5 = pPlayers[uMessageParam]; | |
2720 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s" | |
2721 strcat(pTmpBuf.data(), ": "); | |
2722 v107 = pPlayer5->GetMajorConditionIdx(); | |
2723 strcat(pTmpBuf.data(), aCharacterConditionNames[v107]); | |
2724 GameUI_SetFooterString(pTmpBuf.data()); | |
2725 v108 = 8 * uMessageParam - 8; | |
2726 LOBYTE(v108) = v108 | 4; | |
2727 pMouse->uPointingObjectID = PID(OBJECT_Player, v108); | |
2728 continue; | |
2729 case UIMSG_ShowStatus_ManaHP: | |
2730 sprintf(pTmpBuf.data(), "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), | |
2731 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), | |
2732 pGlobalTXT_LocalizationStrings[212]); | |
2733 GameUI_SetFooterString(pTmpBuf.data()); | |
2734 continue; | |
2735 case UIMSG_CHEST_ClickItem: | |
2736 if (current_screen_type == SCREEN_CHEST_INVENTORY) | |
2737 { | |
2738 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); | |
2739 continue; | |
2740 } | |
2741 Chest::OnChestLeftClick(); | |
2742 continue; | |
2743 case UIMSG_InventoryLeftClick: | |
2744 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); | |
2745 continue; | |
2746 case UIMSG_MouseLeftClickInGame: | |
2747 /*if ( !pRenderer->pRenderD3D ) | |
2748 { | |
2749 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2750 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2751 OnGameViewportClick(); | |
2752 continue; | |
2753 }*/ | |
2754 v115 = pMessageQueue_50CBD0->uNumMessages; | |
2755 if (!pMessageQueue_50CBD0->uNumMessages) | |
2756 { | |
2757 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
2758 /*if ( (signed int)v115 < 40 ) | |
2759 //goto LABEL_769; | |
2760 { | |
2761 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
2762 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2763 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2764 ++pMessageQueue_50CBD0->uNumMessages; | |
2765 continue; | |
2766 }*/ | |
2767 } | |
2543 | 2768 else if (pMessageQueue_50CBD0->pMessages[0].field_8) |
2541 | 2769 { |
2770 pMessageQueue_50CBD0->uNumMessages = 1; | |
2771 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
2772 /*v115 = v0; | |
2773 pMessageQueue_50CBD0->uNumMessages = v0; | |
2774 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
2775 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2776 //goto LABEL_771; | |
2777 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2778 ++pMessageQueue_50CBD0->uNumMessages;*/ | |
2779 } | |
2543 | 2780 else |
2541 | 2781 { |
2543 | 2782 v115 = 0; |
2783 pMessageQueue_50CBD0->uNumMessages = 0; | |
2784 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
2785 /*if ( (signed int)v115 < 40 ) | |
2786 //goto LABEL_769; | |
2787 { | |
2788 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
2789 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2790 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2791 ++pMessageQueue_50CBD0->uNumMessages; | |
2792 continue; | |
2793 }*/ | |
2794 } | |
2541 | 2795 continue; |
2796 case UIMSG_MouseLeftClickInScreen://срабатывает при нажатии на правую кнопку мыши после UIMSG_MouseLeftClickInGame | |
2797 DoThatMessageThing(); | |
2798 OnGameViewportClick(); | |
2799 continue; | |
2800 case UIMSG_F: | |
2801 __debugbreak(); | |
2802 //if ( pRenderer->pRenderD3D ) | |
2803 { | |
2804 LOWORD(v116) = pEngine->pVisInstance->get_picked_object_zbuf_val(); | |
2805 } | |
2806 /*else | |
2807 { | |
2808 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); | |
2809 pPoint3 = pMouse->GetCursorPos(&v204); | |
2810 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; | |
2811 }*/ | |
2812 pButton2 = (GUIButton *)(unsigned __int16)v116; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2813 __debugbreak();//GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); |
2541 | 2814 continue; |
2815 case UIMSG_54: | |
2816 __debugbreak(); | |
2817 pButton2 = (GUIButton *)uMessageParam; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2818 __debugbreak();//GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); |
2541 | 2819 continue; |
2820 case UIMSG_Game_Action: | |
2821 DoThatMessageThing(); | |
2822 OnPressSpace(); | |
2823 continue; | |
2824 case UIMSG_ClickZoomOutBtn: | |
2825 if (current_screen_type) | |
2826 continue; | |
2827 pParty->uFlags |= 2u; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2828 new OnButtonClick2(519, 136, 0, 0, (int)pBtn_ZoomOut, 0); |
2541 | 2829 uNumSeconds = 131072; |
2830 v118 = 2 * viewparams->uMinimapZoom; | |
2831 ++viewparams->field_28; | |
2832 viewparams->uMinimapZoom *= 2; | |
2833 if (uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
2834 { | |
2835 if ((signed int)v118 > 4096) | |
2836 { | |
2837 viewparams->uMinimapZoom = 4096; | |
2838 viewparams->field_28 = 12; | |
2839 } | |
2840 continue; | |
2841 } | |
2842 v119 = 2048; | |
2843 if ((signed int)v118 <= 2048) | |
2844 { | |
2845 _576E2C_current_minimap_zoom = v118; | |
2846 dword_576E28 = viewparams->field_28; | |
2847 break; | |
2848 } | |
2849 viewparams->field_28 = 11; | |
2850 viewparams->uMinimapZoom = v119; | |
2851 _576E2C_current_minimap_zoom = v119; | |
2852 dword_576E28 = viewparams->field_28; | |
2853 break; | |
2854 case UIMSG_ClickZoomInBtn: | |
2855 if (current_screen_type) | |
2856 continue; | |
2857 pParty->uFlags |= 2u; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2858 new OnButtonClick2(574, 136, 0, 0, (int)pBtn_ZoomIn, 0); |
2541 | 2859 uNumSeconds = 32768; |
2860 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
2861 --viewparams->field_28; | |
2862 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
2863 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
2864 { | |
2865 v119 = 512; | |
2866 if ((signed int)v118 < 512) | |
2867 { | |
2868 viewparams->field_28 = 9; | |
2869 v118 = v119; | |
2870 viewparams->uMinimapZoom = v119; | |
2871 } | |
2872 _576E2C_current_minimap_zoom = v118; | |
2873 dword_576E28 = viewparams->field_28; | |
2874 } | |
2875 else | |
2876 { | |
2877 if ((signed int)v118 < 256) | |
2878 { | |
2879 viewparams->uMinimapZoom = 256; | |
2880 viewparams->field_28 = 8; | |
2881 } | |
2882 } | |
2883 default: | |
2884 continue; | |
2885 } | |
2886 } | |
2887 } | |
2888 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8; | |
2889 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages); | |
2890 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); | |
2891 //dword_50C9E8 = 0; | |
2892 | |
2893 | |
2894 pMessageQueue_50C9E8->uNumMessages = 0; | |
2895 if (dword_50C9DC) | |
2896 { | |
2897 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
2898 { | |
2899 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; | |
2900 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0; | |
2901 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2902 ++pMessageQueue_50CBD0->uNumMessages; | |
2903 }*/ | |
2904 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); | |
2905 dword_50C9DC = 0; | |
2906 } | |
2907 else | |
2908 { | |
2909 if (_50C9D0_AfterEnchClickEventId > 0) | |
2910 { | |
2911 _50C9D8_AfterEnchClickEventTimeout -= pEventTimer->uTimeElapsed; | |
2912 if (_50C9D8_AfterEnchClickEventTimeout <= 0) | |
2913 { | |
2914 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
2915 { | |
2916 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0; | |
2917 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4; | |
2918 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2919 ++pMessageQueue_50CBD0->uNumMessages; | |
2920 }*/ | |
2921 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)_50C9D0_AfterEnchClickEventId, _50C9D4_AfterEnchClickEventSecondParam, 0); | |
2922 _50C9D0_AfterEnchClickEventId = 0; | |
2923 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
2924 _50C9D8_AfterEnchClickEventTimeout = 0; | |
2925 } | |
2926 } | |
2927 } | |
2928 CastSpellInfoHelpers::_427E01_cast_spell(); | |
2929 } | |
2930 | |
2931 | |
2932 | |
2933 | |
2934 | |
2935 //----- (00463149) -------------------------------------------------------- | |
2936 void Game_Loop() | |
2937 { | |
2938 const char *pLocationName; // [sp-4h] [bp-68h]@74 | |
2939 bool bLoading; // [sp+10h] [bp-54h]@1 | |
2940 signed int v16; // [sp+14h] [bp-50h]@8 | |
2941 MSG Msg; // [sp+28h] [bp-3Ch]@20 | |
2942 char Source[64]; // [sp+44h] [bp-20h]@76 | |
2943 | |
2944 bLoading = sCurrentMenuID == MENU_LoadingProcInMainMenu; | |
2945 SetCurrentMenuID((MENU_STATE)-1); | |
2946 if (bLoading) | |
2947 { | |
2948 pParty->Reset(); | |
2949 uGameState = GAME_STATE_PLAYING; | |
2950 LoadGame(uLoadGameUI_SelectedSlot); | |
2951 } | |
2952 | |
2953 for (uint i = 1; i < 5; ++i) | |
2954 for (uint j = 1; j < 6; ++j) | |
2955 { | |
2956 sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j); | |
2957 remove(pTmpBuf.data()); | |
2958 } | |
2959 | |
2960 extern bool use_music_folder; | |
2961 LoadPlayerPortraintsAndVoices(); | |
2962 pIcons_LOD->_inlined_sub1(); | |
2963 if (use_music_folder) | |
2964 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
2965 else | |
2966 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
2967 | |
2968 while (2) | |
2969 { | |
2970 v16 = 1; | |
2971 pMessageQueue_50CBD0->Flush(); | |
2972 | |
2973 pPartyActionQueue->uNumActions = 0; | |
2974 if (pParty->bTurnBasedModeOn) | |
2975 { | |
2976 pTurnEngine->End(false); | |
2977 pParty->bTurnBasedModeOn = false; | |
2978 } | |
2979 DoPrepareWorld(bLoading, 1); | |
2980 pEventTimer->Resume(); | |
2981 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME; | |
2982 // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; | |
2983 current_screen_type = SCREEN_GAME; | |
2984 | |
2985 //if ( pRenderer->pRenderD3D ) | |
2986 pEngine->pVisInstance->_4C1A02(); | |
2987 | |
2988 bool game_finished = false; | |
2989 do | |
2990 { | |
2991 while (PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE)) | |
2992 { | |
2993 if (Msg.message == WM_QUIT) | |
2994 Engine_DeinitializeAndTerminate(0); | |
2995 TranslateMessage(&Msg); | |
2996 DispatchMessageA(&Msg); | |
2997 } | |
2998 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) | |
2999 { | |
3000 WaitMessage(); | |
3001 continue; | |
3002 } | |
3003 pEngine->_44EEA7(); | |
3004 GameUI_WritePointedObjectStatusString(); | |
3005 Keyboard::ProcessInputActions(); | |
3006 Game_EventLoop(); | |
3007 if (pArcomageGame->bGameInProgress) | |
3008 { | |
3009 ArcomageGame::Loop(); | |
3010 pRenderer->Present(); | |
3011 continue; | |
3012 } | |
3013 | |
3014 pMediaPlayer->HouseMovieLoop(); | |
3015 | |
3016 pEventTimer->Update(); | |
3017 pMiscTimer->Update(); | |
3018 | |
3019 OnTimer(0); | |
3020 GameUI_StatusBar_UpdateTimedString(0); | |
3021 if (pMiscTimer->bPaused && !pEventTimer->bPaused) | |
3022 pMiscTimer->Resume(); | |
3023 if (pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn) | |
3024 pEventTimer->bTackGameTime = 0; | |
3025 if (!pEventTimer->bPaused && uGameState == GAME_STATE_PLAYING) | |
3026 { | |
3027 if (!pEventTimer->bTackGameTime) | |
3028 _494035_timed_effects__water_walking_damage__etc(); | |
3029 | |
3030 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0001) | |
3031 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0001; | |
3032 else | |
3033 { | |
3034 Actor::UpdateActorAI(); | |
3035 UpdateUserInput_and_MapSpecificStuff(); | |
3036 } | |
3037 } | |
3038 if (v16) | |
3039 { | |
3040 v16 = 0; | |
3041 viewparams->bRedrawGameUI = true; | |
3042 } | |
3043 pAudioPlayer->UpdateSounds(); | |
3044 if ((signed int)uGameState == GAME_STATE_PLAYING) | |
3045 { | |
3046 pEngine->Draw(); | |
3047 continue; | |
3048 } | |
3049 if (uGameState == GAME_FINISHED) | |
3050 { | |
3051 game_finished = true; | |
3052 continue; | |
3053 } | |
3054 if (uGameState == GAME_STATE_CHANGE_LOCATION)// смена локации | |
3055 { | |
3056 pAudioPlayer->StopChannels(-1, -1); | |
3057 PrepareWorld(0); | |
3058 uGameState = GAME_STATE_PLAYING; | |
3059 continue; | |
3060 } | |
3061 if ((signed int)uGameState <= GAME_STATE_5 || uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)//GAME_STATE_NEWGAME_OUT_GAMEMENU, GAME_STATE_LOADING_GAME | |
3062 { | |
3063 game_finished = true; | |
3064 continue; | |
3065 } | |
3066 if (uGameState == GAME_STATE_FINAL_WINDOW) | |
3067 { | |
3068 pRenderer->BeginScene(); | |
3069 GUI_UpdateWindows(); | |
3070 pRenderer->EndScene(); | |
3071 pRenderer->Present(); | |
3072 continue; | |
3073 } | |
3074 if (uGameState != GAME_STATE_PARTY_DIED) | |
3075 { | |
3076 pEngine->Draw(); | |
3077 continue; | |
3078 } | |
3079 if (uGameState == GAME_STATE_PARTY_DIED) | |
3080 { | |
3081 pAudioPlayer->StopChannels(-1, -1); | |
3082 memset(&pParty->pHirelings[0], 0, 0x4Cu); | |
3083 memset(&pParty->pHirelings[1], 0, 0x4Cu); | |
3084 for (int i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i) | |
3085 { | |
3086 if (pNPCStats->pNewNPCData[i].field_24) | |
3087 pNPCStats->pNewNPCData[i].uFlags &= 0xFFFFFF7Fu; | |
3088 } | |
3089 pMediaPlayer->bStopBeforeSchedule = 0; | |
3090 pMediaPlayer->PlayFullscreenMovie(MOVIE_Death, true); | |
3091 if (pMovie_Track) | |
3092 pMediaPlayer->Unload(); | |
3093 SaveGame(0, 0); | |
3094 ++pParty->uNumDeaths; | |
3095 for (uint i = 0; i < 4; ++i) | |
3096 pParty->pPlayers[i].SetVariable(VAR_Award, 85); | |
3097 pParty->days_played_without_rest = 0; | |
3098 pParty->uTimePlayed += 0x276000ui64; | |
3099 LOWORD(pParty->uFlags) &= ~0x204; | |
3100 pParty->SetGold(0); | |
3101 pOtherOverlayList->Reset(); | |
3102 memset(pParty->pPartyBuffs.data(), 0, 0x140u); | |
3103 | |
3104 if (pParty->bTurnBasedModeOn == 1) | |
3105 { | |
3106 pTurnEngine->End(true); | |
3107 pParty->bTurnBasedModeOn = 0; | |
3108 } | |
3109 for (int i = 0; i < 4; ++i) | |
3110 { | |
3111 memset(pParty->pPlayers[i].pConditions.data(), 0, 0xA0u);//(pConditions, 0, 160) | |
3112 memset(pParty->pPlayers[i].pPlayerBuffs.data(), 0, 0x180u);//(pPlayerBuffs[0], 0, 384) | |
3113 pParty->pPlayers[i].sHealth = 1; | |
3114 uActiveCharacter = 1; | |
3115 } | |
3116 if (_449B57_test_bit(pParty->_quest_bits, PARTY_QUEST_FINISHED_EMERALD_ISLE)) | |
3117 { | |
3118 pParty->vPosition.x = -17331; // respawn in harmondale | |
3119 pParty->vPosition.y = 12547; | |
3120 pParty->vPosition.z = 465; | |
3121 pParty->sRotationY = 0; | |
3122 pLocationName = "out02.odm"; | |
3123 } | |
3124 else | |
3125 { | |
3126 pParty->vPosition.x = 12552; // respawn on emerald isle | |
3127 pParty->vPosition.y = 1816; | |
3128 pParty->vPosition.z = 0; | |
3129 pParty->sRotationY = 512; | |
3130 pLocationName = "out01.odm"; | |
3131 } | |
3132 strcpy(Source, pLocationName); | |
3133 pParty->uFallStartY = pParty->vPosition.z; | |
3134 pParty->sRotationX = 0; | |
3135 pParty->uFallSpeed = 0; | |
3136 pParty->field_6E4 = 0; | |
3137 pParty->field_6E0 = 0; | |
3138 if (_stricmp(Source, pCurrentMapName)) | |
3139 { | |
3140 strcpy(pCurrentMapName, Source); | |
3141 _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x; | |
3142 _5B65AC_npcdata_fame_or_other = pParty->vPosition.y; | |
3143 _5B65B0_npcdata_rep_or_other = pParty->vPosition.z; | |
3144 _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY; | |
3145 _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX; | |
3146 dword_5B65C0 = 1; | |
3147 PrepareWorld(1); | |
3148 } | |
3149 Actor::InitializeActors(); | |
3150 | |
3151 int num_conscious_players = 0; | |
3152 int conscious_players_ids[4] = { -1, -1, -1, -1 }; | |
3153 for (int i = 0; i < 4; ++i) | |
3154 { | |
3155 if (pParty->pPlayers[i].CanAct()) | |
3156 conscious_players_ids[num_conscious_players++] = i; | |
3157 } | |
3158 if (num_conscious_players) | |
3159 { | |
3160 int idx = conscious_players_ids[rand() % num_conscious_players]; | |
3161 Assert(idx >= 0); | |
3162 pParty->pPlayers[idx].PlaySound(SPEECH_99, 0); | |
3163 } | |
3164 | |
3165 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2);// "Once again you've cheated death!.." "Вы снова обхитрили смерть! …" | |
3166 uGameState = GAME_STATE_PLAYING; | |
3167 } | |
3168 } while (!game_finished); | |
3169 | |
3170 pEventTimer->Pause(); | |
3171 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); | |
3172 if (uGameState == GAME_STATE_LOADING_GAME) | |
3173 { | |
3174 sub_491E3A(); | |
3175 LoadPlayerPortraintsAndVoices(); | |
3176 uGameState = GAME_STATE_PLAYING; | |
3177 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles; | |
3178 bLoading = true; | |
3179 continue; | |
3180 } | |
3181 break; | |
3182 } | |
3183 current_screen_type = SCREEN_VIDEO; | |
3184 sub_491E3A(); | |
3185 } |