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