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