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