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