Mercurial > mm7
annotate Game/Game.cpp @ 2569:d433439699be
Слияние
author | Ritor1 |
---|---|
date | Thu, 21 May 2015 18:33:07 +0600 |
parents | 30eb6dcac768 |
children | d87bfbd3bb3b |
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; |
2566 | 1040 case SCREEN_SPELL_BOOK: |
1041 Game_OnEscape(); | |
1042 continue; | |
1043 | |
2541 | 1044 default: |
2554 | 1045 __debugbreak(); // which GAME_MENU is this? |
1046 Game_OnEscape(); | |
2541 | 1047 continue; |
1048 } | |
2554 | 1049 __debugbreak(); // which GAME_MENU is this? |
1050 Game_OnEscape(); | |
2541 | 1051 continue; |
1052 } | |
2554 | 1053 __debugbreak(); // which GAME_MENU is this? |
2541 | 1054 CharacterUI_ReleaseButtons(); |
1055 ReleaseAwardsScrollBar(); | |
1056 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1057 } | |
2554 | 1058 __debugbreak(); // which GAME_MENU is this? |
1059 Game_OnEscape(); | |
2541 | 1060 continue; |
1061 } | |
1062 continue; | |
2542 | 1063 |
2541 | 1064 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel |
1065 if (uMessageParam) | |
1066 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1067 new OnButtonClick2(626, 179, 0, 0, (int)pBtn_NPCRight, 0); |
2541 | 1068 v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2; |
1069 if (pParty->hirelingScrollPosition < v37) | |
1070 { | |
1071 ++pParty->hirelingScrollPosition;//??? maybe number of the first cell??? | |
1072 if (pParty->hirelingScrollPosition >= v37) | |
1073 pParty->hirelingScrollPosition = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2; | |
1074 } | |
1075 } | |
1076 else | |
1077 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1078 new OnButtonClick2(469, 179, 0, 0, (int)pBtn_NPCLeft, 0); |
2541 | 1079 /*if ( pParty->field_709 ) |
1080 { | |
1081 --pParty->field_709; | |
1082 if ( pParty->field_709 < 1 ) | |
1083 pParty->field_709 = 0; | |
1084 }*/ | |
1085 } | |
1086 GameUI_DrawHiredNPCs(); | |
1087 continue; | |
2542 | 1088 |
2541 | 1089 case UIMSG_TransitionUI_Confirm: |
1090 DoThatMessageThing(); | |
1091 dword_50CDC8 = 1; | |
1092 sub_42FBDD(); | |
1093 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1094 | |
1095 if (pMovie_Track) | |
1096 pMediaPlayer->Unload(); | |
1097 DialogueEnding(); | |
1098 viewparams->bRedrawGameUI = true; | |
1099 if (dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz) | |
1100 { | |
1101 if (dword_59117C_teleportx) | |
1102 { | |
1103 pParty->vPosition.x = dword_59117C_teleportx; | |
1104 _5B65A8_npcdata_uflags_or_other = dword_59117C_teleportx; | |
1105 } | |
1106 if (dword_591178_teleporty) | |
1107 { | |
1108 pParty->vPosition.y = dword_591178_teleporty; | |
1109 _5B65AC_npcdata_fame_or_other = dword_591178_teleporty; | |
1110 } | |
1111 if (dword_591174_teleportz) | |
1112 { | |
1113 pParty->vPosition.z = dword_591174_teleportz; | |
1114 _5B65B0_npcdata_rep_or_other = dword_591174_teleportz; | |
1115 pParty->uFallStartY = dword_591174_teleportz; | |
1116 } | |
1117 if (dword_591170_teleport_directiony) | |
1118 { | |
1119 pParty->sRotationY = dword_591170_teleport_directiony; | |
1120 _5B65B4_npcdata_loword_house_or_other = dword_591170_teleport_directiony; | |
1121 } | |
1122 if (dword_59116C_teleport_directionx) | |
1123 { | |
1124 pParty->sRotationX = dword_59116C_teleport_directionx; | |
1125 _5B65B8_npcdata_hiword_house_or_other = dword_59116C_teleport_directionx; | |
1126 v38 = dword_591168_teleport_speedz; | |
1127 pParty->uFallSpeed = dword_591168_teleport_speedz; | |
1128 dword_5B65BC = dword_591168_teleport_speedz; | |
1129 } | |
1130 else | |
1131 v38 = dword_5B65BC; | |
1132 if (*dword_591164_teleport_map_name != 48) | |
1133 { | |
1134 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)2; | |
1135 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; | |
1136 OnMapLeave(); | |
1137 Transition_StopSound_Autosave(dword_591164_teleport_map_name, MapStartPoint_Party); | |
1138 } | |
1139 } | |
1140 else | |
1141 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); | |
1142 if (!_stricmp(byte_6BE3B0.data(), "d05.blv")) | |
1143 pParty->uTimePlayed += 1474560i64; | |
1144 continue; | |
1145 case UIMSG_TransitionWindowCloseBtn: | |
1146 CloseWindowBackground(); | |
1147 pMediaPlayer->Unload(); | |
1148 DialogueEnding(); | |
1149 viewparams->bRedrawGameUI = true; | |
1150 continue; | |
1151 case UIMSG_CycleCharacters: | |
1152 v39 = GetAsyncKeyState(VK_SHIFT); | |
1153 uActiveCharacter = CycleCharacter(v39); | |
1154 viewparams->bRedrawGameUI = true; | |
1155 continue; | |
1156 case UIMSG_OnTravelByFoot: | |
1157 DoThatMessageThing(); | |
1158 dword_50CDC8 = 1; | |
1159 sub_42FBDD(); | |
1160 //pNPCData4 = (NPCData *)GetTravelTime(); | |
1161 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); | |
1162 if (bUnderwater != 1 && pParty->bFlying | |
1163 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1) | |
1164 { | |
1165 viewparams->bRedrawGameUI = 1; | |
1166 CloseWindowBackground(); | |
1167 if (pParty->vPosition.x < -22528) | |
1168 pParty->vPosition.x = -22528; | |
1169 if (pParty->vPosition.x > 22528) | |
1170 pParty->vPosition.x = 22528; | |
1171 if (pParty->vPosition.y < -22528) | |
1172 pParty->vPosition.y = -22528; | |
1173 if (pParty->vPosition.y > 22528) | |
1174 pParty->vPosition.y = 22528; | |
1175 DialogueEnding(); | |
1176 current_screen_type = SCREEN_GAME; | |
1177 } | |
1178 else | |
1179 { | |
1180 pParty->field_6E4 = 0; | |
1181 pParty->field_6E0 = 0; | |
1182 CastSpellInfoHelpers::_427D48(); | |
1183 DialogueEnding(); | |
1184 pEventTimer->Pause(); | |
1185 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); | |
1186 ++pGameLoadingUI_ProgressBar->uProgressMax; | |
1187 SaveGame(1, 0); | |
1188 pGameLoadingUI_ProgressBar->Progress(); | |
1189 RestAndHeal(1440 * (signed int)GetTravelTime()); | |
1190 if (pParty->uNumFoodRations) | |
1191 { | |
1192 pParty->RestAndHeal(); | |
1193 if (((pParty->uNumFoodRations - (signed int)GetTravelTime()) & 0x80000000u) != 0) | |
1194 { | |
1195 pPlayer7 = pParty->pPlayers.data(); | |
1196 do | |
1197 { | |
1198 pPlayer7->SetCondition(1, 0); | |
1199 ++pPlayer7; | |
1200 } while ((signed int)pPlayer7 < (signed int)pParty->pHirelings.data()); | |
1201 ++pParty->days_played_without_rest; | |
1202 } | |
1203 Party::TakeFood((unsigned int)GetTravelTime()); | |
1204 } | |
1205 else | |
1206 { | |
1207 pPlayer8 = pParty->pPlayers.data(); | |
1208 do | |
1209 { | |
1210 pPlayer8->SetCondition(1, 0); | |
1211 ++pPlayer8; | |
1212 } while ((signed int)pPlayer8 < (signed int)pParty->pHirelings.data()); | |
1213 ++pParty->days_played_without_rest; | |
1214 } | |
1215 pPaletteManager->ResetNonLocked(); | |
1216 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
1217 strcpy(pCurrentMapName, pOut); | |
1218 strcpy(pLevelName, pCurrentMapName); | |
1219 v41 = strtok(pLevelName, "."); | |
1220 strcpy(pLevelName, v41); | |
1221 Level_LoadEvtAndStr(pLevelName); | |
1222 pDecalBuilder->Reset(0); | |
1223 LoadLevel_InitializeLevelEvt(); | |
1224 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName); | |
1225 bUnderwater = 0; | |
1226 bNoNPCHiring = 0; | |
1227 pEngine->uFlags2 &= 0xFFFFFFF7u; | |
1228 if (Is_out15odm_underwater()) | |
1229 { | |
1230 bUnderwater = 1; | |
1231 pEngine->uFlags2 |= 8u; | |
1232 } | |
1233 if (!_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv")) | |
1234 bNoNPCHiring = 1; | |
1235 PrepareToLoadODM(1u, (ODMRenderParams *)1); | |
1236 pAudioPlayer->SetMapEAX(); | |
1237 bDialogueUI_InitializeActor_NPC_ID = 0; | |
1238 OnMapLoad(); | |
1239 pOutdoor->SetFog(); | |
1240 TeleportToStartingPoint(uLevel_StartingPointType); | |
1241 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0); | |
1242 pParty->uFallStartY = pParty->vPosition.z; | |
1243 _461103_load_level_sub(); | |
1244 pEventTimer->Resume(); | |
1245 viewparams->bRedrawGameUI = 1; | |
1246 current_screen_type = SCREEN_GAME; | |
1247 pGameLoadingUI_ProgressBar->Release(); | |
1248 } | |
1249 viewparams->bRedrawGameUI = 1; | |
1250 continue; | |
1251 case UIMSG_CHANGE_LOCATION_ClickCencelBtn: | |
1252 CloseWindowBackground(); | |
1253 if (pParty->vPosition.x < -22528) | |
1254 pParty->vPosition.x = -22528; | |
1255 if (pParty->vPosition.x > 22528) | |
1256 pParty->vPosition.x = 22528; | |
1257 if (pParty->vPosition.y < -22528) | |
1258 pParty->vPosition.y = -22528; | |
1259 if (pParty->vPosition.y > 22528) | |
1260 pParty->vPosition.y = 22528; | |
1261 DialogueEnding(); | |
1262 current_screen_type = SCREEN_GAME; | |
2542 | 1263 viewparams->bRedrawGameUI = true; |
2541 | 1264 continue; |
1265 case UIMSG_CastSpell_Telekinesis: | |
1266 //if ( pRenderer->pRenderD3D ) | |
1267 LOWORD(v42) = pEngine->pVisInstance->get_picked_object_zbuf_val(); | |
1268 /*else | |
1269 { | |
1270 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | |
1271 pPoint = pMouse->GetCursorPos(&v208); | |
1272 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | |
1273 }*/ | |
1274 v44 = (unsigned __int16)v42; | |
1275 v45 = PID_TYPE(v44); | |
1276 uNumSeconds = v44; | |
1277 v46 = PID_ID(v44); | |
1278 if (v45 == 3) | |
1279 { | |
1280 v47 = pActors[v46].uAIState == Dead; | |
1281 if (!v47) | |
1282 continue; | |
2554 | 1283 pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C; |
2541 | 1284 pSpellInfo->uFlags &= ~0x40u; |
1285 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1286 pSpellInfo->spell_target_pid = v44; | |
1287 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2554 | 1288 pGUIWindow_CastTargetedSpell->Release(); |
1289 pGUIWindow_CastTargetedSpell = 0; | |
2541 | 1290 pMouse->SetCursorBitmap("MICON1"); |
1291 GameUI_Footer_TimeLeft = 0; | |
1292 _50C9A0_IsEnchantingInProgress = 0; | |
1293 back_to_game(); | |
1294 continue; | |
1295 } | |
1296 if (v45 == 2) | |
1297 { | |
1298 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; | |
1299 if (!v47) | |
1300 continue; | |
2554 | 1301 pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C; |
2541 | 1302 pSpellInfo->uFlags &= ~0x40u; |
1303 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1304 pSpellInfo->spell_target_pid = v44; | |
1305 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2554 | 1306 pGUIWindow_CastTargetedSpell->Release(); |
1307 pGUIWindow_CastTargetedSpell = 0; | |
2541 | 1308 pMouse->SetCursorBitmap("MICON1"); |
1309 GameUI_Footer_TimeLeft = 0; | |
1310 _50C9A0_IsEnchantingInProgress = 0; | |
1311 back_to_game(); | |
1312 continue; | |
1313 } | |
1314 if (v45 == 5) | |
1315 { | |
1316 v48 = pLevelDecorations[v46].uEventID == 0; | |
1317 } | |
1318 else | |
1319 { | |
1320 if (v45 != 6) | |
1321 continue; | |
1322 if (uCurrentlyLoadedLevelType != 1) | |
1323 { | |
1324 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; | |
1325 if (!pODMFace->Clickable() || !pODMFace->sCogTriggeredID) | |
1326 continue; | |
1327 v44 = uNumSeconds; | |
2554 | 1328 pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C; |
2541 | 1329 pSpellInfo->uFlags &= ~0x40u; |
1330 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1331 pSpellInfo->spell_target_pid = v44; | |
1332 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2554 | 1333 pGUIWindow_CastTargetedSpell->Release(); |
1334 pGUIWindow_CastTargetedSpell = 0; | |
2541 | 1335 pMouse->SetCursorBitmap("MICON1"); |
1336 GameUI_Footer_TimeLeft = 0; | |
1337 _50C9A0_IsEnchantingInProgress = 0; | |
1338 back_to_game(); | |
1339 continue; | |
1340 } | |
1341 pBLVFace = &pIndoor->pFaces[v46]; | |
1342 if (!pBLVFace->Clickable()) | |
1343 continue; | |
1344 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0; | |
1345 } | |
1346 if (v48) | |
1347 continue; | |
2554 | 1348 pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C; |
2541 | 1349 pSpellInfo->uFlags &= ~0x40u; |
1350 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1351 pSpellInfo->spell_target_pid = v44; | |
1352 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2554 | 1353 pGUIWindow_CastTargetedSpell->Release(); |
1354 pGUIWindow_CastTargetedSpell = 0; | |
2541 | 1355 pMouse->SetCursorBitmap("MICON1"); |
1356 GameUI_Footer_TimeLeft = 0; | |
1357 _50C9A0_IsEnchantingInProgress = 0; | |
1358 back_to_game(); | |
1359 continue; | |
1360 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) | |
1361 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure | |
1362 case UIMSG_HiredNPC_CastSpell: | |
1363 DoThatMessageThing(); | |
1364 if (_50C9A0_IsEnchantingInProgress) | |
1365 { | |
1366 uActiveCharacter = uMessageParam; | |
1367 viewparams->bRedrawGameUI = 1; | |
1368 } | |
1369 else | |
1370 { | |
2554 | 1371 if (pGUIWindow_CastTargetedSpell) |
2541 | 1372 { |
2554 | 1373 pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C; |
2541 | 1374 switch (uMessage) |
1375 { | |
1376 case UIMSG_CastSpell_Character_Big_Improvement: | |
1377 pSpellInfo->uFlags &= ~0x02u; | |
1378 break; | |
1379 case UIMSG_CastSpell_Character_Small_Improvement: | |
1380 pSpellInfo->uFlags &= ~0x0100u; | |
1381 break; | |
1382 case UIMSG_HiredNPC_CastSpell: | |
1383 pSpellInfo->uFlags &= ~0x0200u; | |
1384 break; | |
1385 } | |
1386 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1387 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2554 | 1388 pGUIWindow_CastTargetedSpell->Release(); |
1389 pGUIWindow_CastTargetedSpell = 0; | |
2541 | 1390 pEventTimer->Resume(); |
1391 pMouse->SetCursorBitmap("MICON1"); | |
1392 GameUI_Footer_TimeLeft = 0; | |
1393 _50C9A0_IsEnchantingInProgress = 0; | |
1394 } | |
1395 } | |
1396 continue; | |
2542 | 1397 |
2541 | 1398 case UIMSG_BF: |
1399 __debugbreak(); | |
1400 dword_50CDC8 = 1; | |
1401 sub_42FBDD(); | |
1402 SaveGame(1, 0); | |
1403 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); | |
1404 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; | |
1405 uGameState = GAME_STATE_CHANGE_LOCATION; | |
1406 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; | |
1407 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; | |
1408 if (v53 < 0) | |
1409 { | |
1410 v54 = abs(v53) - 1; | |
1411 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1412 dword_5B65BC = 0; | |
1413 v55 = dword_4E4560[v54]; | |
1414 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54]; | |
1415 v56 = dword_4E4590[v54]; | |
1416 v57 = dword_4E45A8[v54]; | |
1417 _5B65A8_npcdata_uflags_or_other = v55; | |
1418 _5B65B4_npcdata_loword_house_or_other = v57; | |
1419 _5B65B0_npcdata_rep_or_other = v56; | |
1420 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57; | |
1421 } | |
1422 HouseDialogPressCloseBtn(); | |
1423 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
1424 continue; | |
1425 | |
1426 case UIMSG_OnCastTownPortal: | |
1427 pAudioPlayer->StopChannels(-1, -1); | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2547
diff
changeset
|
1428 pGUIWindow_CurrentMenu = new GUIWindow_TownPortalBook((char *)uMessageParam); |
2541 | 1429 continue; |
1430 | |
1431 case UIMSG_OnCastLloydsBeacon: | |
1432 pAudioPlayer->StopChannels(-1, -1); | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2547
diff
changeset
|
1433 pGUIWindow_CurrentMenu = new GUIWindow_LloydsBook(); |
2541 | 1434 continue; |
1435 | |
1436 case UIMSG_LloydsBeacon_FlippingBtn: | |
1437 bRecallingBeacon = uMessageParam; | |
1438 v127 = uMessageParam + 204; | |
1439 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); | |
1440 continue; | |
1441 case UIMSG_HintBeaconSlot: | |
1442 if (!pGUIWindow_CurrentMenu) | |
1443 continue; | |
1444 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1]; | |
1445 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; | |
1446 if (bRecallingBeacon) | |
1447 { | |
1448 if (!*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels)) | |
1449 continue; | |
1450 v173 = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName; | |
1451 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" | |
1452 GameUI_SetFooterString(pTmpBuf.data()); | |
1453 continue; | |
1454 } | |
1455 pMapNum = pMapStats->GetMapInfo(pCurrentMapName); | |
1456 pMapName = "Not in Map Stats"; | |
1457 if (pMapNum) | |
1458 pMapName = pMapStats->pInfos[pMapNum].pName; | |
1459 if (!*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels) || !pMapNum) | |
1460 { | |
1461 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], pMapName);// "Set to %s" | |
1462 GameUI_SetFooterString(pTmpBuf.data()); | |
1463 continue; | |
1464 } | |
1465 v174 = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; | |
1466 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], (unsigned int)pMapName, v174);// "Set %s over %s" | |
1467 GameUI_SetFooterString(pTmpBuf.data()); | |
1468 continue; | |
1469 case UIMSG_CloseAfterInstallBeacon: | |
1470 dword_50CDC8 = 1; | |
1471 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1472 continue; | |
1473 case UIMSG_InstallBeacon: | |
1474 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1]; | |
1475 if (!pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime && bRecallingBeacon) | |
1476 continue; | |
1477 byte_506360 = 1; | |
1478 pPlayer9->CanCastSpell(uRequiredMana); | |
1479 if (pParty->bTurnBasedModeOn) | |
1480 { | |
1481 v60 = sRecoveryTime; | |
1482 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; | |
1483 pPlayer9->SetRecoveryTime(v60); | |
1484 pTurnEngine->ApplyPlayerAction(); | |
1485 } | |
1486 else | |
1487 { | |
1488 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
1489 } | |
1490 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[lloyds_beacon_spell_id], 0, 0, -1, 0, lloyds_beacon_sound_id, 0, 0); | |
1491 if (bRecallingBeacon) | |
1492 { | |
1493 if (_stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID])) | |
1494 { | |
1495 SaveGame(1, 0); | |
1496 OnMapLeave(); | |
1497 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); | |
1498 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; | |
1499 uGameState = GAME_STATE_CHANGE_LOCATION; | |
1500 _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; | |
1501 _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | |
1502 _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | |
1503 _5B65B4_npcdata_loword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; | |
1504 _5B65B8_npcdata_hiword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; | |
1505 dword_5B65C0 = 1; | |
1506 } | |
1507 else | |
1508 { | |
1509 pParty->vPosition.x = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; | |
1510 pParty->vPosition.y = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | |
1511 pParty->vPosition.z = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | |
1512 pParty->uFallStartY = pParty->vPosition.z; | |
1513 pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; | |
1514 pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; | |
1515 } | |
1516 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2547
diff
changeset
|
1517 pBooksButtonOverlay->Release(); |
2541 | 1518 pGUIWindow_CurrentMenu->Release(); |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2547
diff
changeset
|
1519 pBooksButtonOverlay = 0; |
2541 | 1520 pGUIWindow_CurrentMenu = 0; |
1521 } | |
1522 else | |
1523 { | |
1524 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); | |
1525 pRenderer->SaveScreenshot(a1, 92, 68); | |
1526 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); | |
1527 pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(lloyds_beacon_spell_level << 7) * 0.033333335); | |
1528 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x; | |
1529 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y = pParty->vPosition.y; | |
1530 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z = pParty->vPosition.z; | |
1531 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X = LOWORD(pParty->sRotationY); | |
1532 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX); | |
1533 if ((signed int)pGames_LOD->uNumSubDirs / 2 <= 0) | |
1534 continue; | |
1535 for (thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg) | |
1536 { | |
1537 if (!_stricmp(pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName)) | |
1538 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; | |
1539 } | |
1540 } | |
1541 continue; | |
1542 case UIMSG_ClickTownInTP: | |
1543 if (uMessageParam) | |
1544 { | |
1545 switch (uMessageParam) | |
1546 { | |
1547 case 1: | |
1548 v63 = 208; | |
1549 break; | |
1550 case 2: | |
1551 v63 = 207; | |
1552 break; | |
1553 case 3: | |
1554 v63 = 211; | |
1555 break; | |
1556 case 4: | |
1557 v63 = 209; | |
1558 break; | |
1559 default: | |
1560 if (uMessageParam != 5) | |
1561 { | |
1562 LABEL_486: | |
1563 SaveGame(1, 0); | |
1564 v64 = pMapStats->GetMapInfo(pCurrentMapName); | |
1565 v65 = uMessageParam; | |
1566 if (v64 == TownPortalList[uMessageParam].uMapInfoID) | |
1567 { | |
1568 pParty->vPosition.x = TownPortalList[v65].pos.x; | |
1569 pParty->vPosition.y = TownPortalList[v65].pos.y; | |
1570 pParty->vPosition.z = TownPortalList[v65].pos.z; | |
1571 pParty->uFallStartY = pParty->vPosition.z; | |
1572 pParty->sRotationY = TownPortalList[v65].rot_y; | |
1573 pParty->sRotationX = TownPortalList[v65].rot_x; | |
1574 } | |
1575 else | |
1576 { | |
1577 SaveGame(1, 0); | |
1578 OnMapLeave(); | |
1579 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; | |
1580 uGameState = GAME_STATE_CHANGE_LOCATION; | |
1581 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); | |
1582 dword_5B65C0 = 1; | |
1583 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; | |
1584 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | |
1585 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | |
1586 v66 = TownPortalList[uMessageParam].rot_x; | |
1587 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; | |
1588 _5B65B8_npcdata_hiword_house_or_other = v66; | |
1589 Actor::InitializeActors(); | |
1590 } | |
1591 v67 = (char*)pGUIWindow_CurrentMenu->Hint; | |
1592 if (v67) | |
1593 *((int *)v67 + 17) = 1; | |
1594 else | |
1595 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); | |
2543 | 1596 |
2541 | 1597 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); |
1598 continue; | |
1599 } | |
1600 v63 = 210; | |
1601 break; | |
1602 } | |
1603 } | |
1604 else | |
1605 { | |
1606 v63 = 206; | |
1607 } | |
1608 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63)) | |
1609 return; | |
1610 goto LABEL_486; | |
1611 case UIMSG_HintTownPortal: | |
1612 if (uMessageParam) | |
1613 { | |
1614 switch (uMessageParam) | |
1615 { | |
1616 case 1: | |
1617 v68 = 208; | |
1618 break; | |
1619 case 2: | |
1620 v68 = 207; | |
1621 break; | |
1622 case 3: | |
1623 v68 = 211; | |
1624 break; | |
1625 case 4: | |
1626 v68 = 209; | |
1627 break; | |
1628 default: | |
1629 if (uMessageParam != 5) | |
1630 //goto LABEL_506; | |
1631 { | |
1632 if (uMessageParam) | |
1633 { | |
1634 switch (uMessageParam) | |
1635 { | |
1636 case 1: | |
1637 v69 = pMapStats->pInfos[4].pName; | |
1638 break; | |
1639 case 2: | |
1640 v69 = pMapStats->pInfos[3].pName; | |
1641 break; | |
1642 case 3: | |
1643 v69 = pMapStats->pInfos[10].pName; | |
1644 break; | |
1645 case 4: | |
1646 v69 = pMapStats->pInfos[7].pName; | |
1647 break; | |
1648 default: | |
1649 if (uMessageParam != 5) | |
1650 { | |
1651 __debugbreak(); // warning C4700: uninitialized local variable 'v200' used | |
1652 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); | |
1653 GameUI_SetFooterString(pTmpBuf.data()); | |
1654 continue; | |
1655 } | |
1656 v69 = pMapStats->pInfos[8].pName; | |
1657 break; | |
1658 } | |
1659 } | |
1660 else | |
1661 { | |
1662 v69 = pMapStats->pInfos[21].pName; | |
1663 } | |
1664 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); | |
1665 GameUI_SetFooterString(pTmpBuf.data()); | |
1666 continue; | |
1667 } | |
1668 v68 = 210; | |
1669 break; | |
1670 } | |
1671 } | |
1672 else | |
1673 { | |
1674 v68 = 206; | |
1675 } | |
1676 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68)) | |
1677 { | |
1678 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | |
1679 continue; | |
1680 } | |
1681 //LABEL_506: | |
1682 if (uMessageParam) | |
1683 { | |
1684 switch (uMessageParam) | |
1685 { | |
1686 case 1: | |
1687 v69 = pMapStats->pInfos[4].pName; | |
1688 break; | |
1689 case 2: | |
1690 v69 = pMapStats->pInfos[3].pName; | |
1691 break; | |
1692 case 3: | |
1693 v69 = pMapStats->pInfos[10].pName; | |
1694 break; | |
1695 case 4: | |
1696 v69 = pMapStats->pInfos[7].pName; | |
1697 break; | |
1698 default: | |
1699 if (uMessageParam != 5) | |
1700 //goto LABEL_519; | |
1701 { | |
1702 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); | |
1703 GameUI_SetFooterString(pTmpBuf.data()); | |
1704 continue; | |
1705 } | |
1706 v69 = pMapStats->pInfos[8].pName; | |
1707 break; | |
1708 } | |
1709 } | |
1710 else | |
1711 { | |
1712 v69 = pMapStats->pInfos[21].pName; | |
1713 } | |
1714 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); | |
1715 GameUI_SetFooterString(pTmpBuf.data()); | |
1716 continue; | |
1717 case UIMSG_ShowFinalWindow: | |
1718 sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." | |
1719 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." | |
1720 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." | |
2547 | 1721 pModalWindow = new GUIWindow_Modal(pFinalMessage.data(), UIMSG_OnFinalWindowClose); |
2541 | 1722 uGameState = GAME_STATE_FINAL_WINDOW; |
1723 continue; | |
1724 case UIMSG_OnFinalWindowClose: | |
1725 __debugbreak(); | |
1726 uGameState = GAME_STATE_PLAYING; | |
1727 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); | |
1728 __debugbreak(); // missed break/continue? | |
1729 case UIMSG_DD: | |
1730 __debugbreak(); | |
1731 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); | |
1732 memcpy(&v216, txt_file_frametable_parser(pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); | |
1733 if (v216.uPropCount == 1) | |
1734 { | |
1735 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); | |
1736 v70 = atoi(v216.pProperties[0]); | |
1737 if (v70 <= 0 || v70 >= 77) | |
1738 continue; | |
1739 v71 = v70; | |
1740 strcpy(Str2, pMapStats->pInfos[v70].pFilename); | |
1741 pNPCData3 = 0; | |
1742 if ((signed int)pNPCData4 > 0) | |
1743 { | |
1744 thish = 0; | |
1745 do | |
1746 { | |
1747 if (!_stricmp(pGames_LOD->pSubIndices[thish].pFilename, Str2)) | |
1748 break; | |
1749 ++thish; | |
1750 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | |
1751 } while ((signed int)pNPCData3 < (signed int)pNPCData4); | |
1752 if ((signed int)pNPCData3 < (signed int)pNPCData4) | |
1753 { | |
1754 strcpy(pCurrentMapName, pGames_LOD->pSubIndices[(int)pNPCData3].pFilename); | |
1755 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; | |
1756 uGameState = GAME_STATE_CHANGE_LOCATION; | |
1757 OnMapLeave(); | |
1758 continue; | |
1759 } | |
1760 } | |
1761 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); | |
1762 v73 = Str2; | |
1763 } | |
1764 else | |
1765 { | |
1766 if (v216.uPropCount != 3) | |
1767 continue; | |
1768 v74 = atoi(v216.pProperties[0]); | |
1769 thisi = atoi(v216.pProperties[1]); | |
1770 v75 = atoi(v216.pProperties[2]); | |
1771 v76 = v75; | |
1772 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1773 { | |
1774 if (pIndoor->GetSector(v74, thisi, v75)) | |
1775 { | |
1776 v77 = thisi; | |
1777 pParty->vPosition.x = v74; | |
1778 pParty->vPosition.y = v77; | |
1779 pParty->vPosition.z = v76; | |
1780 pParty->uFallStartY = v76; | |
1781 continue; | |
1782 } | |
1783 } | |
1784 else | |
1785 { | |
1786 if (v74 > -32768) | |
1787 { | |
1788 if (v74 < 32768) | |
1789 { | |
1790 v77 = thisi; | |
1791 if (thisi > -32768) | |
1792 { | |
1793 if (thisi < 32768 && v76 >= 0 && v76 < 10000) | |
1794 { | |
1795 pParty->vPosition.x = v74; | |
1796 pParty->vPosition.y = v77; | |
1797 pParty->vPosition.z = v76; | |
1798 pParty->uFallStartY = v76; | |
1799 continue; | |
1800 } | |
1801 } | |
1802 } | |
1803 } | |
1804 } | |
1805 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
1806 v73 = "Can't jump to that location!"; | |
1807 } | |
1808 ShowStatusBarString(v73, 6); | |
1809 continue; | |
1810 case UIMSG_CastQuickSpell: | |
1811 if (bUnderwater == 1) | |
1812 { | |
1813 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
1814 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
1815 continue; | |
1816 } | |
1817 if (!uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery)) | |
1818 continue; | |
2566 | 1819 _42777D_CastSpell_UseWand_ShootArrow((SPELL_TYPE)pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); |
2541 | 1820 continue; |
1821 case UIMSG_CastSpell_Monster_Improvement: | |
1822 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, | |
1823 //if ( pRenderer->pRenderD3D ) | |
1824 { | |
1825 v81 = pEngine->pVisInstance->get_picked_object_zbuf_val(); | |
1826 } | |
1827 /*else | |
1828 { | |
1829 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206); | |
1830 pPoint2 = pMouse->GetCursorPos(&v201); | |
1831 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | |
1832 }*/ | |
1833 v83 = v81; | |
1834 v44 = (unsigned __int16)v81; | |
1835 v84 = v83 >> 16; | |
1836 if (PID_TYPE(v44) != 3 || v84 >= 5120) | |
1837 continue; | |
2554 | 1838 pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C; |
2541 | 1839 if (uMessage == UIMSG_CastSpell_Shoot_Monster) |
1840 { | |
1841 pSpellInfo->uFlags &= ~0x08; | |
1842 } | |
1843 else | |
1844 { | |
1845 if (uMessage == UIMSG_CastSpell_Monster_Improvement) | |
1846 pSpellInfo->uFlags &= ~0x0100u; | |
1847 else | |
1848 pSpellInfo->uFlags &= ~0x0200u; | |
1849 } | |
1850 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1851 pSpellInfo->spell_target_pid = v44; | |
1852 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2554 | 1853 pGUIWindow_CastTargetedSpell->Release(); |
1854 pGUIWindow_CastTargetedSpell = 0; | |
2541 | 1855 pMouse->SetCursorBitmap("MICON1"); |
1856 GameUI_Footer_TimeLeft = 0; | |
1857 _50C9A0_IsEnchantingInProgress = 0; | |
1858 back_to_game(); | |
1859 continue; | |
1860 case UIMSG_1C: | |
1861 __debugbreak(); | |
2543 | 1862 if (!uActiveCharacter || current_screen_type != SCREEN_GAME) |
2541 | 1863 continue; |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1864 __debugbreak();//ptr_507BC8 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_68, uMessageParam, 0); |
2541 | 1865 current_screen_type = SCREEN_19; |
1866 pEventTimer->Pause(); | |
1867 continue; | |
1868 case UIMSG_STEALFROMACTOR: | |
1869 if (!uActiveCharacter) | |
1870 continue; | |
1871 if (pParty->bTurnBasedModeOn != 1) | |
1872 { | |
1873 if (pActors[uMessageParam].uAIState == 5) | |
1874 pActors[uMessageParam].LootActor(); | |
1875 else | |
1876 Actor::StealFrom(uMessageParam); | |
1877 continue; | |
1878 } | |
1879 if (pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT) | |
1880 continue; | |
1881 if (!(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS)) | |
1882 { | |
1883 if (pActors[uMessageParam].uAIState == 5) | |
1884 pActors[uMessageParam].LootActor(); | |
1885 else | |
1886 Actor::StealFrom(uMessageParam); | |
1887 } | |
1888 continue; | |
1889 | |
1890 case UIMSG_Attack: | |
1891 if (!uActiveCharacter) | |
1892 continue; | |
1893 if (pParty->bTurnBasedModeOn != 1) | |
1894 { | |
1895 Player::_42ECB5_PlayerAttacksActor(); | |
1896 continue; | |
1897 } | |
1898 if (pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT) | |
1899 continue; | |
1900 if (!(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS)) | |
1901 Player::_42ECB5_PlayerAttacksActor(); | |
1902 continue; | |
1903 case UIMSG_ExitRest: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1904 new OnCancel(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" |
2541 | 1905 continue; |
1906 case UIMSG_Wait5Minutes: | |
2543 | 1907 if (_506F14_resting_stage == 2) |
2541 | 1908 { |
1909 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
1910 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
1911 continue; | |
1912 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1913 new OnButtonClick2(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, |
2541 | 1914 (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" |
2543 | 1915 _506F14_resting_stage = 1; |
2541 | 1916 _506F18_num_minutes_to_sleep = 5; |
1917 continue; | |
1918 case UIMSG_Wait1Hour: | |
2543 | 1919 if (_506F14_resting_stage == 2) |
2541 | 1920 { |
1921 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
1922 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
1923 continue; | |
1924 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1925 new OnButtonClick2(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, |
2541 | 1926 (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" |
2543 | 1927 _506F14_resting_stage = 1; |
2541 | 1928 _506F18_num_minutes_to_sleep = 60; |
1929 continue; | |
1930 case UIMSG_RentRoom: | |
2543 | 1931 _506F14_resting_stage = 2; |
1932 | |
2549 | 1933 pGUIWindow_CurrentMenu = new GUIWindow_Rest(); |
2543 | 1934 |
2541 | 1935 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; |
1936 _506F18_num_minutes_to_sleep = v86; | |
1937 if (uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116) // 107 = Emerald Isle tavern | |
1938 _506F18_num_minutes_to_sleep = v86 + 12 * 60; | |
2543 | 1939 _506F14_resting_stage = 2; |
2541 | 1940 pParty->RestAndHeal(); |
1941 pParty->days_played_without_rest = 0; | |
1942 pParty->pPlayers[3].SetAsleep(1); | |
1943 pParty->pPlayers[2].SetAsleep(1); | |
1944 pParty->pPlayers[1].SetAsleep(1); | |
1945 pParty->pPlayers[0].SetAsleep(1); | |
1946 continue; | |
1947 case UIMSG_RestWindow: | |
1948 DoThatMessageThing(); | |
2543 | 1949 if (current_screen_type != SCREEN_GAME) |
2541 | 1950 continue; |
1951 if (CheckActors_proximity()) | |
1952 { | |
1953 if (pParty->bTurnBasedModeOn == 1) | |
1954 { | |
1955 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
1956 continue; | |
1957 } | |
1958 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
1959 if (pParty->uFlags & 0x88) | |
1960 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
1961 ShowStatusBarString(v88, 2); | |
1962 if (!uActiveCharacter) | |
1963 continue; | |
1964 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); | |
1965 continue; | |
1966 } | |
1967 if (pParty->bTurnBasedModeOn == 1) | |
1968 { | |
1969 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
1970 continue; | |
1971 } | |
1972 if (!(pParty->uFlags & 0x88)) | |
1973 { | |
2549 | 1974 pGUIWindow_CurrentMenu = new GUIWindow_Rest(); |
2541 | 1975 continue; |
1976 } | |
1977 if (pParty->bTurnBasedModeOn == 1) | |
1978 { | |
1979 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
1980 continue; | |
1981 } | |
1982 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
1983 if (pParty->uFlags & 0x88) | |
1984 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
2543 | 1985 ShowStatusBarString(v88, 2); |
2541 | 1986 if (!uActiveCharacter) |
1987 continue; | |
2543 | 1988 pPlayers[uActiveCharacter]->PlaySound(SPEECH_CantRestHere, 0); |
2541 | 1989 continue; |
1990 case UIMSG_Rest8Hour: | |
2543 | 1991 if (_506F14_resting_stage != 0) |
2541 | 1992 { |
1993 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
1994 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
1995 continue; | |
1996 } | |
1997 if (pParty->uNumFoodRations < uRestUI_FoodRequiredToRest) | |
1998 { | |
2543 | 1999 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2);// "You don't have enough food to rest" |
2541 | 2000 if (uActiveCharacter && pPlayers[uActiveCharacter]->CanAct()) |
2543 | 2001 pPlayers[uActiveCharacter]->PlaySound(SPEECH_108, 0); |
2541 | 2002 } |
2003 else | |
2004 { | |
2005 pParty->pPlayers[3].pConditions[Condition_Sleep] = pParty->uTimePlayed; | |
2006 pParty->pPlayers[2].pConditions[Condition_Sleep] = pParty->uTimePlayed; | |
2007 pParty->pPlayers[1].pConditions[Condition_Sleep] = pParty->uTimePlayed; | |
2008 pParty->pPlayers[0].pConditions[Condition_Sleep] = pParty->uTimePlayed; | |
2009 v90 = pMapStats->GetMapInfo(pCurrentMapName); | |
2010 if (!v90) | |
2011 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | |
2012 pMapInfo = &pMapStats->pInfos[v90]; | |
2013 if (rand() % 100 + 1 <= pMapInfo->Encounter_percent) | |
2014 { | |
2015 v91 = rand() % 100; | |
2016 v92 = pMapInfo->EncM1percent; | |
2017 v93 = v91 + 1; | |
2018 if (v93 > v92) | |
2019 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); | |
2020 else | |
2021 pNPCData4 = (NPCData *)1; | |
2022 if (!_45063B_spawn_some_monster(pMapInfo, (int)pNPCData4)) | |
2023 pNPCData4 = 0; | |
2024 if (pNPCData4) | |
2025 { | |
2026 pPlayerNum = rand() % 4; | |
2027 pParty->pPlayers[pPlayerNum].pConditions[Condition_Sleep] = 0; | |
2028 v95 = rand(); | |
2029 Rest(v95 % 6 + 60); | |
2030 _506F18_num_minutes_to_sleep = 0; | |
2543 | 2031 _506F14_resting_stage = 0; |
2032 | |
2541 | 2033 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); |
2034 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" | |
2035 pAudioPlayer->PlaySound(SOUND_encounter, 0, 0, -1, 0, 0, 0, 0); | |
2036 continue; | |
2037 } | |
2038 } | |
2039 Party::TakeFood(uRestUI_FoodRequiredToRest); | |
2040 _506F18_num_minutes_to_sleep = 480; | |
2543 | 2041 _506F14_resting_stage = 2; |
2541 | 2042 pParty->RestAndHeal(); |
2043 pParty->days_played_without_rest = 0; | |
2044 pParty->pPlayers[3].SetAsleep(1); | |
2045 pParty->pPlayers[2].SetAsleep(1); | |
2046 pParty->pPlayers[1].SetAsleep(1); | |
2047 pParty->pPlayers[0].SetAsleep(1); | |
2048 } | |
2049 continue; | |
2050 case UIMSG_AlreadyResting: | |
2543 | 2051 if (_506F14_resting_stage == 2) |
2541 | 2052 { |
2053 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
2054 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2055 continue; | |
2056 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2057 new OnButtonClick2(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, |
2541 | 2058 (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" |
2059 v97 = _494820_training_time(pParty->uCurrentHour); | |
2543 | 2060 _506F14_resting_stage = 1; |
2541 | 2061 _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute; |
2062 continue; | |
2063 case UIMSG_HintSelectRemoveQuickSpellBtn: | |
2064 if (quick_spell_at_page && byte_506550) | |
2065 { | |
2066 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName; | |
2067 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173); | |
2068 } | |
2069 else | |
2070 { | |
2071 if (pPlayers[uActiveCharacter]->uQuickSpell) | |
2072 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell" | |
2073 else | |
2074 v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell" | |
2075 strcpy(pTmpBuf.data(), v177); | |
2076 } | |
2077 GameUI_SetFooterString(pTmpBuf.data()); | |
2078 continue; | |
2079 case UIMSG_SPellbook_ShowHightlightedSpellInfo: | |
2080 if (!uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], | |
2081 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402))) | |
2082 continue; | |
2083 if (sub_4637E0_is_there_popup_onscreen()) | |
2084 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1; | |
2085 v98 = *(char *)(uNumSeconds + 6734); | |
2086 if (quick_spell_at_page - 1 == uMessageParam) | |
2087 { | |
2088 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2089 v161 = pGlobalTXT_LocalizationStrings[485]; | |
2090 } | |
2091 else | |
2092 { | |
2093 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2094 v161 = pGlobalTXT_LocalizationStrings[486]; | |
2095 } | |
2096 sprintfex(pTmpBuf.data(), v161, v178); | |
2097 GameUI_SetFooterString(pTmpBuf.data()); | |
2098 continue; | |
2099 case UIMSG_ClickInstallRemoveQuickSpellBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2100 new OnButtonClick2(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, (int)pBtn_InstallRemoveSpell, 0); |
2541 | 2101 if (!uActiveCharacter) |
2102 continue; | |
2103 pPlayer10 = pPlayers[uActiveCharacter]; | |
2104 if (!byte_506550 || !quick_spell_at_page) | |
2105 { | |
2106 pPlayer10->uQuickSpell = 0; | |
2107 quick_spell_at_page = 0; | |
2108 pAudioPlayer->PlaySound(SOUND_fizzle, 0, 0, -1, 0, 0, 0, 0); | |
2109 continue; | |
2110 } | |
2111 pPlayers[uActiveCharacter]->uQuickSpell = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; | |
2112 AA1058_PartyQuickSpellSound[uActiveCharacter - 1].AddPartySpellSound(pPlayers[uActiveCharacter]->uQuickSpell, uActiveCharacter); | |
2113 if (uActiveCharacter) | |
2114 pPlayer10->PlaySound(SPEECH_12, 0); | |
2115 byte_506550 = 0; | |
2116 continue; | |
2117 case UIMSG_SpellBook_PressTab:// Tab | |
2118 { | |
2119 if (!uActiveCharacter) | |
2120 continue; | |
2121 int skill_count = 0; | |
2122 uAction = 0; | |
2123 for (uint i = 0; i < 9; i++) | |
2124 { | |
2125 if (pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_FIRE + i]) | |
2126 { | |
2127 if (pPlayers[uActiveCharacter]->lastOpenedSpellbookPage == i) | |
2128 uAction = skill_count; | |
2129 v217[skill_count++] = i; | |
2130 } | |
2131 } | |
2132 if (!skill_count)// | |
2133 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0); | |
2134 else | |
2135 { | |
2136 if (GetAsyncKeyState(VK_SHIFT)) | |
2137 { | |
2138 --uAction; | |
2139 if (uAction < 0) | |
2140 uAction = skill_count - 1; | |
2141 } | |
2142 else | |
2143 { | |
2144 ++uAction; | |
2145 if (uAction >= skill_count) | |
2146 uAction = 0; | |
2147 } | |
2549 | 2148 ((GUIWindow_Spellbook *)pGUIWindow_CurrentMenu)->OpenSpellbookPage(v217[uAction]); |
2541 | 2149 } |
2150 continue; | |
2151 } | |
2152 case UIMSG_OpenSpellbookPage: | |
2153 if (pTurnEngine->turn_stage == TE_MOVEMENT || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage) | |
2154 continue; | |
2549 | 2155 ((GUIWindow_Spellbook *)pGUIWindow_CurrentMenu)->OpenSpellbookPage(uMessageParam); |
2541 | 2156 continue; |
2157 case UIMSG_SelectSpell: | |
2158 { | |
2159 if (pTurnEngine->turn_stage == TE_MOVEMENT) | |
2160 continue; | |
2161 if (!uActiveCharacter) | |
2162 continue; | |
2163 | |
2164 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter]; | |
2165 Player* player = pPlayers[uActiveCharacter]; | |
2166 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam]) | |
2167 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) ) | |
2168 { | |
2169 if (quick_spell_at_page - 1 == uMessageParam) | |
2170 { | |
2171 pGUIWindow_CurrentMenu->Release(); | |
2172 pEventTimer->Resume(); | |
2173 viewparams->bRedrawGameUI = 1; | |
2174 current_screen_type = SCREEN_GAME; | |
2175 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2176 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; | |
2177 /*if ( dword_50C9E8 < 40 ) | |
2178 { | |
2179 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; | |
2180 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; | |
2181 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; | |
2182 ++dword_50C9E8; | |
2183 }*/ | |
2184 pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
2185 // pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
2186 } | |
2187 else | |
2188 { | |
2189 byte_506550 = 1; | |
2190 quick_spell_at_page = uMessageParam + 1; | |
2191 } | |
2192 } | |
2193 } | |
2194 continue; | |
2195 | |
2196 case UIMSG_CastSpellFromBook: | |
2197 if (pTurnEngine->turn_stage != TE_MOVEMENT) | |
2566 | 2198 _42777D_CastSpell_UseWand_ShootArrow((SPELL_TYPE)uMessageParam, v199, 0, 0, 0); |
2541 | 2199 continue; |
2200 | |
2201 case UIMSG_SpellScrollUse: | |
2202 __debugbreak(); | |
2203 if (pTurnEngine->turn_stage != TE_MOVEMENT) | |
2566 | 2204 _42777D_CastSpell_UseWand_ShootArrow((SPELL_TYPE)uMessageParam, v199, 133, 1, 0); |
2541 | 2205 continue; |
2206 case UIMSG_SpellBookWindow: | |
2207 if (pTurnEngine->turn_stage == TE_MOVEMENT) | |
2208 continue; | |
2209 if (bUnderwater == true) | |
2210 { | |
2211 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
2212 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
2213 } | |
2214 else | |
2215 { | |
2216 DoThatMessageThing(); | |
2217 if (uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery) | |
2218 { | |
2219 if (current_screen_type == SCREEN_GAME) | |
2220 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2221 new OnButtonClick2(476, 450, 0, 0, (int)pBtn_CastSpell, 0); |
2549 | 2222 pGUIWindow_CurrentMenu = new GUIWindow_Spellbook(); |
2541 | 2223 continue; |
2224 } | |
2225 if (current_screen_type != SCREEN_REST && current_screen_type != SCREEN_CHARACTERS | |
2226 && (current_screen_type <= SCREEN_63 || current_screen_type > SCREEN_67)) | |
2227 { | |
2228 pGUIWindow_CurrentMenu->Release(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2229 new OnButtonClick2(476, 450, 0, 0, (int)pBtn_CastSpell, 0); |
2549 | 2230 pGUIWindow_CurrentMenu = new GUIWindow_Spellbook(); |
2541 | 2231 continue; |
2232 } | |
2233 } | |
2234 } | |
2235 continue; | |
2236 case UIMSG_QuickReference: | |
2237 DoThatMessageThing(); | |
2547 | 2238 if (current_screen_type != SCREEN_GAME) |
2541 | 2239 pGUIWindow_CurrentMenu->Release(); |
2240 ++pIcons_LOD->uTexturePacksCount; | |
2241 if (!pIcons_LOD->uNumPrevLoadedFiles) | |
2242 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2243 new OnButtonClick2(0x230u, 0x1C2u, 0, 0, (int)pBtn_QuickReference, 0); |
2547 | 2244 viewparams->bRedrawGameUI = true; |
2245 | |
2246 pGUIWindow_CurrentMenu = new GUIWindow_QuickReference(); | |
2541 | 2247 continue; |
2248 case UIMSG_GameMenuButton: | |
2543 | 2249 if (current_screen_type != SCREEN_GAME) |
2541 | 2250 { |
2251 pGUIWindow_CurrentMenu->Release(); | |
2252 pEventTimer->Resume(); | |
2253 current_screen_type = SCREEN_GAME; | |
2254 viewparams->bRedrawGameUI = 1; | |
2255 } | |
2256 | |
2257 stru_506E40.Release(); | |
2258 pRenderer->SaveScreenshot("gamma.pcx", 155, 117); | |
2259 stru_506E40.LoadPCXFile("gamma.pcx", 0); | |
2260 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2261 new OnButtonClick(0x25Au, 0x1C2u, 0, 0, (int)pBtn_GameSettings, 0); |
2541 | 2262 //LABEL_453: |
2263 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
2264 continue; | |
2265 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
2266 //goto LABEL_770; | |
2267 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2268 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2269 ++pMessageQueue_50CBD0->uNumMessages;*/ | |
2270 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
2271 continue; | |
2272 case UIMSG_ClickAwardScrollBar: | |
2273 books_page_number = 1; | |
2274 if (pMouse->GetCursorPos(&v211)->y > 178) | |
2275 books_page_number = -1; | |
2276 continue; | |
2277 case UIMSG_ClickAwardsUpBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2278 new OnButtonClick3(pBtn_Up->uX, pBtn_Up->uY, 0, 0, (int)pBtn_Up, 0); |
2541 | 2279 BtnUp_flag = 1; |
2280 continue; | |
2281 case UIMSG_ClickAwardsDownBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2282 new OnButtonClick3(pBtn_Down->uX, pBtn_Down->uY, 0, 0, (int)pBtn_Down, 0); |
2541 | 2283 BtnDown_flag = 1; |
2284 continue; | |
2285 case UIMSG_ChangeDetaliz: | |
2547 | 2286 ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ToggleRingsOverlay(); |
2541 | 2287 continue; |
2288 case UIMSG_ClickPaperdoll: | |
2289 OnPaperdollLeftClick(); | |
2290 continue; | |
2291 case UIMSG_SkillUp: | |
2292 pPlayer4 = pPlayers[uActiveCharacter]; | |
2293 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; | |
2294 LOWORD(v2) = *(short *)v105; | |
2295 uNumSeconds = v2; | |
2296 if (pPlayer4->uSkillPoints < (v2 & 0x3F) + 1) | |
2297 { | |
2298 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!" | |
2299 } | |
2300 else | |
2301 { | |
2302 if ((uNumSeconds & 0x3F) < 0x3C) | |
2303 { | |
2304 *(short *)v105 = uNumSeconds + 1; | |
2305 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; | |
2306 pPlayer4->PlaySound(SPEECH_14, 0); | |
2307 pAudioPlayer->PlaySound((SoundID)SOUND_quest, 0, 0, -1, 0, 0, 0, 0); | |
2308 continue; | |
2309 } | |
2310 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" | |
2311 } | |
2312 ShowStatusBarString(v87, 2); | |
2313 continue; | |
2547 | 2314 case UIMSG_ClickStatsBtn: |
2315 ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ShowStatsTab(); | |
2316 continue; | |
2317 case UIMSG_ClickSkillsBtn: | |
2318 ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ShowSkillsTab(); | |
2319 continue; | |
2541 | 2320 case UIMSG_ClickInventoryBtn: |
2547 | 2321 ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ShowInventoryTab(); |
2322 continue; | |
2323 case UIMSG_ClickAwardsBtn: | |
2324 ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ShowAwardsTab(); | |
2541 | 2325 continue; |
2326 case UIMSG_ClickExitCharacterWindowBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2327 new OnCancel2(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, (int)pCharacterScreen_ExitBtn, 0); |
2541 | 2328 continue; |
2329 case UIMSG_ClickBooksBtn: | |
2330 switch (uMessageParam) | |
2331 { | |
2332 case 11://Page UP | |
2333 BtnUp_flag = 1; | |
2334 pButton = pBtn_Book_2; | |
2335 break; | |
2336 case 10://Page DOWN | |
2337 BtnDown_flag = 1; | |
2338 pButton = pBtn_Book_1; | |
2339 break; | |
2340 case 0://Zoom plus | |
2341 pButton = pBtn_Book_1; | |
2342 BtnDown_flag = 1; | |
2343 break; | |
2344 case 1://Zoom minus | |
2345 pButton = pBtn_Book_2; | |
2346 BtnUp_flag = 1; | |
2347 break; | |
2348 case 2://Potions | |
2349 Book_PageBtn3_flag = 1; | |
2350 if (dword_506364) | |
2351 continue; | |
2352 pButton = pBtn_Book_3; | |
2353 break; | |
2354 case 3://fountains | |
2355 Book_PageBtn4_flag = 1; | |
2356 if (dword_506364) | |
2357 continue; | |
2358 pButton = pBtn_Book_4; | |
2359 break; | |
2360 case 4://obelisks | |
2361 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag | |
2362 if (dword_506364) | |
2363 continue; | |
2364 pButton = pBtn_Book_5; | |
2365 break; | |
2366 case 5://seer | |
2367 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag | |
2368 if (dword_506364) | |
2369 continue; | |
2370 pButton = pBtn_Book_6; | |
2371 break; | |
2372 case 6://misc | |
2373 pButton = pBtn_Autonotes_Misc; | |
2374 Autonotes_Misc_page_flag = 1; | |
2375 break; | |
2376 case 7://Instructors | |
2377 pButton = pBtn_Autonotes_Instructors; | |
2378 Autonotes_Instructors_page_flag = 1; | |
2379 break; | |
2380 default: | |
2381 continue; | |
2382 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2383 new OnButtonClick(pButton->uX, pButton->uY, 0, 0, (int)pButton, (char *)1); |
2541 | 2384 continue; |
2385 case UIMSG_SelectCharacter: | |
2386 DoThatMessageThing(); | |
2387 GameUI_OnPlayerPortraitLeftClick(uMessageParam); | |
2388 continue; | |
2389 case UIMSG_ShowStatus_Funds: | |
2390 v174 = (char *)pParty->uNumGoldInBank; | |
2391 //v158 = pParty->uNumGold + pParty->uNumGoldInBank; | |
2392 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], pParty->uNumGold + pParty->uNumGoldInBank, v174);// "You have %d total gold, %d in the Bank" | |
2393 GameUI_SetFooterString(pTmpBuf.data()); | |
2394 continue; | |
2395 case UIMSG_ShowStatus_DateTime: | |
2396 currHour = pParty->uCurrentHour; | |
2397 uNumSeconds = 1; | |
2398 if (pParty->uCurrentHour > 12) | |
2399 { | |
2400 if (pParty->uCurrentHour >= 24) | |
2401 uNumSeconds = 0; | |
2402 currHour = (currHour - 12); | |
2403 } | |
2404 else | |
2405 { | |
2406 if (pParty->uCurrentHour < 12) // 12:00 is PM | |
2407 uNumSeconds = 0; | |
2408 if (pParty->uCurrentHour == 0) | |
2409 currHour = 12; | |
2410 } | |
2411 sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", currHour, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], | |
2412 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear); | |
2413 GameUI_SetFooterString(pTmpBuf.data()); | |
2414 continue; | |
2415 case UIMSG_ShowStatus_Food: | |
2416 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food" | |
2417 GameUI_SetFooterString(pTmpBuf.data()); | |
2418 continue; | |
2419 case UIMSG_ShowStatus_Player: | |
2420 pPlayer5 = pPlayers[uMessageParam]; | |
2421 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s" | |
2422 strcat(pTmpBuf.data(), ": "); | |
2423 v107 = pPlayer5->GetMajorConditionIdx(); | |
2424 strcat(pTmpBuf.data(), aCharacterConditionNames[v107]); | |
2425 GameUI_SetFooterString(pTmpBuf.data()); | |
2426 v108 = 8 * uMessageParam - 8; | |
2427 LOBYTE(v108) = v108 | 4; | |
2428 pMouse->uPointingObjectID = PID(OBJECT_Player, v108); | |
2429 continue; | |
2430 case UIMSG_ShowStatus_ManaHP: | |
2431 sprintf(pTmpBuf.data(), "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), | |
2432 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), | |
2433 pGlobalTXT_LocalizationStrings[212]); | |
2434 GameUI_SetFooterString(pTmpBuf.data()); | |
2435 continue; | |
2436 case UIMSG_CHEST_ClickItem: | |
2437 if (current_screen_type == SCREEN_CHEST_INVENTORY) | |
2438 { | |
2439 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); | |
2440 continue; | |
2441 } | |
2442 Chest::OnChestLeftClick(); | |
2443 continue; | |
2444 case UIMSG_InventoryLeftClick: | |
2445 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); | |
2446 continue; | |
2447 case UIMSG_MouseLeftClickInGame: | |
2448 /*if ( !pRenderer->pRenderD3D ) | |
2449 { | |
2450 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2451 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2452 OnGameViewportClick(); | |
2453 continue; | |
2454 }*/ | |
2455 v115 = pMessageQueue_50CBD0->uNumMessages; | |
2456 if (!pMessageQueue_50CBD0->uNumMessages) | |
2457 { | |
2458 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
2459 /*if ( (signed int)v115 < 40 ) | |
2460 //goto LABEL_769; | |
2461 { | |
2462 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
2463 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2464 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2465 ++pMessageQueue_50CBD0->uNumMessages; | |
2466 continue; | |
2467 }*/ | |
2468 } | |
2543 | 2469 else if (pMessageQueue_50CBD0->pMessages[0].field_8) |
2541 | 2470 { |
2471 pMessageQueue_50CBD0->uNumMessages = 1; | |
2472 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
2473 /*v115 = v0; | |
2474 pMessageQueue_50CBD0->uNumMessages = v0; | |
2475 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
2476 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2477 //goto LABEL_771; | |
2478 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2479 ++pMessageQueue_50CBD0->uNumMessages;*/ | |
2480 } | |
2543 | 2481 else |
2541 | 2482 { |
2543 | 2483 v115 = 0; |
2484 pMessageQueue_50CBD0->uNumMessages = 0; | |
2485 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
2486 /*if ( (signed int)v115 < 40 ) | |
2487 //goto LABEL_769; | |
2488 { | |
2489 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
2490 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2491 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2492 ++pMessageQueue_50CBD0->uNumMessages; | |
2493 continue; | |
2494 }*/ | |
2495 } | |
2541 | 2496 continue; |
2497 case UIMSG_MouseLeftClickInScreen:// UIMSG_MouseLeftClickInGame | |
2498 DoThatMessageThing(); | |
2499 OnGameViewportClick(); | |
2500 continue; | |
2501 case UIMSG_F: | |
2502 __debugbreak(); | |
2503 //if ( pRenderer->pRenderD3D ) | |
2504 { | |
2505 LOWORD(v116) = pEngine->pVisInstance->get_picked_object_zbuf_val(); | |
2506 } | |
2507 /*else | |
2508 { | |
2509 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); | |
2510 pPoint3 = pMouse->GetCursorPos(&v204); | |
2511 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; | |
2512 }*/ | |
2513 pButton2 = (GUIButton *)(unsigned __int16)v116; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2514 __debugbreak();//GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); |
2541 | 2515 continue; |
2516 case UIMSG_54: | |
2517 __debugbreak(); | |
2518 pButton2 = (GUIButton *)uMessageParam; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2519 __debugbreak();//GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); |
2541 | 2520 continue; |
2521 case UIMSG_Game_Action: | |
2522 DoThatMessageThing(); | |
2523 OnPressSpace(); | |
2524 continue; | |
2525 case UIMSG_ClickZoomOutBtn: | |
2526 if (current_screen_type) | |
2527 continue; | |
2528 pParty->uFlags |= 2u; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2529 new OnButtonClick2(519, 136, 0, 0, (int)pBtn_ZoomOut, 0); |
2541 | 2530 uNumSeconds = 131072; |
2531 v118 = 2 * viewparams->uMinimapZoom; | |
2532 ++viewparams->field_28; | |
2533 viewparams->uMinimapZoom *= 2; | |
2534 if (uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
2535 { | |
2536 if ((signed int)v118 > 4096) | |
2537 { | |
2538 viewparams->uMinimapZoom = 4096; | |
2539 viewparams->field_28 = 12; | |
2540 } | |
2541 continue; | |
2542 } | |
2543 v119 = 2048; | |
2544 if ((signed int)v118 <= 2048) | |
2545 { | |
2546 _576E2C_current_minimap_zoom = v118; | |
2547 dword_576E28 = viewparams->field_28; | |
2548 break; | |
2549 } | |
2550 viewparams->field_28 = 11; | |
2551 viewparams->uMinimapZoom = v119; | |
2552 _576E2C_current_minimap_zoom = v119; | |
2553 dword_576E28 = viewparams->field_28; | |
2554 break; | |
2555 case UIMSG_ClickZoomInBtn: | |
2556 if (current_screen_type) | |
2557 continue; | |
2558 pParty->uFlags |= 2u; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2559 new OnButtonClick2(574, 136, 0, 0, (int)pBtn_ZoomIn, 0); |
2541 | 2560 uNumSeconds = 32768; |
2561 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
2562 --viewparams->field_28; | |
2563 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
2564 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
2565 { | |
2566 v119 = 512; | |
2567 if ((signed int)v118 < 512) | |
2568 { | |
2569 viewparams->field_28 = 9; | |
2570 v118 = v119; | |
2571 viewparams->uMinimapZoom = v119; | |
2572 } | |
2573 _576E2C_current_minimap_zoom = v118; | |
2574 dword_576E28 = viewparams->field_28; | |
2575 } | |
2576 else | |
2577 { | |
2578 if ((signed int)v118 < 256) | |
2579 { | |
2580 viewparams->uMinimapZoom = 256; | |
2581 viewparams->field_28 = 8; | |
2582 } | |
2583 } | |
2584 default: | |
2585 continue; | |
2586 } | |
2587 } | |
2588 } | |
2589 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8; | |
2590 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages); | |
2591 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); | |
2592 //dword_50C9E8 = 0; | |
2593 | |
2594 | |
2595 pMessageQueue_50C9E8->uNumMessages = 0; | |
2596 if (dword_50C9DC) | |
2597 { | |
2598 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
2599 { | |
2600 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; | |
2601 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0; | |
2602 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2603 ++pMessageQueue_50CBD0->uNumMessages; | |
2604 }*/ | |
2605 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); | |
2606 dword_50C9DC = 0; | |
2607 } | |
2608 else | |
2609 { | |
2610 if (_50C9D0_AfterEnchClickEventId > 0) | |
2611 { | |
2612 _50C9D8_AfterEnchClickEventTimeout -= pEventTimer->uTimeElapsed; | |
2613 if (_50C9D8_AfterEnchClickEventTimeout <= 0) | |
2614 { | |
2615 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
2616 { | |
2617 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0; | |
2618 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4; | |
2619 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2620 ++pMessageQueue_50CBD0->uNumMessages; | |
2621 }*/ | |
2622 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)_50C9D0_AfterEnchClickEventId, _50C9D4_AfterEnchClickEventSecondParam, 0); | |
2623 _50C9D0_AfterEnchClickEventId = 0; | |
2624 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
2625 _50C9D8_AfterEnchClickEventTimeout = 0; | |
2626 } | |
2627 } | |
2628 } | |
2629 CastSpellInfoHelpers::_427E01_cast_spell(); | |
2630 } | |
2631 | |
2632 | |
2633 | |
2634 | |
2635 | |
2636 //----- (00463149) -------------------------------------------------------- | |
2637 void Game_Loop() | |
2638 { | |
2639 const char *pLocationName; // [sp-4h] [bp-68h]@74 | |
2640 bool bLoading; // [sp+10h] [bp-54h]@1 | |
2641 signed int v16; // [sp+14h] [bp-50h]@8 | |
2642 MSG Msg; // [sp+28h] [bp-3Ch]@20 | |
2643 char Source[64]; // [sp+44h] [bp-20h]@76 | |
2644 | |
2645 bLoading = sCurrentMenuID == MENU_LoadingProcInMainMenu; | |
2646 SetCurrentMenuID((MENU_STATE)-1); | |
2647 if (bLoading) | |
2648 { | |
2649 pParty->Reset(); | |
2650 uGameState = GAME_STATE_PLAYING; | |
2651 LoadGame(uLoadGameUI_SelectedSlot); | |
2652 } | |
2653 | |
2654 for (uint i = 1; i < 5; ++i) | |
2655 for (uint j = 1; j < 6; ++j) | |
2656 { | |
2657 sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j); | |
2658 remove(pTmpBuf.data()); | |
2659 } | |
2660 | |
2661 extern bool use_music_folder; | |
2662 LoadPlayerPortraintsAndVoices(); | |
2663 pIcons_LOD->_inlined_sub1(); | |
2664 if (use_music_folder) | |
2665 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
2666 else | |
2667 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
2668 | |
2566 | 2669 |
2670 extern bool all_spells; | |
2671 if (all_spells) | |
2672 { | |
2673 for (int i = 0; i < 4; ++i) | |
2674 for (int j = 0; j < 99; ++j) | |
2675 pParty->pPlayers[i].spellbook.bHaveSpell[j] = true; | |
2676 } | |
2677 | |
2541 | 2678 while (2) |
2679 { | |
2680 v16 = 1; | |
2681 pMessageQueue_50CBD0->Flush(); | |
2682 | |
2683 pPartyActionQueue->uNumActions = 0; | |
2684 if (pParty->bTurnBasedModeOn) | |
2685 { | |
2686 pTurnEngine->End(false); | |
2687 pParty->bTurnBasedModeOn = false; | |
2688 } | |
2689 DoPrepareWorld(bLoading, 1); | |
2690 pEventTimer->Resume(); | |
2691 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME; | |
2692 // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; | |
2693 current_screen_type = SCREEN_GAME; | |
2694 | |
2695 //if ( pRenderer->pRenderD3D ) | |
2696 pEngine->pVisInstance->_4C1A02(); | |
2697 | |
2698 bool game_finished = false; | |
2699 do | |
2700 { | |
2701 while (PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE)) | |
2702 { | |
2703 if (Msg.message == WM_QUIT) | |
2704 Engine_DeinitializeAndTerminate(0); | |
2705 TranslateMessage(&Msg); | |
2706 DispatchMessageA(&Msg); | |
2707 } | |
2708 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) | |
2709 { | |
2710 WaitMessage(); | |
2711 continue; | |
2712 } | |
2713 pEngine->_44EEA7(); | |
2714 GameUI_WritePointedObjectStatusString(); | |
2715 Keyboard::ProcessInputActions(); | |
2716 Game_EventLoop(); | |
2717 if (pArcomageGame->bGameInProgress) | |
2718 { | |
2719 ArcomageGame::Loop(); | |
2720 pRenderer->Present(); | |
2721 continue; | |
2722 } | |
2723 | |
2724 pMediaPlayer->HouseMovieLoop(); | |
2725 | |
2726 pEventTimer->Update(); | |
2727 pMiscTimer->Update(); | |
2728 | |
2729 OnTimer(0); | |
2730 GameUI_StatusBar_UpdateTimedString(0); | |
2731 if (pMiscTimer->bPaused && !pEventTimer->bPaused) | |
2732 pMiscTimer->Resume(); | |
2733 if (pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn) | |
2734 pEventTimer->bTackGameTime = 0; | |
2735 if (!pEventTimer->bPaused && uGameState == GAME_STATE_PLAYING) | |
2736 { | |
2737 if (!pEventTimer->bTackGameTime) | |
2738 _494035_timed_effects__water_walking_damage__etc(); | |
2739 | |
2740 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0001) | |
2741 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0001; | |
2742 else | |
2743 { | |
2744 Actor::UpdateActorAI(); | |
2745 UpdateUserInput_and_MapSpecificStuff(); | |
2746 } | |
2747 } | |
2748 if (v16) | |
2749 { | |
2750 v16 = 0; | |
2751 viewparams->bRedrawGameUI = true; | |
2752 } | |
2753 pAudioPlayer->UpdateSounds(); | |
2754 if ((signed int)uGameState == GAME_STATE_PLAYING) | |
2755 { | |
2756 pEngine->Draw(); | |
2757 continue; | |
2758 } | |
2759 if (uGameState == GAME_FINISHED) | |
2760 { | |
2761 game_finished = true; | |
2762 continue; | |
2763 } | |
2764 if (uGameState == GAME_STATE_CHANGE_LOCATION)// | |
2765 { | |
2766 pAudioPlayer->StopChannels(-1, -1); | |
2767 PrepareWorld(0); | |
2768 uGameState = GAME_STATE_PLAYING; | |
2769 continue; | |
2770 } | |
2563
65c97624c047
Saving & loading works from both main menu and game
a.parshin
parents:
2554
diff
changeset
|
2771 //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
|
2772 if (uGameState == GAME_STATE_LOADING_GAME |
65c97624c047
Saving & loading works from both main menu and game
a.parshin
parents:
2554
diff
changeset
|
2773 || uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU |
65c97624c047
Saving & loading works from both main menu and game
a.parshin
parents:
2554
diff
changeset
|
2774 || uGameState == GAME_STATE_5 |
65c97624c047
Saving & loading works from both main menu and game
a.parshin
parents:
2554
diff
changeset
|
2775 || uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU) |
2541 | 2776 { |
2777 game_finished = true; | |
2778 continue; | |
2779 } | |
2780 if (uGameState == GAME_STATE_FINAL_WINDOW) | |
2781 { | |
2782 pRenderer->BeginScene(); | |
2783 GUI_UpdateWindows(); | |
2784 pRenderer->EndScene(); | |
2785 pRenderer->Present(); | |
2786 continue; | |
2787 } | |
2788 if (uGameState != GAME_STATE_PARTY_DIED) | |
2789 { | |
2790 pEngine->Draw(); | |
2791 continue; | |
2792 } | |
2793 if (uGameState == GAME_STATE_PARTY_DIED) | |
2794 { | |
2795 pAudioPlayer->StopChannels(-1, -1); | |
2796 memset(&pParty->pHirelings[0], 0, 0x4Cu); | |
2797 memset(&pParty->pHirelings[1], 0, 0x4Cu); | |
2798 for (int i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i) | |
2799 { | |
2800 if (pNPCStats->pNewNPCData[i].field_24) | |
2801 pNPCStats->pNewNPCData[i].uFlags &= 0xFFFFFF7Fu; | |
2802 } | |
2803 pMediaPlayer->bStopBeforeSchedule = 0; | |
2804 pMediaPlayer->PlayFullscreenMovie(MOVIE_Death, true); | |
2805 if (pMovie_Track) | |
2806 pMediaPlayer->Unload(); | |
2807 SaveGame(0, 0); | |
2808 ++pParty->uNumDeaths; | |
2809 for (uint i = 0; i < 4; ++i) | |
2810 pParty->pPlayers[i].SetVariable(VAR_Award, 85); | |
2811 pParty->days_played_without_rest = 0; | |
2812 pParty->uTimePlayed += 0x276000ui64; | |
2813 LOWORD(pParty->uFlags) &= ~0x204; | |
2814 pParty->SetGold(0); | |
2815 pOtherOverlayList->Reset(); | |
2816 memset(pParty->pPartyBuffs.data(), 0, 0x140u); | |
2817 | |
2818 if (pParty->bTurnBasedModeOn == 1) | |
2819 { | |
2820 pTurnEngine->End(true); | |
2821 pParty->bTurnBasedModeOn = 0; | |
2822 } | |
2823 for (int i = 0; i < 4; ++i) | |
2824 { | |
2825 memset(pParty->pPlayers[i].pConditions.data(), 0, 0xA0u);//(pConditions, 0, 160) | |
2826 memset(pParty->pPlayers[i].pPlayerBuffs.data(), 0, 0x180u);//(pPlayerBuffs[0], 0, 384) | |
2827 pParty->pPlayers[i].sHealth = 1; | |
2828 uActiveCharacter = 1; | |
2829 } | |
2830 if (_449B57_test_bit(pParty->_quest_bits, PARTY_QUEST_FINISHED_EMERALD_ISLE)) | |
2831 { | |
2832 pParty->vPosition.x = -17331; // respawn in harmondale | |
2833 pParty->vPosition.y = 12547; | |
2834 pParty->vPosition.z = 465; | |
2835 pParty->sRotationY = 0; | |
2836 pLocationName = "out02.odm"; | |
2837 } | |
2838 else | |
2839 { | |
2840 pParty->vPosition.x = 12552; // respawn on emerald isle | |
2841 pParty->vPosition.y = 1816; | |
2842 pParty->vPosition.z = 0; | |
2843 pParty->sRotationY = 512; | |
2844 pLocationName = "out01.odm"; | |
2845 } | |
2846 strcpy(Source, pLocationName); | |
2847 pParty->uFallStartY = pParty->vPosition.z; | |
2848 pParty->sRotationX = 0; | |
2849 pParty->uFallSpeed = 0; | |
2850 pParty->field_6E4 = 0; | |
2851 pParty->field_6E0 = 0; | |
2852 if (_stricmp(Source, pCurrentMapName)) | |
2853 { | |
2854 strcpy(pCurrentMapName, Source); | |
2855 _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x; | |
2856 _5B65AC_npcdata_fame_or_other = pParty->vPosition.y; | |
2857 _5B65B0_npcdata_rep_or_other = pParty->vPosition.z; | |
2858 _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY; | |
2859 _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX; | |
2860 dword_5B65C0 = 1; | |
2861 PrepareWorld(1); | |
2862 } | |
2863 Actor::InitializeActors(); | |
2864 | |
2865 int num_conscious_players = 0; | |
2866 int conscious_players_ids[4] = { -1, -1, -1, -1 }; | |
2867 for (int i = 0; i < 4; ++i) | |
2868 { | |
2869 if (pParty->pPlayers[i].CanAct()) | |
2870 conscious_players_ids[num_conscious_players++] = i; | |
2871 } | |
2872 if (num_conscious_players) | |
2873 { | |
2874 int idx = conscious_players_ids[rand() % num_conscious_players]; | |
2875 Assert(idx >= 0); | |
2876 pParty->pPlayers[idx].PlaySound(SPEECH_99, 0); | |
2877 } | |
2878 | |
2879 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2);// "Once again you've cheated death!.." " ! " | |
2880 uGameState = GAME_STATE_PLAYING; | |
2881 } | |
2882 } while (!game_finished); | |
2883 | |
2884 pEventTimer->Pause(); | |
2885 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); | |
2886 if (uGameState == GAME_STATE_LOADING_GAME) | |
2887 { | |
2888 sub_491E3A(); | |
2889 LoadPlayerPortraintsAndVoices(); | |
2890 uGameState = GAME_STATE_PLAYING; | |
2891 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles; | |
2892 bLoading = true; | |
2893 continue; | |
2894 } | |
2895 break; | |
2896 } | |
2897 current_screen_type = SCREEN_VIDEO; | |
2898 sub_491E3A(); | |
2899 } |