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