2499
|
1 #define _CRTDBG_MAP_ALLOC
|
|
2 #include <stdlib.h>
|
|
3 #include <crtdbg.h>
|
|
4
|
|
5 #define _CRT_SECURE_NO_WARNINGS
|
|
6 #include "Arcomage\Arcomage.h"
|
|
7
|
|
8 #include "Engine/Graphics/Vis.h"
|
|
9 #include "Engine/Graphics/Weather.h"
|
|
10 #include "Engine/Graphics/LightmapBuilder.h"
|
|
11 #include "Engine/Graphics/DecalBuilder.h"
|
|
12 #include "Engine/Graphics/ParticleEngine.h"
|
2502
|
13 #include "IO/Mouse.h"
|
|
14 #include "IO/Keyboard.h"
|
2499
|
15 #include "Engine/Graphics/GammaControl.h"
|
|
16 #include "stru6.h"
|
|
17 #include "Engine/Graphics/stru9.h"
|
|
18 #include "Engine/Graphics/stru10.h"
|
|
19 #include "Engine/ErrorHandling.h"
|
|
20
|
|
21 #include "Game.h"
|
|
22 #include "Party.h"
|
|
23 #include "Engine/Graphics/Viewport.h"
|
|
24 #include "Timer.h"
|
|
25 #include "Engine/Graphics/Outdoor.h"
|
|
26 #include "Engine/Graphics/Overlays.h"
|
2502
|
27 #include "Media/Audio/AudioPlayer.h"
|
2499
|
28 #include "LOD.h"
|
2502
|
29 #include "GUI/GUIWindow.h"
|
2501
|
30 #include "TurnEngine/TurnEngine.h"
|
2502
|
31 #include "Media/Video/Bink_Smacker.h"
|
2501
|
32 #include "Events.h"
|
2534
|
33 #include "OurMath.h"
|
2499
|
34 #include "texts.h"
|
2502
|
35 #include "GUI/GUIFont.h"
|
2499
|
36 #include "Log.h"
|
2501
|
37 #include "Graphics/Lights.h"
|
|
38 #include "Spells/CastSpellInfo.h"
|
|
39 #include "Tables/FrameTableInc.h"
|
|
40 #include "Objects/Actor.h"
|
2502
|
41 #include "GUI/GUIProgressBar.h"
|
2501
|
42 #include "Objects/ObjectList.h"
|
|
43 #include "Graphics/Level/Decoration.h"
|
|
44 #include "Graphics/PaletteManager.h"
|
|
45 #include "..\GUI\UI\UIHouses.h"
|
|
46 #include "..\GUI\UI\UIShops.h"
|
|
47 #include "..\GUI\UI\UIPartyCreation.h"
|
2499
|
48 #include "SaveLoad.h"
|
|
49 #include "Engine/Objects/SpriteObject.h"
|
|
50 #include "mm7.h"
|
2501
|
51 #include "Graphics/Sprites.h"
|
2499
|
52 #include "Registry.h"
|
2501
|
53 #include "Objects/Chest.h"
|
|
54
|
|
55 #include "..\GUI\UI\UIGame.h"
|
|
56
|
|
57 #include "Graphics/DecorationList.h"
|
|
58 #include "Tables/IconFrameTable.h"
|
|
59 #include "Tables/PlayerFrameTable.h"
|
2499
|
60 #include "MapsLongTimer.h"
|
2501
|
61 #include "Tables/StorylineTextTable.h"
|
|
62 #include "Tables/FactionTable.h"
|
2499
|
63 #include "stru123.h"
|
|
64 #include "LuaVM.h"
|
2501
|
65 #include "Graphics/RenderD3D11.h"
|
2499
|
66 #include "MMT.h"
|
2501
|
67 #include "../GUI/NewUI\MainMenu.h"
|
2499
|
68 #include <direct.h>
|
|
69
|
|
70
|
|
71
|
|
72
|
|
73
|
|
74 Game *pGame;
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
|
80 //----- (00435694) --------------------------------------------------------
|
|
81 void Game::ToggleFlags2(unsigned int uFlag)
|
|
82 {
|
|
83 unsigned int v2; // eax@1
|
|
84
|
|
85 v2 = this->uFlags2;
|
|
86 if ( v2 & uFlag )
|
|
87 this->uFlags2 = v2 & ~uFlag;
|
|
88 else
|
|
89 this->uFlags2 = uFlag | v2;
|
|
90 }
|
|
91
|
|
92 //----- (0044103C) --------------------------------------------------------
|
|
93 void Game::Draw()
|
|
94 {
|
|
95 int v4; // edi@26
|
|
96
|
|
97 uFlags2 &= ~0x02;
|
|
98 if ( pParty->_497FC5_check_party_perception_against_level() )
|
|
99 uFlags2 |= 2;
|
|
100
|
|
101 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX;
|
|
102 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
|
2534
|
103 pGame->pIndoorCameraD3D->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * pi_double * pParty->sRotationY / 2048.0);
|
|
104 pGame->pIndoorCameraD3D->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * pi_double * pParty->sRotationY / 2048.0);
|
2499
|
105 pGame->pIndoorCameraD3D->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353
|
|
106
|
|
107 //pIndoorCamera->Initialize2();
|
|
108 pIndoorCameraD3D->CalculateRotations(pParty->sRotationX, pParty->sRotationY);
|
|
109 pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff();
|
|
110 pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum();
|
|
111
|
|
112 if ( pMovie_Track )
|
|
113 {
|
|
114 /*if ( !pRenderer->pRenderD3D )
|
|
115 {
|
|
116 pRenderer->BeginSceneD3D();
|
|
117 pMouse->DrawCursorToTarget();
|
|
118 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
|
|
119 }*/
|
|
120 }
|
|
121 else
|
|
122 {
|
|
123 if ( pParty->vPosition.x != pParty->vPrevPosition.x || pParty->sRotationY != pParty->sPrevRotationY || pParty->vPosition.y != pParty->vPrevPosition.y
|
|
124 || pParty->sRotationX != pParty->sPrevRotationX || pParty->vPosition.z != pParty->vPrevPosition.z || pParty->sEyelevel != pParty->sPrevEyelevel )
|
|
125 pParty->uFlags |= 2u;
|
|
126 pParty->vPrevPosition.x = pParty->vPosition.x;
|
|
127 pParty->vPrevPosition.y = pParty->vPosition.y;
|
|
128 pParty->vPrevPosition.z = pParty->vPosition.z;
|
|
129 //v0 = &pRenderer;
|
|
130 pParty->sPrevRotationY = pParty->sRotationY;
|
|
131 pParty->sPrevRotationX = pParty->sRotationX;
|
|
132
|
|
133 pParty->sPrevEyelevel = pParty->sEyelevel;
|
|
134 pRenderer->BeginSceneD3D();
|
|
135
|
|
136 //if ( !pRenderer->pRenderD3D )
|
|
137 //pMouse->DrawCursorToTarget();
|
|
138 if ( !PauseGameDrawing() || viewparams->field_48 == 1 )
|
|
139 {
|
|
140 //if ( pRenderer->pRenderD3D )
|
|
141 {
|
|
142 float v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0;
|
|
143 //v3 = v2 + 6.7553994e15;
|
|
144 //pRenderer->field_1036A8_bitmapid = LODWORD(v3);
|
|
145 pRenderer->hd_water_current_frame = floorf(v2 + 0.5f);
|
|
146 }
|
|
147
|
|
148 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
149 pIndoor->Draw();
|
|
150 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
151 pOutdoor->Draw();
|
|
152 else
|
|
153 Error("Invalid level type: %u", uCurrentlyLoadedLevelType);
|
|
154
|
|
155 //if (pRenderer->pRenderD3D)
|
|
156 {
|
|
157 pDecalBuilder->DrawBloodsplats();
|
|
158 pGame->pLightmapBuilder->DrawLightmapsType(2);
|
|
159 }
|
|
160 }
|
|
161 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
|
|
162 }
|
|
163
|
|
164 //DEBUG: force redraw gui
|
|
165 viewparams->bRedrawGameUI = true;
|
|
166
|
|
167
|
|
168 pRenderer->BeginScene();
|
|
169 //if (pRenderer->pRenderD3D)
|
|
170 pMouse->DrawCursorToTarget();
|
|
171 if (pOtherOverlayList->bRedraw)
|
|
172 viewparams->bRedrawGameUI = true;
|
|
173 v4 = viewparams->bRedrawGameUI;
|
|
174 GameUI_Footer();
|
|
175 if (!viewparams->bRedrawGameUI)
|
|
176 GameUI_DrawRightPanelItems();
|
|
177 else
|
|
178 {
|
|
179 GameUI_DrawRightPanelFrames();
|
|
180 GameUI_Footer_2();
|
|
181 viewparams->bRedrawGameUI = false;
|
|
182 }
|
|
183 if (!pMovie_Track)//!pVideoPlayer->pSmackerMovie)
|
|
184 {
|
|
185 GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, true);//redraw = pParty->uFlags & 2);
|
|
186 if (v4)
|
|
187 {
|
|
188 if ( !PauseGameDrawing() /*&& pRenderer->pRenderD3D*/) // clear game viewport with transparent color
|
|
189 pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pViewport->uViewportBR_X - pViewport->uViewportTL_X,
|
|
190 pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1,
|
|
191 0x7FF);
|
|
192 viewparams->field_48 = 0;
|
|
193 }
|
|
194 }
|
|
195
|
|
196 viewparams->bRedrawGameUI = pOtherOverlayList->bRedraw;
|
|
197 pOtherOverlayList->bRedraw = 0;
|
|
198
|
|
199 GameUI_DrawPartySpells();
|
|
200 if (v4 || pParty->pHirelings[0].evt_C || pParty->pHirelings[1].evt_C )
|
|
201 GameUI_DrawHiredNPCs();
|
|
202 GameUI_DrawPortraits(v4);
|
|
203 GameUI_DrawLifeManaBars();
|
|
204 GameUI_DrawCharacterSelectionFrame();
|
|
205 if ( _44100D_should_alter_right_panel() )
|
|
206 GameUI_DrawRightPanel();
|
|
207 if ( !pMovie_Track )
|
|
208 {
|
|
209 pStru6Instance->DrawPlayerBuffAnims();
|
|
210 pOtherOverlayList->DrawTurnBasedIcon(v4);
|
|
211 GameUI_DrawTorchlightAndWizardEye();
|
|
212 }
|
|
213
|
|
214
|
|
215 static bool render_framerate = false;
|
|
216 static float framerate = 0.0f;
|
|
217 static uint frames_this_second = 0;
|
|
218 static uint last_frame_time = GetTickCount();
|
|
219 static uint framerate_time_elapsed = 0;
|
|
220
|
|
221 if ( pCurrentScreen == SCREEN_GAME && uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
222 pWeather->Draw();//Ritor1: my include
|
|
223
|
|
224 //while(GetTickCount() - last_frame_time < 33 );//FPS control
|
|
225 uint frame_dt = GetTickCount() - last_frame_time;
|
|
226 last_frame_time = GetTickCount();
|
|
227
|
|
228 framerate_time_elapsed += frame_dt;
|
|
229 if (framerate_time_elapsed >= 1000)
|
|
230 {
|
|
231 framerate = frames_this_second * (1000.0f / framerate_time_elapsed);
|
|
232
|
|
233 framerate_time_elapsed = 0;
|
|
234 frames_this_second = 0;
|
|
235 render_framerate = true;
|
|
236 }
|
|
237
|
|
238 ++frames_this_second;
|
|
239
|
|
240 if ( debug_information )
|
|
241 {
|
|
242 if (render_framerate)
|
|
243 {
|
|
244 sprintf(pTmpBuf.data(), "FPS: % .4f", framerate);
|
|
245 pPrimaryWindow->DrawText(pFontArrus, 494, 0, Color16(0, 0, 0), pTmpBuf.data(), 0, 0, 0);
|
|
246 }
|
|
247
|
|
248 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
249 {
|
|
250 int sector_id = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
|
|
251 sprintf(pTmpBuf.data(), "Party Sector ID: %u/%u\n", sector_id, pIndoor->uNumSectors);
|
2528
|
252 pPrimaryWindow->DrawText(pFontArrus, 16, 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, Color16(255, 255, 255));
|
2499
|
253 }
|
|
254 sprintf(pTmpBuf.data(), "Party Position: % d % d % d", pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
|
2528
|
255 pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, Color16(255, 255, 255));
|
2499
|
256
|
|
257 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
258 {
|
|
259 uint uFaceID;
|
|
260 int sector_id = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
|
|
261 int floor_level = BLV_GetFloorLevel(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + 40, sector_id, &uFaceID);
|
|
262 sprintf(pTmpBuf.data(), "BLV_GetFloorLevel: %d face_id %d\n", floor_level, uFaceID);
|
|
263 }
|
|
264 else
|
|
265 {
|
|
266 int on_water, _a6;
|
|
267 int floor_level = ODM_GetFloorLevel(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z, 0, &on_water, &_a6, false);
|
|
268 sprintf(pTmpBuf.data(), "ODM_GetFloorLevel: %d on_water: %s a6 = %d\n", floor_level, on_water ? "true" : "false", _a6);
|
|
269 }
|
2528
|
270 pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16 + 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, Color16(255, 255, 255));
|
2499
|
271 }
|
|
272
|
|
273 GUI_UpdateWindows();
|
|
274 pParty->UpdatePlayersAndHirelingsEmotions();
|
|
275
|
|
276 _unused_5B5924_is_travel_ui_drawn = false;
|
|
277 if (v4)
|
|
278 pMouse->bRedraw = true;
|
|
279 pMouse->ReadCursorWithItem();
|
|
280 pMouse->DrawCursor();
|
|
281 pMouse->Activate();
|
|
282 pRenderer->EndScene();
|
|
283 pRenderer->Present();
|
|
284 pParty->uFlags &= ~2;
|
|
285 }
|
|
286
|
|
287 //----- (0047A815) --------------------------------------------------------
|
|
288 void Game::DrawParticles()
|
|
289 {
|
|
290 pParticleEngine->Draw();
|
|
291 }
|
|
292
|
|
293 //----- (00463149) --------------------------------------------------------
|
|
294 void Game::Loop()
|
|
295 {
|
|
296 const char *pLocationName; // [sp-4h] [bp-68h]@74
|
|
297 bool bLoading; // [sp+10h] [bp-54h]@1
|
|
298 signed int v16; // [sp+14h] [bp-50h]@8
|
|
299 MSG Msg; // [sp+28h] [bp-3Ch]@20
|
|
300 char Source[64]; // [sp+44h] [bp-20h]@76
|
|
301
|
|
302 bLoading = sCurrentMenuID == MENU_LoadingProcInMainMenu;
|
|
303 SetCurrentMenuID((MENU_STATE)-1);
|
|
304 if (bLoading)
|
|
305 {
|
|
306 pParty->Reset();
|
|
307 uGameState = GAME_STATE_PLAYING;
|
|
308 LoadGame(uLoadGameUI_SelectedSlot);
|
|
309 }
|
|
310
|
|
311 for (uint i = 1; i < 5; ++i)
|
|
312 for (uint j = 1; j < 6; ++j)
|
|
313 {
|
|
314 sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
|
|
315 remove(pTmpBuf.data());
|
|
316 }
|
|
317
|
|
318 LoadPlayerPortraintsAndVoices();
|
|
319 pIcons_LOD->_inlined_sub1();
|
2508
|
320 if ( use_music_folder )
|
|
321 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
|
|
322 else
|
|
323 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
|
2499
|
324
|
|
325 while ( 2 )
|
|
326 {
|
|
327 v16 = 1;
|
|
328 pMessageQueue_50CBD0->Flush();
|
|
329
|
|
330 pPartyActionQueue->uNumActions = 0;
|
|
331 if (pParty->bTurnBasedModeOn)
|
|
332 {
|
|
333 pTurnEngine->End(false);
|
|
334 pParty->bTurnBasedModeOn = false;
|
|
335 }
|
|
336 DoPrepareWorld(bLoading, 1);
|
|
337 pEventTimer->Resume();
|
|
338 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME;
|
|
339 // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
|
|
340 pCurrentScreen = SCREEN_GAME;
|
|
341
|
|
342 //if ( pRenderer->pRenderD3D )
|
|
343 pGame->pVisInstance->_4C1A02();
|
|
344
|
|
345 bool game_finished = false;
|
|
346 do
|
|
347 {
|
|
348 while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) )
|
|
349 {
|
|
350 if ( Msg.message == WM_QUIT )
|
|
351 Game_DeinitializeAndTerminate(0);
|
|
352 TranslateMessage(&Msg);
|
|
353 DispatchMessageA(&Msg);
|
|
354 }
|
|
355 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
|
|
356 {
|
|
357 WaitMessage();
|
|
358 continue;
|
|
359 }
|
|
360 pGame->_44EEA7();
|
|
361 GameUI_WritePointedObjectStatusString();
|
|
362 Keyboard::ProcessInputActions();
|
|
363 GameUI_MsgProc();
|
|
364 if ( pArcomageGame->bGameInProgress )
|
|
365 {
|
|
366 ArcomageGame::Loop();
|
|
367 pRenderer->Present();
|
|
368 continue;
|
|
369 }
|
|
370
|
|
371 pMediaPlayer->HouseMovieLoop();
|
|
372
|
|
373 pEventTimer->Update();
|
|
374 pMiscTimer->Update();
|
|
375
|
|
376 OnTimer(0);
|
|
377 GameUI_StatusBar_UpdateTimedString(0);
|
|
378 if ( pMiscTimer->bPaused && !pEventTimer->bPaused )
|
|
379 pMiscTimer->Resume();
|
|
380 if ( pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn )
|
|
381 pEventTimer->bTackGameTime = 0;
|
|
382 if ( !pEventTimer->bPaused && uGameState == GAME_STATE_PLAYING)
|
|
383 {
|
|
384 if ( !pEventTimer->bTackGameTime )
|
|
385 _494035_timed_effects__water_walking_damage__etc();
|
|
386
|
|
387 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0001)
|
|
388 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0001;
|
|
389 else
|
|
390 {
|
|
391 Actor::UpdateActorAI();
|
|
392 UpdateUserInput_and_MapSpecificStuff();
|
|
393 }
|
|
394 }
|
|
395 if ( v16 )
|
|
396 {
|
|
397 v16 = 0;
|
|
398 viewparams->bRedrawGameUI = true;
|
|
399 }
|
|
400 pAudioPlayer->UpdateSounds();
|
|
401 if ( (signed int)uGameState == GAME_STATE_PLAYING )
|
|
402 {
|
|
403 pGame->Draw();
|
|
404 continue;
|
|
405 }
|
|
406 if (uGameState == GAME_FINISHED)
|
|
407 {
|
|
408 game_finished = true;
|
|
409 continue;
|
|
410 }
|
|
411 if (uGameState == GAME_STATE_CHANGE_LOCATION)// ñìåíà ëîêàöèè
|
|
412 {
|
|
413 pAudioPlayer->StopChannels(-1, -1);
|
|
414 PrepareWorld(0);
|
|
415 uGameState = GAME_STATE_PLAYING;
|
|
416 continue;
|
|
417 }
|
|
418 if ( (signed int)uGameState <= GAME_STATE_5 || uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU )//GAME_STATE_NEWGAME_OUT_GAMEMENU, GAME_STATE_LOADING_GAME
|
|
419 {
|
|
420 game_finished = true;
|
|
421 continue;
|
|
422 }
|
|
423 if ( uGameState == GAME_STATE_FINAL_WINDOW )
|
|
424 {
|
|
425 pRenderer->BeginScene();
|
|
426 GUI_UpdateWindows();
|
|
427 pRenderer->EndScene();
|
|
428 pRenderer->Present();
|
|
429 continue;
|
|
430 }
|
|
431 if ( uGameState != GAME_STATE_PARTY_DIED )
|
|
432 {
|
|
433 pGame->Draw();
|
|
434 continue;
|
|
435 }
|
|
436 if ( uGameState == GAME_STATE_PARTY_DIED )
|
|
437 {
|
|
438 pAudioPlayer->StopChannels(-1, -1);
|
|
439 memset(&pParty->pHirelings[0], 0, 0x4Cu);
|
|
440 memset(&pParty->pHirelings[1], 0, 0x4Cu);
|
|
441 for ( int i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i )
|
|
442 {
|
|
443 if ( pNPCStats->pNewNPCData[i].field_24 )
|
|
444 pNPCStats->pNewNPCData[i].uFlags &= 0xFFFFFF7Fu;
|
|
445 }
|
|
446 pMediaPlayer->bStopBeforeSchedule = 0;
|
|
447 pMediaPlayer->PlayFullscreenMovie(MOVIE_Death, true);
|
|
448 if ( pMovie_Track )
|
|
449 pMediaPlayer->Unload();
|
|
450 SaveGame(0, 0);
|
|
451 ++pParty->uNumDeaths;
|
|
452 for ( uint i = 0; i < 4; ++i )
|
|
453 pParty->pPlayers[i].SetVariable(VAR_Award, 85);
|
|
454 pParty->days_played_without_rest = 0;
|
|
455 pParty->uTimePlayed += 0x276000ui64;
|
|
456 LOWORD(pParty->uFlags) &= ~0x204;
|
|
457 pParty->SetGold(0);
|
|
458 pOtherOverlayList->Reset();
|
|
459 memset(pParty->pPartyBuffs.data(), 0, 0x140u);
|
|
460
|
|
461 if ( pParty->bTurnBasedModeOn == 1 )
|
|
462 {
|
|
463 pTurnEngine->End(true);
|
|
464 pParty->bTurnBasedModeOn = 0;
|
|
465 }
|
|
466 for( int i = 0; i < 4; ++i)
|
|
467 {
|
|
468 memset(pParty->pPlayers[i].pConditions.data(), 0, 0xA0u);//(pConditions, 0, 160)
|
|
469 memset(pParty->pPlayers[i].pPlayerBuffs.data(), 0, 0x180u);//(pPlayerBuffs[0], 0, 384)
|
|
470 pParty->pPlayers[i].sHealth = 1;
|
|
471 uActiveCharacter = 1;
|
|
472 }
|
|
473 if (_449B57_test_bit(pParty->_quest_bits, PARTY_QUEST_FINISHED_EMERALD_ISLE))
|
|
474 {
|
|
475 pParty->vPosition.x = -17331; // respawn in harmondale
|
|
476 pParty->vPosition.y = 12547;
|
|
477 pParty->vPosition.z = 465;
|
|
478 pParty->sRotationY = 0;
|
|
479 pLocationName = "out02.odm";
|
|
480 }
|
|
481 else
|
|
482 {
|
|
483 pParty->vPosition.x = 12552; // respawn on emerald isle
|
|
484 pParty->vPosition.y = 1816;
|
|
485 pParty->vPosition.z = 0;
|
|
486 pParty->sRotationY = 512;
|
|
487 pLocationName = "out01.odm";
|
|
488 }
|
|
489 strcpy(Source, pLocationName);
|
|
490 pParty->uFallStartY = pParty->vPosition.z;
|
|
491 pParty->sRotationX = 0;
|
|
492 pParty->uFallSpeed = 0;
|
|
493 pParty->field_6E4 = 0;
|
|
494 pParty->field_6E0 = 0;
|
|
495 if ( _stricmp(Source, pCurrentMapName) )
|
|
496 {
|
|
497 strcpy(pCurrentMapName, Source);
|
|
498 _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x;
|
|
499 _5B65AC_npcdata_fame_or_other = pParty->vPosition.y;
|
|
500 _5B65B0_npcdata_rep_or_other = pParty->vPosition.z;
|
|
501 _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY;
|
|
502 _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX;
|
|
503 dword_5B65C0 = 1;
|
|
504 PrepareWorld(1);
|
|
505 }
|
|
506 Actor::InitializeActors();
|
|
507
|
|
508 int num_conscious_players = 0;
|
|
509 int conscious_players_ids[4] = {-1, -1, -1, -1};
|
|
510 for (int i = 0; i < 4; ++i)
|
|
511 {
|
|
512 if (pParty->pPlayers[i].CanAct())
|
|
513 conscious_players_ids[num_conscious_players++] = i;
|
|
514 }
|
|
515 if (num_conscious_players)
|
|
516 {
|
|
517 int idx = conscious_players_ids[rand() % num_conscious_players];
|
|
518 Assert(idx >= 0);
|
|
519 pParty->pPlayers[idx].PlaySound(SPEECH_99, 0);
|
|
520 }
|
|
521
|
|
522 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2);// "Once again you've cheated death!.." "Âû ñíîâà îáõèòðèëè ñìåðòü! …"
|
|
523 uGameState = GAME_STATE_PLAYING;
|
|
524 }
|
|
525 }
|
|
526 while (!game_finished);
|
|
527
|
|
528 pEventTimer->Pause();
|
|
529 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
|
|
530 if ( uGameState == GAME_STATE_LOADING_GAME )
|
|
531 {
|
|
532 sub_491E3A();
|
|
533 LoadPlayerPortraintsAndVoices();
|
|
534 uGameState = GAME_STATE_PLAYING;
|
|
535 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
|
|
536 bLoading = true;
|
|
537 continue;
|
|
538 }
|
|
539 break;
|
|
540 }
|
|
541 pCurrentScreen = SCREEN_VIDEO;
|
|
542 sub_491E3A();
|
|
543 }
|
|
544
|
|
545
|
|
546 //----- (0044F192) --------------------------------------------------------
|
|
547 void Game::PrepareBloodsplats()
|
|
548 {
|
|
549 for (uint i = 0; i < uNumBloodsplats; ++i)
|
|
550 {
|
|
551 pBloodsplatContainer->AddBloodsplat(pBloodsplats[i].x, pBloodsplats[i].y, pBloodsplats[i].z,
|
|
552 pBloodsplats[i].radius, pBloodsplats[i].r, pBloodsplats[i].g, pBloodsplats[i].b);
|
|
553 }
|
|
554 }
|
|
555
|
|
556
|
|
557 //----- (0044F120) --------------------------------------------------------
|
|
558 void Game::PushStationaryLights(int a2)
|
|
559 {
|
|
560 Game__StationaryLight* pLight;
|
|
561
|
2532
|
562 for( int i = 0; i < uNumStationaryLights; ++i )
|
2499
|
563 {
|
2532
|
564 pLight = &pStationaryLights[i];
|
2499
|
565 pStationaryLightsStack->AddLight(pLight->vPosition.x, pLight->vPosition.y, pLight->vPosition.z,
|
|
566 pLight->flt_18, pLight->vRGBColor.x, pLight->vRGBColor.y, pLight->vRGBColor.z, _4E94D0_light_type);
|
|
567 }
|
|
568 }
|
|
569 // 4E94D0: using guessed type char _4E94D0_light_type;
|
|
570
|
|
571 //----- (0044F0FD) --------------------------------------------------------
|
|
572 void Game::_44F0FD()
|
|
573 {
|
|
574 ToggleFlags(0x40u);
|
|
575
|
|
576 if ( !(uFlags & 0x40) )
|
|
577 {
|
|
578 uNumBloodsplats = 0;
|
|
579 field_E0C = 0;
|
|
580 }
|
|
581 }
|
|
582
|
|
583 //----- (0044F0D8) --------------------------------------------------------
|
|
584 void Game::ToggleFlags(uint uMask)
|
|
585 {
|
|
586 if (uFlags & uMask)
|
|
587 uFlags &= ~uMask;
|
|
588 else
|
|
589 uFlags |= uMask;
|
|
590 }
|
|
591
|
|
592
|
|
593 //----- (0044F07B) --------------------------------------------------------
|
|
594 bool Game::_44F07B()
|
|
595 {
|
|
596 if (!pKeyboardInstance->IsKeyBeingHeld(VK_SHIFT) && !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) &&
|
|
597 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) || (pKeyboardInstance->WasKeyPressed(VK_F11) == 0 &&
|
|
598 pKeyboardInstance->WasKeyPressed(VK_F11)))
|
|
599 return true;
|
|
600 return false;
|
|
601 }
|
|
602
|
|
603 //----- (0044EEA7) --------------------------------------------------------
|
|
604 bool Game::_44EEA7()
|
|
605 {
|
|
606 //Game *v1; // esi@1
|
|
607 //double v2; // st7@2
|
|
608 float depth; // ST00_4@9
|
|
609 //bool result; // eax@9
|
|
610 //unsigned int v5; // eax@14
|
|
611 __int64 v6; // kr00_8@21
|
|
612 //unsigned int y; // [sp+4h] [bp-24h]@2
|
|
613 //unsigned int x; // [sp+8h] [bp-20h]@2
|
|
614 Vis_SelectionFilter *v10; // [sp+10h] [bp-18h]@2
|
|
615 Vis_SelectionFilter *v11; // [sp+14h] [bp-14h]@2
|
|
616 POINT cursor; // [sp+20h] [bp-8h]@1
|
|
617
|
|
618 //v1 = this;
|
|
619 ++qword_5C6DF0;
|
|
620 pParticleEngine->UpdateParticles();
|
|
621 pMouseInstance->GetCursorPos(&cursor);
|
|
622
|
|
623 //x = cursor.y;
|
|
624 //y = cursor.x;
|
|
625 if ( sub_4637E0_is_there_popup_onscreen() )
|
|
626 {
|
|
627 v11 = &vis_face_filter;
|
|
628 v10 = &vis_sprite_filter_2;
|
|
629 depth = pGame->pIndoorCameraD3D->GetPickDepth();
|
|
630 }
|
|
631 else
|
|
632 {
|
|
633 if ( uFlags2 & GAME_FLAGS_2_TARGETING_MODE )
|
|
634 {
|
|
635 v11 = &vis_face_filter;
|
|
636 v10 = &vis_sprite_filter_1;
|
|
637 }
|
|
638 else
|
|
639 {
|
|
640 v11 = &vis_face_filter;
|
|
641 v10 = &vis_sprite_filter_4;
|
|
642 }
|
|
643 depth = 5120.0;
|
|
644 }
|
|
645 //depth = v2;
|
|
646
|
|
647 PickMouse(depth, cursor.x, cursor.y, false, v10, v11);
|
|
648 pLightmapBuilder->std__vector_000004_size = 0;
|
|
649 pLightmapBuilder->std__vector_183808_size = 0;
|
|
650 pDecalBuilder->std__vector_pDecals_size = 0;
|
|
651 pDecalBuilder->field_308008 = 0;
|
|
652 if (!_44F07B())
|
|
653 return false;
|
|
654
|
|
655 if ( uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
|
|
656 pStru10Instance->bDoNotDrawPortalFrustum = false;
|
|
657 if ( /*pRenderer->pRenderD3D &&*/ uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
658 pRenderer->uFogColor = GetLevelFogColor() & 0xFFFFFF;
|
|
659 if (uFlags & 0x0400)
|
|
660 uFlags2 |= 0x01;
|
|
661 /*if ( !pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor && pMobileLightsStack->uNumLightsActive )
|
|
662 {
|
|
663 uFlags2 |= 0x01;
|
|
664 field_E10 = qword_5C6DF0;
|
|
665 }*/
|
|
666 v6 = qword_5C6DF0 - field_E10;
|
|
667 if ( qword_5C6DF0 - field_E10 == 1 )
|
|
668 uFlags2 |= v6;
|
|
669 if (uNumStationaryLights_in_pStationaryLightsStack != pStationaryLightsStack->uNumLightsActive )
|
|
670 {
|
|
671 uFlags2 |= 1;
|
|
672 uNumStationaryLights_in_pStationaryLightsStack = pStationaryLightsStack->uNumLightsActive;
|
|
673 }
|
|
674 _44E904();
|
|
675 return true;
|
|
676 }
|
|
677
|
|
678
|
|
679 //----- (0044EDE4) --------------------------------------------------------
|
|
680 bool Game::AlterGamma_BLV(BLVFace *pFace, signed int *pColor)
|
|
681 {
|
|
682 if (uFlags2 & GAME_FLAGS_2_SATURATE_LIGHTMAPS &&
|
|
683 pFace->uAttributes & FACE_CAN_SATURATE_COLOR)
|
|
684 {
|
|
685 *pColor = ReplaceHSV(*pColor, 1.0, fSaturation, -1.0);
|
|
686 return true;
|
|
687 }
|
|
688 else
|
|
689 return false;
|
|
690 }
|
|
691
|
|
692 //----- (0044EE30) --------------------------------------------------------
|
|
693 bool Game::AlterGamma_ODM(ODMFace *pFace, signed int *pColor)
|
|
694 {
|
|
695 if (uFlags2 & GAME_FLAGS_2_SATURATE_LIGHTMAPS &&
|
|
696 pFace->uAttributes & FACE_CAN_SATURATE_COLOR)
|
|
697 {
|
|
698 *pColor = ReplaceHSV(*pColor, 1.0, fSaturation, -1.0);
|
|
699 return true;
|
|
700 }
|
|
701 else
|
|
702 return false;
|
|
703 }
|
|
704
|
|
705
|
|
706 //----- (004645FA) --------------------------------------------------------
|
|
707 void Game::Deinitialize()
|
|
708 {
|
|
709 WriteWindowsRegistryInt("startinwindow", 1);//pRenderer->bWindowMode);
|
|
710 //if (pRenderer->bWindowMode)
|
|
711 {
|
|
712 WriteWindowsRegistryInt("window X", window->GetX());
|
|
713 WriteWindowsRegistryInt("window Y", window->GetY());
|
|
714 }
|
|
715 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
|
|
716 pItemsTable->Release();
|
|
717 pNPCStats->Release();
|
|
718
|
|
719 if (pMouse)
|
|
720 pMouse->Deactivate();
|
|
721
|
|
722 delete pRenderer;
|
|
723 pAudioPlayer->Release();//error
|
|
724 pNew_LOD->FreeSubIndexAndIO();
|
|
725 pGames_LOD->FreeSubIndexAndIO();
|
|
726 ClipCursor(0);
|
|
727 Game::Destroy();
|
|
728 delete pEventTimer;
|
|
729 }
|
|
730
|
|
731 //----- (0044EE7C) --------------------------------------------------------
|
|
732 bool Game::draw_debug_outlines()
|
|
733 {
|
|
734 if (uFlags & 0x04)
|
|
735 {
|
|
736 pLightmapBuilder->DrawDebugOutlines(-1);
|
|
737 pDecalBuilder->DrawDecalDebugOutlines();
|
|
738 }
|
|
739 return true;
|
|
740 }
|
|
741
|
|
742 //----- (0044EC23) --------------------------------------------------------
|
|
743 int Game::_44EC23(struct Polygon *a2, int *a3, signed int a4)
|
|
744 {
|
|
745 double v4; // st7@4
|
|
746 //double v5; // ST00_8@4
|
|
747 signed int v6; // eax@5
|
|
748 //double v7; // ST00_8@6
|
|
749 signed int result; // eax@8
|
|
750 //double v9; // ST00_8@9
|
|
751 //double v10; // ST00_8@11
|
|
752 float a2a; // [sp+14h] [bp+8h]@4
|
|
753 float a3a; // [sp+18h] [bp+Ch]@4
|
|
754 float a3b; // [sp+18h] [bp+Ch]@6
|
|
755 float a4a; // [sp+1Ch] [bp+10h]@9
|
|
756 float a4b; // [sp+1Ch] [bp+10h]@11
|
|
757
|
|
758 if ( this->uFlags2 & 2 && a2->field_59 == 5 && a2->pODMFace->uAttributes & 2 )
|
|
759 {
|
|
760 v4 = (double)a4;
|
|
761 a2a = v4;
|
|
762 *a3 |= 2u;
|
|
763 a3a = (1.0 - this->fSaturation) * v4;
|
|
764 //v5 = a3a + 6.7553994e15;
|
|
765 //if ( SLODWORD(v5) >= 0 )
|
|
766 if (floorf(a3a + 0.5f) >= 0 )
|
|
767 {
|
|
768 a3b = (1.0 - this->fSaturation) * a2a;
|
|
769 //v7 = a3b + 6.7553994e15;
|
|
770 //v6 = LODWORD(v7);
|
|
771 v6 = floorf(a3b + 0.5f);
|
|
772 }
|
|
773 else
|
|
774 v6 = 0;
|
|
775 if ( a4 >= v6 )
|
|
776 {
|
|
777 a4a = (1.0 - fSaturation) * a2a;
|
|
778 //v9 = a4a + 6.7553994e15;
|
|
779 //if ( SLODWORD(v9) >= 0 )
|
|
780 if (floorf(a4a + 0.5f) >= 0)
|
|
781 {
|
|
782 a4b = (1.0 - fSaturation) * a2a;
|
|
783 //v10 = a4b + 6.7553994e15;
|
|
784 //result = LODWORD(v10);
|
|
785 result = floorf(a4b + 0.5f);
|
|
786 }
|
|
787 else
|
|
788 result = 0;
|
|
789 }
|
|
790 else
|
|
791 result = a4;
|
|
792 }
|
|
793 else
|
|
794 result = -1;
|
|
795 return result;
|
|
796 }
|
|
797
|
|
798
|
|
799
|
|
800 //----- (00465C8B) --------------------------------------------------------
|
|
801 Game *Game::Create()
|
|
802 {
|
|
803 return new Game;
|
|
804 }
|
|
805
|
|
806 //----- (00465CF3) --------------------------------------------------------
|
|
807 void Game::Destroy()
|
|
808 {
|
|
809 delete pGame;
|
|
810 pGame = nullptr;
|
|
811 }
|
|
812
|
|
813 //----- (0044ED0A) --------------------------------------------------------
|
|
814 signed int Game::_44ED0A(BLVFace *a2, int *a3, signed int a4)
|
|
815 {
|
|
816 double v4; // st7@3
|
|
817 //double v5; // ST00_8@3
|
|
818 signed int v6; // eax@4
|
|
819 //double v7; // ST00_8@5
|
|
820 signed int result; // eax@7
|
|
821 //double v9; // ST00_8@8
|
|
822 //double v10; // ST00_8@10
|
|
823 float v11; // [sp+14h] [bp+8h]@3
|
|
824 float v12; // [sp+18h] [bp+Ch]@3
|
|
825 float v13; // [sp+18h] [bp+Ch]@5
|
|
826 float v14; // [sp+1Ch] [bp+10h]@8
|
|
827 float v15; // [sp+1Ch] [bp+10h]@10
|
|
828
|
|
829 if ( this->uFlags2 & 2 && a2->uAttributes & 2 )
|
|
830 {
|
|
831 v4 = (double)a4;
|
|
832 v11 = v4;
|
|
833 *a3 |= 2u;
|
|
834 v12 = (1.0 - this->fSaturation) * v4;
|
|
835 //v5 = v12 + 6.7553994e15;
|
|
836 if (floorf(v12 + 0.5f)/* SLODWORD(v5)*/ >= 0 )
|
|
837 {
|
|
838 v13 = (1.0 - this->fSaturation) * v11;
|
|
839 //v7 = v13 + 6.7553994e15;
|
|
840 //v6 = LODWORD(v7);
|
|
841 v6 = floorf(v13 + 0.5f);
|
|
842 }
|
|
843 else
|
|
844 v6 = 0;
|
|
845 if ( a4 >= v6 )
|
|
846 {
|
|
847 v14 = (1.0 - fSaturation) * v11;
|
|
848 //v9 = v14 + 6.7553994e15;
|
|
849 if (floorf(v14 + 0.5f)/* SLODWORD(v9)*/ >= 0 )
|
|
850 {
|
|
851 v15 = (1.0 - fSaturation) * v11;
|
|
852 //v10 = v15 + 6.7553994e15;
|
|
853 //result = LODWORD(v10);
|
|
854 result = floorf(v15 + 0.5f);
|
|
855 }
|
|
856 else
|
|
857 result = 0;
|
|
858 }
|
|
859 else
|
|
860 result = a4;
|
|
861 }
|
|
862 else
|
|
863 result = -1;
|
|
864 return result;
|
|
865 }
|
|
866
|
|
867
|
|
868 //----- (0044E4B7) --------------------------------------------------------
|
|
869 Game::Game()
|
|
870 {
|
|
871 uNumStationaryLights = 0;
|
|
872 uNumBloodsplats = 0;
|
|
873 field_E0C = 0;
|
|
874 field_E10 = 0;
|
|
875 uNumStationaryLights_in_pStationaryLightsStack = 0;
|
|
876 bGammaControlInitialized = false;
|
|
877 uFlags = 0;
|
|
878 uFlags2 = 0;
|
|
879 uSomeGammaStartTime = 0;
|
|
880 uSomeGammaDeltaTime = 0;
|
|
881
|
|
882 //pThreadWardInstance = new ThreadWard;
|
|
883 pThreadWardInstance = nullptr;
|
|
884 pParticleEngine = new ParticleEngine;
|
|
885 pMouse = pMouseInstance = new Mouse;
|
|
886 pLightmapBuilder = new LightmapBuilder;
|
|
887 pVisInstance = new Vis;
|
|
888 pStru6Instance = new stru6;
|
|
889 pIndoorCameraD3D = new IndoorCameraD3D;
|
|
890 pStru9Instance = new stru9;
|
|
891 pStru10Instance = new stru10;
|
|
892 //pStru11Instance = new stru11;
|
|
893 pStru11Instance = nullptr;
|
|
894 //pStru12Instance = new stru12(pStru11Instance);
|
|
895 pStru12Instance = nullptr;
|
|
896 //pCShow = new CShow;
|
|
897 pCShow = nullptr;
|
|
898 pKeyboardInstance = new Keyboard;
|
|
899 pGammaController = new GammaController;
|
|
900
|
|
901 uFlags |= 0x0800;
|
|
902 uFlags2 |= 0x24;
|
|
903
|
|
904 _44F0FD();
|
|
905 }
|
|
906
|
|
907 //----- (0044E7F3) --------------------------------------------------------
|
|
908 Game::~Game()
|
|
909 {
|
|
910 delete pGammaController;
|
|
911 delete pKeyboardInstance;
|
|
912 /*delete pCShow;
|
|
913 delete pStru12Instance;
|
|
914 delete pStru11Instance;*/
|
|
915 delete pStru10Instance;
|
|
916 delete pStru9Instance;
|
|
917 delete pIndoorCameraD3D;
|
|
918 delete pStru6Instance;
|
|
919 delete pVisInstance;
|
|
920 delete pLightmapBuilder;
|
|
921 delete pMouseInstance;
|
|
922 delete pParticleEngine;
|
|
923 //delete pThreadWardInstance;
|
|
924 }
|
|
925
|
|
926 //----- (0044E904) --------------------------------------------------------
|
|
927 void Game::_44E904()
|
|
928 {
|
|
929 //Game *v1; // esi@1
|
|
930 unsigned __int64 v2; // qax@1
|
|
931 unsigned int v3; // ecx@1
|
|
932 int v4; // edi@1
|
|
933 unsigned __int8 v5; // cf@7
|
|
934 double v6; // st7@13
|
|
935 double v7; // st7@15
|
|
936 signed __int64 v8; // [sp+Ch] [bp-8h]@1
|
|
937
|
|
938 //v1 = this;
|
|
939 v2 = pEventTimer->Time();
|
|
940 v4 = (v2 - uSomeGammaStartTime) >> 32;
|
|
941 v3 = v2 - LODWORD(uSomeGammaStartTime);
|
|
942 v8 = v2 - uSomeGammaStartTime;
|
|
943 if ( v4 < 0
|
|
944 || SHIDWORD(v2) < ((unsigned int)v2 < LODWORD(uSomeGammaStartTime)) + HIDWORD(uSomeGammaStartTime) | v4 == 0
|
|
945 && v3 <= 0x80 )
|
|
946 {
|
|
947 if ( v4 < 0 )
|
|
948 {
|
|
949 v3 = 0;
|
|
950 v4 = 0;
|
|
951 uSomeGammaStartTime = v2;
|
|
952 v8 = __PAIR__(v4, v3);
|
|
953 }
|
|
954 }
|
|
955 else
|
|
956 {
|
|
957 if ( uSomeGammaDeltaTime )
|
|
958 {
|
|
959 LODWORD(uSomeGammaDeltaTime) = 0;
|
|
960 HIDWORD(uSomeGammaDeltaTime) = 0;
|
|
961 }
|
|
962 else
|
|
963 {
|
|
964 LODWORD(uSomeGammaDeltaTime) = v3;
|
|
965 HIDWORD(uSomeGammaDeltaTime) = v4;
|
|
966 }
|
|
967 v5 = __CFADD__(v3, -128);
|
|
968 v3 -= 128;
|
|
969 v4 = v5 + v4 - 1;
|
|
970 uSomeGammaStartTime = v2;
|
|
971 v8 = __PAIR__(v4, v3);
|
|
972 }
|
|
973 if ( uSomeGammaDeltaTime )
|
|
974 v6 = (double)(signed __int64)(uSomeGammaDeltaTime - __PAIR__(v4, v3));
|
|
975 else
|
|
976 v6 = (double)v8;
|
|
977 v7 = v6 * 0.0078125;
|
|
978 if ( v7 < 0.0 || v7 <= 1.0 )
|
|
979 {
|
|
980 if ( v7 < 0.0 )
|
|
981 v7 = 0.0;
|
|
982 }
|
|
983 else
|
|
984 v7 = 1.0;
|
|
985 //if ( pRenderer->pRenderD3D )
|
|
986 fSaturation = v7;
|
|
987 //else
|
|
988 // fSaturation = (1.0 - 0.5) * v7 + 0.5;
|
|
989 }
|
|
990
|
|
991 //----- (0044EA17) --------------------------------------------------------
|
|
992 bool Game::InitializeGammaController()
|
|
993 {
|
|
994 //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
|
|
995 //pVersion->pVersionInfo.dwMajorVersion != 4 )
|
|
996 pGammaController->InitializeFromSurface(pRenderer->pFrontBuffer4);
|
|
997
|
|
998 bGammaControlInitialized = true;
|
|
999 uSomeGammaStartTime = pEventTimer->Time();
|
|
1000 return true;
|
|
1001 }
|
|
1002
|
|
1003 //----- (0044EA5E) --------------------------------------------------------
|
|
1004 bool Game::PickMouse(float fPickDepth, unsigned int uMouseX, unsigned int uMouseY, bool bOutline, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter)
|
|
1005 {
|
|
1006 /*if (pCurrentScreen != SCREEN_GAME|| !pRenderer->pRenderD3D)
|
|
1007 return false;*/
|
|
1008
|
|
1009 if (!pVisInstance)
|
|
1010 {
|
|
1011 MessageBoxW(nullptr, L"The 'Vis' object pointer has not been instatiated, but CGame::Pick() is trying to call through it.", nullptr, 0);
|
|
1012 return false;
|
|
1013 }
|
|
1014
|
|
1015 if (uMouseX >= (signed int)pViewport->uScreen_TL_X &&
|
|
1016 uMouseX <= (signed int)pViewport->uScreen_BR_X &&
|
|
1017 uMouseY >= (signed int)pViewport->uScreen_TL_Y &&
|
|
1018 uMouseY <= (signed int)pViewport->uScreen_BR_Y)
|
|
1019 {
|
|
1020 pVisInstance->PickMouse(fPickDepth, uMouseX, uMouseY, sprite_filter, face_filter);
|
|
1021
|
|
1022 if (bOutline)
|
|
1023 OutlineSelection();
|
|
1024 }
|
|
1025
|
|
1026 return true;
|
|
1027 }
|
|
1028 // 4E28F8: using guessed type int pCurrentScreen;
|
|
1029
|
|
1030 //----- (0044EB12) --------------------------------------------------------
|
|
1031 bool Game::PickKeyboard(bool bOutline, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter)
|
|
1032 {
|
|
1033 if (pCurrentScreen == SCREEN_GAME && pVisInstance /*&& pRenderer->pRenderD3D*/)
|
|
1034 {
|
|
1035 bool r = pVisInstance->PickKeyboard(&pVisInstance->default_list, sprite_filter, face_filter);
|
|
1036
|
|
1037 if (bOutline)
|
|
1038 OutlineSelection();
|
|
1039 return r;
|
|
1040 }
|
|
1041 return false;
|
|
1042 }
|
|
1043 /*
|
|
1044 Result::Code Game::PickKeyboard(bool bOutline, struct unnamed_F93E6C *a3, struct unnamed_F93E6C *a4)
|
|
1045 {
|
|
1046 if (dword_4E28F8_PartyCantJumpIfTrue)
|
|
1047 return Result::Generic;
|
|
1048
|
|
1049 pVis->PickKeyboard(a3, a4);
|
|
1050 if (bOutline)
|
|
1051 Game_outline_selection((int)this);
|
|
1052 return Result::Success;
|
|
1053 }
|
|
1054 */
|
|
1055 // 4E28F8: using guessed type int pCurrentScreen;
|
|
1056
|
|
1057 //----- (0044EB5A) --------------------------------------------------------
|
|
1058 void Game::OutlineSelection()
|
|
1059 {
|
|
1060 if (!pVisInstance)
|
|
1061 return;
|
|
1062
|
|
1063 if (!pVisInstance->default_list.uNumPointers)
|
|
1064 return;
|
|
1065
|
|
1066 Vis_ObjectInfo* object_info = pVisInstance->default_list.object_pointers[0];
|
|
1067 if (object_info)
|
|
1068 switch (object_info->object_type)
|
|
1069 {
|
|
1070 case VisObjectType_Sprite:
|
|
1071 {
|
|
1072 Log::Warning(L"Sprite outline currently unsupported");
|
|
1073 return;
|
|
1074 }
|
|
1075
|
|
1076 case VisObjectType_Face:
|
|
1077 {
|
|
1078 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
1079 {
|
|
1080 ODMFace* face = (ODMFace *)object_info->object;
|
|
1081 if (face->uAttributes & FACE_OUTLINED)
|
|
1082 face->uAttributes &= ~FACE_OUTLINED;
|
|
1083 else
|
|
1084 face->uAttributes |= FACE_OUTLINED;
|
|
1085 }
|
|
1086 else if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
1087 {
|
|
1088 BLVFace* face = (BLVFace *)object_info->object;
|
|
1089 if (face->uAttributes & FACE_OUTLINED)
|
|
1090 face->uAttributes &= ~FACE_OUTLINED;
|
|
1091 else
|
|
1092 face->uAttributes |= FACE_OUTLINED;
|
|
1093 }
|
|
1094 else
|
|
1095 Error("Invalid level type", uCurrentlyLoadedLevelType);
|
|
1096 }
|
|
1097 break;
|
|
1098
|
|
1099 default:
|
|
1100 {
|
|
1101 MessageBoxW(nullptr, L"Undefined CObjectInfo type requested in CGame::outline_selection()", nullptr, 0);
|
|
1102 ExitProcess(0);
|
|
1103 }
|
|
1104 }
|
|
1105 }
|
|
1106 //----- (004304E7) --------------------------------------------------------
|
|
1107 void GameUI_MsgProc()
|
|
1108 {
|
|
1109 unsigned int v2; // edx@7
|
|
1110 Actor *pActor; // ecx@13
|
|
1111 int v4; // ecx@18
|
|
1112 unsigned int v10; // ecx@73
|
|
1113 int v14; // eax@98
|
|
1114 int v18; // eax@106
|
|
1115 float v19; // ST64_4@121
|
|
1116 float v21; // ST64_4@126
|
|
1117 float v22; // ST64_4@127
|
|
1118 unsigned int v24; // ecx@149
|
|
1119 GUIWindow *pWindow2; // ecx@248
|
|
1120 bool pKeyBindingFlag; // eax@269
|
|
1121 unsigned int v33; // eax@277
|
|
1122 int v37; // eax@341
|
|
1123 int v38; // eax@358
|
|
1124 SHORT v39; // ax@365
|
|
1125 char *v41; // eax@380
|
|
1126 int v42; // eax@396
|
|
1127 signed int v44; // eax@398
|
|
1128 int v45; // edx@398
|
|
1129 signed int v46; // ecx@398
|
|
1130 char v47; // zf@399
|
|
1131 char v48; // zf@405
|
|
1132 BLVFace *pBLVFace; // ecx@410
|
|
1133 ODMFace *pODMFace; // ecx@412
|
|
1134 CastSpellInfo *pSpellInfo; // ecx@415
|
|
1135 __int16 v53; // ax@431
|
|
1136 int v54; // eax@432
|
|
1137 int v55; // ecx@432
|
|
1138 int v56; // edx@432
|
|
1139 int v57; // eax@432
|
|
1140 Player *pPlayer; // edx@442
|
|
1141 unsigned int pMapNum; // eax@445
|
|
1142 signed int v60; // ST64_4@459
|
|
1143 __int16 v63; // dx@479
|
|
1144 unsigned int v64; // eax@486
|
|
1145 int v65; // ecx@486
|
|
1146 int v66; // eax@488
|
|
1147 char *v67; // eax@489
|
|
1148 __int16 v68; // dx@498
|
|
1149 char *v69; // eax@512
|
|
1150 int v70; // eax@525
|
|
1151 int v71; // edi@527
|
|
1152 NPCData *pNPCData3; // esi@527
|
|
1153 char *v73; // ecx@533
|
|
1154 signed int v74; // edi@535
|
|
1155 int v75; // eax@535
|
|
1156 int v76; // esi@535
|
|
1157 int v77; // eax@537
|
|
1158 Player *pPlayer2; // ecx@549
|
|
1159 signed int v81; // eax@552
|
|
1160 signed int v83; // ecx@554
|
|
1161 signed int v84; // ecx@554
|
|
1162 GUIButton *pButton; // eax@578
|
|
1163 unsigned int v86; // eax@583
|
|
1164 const char *v87; // ecx@595
|
|
1165 const char *v88; // ecx@596
|
|
1166 unsigned int v90; // eax@602
|
|
1167 int v91; // edx@605
|
|
1168 int v92; // eax@605
|
|
1169 int v93; // edx@605
|
|
1170 int pPlayerNum; // edx@611
|
|
1171 int v95; // eax@611
|
|
1172 unsigned int v97; // eax@624
|
|
1173 int v98; // eax@636
|
|
1174 int v103; // eax@671
|
|
1175 Player *pPlayer4; // ecx@718
|
|
1176 int v105; // eax@718
|
|
1177 Player *pPlayer5; // ST78_4@758
|
|
1178 unsigned int v107; // eax@758
|
|
1179 unsigned int v108; // eax@758
|
|
1180 unsigned int v115; // eax@764
|
|
1181 int v116; // eax@776
|
|
1182 unsigned int v118; // eax@785
|
|
1183 unsigned int v119; // ecx@786
|
|
1184 unsigned int v121; // [sp-28h] [bp-624h]@711
|
|
1185 unsigned int v123; // [sp-24h] [bp-620h]@711
|
|
1186 unsigned int v125; // [sp-20h] [bp-61Ch]@711
|
|
1187 int v127; // [sp-1Ch] [bp-618h]@107
|
|
1188 unsigned int v128; // [sp-1Ch] [bp-618h]@711
|
|
1189 GUIButton *pButton2; // [sp-4h] [bp-600h]@59
|
|
1190 const char *v161; // [sp-4h] [bp-600h]@637
|
|
1191 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287
|
|
1192 char *v173; // [sp+0h] [bp-5FCh]@444
|
|
1193 char *v174; // [sp+0h] [bp-5FCh]@449
|
|
1194 const char *v177; // [sp+0h] [bp-5FCh]@629
|
|
1195 char *v178; // [sp+0h] [bp-5FCh]@637
|
|
1196 signed int thisb; // [sp+14h] [bp-5E8h]@272
|
|
1197 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373
|
|
1198 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377
|
|
1199 char *pMapName; // [sp+14h] [bp-5E8h]@445
|
|
1200 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455
|
|
1201 int thisg; // [sp+14h] [bp-5E8h]@467
|
|
1202 int thish; // [sp+14h] [bp-5E8h]@528
|
|
1203 signed int thisi; // [sp+14h] [bp-5E8h]@535
|
|
1204 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604
|
|
1205 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641
|
|
1206 int uMessageParam; // [sp+18h] [bp-5E4h]@7
|
|
1207 int uAction; // [sp+1Ch] [bp-5E0h]@18
|
|
1208 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23
|
|
1209 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18
|
|
1210 char v197; // [sp+2Bh] [bp-5D1h]@101
|
|
1211 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7
|
|
1212 unsigned int v199; // [sp+30h] [bp-5CCh]@7
|
|
1213 char *v200; // [sp+34h] [bp-5C8h]@518
|
|
1214 POINT v202; // [sp+40h] [bp-5BCh]@141
|
|
1215 POINT a2; // [sp+48h] [bp-5B4h]@127
|
|
1216 POINT v205; // [sp+58h] [bp-5A4h]@171
|
|
1217 POINT v207; // [sp+68h] [bp-594h]@155
|
|
1218 POINT v211; // [sp+88h] [bp-574h]@704
|
|
1219 int v213; // [sp+98h] [bp-564h]@385
|
|
1220 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380
|
|
1221 char pOut[32]; // [sp+BCh] [bp-540h]@370
|
|
1222 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524
|
|
1223 int v217[9]; // [sp+158h] [bp-4A4h]@652
|
|
1224 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524
|
|
1225 char a1[64]; // [sp+1F8h] [bp-404h]@467
|
|
1226 char Str2[128]; // [sp+238h] [bp-3C4h]@527
|
|
1227 Actor actor; // [sp+2B8h] [bp-344h]@4
|
|
1228 int currHour;
|
|
1229
|
|
1230 dword_50CDC8 = 0;
|
|
1231 if ( !pEventTimer->bPaused )
|
|
1232 {
|
|
1233 pParty->sEyelevel = pParty->uDefaultEyelevel;
|
|
1234 pParty->uPartyHeight = pParty->uDefaultPartyHeight;
|
|
1235 }
|
|
1236 if ( bDialogueUI_InitializeActor_NPC_ID )
|
|
1237 {
|
|
1238 //Actor::Actor(&actor);
|
|
1239 memset(&actor, 0, 0x344u);
|
|
1240 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID;
|
|
1241 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID;
|
|
1242 GameUI_InitializeDialogue(&actor, false);
|
|
1243 bDialogueUI_InitializeActor_NPC_ID = 0;
|
|
1244 }
|
|
1245 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1246 {
|
|
1247 //v1 = "";
|
|
1248 while ( 2 )
|
|
1249 {
|
|
1250 if ( !pMessageQueue_50CBD0->uNumMessages )
|
|
1251 break;
|
|
1252
|
|
1253 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199);
|
|
1254 switch ( uMessage )
|
|
1255 {
|
|
1256 case UIMSG_ChangeGameState:
|
|
1257 uGameState = GAME_FINISHED;
|
|
1258 continue;
|
|
1259 case UIMSG_PlayArcomage:
|
|
1260 BackToHouseMenu();
|
|
1261 pArcomageGame->bGameInProgress = 1;
|
|
1262 ArcomageGame::PrepareArcomage();
|
|
1263 continue;
|
|
1264 case UIMSG_StartNPCDialogue:
|
|
1265 if ( !uActiveCharacter )
|
|
1266 continue;
|
|
1267 viewparams->field_48 = 1;
|
|
1268 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1269 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1270 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID;
|
|
1271 pActor = &pActors[uMessageParam];
|
|
1272 //goto _actor_init_dlg;
|
|
1273 GameUI_InitializeDialogue(pActor, true);
|
|
1274 continue;
|
|
1275 case UIMSG_StartHireling1Dialogue:
|
|
1276 case UIMSG_StartHireling2Dialogue:
|
|
1277 {
|
|
1278 if (bNoNPCHiring || pCurrentScreen)
|
|
1279 continue;
|
|
1280
|
|
1281 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1282 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1283 uAction = 0;
|
|
1284 int hireling_idx = uMessage - UIMSG_StartHireling1Dialogue;
|
|
1285 v4 = 0;
|
|
1286
|
|
1287 for (uint i = 0; i < 2; ++i)
|
|
1288 //pNPCData0 = pParty->pHirelings;
|
|
1289 //do
|
|
1290 {
|
|
1291 if (pParty->pHirelings[i].pName)
|
|
1292 //{
|
|
1293 //v6 = uAction++;
|
|
1294 pTmpBuf[uAction++] = i;
|
|
1295 //}
|
|
1296 //++pNPCData0;
|
|
1297 //++v4;
|
|
1298 }
|
|
1299 //while ( (signed int)pNPCData0 < (signed int)&pParty->pPickedItem );
|
|
1300
|
|
1301 //_this = 0;
|
|
1302 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
|
|
1303 {
|
|
1304 NPCData* npc = &pNPCStats->pNewNPCData[i];
|
|
1305 //do
|
|
1306 //{
|
|
1307 if (npc->Hired() &&
|
|
1308 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) &&
|
|
1309 (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) )
|
|
1310 {
|
|
1311 //v7 =;
|
|
1312 pTmpBuf[uAction++] = i + 2;
|
|
1313 }
|
|
1314 //++_this;
|
|
1315 //++pNPCData4;
|
|
1316 //}
|
|
1317 //while ( _this < (signed int)pNPCStats->uNumNewNPCs );
|
|
1318 }
|
|
1319
|
|
1320 if ( (signed int)(hireling_idx + pParty->hirelingScrollPosition) < uAction )
|
|
1321 {
|
|
1322 //Actor::Actor(&actor);
|
|
1323 memset(&actor, 0, 0x344u);
|
|
1324 actor.sNPC_ID += -1 - pParty->hirelingScrollPosition - hireling_idx;
|
|
1325 pActor = &actor;
|
|
1326 GameUI_InitializeDialogue(&actor, true);
|
|
1327 }
|
|
1328 }
|
|
1329 continue;
|
|
1330
|
|
1331 case UIMSG_BuyInShop_Identify_Repair:
|
|
1332 UIShop_Buy_Identify_Repair();
|
|
1333 continue;
|
|
1334 case UIMSG_ClickNPCTopic:
|
|
1335 ClickNPCTopic(uMessageParam);
|
|
1336 continue;
|
|
1337 case UIMSG_SelectShopDialogueOption:
|
|
1338 OnSelectShopDialogueOption(uMessageParam);
|
|
1339 continue;
|
|
1340 case UIMSG_SelectNPCDialogueOption:
|
|
1341 OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam);
|
|
1342 continue;
|
|
1343 case UIMSG_ClickHouseNPCPortrait:
|
|
1344 _4B4224_UpdateNPCTopics(uMessageParam);
|
|
1345 continue;
|
|
1346 case UIMSG_StartNewGame:
|
|
1347 if ( dword_6BE138 == 124 || uMessageParam )
|
|
1348 {
|
|
1349 pIcons_LOD->SyncLoadedFilesCount();
|
|
1350 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
1351 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1352 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1353 pGUIWindow_CurrentMenu->Release();
|
|
1354 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU;
|
|
1355 pCurrentScreen = SCREEN_GAME;
|
|
1356 viewparams->bRedrawGameUI = 1;
|
|
1357 }
|
|
1358 else
|
|
1359 {
|
|
1360 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2);// "Are you sure? Click again to start a New Game"
|
2534
|
1361 pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1362 dword_6BE138 = 124;
|
|
1363 }
|
|
1364 stru_506E40.Release();
|
|
1365 continue;
|
|
1366 case UIMSG_Game_OpenLoadGameDialog:
|
|
1367 pIcons_LOD->SyncLoadedFilesCount();
|
|
1368 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
1369 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1370 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1371 pGUIWindow_CurrentMenu->Release();
|
|
1372 pCurrentScreen = SCREEN_LOADGAME;
|
|
1373 LoadUI_Load(1);
|
|
1374 continue;
|
|
1375 case UIMSG_Quit:
|
|
1376 if ( dword_6BE138 == 132 || uMessageParam )
|
|
1377 {
|
|
1378 pIcons_LOD->SyncLoadedFilesCount();
|
|
1379 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
1380 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1381 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1382 pGUIWindow_CurrentMenu->Release();
|
|
1383 pCurrentScreen = SCREEN_GAME;
|
|
1384 viewparams->bRedrawGameUI = 1;
|
|
1385 if ( !uMessageParam )
|
2534
|
1386 pAudioPlayer->PlaySound((SoundID)SOUND_wooddrclose, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1387 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU;
|
|
1388 }
|
|
1389 else
|
|
1390 {
|
|
1391 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit"
|
2534
|
1392 pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1393 dword_6BE138 = 132;
|
|
1394 }
|
|
1395 stru_506E40.Release();
|
|
1396 continue;
|
|
1397 case UIMSG_80:
|
|
1398 __debugbreak();
|
|
1399 pIcons_LOD->SyncLoadedFilesCount();
|
|
1400 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
1401 pGUIWindow_CurrentMenu->Release();
|
|
1402 pCurrentScreen = SCREEN_OPTIONS;
|
|
1403 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_8, 0, 0);
|
|
1404 continue;
|
|
1405 case UIMSG_ArrowUp:
|
|
1406 --pSaveListPosition;
|
|
1407 if ( pSaveListPosition < 0 )
|
|
1408 pSaveListPosition = 0;
|
|
1409 GUIWindow::Create(215, 199, 17, 17, WINDOW_PressedButton2, (int)pBtnArrowUp, 0);
|
|
1410 continue;
|
|
1411 case UIMSG_DownArrow:
|
|
1412 ++pSaveListPosition;
|
|
1413 if ( pSaveListPosition >= uMessageParam )
|
|
1414 pSaveListPosition = uMessageParam - 1;
|
|
1415 GUIWindow::Create(215, 323, 17, 17, WINDOW_PressedButton2, (int)pBtnDownArrow, 0);
|
|
1416 continue;
|
|
1417 case UIMSG_Cancel:
|
|
1418 GUIWindow::Create(350, 302, 106, 42, WINDOW_CloseRestWindowBtn, (int)pBtnCancel, 0);
|
|
1419 continue;
|
|
1420 case UIMSG_SaveLoadBtn:
|
|
1421 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
|
|
1422 continue;
|
|
1423 case UIMSG_SelectLoadSlot:
|
|
1424 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
|
|
1425 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
|
|
1426 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam )
|
|
1427 {
|
|
1428 v10 = pSaveListPosition + uMessageParam;
|
|
1429 if ( dword_6BE138 == pSaveListPosition + uMessageParam )
|
|
1430 {
|
|
1431 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0);
|
|
1432 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
|
|
1433 }
|
|
1434 uLoadGameUI_SelectedSlot = v10;
|
|
1435 dword_6BE138 = v10;
|
|
1436 }
|
|
1437 else
|
|
1438 {
|
|
1439 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
|
|
1440 if ( strcmp(pSavegameHeader[uLoadGameUI_SelectedSlot].pName, pGlobalTXT_LocalizationStrings[72]) )// "Empty"
|
|
1441 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
|
|
1442 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
|
|
1443 }
|
|
1444 continue;
|
|
1445 case UIMSG_LoadGame:
|
|
1446 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
|
|
1447 {
|
|
1448 LoadGame(uLoadGameUI_SelectedSlot);
|
|
1449 uGameState = GAME_STATE_LOADING_GAME;
|
|
1450 }
|
|
1451 stru_506E40.Release();
|
|
1452 continue;
|
|
1453 case UIMSG_SaveGame:
|
|
1454 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
|
|
1455 {
|
|
1456 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
|
|
1457 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pKeyActionMap->pPressedKeysBuffer);
|
|
1458 }
|
|
1459 DoSavegame(uLoadGameUI_SelectedSlot);
|
|
1460 stru_506E40.Release();
|
|
1461 continue;
|
|
1462 case UIMSG_Game_OpenSaveGameDialog:
|
|
1463 pGUIWindow_CurrentMenu->Release();
|
|
1464 pCurrentScreen = SCREEN_SAVEGAME;
|
|
1465 SaveUI_Load();
|
|
1466 continue;
|
|
1467 case UIMSG_Game_OpenOptionsDialog://Open
|
|
1468 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1469 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1470 pGUIWindow_CurrentMenu->Release();
|
|
1471 viewparams->field_48 = 1;
|
|
1472 pCurrentScreen = SCREEN_OPTIONS;
|
|
1473
|
|
1474 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
|
|
1475 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
|
|
1476 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
|
|
1477 options_menu_skin.uTextureID_TurnSpeed[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
|
|
1478 options_menu_skin.uTextureID_ArrowLeft = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
|
|
1479 options_menu_skin.uTextureID_ArrowRight = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
|
|
1480 options_menu_skin.uTextureID_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
|
|
1481 options_menu_skin.uTextureID_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
|
|
1482 options_menu_skin.uTextureID_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE);
|
|
1483 options_menu_skin.uTextureID_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE);
|
|
1484 options_menu_skin.uTextureID_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE);
|
|
1485 options_menu_skin.uTextureID_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE);
|
|
1486 options_menu_skin.uTextureID_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
|
|
1487 options_menu_skin.uTextureID_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
|
|
1488 options_menu_skin.uTextureID_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
|
|
1489 options_menu_skin.uTextureID_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
|
|
1490 options_menu_skin.uTextureID_FlipOnExit = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
|
|
1491 options_menu_skin.uTextureID_AlwaysRun = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
|
|
1492 options_menu_skin.uTextureID_ShowDamage = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
|
|
1493 options_menu_skin.uTextureID_WalkSound = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
|
|
1494
|
|
1495 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Options, 0, 0);
|
|
1496 pGUIWindow_CurrentMenu->CreateButton(22, 270,
|
|
1497 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth,
|
|
1498 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight,
|
|
1499 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0);
|
|
1500 pGUIWindow_CurrentMenu->CreateButton(93, 270,
|
|
1501 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth,
|
|
1502 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight,
|
|
1503 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0);
|
|
1504 pGUIWindow_CurrentMenu->CreateButton(164, 270,
|
|
1505 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth,
|
|
1506 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight,
|
|
1507 1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0);
|
|
1508
|
|
1509 pGUIWindow_CurrentMenu->CreateButton(20, 303,
|
|
1510 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth,
|
|
1511 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight,
|
|
1512 1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0);
|
|
1513 pGUIWindow_CurrentMenu->CreateButton(128, 303,
|
|
1514 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth,
|
|
1515 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight,
|
|
1516 1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0);
|
|
1517 pGUIWindow_CurrentMenu->CreateButton(20, 325,
|
|
1518 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth,
|
|
1519 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight,
|
|
1520 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0);
|
|
1521 pGUIWindow_CurrentMenu->CreateButton(128, 325,
|
|
1522 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth,
|
|
1523 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight,
|
|
1524 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0);
|
|
1525
|
|
1526 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
|
|
1527 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
|
|
1528 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0);
|
|
1529
|
|
1530 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
|
|
1531 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
|
|
1532 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0);
|
|
1533
|
|
1534 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
|
|
1535 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
|
|
1536 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0);
|
|
1537
|
|
1538 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game"
|
|
1539 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0);
|
|
1540 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0);
|
|
1541 continue;
|
|
1542
|
|
1543 case UIMSG_OpenKeyMappingOptions://Open
|
|
1544 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1545 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1546 pGUIWindow_CurrentMenu->Release();
|
|
1547 viewparams->field_48 = 1;
|
|
1548 pCurrentScreen = SCREEN_KEYBOARD_OPTIONS;
|
|
1549 uTextureID_Optkb[0] = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE);
|
|
1550 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
|
|
1551 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
|
|
1552 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
|
|
1553 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
|
|
1554 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_KeyMappingOptions, 0, 0);
|
|
1555
|
|
1556 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, "", 0);
|
|
1557
|
|
1558 pGUIWindow_CurrentMenu->CreateButton(19, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0);
|
|
1559 pGUIWindow_CurrentMenu->CreateButton(127, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0);
|
|
1560 pGUIWindow_CurrentMenu->CreateButton(127, 324, 108, 20, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0);
|
|
1561 pGUIWindow_CurrentMenu->CreateButton(19, 324, 108, 20, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0);
|
|
1562
|
|
1563 pGUIWindow_CurrentMenu->CreateButton(129, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0);
|
|
1564 pGUIWindow_CurrentMenu->CreateButton(129, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 1, 0, "", 0);
|
|
1565 pGUIWindow_CurrentMenu->CreateButton(129, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 2, 0, "", 0);
|
|
1566 pGUIWindow_CurrentMenu->CreateButton(129, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 3, 0, "", 0);
|
|
1567 pGUIWindow_CurrentMenu->CreateButton(129, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 4, 0, "", 0);
|
|
1568 pGUIWindow_CurrentMenu->CreateButton(129, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 5, 0, "", 0);
|
|
1569 pGUIWindow_CurrentMenu->CreateButton(129, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 6, 0, "", 0);
|
|
1570 pGUIWindow_CurrentMenu->CreateButton(350, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 7, 0, "", 0);
|
|
1571 pGUIWindow_CurrentMenu->CreateButton(350, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 8, 0, "", 0);
|
|
1572 pGUIWindow_CurrentMenu->CreateButton(350, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 9, 0, "", 0);
|
|
1573 pGUIWindow_CurrentMenu->CreateButton(350, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 10, 0, "", 0);
|
|
1574 pGUIWindow_CurrentMenu->CreateButton(350, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 11, 0, "", 0);
|
|
1575 pGUIWindow_CurrentMenu->CreateButton(350, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 12, 0, "", 0);
|
|
1576 pGUIWindow_CurrentMenu->CreateButton(350, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 13, 0, "", 0);
|
|
1577
|
|
1578 uGameMenuUI_CurentlySelectedKeyIdx = -1;
|
|
1579 KeyboardPageNum = 1;
|
|
1580 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
|
|
1581 //*(_WORD *)KeyButtonArray[28] = 0;
|
|
1582 memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
|
|
1583 continue;
|
|
1584 case UIMSG_ChangeKeyButton:
|
|
1585 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 )
|
|
1586 {
|
2506
|
1587 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1588 continue;
|
|
1589 }
|
|
1590 v14 = uMessageParam;
|
|
1591 if ( KeyboardPageNum != 1 )
|
|
1592 v14 = uMessageParam + 14;
|
|
1593 uGameMenuUI_CurentlySelectedKeyIdx = v14;
|
|
1594 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu);
|
|
1595 continue;
|
|
1596 case UIMSG_ResetKeyMapping:
|
|
1597 v197 = 1;
|
|
1598 pKeyActionMap->SetDefaultMapping();
|
|
1599 for ( uint i = 0; i < 28; i++ )
|
|
1600 {
|
|
1601 if ( pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i] )
|
|
1602 {
|
|
1603 if ( v197 )
|
|
1604 {
|
|
1605 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 1);
|
|
1606 v197 = 0;
|
|
1607 }
|
|
1608 else
|
|
1609 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 0);
|
|
1610 }
|
|
1611 pPrevVirtualCidesMapping[i] = pKeyActionMap->GetActionVKey((enum InputAction)i);
|
|
1612 GameMenuUI_InvaligKeyBindingsFlags[i] = false;
|
|
1613 }
|
2534
|
1614 pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1615 continue;
|
|
1616 case UIMSG_SelectKeyPage1:
|
|
1617 KeyboardPageNum = 1;
|
|
1618 continue;
|
|
1619 case UIMSG_SelectKeyPage2:
|
|
1620 KeyboardPageNum = 2;
|
|
1621 continue;
|
|
1622 case UIMSG_OpenVideoOptions:
|
|
1623 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1624 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1625 pGUIWindow_CurrentMenu->Release();
|
|
1626 viewparams->field_48 = 1;
|
|
1627 pCurrentScreen = SCREEN_VIDEO_OPTIONS;
|
|
1628 optvid_base_texture_id = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE);
|
|
1629 bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE);
|
|
1630 us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE);
|
|
1631 tinting_texture_id = pIcons_LOD->LoadTexture("opvdH-tn", TEXTURE_16BIT_PALETTE);
|
|
1632 uTextureID_507C20 = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
|
|
1633 uTextureID_507C24 = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
|
|
1634 pTextureIDs_GammaPositions[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
|
|
1635 pTextureIDs_GammaPositions[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
|
|
1636 pTextureIDs_GammaPositions[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE);
|
|
1637 pTextureIDs_GammaPositions[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE);
|
|
1638 pTextureIDs_GammaPositions[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE);
|
|
1639 pTextureIDs_GammaPositions[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE);
|
|
1640 pTextureIDs_GammaPositions[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
|
|
1641 pTextureIDs_GammaPositions[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
|
|
1642 pTextureIDs_GammaPositions[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
|
|
1643 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
|
|
1644 not_available_bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE);
|
|
1645 not_available_us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE);
|
|
1646 not_available_tinting_texture_id = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE);
|
|
1647 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_VideoOptions, 0, 0);
|
|
1648 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0);
|
|
1649 //if ( pRenderer->pRenderD3D )
|
|
1650 {
|
|
1651 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0);
|
|
1652 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0);
|
|
1653 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0);
|
|
1654 }
|
|
1655 /*if ( !pRenderer->bWindowMode )
|
|
1656 {
|
|
1657 //v0 = 1;
|
|
1658 if ( pRenderer->IsGammaSupported() )
|
|
1659 {
|
|
1660 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0);
|
|
1661 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0);
|
|
1662 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, "", 0);
|
|
1663 }
|
|
1664 }*/
|
|
1665 continue;
|
|
1666 case UIMSG_1A9:
|
|
1667 __debugbreak();
|
|
1668 if ( uMessageParam == 4 )
|
|
1669 {
|
|
1670 //--uGammaPos;
|
|
1671 if ( (uGammaPos -- -1) < 0 )
|
|
1672 {
|
|
1673 uGammaPos = 0;
|
2534
|
1674 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1675 continue;
|
|
1676 }
|
|
1677 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6;
|
|
1678 pGame->pGammaController->Initialize(v19);
|
|
1679 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
|
2534
|
1680 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1681 continue;
|
|
1682 }
|
|
1683 if ( uMessageParam == 5 )
|
|
1684 {
|
|
1685 ++uGammaPos;
|
|
1686 if ( (signed int)uGammaPos <= 9 )
|
|
1687 {
|
|
1688 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6;
|
|
1689 pGame->pGammaController->Initialize(v21);
|
|
1690 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
|
2534
|
1691 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1692 continue;
|
|
1693 }
|
|
1694 uGammaPos = 9;
|
|
1695 }
|
|
1696 else
|
|
1697 {
|
|
1698 uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17;
|
|
1699 v22 = (double)(signed int)uGammaPos * 0.1 + 0.6;
|
|
1700 pGame->pGammaController->Initialize(v22);
|
|
1701 }
|
2534
|
1702 pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
1703 continue;
|
|
1704 case UIMSG_ToggleBloodsplats:
|
|
1705 pGame->ToggleFlags2(0x20u);
|
|
1706 continue;
|
|
1707 case UIMSG_ToggleColoredLights:
|
|
1708 pRenderer->ToggleColoredLights();
|
|
1709 continue;
|
|
1710 case UIMSG_ToggleTint:
|
|
1711 pRenderer->ToggleTint();
|
|
1712 continue;
|
|
1713 case UIMSG_ChangeMusicVolume:
|
|
1714 if ( uMessageParam == 4 )//-
|
|
1715 {
|
|
1716 --uMusicVolimeMultiplier;
|
|
1717 if ( (char)uMusicVolimeMultiplier < 1 )
|
|
1718 uMusicVolimeMultiplier = 0;
|
|
1719 GUIWindow::Create(243, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
|
|
1720 if ( uMusicVolimeMultiplier )
|
2534
|
1721 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
|
|
1722
|
|
1723 if ( use_music_folder )
|
2508
|
1724 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
|
|
1725 else
|
|
1726 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
|
2534
|
1727
|
2499
|
1728 continue;
|
|
1729 }
|
|
1730 if ( uMessageParam == 5 )//+
|
|
1731 {
|
|
1732 ++uMusicVolimeMultiplier;
|
|
1733 if ( (char)uMusicVolimeMultiplier > 9 )
|
|
1734 uMusicVolimeMultiplier = 9;
|
|
1735 GUIWindow::Create(435, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
|
|
1736 if ( uMusicVolimeMultiplier )
|
2534
|
1737 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
|
2508
|
1738 if ( use_music_folder )
|
|
1739 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
|
|
1740 else
|
|
1741 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
|
2499
|
1742 continue;
|
|
1743 }
|
|
1744 uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//for mouse
|
|
1745 if ( (char)uMusicVolimeMultiplier > 9 )
|
|
1746 uMusicVolimeMultiplier = 9;
|
|
1747 if ( uMusicVolimeMultiplier )
|
2534
|
1748 pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
|
2508
|
1749 if ( use_music_folder )
|
|
1750 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
|
|
1751 else
|
|
1752 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
|
2499
|
1753 continue;
|
|
1754 case UIMSG_ChangeSoundVolume:
|
|
1755 if ( uMessageParam == 4 )//reduce sound level button left
|
|
1756 {
|
|
1757 --uSoundVolumeMultiplier;
|
|
1758 if ( (char)uSoundVolumeMultiplier < 1 )
|
|
1759 uSoundVolumeMultiplier = 0;
|
|
1760 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
|
|
1761 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
|
2534
|
1762 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0);
|
2506
|
1763 int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook);
|
|
1764 //v = v+1;
|
|
1765 if (v)
|
|
1766 __debugbreak();
|
2499
|
1767 continue;
|
|
1768 }
|
|
1769 if ( uMessageParam == 5 )//Increase sound level button right
|
|
1770 {
|
|
1771 ++uSoundVolumeMultiplier;
|
|
1772 if ( (char)uSoundVolumeMultiplier > 8 )
|
|
1773 uSoundVolumeMultiplier = 9;
|
|
1774 //v168 = 1;
|
|
1775 v24 = 435;
|
|
1776 //v154 = (int)pBtn_SliderRight;
|
2506
|
1777 GUIWindow::Create(v24, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
|
2499
|
1778 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
|
2534
|
1779 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0);
|
2499
|
1780 continue;
|
|
1781 }
|
|
1782 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17;
|
|
1783 if ( (char)uSoundVolumeMultiplier > 8 )
|
|
1784 uSoundVolumeMultiplier = 9;
|
|
1785 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
|
2534
|
1786 pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0);
|
2499
|
1787 continue;
|
|
1788 case UIMSG_ToggleFlipOnExit:
|
|
1789 bFlipOnExit = bFlipOnExit == 0;
|
|
1790 continue;
|
|
1791 case UIMSG_ToggleAlwaysRun:
|
|
1792 bAlwaysRun = bAlwaysRun == 0;
|
|
1793 continue;
|
|
1794 case UIMSG_ToggleWalkSound:
|
|
1795 bWalkSound = bWalkSound == 0;
|
|
1796 continue;
|
|
1797 case UIMSG_ToggleShowDamage:
|
|
1798 bShowDamage = bShowDamage == 0;
|
|
1799 continue;
|
|
1800 case UIMSG_ChangeVoiceVolume:
|
|
1801 if ( uMessageParam == 4 )
|
|
1802 {
|
|
1803 --uVoicesVolumeMultiplier;
|
|
1804 if ( (char)uVoicesVolumeMultiplier < 1 )
|
|
1805 uVoicesVolumeMultiplier = 0;
|
|
1806 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
|
|
1807 if ( !uVoicesVolumeMultiplier )
|
|
1808 continue;
|
2506
|
1809 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
|
2499
|
1810 continue;
|
|
1811 }
|
|
1812 if ( uMessageParam == 5 )
|
|
1813 {
|
|
1814 ++uVoicesVolumeMultiplier;
|
|
1815 if ( (char)uVoicesVolumeMultiplier > 8 )
|
|
1816 uVoicesVolumeMultiplier = 9;
|
|
1817 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
|
|
1818 if ( !uVoicesVolumeMultiplier )
|
|
1819 continue;
|
2506
|
1820 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
|
2499
|
1821 continue;
|
|
1822 }
|
|
1823 uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17;
|
|
1824 if ( (char)uVoicesVolumeMultiplier > 8 )
|
|
1825 uVoicesVolumeMultiplier = 9;
|
|
1826 if ( !uVoicesVolumeMultiplier )
|
|
1827 continue;
|
2506
|
1828 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
|
2499
|
1829 continue;
|
|
1830 case UIMSG_SetTurnSpeed:
|
|
1831 if ( uMessageParam )
|
|
1832 pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam;
|
|
1833 uTurnSpeed = uMessageParam;
|
|
1834 continue;
|
|
1835
|
|
1836 case UIMSG_SetGraphicsMode:
|
|
1837 /*if ( !bUseLoResSprites )
|
|
1838 {
|
|
1839 byte_6BE388_graphicsmode = uMessageParam;
|
|
1840 MM7Initialization();
|
|
1841 continue;
|
|
1842 }
|
|
1843 if ( uMessageParam )
|
|
1844 {
|
|
1845 if ( uMessageParam == 1 )
|
|
1846 {
|
|
1847 byte_6BE388_graphicsmode = 0;
|
|
1848 }
|
|
1849 else
|
|
1850 {
|
|
1851 if ( uMessageParam != 2 )
|
|
1852 continue;
|
|
1853 byte_6BE388_graphicsmode = 1;
|
|
1854 }
|
|
1855 MM7Initialization();
|
|
1856 continue;
|
|
1857 }*/
|
|
1858 ModalWindow(pNPCTopics[453].pText, UIMSG_0);
|
|
1859 __debugbreak(); // Nomad: graphicsmode as it was now removed
|
|
1860 continue;
|
|
1861
|
|
1862 case UIMSG_GameMenu_ReturnToGame:
|
|
1863 pGUIWindow_CurrentMenu->Release();
|
|
1864 pEventTimer->Resume();
|
|
1865 pCurrentScreen = SCREEN_GAME;
|
|
1866 viewparams->bRedrawGameUI = 1;
|
|
1867 stru_506E40.Release();
|
|
1868 continue;
|
|
1869 case UIMSG_OpenQuestBook:
|
|
1870 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1871 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1872 if ( pCurrentScreen )
|
|
1873 pGUIWindow_CurrentMenu->Release();
|
|
1874 pEventTimer->Pause();
|
|
1875 pAudioPlayer->StopChannels(-1, -1);
|
|
1876 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
|
|
1877 pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Quests, 0);
|
|
1878 bFlashQuestBook = 0;
|
|
1879 continue;
|
|
1880 case UIMSG_OpenAutonotes:
|
|
1881 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1882 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1883 if ( pCurrentScreen )
|
|
1884 pGUIWindow_CurrentMenu->Release();
|
|
1885 pEventTimer->Pause();
|
|
1886 pAudioPlayer->StopChannels(-1, -1);
|
|
1887 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
|
|
1888 pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Autonotes, 0);
|
|
1889 bFlashAutonotesBook = 0;
|
|
1890 continue;
|
|
1891 case UIMSG_OpenMapBook:
|
|
1892 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1893 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1894 if ( pCurrentScreen )
|
|
1895 pGUIWindow_CurrentMenu->Release();
|
|
1896 pEventTimer->Pause();
|
|
1897 viewparams->sViewCenterX = pParty->vPosition.x;
|
|
1898 viewparams->sViewCenterY = pParty->vPosition.y;
|
|
1899 pAudioPlayer->StopChannels(-1, -1);
|
|
1900 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
|
|
1901 pBooksWindow = GUIWindow::Create(546, 353, 0, 0, WINDOW_BooksWindow, (int)pBtn_Maps, 0);
|
|
1902 continue;
|
|
1903 case UIMSG_OpenCalendar:
|
|
1904 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1905 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1906 if ( pCurrentScreen )
|
|
1907 pGUIWindow_CurrentMenu->Release();
|
|
1908 pEventTimer->Pause();
|
|
1909 pAudioPlayer->StopChannels(-1, -1);
|
|
1910 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
|
|
1911 pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_BooksWindow, (int)pBtn_Calendar, 0);
|
|
1912 continue;
|
|
1913 case UIMSG_OpenHistoryBook:
|
|
1914 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1915 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1916 if ( pCurrentScreen )
|
|
1917 pGUIWindow_CurrentMenu->Release();
|
|
1918 pEventTimer->Pause();
|
|
1919 pAudioPlayer->StopChannels(-1, -1);
|
|
1920 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
|
|
1921 pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_BooksWindow, (int)pBtn_History, 0);
|
|
1922 bFlashHistoryBook = 0;
|
|
1923 continue;
|
|
1924 case UIMSG_Escape:// íàæàòèå Escape and return to game
|
|
1925 back_to_game();
|
|
1926 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1927 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1928 switch ( pCurrentScreen )
|
|
1929 {
|
|
1930 case SCREEN_E:
|
|
1931 __debugbreak();
|
|
1932 case SCREEN_NPC_DIALOGUE:
|
|
1933 case SCREEN_CHEST:
|
|
1934 case SCREEN_CHEST_INVENTORY:
|
|
1935 case SCREEN_CHANGE_LOCATION:
|
|
1936 case SCREEN_INPUT_BLV:
|
|
1937 case SCREEN_QUICK_REFERENCE:
|
|
1938 if ( dword_50CDC8 )
|
|
1939 break;
|
|
1940 CloseWindowBackground();
|
|
1941 uMessageParam = 1;
|
|
1942 break;
|
|
1943 case SCREEN_HOUSE:
|
|
1944 if ( !dword_50CDC8 )
|
|
1945 {
|
|
1946 CloseWindowBackground();
|
|
1947 uMessageParam = 1;
|
|
1948 break;
|
|
1949 }
|
|
1950 break;
|
|
1951 }
|
|
1952 if ( !pModalWindow )
|
|
1953 {
|
|
1954 pRenderer->ClearZBuffer(0, 479);
|
|
1955 viewparams->bRedrawGameUI = 1;
|
|
1956 viewparams->field_48 = 1;
|
|
1957 if ( pCurrentScreen )
|
|
1958 {
|
|
1959 if ( pCurrentScreen > SCREEN_67 )
|
|
1960 {
|
|
1961 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE )
|
|
1962 {
|
|
1963 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
1964 if ( pGUIWindow_Settings )
|
|
1965 {
|
|
1966 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
1967 pMouse->SetCursorBitmap("MICON2");
|
|
1968 else
|
|
1969 {
|
|
1970 pGUIWindow_Settings->Release();
|
|
1971 pGUIWindow_Settings = 0;
|
|
1972 pMouse->SetCursorBitmap("MICON1");
|
|
1973 GameUI_Footer_TimeLeft = 0;
|
|
1974 _50C9A0_IsEnchantingInProgress = 0;
|
|
1975 back_to_game();
|
|
1976 }
|
|
1977 }
|
|
1978 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
1979 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
1980 pGUIWindow_CurrentMenu->Release();
|
|
1981 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
1982 window_SpeakInHouse = 0;
|
|
1983 pGUIWindow_CurrentMenu = 0;
|
|
1984 pEventTimer->Resume();
|
|
1985 pCurrentScreen = SCREEN_GAME;
|
|
1986 viewparams->bRedrawGameUI = 1;
|
|
1987 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
1988 continue;
|
|
1989 }
|
|
1990 }
|
|
1991 else
|
|
1992 {
|
|
1993 if ( pCurrentScreen < SCREEN_64 )
|
|
1994 {
|
|
1995 switch ( pCurrentScreen )
|
|
1996 {
|
|
1997 case SCREEN_CASTING:
|
|
1998 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
1999 if ( some_active_character )
|
|
2000 {
|
|
2001 uActiveCharacter = some_active_character;
|
|
2002 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2003 some_active_character = 0;
|
|
2004 if ( pParty->bTurnBasedModeOn )
|
|
2005 pTurnEngine->ApplyPlayerAction();
|
|
2006 _50C9D0_AfterEnchClickEventId = 0;
|
|
2007 _50C9D4_AfterEnchClickEventSecondParam = 0;
|
|
2008 _50C9D8_AfterEnchClickEventTimeout = 0;
|
|
2009 }
|
|
2010 if ( ptr_50C9A4_ItemToEnchant && ptr_50C9A4_ItemToEnchant->uItemID )
|
|
2011 {
|
|
2012 LOBYTE(ptr_50C9A4_ItemToEnchant->uAttributes) &= 0xFu;
|
|
2013 _50C9A8_item_enchantment_timer = 0;
|
|
2014 ptr_50C9A4_ItemToEnchant = nullptr;
|
|
2015 }
|
|
2016 if ( pGUIWindow_Settings )
|
|
2017 {
|
|
2018 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
2019 pMouse->SetCursorBitmap("MICON2");
|
|
2020 else
|
|
2021 {
|
|
2022 pGUIWindow_Settings->Release();
|
|
2023 pGUIWindow_Settings = 0;
|
|
2024 pMouse->SetCursorBitmap("MICON1");
|
|
2025 GameUI_Footer_TimeLeft = 0;
|
|
2026 _50C9A0_IsEnchantingInProgress = 0;
|
|
2027 back_to_game();
|
|
2028 }
|
|
2029 }
|
|
2030 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
2031 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2032 pGUIWindow_CurrentMenu->Release();
|
|
2033 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
2034 window_SpeakInHouse = 0;
|
|
2035 pGUIWindow_CurrentMenu = 0;
|
|
2036 pEventTimer->Resume();
|
|
2037 pCurrentScreen = SCREEN_GAME;
|
|
2038 viewparams->bRedrawGameUI = 1;
|
|
2039 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
2040 continue;
|
|
2041 case SCREEN_BOOKS:
|
|
2042 pBooksWindow->Release();
|
|
2043 //crt_deconstruct_ptr_6A0118();
|
|
2044 pBooksWindow = 0;
|
|
2045 pEventTimer->Resume();
|
|
2046 if ( pGUIWindow_Settings )
|
|
2047 {
|
|
2048 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
2049 pMouse->SetCursorBitmap("MICON2");
|
|
2050 else
|
|
2051 {
|
|
2052 pGUIWindow_Settings->Release();
|
|
2053 pGUIWindow_Settings = 0;
|
|
2054 pMouse->SetCursorBitmap("MICON1");
|
|
2055 GameUI_Footer_TimeLeft = 0;
|
|
2056 _50C9A0_IsEnchantingInProgress = 0;
|
|
2057 back_to_game();
|
|
2058 }
|
|
2059 }
|
|
2060 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
2061 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2062 pGUIWindow_CurrentMenu->Release();
|
|
2063 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
2064 window_SpeakInHouse = 0;
|
|
2065 pGUIWindow_CurrentMenu = 0;
|
|
2066 pEventTimer->Resume();
|
|
2067 pCurrentScreen = SCREEN_GAME;
|
|
2068 viewparams->bRedrawGameUI = 1;
|
|
2069 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
2070 continue;
|
|
2071 case SCREEN_SAVEGAME:
|
|
2072 case SCREEN_LOADGAME:
|
|
2073 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2074 //crt_deconstruct_ptr_6A0118();
|
|
2075 stru_506E40.Release();
|
|
2076 break;
|
|
2077 case SCREEN_CHEST_INVENTORY:
|
|
2078 pCurrentScreen = SCREEN_CHEST;
|
|
2079 continue;
|
|
2080 case SCREEN_CHEST:
|
|
2081 pWindow2 = pChestWindow;
|
|
2082 pWindow2->Release();
|
|
2083 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2084 pCurrentScreen = SCREEN_GAME;
|
|
2085 viewparams->bRedrawGameUI = 1;
|
|
2086 pEventTimer->Resume();
|
|
2087 continue;
|
|
2088 case SCREEN_19:
|
|
2089 __debugbreak();
|
|
2090 pWindow2 = ptr_507BC8;
|
|
2091 pWindow2->Release();
|
|
2092 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2093 pCurrentScreen = SCREEN_GAME;
|
|
2094 viewparams->bRedrawGameUI = 1;
|
|
2095 pEventTimer->Resume();
|
|
2096 continue;
|
|
2097 case SCREEN_OPTIONS://Close
|
|
2098 options_menu_skin.Relaease();
|
|
2099 pIcons_LOD->SyncLoadedFilesCount();
|
|
2100 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
|
|
2101 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
|
|
2102 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
|
|
2103 WriteWindowsRegistryInt("WalkSound", bWalkSound);
|
|
2104 WriteWindowsRegistryInt("ShowDamage", bShowDamage);
|
|
2105 //WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode);
|
|
2106 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
|
|
2107 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit);
|
|
2108 if ( !uTurnSpeed )
|
|
2109 {
|
|
2110 WriteWindowsRegistryInt("TurnDelta", 3);
|
|
2111 stru_506E40.Release();
|
|
2112 break;
|
|
2113 }
|
|
2114 if ( uTurnSpeed == 64 )
|
|
2115 {
|
|
2116 WriteWindowsRegistryInt("TurnDelta", 2);
|
|
2117 stru_506E40.Release();
|
|
2118 break;
|
|
2119 }
|
|
2120 if ( uTurnSpeed != 128 )
|
|
2121 {
|
|
2122 stru_506E40.Release();
|
|
2123 break;
|
|
2124 }
|
|
2125 WriteWindowsRegistryInt("TurnDelta", 1);
|
|
2126 stru_506E40.Release();
|
|
2127 break;
|
|
2128 case SCREEN_MENU:
|
|
2129 pIcons_LOD->SyncLoadedFilesCount();
|
|
2130 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2131 pIcons_LOD->SyncLoadedFilesCount();
|
|
2132 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2133 stru_506E40.Release();
|
|
2134 break;
|
|
2135 case SCREEN_VIDEO_OPTIONS:
|
|
2136 //if ( pRenderer->pRenderD3D )
|
|
2137 {
|
|
2138 WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights);
|
|
2139 WriteWindowsRegistryInt("Tinting", pRenderer->bTinting);
|
|
2140 WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1);
|
|
2141 }
|
|
2142 /*if ( !pRenderer->bWindowMode )
|
|
2143 WriteWindowsRegistryInt("GammaPos", uGammaPos);*/
|
|
2144
|
|
2145 stru_506E40.Release();
|
|
2146 break;
|
|
2147
|
|
2148 case SCREEN_KEYBOARD_OPTIONS://Return to game
|
|
2149 v197 = 1;
|
|
2150 pKeyBindingFlag = false;
|
|
2151 for ( uint i = 0; i < 28; ++i )
|
|
2152 {
|
|
2153 if ( GameMenuUI_InvaligKeyBindingsFlags[i] )
|
|
2154 pKeyBindingFlag = true;
|
|
2155 }
|
|
2156 if ( !pKeyBindingFlag )
|
|
2157 {
|
|
2158 for ( uint i = 0; i < 5; i++ )
|
|
2159 {
|
|
2160 if ( uTextureID_Optkb[i] )
|
|
2161 pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release();
|
|
2162 }
|
|
2163 memset(&uTextureID_Optkb, 0, 20);
|
|
2164 pIcons_LOD->SyncLoadedFilesCount();
|
|
2165 for ( uint i = 0; i < 28; ++i )
|
|
2166 {
|
|
2167 if ( pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i] )
|
|
2168 {
|
|
2169 if ( v197 )
|
|
2170 {
|
|
2171 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1);
|
|
2172 v197 = 0;
|
|
2173 }
|
|
2174 else
|
|
2175 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0);
|
|
2176 }
|
|
2177 if ( i > 3 && i != 25 && i != 26 )
|
|
2178 pKeyToggleType = TOGGLE_OneTimePress;
|
|
2179 else
|
|
2180 pKeyToggleType = TOGGLE_Continuously;
|
|
2181 pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType);
|
|
2182 }
|
|
2183 pKeyActionMap->StoreMappings();
|
|
2184 stru_506E40.Release();
|
|
2185 break;
|
|
2186 }
|
2506
|
2187 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
2188 break;
|
|
2189 case SCREEN_REST://close rest screen
|
|
2190 if ( dword_506F14 )
|
|
2191 {
|
|
2192 Rest(_506F18_num_minutes_to_sleep);
|
|
2193 pParty->pPlayers[3].SetAsleep(false);
|
|
2194 pParty->pPlayers[2].SetAsleep(false);
|
|
2195 pParty->pPlayers[1].SetAsleep(false);
|
|
2196 pParty->pPlayers[0].SetAsleep(false);
|
|
2197 }
|
|
2198 pTexture_RestUI_CurrentSkyFrame->Release();
|
|
2199 pTexture_RestUI_CurrentHourglassFrame->Release();
|
|
2200 pTexture_RestUI_CurrentHourglassFrame = 0;
|
|
2201 pTexture_RestUI_CurrentSkyFrame = 0;
|
|
2202 pIcons_LOD->SyncLoadedFilesCount();
|
|
2203 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2204 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
2205 {
|
|
2206 pOutdoor->UpdateSunlightVectors();
|
|
2207 pOutdoor->UpdateFog();
|
|
2208 }
|
|
2209 _506F18_num_minutes_to_sleep = 0;
|
|
2210 dword_506F14 = 0;
|
|
2211 if ( pGUIWindow_Settings )
|
|
2212 {
|
|
2213 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
2214 pMouse->SetCursorBitmap("MICON2");
|
|
2215 else
|
|
2216 {
|
|
2217 pGUIWindow_Settings->Release();
|
|
2218 pGUIWindow_Settings = 0;
|
|
2219 pMouse->SetCursorBitmap("MICON1");
|
|
2220 GameUI_Footer_TimeLeft = 0;
|
|
2221 _50C9A0_IsEnchantingInProgress = 0;
|
|
2222 back_to_game();
|
|
2223 }
|
|
2224 }
|
|
2225 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
2226 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2227 pGUIWindow_CurrentMenu->Release();
|
|
2228 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
2229 window_SpeakInHouse = 0;
|
|
2230 pGUIWindow_CurrentMenu = 0;
|
|
2231 pEventTimer->Resume();
|
|
2232 pCurrentScreen = SCREEN_GAME;
|
|
2233 viewparams->bRedrawGameUI = 1;
|
|
2234 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
2235 continue;
|
|
2236 case SCREEN_E:
|
|
2237 __debugbreak();
|
|
2238 pGUIWindow_CurrentMenu->Release();
|
|
2239 pCurrentScreen = SCREEN_HOUSE;
|
|
2240 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2241 continue;
|
|
2242 case SCREEN_HOUSE:
|
|
2243 if ( uDialogueType )
|
|
2244 uDialogueType = 0;
|
|
2245 if ( uGameState == GAME_STATE_CHANGE_LOCATION )
|
|
2246 {
|
|
2247 while ( HouseDialogPressCloseBtn() )
|
|
2248 ;
|
|
2249 }
|
|
2250 else
|
|
2251 {
|
|
2252 if ( HouseDialogPressCloseBtn() )
|
|
2253 continue;
|
|
2254 }
|
|
2255 GetHouseGoodbyeSpeech();
|
2534
|
2256 pAudioPlayer->PlaySound(SOUND_wooddrclose, 814, 0, -1, 0, 0, 0, 0);
|
2499
|
2257 pMediaPlayer->Unload();
|
|
2258 pGUIWindow_CurrentMenu = window_SpeakInHouse;
|
|
2259 if ( pGUIWindow_Settings )
|
|
2260 {
|
|
2261 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
2262 pMouse->SetCursorBitmap("MICON2");
|
|
2263 else
|
|
2264 {
|
|
2265 pGUIWindow_Settings->Release();
|
|
2266 pGUIWindow_Settings = 0;
|
|
2267 pMouse->SetCursorBitmap("MICON1");
|
|
2268 GameUI_Footer_TimeLeft = 0;
|
|
2269 _50C9A0_IsEnchantingInProgress = 0;
|
|
2270 back_to_game();
|
|
2271 }
|
|
2272 }
|
|
2273 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
2274 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2275 pGUIWindow_CurrentMenu->Release();
|
|
2276 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
2277 window_SpeakInHouse = 0;
|
|
2278 pGUIWindow_CurrentMenu = 0;
|
|
2279 pEventTimer->Resume();
|
|
2280 pCurrentScreen = SCREEN_GAME;
|
|
2281 viewparams->bRedrawGameUI = true;
|
|
2282 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
2283 continue;
|
|
2284 case SCREEN_INPUT_BLV://click escape
|
|
2285 if ( uCurrentHouse_Animation == 153 )
|
|
2286 PlayHouseSound(0x99u, HouseSound_Greeting_2);
|
|
2287 pMediaPlayer->Unload();
|
|
2288 if ( npcIdToDismissAfterDialogue )
|
|
2289 {
|
|
2290 pParty->hirelingScrollPosition = 0;
|
|
2291 LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu;
|
|
2292 pParty->CountHirelings();
|
|
2293 viewparams->bRedrawGameUI = true;
|
|
2294 npcIdToDismissAfterDialogue = 0;
|
|
2295 }
|
|
2296 DialogueEnding();
|
|
2297 pCurrentScreen = SCREEN_GAME;
|
|
2298 viewparams->bRedrawGameUI = true;
|
|
2299 continue;
|
|
2300 case SCREEN_NPC_DIALOGUE://click escape
|
|
2301 if ( npcIdToDismissAfterDialogue )
|
|
2302 {
|
|
2303 pParty->hirelingScrollPosition = 0;
|
|
2304 LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu;
|
|
2305 pParty->CountHirelings();
|
|
2306 viewparams->bRedrawGameUI = true;
|
|
2307 npcIdToDismissAfterDialogue = 0;
|
|
2308 }
|
|
2309 //goto LABEL_317;
|
|
2310 DialogueEnding();
|
|
2311 pCurrentScreen = SCREEN_GAME;
|
|
2312 viewparams->bRedrawGameUI = true;
|
|
2313 continue;
|
|
2314 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape
|
|
2315 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u);
|
|
2316 sub_4452BB();
|
|
2317 DialogueEnding();
|
|
2318 pCurrentScreen = SCREEN_GAME;
|
|
2319 viewparams->bRedrawGameUI = true;
|
|
2320 continue;
|
|
2321 case SCREEN_CHANGE_LOCATION://click escape
|
|
2322 if ( pParty->vPosition.x < -22528 )
|
|
2323 pParty->vPosition.x = -22528;
|
|
2324 if ( pParty->vPosition.x > 22528 )
|
|
2325 pParty->vPosition.x = 22528;
|
|
2326 if ( pParty->vPosition.y < -22528 )
|
|
2327 pParty->vPosition.y = -22528;
|
|
2328 if ( pParty->vPosition.y > 22528 )
|
|
2329 pParty->vPosition.y = 22528;
|
|
2330 DialogueEnding();
|
|
2331 pCurrentScreen = SCREEN_GAME;
|
|
2332 viewparams->bRedrawGameUI = true;
|
|
2333 continue;
|
|
2334 case SCREEN_VIDEO:
|
|
2335 pMediaPlayer->Unload();
|
|
2336 continue;
|
|
2337 case SCREEN_CHARACTERS:
|
|
2338 CharacterUI_ReleaseButtons();
|
|
2339 ReleaseAwardsScrollBar();
|
|
2340 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2341 if ( pGUIWindow_Settings )
|
|
2342 {
|
|
2343 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
2344 pMouse->SetCursorBitmap("MICON2");
|
|
2345 else
|
|
2346 {
|
|
2347 pGUIWindow_Settings->Release();
|
|
2348 pGUIWindow_Settings = 0;
|
|
2349 pMouse->SetCursorBitmap("MICON1");
|
|
2350 GameUI_Footer_TimeLeft = 0;
|
|
2351 _50C9A0_IsEnchantingInProgress = 0;
|
|
2352 back_to_game();
|
|
2353 }
|
|
2354 }
|
|
2355 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
2356 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2357 pGUIWindow_CurrentMenu->Release();
|
|
2358 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
2359 window_SpeakInHouse = 0;
|
|
2360 pGUIWindow_CurrentMenu = 0;
|
|
2361 pEventTimer->Resume();
|
|
2362 pCurrentScreen = SCREEN_GAME;
|
|
2363 viewparams->bRedrawGameUI = true;
|
|
2364 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
2365 continue;
|
|
2366 default:
|
|
2367 if ( pGUIWindow_Settings )
|
|
2368 {
|
|
2369 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
2370 pMouse->SetCursorBitmap("MICON2");
|
|
2371 else
|
|
2372 {
|
|
2373 pGUIWindow_Settings->Release();
|
|
2374 pGUIWindow_Settings = 0;
|
|
2375 pMouse->SetCursorBitmap("MICON1");
|
|
2376 GameUI_Footer_TimeLeft = 0;
|
|
2377 _50C9A0_IsEnchantingInProgress = 0;
|
|
2378 back_to_game();
|
|
2379 }
|
|
2380 }
|
|
2381 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
2382 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2383 pGUIWindow_CurrentMenu->Release();
|
|
2384 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
2385 window_SpeakInHouse = 0;
|
|
2386 pGUIWindow_CurrentMenu = 0;
|
|
2387 pEventTimer->Resume();
|
|
2388 pCurrentScreen = SCREEN_GAME;
|
|
2389 viewparams->bRedrawGameUI = 1;
|
|
2390 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
2391 continue;
|
|
2392 }
|
|
2393 if ( pGUIWindow_Settings )
|
|
2394 {
|
|
2395 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
2396 pMouse->SetCursorBitmap("MICON2");
|
|
2397 else
|
|
2398 {
|
|
2399 pGUIWindow_Settings->Release();
|
|
2400 pGUIWindow_Settings = 0;
|
|
2401 pMouse->SetCursorBitmap("MICON1");
|
|
2402 GameUI_Footer_TimeLeft = 0;
|
|
2403 _50C9A0_IsEnchantingInProgress = 0;
|
|
2404 back_to_game();
|
|
2405 }
|
|
2406 }
|
|
2407 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
2408 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2409 pGUIWindow_CurrentMenu->Release();
|
|
2410 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
2411 window_SpeakInHouse = 0;
|
|
2412 pGUIWindow_CurrentMenu = 0;
|
|
2413 pEventTimer->Resume();
|
|
2414 pCurrentScreen = SCREEN_GAME;
|
|
2415 viewparams->bRedrawGameUI = true;
|
|
2416 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
2417 continue;
|
|
2418 }
|
|
2419 CharacterUI_ReleaseButtons();
|
|
2420 ReleaseAwardsScrollBar();
|
|
2421 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
2422 }
|
|
2423 if ( pGUIWindow_Settings )
|
|
2424 {
|
|
2425 if ( pCurrentScreen == SCREEN_CHARACTERS )
|
|
2426 pMouse->SetCursorBitmap("MICON2");
|
|
2427 else
|
|
2428 {
|
|
2429 pGUIWindow_Settings->Release();
|
|
2430 pGUIWindow_Settings = 0;
|
|
2431 pMouse->SetCursorBitmap("MICON1");
|
|
2432 GameUI_Footer_TimeLeft = 0;
|
|
2433 _50C9A0_IsEnchantingInProgress = 0;
|
|
2434 back_to_game();
|
|
2435 }
|
|
2436 }
|
|
2437 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
|
|
2438 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
2439 pGUIWindow_CurrentMenu->Release();
|
|
2440 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
|
|
2441 window_SpeakInHouse = 0;
|
|
2442 pGUIWindow_CurrentMenu = 0;
|
|
2443 pEventTimer->Resume();
|
|
2444 pCurrentScreen = SCREEN_GAME;
|
|
2445 viewparams->bRedrawGameUI = true;
|
|
2446 pIcons_LOD->RemoveTexturesFromTextureList();
|
|
2447 continue;
|
|
2448 }
|
|
2449 if ( !pGUIWindow_Settings )//Draw Menu
|
|
2450 {
|
|
2451 dword_6BE138 = -1;
|
|
2452 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, (char *)1);
|
|
2453 pEventTimer->Pause();
|
|
2454 pAudioPlayer->StopChannels(-1, -1);
|
|
2455 pCurrentScreen = SCREEN_MENU;
|
|
2456
|
|
2457 ++pIcons_LOD->uTexturePacksCount;
|
|
2458 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
2459 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
2460
|
|
2461 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_OptionsButtons, 0, 0);
|
|
2462 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
|
|
2463 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
|
|
2464 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
|
|
2465 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
|
|
2466 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
|
|
2467 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
|
|
2468 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
|
|
2469 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu,
|
|
2470 pGlobalTXT_LocalizationStrings[614],// "New Game"
|
|
2471 pIcons_LOD->GetTexture(uTextureID_New1), 0);
|
|
2472 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u,
|
|
2473 pGlobalTXT_LocalizationStrings[615],// "Save Game"
|
|
2474 pIcons_LOD->GetTexture(uTextureID_Save1), 0);
|
|
2475 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu,
|
|
2476 pGlobalTXT_LocalizationStrings[616],// "Load Game"
|
|
2477 pIcons_LOD->GetTexture(uTextureID_Load1), 0);
|
|
2478 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u,
|
|
2479 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:""
|
|
2480 pIcons_LOD->GetTexture(uTextureID_Controls1), 0);
|
|
2481 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u,
|
|
2482 pGlobalTXT_LocalizationStrings[618],// "Quit"
|
|
2483 pIcons_LOD->GetTexture(uTextureID_Quit1), 0);
|
|
2484 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u,
|
|
2485 pGlobalTXT_LocalizationStrings[619],// "Return to Game"
|
|
2486 pIcons_LOD->GetTexture(uTextureID_Resume1), 0);
|
|
2487 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0);
|
|
2488 viewparams->field_48 = 1;
|
|
2489
|
|
2490 stru_506E40.Release();
|
|
2491 pRenderer->SaveScreenshot("gamma.pcx", 155, 117);
|
|
2492 stru_506E40.LoadPCXFile("gamma.pcx", 0);
|
|
2493
|
|
2494 continue;
|
|
2495 }
|
|
2496 pGUIWindow_Settings->Release();
|
|
2497 pGUIWindow_Settings = 0;
|
|
2498 pMouse->SetCursorBitmap("MICON1");
|
|
2499 GameUI_Footer_TimeLeft = 0;
|
|
2500 _50C9A0_IsEnchantingInProgress = 0;
|
|
2501 back_to_game();
|
|
2502 continue;
|
|
2503 }
|
|
2504 ModalWindow_Release();
|
|
2505 continue;
|
|
2506 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel
|
|
2507 if ( uMessageParam )
|
|
2508 {
|
|
2509 GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0);
|
|
2510 v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2;
|
|
2511 if ( pParty->hirelingScrollPosition < v37 )
|
|
2512 {
|
|
2513 ++pParty->hirelingScrollPosition;//??? maybe number of the first cell???
|
|
2514 if ( pParty->hirelingScrollPosition >= v37 )
|
|
2515 pParty->hirelingScrollPosition = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2;
|
|
2516 }
|
|
2517 }
|
|
2518 else
|
|
2519 {
|
|
2520 GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0);
|
|
2521 /*if ( pParty->field_709 )
|
|
2522 {
|
|
2523 --pParty->field_709;
|
|
2524 if ( pParty->field_709 < 1 )
|
|
2525 pParty->field_709 = 0;
|
|
2526 }*/
|
|
2527 }
|
|
2528 GameUI_DrawHiredNPCs();
|
|
2529 continue;
|
|
2530 case UIMSG_TransitionUI_Confirm:
|
|
2531 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
2532 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
2533 dword_50CDC8 = 1;
|
|
2534 sub_42FBDD();
|
|
2535 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
2536
|
|
2537 if (pMovie_Track)
|
|
2538 pMediaPlayer->Unload();
|
|
2539 DialogueEnding();
|
|
2540 viewparams->bRedrawGameUI = true;
|
|
2541 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz )
|
|
2542 {
|
|
2543 if ( dword_59117C_teleportx )
|
|
2544 {
|
|
2545 pParty->vPosition.x = dword_59117C_teleportx;
|
|
2546 _5B65A8_npcdata_uflags_or_other = dword_59117C_teleportx;
|
|
2547 }
|
|
2548 if ( dword_591178_teleporty )
|
|
2549 {
|
|
2550 pParty->vPosition.y = dword_591178_teleporty;
|
|
2551 _5B65AC_npcdata_fame_or_other = dword_591178_teleporty;
|
|
2552 }
|
|
2553 if ( dword_591174_teleportz )
|
|
2554 {
|
|
2555 pParty->vPosition.z = dword_591174_teleportz;
|
|
2556 _5B65B0_npcdata_rep_or_other = dword_591174_teleportz;
|
|
2557 pParty->uFallStartY = dword_591174_teleportz;
|
|
2558 }
|
|
2559 if ( dword_591170_teleport_directiony )
|
|
2560 {
|
|
2561 pParty->sRotationY = dword_591170_teleport_directiony;
|
|
2562 _5B65B4_npcdata_loword_house_or_other = dword_591170_teleport_directiony;
|
|
2563 }
|
|
2564 if ( dword_59116C_teleport_directionx )
|
|
2565 {
|
|
2566 pParty->sRotationX = dword_59116C_teleport_directionx;
|
|
2567 _5B65B8_npcdata_hiword_house_or_other = dword_59116C_teleport_directionx;
|
|
2568 v38 = dword_591168_teleport_speedz;
|
|
2569 pParty->uFallSpeed = dword_591168_teleport_speedz;
|
|
2570 dword_5B65BC = dword_591168_teleport_speedz;
|
|
2571 }
|
|
2572 else
|
|
2573 v38 = dword_5B65BC;
|
|
2574 if ( *dword_591164_teleport_map_name != 48 )
|
|
2575 {
|
|
2576 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)2;
|
|
2577 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;
|
|
2578 OnMapLeave();
|
|
2579 Transition_StopSound_Autosave(dword_591164_teleport_map_name, MapStartPoint_Party);
|
|
2580 }
|
|
2581 }
|
|
2582 else
|
|
2583 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
|
|
2584 if ( !_stricmp(byte_6BE3B0.data(), "d05.blv") )
|
|
2585 pParty->uTimePlayed += 1474560i64;
|
|
2586 continue;
|
|
2587 case UIMSG_TransitionWindowCloseBtn:
|
|
2588 CloseWindowBackground();
|
|
2589 pMediaPlayer->Unload();
|
|
2590 DialogueEnding();
|
|
2591 viewparams->bRedrawGameUI = true;
|
|
2592 continue;
|
|
2593 case UIMSG_CycleCharacters:
|
|
2594 v39 = GetAsyncKeyState(VK_SHIFT);
|
|
2595 uActiveCharacter = CycleCharacter(v39);
|
|
2596 viewparams->bRedrawGameUI = true;
|
|
2597 continue;
|
|
2598 case UIMSG_OnTravelByFoot:
|
|
2599 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
2600 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
2601 dword_50CDC8 = 1;
|
|
2602 sub_42FBDD();
|
|
2603 //pNPCData4 = (NPCData *)GetTravelTime();
|
|
2604 strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
|
|
2605 if ( bUnderwater != 1 && pParty->bFlying
|
|
2606 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 )
|
|
2607 {
|
|
2608 viewparams->bRedrawGameUI = 1;
|
|
2609 CloseWindowBackground();
|
|
2610 if ( pParty->vPosition.x < -22528 )
|
|
2611 pParty->vPosition.x = -22528;
|
|
2612 if ( pParty->vPosition.x > 22528 )
|
|
2613 pParty->vPosition.x = 22528;
|
|
2614 if ( pParty->vPosition.y < -22528 )
|
|
2615 pParty->vPosition.y = -22528;
|
|
2616 if ( pParty->vPosition.y > 22528 )
|
|
2617 pParty->vPosition.y = 22528;
|
|
2618 DialogueEnding();
|
|
2619 pCurrentScreen = SCREEN_GAME;
|
|
2620 }
|
|
2621 else
|
|
2622 {
|
|
2623 pParty->field_6E4 = 0;
|
|
2624 pParty->field_6E0 = 0;
|
|
2625 CastSpellInfoHelpers::_427D48();
|
|
2626 DialogueEnding();
|
|
2627 pEventTimer->Pause();
|
|
2628 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box);
|
|
2629 ++pGameLoadingUI_ProgressBar->uProgressMax;
|
|
2630 SaveGame(1, 0);
|
|
2631 pGameLoadingUI_ProgressBar->Progress();
|
|
2632 RestAndHeal(1440 * (signed int)GetTravelTime());
|
|
2633 if ( pParty->uNumFoodRations )
|
|
2634 {
|
|
2635 pParty->RestAndHeal();
|
|
2636 if ( ((pParty->uNumFoodRations - (signed int)GetTravelTime()) & 0x80000000u) != 0 )
|
|
2637 {
|
|
2638 pPlayer7 = pParty->pPlayers.data();
|
|
2639 do
|
|
2640 {
|
|
2641 pPlayer7->SetCondition(1, 0);
|
|
2642 ++pPlayer7;
|
|
2643 }
|
|
2644 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings.data() );
|
|
2645 ++pParty->days_played_without_rest;
|
|
2646 }
|
|
2647 Party::TakeFood((unsigned int)GetTravelTime());
|
|
2648 }
|
|
2649 else
|
|
2650 {
|
|
2651 pPlayer8 = pParty->pPlayers.data();
|
|
2652 do
|
|
2653 {
|
|
2654 pPlayer8->SetCondition(1, 0);
|
|
2655 ++pPlayer8;
|
|
2656 }
|
|
2657 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings.data() );
|
|
2658 ++pParty->days_played_without_rest;
|
|
2659 }
|
|
2660 pPaletteManager->ResetNonLocked();
|
|
2661 pSpriteFrameTable->ResetSomeSpriteFlags();
|
|
2662 strcpy(pCurrentMapName, pOut);
|
|
2663 strcpy(pLevelName, pCurrentMapName);
|
|
2664 v41 = strtok(pLevelName, ".");
|
|
2665 strcpy(pLevelName, v41);
|
|
2666 Level_LoadEvtAndStr(pLevelName);
|
|
2667 pDecalBuilder->Reset(0);
|
|
2668 LoadLevel_InitializeLevelEvt();
|
|
2669 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName);
|
|
2670 bUnderwater = 0;
|
|
2671 bNoNPCHiring = 0;
|
|
2672 pGame->uFlags2 &= 0xFFFFFFF7u;
|
|
2673 if ( Is_out15odm_underwater() )
|
|
2674 {
|
|
2675 bUnderwater = 1;
|
|
2676 pGame->uFlags2 |= 8u;
|
|
2677 }
|
|
2678 if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") )
|
|
2679 bNoNPCHiring = 1;
|
|
2680 PrepareToLoadODM(1u, (ODMRenderParams *)1);
|
|
2681 pAudioPlayer->SetMapEAX();
|
|
2682 bDialogueUI_InitializeActor_NPC_ID = 0;
|
|
2683 OnMapLoad();
|
|
2684 pOutdoor->SetFog();
|
|
2685 TeleportToStartingPoint(uLevel_StartingPointType);
|
|
2686 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0);
|
|
2687 pParty->uFallStartY = pParty->vPosition.z;
|
|
2688 _461103_load_level_sub();
|
|
2689 pEventTimer->Resume();
|
|
2690 viewparams->bRedrawGameUI = 1;
|
|
2691 pCurrentScreen = SCREEN_GAME;
|
|
2692 pGameLoadingUI_ProgressBar->Release();
|
|
2693 }
|
|
2694 viewparams->bRedrawGameUI = 1;
|
|
2695 continue;
|
|
2696 case UIMSG_CHANGE_LOCATION_ClickCencelBtn:
|
|
2697 CloseWindowBackground();
|
|
2698 if ( pParty->vPosition.x < -22528 )
|
|
2699 pParty->vPosition.x = -22528;
|
|
2700 if ( pParty->vPosition.x > 22528 )
|
|
2701 pParty->vPosition.x = 22528;
|
|
2702 if ( pParty->vPosition.y < -22528 )
|
|
2703 pParty->vPosition.y = -22528;
|
|
2704 if ( pParty->vPosition.y > 22528 )
|
|
2705 pParty->vPosition.y = 22528;
|
|
2706 DialogueEnding();
|
|
2707 pCurrentScreen = SCREEN_GAME;
|
|
2708 viewparams->bRedrawGameUI = 1;
|
|
2709 continue;
|
|
2710 case UIMSG_CastSpell_Telekinesis:
|
|
2711 //if ( pRenderer->pRenderD3D )
|
|
2712 LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val();
|
|
2713 /*else
|
|
2714 {
|
|
2715 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210);
|
|
2716 pPoint = pMouse->GetCursorPos(&v208);
|
|
2717 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]];
|
|
2718 }*/
|
|
2719 v44 = (unsigned __int16)v42;
|
|
2720 v45 = PID_TYPE(v44);
|
|
2721 uNumSeconds = v44;
|
|
2722 v46 = PID_ID(v44);
|
|
2723 if ( v45 == 3 )
|
|
2724 {
|
|
2725 v47 = pActors[v46].uAIState == Dead;
|
|
2726 if ( !v47 )
|
|
2727 continue;
|
|
2728 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
|
|
2729 pSpellInfo->uFlags &= ~0x40u;
|
|
2730 pSpellInfo->uPlayerID_2 = uMessageParam;
|
|
2731 pSpellInfo->spell_target_pid = v44;
|
|
2732 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
|
|
2733 pGUIWindow_Settings->Release();
|
|
2734 pGUIWindow_Settings = 0;
|
|
2735 pMouse->SetCursorBitmap("MICON1");
|
|
2736 GameUI_Footer_TimeLeft = 0;
|
|
2737 _50C9A0_IsEnchantingInProgress = 0;
|
|
2738 back_to_game();
|
|
2739 continue;
|
|
2740 }
|
|
2741 if ( v45 == 2 )
|
|
2742 {
|
|
2743 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0;
|
|
2744 if ( !v47 )
|
|
2745 continue;
|
|
2746 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
|
|
2747 pSpellInfo->uFlags &= ~0x40u;
|
|
2748 pSpellInfo->uPlayerID_2 = uMessageParam;
|
|
2749 pSpellInfo->spell_target_pid = v44;
|
|
2750 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
|
|
2751 pGUIWindow_Settings->Release();
|
|
2752 pGUIWindow_Settings = 0;
|
|
2753 pMouse->SetCursorBitmap("MICON1");
|
|
2754 GameUI_Footer_TimeLeft = 0;
|
|
2755 _50C9A0_IsEnchantingInProgress = 0;
|
|
2756 back_to_game();
|
|
2757 continue;
|
|
2758 }
|
|
2759 if ( v45 == 5 )
|
|
2760 {
|
|
2761 v48 = pLevelDecorations[v46].uEventID == 0;
|
|
2762 }
|
|
2763 else
|
|
2764 {
|
|
2765 if ( v45 != 6 )
|
|
2766 continue;
|
|
2767 if ( uCurrentlyLoadedLevelType != 1 )
|
|
2768 {
|
|
2769 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F];
|
|
2770 if ( !pODMFace->Clickable() || !pODMFace->sCogTriggeredID )
|
|
2771 continue;
|
|
2772 v44 = uNumSeconds;
|
|
2773 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
|
|
2774 pSpellInfo->uFlags &= ~0x40u;
|
|
2775 pSpellInfo->uPlayerID_2 = uMessageParam;
|
|
2776 pSpellInfo->spell_target_pid = v44;
|
|
2777 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
|
|
2778 pGUIWindow_Settings->Release();
|
|
2779 pGUIWindow_Settings = 0;
|
|
2780 pMouse->SetCursorBitmap("MICON1");
|
|
2781 GameUI_Footer_TimeLeft = 0;
|
|
2782 _50C9A0_IsEnchantingInProgress = 0;
|
|
2783 back_to_game();
|
|
2784 continue;
|
|
2785 }
|
|
2786 pBLVFace = &pIndoor->pFaces[v46];
|
|
2787 if ( !pBLVFace->Clickable() )
|
|
2788 continue;
|
|
2789 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0;
|
|
2790 }
|
|
2791 if ( v48 )
|
|
2792 continue;
|
|
2793 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
|
|
2794 pSpellInfo->uFlags &= ~0x40u;
|
|
2795 pSpellInfo->uPlayerID_2 = uMessageParam;
|
|
2796 pSpellInfo->spell_target_pid = v44;
|
|
2797 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
|
|
2798 pGUIWindow_Settings->Release();
|
|
2799 pGUIWindow_Settings = 0;
|
|
2800 pMouse->SetCursorBitmap("MICON1");
|
|
2801 GameUI_Footer_TimeLeft = 0;
|
|
2802 _50C9A0_IsEnchantingInProgress = 0;
|
|
2803 back_to_game();
|
|
2804 continue;
|
|
2805 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade)
|
|
2806 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure
|
|
2807 case UIMSG_HiredNPC_CastSpell:
|
|
2808 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
2809 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
2810 if ( _50C9A0_IsEnchantingInProgress )
|
|
2811 {
|
|
2812 uActiveCharacter = uMessageParam;
|
|
2813 viewparams->bRedrawGameUI = 1;
|
|
2814 }
|
|
2815 else
|
|
2816 {
|
|
2817 if ( pGUIWindow_Settings )
|
|
2818 {
|
|
2819 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
|
|
2820 switch ( uMessage )
|
|
2821 {
|
|
2822 case UIMSG_CastSpell_Character_Big_Improvement:
|
|
2823 pSpellInfo->uFlags &= ~0x02u;
|
|
2824 break;
|
|
2825 case UIMSG_CastSpell_Character_Small_Improvement:
|
|
2826 pSpellInfo->uFlags &= ~0x0100u;
|
|
2827 break;
|
|
2828 case UIMSG_HiredNPC_CastSpell:
|
|
2829 pSpellInfo->uFlags &= ~0x0200u;
|
|
2830 break;
|
|
2831 }
|
|
2832 pSpellInfo->uPlayerID_2 = uMessageParam;
|
|
2833 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
|
|
2834 pGUIWindow_Settings->Release();
|
|
2835 pGUIWindow_Settings = 0;
|
|
2836 pEventTimer->Resume();
|
|
2837 pMouse->SetCursorBitmap("MICON1");
|
|
2838 GameUI_Footer_TimeLeft = 0;
|
|
2839 _50C9A0_IsEnchantingInProgress = 0;
|
|
2840 }
|
|
2841 }
|
|
2842 continue;
|
|
2843 case UIMSG_BF:
|
|
2844 __debugbreak();
|
|
2845 dword_50CDC8 = 1;
|
|
2846 sub_42FBDD();
|
|
2847 SaveGame(1, 0);
|
|
2848 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename);
|
|
2849 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
|
|
2850 uGameState = GAME_STATE_CHANGE_LOCATION;
|
|
2851 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
2852 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related;
|
|
2853 if ( v53 < 0 )
|
|
2854 {
|
|
2855 v54 = abs(v53) - 1;
|
|
2856 _5B65B8_npcdata_hiword_house_or_other = 0;
|
|
2857 dword_5B65BC = 0;
|
|
2858 v55 = dword_4E4560[v54];
|
|
2859 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54];
|
|
2860 v56 = dword_4E4590[v54];
|
|
2861 v57 = dword_4E45A8[v54];
|
|
2862 _5B65A8_npcdata_uflags_or_other = v55;
|
|
2863 _5B65B4_npcdata_loword_house_or_other = v57;
|
|
2864 _5B65B0_npcdata_rep_or_other = v56;
|
|
2865 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57;
|
|
2866 }
|
|
2867 HouseDialogPressCloseBtn();
|
|
2868 //goto LABEL_434;
|
|
2869 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
2870 {
|
|
2871 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
2872 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
|
|
2873 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
2874 ++pMessageQueue_50CBD0->uNumMessages;
|
|
2875 }*/
|
|
2876 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2877 continue;
|
|
2878
|
|
2879 case UIMSG_OnCastTownPortal:
|
|
2880 pAudioPlayer->StopChannels(-1, -1);
|
|
2881 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, WINDOW_TownPortal, (char *)uMessageParam);
|
|
2882 continue;
|
|
2883
|
|
2884 case UIMSG_OnCastLloydsBeacon:
|
|
2885 pAudioPlayer->StopChannels(-1, -1);
|
|
2886 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, WINDOW_LloydsBeacon, 0);
|
|
2887 continue;
|
|
2888
|
|
2889 case UIMSG_LloydsBeacon_FlippingBtn:
|
|
2890 bRecallingBeacon = uMessageParam;
|
|
2891 v127 = uMessageParam + 204;
|
|
2892 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
|
|
2893 continue;
|
|
2894 case UIMSG_HintBeaconSlot:
|
|
2895 if ( !pGUIWindow_CurrentMenu )
|
|
2896 continue;
|
|
2897 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1];
|
|
2898 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam];
|
|
2899 if ( bRecallingBeacon )
|
|
2900 {
|
|
2901 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) )
|
|
2902 continue;
|
|
2903 v173 = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName;
|
|
2904 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s"
|
|
2905 GameUI_SetFooterString(pTmpBuf.data());
|
|
2906 continue;
|
|
2907 }
|
|
2908 pMapNum = pMapStats->GetMapInfo(pCurrentMapName);
|
|
2909 pMapName = "Not in Map Stats";
|
|
2910 if ( pMapNum )
|
|
2911 pMapName = pMapStats->pInfos[pMapNum].pName;
|
|
2912 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) || !pMapNum )
|
|
2913 {
|
|
2914 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], pMapName);// "Set to %s"
|
|
2915 GameUI_SetFooterString(pTmpBuf.data());
|
|
2916 continue;
|
|
2917 }
|
|
2918 v174 = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName;
|
|
2919 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], (unsigned int)pMapName, v174);// "Set %s over %s"
|
|
2920 GameUI_SetFooterString(pTmpBuf.data());
|
|
2921 continue;
|
|
2922 case UIMSG_CloseAfterInstallBeacon:
|
|
2923 dword_50CDC8 = 1;
|
|
2924 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
2925 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
|
|
2926 continue;
|
|
2927 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
2928 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
|
|
2929 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
2930 ++pMessageQueue_50CBD0->uNumMessages;*/
|
|
2931 continue;
|
|
2932 case UIMSG_InstallBeacon:
|
|
2933 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1];
|
|
2934 if ( !pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime && bRecallingBeacon )
|
|
2935 continue;
|
|
2936 byte_506360 = 1;
|
|
2937 pPlayer9->CanCastSpell(uRequiredMana);
|
|
2938 if ( pParty->bTurnBasedModeOn )
|
|
2939 {
|
|
2940 v60 = sRecoveryTime;
|
|
2941 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime;
|
|
2942 pPlayer9->SetRecoveryTime(v60);
|
|
2943 pTurnEngine->ApplyPlayerAction();
|
|
2944 }
|
|
2945 else
|
|
2946 {
|
|
2947 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333));
|
|
2948 }
|
|
2949 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[lloyds_beacon_spell_id], 0, 0, -1, 0, lloyds_beacon_sound_id, 0, 0);
|
|
2950 if ( bRecallingBeacon )
|
|
2951 {
|
|
2952 if ( _stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) )
|
|
2953 {
|
|
2954 SaveGame(1, 0);
|
|
2955 OnMapLeave();
|
|
2956 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]);
|
|
2957 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
|
|
2958 uGameState = GAME_STATE_CHANGE_LOCATION;
|
|
2959 _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X;
|
|
2960 _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y;
|
|
2961 _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z;
|
|
2962 _5B65B4_npcdata_loword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X;
|
|
2963 _5B65B8_npcdata_hiword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y;
|
|
2964 dword_5B65C0 = 1;
|
|
2965 }
|
|
2966 else
|
|
2967 {
|
|
2968 pParty->vPosition.x = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X;
|
|
2969 pParty->vPosition.y = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y;
|
|
2970 pParty->vPosition.z = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z;
|
|
2971 pParty->uFallStartY = pParty->vPosition.z;
|
|
2972 pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X;
|
|
2973 pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y;
|
|
2974 }
|
|
2975 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2976 pBooksWindow->Release();
|
|
2977 pGUIWindow_CurrentMenu->Release();
|
|
2978 pBooksWindow = 0;
|
|
2979 pGUIWindow_CurrentMenu = 0;
|
|
2980 }
|
|
2981 else
|
|
2982 {
|
|
2983 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1);
|
|
2984 pRenderer->SaveScreenshot(a1, 92, 68);
|
|
2985 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1);
|
|
2986 pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(lloyds_beacon_spell_level << 7) * 0.033333335);
|
|
2987 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x;
|
|
2988 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y = pParty->vPosition.y;
|
|
2989 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z = pParty->vPosition.z;
|
|
2990 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X = LOWORD(pParty->sRotationY);
|
|
2991 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX);
|
|
2992 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 )
|
|
2993 continue;
|
|
2994 for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg )
|
|
2995 {
|
|
2996 if ( !_stricmp(pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) )
|
|
2997 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg;
|
|
2998 }
|
|
2999 }
|
|
3000 continue;
|
|
3001 case UIMSG_ClickTownInTP:
|
|
3002 if ( uMessageParam )
|
|
3003 {
|
|
3004 switch ( uMessageParam )
|
|
3005 {
|
|
3006 case 1:
|
|
3007 v63 = 208;
|
|
3008 break;
|
|
3009 case 2:
|
|
3010 v63 = 207;
|
|
3011 break;
|
|
3012 case 3:
|
|
3013 v63 = 211;
|
|
3014 break;
|
|
3015 case 4:
|
|
3016 v63 = 209;
|
|
3017 break;
|
|
3018 default:
|
|
3019 if ( uMessageParam != 5 )
|
|
3020 {
|
|
3021 LABEL_486:
|
|
3022 SaveGame(1, 0);
|
|
3023 v64 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
3024 v65 = uMessageParam;
|
|
3025 if ( v64 == TownPortalList[uMessageParam].uMapInfoID )
|
|
3026 {
|
|
3027 pParty->vPosition.x = TownPortalList[v65].pos.x;
|
|
3028 pParty->vPosition.y = TownPortalList[v65].pos.y;
|
|
3029 pParty->vPosition.z = TownPortalList[v65].pos.z;
|
|
3030 pParty->uFallStartY = pParty->vPosition.z;
|
|
3031 pParty->sRotationY = TownPortalList[v65].rot_y;
|
|
3032 pParty->sRotationX = TownPortalList[v65].rot_x;
|
|
3033 }
|
|
3034 else
|
|
3035 {
|
|
3036 SaveGame(1, 0);
|
|
3037 OnMapLeave();
|
|
3038 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
|
|
3039 uGameState = GAME_STATE_CHANGE_LOCATION;
|
|
3040 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename);
|
|
3041 dword_5B65C0 = 1;
|
|
3042 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x;
|
|
3043 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y;
|
|
3044 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z;
|
|
3045 v66 = TownPortalList[uMessageParam].rot_x;
|
|
3046 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y;
|
|
3047 _5B65B8_npcdata_hiword_house_or_other = v66;
|
|
3048 Actor::InitializeActors();
|
|
3049 }
|
|
3050 v67 = (char*)pGUIWindow_CurrentMenu->Hint;
|
|
3051 if ( v67 )
|
|
3052 *((int *)v67 + 17) = 1;
|
|
3053 else
|
|
3054 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u);
|
|
3055 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3056 {
|
|
3057 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3058 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
|
|
3059 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3060 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3061 }*/
|
|
3062 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
3063 continue;
|
|
3064 }
|
|
3065 v63 = 210;
|
|
3066 break;
|
|
3067 }
|
|
3068 }
|
|
3069 else
|
|
3070 {
|
|
3071 v63 = 206;
|
|
3072 }
|
|
3073 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) )
|
|
3074 return;
|
|
3075 goto LABEL_486;
|
|
3076 case UIMSG_HintTownPortal:
|
|
3077 if ( uMessageParam )
|
|
3078 {
|
|
3079 switch ( uMessageParam )
|
|
3080 {
|
|
3081 case 1:
|
|
3082 v68 = 208;
|
|
3083 break;
|
|
3084 case 2:
|
|
3085 v68 = 207;
|
|
3086 break;
|
|
3087 case 3:
|
|
3088 v68 = 211;
|
|
3089 break;
|
|
3090 case 4:
|
|
3091 v68 = 209;
|
|
3092 break;
|
|
3093 default:
|
|
3094 if ( uMessageParam != 5 )
|
|
3095 //goto LABEL_506;
|
|
3096 {
|
|
3097 if ( uMessageParam )
|
|
3098 {
|
|
3099 switch ( uMessageParam )
|
|
3100 {
|
|
3101 case 1:
|
|
3102 v69 = pMapStats->pInfos[4].pName;
|
|
3103 break;
|
|
3104 case 2:
|
|
3105 v69 = pMapStats->pInfos[3].pName;
|
|
3106 break;
|
|
3107 case 3:
|
|
3108 v69 = pMapStats->pInfos[10].pName;
|
|
3109 break;
|
|
3110 case 4:
|
|
3111 v69 = pMapStats->pInfos[7].pName;
|
|
3112 break;
|
|
3113 default:
|
|
3114 if ( uMessageParam != 5 )
|
|
3115 {
|
|
3116 __debugbreak(); // warning C4700: uninitialized local variable 'v200' used
|
|
3117 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200);
|
|
3118 GameUI_SetFooterString(pTmpBuf.data());
|
|
3119 continue;
|
|
3120 }
|
|
3121 v69 = pMapStats->pInfos[8].pName;
|
|
3122 break;
|
|
3123 }
|
|
3124 }
|
|
3125 else
|
|
3126 {
|
|
3127 v69 = pMapStats->pInfos[21].pName;
|
|
3128 }
|
|
3129 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69);
|
|
3130 GameUI_SetFooterString(pTmpBuf.data());
|
|
3131 continue;
|
|
3132 }
|
|
3133 v68 = 210;
|
|
3134 break;
|
|
3135 }
|
|
3136 }
|
|
3137 else
|
|
3138 {
|
|
3139 v68 = 206;
|
|
3140 }
|
|
3141 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) )
|
|
3142 {
|
|
3143 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar);
|
|
3144 continue;
|
|
3145 }
|
|
3146 //LABEL_506:
|
|
3147 if ( uMessageParam )
|
|
3148 {
|
|
3149 switch ( uMessageParam )
|
|
3150 {
|
|
3151 case 1:
|
|
3152 v69 = pMapStats->pInfos[4].pName;
|
|
3153 break;
|
|
3154 case 2:
|
|
3155 v69 = pMapStats->pInfos[3].pName;
|
|
3156 break;
|
|
3157 case 3:
|
|
3158 v69 = pMapStats->pInfos[10].pName;
|
|
3159 break;
|
|
3160 case 4:
|
|
3161 v69 = pMapStats->pInfos[7].pName;
|
|
3162 break;
|
|
3163 default:
|
|
3164 if ( uMessageParam != 5 )
|
|
3165 //goto LABEL_519;
|
|
3166 {
|
|
3167 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200);
|
|
3168 GameUI_SetFooterString(pTmpBuf.data());
|
|
3169 continue;
|
|
3170 }
|
|
3171 v69 = pMapStats->pInfos[8].pName;
|
|
3172 break;
|
|
3173 }
|
|
3174 }
|
|
3175 else
|
|
3176 {
|
|
3177 v69 = pMapStats->pInfos[21].pName;
|
|
3178 }
|
|
3179 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69);
|
|
3180 GameUI_SetFooterString(pTmpBuf.data());
|
|
3181 continue;
|
|
3182 case UIMSG_ShowFinalWindow:
|
|
3183 sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
|
|
3184 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."
|
|
3185 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team."
|
|
3186 ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose);
|
|
3187 uGameState = GAME_STATE_FINAL_WINDOW;
|
|
3188 continue;
|
|
3189 case UIMSG_OnFinalWindowClose:
|
|
3190 __debugbreak();
|
|
3191 uGameState = GAME_STATE_PLAYING;
|
|
3192 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
|
|
3193 __debugbreak(); // missed break/continue?
|
|
3194 case UIMSG_DD:
|
|
3195 __debugbreak();
|
|
3196 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer);
|
|
3197 memcpy(&v216, txt_file_frametable_parser(pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
|
|
3198 if ( v216.uPropCount == 1 )
|
|
3199 {
|
|
3200 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2);
|
|
3201 v70 = atoi(v216.pProperties[0]);
|
|
3202 if ( v70 <= 0 || v70 >= 77 )
|
|
3203 continue;
|
|
3204 v71 = v70;
|
|
3205 strcpy(Str2, pMapStats->pInfos[v70].pFilename);
|
|
3206 pNPCData3 = 0;
|
|
3207 if ( (signed int)pNPCData4 > 0 )
|
|
3208 {
|
|
3209 thish = 0;
|
|
3210 do
|
|
3211 {
|
|
3212 if ( !_stricmp(pGames_LOD->pSubIndices[thish].pFilename, Str2) )
|
|
3213 break;
|
|
3214 ++thish;
|
|
3215 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1);
|
|
3216 }
|
|
3217 while ( (signed int)pNPCData3 < (signed int)pNPCData4 );
|
|
3218 if ( (signed int)pNPCData3 < (signed int)pNPCData4 )
|
|
3219 {
|
|
3220 strcpy(pCurrentMapName, pGames_LOD->pSubIndices[(int)pNPCData3].pFilename);
|
|
3221 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
|
|
3222 uGameState = GAME_STATE_CHANGE_LOCATION;
|
|
3223 OnMapLeave();
|
|
3224 continue;
|
|
3225 }
|
|
3226 }
|
|
3227 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName);
|
|
3228 v73 = Str2;
|
|
3229 }
|
|
3230 else
|
|
3231 {
|
|
3232 if ( v216.uPropCount != 3 )
|
|
3233 continue;
|
|
3234 v74 = atoi(v216.pProperties[0]);
|
|
3235 thisi = atoi(v216.pProperties[1]);
|
|
3236 v75 = atoi(v216.pProperties[2]);
|
|
3237 v76 = v75;
|
|
3238 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
3239 {
|
|
3240 if ( pIndoor->GetSector(v74, thisi, v75) )
|
|
3241 {
|
|
3242 v77 = thisi;
|
|
3243 pParty->vPosition.x = v74;
|
|
3244 pParty->vPosition.y = v77;
|
|
3245 pParty->vPosition.z = v76;
|
|
3246 pParty->uFallStartY = v76;
|
|
3247 continue;
|
|
3248 }
|
|
3249 }
|
|
3250 else
|
|
3251 {
|
|
3252 if ( v74 > -32768 )
|
|
3253 {
|
|
3254 if ( v74 < 32768 )
|
|
3255 {
|
|
3256 v77 = thisi;
|
|
3257 if ( thisi > -32768 )
|
|
3258 {
|
|
3259 if ( thisi < 32768 && v76 >= 0 && v76 < 10000 )
|
|
3260 {
|
|
3261 pParty->vPosition.x = v74;
|
|
3262 pParty->vPosition.y = v77;
|
|
3263 pParty->vPosition.z = v76;
|
|
3264 pParty->uFallStartY = v76;
|
|
3265 continue;
|
|
3266 }
|
|
3267 }
|
|
3268 }
|
|
3269 }
|
|
3270 }
|
|
3271 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
|
3272 v73 = "Can't jump to that location!";
|
|
3273 }
|
2506
|
3274 ShowStatusBarString(v73, 6);
|
2499
|
3275 continue;
|
|
3276 case UIMSG_CastQuickSpell:
|
|
3277 if ( bUnderwater == 1 )
|
|
3278 {
|
|
3279 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
|
2506
|
3280 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3281 continue;
|
|
3282 }
|
|
3283 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) )
|
|
3284 continue;
|
|
3285 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
|
|
3286 continue;
|
|
3287 case UIMSG_CastSpell_Monster_Improvement:
|
|
3288 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm,
|
|
3289 //if ( pRenderer->pRenderD3D )
|
|
3290 {
|
|
3291 v81 = pGame->pVisInstance->get_picked_object_zbuf_val();
|
|
3292 }
|
|
3293 /*else
|
|
3294 {
|
|
3295 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206);
|
|
3296 pPoint2 = pMouse->GetCursorPos(&v201);
|
|
3297 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]];
|
|
3298 }*/
|
|
3299 v83 = v81;
|
|
3300 v44 = (unsigned __int16)v81;
|
|
3301 v84 = v83 >> 16;
|
|
3302 if ( PID_TYPE(v44) != 3 || v84 >= 5120 )
|
|
3303 continue;
|
|
3304 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
|
|
3305 if ( uMessage == UIMSG_CastSpell_Shoot_Monster )
|
|
3306 {
|
|
3307 pSpellInfo->uFlags &= ~0x08;
|
|
3308 }
|
|
3309 else
|
|
3310 {
|
|
3311 if ( uMessage == UIMSG_CastSpell_Monster_Improvement )
|
|
3312 pSpellInfo->uFlags &= ~0x0100u;
|
|
3313 else
|
|
3314 pSpellInfo->uFlags &= ~0x0200u;
|
|
3315 }
|
|
3316 pSpellInfo->uPlayerID_2 = uMessageParam;
|
|
3317 pSpellInfo->spell_target_pid = v44;
|
|
3318 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
|
|
3319 pGUIWindow_Settings->Release();
|
|
3320 pGUIWindow_Settings = 0;
|
|
3321 pMouse->SetCursorBitmap("MICON1");
|
|
3322 GameUI_Footer_TimeLeft = 0;
|
|
3323 _50C9A0_IsEnchantingInProgress = 0;
|
|
3324 back_to_game();
|
|
3325 continue;
|
|
3326 case UIMSG_1C:
|
|
3327 __debugbreak();
|
|
3328 if ( !uActiveCharacter || pCurrentScreen )
|
|
3329 continue;
|
|
3330 ptr_507BC8 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_68, uMessageParam, 0);
|
|
3331 pCurrentScreen = SCREEN_19;
|
|
3332 pEventTimer->Pause();
|
|
3333 continue;
|
|
3334 case UIMSG_STEALFROMACTOR:
|
|
3335 if ( !uActiveCharacter )
|
|
3336 continue;
|
|
3337 if ( pParty->bTurnBasedModeOn != 1 )
|
|
3338 {
|
|
3339 if ( pActors[uMessageParam].uAIState == 5 )
|
|
3340 pActors[uMessageParam].LootActor();
|
|
3341 else
|
|
3342 Actor::StealFrom(uMessageParam);
|
|
3343 continue;
|
|
3344 }
|
|
3345 if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT )
|
|
3346 continue;
|
|
3347 if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) )
|
|
3348 {
|
|
3349 if ( pActors[uMessageParam].uAIState == 5 )
|
|
3350 pActors[uMessageParam].LootActor();
|
|
3351 else
|
|
3352 Actor::StealFrom(uMessageParam);
|
|
3353 }
|
|
3354 continue;
|
|
3355
|
|
3356 case UIMSG_Attack:
|
|
3357 if ( !uActiveCharacter )
|
|
3358 continue;
|
|
3359 if ( pParty->bTurnBasedModeOn != 1 )
|
|
3360 {
|
|
3361 Player::_42ECB5_PlayerAttacksActor();
|
|
3362 continue;
|
|
3363 }
|
|
3364 if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT )
|
|
3365 continue;
|
|
3366 if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) )
|
|
3367 Player::_42ECB5_PlayerAttacksActor();
|
|
3368 continue;
|
|
3369 case UIMSG_ExitRest:
|
|
3370 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest"
|
|
3371 continue;
|
|
3372 case UIMSG_Wait5Minutes:
|
|
3373 if ( dword_506F14 == 2 )
|
|
3374 {
|
|
3375 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
|
2506
|
3376 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3377 continue;
|
|
3378 }
|
|
3379 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2,
|
|
3380 (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes"
|
|
3381 dword_506F14 = 1;
|
|
3382 _506F18_num_minutes_to_sleep = 5;
|
|
3383 continue;
|
|
3384 case UIMSG_Wait1Hour:
|
|
3385 if ( dword_506F14 == 2 )
|
|
3386 {
|
|
3387 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
|
2506
|
3388 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3389 continue;
|
|
3390 }
|
|
3391 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2,
|
|
3392 (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour"
|
|
3393 dword_506F14 = 1;
|
|
3394 _506F18_num_minutes_to_sleep = 60;
|
|
3395 continue;
|
|
3396 case UIMSG_RentRoom:
|
|
3397 dword_506F14 = 2;
|
|
3398 RestUI_Load();
|
|
3399 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute;
|
|
3400 _506F18_num_minutes_to_sleep = v86;
|
|
3401 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) // 107 = Emerald Isle tavern
|
|
3402 _506F18_num_minutes_to_sleep = v86 + 12 * 60;
|
|
3403 dword_506F14 = 2;
|
|
3404 pParty->RestAndHeal();
|
|
3405 pParty->days_played_without_rest = 0;
|
|
3406 pParty->pPlayers[3].SetAsleep(1);
|
|
3407 pParty->pPlayers[2].SetAsleep(1);
|
|
3408 pParty->pPlayers[1].SetAsleep(1);
|
|
3409 pParty->pPlayers[0].SetAsleep(1);
|
|
3410 continue;
|
|
3411 case UIMSG_RestWindow:
|
|
3412 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
3413 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
3414 if ( pCurrentScreen )
|
|
3415 continue;
|
|
3416 if ( CheckActors_proximity() )
|
|
3417 {
|
|
3418 if ( pParty->bTurnBasedModeOn == 1 )
|
|
3419 {
|
|
3420 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
|
|
3421 continue;
|
|
3422 }
|
|
3423 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
|
|
3424 if ( pParty->uFlags & 0x88 )
|
|
3425 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
|
|
3426 ShowStatusBarString(v88, 2);
|
|
3427 if ( !uActiveCharacter )
|
|
3428 continue;
|
|
3429 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
|
|
3430 continue;
|
|
3431 }
|
|
3432 if ( pParty->bTurnBasedModeOn == 1 )
|
|
3433 {
|
|
3434 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
|
|
3435 continue;
|
|
3436 }
|
|
3437 if ( !(pParty->uFlags & 0x88) )
|
|
3438 {
|
|
3439 RestUI_Load();
|
|
3440 continue;
|
|
3441 }
|
|
3442 if ( pParty->bTurnBasedModeOn == 1 )
|
|
3443 {
|
|
3444 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
|
|
3445 continue;
|
|
3446 }
|
|
3447 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
|
|
3448 if ( pParty->uFlags & 0x88 )
|
|
3449 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
|
|
3450 ShowStatusBarString(v88, 2u);
|
|
3451 if ( !uActiveCharacter )
|
|
3452 continue;
|
|
3453 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
|
|
3454 continue;
|
|
3455 case UIMSG_Rest8Hour:
|
|
3456 if ( dword_506F14 )
|
|
3457 {
|
|
3458 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
|
2506
|
3459 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3460 continue;
|
|
3461 }
|
|
3462 if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest )
|
|
3463 {
|
|
3464 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest"
|
|
3465 if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() )
|
|
3466 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0);
|
|
3467 }
|
|
3468 else
|
|
3469 {
|
|
3470 pParty->pPlayers[3].pConditions[Condition_Sleep] = pParty->uTimePlayed;
|
|
3471 pParty->pPlayers[2].pConditions[Condition_Sleep] = pParty->uTimePlayed;
|
|
3472 pParty->pPlayers[1].pConditions[Condition_Sleep] = pParty->uTimePlayed;
|
|
3473 pParty->pPlayers[0].pConditions[Condition_Sleep] = pParty->uTimePlayed;
|
|
3474 v90 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
3475 if ( !v90 )
|
|
3476 v90 = rand() % (signed int)pMapStats->uNumMaps + 1;
|
|
3477 pMapInfo = &pMapStats->pInfos[v90];
|
|
3478 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent )
|
|
3479 {
|
|
3480 v91 = rand() % 100;
|
|
3481 v92 = pMapInfo->EncM1percent;
|
|
3482 v93 = v91 + 1;
|
|
3483 if ( v93 > v92 )
|
|
3484 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2);
|
|
3485 else
|
|
3486 pNPCData4 = (NPCData *)1;
|
|
3487 if ( !_45063B_spawn_some_monster(pMapInfo, (int)pNPCData4) )
|
|
3488 pNPCData4 = 0;
|
|
3489 if ( pNPCData4 )
|
|
3490 {
|
|
3491 pPlayerNum = rand() % 4;
|
|
3492 pParty->pPlayers[pPlayerNum].pConditions[Condition_Sleep] = 0;
|
|
3493 v95 = rand();
|
|
3494 Rest(v95 % 6 + 60);
|
|
3495 _506F18_num_minutes_to_sleep = 0;
|
|
3496 dword_506F14 = 0;
|
|
3497 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3498 {
|
|
3499 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3500 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
|
|
3501 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3502 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3503 }*/
|
|
3504 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
3505 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!"
|
2534
|
3506 pAudioPlayer->PlaySound(SOUND_encounter, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3507 continue;
|
|
3508 }
|
|
3509 }
|
|
3510 Party::TakeFood(uRestUI_FoodRequiredToRest);
|
|
3511 _506F18_num_minutes_to_sleep = 480;
|
|
3512 dword_506F14 = 2;
|
|
3513 pParty->RestAndHeal();
|
|
3514 pParty->days_played_without_rest = 0;
|
|
3515 pParty->pPlayers[3].SetAsleep(1);
|
|
3516 pParty->pPlayers[2].SetAsleep(1);
|
|
3517 pParty->pPlayers[1].SetAsleep(1);
|
|
3518 pParty->pPlayers[0].SetAsleep(1);
|
|
3519 }
|
|
3520 continue;
|
|
3521 case UIMSG_AlreadyResting:
|
|
3522 if ( dword_506F14 == 2 )
|
|
3523 {
|
|
3524 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
|
2506
|
3525 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3526 continue;
|
|
3527 }
|
|
3528 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2,
|
|
3529 (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
|
|
3530 v97 = _494820_training_time(pParty->uCurrentHour);
|
|
3531 dword_506F14 = 1;
|
|
3532 _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute;
|
|
3533 continue;
|
|
3534 case UIMSG_HintSelectRemoveQuickSpellBtn:
|
|
3535 if ( quick_spell_at_page && byte_506550 )
|
|
3536 {
|
|
3537 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName;
|
|
3538 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173);
|
|
3539 }
|
|
3540 else
|
|
3541 {
|
|
3542 if ( pPlayers[uActiveCharacter]->uQuickSpell )
|
|
3543 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell"
|
|
3544 else
|
|
3545 v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell"
|
|
3546 strcpy(pTmpBuf.data(), v177);
|
|
3547 }
|
|
3548 GameUI_SetFooterString(pTmpBuf.data());
|
|
3549 continue;
|
|
3550 case UIMSG_SPellbook_ShowHightlightedSpellInfo:
|
|
3551 if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter],
|
|
3552 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) )
|
|
3553 continue;
|
|
3554 if ( sub_4637E0_is_there_popup_onscreen() )
|
|
3555 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1;
|
|
3556 v98 = *(char *)(uNumSeconds + 6734);
|
|
3557 if ( quick_spell_at_page - 1 == uMessageParam )
|
|
3558 {
|
|
3559 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName;
|
|
3560 v161 = pGlobalTXT_LocalizationStrings[485];
|
|
3561 }
|
|
3562 else
|
|
3563 {
|
|
3564 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName;
|
|
3565 v161 = pGlobalTXT_LocalizationStrings[486];
|
|
3566 }
|
|
3567 sprintfex(pTmpBuf.data(), v161, v178);
|
|
3568 GameUI_SetFooterString(pTmpBuf.data());
|
|
3569 continue;
|
|
3570 case UIMSG_ClickInstallRemoveQuickSpellBtn:
|
|
3571 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0);
|
|
3572 if ( !uActiveCharacter )
|
|
3573 continue;
|
|
3574 pPlayer10 = pPlayers[uActiveCharacter];
|
|
3575 if ( !byte_506550 || !quick_spell_at_page )
|
|
3576 {
|
|
3577 pPlayer10->uQuickSpell = 0;
|
|
3578 quick_spell_at_page = 0;
|
2534
|
3579 pAudioPlayer->PlaySound(SOUND_fizzle, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3580 continue;
|
|
3581 }
|
|
3582 pPlayers[uActiveCharacter]->uQuickSpell = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage;
|
|
3583 AA1058_PartyQuickSpellSound[uActiveCharacter - 1].AddPartySpellSound(pPlayers[uActiveCharacter]->uQuickSpell, uActiveCharacter);
|
|
3584 if ( uActiveCharacter )
|
|
3585 pPlayer10->PlaySound(SPEECH_12, 0);
|
|
3586 byte_506550 = 0;
|
|
3587 continue;
|
|
3588 case UIMSG_SpellBook_PressTab://ïåðåëèñòûâàíèå ñòðàíèö êëàâèøåé Tab
|
|
3589 {
|
|
3590 if ( !uActiveCharacter )
|
|
3591 continue;
|
|
3592 int skill_count = 0;
|
|
3593 uAction = 0;
|
|
3594 for ( uint i = 0; i < 9; i++ )
|
|
3595 {
|
|
3596 if ( pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_FIRE + i] )
|
|
3597 {
|
|
3598 if ( pPlayers[uActiveCharacter]->lastOpenedSpellbookPage == i )
|
|
3599 uAction = skill_count;
|
|
3600 v217[skill_count++] = i;
|
|
3601 }
|
|
3602 }
|
|
3603 if ( !skill_count )//íåò ñêèëëîâ
|
2534
|
3604 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3605 else
|
|
3606 {
|
|
3607 if ( GetAsyncKeyState(VK_SHIFT) )
|
|
3608 {
|
|
3609 --uAction;
|
|
3610 if ( uAction < 0 )
|
|
3611 uAction = skill_count - 1;
|
|
3612 }
|
|
3613 else
|
|
3614 {
|
|
3615 ++uAction;
|
|
3616 if ( uAction >= skill_count )
|
|
3617 uAction = 0;
|
|
3618 }
|
|
3619 OnCloseSpellBookPage();
|
|
3620 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]);
|
|
3621 pGUIWindow_CurrentMenu->OpenSpellBook();
|
2534
|
3622 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3623 }
|
|
3624 continue;
|
|
3625 }
|
|
3626 case UIMSG_OpenSpellbookPage:
|
|
3627 if ( pTurnEngine->turn_stage == TE_MOVEMENT || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage )
|
|
3628 continue;
|
|
3629 OnCloseSpellBookPage();
|
|
3630 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam;
|
|
3631 pGUIWindow_CurrentMenu->OpenSpellBook();
|
2534
|
3632 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3633 continue;
|
|
3634 case UIMSG_SelectSpell:
|
|
3635 {
|
|
3636 if (pTurnEngine->turn_stage == TE_MOVEMENT)
|
|
3637 continue;
|
|
3638 if (!uActiveCharacter)
|
|
3639 continue;
|
|
3640
|
|
3641 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter];
|
|
3642 Player* player = pPlayers[uActiveCharacter];
|
|
3643 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam])
|
|
3644 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) )
|
|
3645 {
|
|
3646 if ( quick_spell_at_page - 1 == uMessageParam )
|
|
3647 {
|
|
3648 pGUIWindow_CurrentMenu->Release();
|
|
3649 pEventTimer->Resume();
|
|
3650 viewparams->bRedrawGameUI = 1;
|
|
3651 pCurrentScreen = SCREEN_GAME;
|
|
3652 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
3653 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage;
|
|
3654 /*if ( dword_50C9E8 < 40 )
|
|
3655 {
|
|
3656 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook;
|
|
3657 dword_50C9EC[3 * dword_50C9E8 + 1] = v103;
|
|
3658 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1;
|
|
3659 ++dword_50C9E8;
|
|
3660 }*/
|
|
3661 pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
|
|
3662 // pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
|
|
3663 }
|
|
3664 else
|
|
3665 {
|
|
3666 byte_506550 = 1;
|
|
3667 quick_spell_at_page = uMessageParam + 1;
|
|
3668 }
|
|
3669 }
|
|
3670 }
|
|
3671 continue;
|
|
3672
|
|
3673 case UIMSG_CastSpellFromBook:
|
|
3674 if ( pTurnEngine->turn_stage != TE_MOVEMENT )
|
|
3675 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0);
|
|
3676 continue;
|
|
3677
|
|
3678 case UIMSG_SpellScrollUse:
|
|
3679 __debugbreak();
|
|
3680 if ( pTurnEngine->turn_stage != TE_MOVEMENT )
|
|
3681 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0);
|
|
3682 continue;
|
|
3683 case UIMSG_SpellBookWindow:
|
|
3684 if ( pTurnEngine->turn_stage == TE_MOVEMENT )
|
|
3685 continue;
|
|
3686 if ( bUnderwater == true )
|
|
3687 {
|
|
3688 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
|
2506
|
3689 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3690 }
|
|
3691 else
|
|
3692 {
|
|
3693 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
3694 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
3695 if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery )
|
|
3696 {
|
|
3697 if ( pCurrentScreen == SCREEN_GAME )
|
|
3698 {
|
|
3699 GUIWindow::Create(476, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
|
|
3700 pCurrentScreen = SCREEN_SPELL_BOOK;
|
|
3701 pEventTimer->Pause();
|
|
3702 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_SpellBook, 0, 0);
|
2506
|
3703 pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3704 viewparams->field_48 = 1;
|
|
3705 continue;
|
|
3706 }
|
|
3707 if ( pCurrentScreen != SCREEN_REST && pCurrentScreen != SCREEN_CHARACTERS
|
|
3708 && (pCurrentScreen <= SCREEN_63 || pCurrentScreen > SCREEN_67) )
|
|
3709 {
|
|
3710 pGUIWindow_CurrentMenu->Release();
|
|
3711 GUIWindow::Create(476, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
|
|
3712 pCurrentScreen = SCREEN_SPELL_BOOK;
|
|
3713 pEventTimer->Pause();
|
|
3714 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_SpellBook, 0, 0);
|
2506
|
3715 pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3716 viewparams->field_48 = 1;
|
|
3717 continue;
|
|
3718 }
|
|
3719 }
|
|
3720 }
|
|
3721 continue;
|
|
3722 case UIMSG_QuickReference:
|
|
3723 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
3724 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
3725 if ( pCurrentScreen )
|
|
3726 pGUIWindow_CurrentMenu->Release();
|
|
3727 ++pIcons_LOD->uTexturePacksCount;
|
|
3728 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
3729 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
3730 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0);
|
|
3731 viewparams->bRedrawGameUI = 1;
|
|
3732 pEventTimer->Pause();
|
|
3733 pAudioPlayer->StopChannels(-1, -1);
|
|
3734 pCurrentScreen = SCREEN_QUICK_REFERENCE;
|
|
3735 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_QuickReference, 5, 0);
|
|
3736 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE);
|
|
3737 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0,
|
|
3738 pGlobalTXT_LocalizationStrings[79],// "Exit"
|
|
3739 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179);
|
|
3740 continue;
|
|
3741 case UIMSG_GameMenuButton:
|
|
3742 if ( pCurrentScreen )
|
|
3743 {
|
|
3744 pGUIWindow_CurrentMenu->Release();
|
|
3745 pEventTimer->Resume();
|
|
3746 pCurrentScreen = SCREEN_GAME;
|
|
3747 viewparams->bRedrawGameUI = 1;
|
|
3748 }
|
|
3749
|
|
3750 stru_506E40.Release();
|
|
3751 pRenderer->SaveScreenshot("gamma.pcx", 155, 117);
|
|
3752 stru_506E40.LoadPCXFile("gamma.pcx", 0);
|
|
3753
|
|
3754 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0);
|
|
3755 //LABEL_453:
|
|
3756 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
|
|
3757 continue;
|
|
3758 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3759 //goto LABEL_770;
|
|
3760 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
|
|
3761 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3762 ++pMessageQueue_50CBD0->uNumMessages;*/
|
|
3763 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
3764 continue;
|
|
3765 case UIMSG_ClickAwardScrollBar:
|
|
3766 books_page_number = 1;
|
|
3767 if ( pMouse->GetCursorPos(&v211)->y > 178 )
|
|
3768 books_page_number = -1;
|
|
3769 continue;
|
|
3770 case UIMSG_ClickAwardsUpBtn:
|
|
3771 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0);
|
|
3772 BtnUp_flag = 1;
|
|
3773 continue;
|
|
3774 case UIMSG_ClickAwardsDownBtn:
|
|
3775 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0);
|
|
3776 BtnDown_flag = 1;
|
|
3777 continue;
|
|
3778 case UIMSG_ChangeDetaliz:
|
|
3779 bRingsShownInCharScreen ^= 1;
|
|
3780 pCharacterScreen_DetalizBtn->Release();
|
|
3781 pCharacterScreen_DollBtn->Release();
|
|
3782 if ( bRingsShownInCharScreen )
|
|
3783 {
|
|
3784 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight;
|
|
3785 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth;
|
|
3786 v123 = 445;
|
|
3787 v121 = 470;
|
|
3788 }
|
|
3789 else
|
|
3790 {
|
|
3791 v128 = 30;
|
|
3792 v125 = 30;
|
|
3793 v123 = 300;
|
|
3794 v121 = 600;
|
|
3795 }
|
|
3796 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0,
|
|
3797 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle"
|
|
3798 0);
|
|
3799 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);
|
|
3800 viewparams->bRedrawGameUI = 1;
|
|
3801 continue;
|
|
3802 case UIMSG_ClickPaperdoll:
|
|
3803 OnPaperdollLeftClick();
|
|
3804 continue;
|
|
3805 case UIMSG_ClickStatsBtn:
|
|
3806 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
|
|
3807 CharacterUI_ReleaseButtons();
|
|
3808 ReleaseAwardsScrollBar();
|
|
3809 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0);
|
|
3810 continue;
|
|
3811 case UIMSG_ClickSkillsBtn:
|
|
3812 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
|
|
3813 CharacterUI_ReleaseButtons();
|
|
3814 ReleaseAwardsScrollBar();
|
|
3815 CharacterUI_SkillsTab_CreateButtons();
|
|
3816 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0);
|
|
3817 continue;
|
|
3818 case UIMSG_SkillUp:
|
|
3819 pPlayer4 = pPlayers[uActiveCharacter];
|
|
3820 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam];
|
|
3821 LOWORD(v2) = *(short *)v105;
|
|
3822 uNumSeconds = v2;
|
|
3823 if ( pPlayer4->uSkillPoints < (v2 & 0x3F) + 1 )
|
|
3824 {
|
|
3825 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!"
|
|
3826 }
|
|
3827 else
|
|
3828 {
|
|
3829 if ( (uNumSeconds & 0x3F) < 0x3C )
|
|
3830 {
|
|
3831 *(short *)v105 = uNumSeconds + 1;
|
|
3832 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F;
|
|
3833 pPlayer4->PlaySound(SPEECH_14, 0);
|
2534
|
3834 pAudioPlayer->PlaySound((SoundID)SOUND_quest, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
3835 continue;
|
|
3836 }
|
|
3837 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!"
|
|
3838 }
|
|
3839 ShowStatusBarString(v87, 2);
|
|
3840 continue;
|
|
3841 case UIMSG_ClickInventoryBtn:
|
|
3842 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
|
|
3843 ReleaseAwardsScrollBar();
|
|
3844 CharacterUI_ReleaseButtons();
|
|
3845 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0);
|
|
3846 continue;
|
|
3847 case UIMSG_ClickExitCharacterWindowBtn:
|
|
3848 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0);
|
|
3849 continue;
|
|
3850 case UIMSG_ClickAwardsBtn:
|
|
3851 ReleaseAwardsScrollBar();
|
|
3852 CharacterUI_ReleaseButtons();
|
|
3853 CreateAwardsScrollBar();
|
|
3854 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102;
|
|
3855 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0);
|
|
3856 FillAwardsData();
|
|
3857 continue;
|
|
3858 case UIMSG_ClickBooksBtn:
|
|
3859 switch ( uMessageParam )
|
|
3860 {
|
|
3861 case 11://Page UP
|
|
3862 BtnUp_flag = 1;
|
|
3863 pButton = pBtn_Book_2;
|
|
3864 break;
|
|
3865 case 10://Page DOWN
|
|
3866 BtnDown_flag = 1;
|
|
3867 pButton = pBtn_Book_1;
|
|
3868 break;
|
|
3869 case 0://Zoom plus
|
|
3870 pButton = pBtn_Book_1;
|
|
3871 BtnDown_flag = 1;
|
|
3872 break;
|
|
3873 case 1://Zoom minus
|
|
3874 pButton = pBtn_Book_2;
|
|
3875 BtnUp_flag = 1;
|
|
3876 break;
|
|
3877 case 2://Potions
|
|
3878 Book_PageBtn3_flag = 1;
|
|
3879 if ( dword_506364 )
|
|
3880 continue;
|
|
3881 pButton = pBtn_Book_3;
|
|
3882 break;
|
|
3883 case 3://fountains
|
|
3884 Book_PageBtn4_flag = 1;
|
|
3885 if ( dword_506364 )
|
|
3886 continue;
|
|
3887 pButton = pBtn_Book_4;
|
|
3888 break;
|
|
3889 case 4://obelisks
|
|
3890 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag
|
|
3891 if ( dword_506364 )
|
|
3892 continue;
|
|
3893 pButton = pBtn_Book_5;
|
|
3894 break;
|
|
3895 case 5://seer
|
|
3896 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag
|
|
3897 if ( dword_506364 )
|
|
3898 continue;
|
|
3899 pButton = pBtn_Book_6;
|
|
3900 break;
|
|
3901 case 6://misc
|
|
3902 pButton = pBtn_Autonotes_Misc;
|
|
3903 Autonotes_Misc_page_flag = 1;
|
|
3904 break;
|
|
3905 case 7://Instructors
|
|
3906 pButton = pBtn_Autonotes_Instructors;
|
|
3907 Autonotes_Instructors_page_flag = 1;
|
|
3908 break;
|
|
3909 default:
|
|
3910 continue;
|
|
3911 }
|
|
3912 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1);
|
|
3913 continue;
|
|
3914 case UIMSG_SelectCharacter:
|
|
3915 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
3916 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
3917 GameUI_OnPlayerPortraitLeftClick(uMessageParam);
|
|
3918 continue;
|
|
3919 case UIMSG_ShowStatus_Funds:
|
|
3920 v174 = (char *)pParty->uNumGoldInBank;
|
|
3921 //v158 = pParty->uNumGold + pParty->uNumGoldInBank;
|
|
3922 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], pParty->uNumGold + pParty->uNumGoldInBank, v174);// "You have %d total gold, %d in the Bank"
|
|
3923 GameUI_SetFooterString(pTmpBuf.data());
|
|
3924 continue;
|
|
3925 case UIMSG_ShowStatus_DateTime:
|
|
3926 currHour = pParty->uCurrentHour;
|
|
3927 uNumSeconds = 1;
|
|
3928 if (pParty->uCurrentHour > 12 )
|
|
3929 {
|
|
3930 if (pParty->uCurrentHour >= 24)
|
|
3931 uNumSeconds = 0;
|
|
3932 currHour = (currHour - 12);
|
|
3933 }
|
|
3934 else
|
|
3935 {
|
|
3936 if (pParty->uCurrentHour < 12) // 12:00 is PM
|
|
3937 uNumSeconds = 0;
|
|
3938 if (pParty->uCurrentHour == 0)
|
|
3939 currHour = 12;
|
|
3940 }
|
|
3941 sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", currHour, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7],
|
|
3942 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear);
|
|
3943 GameUI_SetFooterString(pTmpBuf.data());
|
|
3944 continue;
|
|
3945 case UIMSG_ShowStatus_Food:
|
|
3946 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food"
|
|
3947 GameUI_SetFooterString(pTmpBuf.data());
|
|
3948 continue;
|
|
3949 case UIMSG_ShowStatus_Player:
|
|
3950 pPlayer5 = pPlayers[uMessageParam];
|
|
3951 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s"
|
|
3952 strcat(pTmpBuf.data(), ": ");
|
|
3953 v107 = pPlayer5->GetMajorConditionIdx();
|
|
3954 strcat(pTmpBuf.data(), aCharacterConditionNames[v107]);
|
|
3955 GameUI_SetFooterString(pTmpBuf.data());
|
|
3956 v108 = 8 * uMessageParam - 8;
|
|
3957 LOBYTE(v108) = v108 | 4;
|
|
3958 pMouse->uPointingObjectID = PID(OBJECT_Player,v108);
|
|
3959 continue;
|
|
3960 case UIMSG_ShowStatus_ManaHP:
|
|
3961 sprintf(pTmpBuf.data(), "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(),
|
|
3962 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(),
|
|
3963 pGlobalTXT_LocalizationStrings[212]);
|
|
3964 GameUI_SetFooterString(pTmpBuf.data());
|
|
3965 continue;
|
|
3966 case UIMSG_CHEST_ClickItem:
|
|
3967 if ( pCurrentScreen == SCREEN_CHEST_INVENTORY )
|
|
3968 {
|
|
3969 pPlayers[uActiveCharacter]->OnInventoryLeftClick();
|
|
3970 continue;
|
|
3971 }
|
|
3972 Chest::OnChestLeftClick();
|
|
3973 continue;
|
|
3974 case UIMSG_InventoryLeftClick:
|
|
3975 pPlayers[uActiveCharacter]->OnInventoryLeftClick();
|
|
3976 continue;
|
|
3977 case UIMSG_MouseLeftClickInGame:
|
|
3978 /*if ( !pRenderer->pRenderD3D )
|
|
3979 {
|
|
3980 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
3981 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
3982 OnGameViewportClick();
|
|
3983 continue;
|
|
3984 }*/
|
|
3985 v115 = pMessageQueue_50CBD0->uNumMessages;
|
|
3986 if ( !pMessageQueue_50CBD0->uNumMessages )
|
|
3987 {
|
|
3988 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
|
|
3989 /*if ( (signed int)v115 < 40 )
|
|
3990 //goto LABEL_769;
|
|
3991 {
|
|
3992 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
|
|
3993 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
|
|
3994 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3995 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3996 continue;
|
|
3997 }*/
|
|
3998 continue;
|
|
3999 }
|
|
4000 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
|
|
4001 {
|
|
4002 pMessageQueue_50CBD0->uNumMessages = 1;
|
|
4003 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
|
|
4004 /*v115 = v0;
|
|
4005 pMessageQueue_50CBD0->uNumMessages = v0;
|
|
4006 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
|
|
4007 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
|
|
4008 //goto LABEL_771;
|
|
4009 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
4010 ++pMessageQueue_50CBD0->uNumMessages;*/
|
|
4011 continue;
|
|
4012 }
|
|
4013 v115 = 0;
|
|
4014 pMessageQueue_50CBD0->uNumMessages = 0;
|
|
4015 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
|
|
4016 /*if ( (signed int)v115 < 40 )
|
|
4017 //goto LABEL_769;
|
|
4018 {
|
|
4019 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
|
|
4020 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
|
|
4021 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
4022 ++pMessageQueue_50CBD0->uNumMessages;
|
|
4023 continue;
|
|
4024 }*/
|
|
4025 continue;
|
|
4026 case UIMSG_MouseLeftClickInScreen://ñðàáàòûâàåò ïðè íàæàòèè íà ïðàâóþ êíîïêó ìûøè ïîñëå UIMSG_MouseLeftClickInGame
|
|
4027 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
4028 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
4029 OnGameViewportClick();
|
|
4030 continue;
|
|
4031 case UIMSG_F:
|
|
4032 __debugbreak();
|
|
4033 //if ( pRenderer->pRenderD3D )
|
|
4034 {
|
|
4035 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val();
|
|
4036 }
|
|
4037 /*else
|
|
4038 {
|
|
4039 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209);
|
|
4040 pPoint3 = pMouse->GetCursorPos(&v204);
|
|
4041 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]];
|
|
4042 }*/
|
|
4043 pButton2 = (GUIButton *)(unsigned __int16)v116;
|
|
4044 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0);
|
|
4045 continue;
|
|
4046 case UIMSG_54:
|
|
4047 __debugbreak();
|
|
4048 pButton2 = (GUIButton *)uMessageParam;
|
|
4049 GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0);
|
|
4050 continue;
|
|
4051 case UIMSG_Game_Action:
|
|
4052 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
4053 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
4054 OnPressSpace();
|
|
4055 continue;
|
|
4056 case UIMSG_ClickZoomOutBtn:
|
|
4057 if ( pCurrentScreen )
|
|
4058 continue;
|
|
4059 pParty->uFlags |= 2u;
|
|
4060 GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0);
|
|
4061 uNumSeconds = 131072;
|
|
4062 v118 = 2 * viewparams->uMinimapZoom;
|
|
4063 ++viewparams->field_28;
|
|
4064 viewparams->uMinimapZoom *= 2;
|
|
4065 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
|
|
4066 {
|
|
4067 if ( (signed int)v118 > 4096 )
|
|
4068 {
|
|
4069 viewparams->uMinimapZoom = 4096;
|
|
4070 viewparams->field_28 = 12;
|
|
4071 }
|
|
4072 continue;
|
|
4073 }
|
|
4074 v119 = 2048;
|
|
4075 if ( (signed int)v118 <= 2048 )
|
|
4076 {
|
|
4077 _576E2C_current_minimap_zoom = v118;
|
|
4078 dword_576E28 = viewparams->field_28;
|
|
4079 break;
|
|
4080 }
|
|
4081 viewparams->field_28 = 11;
|
|
4082 viewparams->uMinimapZoom = v119;
|
|
4083 _576E2C_current_minimap_zoom = v119;
|
|
4084 dword_576E28 = viewparams->field_28;
|
|
4085 break;
|
|
4086 case UIMSG_ClickZoomInBtn:
|
|
4087 if ( pCurrentScreen )
|
|
4088 continue;
|
|
4089 pParty->uFlags |= 2u;
|
|
4090 GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0);
|
|
4091 uNumSeconds = 32768;
|
|
4092 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16;
|
|
4093 --viewparams->field_28;
|
|
4094 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16;
|
|
4095 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
4096 {
|
|
4097 v119 = 512;
|
|
4098 if ( (signed int)v118 < 512 )
|
|
4099 {
|
|
4100 viewparams->field_28 = 9;
|
|
4101 v118 = v119;
|
|
4102 viewparams->uMinimapZoom = v119;
|
|
4103 }
|
|
4104 _576E2C_current_minimap_zoom = v118;
|
|
4105 dword_576E28 = viewparams->field_28;
|
|
4106 }
|
|
4107 else
|
|
4108 {
|
|
4109 if ( (signed int)v118 < 256 )
|
|
4110 {
|
|
4111 viewparams->uMinimapZoom = 256;
|
|
4112 viewparams->field_28 = 8;
|
|
4113 }
|
|
4114 }
|
|
4115 default:
|
|
4116 continue;
|
|
4117 }
|
|
4118 }
|
|
4119 }
|
|
4120 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8;
|
|
4121 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages);
|
|
4122 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8);
|
|
4123 //dword_50C9E8 = 0;
|
|
4124
|
|
4125
|
|
4126 pMessageQueue_50C9E8->uNumMessages=0;
|
|
4127 if ( dword_50C9DC )
|
|
4128 {
|
|
4129 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
4130 {
|
|
4131 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC;
|
|
4132 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0;
|
|
4133 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
4134 ++pMessageQueue_50CBD0->uNumMessages;
|
|
4135 }*/
|
|
4136 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0);
|
|
4137 dword_50C9DC = 0;
|
|
4138 }
|
|
4139 else
|
|
4140 {
|
|
4141 if ( _50C9D0_AfterEnchClickEventId > 0 )
|
|
4142 {
|
|
4143 _50C9D8_AfterEnchClickEventTimeout -= pEventTimer->uTimeElapsed;
|
|
4144 if ( _50C9D8_AfterEnchClickEventTimeout <= 0 )
|
|
4145 {
|
|
4146 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
4147 {
|
|
4148 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0;
|
|
4149 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4;
|
|
4150 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
4151 ++pMessageQueue_50CBD0->uNumMessages;
|
|
4152 }*/
|
|
4153 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)_50C9D0_AfterEnchClickEventId, _50C9D4_AfterEnchClickEventSecondParam, 0);
|
|
4154 _50C9D0_AfterEnchClickEventId = 0;
|
|
4155 _50C9D4_AfterEnchClickEventSecondParam = 0;
|
|
4156 _50C9D8_AfterEnchClickEventTimeout = 0;
|
|
4157 }
|
|
4158 }
|
|
4159 }
|
|
4160 CastSpellInfoHelpers::_427E01_cast_spell();
|
|
4161 }
|
|
4162 //----- (00435748) --------------------------------------------------------
|
|
4163 void GUI_MainMenuMessageProc()
|
|
4164 {
|
|
4165 Player *pPlayer; // ebx@2
|
|
4166 void *v3; // edi@21
|
|
4167 signed int v4; // eax@29
|
|
4168 // int v5; // ecx@29
|
|
4169 // PLAYER_SKILL_TYPE v6; // edi@37
|
|
4170 GUIWindow *pWindow; // eax@56
|
|
4171 GUIButton *pButton; // eax@59
|
|
4172 int v15; // edi@70
|
|
4173 char v20; // dl@116
|
|
4174 unsigned int v21; // eax@116
|
|
4175 unsigned int v25; // eax@120
|
|
4176 unsigned int v26; // ecx@127
|
|
4177 // SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36
|
|
4178 // signed int v41; // [sp-10h] [bp-20h]@29
|
|
4179 int pParam; // [sp+4h] [bp-Ch]@3
|
|
4180 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3
|
|
4181 int pSex; // [sp+Ch] [bp-4h]@3
|
|
4182
|
|
4183 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
4184 {
|
|
4185 pPlayer = pParty->pPlayers.data();
|
|
4186 do
|
|
4187 {
|
|
4188 int param2;
|
|
4189 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, ¶m2);
|
|
4190 //auto player = &pParty->pPlayers[pParam];
|
|
4191
|
|
4192 switch (pUIMessageType) // For buttons of window MainMenu
|
|
4193 {
|
|
4194 case UIMSG_MainMenu_ShowPartyCreationWnd:
|
|
4195 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
|
|
4196 SetCurrentMenuID(MENU_NEWGAME);
|
|
4197 break;
|
|
4198 case UIMSG_MainMenu_ShowLoadWindow:
|
|
4199 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0);
|
|
4200 SetCurrentMenuID(MENU_SAVELOAD);
|
|
4201 break;
|
|
4202 case UIMSG_ShowCredits:
|
|
4203 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0);
|
|
4204 SetCurrentMenuID(MENU_CREDITS);
|
|
4205 break;
|
|
4206 case UIMSG_ExitToWindows:
|
|
4207 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
|
|
4208 SetCurrentMenuID(MENU_EXIT_GAME);
|
|
4209 break;
|
|
4210 case UIMSG_PlayerCreation_SelectAttribute:
|
|
4211 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
|
|
4212 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
|
|
4213 uPlayerCreationUI_SelectedCharacter = pParam;
|
2534
|
4214 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4215 break;
|
|
4216 case UIMSG_PlayerCreation_VoicePrev:
|
|
4217 pSex = pParty->pPlayers[pParam].GetSexByVoice();
|
|
4218 do
|
|
4219 {
|
|
4220 if (pParty->pPlayers[pParam].uVoiceID == 0)
|
|
4221 pParty->pPlayers[pParam].uVoiceID = 19;
|
|
4222 else --pParty->pPlayers[pParam].uVoiceID;
|
|
4223 }
|
|
4224 while (pParty->pPlayers[pParam].GetSexByVoice() != pSex);
|
|
4225 pButton = pCreationUI_BtnPressLeft2[pParam];
|
|
4226 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1);
|
2534
|
4227 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4228 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0);
|
|
4229 break;
|
|
4230 case UIMSG_PlayerCreation_VoiceNext:
|
|
4231 pSex = pParty->pPlayers[pParam].GetSexByVoice();
|
|
4232 do
|
|
4233 {
|
|
4234 pParty->pPlayers[pParam].uVoiceID = (pParty->pPlayers[pParam].uVoiceID + 1) % 20;
|
|
4235 }
|
|
4236 while (pParty->pPlayers[pParam].GetSexByVoice() != pSex);
|
|
4237 pButton = pCreationUI_BtnPressRight2[pParam];
|
|
4238 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1);
|
2534
|
4239 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4240 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0);
|
|
4241 break;
|
|
4242 case UIMSG_PlayerCreation_FacePrev:
|
|
4243 //pPlayer = &pParty->pPlayers[pParam];
|
|
4244 if (!pParty->pPlayers[pParam].uCurrentFace)
|
|
4245 pParty->pPlayers[pParam].uCurrentFace = 19;
|
|
4246 else
|
|
4247 pParty->pPlayers[pParam].uCurrentFace -= 1;
|
|
4248 pParty->pPlayers[pParam].uVoiceID = pParty->pPlayers[pParam].uCurrentFace;
|
|
4249 pParty->pPlayers[pParam].SetInitialStats();
|
|
4250 pParty->pPlayers[pParam].SetSexByVoice();
|
|
4251 pParty->pPlayers[pParam].RandomizeName();
|
|
4252 v25 = pParam;
|
|
4253 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
|
|
4254 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
|
|
4255 uPlayerCreationUI_SelectedCharacter = v25;
|
|
4256 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], (char *)1);
|
2534
|
4257 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0.0, 0);
|
2499
|
4258 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0);
|
|
4259 break;
|
|
4260 case UIMSG_PlayerCreation_FaceNext:
|
|
4261 //pPlayer = &pParty->pPlayers[pParam];
|
|
4262 v20 = (char)((int)pParty->pPlayers[pParam].uCurrentFace + 1) % 20;
|
|
4263 pParty->pPlayers[pParam].uCurrentFace = v20;
|
|
4264 pParty->pPlayers[pParam].uVoiceID = v20;
|
|
4265 pParty->pPlayers[pParam].SetInitialStats();
|
|
4266 pParty->pPlayers[pParam].SetSexByVoice();
|
|
4267 pParty->pPlayers[pParam].RandomizeName();
|
|
4268 v21 = pParam;
|
|
4269 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
|
|
4270 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
|
|
4271 uPlayerCreationUI_SelectedCharacter = v21;
|
|
4272 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], (char *)1);
|
2534
|
4273 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4274 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0);
|
|
4275 break;
|
|
4276 case UIMSG_PlayerCreationClickPlus:
|
|
4277 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, (char *)1);
|
|
4278 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
|
2534
|
4279 pAudioPlayer->PlaySound(SOUND_ClickMinus, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4280 break;
|
|
4281 case UIMSG_PlayerCreationClickMinus:
|
|
4282 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, (char *)1);
|
|
4283 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
|
2534
|
4284 pAudioPlayer->PlaySound(SOUND_ClickPlus, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4285 break;
|
|
4286 case UIMSG_PlayerCreationSelectActiveSkill:
|
|
4287 if ( pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37 )
|
|
4288 pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pParam + 4)] = 1;
|
2534
|
4289 pAudioPlayer->PlaySound(SOUND_ClickSkill, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4290 break;
|
|
4291 case UIMSG_PlayerCreationSelectClass:
|
|
4292 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam);
|
2534
|
4293 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4294 break;
|
|
4295 case UIMSG_PlayerCreationClickOK:
|
|
4296 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0);
|
|
4297 if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills() )
|
|
4298 GameUI_Footer_TimeLeft = GetTickCount() + 4000;
|
|
4299 else
|
|
4300 uGameState = GAME_STATE_STARTING_NEW_GAME;
|
|
4301 break;
|
|
4302 case UIMSG_PlayerCreationClickReset:
|
|
4303 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0);
|
|
4304 pParty->Reset();
|
|
4305 break;
|
|
4306 case UIMSG_PlayerCreationRemoveUpSkill:
|
|
4307 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
|
|
4308 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
|
|
4309 if ( pPlayer[pParam].GetSkillIdxByOrder(2) != 37 )//37 - None(Íåò)
|
|
4310 pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(2)] = 0;
|
|
4311 break;
|
|
4312 case UIMSG_PlayerCreationRemoveDownSkill:
|
|
4313 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
|
|
4314 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
|
|
4315 if ( pPlayer[pParam].GetSkillIdxByOrder(3) != 37 )//37 - None(Íåò)
|
|
4316 pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(3)] = 0;
|
|
4317 break;
|
|
4318 case UIMSG_PlayerCreationChangeName:
|
2534
|
4319 pAudioPlayer->PlaySound(SOUND_ClickSkill, 0, 0, -1, 0, 0, 0, 0);
|
2499
|
4320 v3 = (void *)pParam;
|
|
4321 uPlayerCreationUI_SelectedCharacter = pParam;
|
|
4322 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
|
|
4323 pGUIWindow_CurrentMenu->ptr_1C = v3;
|
|
4324 break;
|
|
4325 case UIMSG_ChangeGameState:
|
|
4326 uGameState = GAME_FINISHED;
|
|
4327 break;
|
|
4328 case UIMSG_ChangeCursor:
|
|
4329 pMouse->SetCursorBitmap("MICON2");
|
|
4330 break;
|
|
4331 case UIMSG_3A:
|
|
4332 SetCurrentMenuID(MENU_DebugBLVLevel);
|
|
4333 break;
|
|
4334 case UIMSG_LoadGame:
|
|
4335 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
|
|
4336 break;
|
|
4337 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
|
|
4338 break;
|
|
4339 case UIMSG_SelectLoadSlot:
|
|
4340 //main menu save/load wnd clicking on savegame lines
|
|
4341 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
|
|
4342 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
|
|
4343 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition )
|
|
4344 {
|
|
4345 //load clicked line
|
|
4346 v26 = pParam + pSaveListPosition;
|
|
4347 if ( dword_6BE138 == pParam + pSaveListPosition )
|
|
4348 {
|
|
4349 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0);
|
|
4350 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
|
|
4351 }
|
|
4352 uLoadGameUI_SelectedSlot = v26;
|
|
4353 dword_6BE138 = v26;
|
|
4354 }
|
|
4355 else
|
|
4356 {
|
|
4357 //typing in the line
|
|
4358 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
|
|
4359 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
|
|
4360 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
|
|
4361 }
|
|
4362 break;
|
|
4363 case UIMSG_SaveLoadBtn:
|
|
4364 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
|
|
4365 break;
|
|
4366 case UIMSG_DownArrow:
|
|
4367 ++pSaveListPosition;
|
|
4368 if ( pSaveListPosition >= pParam )
|
|
4369 pSaveListPosition = pParam - 1;
|
|
4370 if ( pSaveListPosition < 1 )
|
|
4371 pSaveListPosition = 0;
|
|
4372 pWindow = pGUIWindow_CurrentMenu;
|
|
4373 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0);
|
|
4374 break;
|
|
4375 case UIMSG_Cancel:
|
|
4376 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0);
|
|
4377 break;
|
|
4378 case UIMSG_ArrowUp:
|
|
4379 --pSaveListPosition;
|
|
4380 if ( pSaveListPosition < 0 )
|
|
4381 pSaveListPosition = 0;
|
|
4382 pWindow = pGUIWindow_CurrentMenu;
|
|
4383 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0);
|
|
4384 break;
|
|
4385 case UIMSG_AD:
|
|
4386 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
|
|
4387 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
|
|
4388 break;
|
|
4389 case UIMSG_AE:
|
|
4390 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
|
|
4391 SetCurrentMenuID(MENU_DebugBLVLevel);
|
|
4392 break;
|
|
4393 case UIMSG_Escape:
|
|
4394 if ( pModalWindow )
|
|
4395 {
|
|
4396 ModalWindow_Release();
|
|
4397 break;
|
|
4398 }
|
|
4399 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_4000))
|
|
4400 break;
|
|
4401 v15 = 1;
|
|
4402 pMediaPlayer->bStopBeforeSchedule = 1;
|
|
4403 viewparams->bRedrawGameUI = 1;
|
|
4404 viewparams->field_48 = 1;
|
|
4405 if ( GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_MMT_MAIN_MENU
|
|
4406 || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC )
|
|
4407 {
|
|
4408 //if ( pCurrentScreen == SCREEN_VIDEO )
|
|
4409 //pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag);
|
|
4410 if (GetCurrentMenuID() == MENU_NAMEPANELESC) //èç ïàíåëè èçìåíåíèÿ èìåíè
|
|
4411 {
|
|
4412 SetCurrentMenuID(MENU_CREATEPARTY);//â îêíî ñîçäàíèÿ ãðóïïû
|
|
4413 break;
|
|
4414 }
|
|
4415 if (GetCurrentMenuID() == MENU_CREDITSPROC) //èç îêíà Ñîçäàòåëè
|
|
4416 {
|
|
4417 SetCurrentMenuID(MENU_CREDITSCLOSE);//â çàêðûòèå Ñîçäàòåëè
|
|
4418 break;
|
|
4419 }
|
|
4420 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
|
|
4421 break;
|
|
4422 }
|
|
4423 if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen )
|
|
4424 {
|
|
4425 //if ( pCurrentScreen == SCREEN_VIDEO )
|
|
4426 //pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag);
|
|
4427 if (GetCurrentMenuID() == MENU_NAMEPANELESC)
|
|
4428 {
|
|
4429 SetCurrentMenuID(MENU_CREATEPARTY);
|
|
4430 break;
|
|
4431 }
|
|
4432 if (GetCurrentMenuID() == MENU_CREDITSPROC)
|
|
4433 {
|
|
4434 SetCurrentMenuID(MENU_CREDITSCLOSE);
|
|
4435 break;
|
|
4436 }
|
|
4437 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
|
|
4438 break;
|
|
4439 }
|
|
4440 if ( pCurrentScreen == SCREEN_LOADGAME )
|
|
4441 {
|
|
4442 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
4443 //crt_deconstruct_ptr_6A0118();
|
|
4444 pTexture_PCX.Release();
|
|
4445 pTexture_PCX.Load("title.pcx", 0);
|
|
4446 SetCurrentMenuID(MENU_MAIN);
|
|
4447 v15 = 1;
|
|
4448 pGUIWindow_CurrentMenu->Release();
|
|
4449 pGUIWindow2->Release();
|
|
4450 pGUIWindow2 = 0;
|
|
4451 pEventTimer->Resume();
|
|
4452 pCurrentScreen = SCREEN_GAME;
|
|
4453 viewparams->bRedrawGameUI = v15;
|
|
4454 break;
|
|
4455 }
|
|
4456 if ( pCurrentScreen == SCREEN_VIDEO )
|
|
4457 {
|
|
4458 //pVideoPlayer->Unload();
|
|
4459 }
|
|
4460 else
|
|
4461 {
|
|
4462 if ( pCurrentScreen != SCREEN_1B )
|
|
4463 {
|
|
4464 pGUIWindow_CurrentMenu->Release();
|
|
4465 pGUIWindow2->Release();
|
|
4466 pGUIWindow2 = 0;
|
|
4467 pEventTimer->Resume();
|
|
4468 pCurrentScreen = SCREEN_GAME;
|
|
4469 viewparams->bRedrawGameUI = v15;
|
|
4470 break;
|
|
4471 }
|
|
4472 //VideoPlayer::dtor();
|
|
4473 }
|
|
4474 break;
|
|
4475 default:
|
|
4476 break;
|
|
4477 }
|
|
4478 }
|
|
4479 while ( pMessageQueue_50CBD0->uNumMessages );
|
|
4480 }
|
|
4481 }
|
|
4482
|
|
4483
|
|
4484
|
|
4485 //----- (0042FBDD) --------------------------------------------------------
|
|
4486 void sub_42FBDD()
|
|
4487 {
|
2506
|
4488 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2524
|
4489 pRenderer->DrawTextureIndexedAlpha(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]);
|
2499
|
4490 pRenderer->Present();
|
|
4491 }
|
|
4492
|
|
4493 //----- (0042FC15) --------------------------------------------------------
|
|
4494 void CloseWindowBackground()
|
|
4495 {
|
2506
|
4496 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, -2, 0, -1, 0, 0, 0, 0);
|
2524
|
4497 pRenderer->DrawTextureIndexedAlpha(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]);
|
2499
|
4498 pRenderer->Present();
|
|
4499 }
|
|
4500
|
|
4501
|
|
4502 //----- (0046BDC0) --------------------------------------------------------
|
|
4503 void UpdateUserInput_and_MapSpecificStuff()
|
|
4504 {
|
|
4505 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME)
|
|
4506 {
|
|
4507 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME;
|
|
4508 return;
|
|
4509 }
|
|
4510
|
|
4511 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
4512 BLV_UpdateUserInputAndOther();
|
|
4513 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
4514 ODM_UpdateUserInputAndOther();
|
|
4515
|
|
4516 area_of_effect__damage_evaluate();
|
|
4517 }
|
|
4518
|
|
4519 //----- (004646F0) --------------------------------------------------------
|
|
4520 void PrepareWorld(unsigned int _0_box_loading_1_fullscreen)
|
|
4521 {
|
|
4522 //if ( pRenderer->pRenderD3D )
|
|
4523 pGame->pVisInstance->_4C1A02();
|
|
4524 pEventTimer->Pause();
|
|
4525 pMiscTimer->Pause();
|
|
4526 pParty->uFlags = 2;
|
|
4527 CastSpellInfoHelpers::_427D48();
|
|
4528 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
|
|
4529 DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1);
|
|
4530 pMiscTimer->Resume();
|
|
4531 pEventTimer->Resume();
|
|
4532 }
|
|
4533
|
|
4534 //----- (00464866) --------------------------------------------------------
|
|
4535 void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box)
|
|
4536 {
|
|
4537 char *v3; // eax@1
|
|
4538 unsigned int v5; // eax@3
|
|
4539 char Str1[20]; // [sp+Ch] [bp-18h]@1
|
|
4540 unsigned int v9; // [sp+20h] [bp-4h]@1
|
|
4541
|
|
4542 v9 = bLoading;
|
|
4543 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
|
|
4544 pDecalBuilder->Reset(0);
|
|
4545 pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen :
|
|
4546 GUIProgressBar::TYPE_Box);
|
|
4547 strcpy(Str1, pCurrentMapName);
|
|
4548 v3 = strtok(Str1, ".");
|
|
4549 strcpy(Str1, v3);
|
|
4550 Level_LoadEvtAndStr(Str1);
|
|
4551 LoadLevel_InitializeLevelEvt();
|
|
4552 strcpy(Str1, pCurrentMapName);
|
|
4553 _strrev(Str1);
|
|
4554 strtok(Str1, ".");
|
|
4555 _strrev(Str1);
|
|
4556
|
|
4557 for (uint i = 0; i < 1000; ++i)
|
|
4558 pSpriteObjects[i].uObjectDescID = 0;
|
|
4559
|
|
4560 v5 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
4561 bUnderwater = false;
|
|
4562 uLevelMapStatsID = v5;
|
|
4563 pGame->uFlags2 &= 0xFFFFFFF7u;
|
|
4564 if (!_stricmp(pCurrentMapName, "out15.odm"))
|
|
4565 {
|
|
4566 bUnderwater = true;
|
|
4567 pGame->uFlags2 |= GAME_FLAGS_2_ALTER_GRAVITY;
|
|
4568 }
|
|
4569 pParty->floor_face_pid = 0;
|
|
4570 if (_stricmp(Str1, "blv"))
|
|
4571 PrepareToLoadODM(v9, 0);
|
|
4572 else
|
|
4573 PrepareToLoadBLV(v9);
|
|
4574 pAudioPlayer->SetMapEAX();
|
|
4575 _461103_load_level_sub();
|
|
4576 if (!_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv"))
|
|
4577 {
|
|
4578 //spawning grounds & walls of mist - no loot & exp from monsters
|
|
4579
|
|
4580 for (uint i = 0; i < uNumActors; ++i)
|
|
4581 {
|
|
4582 pActors[i].pMonsterInfo.uTreasureType = 0;
|
|
4583 pActors[i].pMonsterInfo.uTreasureDiceRolls = 0;
|
|
4584 pActors[i].pMonsterInfo.uExp = 0;
|
|
4585 }
|
|
4586 }
|
|
4587 bDialogueUI_InitializeActor_NPC_ID = 0;
|
|
4588 OnMapLoad();
|
|
4589 pGameLoadingUI_ProgressBar->Progress();
|
|
4590 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D));
|
|
4591 pGameLoadingUI_ProgressBar->Release();
|
|
4592 _flushall();
|
|
4593 }
|
|
4594
|
|
4595 void IntegrityTest()
|
|
4596 {
|
|
4597 static_assert(sizeof(MovieHeader) == 44, "Wrong type size");
|
|
4598 static_assert(sizeof(SoundDesc_mm6) == 112, "Wrong type size");
|
|
4599 static_assert(sizeof(SoundDesc) == 120, "Wrong type size");
|
|
4600 static_assert(sizeof(OverlayDesc) == 8, "Wrong type size");
|
|
4601 static_assert(sizeof(ChestDesc) == 36, "Wrong type size");
|
|
4602 static_assert(sizeof(ObjectDesc_mm6) == 52, "Wrong type size");
|
|
4603 static_assert(sizeof(ObjectDesc) == 56, "Wrong type size");
|
|
4604 static_assert(sizeof(DecorationDesc) == 84, "Wrong type size");
|
|
4605 static_assert(sizeof(IconFrame) == 32, "Wrong type size");
|
|
4606 static_assert(sizeof(PlayerFrame) == 10, "Wrong type size");
|
|
4607 static_assert(sizeof(TextureFrame) == 20, "Wrong type size");
|
|
4608 static_assert(sizeof(SpriteFrame) == 60, "Wrong type size");
|
|
4609 static_assert(sizeof(RenderVertexSoft) == 0x30, "Wrong type size");
|
|
4610 static_assert(sizeof(RenderBillboard) == 0x34, "Wrong type size");
|
|
4611 static_assert(sizeof(Texture) == 0x48, "Wrong type size");
|
2518
|
4612 //static_assert(sizeof(RGBTexture) == 0x28, "Wrong type size");
|
2499
|
4613 //static_assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4, "Wrong type size"); // + virtual dtor ptr
|
|
4614 static_assert(sizeof(AudioPlayer) == 0xC84, "Wrong type size");
|
|
4615 static_assert(sizeof(SoundDesc) == 0x78, "Wrong type size");
|
|
4616 static_assert(sizeof(stru339_spell_sound) == 0xAFD8, "Wrong type size");
|
|
4617 //static_assert(sizeof(VideoPlayer) == 0x108 + 4, "Wrong type size");
|
|
4618 static_assert(sizeof(MovieHeader) == 0x2C, "Wrong type size");
|
|
4619 static_assert(sizeof(DecorationDesc) == 0x54, "Wrong type size");
|
|
4620 static_assert(sizeof(ObjectDesc) == 0x38, "Wrong type size");
|
|
4621 static_assert(sizeof(OverlayDesc) == 0x8, "Wrong type size");
|
|
4622 static_assert(sizeof(ChestDesc) == 0x24, "Wrong type size");
|
|
4623 static_assert(sizeof(TileDesc) == 0x1A, "Wrong type size");
|
|
4624 static_assert(sizeof(MonsterDesc_mm6) == 148, "Wrong type size");
|
|
4625 static_assert(sizeof(MonsterDesc) == 152, "Wrong type size");
|
|
4626 static_assert(sizeof(Timer) == 0x28, "Wrong type size");
|
|
4627 static_assert(sizeof(OtherOverlay) == 0x14, "Wrong type size");
|
|
4628 static_assert(sizeof(ItemGen) == 0x24, "Wrong type size");
|
|
4629 static_assert(sizeof(SpriteObject) == 0x70, "Wrong type size");
|
|
4630 static_assert(sizeof(ItemDesc) == 0x30, "Wrong type size");
|
|
4631 static_assert(sizeof(ItemsTable) == 0x117A0, "Wrong type size");
|
|
4632 static_assert(sizeof(Chest) == 0x14CC, "Wrong type size");
|
|
4633 static_assert(sizeof(MapInfo) == 0x44, "Wrong type size");
|
|
4634 static_assert(sizeof(SpellInfo) == 0x24, "Wrong type size");
|
|
4635 static_assert(sizeof(SpellData) == 0x14, "Wrong type size");
|
|
4636 static_assert(sizeof(SpellBuff) == 0x10, "Wrong type size");
|
|
4637 static_assert(sizeof(AIDirection) == 0x1C, "Wrong type size");
|
|
4638 static_assert(sizeof(ActorJob) == 0xC, "Wrong type size");
|
|
4639 static_assert(sizeof(Actor) == 0x344, "Wrong type size");
|
|
4640 static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size");
|
|
4641 static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size");
|
|
4642 static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size");
|
|
4643 static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size");
|
|
4644 static_assert(sizeof(ODMFace) == 0x134, "Wrong type size");
|
|
4645 static_assert(sizeof(BSPNode) == 0x8, "Wrong type size");
|
|
4646 static_assert(sizeof(BSPModel) == 0xBC, "Wrong type size");
|
|
4647 static_assert(sizeof(OutdoorLocation) == 0x1C28C, "Wrong type size");
|
|
4648 static_assert(sizeof(BLVFace) == 0x60, "Wrong type size");
|
|
4649 static_assert(sizeof(BLVFaceExtra) == 0x24, "Wrong type size");
|
|
4650 static_assert(sizeof(BLVSector) == 0x74, "Wrong type size");
|
|
4651 static_assert(sizeof(BLVLightMM7) == 0x10, "Wrong type size");
|
|
4652 static_assert(sizeof(BLVDoor) == 0x50, "Wrong type size");
|
|
4653 static_assert(sizeof(IndoorLocation) == 0x690, "Wrong type size");
|
|
4654 //static_assert(sizeof(ODMRenderParams) == 0x74, "Wrong type size");
|
|
4655 static_assert(sizeof(Mouse) == 0x114, "Wrong type size");
|
|
4656 static_assert(sizeof(Particle_sw) == 0x68, "Wrong type size");
|
|
4657 static_assert(sizeof(Particle) == 0x68, "Wrong type size");
|
|
4658 static_assert(sizeof(ParticleEngine) == 0xE430, "Wrong type size");
|
|
4659 static_assert(sizeof(Lightmap) == 0xC1C, "Wrong type size");
|
|
4660 static_assert(sizeof(LightmapBuilder) == 0x3CBC38, "Wrong type size");
|
|
4661 static_assert(sizeof(Vis_SelectionList) == 0x2008, "Wrong type size");
|
|
4662 static_assert(sizeof(Vis) == 0x20D0, "Wrong type size");
|
|
4663 static_assert(sizeof(PlayerBuffAnim) == 0x10, "Wrong type size");
|
|
4664 static_assert(sizeof(ProjectileAnim) == 0x1C, "Wrong type size");
|
|
4665 static_assert(sizeof(stru6) == 0x5F8, "Wrong type size");
|
|
4666 static_assert(sizeof(IndoorCameraD3D_Vec3) == 0x10, "Wrong type size");
|
|
4667 static_assert(sizeof(IndoorCameraD3D_Vec4) == 0x18, "Wrong type size"); //should be 14 (10 vec3 + 4 vdtor) but 18 coz of his +4 from own vdtor, but it is odd since vdtor already present from vec3
|
|
4668 //static_assert(sizeof(IndoorCameraD3D) == 0x1A1384, "Wrong type size");
|
|
4669 static_assert(sizeof(StationaryLight) == 0xC, "Wrong type size");
|
|
4670 static_assert(sizeof(LightsStack_StationaryLight_) == 0x12C8, "Wrong type size");
|
|
4671 static_assert(sizeof(MobileLight) == 0x12, "Wrong type size");
|
|
4672 static_assert(sizeof(LightsStack_MobileLight_) == 0x1C28, "Wrong type size");
|
|
4673 static_assert(sizeof(Game) == 0xE78, "Wrong type size");
|
|
4674 static_assert(sizeof(stru141_actor_collision_object) == 0xA8, "Wrong type size");
|
|
4675 static_assert(sizeof(ActionQueue) == 0x7C, "Wrong type size");
|
|
4676 static_assert(sizeof(NPCData) == 0x4C, "Wrong type size");
|
|
4677 static_assert(sizeof(NPCStats) == 0x17FFC, "Wrong type size");
|
|
4678 static_assert(sizeof(BspRenderer) == 0x53740, "Wrong type size");
|
|
4679 static_assert(sizeof(PaletteManager) == 0x267AF0, "Wrong type size");
|
|
4680 static_assert(sizeof(ViewingParams) == 0x26C, "Wrong type size");
|
|
4681 //static_assert(sizeof(IndoorCamera) == 0x50, "Wrong type size");
|
|
4682 static_assert(sizeof(Bloodsplat) == 0x28, "Wrong type size");
|
|
4683 static_assert(sizeof(BloodsplatContainer) == 0xA0C, "Wrong type size");
|
|
4684 static_assert(sizeof(TrailParticle) == 0x18, "Wrong type size");
|
|
4685 static_assert(sizeof(EventIndex) == 0xC, "Wrong type size");
|
|
4686 static_assert(sizeof(_2devent) == 0x34, "Wrong type size");
|
|
4687 static_assert(sizeof(MapsLongTimer) == 0x20, "Wrong type size");
|
|
4688 static_assert(sizeof(SavegameHeader) == 0x64, "Wrong type size");
|
|
4689 static_assert(sizeof(SavegameList) == 0x3138, "Wrong type size");
|
|
4690 static_assert(sizeof(StorylineText) == 0x160, "Wrong type size");
|
|
4691 static_assert(sizeof(FactionTable) == 0x1EF1, "Wrong type size");
|
|
4692 static_assert(sizeof(Decal) == 0xC20, "Wrong type size");
|
|
4693 static_assert(sizeof(DecalBuilder) == 0x30C038, "Wrong type size");
|
|
4694 static_assert(sizeof(MonsterInfo) == 0x58, "Wrong type size");
|
|
4695 static_assert(sizeof(MonsterStats) == 0x5BA0, "Wrong type size");
|
|
4696 static_assert(sizeof(RenderD3D) == 0x148, "Wrong type size");
|
|
4697 // static_assert(sizeof(Render) == 0x129844, "Wrong type size");
|
|
4698 static_assert(sizeof(Player) == 0x1B3C, "Wrong type size");
|
|
4699 static_assert(sizeof(PartyTimeStruct) == 0x678, "Wrong type size");
|
|
4700 static_assert(sizeof(Party) == 0x16238, "Wrong type size");
|
|
4701 static_assert(sizeof(GUIButton) == 0xBC, "Wrong type size");
|
|
4702 static_assert(sizeof(GUIWindow) == 0x54, "Wrong type size");
|
2518
|
4703 //static_assert(sizeof(GUIProgressBar) == 0x1B8, "Wrong type size");
|
2499
|
4704 static_assert(sizeof(GUIFont) == 0x1020, "Wrong type size");
|
|
4705 // static_assert(sizeof(stru262_TurnBased) == 0x40, "Wrong type size");
|
2518
|
4706 //static_assert(sizeof(ArcomageGame) == 0xFB, "Wrong type size");
|
2499
|
4707 static_assert(sizeof(CastSpellInfo) == 0x14, "Wrong type size");
|
|
4708 static_assert(sizeof(ArcomageCard) == 0x6C, "Wrong type size");
|
|
4709 static_assert(sizeof(stru320) == 0x3FC, "Wrong type size");
|
|
4710 static_assert(sizeof(TravelInfo) == 0x20, "Wrong type size");
|
|
4711 static_assert(sizeof(stru336) == 0x798, "Wrong type size");
|
|
4712 static_assert(sizeof(Vec3_short_) == 6, "Wrong type size");
|
|
4713 static_assert(sizeof(BLVFace) == 96, "Wrong type size");
|
|
4714 static_assert(sizeof(BLVFaceExtra) == 36, "Wrong type size");
|
|
4715 static_assert(sizeof(BLVSector) == 116, "Wrong type size");
|
|
4716 static_assert(sizeof(LevelDecoration) == 32, "Wrong type size");
|
|
4717 static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size");
|
|
4718 static_assert(sizeof(BSPNode) == 8, "Wrong type size");
|
|
4719 static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size");
|
|
4720 static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size");
|
|
4721 static_assert(sizeof(Actor) == 836, "Wrong type size");
|
|
4722 static_assert(sizeof(SpriteObject) == 112, "Wrong type size");
|
|
4723 static_assert(sizeof(Chest) == 5324, "Wrong type size");
|
|
4724 static_assert(sizeof(stru123) == 0xC8, "Wrong type size");
|
|
4725 static_assert(sizeof(BLVMapOutline) == 12, "Wrong type size");
|
|
4726 static_assert(sizeof(LODSprite) == 0x28, "Wrong type size");
|
|
4727 }
|
|
4728
|
|
4729
|
|
4730 //----- (00464761) --------------------------------------------------------
|
|
4731 void Game_DeinitializeAndTerminate(int exitCode)
|
|
4732 {
|
|
4733 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
|
|
4734 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
|
|
4735 pGame->Deinitialize();
|
|
4736 pRenderer->Release();
|
|
4737 delete window;
|
|
4738 //if ( !DestroyWindow(hWnd) )
|
|
4739 // GetLastError();
|
|
4740 exit(exitCode);
|
|
4741 }
|
|
4742
|
|
4743 //----- (004647AB) --------------------------------------------------------
|
|
4744 void FinalInitialization()
|
|
4745 {
|
|
4746 pViewport->SetScreen(viewparams->uSomeX, viewparams->uSomeY, viewparams->uSomeZ, viewparams->uSomeW);
|
|
4747 pViewport->SetFOV(flt_6BE3A0 * 65536.0f);
|
|
4748
|
|
4749 //pIndoorCamera = new IndoorCamera;
|
|
4750 //pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1,
|
|
4751 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1);
|
|
4752
|
|
4753 InitializeTurnBasedAnimations(&stru_50C198);
|
|
4754 pBitmaps_LOD->_inlined_sub1();
|
|
4755 pSprites_LOD->_inlined_sub1();
|
|
4756 pIcons_LOD->_inlined_sub1();
|
|
4757 }
|
|
4758 // 6BE3A0: using guessed type float flt_6BE3A0;
|
|
4759
|
|
4760
|
|
4761
|
|
4762 //----- (00464E17) --------------------------------------------------------
|
|
4763 bool __fastcall CheckMM7CD(char c)
|
|
4764 {
|
|
4765 char DstBuf[256] = { 0 };
|
|
4766 char strCommand[256] = { 0 }; // [sp+10Ch] [bp-118h]@1
|
|
4767 char Filename[20] = { 0 }; // [sp+20Ch] [bp-18h]@1
|
|
4768
|
|
4769 wchar_t pMagicPath[1024];
|
|
4770 swprintf(pMagicPath, wcslen(L"%C:\\anims\\magic7.vid"), L"%C:\\anims\\magic7.vid", c);
|
|
4771 if (GetFileAttributesW(pMagicPath) == -1)
|
|
4772 return false;
|
|
4773
|
2508
|
4774 //Open CD audio
|
2499
|
4775 wsprintfA(strCommand, "open %c: type cdaudio alias CD", c);
|
2508
|
4776 if (!mciSendStringA(strCommand, DstBuf, 255, 0))
|
|
4777 {
|
|
4778 wsprintfA(strCommand, "info CD UPC wait");
|
|
4779 mciSendStringA(strCommand, DstBuf, 255, 0);
|
|
4780 wsprintfA(strCommand, "close CD");
|
|
4781 mciSendStringA(strCommand, DstBuf, 255, 0);
|
|
4782 }
|
2499
|
4783
|
|
4784 memcpy(Filename, "X:\\anims\\magic7.vid", sizeof(Filename));
|
|
4785 *Filename = c;
|
|
4786
|
|
4787 FILE* f = fopen(Filename, "rb");
|
|
4788 if (!f)
|
|
4789 return false;
|
|
4790
|
|
4791 if (!fseek(f, 0, SEEK_END))
|
|
4792 {
|
|
4793 if (!fseek(f, -100, SEEK_CUR))
|
|
4794 fread(DstBuf, 1, 0x64u, f);
|
|
4795
|
|
4796 fclose(f);
|
|
4797 return true;
|
|
4798 }
|
|
4799 fclose(f);
|
|
4800 return false;
|
|
4801 }
|
|
4802
|
|
4803 //----- (00464F1B) --------------------------------------------------------
|
|
4804 signed int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4)
|
|
4805 {
|
|
4806 char v4; // zf@3
|
|
4807 int v6; // eax@10
|
|
4808 int v7; // eax@11
|
|
4809 int v8; // eax@12
|
|
4810 int v9; // eax@13
|
|
4811 BOOL(__stdcall *v10)(HWND, int, LPCSTR); // edi@15
|
|
4812 const CHAR *v11; // [sp-Ch] [bp-Ch]@15
|
|
4813 INT_PTR v12; // [sp-4h] [bp-4h]@5
|
|
4814
|
|
4815 if (a2 == 272)
|
|
4816 {
|
|
4817 hInsertCDWindow = hDlg;
|
|
4818 v6 = (GetUserDefaultLangID() & 0x3FF) - 7;
|
|
4819 if (v6)
|
|
4820 {
|
|
4821 v7 = v6 - 3;
|
|
4822 if (v7)
|
|
4823 {
|
|
4824 v8 = v7 - 2;
|
|
4825 if (v8)
|
|
4826 {
|
|
4827 v9 = v8 - 4;
|
|
4828 if (v9)
|
|
4829 {
|
|
4830 if (v9 != 5)
|
|
4831 return 0;
|
|
4832 SetWindowTextA(hDlg, "Wloz CD-ROM numer 2");
|
|
4833 v10 = SetDlgItemTextA;
|
|
4834 SetDlgItemTextA(hDlg, 1010, "Wloz CD-ROM numer 2 Might and Magic® VII.");
|
|
4835 v11 = "Odwolaj";
|
|
4836 }
|
|
4837 else
|
|
4838 {
|
|
4839 SetWindowTextA(hDlg, "Inserire il secondo CD");
|
|
4840 v10 = SetDlgItemTextA;
|
|
4841 SetDlgItemTextA(hDlg, 1010, "Inserire il secondo CD di Might and Magic® VII.");
|
|
4842 v11 = "Annulla";
|
|
4843 }
|
|
4844 }
|
|
4845 else
|
|
4846 {
|
|
4847 SetWindowTextA(hDlg, "Insérez le CD 2");
|
|
4848 v10 = SetDlgItemTextA;
|
|
4849 SetDlgItemTextA(hDlg, 1010, "Insérez Might & Magic® VII CD 2.");
|
|
4850 v11 = "Supprimer";
|
|
4851 }
|
|
4852 }
|
|
4853 else
|
|
4854 {
|
|
4855 SetWindowTextA(hDlg, "Por favor, inserte disco 2");
|
|
4856 v10 = SetDlgItemTextA;
|
|
4857 SetDlgItemTextA(hDlg, 1010, "Por favor, inserte disco 2 de Might & Magic® VII.");
|
|
4858 v11 = "Cancelar";
|
|
4859 }
|
|
4860 }
|
|
4861 else
|
|
4862 {
|
|
4863 SetWindowTextA(hDlg, "Bitte CD 2 einlegen");
|
|
4864 v10 = SetDlgItemTextA;
|
|
4865 SetDlgItemTextA(hDlg, 1010, "Bitte CD 2 von Might and Magic® VII einlegen.");
|
|
4866 v11 = "Abbrechen";
|
|
4867 }
|
|
4868 v10(hDlg, 2, v11);
|
|
4869 return 0;
|
|
4870 }
|
|
4871 if (a2 == 273)
|
|
4872 {
|
|
4873 if (a3 == 2)
|
|
4874 {
|
|
4875 v12 = 0;
|
|
4876 EndDialog(hDlg, v12);
|
|
4877 return 1;
|
|
4878 }
|
|
4879 v4 = a3 == 1;
|
|
4880 }
|
|
4881 else
|
|
4882 {
|
|
4883 v4 = a2 == 1025;
|
|
4884 }
|
|
4885 if (v4)
|
|
4886 {
|
|
4887 v12 = 1;
|
|
4888 EndDialog(hDlg, v12);
|
|
4889 return 1;
|
|
4890 }
|
|
4891 return 0;
|
|
4892 }
|
|
4893
|
|
4894 //----- (00465061) --------------------------------------------------------
|
|
4895 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive)
|
|
4896 {
|
|
4897 char drive[4] = { 'X', ':', '\\', 0 };
|
|
4898
|
|
4899 bool bGotCDFromRegistry = false;
|
|
4900
|
|
4901 HKEY hSoftware = nullptr,
|
|
4902 hNWC = nullptr,
|
|
4903 hMM7 = nullptr,
|
|
4904 hVersion = nullptr;
|
|
4905 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hSoftware))
|
|
4906 {
|
|
4907 if (!RegOpenKeyExA(hSoftware, "New World Computing", 0, KEY_READ|KEY_WOW64_32KEY, &hNWC))
|
|
4908 {
|
|
4909 if (!RegOpenKeyExA(hNWC, "Might and Magic VII", 0, KEY_READ|KEY_WOW64_32KEY, &hMM7))
|
|
4910 {
|
|
4911 if (!RegOpenKeyExA(hMM7, "1.0", 0, KEY_READ|KEY_WOW64_32KEY, &hVersion))
|
|
4912 {
|
|
4913 DWORD cbData = 3;
|
|
4914 if (!RegQueryValueExA(hVersion, "CDDrive", 0, 0, (BYTE *)drive, &cbData))
|
|
4915 bGotCDFromRegistry = true;
|
|
4916 }
|
|
4917 RegCloseKey(hVersion);
|
|
4918 }
|
|
4919 RegCloseKey(hMM7);
|
|
4920 }
|
|
4921 RegCloseKey(hNWC);
|
|
4922 }
|
|
4923 RegCloseKey(hSoftware);
|
|
4924
|
|
4925 if (bGotCDFromRegistry)
|
|
4926 if (CheckMM7CD(*drive))
|
|
4927 {
|
|
4928 cMM7GameCDDriveLetter = *drive;
|
|
4929 return true;
|
|
4930 }
|
|
4931
|
|
4932 while (true)
|
|
4933 {
|
|
4934 for (uint i = 0; i < 26; ++i)
|
|
4935 {
|
|
4936 drive[0] = 'A' + i;
|
|
4937
|
|
4938 if (GetDriveTypeA(drive) == DRIVE_CDROM)
|
|
4939 if (CheckMM7CD(*drive))
|
|
4940 {
|
|
4941 cMM7GameCDDriveLetter = *drive;
|
|
4942 WriteWindowsRegistryString("CDDrive", drive);
|
|
4943 return true;
|
|
4944 }
|
|
4945 }
|
|
4946
|
|
4947 if (DialogBoxParamA(GetModuleHandleW(nullptr), "InsertCD", hWnd, (DLGPROC)InsertMM7CDDialogFunc, 0))
|
|
4948 continue;
|
|
4949 return false;
|
|
4950 }
|
|
4951 }
|
|
4952
|
|
4953 //----- (004651F4) --------------------------------------------------------
|
|
4954 bool MM7_Initialize(int game_width, int game_height)
|
|
4955 {
|
|
4956 wchar_t pCurrentDir[1024];
|
|
4957 _wgetcwd(pCurrentDir, 1024);
|
|
4958
|
|
4959 wchar_t pMM6IniFile[1024];
|
|
4960 wsprintfW(pMM6IniFile, L"%s\\mm6.ini", pCurrentDir);
|
|
4961
|
|
4962 bCanLoadFromCD = GetPrivateProfileIntW(L"settings", L"use_cd", 1, pMM6IniFile);
|
|
4963 if (bNoCD)
|
|
4964 bCanLoadFromCD = false;
|
|
4965 if (bCanLoadFromCD)
|
|
4966 {
|
|
4967 Log::Warning(L"Checking for CD...");
|
|
4968 if (!FindMM7CD(nullptr, &cMM7GameCDDriveLetter))
|
|
4969 return false;
|
|
4970 Log::Warning(L"...done.");
|
|
4971 }
|
|
4972
|
|
4973
|
|
4974 srand(GetTickCount());
|
|
4975
|
|
4976 pEventTimer = Timer::Create();
|
|
4977 pEventTimer->Initialize();
|
|
4978 window = OSWindow::Create(L"Might and Magic® Trilogy", game_width, game_height);//Create game window
|
|
4979
|
2508
|
4980 bool use_d3d11 = false;
|
|
4981 if (use_d3d11)
|
2511
|
4982 pRenderer = RenderD3D11::Create();
|
2508
|
4983 else
|
2511
|
4984 pRenderer = Render::Create();//Create DirectX
|
2499
|
4985 if (!pRenderer)
|
|
4986 {
|
|
4987 Log::Warning(L"Render creation failed");
|
|
4988 return false;
|
|
4989 }
|
|
4990 else
|
|
4991 {
|
|
4992 //bool bWindowMode = ReadWindowsRegistryInt("startinwindow", false);
|
|
4993 //uint uDefaultDevice = ReadWindowsRegistryInt("D3D Device", 1);
|
|
4994
|
|
4995 if (!pRenderer->Initialize(window/*, bColoredLights, uLevelOfDetail, bTinting*/))
|
|
4996 {
|
|
4997 Log::Warning(L"Render failed to initialize");
|
|
4998 return false;
|
|
4999 }
|
|
5000 }
|
|
5001
|
|
5002 game_starting_year = 1168;
|
|
5003
|
|
5004 pParty = new Party;
|
|
5005 memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings));
|
|
5006 pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile);
|
|
5007 pParty->uDefaultEyelevel = GetPrivateProfileIntW(L"party", L"eyelevel", 160, pMM6IniFile);
|
|
5008 pParty->sEyelevel = pParty->uDefaultEyelevel;
|
|
5009 pParty->uDefaultPartyHeight = GetPrivateProfileIntW(L"party", L"height", 192, pMM6IniFile);
|
|
5010 pParty->uPartyHeight = pParty->uDefaultPartyHeight;
|
|
5011
|
|
5012 MM6_Initialize(pMM6IniFile);
|
|
5013
|
|
5014 pKeyActionMap = new KeyboardActionMapping;
|
|
5015
|
|
5016 OnTimer(1);
|
|
5017 GameUI_StatusBar_UpdateTimedString(1);
|
|
5018 pGame = Game::Create();
|
|
5019 pMouse = pGame->pMouseInstance;
|
|
5020
|
|
5021
|
|
5022 pIcons_LOD = new LODFile_IconsBitmaps;
|
|
5023 if (!pIcons_LOD->Load("data\\icons.lod", "icons"))
|
|
5024 {
|
|
5025 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.",
|
|
5026 L"Files Missing", MB_ICONEXCLAMATION);
|
|
5027 return false;
|
|
5028 }
|
|
5029 pIcons_LOD->dword_011BA4 = 0;
|
|
5030
|
|
5031 pEvents_LOD = new LODFile_IconsBitmaps;
|
|
5032 if (!pEvents_LOD->Load("data\\events.lod", "icons"))
|
|
5033 {
|
|
5034 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.",
|
|
5035 L"Files Missing", MB_ICONEXCLAMATION);
|
|
5036 return false;
|
|
5037 }
|
|
5038
|
|
5039 InitializeGameText();
|
|
5040
|
|
5041 pBitmaps_LOD = new LODFile_IconsBitmaps;
|
|
5042 if (!pBitmaps_LOD->Load("data\\bitmaps.lod", "bitmaps"))
|
|
5043 {
|
|
5044 MessageBoxA(nullptr, pGlobalTXT_LocalizationStrings[63],
|
|
5045 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION);
|
|
5046 return false;
|
|
5047 }
|
|
5048
|
|
5049 pSprites_LOD = new LODFile_Sprites;
|
|
5050 if (!pSprites_LOD->LoadSprites("data\\sprites.lod"))
|
|
5051 {
|
|
5052 MessageBoxA(nullptr,
|
|
5053 pGlobalTXT_LocalizationStrings[63],
|
|
5054 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION);
|
|
5055 return false;
|
|
5056 }
|
|
5057
|
|
5058
|
|
5059 #if 0
|
|
5060 if (_access("../MM_VI/data/icons.lod", 0) == 0)
|
|
5061 {
|
|
5062 pIcons_LOD_mm6 = new LODFile_IconsBitmaps;
|
|
5063 if (!pIcons_LOD_mm6->Load("../MM_VI/data/icons.lod", "icons"))
|
|
5064 {
|
|
5065 delete pIcons_LOD_mm6;
|
|
5066 pIcons_LOD_mm6 = nullptr;
|
|
5067 Log::Warning(L"Unable to load mm6:icons.lod");
|
|
5068 }
|
|
5069 }
|
|
5070 else
|
|
5071 Log::Warning(L"Unable to find mm6:icons.lod");
|
|
5072
|
|
5073 if (_access("../MM_VI/data/bitmaps.lod", 0) == 0)
|
|
5074 {
|
|
5075 pBitmaps_LOD_mm6 = new LODFile_IconsBitmaps;
|
|
5076 if (!pBitmaps_LOD_mm6->Load("../MM_VI/data/bitmaps.lod", "bitmaps"))
|
|
5077 {
|
|
5078 delete pBitmaps_LOD_mm6;
|
|
5079 pBitmaps_LOD_mm6 = nullptr;
|
|
5080 Log::Warning(L"Unable to load mm6:bitmaps.lod");
|
|
5081 }
|
|
5082 }
|
|
5083 else
|
|
5084 Log::Warning(L"Unable to find mm6:bitmaps.lod");
|
|
5085
|
|
5086 auto mm6_sprite_container_name = bUseLoResSprites ? "../MM_VI/data/spriteLO.lod"
|
|
5087 : "../MM_VI/data/sprites.lod";
|
|
5088 if (_access(mm6_sprite_container_name, 0) == 0)
|
|
5089 {
|
|
5090 pSprites_LOD_mm6 = new LODFile_Sprites;
|
|
5091 if (!pSprites_LOD_mm6->LoadSprites(mm6_sprite_container_name))
|
|
5092 {
|
|
5093 delete pSprites_LOD_mm6;
|
|
5094 pSprites_LOD_mm6 = nullptr;
|
|
5095 Log::Warning(L"Unable to load mm6:sprites.lod");
|
|
5096 }
|
|
5097 }
|
|
5098 else
|
|
5099 Log::Warning(L"Unable to find mm6:sprites.lod");
|
|
5100
|
|
5101
|
|
5102 if (_access("../mm8/data/icons.lod", 0) == 0)
|
|
5103 {
|
|
5104 pIcons_LOD_mm8 = new LODFile_IconsBitmaps;
|
|
5105 if (!pIcons_LOD_mm8->Load("../mm8/data/icons.lod", "icons"))
|
|
5106 {
|
|
5107 delete pIcons_LOD_mm8;
|
|
5108 pIcons_LOD_mm8 = nullptr;
|
|
5109 Log::Warning(L"Unable to load mm8:icons.lod");
|
|
5110 }
|
|
5111 }
|
|
5112 else
|
|
5113 Log::Warning(L"Unable to find mm8:icons.lod");
|
|
5114
|
|
5115
|
|
5116 if (_access("../mm8/data/bitmaps.lod", 0) == 0)
|
|
5117 {
|
|
5118 pBitmaps_LOD_mm8 = new LODFile_IconsBitmaps;
|
|
5119 if (!pBitmaps_LOD_mm8->Load("../mm8/data/bitmaps.lod", "bitmaps"))
|
|
5120 {
|
|
5121 delete pBitmaps_LOD_mm8;
|
|
5122 pBitmaps_LOD_mm8 = nullptr;
|
|
5123 Log::Warning(L"Unable to load mm8:bitmaps.lod");
|
|
5124 }
|
|
5125 }
|
|
5126 else
|
|
5127 Log::Warning(L"Unable to find mm8:bitmaps.lod");
|
|
5128
|
|
5129
|
|
5130 if (_access("../mm8/data/sprites.lod", 0) == 0)
|
|
5131 {
|
|
5132 pSprites_LOD_mm8 = new LODFile_Sprites;
|
|
5133 if (!pSprites_LOD_mm8->LoadSprites("../mm8/data/sprites.lod"))
|
|
5134 {
|
|
5135 delete pSprites_LOD_mm8;
|
|
5136 pSprites_LOD_mm8 = nullptr;
|
|
5137 Log::Warning(L"Unable to load mm8:sprites.lod");
|
|
5138 }
|
|
5139 }
|
|
5140 else
|
|
5141 Log::Warning(L"Unable to find mm8:sprites.lod");
|
|
5142 #endif
|
|
5143
|
|
5144 {
|
|
5145 void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr,
|
|
5146 *sft_mm8 = nullptr;
|
|
5147 void *sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1);
|
|
5148 pSpriteFrameTable = new SpriteFrameTable;
|
|
5149 pSpriteFrameTable->FromFile(sft_mm6, sft_mm7, sft_mm8);
|
|
5150 free(sft_mm6);
|
|
5151 free(sft_mm7);
|
|
5152 free(sft_mm8);
|
|
5153
|
|
5154 void *tft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtft.bin", 1) : nullptr,
|
|
5155 *tft_mm8 = nullptr;
|
|
5156 void *tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1);
|
|
5157 pTextureFrameTable = new TextureFrameTable;
|
|
5158 pTextureFrameTable->FromFile(tft_mm6, tft_mm7, tft_mm8);
|
|
5159 free(tft_mm6);
|
|
5160 free(tft_mm7);
|
|
5161 free(tft_mm8);
|
|
5162
|
|
5163 void *tiles_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtile.bin", 1) : nullptr,
|
|
5164 *tiles_mm8 = nullptr;
|
|
5165 void *tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1);
|
|
5166 pTileTable = new TileTable;
|
|
5167 pTileTable->FromFile(tiles_mm6, tiles_mm7, tiles_mm8);
|
|
5168 free(tiles_mm6);
|
|
5169 free(tiles_mm7);
|
|
5170 free(tiles_mm8);
|
|
5171
|
|
5172 void *pft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dpft.bin", 1) : nullptr,
|
|
5173 *pft_mm8 = nullptr;
|
|
5174 void *pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1);
|
|
5175 pPlayerFrameTable = new PlayerFrameTable;
|
|
5176 pPlayerFrameTable->FromFile(pft_mm6, pft_mm7, pft_mm8);
|
|
5177 free(pft_mm6);
|
|
5178 free(pft_mm7);
|
|
5179 free(pft_mm8);
|
|
5180
|
|
5181 void *ift_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dift.bin", 1) : nullptr,
|
|
5182 *ift_mm8 = nullptr;
|
|
5183 void *ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1);
|
|
5184 pIconsFrameTable = new IconFrameTable;
|
|
5185 pIconsFrameTable->FromFile(ift_mm6, ift_mm7, ift_mm8);
|
|
5186 free(ift_mm6);
|
|
5187 free(ift_mm7);
|
|
5188 free(ift_mm8);
|
|
5189
|
|
5190 void *decs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("ddeclist.bin", 1) : nullptr,
|
|
5191 *decs_mm8 = nullptr;
|
|
5192 void *decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1);
|
|
5193 pDecorationList = new DecorationList;
|
|
5194 pDecorationList->FromFile(decs_mm6, decs_mm7, decs_mm8);
|
|
5195 free(decs_mm6);
|
|
5196 free(decs_mm7);
|
|
5197 free(decs_mm8);
|
|
5198
|
|
5199 void *objs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dobjlist.bin", 1) : nullptr,
|
|
5200 *objs_mm8 = nullptr;
|
|
5201 void *objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1);
|
|
5202 pObjectList = new ObjectList;
|
|
5203 pObjectList->FromFile(objs_mm6, objs_mm7, objs_mm8);
|
|
5204 free(objs_mm6);
|
|
5205 free(objs_mm7);
|
|
5206 free(objs_mm8);
|
|
5207
|
|
5208 void *mons_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dmonlist.bin", 1) : nullptr,
|
|
5209 *mons_mm8 = nullptr;
|
|
5210 void *mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1);
|
|
5211 pMonsterList = new MonsterList;
|
|
5212 pMonsterList->FromFile(mons_mm6, mons_mm7, mons_mm8);
|
|
5213 free(mons_mm6);
|
|
5214 free(mons_mm7);
|
|
5215 free(mons_mm8);
|
|
5216
|
|
5217 void *chests_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dchest.bin", 1) : nullptr,
|
|
5218 *chests_mm8 = nullptr;
|
|
5219 void *chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1);
|
|
5220 pChestList = new ChestList;
|
|
5221 pChestList->FromFile(chests_mm6, chests_mm7, chests_mm8);
|
|
5222 free(chests_mm6);
|
|
5223 free(chests_mm7);
|
|
5224 free(chests_mm8);
|
|
5225
|
|
5226 void *overlays_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("doverlay.bin", 1) : nullptr,
|
|
5227 *overlays_mm8 = nullptr;
|
|
5228 void *overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1);
|
|
5229 pOverlayList = new OverlayList;
|
|
5230 pOverlayList->FromFile(overlays_mm6, overlays_mm7, overlays_mm8);
|
|
5231 free(overlays_mm6);
|
|
5232 free(overlays_mm7);
|
|
5233 free(overlays_mm8);
|
|
5234
|
|
5235 void *sounds_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsounds.bin", 1) : nullptr,
|
|
5236 *sounds_mm8 = nullptr;
|
|
5237 void *sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1);
|
|
5238 pSoundList = new SoundList;
|
|
5239 pSoundList->FromFile(sounds_mm6, sounds_mm7, sounds_mm8);
|
|
5240 free(sounds_mm6);
|
|
5241 free(sounds_mm7);
|
|
5242 free(sounds_mm8);
|
|
5243 }
|
|
5244
|
|
5245
|
|
5246
|
|
5247
|
|
5248 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_RUN_IN_WIDOW)
|
|
5249 {
|
|
5250 //window->SetWindowedMode(game_width, game_height);
|
|
5251 pRenderer->SwitchToWindow();
|
|
5252 }
|
|
5253 else
|
|
5254 {
|
|
5255 __debugbreak(); // Nomad
|
|
5256 window->SetFullscreenMode();
|
|
5257 pRenderer->InitializeFullscreen();
|
|
5258 }
|
|
5259
|
|
5260 uSoundVolumeMultiplier = min(9, ReadWindowsRegistryInt("soundflag", 9));
|
|
5261 uMusicVolimeMultiplier = min(9, ReadWindowsRegistryInt("musicflag", 9));
|
|
5262 uVoicesVolumeMultiplier = min(9, ReadWindowsRegistryInt("CharVoices", 9));
|
|
5263 bShowDamage = ReadWindowsRegistryInt("ShowDamage", 1) != 0;
|
|
5264
|
|
5265 uGammaPos = min(4, ReadWindowsRegistryInt("GammaPos", 4));
|
|
5266 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6);
|
|
5267
|
|
5268 if (ReadWindowsRegistryInt("Bloodsplats", 1))
|
|
5269 pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS;
|
|
5270 else
|
|
5271 pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS;
|
|
5272
|
|
5273 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 3);
|
|
5274
|
|
5275 if (!bNoSound)
|
|
5276 pAudioPlayer->Initialize();
|
|
5277
|
|
5278 pMediaPlayer = new Media::MPlayer();
|
|
5279 pMediaPlayer->Initialize(window);
|
|
5280
|
|
5281 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
|
|
5282
|
|
5283 switch (uTurnSpeed)
|
|
5284 {
|
|
5285 case 0: // undefined turn option
|
|
5286 __debugbreak(); // really shouldn't use this mode
|
|
5287 uTurnSpeed = (unsigned int)uCPUSpeed < 199 ? 128 : 64; // adjust turn speed to estimated fps
|
|
5288 break;
|
|
5289
|
|
5290 case 1: // 16x
|
|
5291 Log::Warning(L"x16 Turn Speed"); // really shouldn't use this mode
|
|
5292 uTurnSpeed = 128;
|
|
5293 break;
|
|
5294
|
|
5295 case 2: // 32x
|
|
5296 Log::Warning(L"x32 Turn Speed"); // really shouldn't use this mode
|
|
5297 uTurnSpeed = 64;
|
|
5298 break;
|
|
5299
|
|
5300 case 3: // smooth
|
|
5301 uTurnSpeed = 0;
|
|
5302 break;
|
|
5303 }
|
|
5304
|
|
5305 return true;
|
|
5306 }
|
|
5307
|
|
5308 //----- (00465D0B) --------------------------------------------------------
|
|
5309 void SecondaryInitialization()
|
|
5310 {
|
|
5311 pMouse->Initialize(window);
|
|
5312
|
|
5313 pItemsTable = new ItemsTable;
|
|
5314 pItemsTable->Initialize();
|
|
5315
|
|
5316 //pBitmaps_LOD->can_load_hardware_sprites = 1;
|
|
5317 //pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
|
|
5318 pBitmaps_LOD->SetupPalettes(5, 6, 5);
|
|
5319 //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
|
|
5320 pIcons_LOD->SetupPalettes(5, 6, 5);
|
|
5321 //pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
|
|
5322 pPaletteManager->SetColorChannelInfo(5, 6, 5);
|
|
5323
|
|
5324 pPaletteManager->SetMistColor(128, 128, 128);
|
|
5325 pPaletteManager->RecalculateAll();
|
|
5326 //pSprites_LOD->can_load_hardware_sprites = 1;
|
|
5327 pObjectList->InitializeSprites();
|
|
5328 pOverlayList->InitializeSprites();
|
|
5329
|
|
5330 if (!bNoSound)
|
|
5331 pSoundList->Initialize();
|
|
5332
|
|
5333
|
|
5334 for (uint i = 0; i < 4; ++i)
|
|
5335 {
|
|
5336 static const char *pUIAnimNames[4] =
|
|
5337 {
|
|
5338 "glow03", "glow05",
|
|
5339 "torchA", "wizeyeA"
|
|
5340 };
|
|
5341 static unsigned short _4E98D0[4][4] =
|
|
5342 {
|
|
5343 { 479, 0, 329, 0 },
|
|
5344 { 585, 0, 332, 0 },
|
|
5345 { 468, 0, 0, 0 },
|
|
5346 { 606, 0, 0, 0 }
|
|
5347 };
|
|
5348
|
|
5349 pUIAnims[i]->uIconID = pIconsFrameTable->FindIcon(pUIAnimNames[i]);
|
|
5350 pIconsFrameTable->InitializeAnimation(pUIAnims[i]->uIconID);
|
|
5351
|
|
5352 pUIAnims[i]->uAnimLength = 0;
|
|
5353 pUIAnims[i]->uAnimTime = 0;
|
|
5354 pUIAnims[i]->x = _4E98D0[i][0];
|
|
5355 pUIAnims[i]->y = _4E98D0[i][2];
|
|
5356 }
|
|
5357
|
|
5358 for (unsigned int i = 0; i < pObjectList->uNumObjects; ++i)
|
|
5359 {
|
|
5360 pObjectList->pObjects[i].uParticleTrailColor = pObjectList->pObjects[i].uParticleTrailColorB |
|
|
5361 ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorG << 8) |
|
|
5362 ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorR << 16);
|
|
5363 }
|
|
5364
|
|
5365 MainMenuUI_Create();
|
|
5366 pGame->pStru6Instance->LoadAnimations();
|
|
5367
|
|
5368 for (uint i = 0; i < 7; ++i)
|
|
5369 {
|
|
5370 char container_name[64];
|
|
5371 sprintf(container_name, "HDWTR%03u", i);
|
|
5372 pRenderer->pHDWaterBitmapIDs[i] = pBitmaps_LOD->LoadTexture(container_name);
|
|
5373 }
|
|
5374
|
|
5375 pNPCStats = new NPCStats;
|
|
5376 memset(pNPCStats->pNPCData, 0, 0x94BCu);
|
|
5377 pNPCStats->Initialize();
|
|
5378
|
|
5379 Initialize_GlobalEVT();
|
|
5380 pBitmaps_LOD->_inlined_sub0();
|
|
5381 pSprites_LOD->_inlined_sub0();
|
|
5382 pPaletteManager->LockAll();
|
|
5383
|
|
5384 _mkdir("Saves");
|
|
5385 for (uint i = 0; i < 5; ++i)
|
|
5386 for (uint j = 0; j < 6; ++j)
|
|
5387 {
|
|
5388 sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
|
|
5389 remove(pTmpBuf.data());
|
|
5390 }
|
|
5391
|
|
5392 Initialize_GamesLOD_NewLOD();
|
|
5393 _576E2C_current_minimap_zoom = 512;
|
|
5394 dword_576E28 = 9;
|
|
5395 }
|
|
5396
|
|
5397 bool new_sky = false; //new sky(need texture)
|
|
5398 int max_flight_height = 4000; //maximum altitude
|
|
5399 bool use_MMT = false;
|
2508
|
5400 bool use_music_folder = true;
|
2499
|
5401 bool for_refactoring = false;
|
|
5402
|
|
5403 //----- (00462C94) --------------------------------------------------------
|
|
5404 bool MM_Main(const wchar_t *pCmdLine)
|
|
5405 {
|
|
5406 IntegrityTest();
|
|
5407
|
|
5408 char test[1024];
|
|
5409 sprintfex(test, "^Pi[%s]: çíàõàð^R[ü;êà;]", "Çîëòàí");
|
|
5410
|
|
5411 lua = new LuaVM;
|
|
5412 lua->Initialize();
|
|
5413
|
|
5414 bool bNoMargareth = false;
|
|
5415 if (pCmdLine && *pCmdLine)
|
|
5416 {
|
|
5417 //if (wcsstr(pCmdLine, L"-usedefs"))
|
|
5418 // bDebugResouces = 1;
|
|
5419 if (wcsstr(pCmdLine, L"-window"))
|
|
5420 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
|
|
5421
|
|
5422 if (wcsstr(pCmdLine, L"-nointro"))
|
|
5423 bNoIntro = true;//dword_6BE364_game_settings_1 |= 4;
|
|
5424 if (wcsstr(pCmdLine, L"-nologo"))
|
|
5425 bNoLogo = true;//dword_6BE364_game_settings_1 |= 8;
|
|
5426 if (wcsstr(pCmdLine, L"-nosound"))
|
|
5427 bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10;
|
|
5428
|
|
5429 bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0;
|
|
5430 if (wcsstr(pCmdLine, L"-nowalksound"))
|
|
5431 bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20;
|
|
5432 if (wcsstr(pCmdLine, L"-novideo"))
|
|
5433 {
|
|
5434 dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM;
|
|
5435 bNoVideo = true;
|
|
5436 }
|
|
5437 if (wcsstr(pCmdLine, L"-nocd"))
|
|
5438 bNoCD = true;
|
|
5439 if (wcsstr(pCmdLine, L"-new_sky"))
|
|
5440 new_sky = true;
|
|
5441 if (wcsstr(pCmdLine, L"-nomarg"))
|
|
5442 bNoMargareth = true;
|
|
5443 }
|
|
5444
|
|
5445 /*v8 = _4AC1C9_get_cpu_speed(0, (Vec4_int_ *)a2);
|
|
5446 Rect.left = *(int *)v8;
|
|
5447 Rect.top = *(int *)(v8 + 4);
|
|
5448 Rect.right = *(int *)(v8 + 8);
|
|
5449 Rect.bottom = *(int *)(v8 + 12);
|
|
5450 uCPUSpeed = Rect.bottom;*/
|
|
5451 uCPUSpeed = 2048; // about 2GHz
|
|
5452
|
|
5453 //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );//Ritor1: for memory test
|
|
5454
|
|
5455 if (!MM7_Initialize(640, 480))
|
|
5456 {
|
|
5457 Log::Warning(L"MM init: failed");
|
|
5458 pGame->Deinitialize();
|
|
5459 return 1;
|
|
5460 }
|
|
5461
|
|
5462 pEventTimer->Pause();
|
|
5463
|
|
5464 SetUserInterface(PartyAlignment_Neutral, false);
|
|
5465
|
|
5466 ShowLogoVideo();
|
|
5467 //ShowIntroVideo_and_LoadingScreen();
|
|
5468 WriteWindowsRegistryInt("Ran once", 1);
|
|
5469 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
|
|
5470 pGame->InitializeGammaController();
|
|
5471 SecondaryInitialization();
|
2524
|
5472 //pRenderer->SetRasterClipRect(0, 0, window->GetWidth() - 1, window->GetHeight() - 1);
|
2499
|
5473 FinalInitialization();
|
|
5474
|
|
5475 //Ritor1: include
|
|
5476 if (use_MMT)
|
|
5477 MMT_MainMenu_Loop();
|
|
5478
|
|
5479 Log::Warning(L"MM: entering main loop");
|
|
5480 while (1)
|
|
5481 {
|
|
5482 MainMenuWindow* main_menu_window = MainMenuWindow::Create();
|
|
5483 window->AddControl(main_menu_window);
|
|
5484 MainMenu_Loop();
|
|
5485 uGameState = GAME_STATE_PLAYING;
|
|
5486 while (1)
|
|
5487 {
|
|
5488 if (uGameState == GAME_FINISHED || GetCurrentMenuID() == MENU_EXIT_GAME)
|
|
5489 {
|
|
5490 pGame->Deinitialize();
|
|
5491 return true;
|
|
5492 }
|
|
5493
|
|
5494 if (GetCurrentMenuID() == MENU_NEWGAME)
|
|
5495 {
|
2508
|
5496 if ( use_music_folder )
|
|
5497 alSourceStop(mSourceID);
|
|
5498 else
|
|
5499 {
|
2499
|
5500 if (pAudioPlayer->hAILRedbook)
|
|
5501 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
|
2508
|
5502 }
|
2499
|
5503 pParty->Reset();
|
|
5504 pOtherOverlayList->Reset();
|
|
5505 strcpy(pCurrentMapName, pStartingMapName);
|
|
5506 pParty->CreateDefaultParty(0);
|
|
5507 PlayerCreationUI_Initialize();
|
|
5508 if (PlayerCreationUI_Loop())
|
|
5509 {
|
|
5510 DeleteCCharFont();
|
|
5511 break;
|
|
5512 }
|
|
5513 DeleteCCharFont();
|
|
5514 bFlashQuestBook = true;
|
|
5515 pMediaPlayer->PlayFullscreenMovie(MOVIE_Emerald, true);
|
|
5516 SaveNewGame();
|
|
5517 if (bNoMargareth)
|
|
5518 _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1);
|
|
5519 pGame->Loop();
|
|
5520 if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU)
|
|
5521 {
|
|
5522 SetCurrentMenuID(MENU_NEWGAME);
|
|
5523 uGameState = GAME_STATE_PLAYING;
|
|
5524 continue;
|
|
5525 }
|
|
5526 else if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)
|
|
5527 break;
|
|
5528 assert(false && "Invalid game state");
|
|
5529 }
|
|
5530 if (GetCurrentMenuID() == MENU_CREDITS)
|
|
5531 {
|
2508
|
5532 if ( use_music_folder )
|
|
5533 alSourceStop(mSourceID);
|
|
5534 else
|
|
5535 {
|
2499
|
5536 if (pAudioPlayer->hAILRedbook)
|
|
5537 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
|
2508
|
5538 }
|
|
5539 MainMenuUI_Credits_Loop();
|
|
5540 break;
|
2499
|
5541 }
|
|
5542 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
|
|
5543 {
|
|
5544 uGameState = GAME_STATE_PLAYING;
|
|
5545 pGame->Loop();
|
|
5546 }
|
|
5547 else
|
|
5548 {
|
|
5549 if (GetCurrentMenuID() == MENU_DebugBLVLevel)
|
|
5550 {
|
|
5551 pMouse->ChangeActivation(0);
|
|
5552 pParty->Reset();
|
|
5553 pParty->CreateDefaultParty(1);
|
|
5554
|
|
5555 __debugbreak();
|
|
5556 /*extern void CreateDefaultBLVLevel();
|
|
5557 CreateDefaultBLVLevel();
|
|
5558
|
|
5559 OPENFILENAMEA ofn;
|
|
5560 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
|
|
5561 {
|
|
5562 pMouse->ChangeActivation(1);
|
|
5563 break;
|
|
5564 }
|
|
5565 _chdir("..\\");
|
|
5566 strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/
|
|
5567 pMouse->ChangeActivation(1);
|
|
5568 pGame->Loop();
|
|
5569 }
|
|
5570 }
|
|
5571 if (uGameState == GAME_STATE_LOADING_GAME)
|
|
5572 {
|
|
5573 SetCurrentMenuID(MENU_5);
|
|
5574 uGameState = GAME_STATE_PLAYING;
|
|
5575 continue;
|
|
5576 }
|
|
5577 if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU)
|
|
5578 {
|
|
5579 SetCurrentMenuID(MENU_NEWGAME);
|
|
5580 uGameState = GAME_STATE_PLAYING;
|
|
5581 continue;
|
|
5582 }
|
|
5583 if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)// from the loaded game
|
|
5584 {
|
|
5585 pAudioPlayer->StopChannels(-1, -1);
|
|
5586 uGameState = GAME_STATE_PLAYING;
|
|
5587 break;
|
|
5588 }
|
|
5589 }
|
2508
|
5590 if (!bNoSound )
|
2499
|
5591 {
|
2508
|
5592 if ( use_music_folder )
|
|
5593 {
|
|
5594 PlayAudio(L"Music\\14.mp3");
|
|
5595 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
|
|
5596 }
|
|
5597 else if ( pAudioPlayer->hAILRedbook)
|
|
5598 {
|
2499
|
5599 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
|
|
5600 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
|
|
5601 unsigned int startms, end_ms;
|
|
5602 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &startms, &end_ms);
|
|
5603 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms);
|
2508
|
5604 }
|
2499
|
5605 }
|
|
5606 }
|
|
5607 //lua_close(L);
|
|
5608 pGame->Deinitialize();
|
|
5609 return 1;
|
|
5610 }
|
|
5611
|
|
5612
|
|
5613
|
|
5614 //----- (00466082) --------------------------------------------------------
|
|
5615 void MM6_Initialize(const wchar_t *pIniFilename)
|
|
5616 {
|
|
5617 size_t v2; // eax@31
|
|
5618 size_t v3; // ebx@32
|
|
5619 size_t v4; // edi@36
|
|
5620 char pDefaultGroundTexture[16]; // [sp+FCh] [bp-8Ch]@32
|
|
5621 unsigned int v9; // [sp+184h] [bp-4h]@28
|
|
5622
|
|
5623 //_getcwd(v5, 120);
|
|
5624 //sprintfex(pIniFilename, "%s\\mm6.ini", v5);
|
|
5625 viewparams = new ViewingParams;
|
|
5626 game_viewport_x = viewparams->uScreen_topL_X = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename);
|
|
5627 game_viewport_y = viewparams->uScreen_topL_Y = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename);
|
|
5628 game_viewport_z = viewparams->uScreen_BttmR_X = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename);
|
|
5629 game_viewport_w = viewparams->uScreen_BttmR_Y = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename);
|
|
5630 game_viewport_width = game_viewport_z - game_viewport_x;
|
|
5631 game_viewport_height = game_viewport_w - game_viewport_y + 1;
|
|
5632
|
|
5633
|
|
5634 pAudioPlayer = new AudioPlayer;
|
|
5635 pAudioPlayer->uMixerChannels = GetPrivateProfileIntW(L"settings", L"mixerchannels", 16, pIniFilename);
|
|
5636 if (pAudioPlayer->uMixerChannels > 16)
|
|
5637 pAudioPlayer->uMixerChannels = 16;
|
|
5638
|
|
5639
|
|
5640 if (GetPrivateProfileIntW(L"debug", L"nomonster", 0, pIniFilename))
|
|
5641 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_ACTORS;
|
|
5642 if (ReadWindowsRegistryInt("startinwindow", 0))
|
|
5643 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
|
|
5644 if (GetPrivateProfileIntW(L"debug", L"showFR", 0, pIniFilename))
|
|
5645 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_0002_SHOW_FR;
|
|
5646 if (GetPrivateProfileIntW(L"debug", L"nodamage", 0, pIniFilename))
|
|
5647 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DAMAGE;
|
|
5648 if (GetPrivateProfileIntW(L"debug", L"nodecoration", 0, pIniFilename))
|
|
5649 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DECORATIONS;
|
|
5650
|
|
5651 wchar_t pStartingMapNameW[1024];
|
|
5652 GetPrivateProfileStringW(L"file", L"startmap", L"out01.odm", pStartingMapNameW, 0x20u, pIniFilename);
|
|
5653 sprintf(pStartingMapName, "%S", pStartingMapNameW);
|
|
5654
|
|
5655 v9 = 0;
|
|
5656 if (strlen(pStartingMapName))
|
|
5657 {
|
|
5658 do
|
|
5659 {
|
|
5660 if (pStartingMapName[v9] == ' ')
|
|
5661 pStartingMapName[v9] = 0;
|
|
5662 ++v9;
|
|
5663 v2 = strlen(pStartingMapName);
|
|
5664 } while (v9 < v2);
|
|
5665 }
|
|
5666
|
|
5667 pODMRenderParams = new ODMRenderParams;
|
|
5668 pODMRenderParams->outdoor_no_mist = GetPrivateProfileIntW(L"debug", L"noMist", 0, pIniFilename);
|
|
5669 pODMRenderParams->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename);
|
|
5670 pODMRenderParams->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename);
|
|
5671 pODMRenderParams->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename);
|
|
5672 outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename);
|
|
5673 outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename);
|
|
5674 outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename);
|
|
5675 pODMRenderParams->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename);
|
|
5676 pODMRenderParams->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename);
|
|
5677 pODMRenderParams->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename);
|
|
5678 pODMRenderParams->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename);
|
|
5679
|
|
5680 pODMRenderParams->shading_dist_mist = GetPrivateProfileIntW(L"shading", L"dist_mist", 0x2000, pIniFilename);//drawing dist 0x2000
|
|
5681
|
|
5682 wchar_t pDefaultSkyTextureW[1024];
|
|
5683 GetPrivateProfileStringW(L"textures", L"sky", L"plansky1", pDefaultSkyTextureW, 0x10u, pIniFilename);
|
|
5684 sprintf(pDefaultSkyTexture.data(), "%S", pDefaultSkyTextureW);
|
|
5685
|
|
5686 wchar_t pDefaultGroundTextureW[1024];
|
|
5687 GetPrivateProfileStringW(L"textures", L"default", L"dirt", pDefaultGroundTextureW, 0x10u, pIniFilename);
|
|
5688 sprintf(pDefaultGroundTexture, "%S", pDefaultGroundTextureW);
|
|
5689
|
|
5690 wchar_t pFloat[1024];
|
|
5691 GetPrivateProfileStringW(L"debug", L"recmod1", L"1.0", pFloat, 0x10u, pIniFilename);
|
|
5692 swscanf(pFloat, L"%f", &flt_6BE3A4_debug_recmod1);
|
|
5693
|
|
5694 GetPrivateProfileStringW(L"debug", L"recmod2", L"1.0", pFloat, 0x10u, pIniFilename);
|
|
5695 swscanf(pFloat, L"%f", &flt_6BE3A8_debug_recmod2);
|
|
5696
|
|
5697 flt_6BE3AC_debug_recmod1_x_1_6 = flt_6BE3A4_debug_recmod1 * 1.666666666666667;
|
|
5698
|
|
5699 v3 = 0;
|
|
5700 if (strlen(pDefaultSkyTexture.data()))
|
|
5701 {
|
|
5702 do
|
|
5703 {
|
|
5704 if (pDefaultSkyTexture[v3] == ' ')
|
|
5705 pDefaultSkyTexture[v3] = 0;
|
|
5706 ++v3;
|
|
5707 } while (v3 < strlen(pDefaultSkyTexture.data()));
|
|
5708 }
|
|
5709 v4 = 0;
|
|
5710 if (strlen(pDefaultGroundTexture))
|
|
5711 {
|
|
5712 do
|
|
5713 {
|
|
5714 if (pDefaultGroundTexture[v4] == ' ')
|
|
5715 pDefaultGroundTexture[v4] = 0;
|
|
5716 ++v4;
|
|
5717 } while (v4 < strlen(pDefaultGroundTexture));
|
|
5718 }
|
|
5719
|
|
5720 MM7Initialization();
|
|
5721 }
|
|
5722
|
|
5723 //----- (004666D5) --------------------------------------------------------
|
|
5724 void MM7Initialization()
|
|
5725 {
|
|
5726 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
5727 {
|
|
5728 /*if (byte_6BE388_graphicsmode == 0)
|
|
5729 {
|
|
5730 outdoor_grid_band_1 = 10;
|
|
5731 outdoor_grid_band_2 = 15;
|
|
5732 outdoor_grid_band_3 = 20;
|
|
5733 pODMRenderParams->shading_dist_mist = 8192;
|
|
5734 pODMRenderParams->bNoSky = false;
|
|
5735 LOBYTE(viewparams->field_20) = 0;
|
|
5736 }*/
|
|
5737 pODMRenderParams->shading_dist_shade = 2048;
|
|
5738 pODMRenderParams->terrain_gamma = 0;
|
|
5739 pODMRenderParams->building_gamme = 0;
|
|
5740 pODMRenderParams->shading_dist_shademist = 4096;
|
|
5741 pODMRenderParams->outdoor_no_wavy_water = 0;
|
|
5742 //_47F4D3_initialize_terrain_bezier_stuff(outdoor_grid_band_1, outdoor_grid_band_2, outdoor_grid_band_3);
|
|
5743 {
|
|
5744 pODMRenderParams->outdoor_grid_band_3 = outdoor_grid_band_3;
|
|
5745 pODMRenderParams->uPickDepth = outdoor_grid_band_3 * 512;
|
|
5746 }
|
|
5747 }
|
|
5748 else
|
|
5749 LOBYTE(viewparams->field_20) = 0;
|
|
5750 pParty->uFlags |= 2;
|
|
5751 viewparams->uSomeY = viewparams->uScreen_topL_Y;
|
|
5752 viewparams->uSomeX = viewparams->uScreen_topL_X;
|
|
5753 viewparams->uSomeZ = viewparams->uScreen_BttmR_X;
|
|
5754 viewparams->uSomeW = viewparams->uScreen_BttmR_Y;
|
|
5755
|
|
5756 pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y);
|
|
5757 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
5758 pODMRenderParams->Initialize();
|
|
5759 }
|
|
5760
|
|
5761 //----- (004610AA) --------------------------------------------------------
|
|
5762 void __fastcall PrepareToLoadODM(unsigned int bLoading, ODMRenderParams *a2)
|
|
5763 {
|
|
5764 pGameLoadingUI_ProgressBar->Reset(27);
|
|
5765 pSoundList->_4A9D79(0);
|
|
5766 uCurrentlyLoadedLevelType = LEVEL_Outdoor;
|
|
5767 ODM_LoadAndInitialize(pCurrentMapName, a2);
|
|
5768 if (!bLoading)
|
|
5769 TeleportToStartingPoint(uLevel_StartingPointType);
|
|
5770 viewparams->_443365();
|
|
5771 PlayLevelMusic();
|
|
5772 }
|
|
5773 // 6BE35C: using guessed type int uLevel_StartingPointType;
|
|
5774
|
|
5775
|
|
5776 //----- (004627B7) --------------------------------------------------------
|
|
5777 void MainMenu_Loop()
|
|
5778 {
|
|
5779 GUIButton *pButton; // eax@27
|
|
5780 unsigned int pControlParam; // ecx@35
|
|
5781 unsigned int pY; // [sp-18h] [bp-54h]@39
|
|
5782 Texture *pTexture; // [sp-14h] [bp-50h]@39
|
|
5783 GUIWindow *pWindow; // [sp+4h] [bp-38h]@11
|
|
5784 MSG msg;
|
|
5785
|
|
5786 pCurrentScreen = SCREEN_GAME;
|
|
5787
|
|
5788 pGUIWindow2 = 0;
|
|
5789 pAudioPlayer->StopChannels(-1, -1);
|
|
5790 pMouse->RemoveHoldingItem();
|
|
5791
|
|
5792 pIcons_LOD->_inlined_sub2();
|
|
5793
|
|
5794 pWindow_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
|
|
5795 Texture* pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE);
|
|
5796 Texture* pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE);
|
|
5797 Texture* pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE);
|
|
5798 Texture* pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
|
|
5799
|
|
5800 pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", pNew, 0);
|
|
5801 pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", pLoad, 0);
|
|
5802 pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 'C', "", pCredits, 0);
|
|
5803 pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0);
|
|
5804
|
|
5805 pTexture_PCX.Release();
|
|
5806 pTexture_PCX.Load("title.pcx", 0);
|
|
5807 SetCurrentMenuID(MENU_MAIN);
|
|
5808 SetForegroundWindow(window->GetApiHandle());
|
|
5809 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
|
|
5810 while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD)
|
|
5811 {
|
|
5812 POINT pt;
|
|
5813 pMouse->GetCursorPos(&pt);
|
|
5814 pWindow = pWindow_MainMenu;
|
|
5815 if (GetCurrentMenuID() == MENU_SAVELOAD)
|
|
5816 {
|
|
5817 if (pCurrentScreen != SCREEN_LOADGAME)
|
|
5818 {
|
|
5819 pTexture_PCX.Release();
|
|
5820 pTexture_PCX.Load("lsave640.pcx", 0);
|
|
5821 pGUIWindow2 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
|
|
5822 pCurrentScreen = SCREEN_LOADGAME;
|
|
5823 LoadUI_Load(0);
|
|
5824 }
|
|
5825 pWindow = pGUIWindow_CurrentMenu;
|
|
5826 }
|
|
5827
|
|
5828 while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
|
|
5829 {
|
|
5830 if (msg.message == WM_QUIT)
|
|
5831 Game_DeinitializeAndTerminate(0);
|
|
5832 TranslateMessage(&msg);
|
|
5833 DispatchMessageW(&msg);
|
|
5834 }
|
|
5835
|
|
5836 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
|
|
5837 {
|
|
5838 WaitMessage();
|
|
5839 continue;
|
|
5840 }
|
|
5841
|
|
5842 pRenderer->BeginScene();
|
2524
|
5843 pRenderer->DrawTextureNew(0, 0, &pTexture_PCX);
|
2499
|
5844
|
|
5845 GUI_MainMenuMessageProc();
|
|
5846 GUI_UpdateWindows();
|
|
5847
|
|
5848 if (GetCurrentMenuID() != MENU_MAIN)
|
|
5849 {
|
|
5850 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
|
|
5851 {
|
|
5852 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
5853 pGUIWindow_CurrentMenu->Release();
|
|
5854 pGUIWindow_CurrentMenu = 0;
|
|
5855 pCurrentScreen = SCREEN_GAME;
|
|
5856 viewparams->bRedrawGameUI = 1;
|
|
5857 }
|
|
5858 }
|
|
5859 else
|
|
5860 {
|
|
5861 if (!pModalWindow)// ???
|
|
5862 {
|
|
5863 pButton = pWindow->pControlsHead;
|
|
5864 for (pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext)
|
|
5865 {
|
|
5866 if (pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ
|
|
5867 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW
|
|
5868 && pWindow == pWindow_MainMenu)
|
|
5869 {
|
|
5870 pControlParam = pButton->msg_param;
|
|
5871 switch (pControlParam) // backlight for buttons
|
|
5872 {
|
|
5873 case 0:
|
|
5874 pTexture = pNew;
|
|
5875 pY = 172;
|
|
5876 break;
|
|
5877 case 1:
|
|
5878 pTexture = pLoad;
|
|
5879 pY = 227;
|
|
5880 break;
|
|
5881 case 2:
|
|
5882 pTexture = pCredits;
|
|
5883 pY = 282;
|
|
5884 break;
|
|
5885 case 3:
|
|
5886 pTexture = pExit;
|
|
5887 pY = 337;
|
|
5888 break;
|
|
5889 }
|
|
5890 pRenderer->DrawTextureIndexed(495, pY, pTexture);
|
|
5891 }
|
|
5892 }
|
|
5893 }
|
|
5894 }
|
|
5895 pRenderer->EndScene();
|
|
5896 pRenderer->Present();
|
|
5897 }
|
|
5898 GUI_MainMenuMessageProc();
|
|
5899 pRenderer->BeginScene();
|
|
5900 GUI_UpdateWindows();
|
|
5901 pRenderer->EndScene();
|
|
5902 pRenderer->Present();
|
|
5903 pTexture_PCX.Release();
|
|
5904 if (pGUIWindow2)
|
|
5905 {
|
|
5906 pGUIWindow2->Release();
|
|
5907 pGUIWindow2 = 0;
|
|
5908 }
|
|
5909 pWindow_MainMenu->Release();
|
|
5910 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
5911 }
|
|
5912
|
|
5913 //----- (004BF91E) --------------------------------------------------------
|
|
5914 unsigned int GameOverMenu(void *ecx0)
|
|
5915 {
|
|
5916 const char *v1; // eax@2
|
|
5917 unsigned int result; // eax@3
|
|
5918 const char *v6; // eax@10
|
|
5919 const char *v7; // edx@10
|
|
5920 const char *v8; // ecx@12
|
|
5921 const char *v9; // eax@14
|
|
5922 unsigned int v10; // eax@25
|
|
5923 GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1
|
|
5924 unsigned int v14; // [sp+A4h] [bp-2Ch]@5
|
|
5925 void *v15; // [sp+A8h] [bp-28h]@1
|
|
5926 const char *pInString; // [sp+ACh] [bp-24h]@5
|
|
5927 unsigned int v17; // [sp+B0h] [bp-20h]@5
|
|
5928 unsigned int v18; // [sp+B4h] [bp-1Ch]@5
|
|
5929 unsigned int v19; // [sp+B8h] [bp-18h]@5
|
|
5930 int v20; // [sp+BCh] [bp-14h]@7
|
|
5931 GUIFont *pFont; // [sp+C4h] [bp-Ch]@1
|
|
5932 unsigned __int64 v23; // [sp+C8h] [bp-8h]@5
|
|
5933 MSG msg;
|
|
5934
|
|
5935 v15 = ecx0;
|
|
5936
|
|
5937 RGBTexture _this; // [sp+Ch] [bp-C4h]@1
|
|
5938 //RGBTexture::RGBTexture(&this);
|
|
5939
|
|
5940 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000;
|
|
5941 bGameoverLoop = 1;
|
|
5942 pMediaPlayer->bStopBeforeSchedule = 0;
|
|
5943 pAudioPlayer->StopChannels(-1, -1);
|
|
5944 pRenderer->BeginScene();
|
|
5945 pRenderer->ClearBlack();
|
|
5946 pRenderer->EndScene();
|
|
5947 pRenderer->Present();
|
|
5948 //pMediaPlayer->pResetflag = 0;
|
|
5949 _449B57_test_bit(pParty->_quest_bits, 99);
|
|
5950 _this.Load("winbg.pcx", 2);
|
|
5951 pRenderer->BeginScene();
|
|
5952 pRenderer->DrawTextureRGB(0, 0, &_this);
|
|
5953 pRenderer->EndScene();
|
|
5954 free(_this.pPixels);
|
|
5955 _this.pPixels = 0;
|
|
5956 window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
|
|
5957 pWindow.uFrameX = 75;
|
|
5958 pWindow.uFrameY = 60;
|
|
5959 pWindow.uFrameWidth = 469;
|
|
5960 pWindow.uFrameHeight = 338;
|
|
5961 pWindow.uFrameZ = 543;
|
|
5962 pWindow.uFrameW = 397;
|
|
5963 pFont = LoadFont("endgame.fnt", "FONTPAL", NULL);
|
|
5964 if (pParty->IsPartyGood())
|
|
5965 v1 = pGlobalTXT_LocalizationStrings[675];//"Splendid job! With the activation of the Gate, a thousand worlds lie at your feet. Perhaps on one of them you will find the Ancients themselves, and return with the fruits their great civilization has to offer your world and your kingdom."
|
|
5966 else
|
|
5967 {
|
|
5968 result = pParty->IsPartyEvil();
|
|
5969 if (!(short)result)
|
|
5970 return result;
|
|
5971 v1 = pGlobalTXT_LocalizationStrings[676];//"Brilliant! The completion of the Heavenly Forge has provided enough Ancient weapons to crush all resistance to your plans. Soon the world will bow to your every whim! Still, you can't help but wonder what was beyond the Gate the other side was trying so hard to build."
|
|
5972 }
|
|
5973 pInString = v1;
|
|
5974 v23 = pParty->uTimePlayed - 138240;
|
|
5975 v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24;
|
|
5976 v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C / 0xC;
|
|
5977 v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C % 0xC;
|
|
5978 v17 = v19 % 0x1C;
|
|
5979 if (!v19)
|
|
5980 v19 = 1;
|
|
5981 pRenderer->BeginScene();
|
|
5982 pWindow.DrawTitleText(pFont, 1, 0x23, 1, pGlobalTXT_LocalizationStrings[9], 3);//Congratulations!
|
|
5983 v23 = 0i64;
|
|
5984 v20 = 0;
|
|
5985 for (uint i = 0; i < 4; i++)
|
|
5986 {
|
|
5987 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], pParty->pPlayers[i].pName, pParty->pPlayers[i].GetBaseLevel(), pClassNames[pParty->pPlayers[i].classType]);//%s the Level %u %s
|
|
5988 pWindow.DrawTitleText(pFont, 1, i * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 1, pTmpBuf.data(), 3);
|
|
5989 v23 += pParty->pPlayers[i].uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8));
|
|
5990 }
|
|
5991 v23 = (signed __int64)v23 / v19;
|
|
5992 v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0);
|
|
5993 pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0);
|
|
5994 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time:
|
|
5995
|
|
5996 v7 = pGlobalTXT_LocalizationStrings[56];
|
|
5997 if (v17 != 1)
|
|
5998 v7 = pGlobalTXT_LocalizationStrings[57];
|
|
5999
|
|
6000 v8 = pGlobalTXT_LocalizationStrings[146];//Month
|
|
6001 if (v18 != 1)
|
|
6002 v8 = pGlobalTXT_LocalizationStrings[148];//Months
|
|
6003
|
|
6004 v9 = pGlobalTXT_LocalizationStrings[245];
|
|
6005 if (v14 != 1)
|
|
6006 v9 = pGlobalTXT_LocalizationStrings[132];
|
|
6007
|
|
6008 sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
|
|
6009 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
6010 pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1, pTmpBuf.data(), 3);
|
|
6011 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
|
|
6012 pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1, pTmpBuf.data(), 3);
|
|
6013 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
|
|
6014 pRenderer->EndScene();
|
|
6015 pRenderer->Present();
|
|
6016 //if ( pRenderer->pRenderD3D )
|
|
6017 pRenderer->pBeforePresentFunction();
|
|
6018 pRenderer->SaveWinnersCertificate("MM7_Win.Pcx");
|
|
6019 free(pFont);
|
|
6020 window_SpeakInHouse->Release();
|
|
6021 window_SpeakInHouse = 0;
|
|
6022 if (v15 == (void *)2)
|
|
6023 result = pMessageQueue_50CBD0->uNumMessages;
|
|
6024 else
|
|
6025 {
|
|
6026 LODWORD(v23) = GetTickCount() + 5000;
|
|
6027 while ((unsigned int)v23 > GetTickCount())
|
|
6028 ;
|
|
6029 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
|
6030 {
|
|
6031 if (msg.message == WM_QUIT)
|
|
6032 Game_DeinitializeAndTerminate(0);
|
|
6033 TranslateMessage(&msg);
|
|
6034 DispatchMessage(&msg);
|
|
6035 }
|
|
6036 if (pMessageQueue_50CBD0->uNumMessages)
|
|
6037 {
|
|
6038 LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
6039 pMessageQueue_50CBD0->uNumMessages = v10;
|
|
6040 }
|
|
6041 pKeyActionMap->ResetKeys();
|
|
6042 pKeyActionMap->uLastKeyPressed = 0;
|
|
6043 do
|
|
6044 {
|
|
6045 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
|
6046 {
|
|
6047 if (msg.message == WM_QUIT)
|
|
6048 Game_DeinitializeAndTerminate(0);
|
|
6049 TranslateMessage(&msg);
|
|
6050 DispatchMessage(&msg);
|
|
6051 }
|
|
6052 } while (!pKeyActionMap->uLastKeyPressed);
|
|
6053 result = pMessageQueue_50CBD0->uNumMessages;
|
|
6054 if (pMessageQueue_50CBD0->uNumMessages)
|
|
6055 {
|
|
6056 result = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
6057 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
6058 }
|
|
6059 }
|
|
6060 if (v15)
|
|
6061 {
|
|
6062 /*if ( (signed int)result < 40 )
|
|
6063 {
|
|
6064 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit;
|
|
6065 }*/
|
|
6066 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Quit, 1, 0);
|
|
6067 }
|
|
6068 else
|
|
6069 {
|
|
6070 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ShowFinalWindow, 1, 0);
|
|
6071 /*if ( (signed int)result < 40 )
|
|
6072 {
|
|
6073 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5;
|
|
6074 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
6075 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
|
|
6076 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
|
|
6077 ++pMessageQueue_50CBD0->uNumMessages;
|
|
6078 }*/
|
|
6079 }
|
|
6080 bGameoverLoop = 0;
|
|
6081 return result;
|
|
6082 }
|
|
6083
|
|
6084 //----- (00464479) --------------------------------------------------------
|
|
6085 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
|
|
6086 {
|
|
6087 int v0; // esi@9
|
|
6088
|
|
6089 if (pMouse)
|
|
6090 pMouse->SetCursorBitmap("MICON1");
|
|
6091
|
|
6092 pPaletteManager->ResetNonLocked();
|
|
6093 pBitmaps_LOD->ReleaseAll2();
|
|
6094 pSprites_LOD->DeleteSomeOtherSprites();
|
|
6095 pIcons_LOD->ReleaseAll2();
|
|
6096
|
|
6097 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
6098 pIndoor->Release();
|
|
6099 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
6100 pOutdoor->Release();
|
|
6101
|
|
6102 pAudioPlayer->StopChannels(-1, -1);
|
|
6103 pSoundList->_4A9D79(0);
|
|
6104 uCurrentlyLoadedLevelType = LEVEL_null;
|
|
6105 pSpriteFrameTable->ResetSomeSpriteFlags();
|
|
6106 v0 = uNumVisibleWindows;
|
|
6107 pParty->armageddon_timer = 0;
|
|
6108 while (v0 > 0)
|
|
6109 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release();
|
|
6110 }
|
|
6111
|
|
6112 //----- (00461103) --------------------------------------------------------
|
|
6113 void _461103_load_level_sub()
|
|
6114 {
|
|
6115 int v4; // edx@8
|
|
6116 signed int v6; // esi@14
|
|
6117 signed int v8; // ecx@16
|
|
6118 int v12; // esi@25
|
|
6119 int v13; // eax@26
|
|
6120 __int16 v14; // ax@41
|
|
6121 signed int v17; // [sp+14h] [bp-48h]@3
|
|
6122 signed int v18; // [sp+14h] [bp-48h]@23
|
|
6123 int v19; // [sp+18h] [bp-44h]@1
|
|
6124 signed int v20; // [sp+18h] [bp-44h]@14
|
|
6125 int v21[16]; // [sp+1Ch] [bp-40h]@17
|
|
6126
|
|
6127 GenerateItemsInChest();
|
|
6128 pGameLoadingUI_ProgressBar->Progress();
|
|
6129 pParty->uFlags |= 2;
|
|
6130 pParty->field_7B5_in_arena_quest = 0;
|
|
6131 dword_5C6DF8 = 1;
|
|
6132 pNPCStats->uNewlNPCBufPos = 0;
|
|
6133 v19 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
6134
|
|
6135 //v15 = 0;
|
|
6136 for (uint i = 0; i < uNumActors; ++i)
|
|
6137 //if ( (signed int)uNumActors > 0 )
|
|
6138 {
|
|
6139 //Actor* pActor = &pActors[i];
|
|
6140 //v2 = (char *)&pActors[0].uNPC_ID;
|
|
6141 //do
|
|
6142 //{
|
|
6143 //v3 = pActors[i].pMonsterInfo.uID;
|
|
6144 v17 = 0;
|
|
6145 if (pActors[i].pMonsterInfo.uID >= 115 && pActors[i].pMonsterInfo.uID <= 186
|
|
6146 || pActors[i].pMonsterInfo.uID >= 232 && pActors[i].pMonsterInfo.uID <= 249)
|
|
6147 v17 = 1;
|
|
6148 //v1 = 0;
|
|
6149 v4 = (pActors[i].pMonsterInfo.uID - 1) % 3;
|
|
6150 if (2 == v4)
|
|
6151 {
|
|
6152 if (pActors[i].sNPC_ID && pActors[i].sNPC_ID < 5000)
|
|
6153 continue;
|
|
6154 }
|
|
6155 else
|
|
6156 {
|
|
6157 if (v4 != 1)
|
|
6158 {
|
|
6159 if (v4 == 0 && pActors[i].sNPC_ID == 0)
|
|
6160 pActors[i].sNPC_ID = 0;
|
|
6161 continue;
|
|
6162 }
|
|
6163 }
|
|
6164 if (pActors[i].sNPC_ID > 0 && pActors[i].sNPC_ID < 5000)
|
|
6165 continue;
|
|
6166 if (v17)
|
|
6167 {
|
|
6168 pNPCStats->InitializeAdditionalNPCs(&pNPCStats->pAdditionalNPC[pNPCStats->uNewlNPCBufPos], pActors[i].pMonsterInfo.uID, 0, v19);
|
|
6169 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000;
|
|
6170 ++pNPCStats->uNewlNPCBufPos;
|
|
6171 pActors[i].sNPC_ID = v14;
|
|
6172 continue;
|
|
6173 }
|
|
6174 pActors[i].sNPC_ID = 0;
|
|
6175 //++v15;
|
|
6176 //v2 += 836;
|
|
6177 //}
|
|
6178 //while ( v15 < (signed int)uNumActors );
|
|
6179 }
|
|
6180
|
|
6181 pGameLoadingUI_ProgressBar->Progress();
|
|
6182
|
|
6183 //v5 = uNumActors;
|
|
6184 v6 = 0;
|
|
6185 v20 = 0;
|
|
6186 //v16 = v1;
|
|
6187
|
|
6188 for (uint i = 0; i < uNumActors; ++i)
|
|
6189 {
|
|
6190 //v7 = (char *)&pActors[0].pMonsterInfo;
|
|
6191 //do
|
|
6192 //{
|
|
6193 for (v8 = 0; v8 < v6; ++v8)
|
|
6194 {
|
|
6195 if (v21[v8] == pActors[i].pMonsterInfo.uID - 1)
|
|
6196 break;
|
|
6197 }
|
|
6198
|
|
6199 if (v8 == v6)
|
|
6200 {
|
|
6201 v21[v6++] = pActors[i].pMonsterInfo.uID - 1;
|
|
6202 v20 = v6;
|
|
6203 if (v6 == 16)
|
|
6204 break;
|
|
6205 }
|
|
6206 //++v16;
|
|
6207 //v7 += 836;
|
|
6208 //}
|
|
6209 //while ( v16 < (signed int)v5 );
|
|
6210 }
|
|
6211
|
|
6212 pGameLoadingUI_ProgressBar->Progress();
|
|
6213
|
|
6214 for (int _v0 = 0; _v0 < v6; ++_v0)
|
|
6215 {
|
|
6216 for (v18 = 4; v18; --v18)
|
|
6217 pSoundList->LoadSound(pMonsterList->pMonsters[v21[_v0]].pSoundSampleIDs[4 - v18], 0);
|
|
6218 v12 = 0;
|
|
6219 do
|
|
6220 v13 = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[pMonsterStats->pInfos[v21[_v0] + 1].uSpell1ID], 1);
|
|
6221 while (v13);
|
|
6222 }
|
|
6223 //v0 = pGameLoadingUI_ProgressBar;
|
|
6224 //v1 = 0;
|
|
6225
|
|
6226 pGameLoadingUI_ProgressBar->Progress();
|
|
6227
|
|
6228 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_ACTORS)
|
|
6229 uNumActors = 0;
|
|
6230 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DECORATIONS)
|
|
6231 uNumLevelDecorations = 0;
|
|
6232 init_event_triggers();
|
|
6233
|
|
6234 pGameLoadingUI_ProgressBar->Progress();
|
|
6235
|
|
6236 pGame->pIndoorCameraD3D->vPartyPos.x = 0;
|
|
6237 pGame->pIndoorCameraD3D->vPartyPos.y = 0;
|
|
6238 pGame->pIndoorCameraD3D->vPartyPos.z = 100;
|
|
6239 pGame->pIndoorCameraD3D->sRotationX = 0;
|
|
6240 pGame->pIndoorCameraD3D->sRotationY = 0;
|
|
6241 viewparams->bRedrawGameUI = true;
|
|
6242 uLevel_StartingPointType = MapStartPoint_Party;
|
|
6243 pSprites_LOD->_461397();
|
|
6244 pPaletteManager->LockTestAll();
|
|
6245 if (pParty->pPickedItem.uItemID != 0)
|
|
6246 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID);
|
|
6247 }
|
|
6248
|
|
6249 //----- (0042F3D6) --------------------------------------------------------
|
|
6250 void InitializeTurnBasedAnimations(void *_this)
|
|
6251 {
|
|
6252 for (unsigned int i = 0; i < pIconIDs_Turn.size(); ++i)
|
|
6253 {
|
|
6254 char icon_name[32];
|
|
6255 sprintf(icon_name, "turn%u", i);
|
|
6256 pIconIDs_Turn[i] = pIconsFrameTable->FindIcon(icon_name);
|
|
6257 pIconsFrameTable->InitializeAnimation(pIconIDs_Turn[i]);
|
|
6258 }
|
|
6259
|
|
6260 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop");
|
|
6261 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour");
|
|
6262 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
|
|
6263 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
|
|
6264 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
|
|
6265
|
|
6266 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour);
|
|
6267 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop);
|
|
6268 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart);
|
|
6269 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame);
|
|
6270 }
|
|
6271
|
|
6272 //----- (00466C40) --------------------------------------------------------
|
|
6273 const wchar_t *MENU_STATE_to_string(MENU_STATE m)
|
|
6274 {
|
|
6275 switch (m)
|
|
6276 {
|
|
6277 case -1: return L"-1";
|
|
6278 case MENU_MAIN: return L"MENU_MAIN";
|
|
6279 case MENU_NEWGAME: return L"MENU_NEWGAME";
|
|
6280 case MENU_CREDITS: return L"MENU_CREDITS";
|
|
6281 case MENU_SAVELOAD: return L"MENU_SAVELOAD";
|
|
6282 case MENU_EXIT_GAME: return L"MENU_EXIT_GAME";
|
|
6283 case MENU_5: return L"MENU_5";
|
|
6284 case MENU_CREATEPARTY: return L"MENU_CREATEPARTY";
|
|
6285 case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC";
|
|
6286 case MENU_CREDITSPROC: return L"MENU_CREDITSPROC";
|
|
6287 case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu";
|
|
6288 case MENU_DebugBLVLevel: return L"MENU_DebugBLVLevel";
|
|
6289 case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE";
|
|
6290 case MENU_MMT_MAIN_MENU: return L"MENU_MMT_MAIN_MENU";
|
|
6291 default: return L"unk";
|
|
6292 };
|
|
6293 };
|
|
6294 void SetCurrentMenuID(MENU_STATE uMenu)
|
|
6295 {
|
|
6296 sCurrentMenuID = uMenu;
|
|
6297
|
|
6298 Log::Warning(L"CurrentMenu = %s \n", MENU_STATE_to_string(uMenu));
|
|
6299 }
|
|
6300
|
|
6301 //----- (00466CA0) --------------------------------------------------------
|
|
6302 MENU_STATE GetCurrentMenuID()
|
|
6303 {
|
|
6304 return sCurrentMenuID;
|
|
6305 }
|
|
6306
|
|
6307 //----- (0046BDA8) --------------------------------------------------------
|
|
6308 unsigned int GetGravityStrength()
|
|
6309 {
|
|
6310 int v0; // eax@1
|
|
6311
|
|
6312 v0 = ~LOBYTE(pGame->uFlags2) & 8;
|
|
6313 LOBYTE(v0) = v0 | 2;
|
|
6314 return (unsigned int)v0 >> 1;
|
|
6315 }
|
|
6316
|
|
6317 //----- (00448B45) --------------------------------------------------------
|
|
6318 void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
|
|
6319 {
|
|
6320 if (bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft)
|
|
6321 GameUI_Footer_TimeLeft = 0;
|
|
6322 }
|
|
6323
|
|
6324 //----- (0044861E) --------------------------------------------------------
|
|
6325 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename)
|
|
6326 {
|
|
6327 unsigned int texture; // eax@2
|
|
6328
|
|
6329 if (uFaceCog)
|
|
6330 {
|
|
6331 texture = pBitmaps_LOD->LoadTexture(pFilename);
|
|
6332 if (texture != -1 ? (int)&pBitmaps_LOD->pTextures[texture] : 0)
|
|
6333 {
|
|
6334 pBitmaps_LOD->pTextures[texture].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[texture].palette_id1);
|
|
6335
|
|
6336 if (uCurrentlyLoadedLevelType == 1)
|
|
6337 {
|
|
6338 if ((signed int)pIndoor->uNumFaceExtras > 1)
|
|
6339 {
|
|
6340 for (uint i = 1; i < (signed int)pIndoor->uNumFaceExtras; ++i)
|
|
6341 {
|
|
6342 if (pIndoor->pFaceExtras[i].sCogNumber == uFaceCog)
|
|
6343 {
|
|
6344 if (pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes & FACE_TEXTURE_FRAME)
|
|
6345 {
|
|
6346 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = pTextureFrameTable->FindTextureByName(pFilename);
|
|
6347 if (pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID)
|
|
6348 {
|
|
6349 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID);
|
|
6350 }
|
|
6351 else
|
|
6352 {
|
|
6353 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = texture;
|
|
6354 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes &= 0xFFFFBFFF;
|
|
6355 }
|
|
6356 }
|
|
6357 else
|
|
6358 {
|
|
6359 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = texture;
|
|
6360 }
|
|
6361 }
|
|
6362 }
|
|
6363 }
|
|
6364 pParty->uFlags |= 2;
|
|
6365 }
|
|
6366 else
|
|
6367 {
|
|
6368 for (uint j = 0; j < (unsigned int)pOutdoor->uNumBModels; ++j)
|
|
6369 {
|
|
6370 for (uint i = 0; i < pOutdoor->pBModels[j].uNumFaces; ++i)
|
|
6371 {
|
|
6372 if (pOutdoor->pBModels[j].pFaces[i].sCogNumber == uFaceCog)
|
|
6373 {
|
|
6374 if (pOutdoor->pBModels[j].pFaces[i].uAttributes & FACE_TEXTURE_FRAME)
|
|
6375 {
|
|
6376 pOutdoor->pBModels[j].pFaces[i].uTextureID = pTextureFrameTable->FindTextureByName(pFilename);
|
|
6377 if (pOutdoor->pBModels[j].pFaces[i].uTextureID)
|
|
6378 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pOutdoor->pBModels[j].pFaces[i].uTextureID);
|
|
6379 else
|
|
6380 {
|
|
6381 pOutdoor->pBModels[j].pFaces[i].uTextureID = texture;
|
|
6382 pOutdoor->pBModels[j].pFaces[i].uAttributes &= 0xFFFFBFFF;
|
|
6383 }
|
|
6384 }
|
|
6385 else
|
|
6386 pOutdoor->pBModels[j].pFaces[i].uTextureID = texture;
|
|
6387 }
|
|
6388 }
|
|
6389 }
|
|
6390 }
|
|
6391 pParty->uFlags |= 2;
|
|
6392 }
|
|
6393 }
|
|
6394 }
|
|
6395
|
|
6396 //----- (0044892E) --------------------------------------------------------
|
|
6397 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on)
|
|
6398 {
|
|
6399 if (sCogNumber)
|
|
6400 {
|
|
6401 if (uCurrentlyLoadedLevelType == 1)
|
|
6402 {
|
|
6403 for (uint i = 1; i < (unsigned int)pIndoor->uNumFaceExtras; ++i)
|
|
6404 {
|
|
6405 if (pIndoor->pFaceExtras[i].sCogNumber == sCogNumber)
|
|
6406 {
|
|
6407 if (on)
|
|
6408 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes |= bit;
|
|
6409 else
|
|
6410 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes &= ~bit;
|
|
6411 }
|
|
6412 }
|
|
6413 pParty->uFlags |= 2;
|
|
6414 }
|
|
6415 else
|
|
6416 {
|
|
6417 for (uint j = 0; j < (unsigned int)pOutdoor->uNumBModels; ++j)
|
|
6418 {
|
|
6419 for (uint i = 0; i < (unsigned int)pOutdoor->pBModels[j].uNumFaces; ++i)
|
|
6420 {
|
|
6421 if (pOutdoor->pBModels[j].pFaces[i].sCogNumber == sCogNumber)
|
|
6422 {
|
|
6423 if (on)
|
|
6424 pOutdoor->pBModels[j].pFaces[i].uAttributes |= bit;
|
|
6425 else
|
|
6426 pOutdoor->pBModels[j].pFaces[i].uAttributes &= ~bit;
|
|
6427 }
|
|
6428 }
|
|
6429 }
|
|
6430 }
|
|
6431 pParty->uFlags |= 2;
|
|
6432 }
|
|
6433 }
|
|
6434
|
|
6435 //----- (0044882F) --------------------------------------------------------
|
|
6436 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName)
|
|
6437 {
|
|
6438 for (size_t i = 0; i < uNumLevelDecorations; i++)
|
|
6439 {
|
|
6440 if (pLevelDecorations[i].uCog == uCog)
|
|
6441 {
|
|
6442 if (pFileName && strcmp(pFileName, "0"))
|
|
6443 {
|
|
6444 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName);
|
|
6445 pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID);
|
|
6446 }
|
|
6447
|
|
6448 if (bHide)
|
|
6449 pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE;
|
|
6450 else
|
|
6451 pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE;
|
|
6452
|
|
6453 pParty->uFlags |= 2;
|
|
6454 }
|
|
6455 }
|
|
6456 }
|
|
6457
|
|
6458 //----- (004356FF) --------------------------------------------------------
|
|
6459 void back_to_game()
|
|
6460 {
|
|
6461 dword_507BF0_is_there_popup_onscreen = 0;
|
|
6462 dword_4E455C = 1;
|
|
6463
|
|
6464 extern int no_rightlick_in_inventory;
|
|
6465 no_rightlick_in_inventory = false;
|
|
6466
|
|
6467 if (pGUIWindow_ScrollWindow)
|
|
6468 free_book_subwindow();
|
|
6469 if (!pCurrentScreen && !pGUIWindow_Settings)
|
|
6470 pEventTimer->Resume();
|
|
6471 viewparams->bRedrawGameUI = 1;
|
|
6472 }
|
|
6473
|
|
6474 //----- (00494035) --------------------------------------------------------
|
|
6475 void _494035_timed_effects__water_walking_damage__etc()
|
|
6476 {
|
|
6477 signed __int64 v0; // qax@1
|
|
6478 unsigned int v4; // edi@1
|
|
6479 // signed int v12; // edi@29
|
|
6480 int v24; // ecx@60
|
|
6481 int v26; // ecx@64
|
|
6482 int v28; // ecx@68
|
|
6483 int v30; // ecx@72
|
|
6484 int v32; // ecx@76
|
|
6485 int v34; // ecx@80
|
|
6486 int v36; // ecx@84
|
|
6487 int v38; // ecx@88
|
|
6488 int v40; // ecx@92
|
|
6489 int v42; // ecx@96
|
|
6490 bool v43; // ebx@102
|
|
6491 bool v46; // edi@111
|
|
6492 // unsigned int v56; // [sp-8h] [bp-38h]@55
|
|
6493 // int v59; // [sp-4h] [bp-34h]@55
|
|
6494 // unsigned int v61; // [sp+14h] [bp-1Ch]@1
|
|
6495 signed int a2a; // [sp+18h] [bp-18h]@47
|
|
6496 signed int old_day; // [sp+1Ch] [bp-14h]@47
|
|
6497 signed int old_hour;
|
|
6498
|
|
6499 old_day = pParty->uDaysPlayed;
|
|
6500 old_hour = pParty->uCurrentHour;
|
|
6501 //auto prev_time = pEventTimer->uTimeElapsed;
|
|
6502 pParty->uTimePlayed += pEventTimer->uTimeElapsed;
|
|
6503 v0 = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60) / 60i64;
|
|
6504 v4 = (unsigned int)(((unsigned int)v0 / 24) / 7) >> 2;
|
|
6505 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60;
|
|
6506 pParty->uCurrentMinute = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60) % 60;
|
|
6507 pParty->uCurrentHour = v0 % 24;
|
|
6508 pParty->uCurrentMonthWeek = ((unsigned int)v0 / 24) / 7 & 3;
|
|
6509 pParty->uDaysPlayed = (unsigned int)((unsigned int)v0 / 24) % 28;
|
|
6510 pParty->uCurrentMonth = v4 % 12;
|
|
6511 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
|
|
6512 if (pParty->uCurrentHour >= 3 && (old_hour < 3 || pParty->uDaysPlayed > old_day)) // new day dawns
|
|
6513 {
|
|
6514 pParty->pHirelings[0].bHasUsedTheAbility = false;
|
|
6515 pParty->pHirelings[1].bHasUsedTheAbility = false;
|
|
6516
|
|
6517 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
|
|
6518 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false;
|
|
6519
|
|
6520 ++pParty->days_played_without_rest;
|
|
6521 if (pParty->days_played_without_rest > 1)
|
|
6522 {
|
|
6523 for (uint i = 0; i < 4; ++i)
|
|
6524 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0);
|
|
6525
|
|
6526 if (pParty->uNumFoodRations)
|
|
6527 Party::TakeFood(1);
|
|
6528 else
|
|
6529 for (uint i = 0; i < 4; ++i)
|
|
6530 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1;
|
|
6531
|
|
6532 if (pParty->days_played_without_rest > 3)
|
|
6533 for (uint i = 0; i < 4; ++i)
|
|
6534 {
|
|
6535 pParty->pPlayers[i].Zero();
|
|
6536 if (!pParty->pPlayers[i].IsPertified() && !pParty->pPlayers[i].IsEradicated()
|
|
6537 && !pParty->pPlayers[i].IsDead())
|
|
6538 {
|
|
6539 if (rand() % 100 < 5 * pParty->days_played_without_rest)
|
|
6540 pParty->pPlayers[i].SetCondDeadWithBlockCheck(0);
|
|
6541 if (rand() % 100 < 10 * pParty->days_played_without_rest)
|
|
6542 pParty->pPlayers[i].SetCondInsaneWithBlockCheck(0);
|
|
6543 }
|
|
6544 }
|
|
6545 }
|
|
6546 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
6547 pOutdoor->SetFog();
|
|
6548
|
|
6549 for (uint i = 0; i < 4; ++i)
|
|
6550 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
|
|
6551 }
|
|
6552
|
|
6553 if (pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed)//water damage
|
|
6554 {
|
|
6555 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128;
|
|
6556 viewparams->bRedrawGameUI = true;
|
|
6557 for (uint pl = 1; pl <= 4; ++pl)
|
|
6558 {
|
|
6559 if (pPlayers[pl]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR)
|
|
6560 || pPlayers[pl]->HasEnchantedItemEquipped(71)
|
|
6561 || pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].uExpireTime > 0)
|
|
6562 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0);
|
|
6563 else
|
|
6564 {
|
|
6565 if (!pPlayers[pl]->HasUnderwaterSuitEquipped())
|
|
6566 {
|
|
6567 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE);
|
|
6568 if (pParty->uFlags & 4)
|
|
6569 {
|
|
6570 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);// Âû òîíåòå!
|
|
6571 GameUI_Footer_TimeLeft = 128;
|
|
6572 }
|
|
6573 }
|
|
6574 else
|
|
6575 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0);
|
|
6576 }
|
|
6577 }
|
|
6578 }
|
|
6579 if (pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed) //lava damage
|
|
6580 {
|
|
6581 viewparams->bRedrawGameUI = true;
|
|
6582 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128;
|
|
6583
|
|
6584 for (uint pl = 1; pl <= 4; pl++)
|
|
6585 {
|
|
6586 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE);
|
|
6587 if (pParty->uFlags & 0x200)
|
|
6588 {
|
|
6589 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); //Âû ãîðèòå!
|
|
6590 GameUI_Footer_TimeLeft = 128;
|
|
6591 }
|
|
6592 }
|
|
6593 }
|
|
6594 _493938_regenerate();
|
|
6595 uint party_condition_flag = 4;
|
|
6596 a2a = pEventTimer->uTimeElapsed;
|
|
6597 if (pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)//çàìåäëåíèå âîññòàíîâëåíèÿ ïðè áåãå
|
|
6598 {
|
|
6599 a2a *= 0.5f;
|
|
6600 if (a2a < 1)
|
|
6601 a2a = 1;
|
|
6602 }
|
|
6603
|
|
6604 for (uint pl = 1; pl <= 4; pl++)
|
|
6605 {
|
|
6606 if (pPlayers[pl]->uTimeToRecovery)
|
|
6607 pPlayers[pl]->Recover(a2a);//âîññòàíîâëåíèå àêòèâíîñòè
|
|
6608 if (pPlayers[pl]->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + pPlayers[pl]->sHealth + pPlayers[pl]->uEndurance >= 1
|
|
6609 || (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0)
|
|
6610 {
|
|
6611 if (pPlayers[pl]->sHealth < 1)
|
|
6612 pPlayers[pl]->SetCondition(Condition_Unconcious, 0);
|
|
6613 }
|
|
6614 else
|
|
6615 pPlayers[pl]->SetCondition(Condition_Dead, 0);
|
|
6616 if (pPlayers[pl]->field_E0)
|
|
6617 {
|
|
6618 v24 = pPlayers[pl]->field_E0 - pEventTimer->uTimeElapsed;
|
|
6619 if (v24 > 0)
|
|
6620 pPlayers[pl]->field_E0 = v24;
|
|
6621 else
|
|
6622 {
|
|
6623 pPlayers[pl]->field_E0 = 0;
|
|
6624 viewparams->bRedrawGameUI = true;
|
|
6625 }
|
|
6626 }
|
|
6627 if (pPlayers[pl]->field_E4)
|
|
6628 {
|
|
6629 v26 = pPlayers[pl]->field_E4 - pEventTimer->uTimeElapsed;
|
|
6630 if (v26 > 0)
|
|
6631 pPlayers[pl]->field_E4 = v26;
|
|
6632 else
|
|
6633 {
|
|
6634 pPlayers[pl]->field_E4 = 0;
|
|
6635 viewparams->bRedrawGameUI = true;
|
|
6636 }
|
|
6637 }
|
|
6638 if (pPlayers[pl]->field_E8)
|
|
6639 {
|
|
6640 v28 = pPlayers[pl]->field_E8 - pEventTimer->uTimeElapsed;
|
|
6641 if (v28 > 0)
|
|
6642 pPlayers[pl]->field_E8 = v28;
|
|
6643 else
|
|
6644 {
|
|
6645 pPlayers[pl]->field_E8 = 0;
|
|
6646 viewparams->bRedrawGameUI = true;
|
|
6647 }
|
|
6648 }
|
|
6649 if (pPlayers[pl]->field_EC)
|
|
6650 {
|
|
6651 v30 = pPlayers[pl]->field_EC - pEventTimer->uTimeElapsed;
|
|
6652 if (v30 > 0)
|
|
6653 pPlayers[pl]->field_EC = v30;
|
|
6654 else
|
|
6655 {
|
|
6656 pPlayers[pl]->field_EC = 0;
|
|
6657 viewparams->bRedrawGameUI = true;
|
|
6658 }
|
|
6659 }
|
|
6660 if (pPlayers[pl]->field_F0)
|
|
6661 {
|
|
6662 v32 = pPlayers[pl]->field_F0 - pEventTimer->uTimeElapsed;
|
|
6663 if (v32 > 0)
|
|
6664 pPlayers[pl]->field_F0 = v32;
|
|
6665 else
|
|
6666 {
|
|
6667 pPlayers[pl]->field_F0 = 0;
|
|
6668 viewparams->bRedrawGameUI = true;
|
|
6669 }
|
|
6670 }
|
|
6671 if (pPlayers[pl]->field_F4)
|
|
6672 {
|
|
6673 v34 = pPlayers[pl]->field_F4 - pEventTimer->uTimeElapsed;
|
|
6674 if (v34 > 0)
|
|
6675 pPlayers[pl]->field_F4 = v34;
|
|
6676 else
|
|
6677 {
|
|
6678 pPlayers[pl]->field_F4 = 0;
|
|
6679 viewparams->bRedrawGameUI = true;
|
|
6680 }
|
|
6681 }
|
|
6682 if (pPlayers[pl]->field_F8)
|
|
6683 {
|
|
6684 v36 = pPlayers[pl]->field_F8 - pEventTimer->uTimeElapsed;
|
|
6685 if (v36 > 0)
|
|
6686 pPlayers[pl]->field_F8 = v36;
|
|
6687 else
|
|
6688 {
|
|
6689 pPlayers[pl]->field_F8 = 0;
|
|
6690 viewparams->bRedrawGameUI = true;
|
|
6691 }
|
|
6692 }
|
|
6693 if (pPlayers[pl]->field_FC)
|
|
6694 {
|
|
6695 v38 = pPlayers[pl]->field_FC - pEventTimer->uTimeElapsed;
|
|
6696 if (v38 > 0)
|
|
6697 pPlayers[pl]->field_FC = v38;
|
|
6698 else
|
|
6699 {
|
|
6700 pPlayers[pl]->field_FC = 0;
|
|
6701 viewparams->bRedrawGameUI = true;
|
|
6702 }
|
|
6703 }
|
|
6704 if (pPlayers[pl]->field_100)
|
|
6705 {
|
|
6706 v40 = pPlayers[pl]->field_100 - pEventTimer->uTimeElapsed;
|
|
6707 if (v40 > 0)
|
|
6708 pPlayers[pl]->field_100 = v40;
|
|
6709 else
|
|
6710 {
|
|
6711 pPlayers[pl]->field_100 = 0;
|
|
6712 viewparams->bRedrawGameUI = true;
|
|
6713 }
|
|
6714 }
|
|
6715 if (pPlayers[pl]->field_104)
|
|
6716 {
|
|
6717 v42 = pPlayers[pl]->field_104 - pEventTimer->uTimeElapsed;
|
|
6718 if (v42 > 0)
|
|
6719 pPlayers[pl]->field_104 = v42;
|
|
6720 else
|
|
6721 {
|
|
6722 pPlayers[pl]->field_104 = 0;
|
|
6723 viewparams->bRedrawGameUI = true;
|
|
6724 }
|
|
6725 }
|
|
6726 if (pPlayers[pl]->pConditions[Condition_Sleep] | pPlayers[pl]->pConditions[Condition_Paralyzed]
|
|
6727 | pPlayers[pl]->pConditions[Condition_Unconcious] | pPlayers[pl]->pConditions[Condition_Dead]
|
|
6728 | pPlayers[pl]->pConditions[Condition_Pertified] | pPlayers[pl]->pConditions[Condition_Eradicated])
|
|
6729 --party_condition_flag;
|
|
6730 v43 = (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0; //ñïåøêà
|
|
6731
|
|
6732 for (uint k = 0; k < 24; ++k)
|
|
6733 pPlayers[pl]->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed);
|
|
6734
|
|
6735 if (v43 && (signed __int64)pPlayers[pl]->pPlayerBuffs[7].uExpireTime <= 0)
|
|
6736 pPlayers[pl]->SetCondition(Condition_Weak, 0);
|
|
6737 }
|
|
6738
|
|
6739 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0;
|
|
6740
|
|
6741 for (uint i = 0; i < 20; ++i)
|
|
6742 {
|
|
6743 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1)
|
|
6744 viewparams->bRedrawGameUI = true;
|
|
6745 }
|
|
6746
|
|
6747 if (v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0)
|
|
6748 {
|
|
6749 for (uint i = 0; i < 4; ++i)
|
|
6750 pParty->pPlayers[i].SetCondition(1, 0);
|
|
6751 }
|
|
6752
|
|
6753 for (uint i = 0; i < 2; ++i)//Ïðîâåðêà â ñîçíàíèè ëè ïåðñ ñäåëàâøèé çàêë íà ïîë¸ò è õîæäåíèå ïî âîäå
|
|
6754 {
|
|
6755 SpellBuff* pBuf = &pParty->pPartyBuffs[Party_Spec_Motion_status_ids[i]];
|
|
6756 if (pBuf->uExpireTime == 0)
|
|
6757 continue;
|
|
6758
|
|
6759 if (!(pBuf->uFlags & 1))
|
|
6760 {
|
|
6761 if (!pPlayers[pBuf->uCaster]->CanAct())
|
|
6762 {
|
|
6763 pBuf->Reset();
|
|
6764 if (Party_Spec_Motion_status_ids[i] == PARTY_BUFF_FLY)
|
|
6765 pParty->bFlying = false;
|
|
6766 }
|
|
6767 }
|
|
6768 }
|
|
6769
|
|
6770 if (!party_condition_flag)
|
|
6771 {
|
|
6772 if (pCurrentScreen != SCREEN_REST)
|
|
6773 {
|
|
6774 for (uint pl = 1; pl <= 4; pl++)
|
|
6775 {
|
|
6776 if (pPlayers[pl]->pConditions[Condition_Sleep])
|
|
6777 {
|
|
6778 pPlayers[pl]->pConditions[Condition_Sleep] = 0;
|
|
6779 party_condition_flag = 1;
|
|
6780 break;
|
|
6781 }
|
|
6782 }
|
|
6783 if (!party_condition_flag || _5C35C0_force_party_death)
|
|
6784 uGameState = GAME_STATE_PARTY_DIED;
|
|
6785 }
|
|
6786 }
|
|
6787
|
|
6788 if (uActiveCharacter)//âûáîð ñëåäóþùåãî ïîñëå ïðîïóñêàþùåãî õîä
|
|
6789 {
|
|
6790 if (pCurrentScreen != SCREEN_REST)
|
|
6791 {
|
|
6792 if (pPlayers[uActiveCharacter]->pConditions[Condition_Sleep]
|
|
6793 || pPlayers[uActiveCharacter]->pConditions[Condition_Paralyzed]
|
|
6794 || pPlayers[uActiveCharacter]->pConditions[Condition_Unconcious]
|
|
6795 || pPlayers[uActiveCharacter]->pConditions[Condition_Dead]
|
|
6796 || pPlayers[uActiveCharacter]->pConditions[Condition_Pertified]
|
|
6797 || pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated])
|
|
6798 {
|
|
6799 viewparams->bRedrawGameUI = true;
|
|
6800 uActiveCharacter = pParty->GetNextActiveCharacter();
|
|
6801 }
|
|
6802 }
|
|
6803 }
|
|
6804 }
|
|
6805
|
|
6806 //----- (00493938) --------------------------------------------------------
|
|
6807 void _493938_regenerate()
|
|
6808 {
|
|
6809 int current_time; // edi@1
|
|
6810 int last_reg_time; // qax@1
|
|
6811 int v4; // eax@2
|
|
6812 int v5; // edi@5
|
|
6813 long long *v6; // ecx@5
|
|
6814 char v7; // sf@5
|
|
6815 int *v8; // ecx@10
|
|
6816 int v9; // edi@15
|
|
6817 signed int v10; // eax@15
|
|
6818 // __int16 *v11; // edx@16
|
|
6819 // int v12; // eax@20
|
|
6820 int numberOfActorsAffected; // ebx@20
|
|
6821 unsigned int v14; // esi@21
|
|
6822 //unsigned int v15; // ecx@21
|
|
6823 //unsigned int v16; // eax@21
|
|
6824 // int v18; // eax@21
|
|
6825 signed int v19; // eax@21
|
|
6826 bool recovery_HP; // ebx@25
|
|
6827 // ITEM_EQUIP_TYPE v22; // edi@30
|
|
6828 signed int v25; // eax@33
|
|
6829 // int v26; // eax@35
|
|
6830 // int v27; // eax@36
|
|
6831 // int v28; // eax@37
|
|
6832 signed int v31; // ecx@53
|
|
6833 int actorsAffectedByImmolation[100]; // [sp+4h] [bp-22Ch]@20
|
|
6834 SpriteObject a1; // [sp+194h] [bp-9Ch]@15
|
|
6835 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15
|
|
6836 bool has_dragon_flag; // [sp+210h] [bp-20h]@22
|
|
6837 bool lich_jar_flag; // [sp+214h] [bp-1Ch]@25
|
|
6838 bool zombie_flag; // [sp+218h] [bp-18h]@25
|
|
6839 bool decrease_HP; // [sp+21Ch] [bp-14h]@25
|
|
6840 bool lich_flag; // [sp+220h] [bp-10h]@25
|
|
6841 int v49; // [sp+224h] [bp-Ch]@24
|
|
6842 bool recovery_SP; // [sp+228h] [bp-8h]@25
|
|
6843 bool redraw_flag; // [sp+22Ch] [bp-4h]@2
|
|
6844
|
|
6845 current_time = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60;
|
|
6846 last_reg_time = (signed int)(signed __int64)((double)pParty->uLastRegenerationTime * 0.234375) / 60;
|
|
6847 if (current_time >= (signed int)last_reg_time + 5)
|
|
6848 {
|
|
6849 redraw_flag = false;
|
|
6850 v4 = (current_time - last_reg_time) / 5;
|
|
6851 if (pParty->FlyActive())
|
|
6852 {
|
|
6853 if (pParty->bFlying)
|
|
6854 {
|
|
6855 if (!(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1))
|
|
6856 {
|
|
6857 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
|
|
6858 //cursed_flag = pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[Condition_Cursed];//cursed
|
|
6859 //v7 = cursed_flag < v5;
|
|
6860 //cursed_flag -= v5;
|
|
6861
|
|
6862 v6 = &pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[Condition_Cursed];
|
|
6863
|
|
6864 if (*v6 < v5)
|
|
6865 {
|
|
6866 v6 = 0;
|
|
6867 pParty->uFlags &= 0xFFFFFFBFu;
|
|
6868 pParty->bFlying = false;
|
|
6869 redraw_flag = true;
|
|
6870 }
|
|
6871 }
|
|
6872 }
|
|
6873 }
|
|
6874
|
|
6875 if (pParty->WaterWalkActive())
|
|
6876 {
|
|
6877 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER)
|
|
6878 {
|
|
6879 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1))
|
|
6880 { // taking on water
|
|
6881 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].pConditions[Condition_Cursed];//&AA1058_PartyQuickSpellSound[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000];
|
|
6882 v7 = *v8 < v4;
|
|
6883 *v8 -= v4;
|
|
6884 if (v7)
|
|
6885 {
|
|
6886 *v8 = 0;
|
|
6887 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
|
|
6888 redraw_flag = true;
|
|
6889 }
|
|
6890 }
|
|
6891 }
|
|
6892 }
|
|
6893
|
|
6894 if (pParty->ImmolationActive())//Æåðòâà
|
|
6895 {
|
|
6896 a3.z = 0;
|
|
6897 a3.y = 0;
|
|
6898 a3.x = 0;
|
|
6899 a1.stru_24.Reset();
|
|
6900 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower;
|
|
6901 a1.spell_skill = pParty->ImmolationSkillLevel();
|
|
6902 v10 = 0;
|
|
6903 a1.uType = 1070;
|
|
6904 a1.spell_id = SPELL_FIRE_IMMOLATION;
|
|
6905 v10 = 0;
|
|
6906 for (uint i = 0; i > pObjectList->uNumObjects; i++)
|
|
6907 {
|
|
6908 if (pObjectList->pObjects[i].uObjectID == stru_4E3ACC[8].uType)
|
|
6909 v10 = i;
|
|
6910 }
|
|
6911 a1.uObjectDescID = v10;
|
|
6912 a1.field_60_distance_related_prolly_lod = 0;
|
|
6913 a1.uAttributes = 0;
|
|
6914 a1.uSectorID = 0;
|
|
6915 a1.uSpriteFrameID = 0;
|
|
6916 a1.spell_caster_pid = PID(OBJECT_Player, pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster);
|
|
6917 a1.uFacing = 0;
|
|
6918 a1.uSoundID = 0;
|
|
6919 numberOfActorsAffected = pParty->_46A89E_immolation_effect(actorsAffectedByImmolation, 100, 307);
|
|
6920 for (v9 = 0; v9 < numberOfActorsAffected; ++v9)
|
|
6921 {
|
|
6922 v14 = actorsAffectedByImmolation[v9];
|
|
6923 a1.vPosition.x = pActors[v14].vPosition.x;
|
|
6924 a1.vPosition.y = pActors[v14].vPosition.y;
|
|
6925 a1.vPosition.z = pActors[v14].vPosition.z;
|
|
6926 a1.spell_target_pid = PID(OBJECT_Actor, v14);
|
|
6927 v19 = a1.Create(0, 0, 0, 0);
|
|
6928 Actor::DamageMonsterFromParty(PID(OBJECT_Item, v19), v14, &a3);
|
|
6929 }
|
|
6930 }
|
|
6931
|
|
6932 has_dragon_flag = false;
|
|
6933 if (PartyHasDragon())
|
|
6934 has_dragon_flag = true;
|
|
6935
|
|
6936 for (v49 = 0; v49 < 4; v49++)
|
|
6937 {
|
|
6938 recovery_HP = false;
|
|
6939 recovery_SP = false;
|
|
6940 decrease_HP = false;
|
|
6941 lich_flag = false;
|
|
6942 lich_jar_flag = false;
|
|
6943 zombie_flag = false;
|
|
6944
|
|
6945 for (int v22 = 0; (signed int)v22 < 16; v22++)
|
|
6946 {
|
|
6947 if (pParty->pPlayers[v49].HasItemEquipped((ITEM_EQUIP_TYPE)v22))
|
|
6948 {
|
|
6949 uint _idx = pParty->pPlayers[v49].pEquipment.pIndices[v22];
|
|
6950 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID > 134)
|
|
6951 {
|
|
6952 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_RELIC_ETHRICS_STAFF)
|
|
6953 decrease_HP = true;
|
|
6954 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HERMES_SANDALS)
|
|
6955 {
|
|
6956 recovery_HP = true;
|
|
6957 recovery_SP = true;
|
|
6958 }
|
|
6959 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_MINDS_EYE)
|
|
6960 recovery_SP = true;
|
|
6961 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HEROS_BELT)
|
|
6962 recovery_HP = true;
|
|
6963 }
|
|
6964 else
|
|
6965 {
|
|
6966 v25 = pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uSpecEnchantmentType;
|
|
6967 if (v25 == 37 //of Regeneration("Regenerate 1hp/x while walking, etc")
|
|
6968 || v25 == 44 //of Life("HP (+10), Regen hpts")
|
|
6969 || v25 == 50 //of The Phoenix("Fire Res (+30), Regen hpts") &&
|
|
6970 || v25 == 54)// of The Troll("End (+15), Regen hpts")
|
|
6971 recovery_HP = true;
|
|
6972 if (v25 == 38 //of Mana("Regenerate 1sp/x while walking, etc")
|
|
6973 || v25 == 47 //of The Eclipse("SP (+10), Regen spts")
|
|
6974 || v25 == 55)//of The Unicorn("Luck (+15), Regen spts")
|
|
6975 recovery_SP = true;
|
|
6976 if (v25 == 66)// of Plenty("Regenerate 1 hp/x and 1 sp/x while walking, etc.")
|
|
6977 {
|
|
6978 recovery_HP = true;
|
|
6979 recovery_SP = true;
|
|
6980 }
|
|
6981 }
|
|
6982
|
|
6983 if (recovery_HP &&
|
|
6984 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
|
|
6985 !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
|
|
6986 {
|
|
6987 if (pParty->pPlayers[v49].sHealth < pParty->pPlayers[v49].GetMaxHealth())
|
|
6988 ++pParty->pPlayers[v49].sHealth;
|
|
6989 if (pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0)
|
|
6990 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0;
|
|
6991 redraw_flag = true;
|
|
6992 }
|
|
6993
|
|
6994 if (recovery_SP &&
|
|
6995 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
|
|
6996 !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
|
|
6997 {
|
|
6998 if (pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana())
|
|
6999 ++pParty->pPlayers[v49].sMana;
|
|
7000 redraw_flag = true;
|
|
7001 }
|
|
7002
|
|
7003 if (decrease_HP &&
|
|
7004 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
|
|
7005 !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
|
|
7006 {
|
|
7007 --pParty->pPlayers[v49].sHealth;
|
|
7008 if (!(pParty->pPlayers[v49].pConditions[Condition_Unconcious]) && pParty->pPlayers[v49].sHealth < 0)
|
|
7009 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed;
|
|
7010 if (pParty->pPlayers[v49].sHealth < 1)
|
|
7011 {
|
|
7012 if (pParty->pPlayers[v49].sHealth + pParty->pPlayers[v49].uEndurance + pParty->pPlayers[v49].GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1
|
|
7013 || (signed __int64)pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0)
|
|
7014 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed;
|
|
7015 else
|
|
7016 {
|
|
7017 if (!pParty->pPlayers[v49].pConditions[Condition_Dead])
|
|
7018 pParty->pPlayers[v49].pConditions[Condition_Dead] = pParty->uTimePlayed;
|
|
7019 }
|
|
7020 }
|
|
7021 redraw_flag = true;
|
|
7022 }
|
|
7023 }
|
|
7024 }
|
|
7025
|
|
7026 //regeneration
|
|
7027 if (pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uExpireTime > 0
|
|
7028 && !pParty->pPlayers[v49].pConditions[Condition_Dead]
|
|
7029 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
|
|
7030 {
|
|
7031 pParty->pPlayers[v49].sHealth += 5 * pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uPower;
|
|
7032 if (pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth())
|
|
7033 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].GetMaxHealth();
|
|
7034 if (pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0)
|
|
7035 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0;
|
|
7036 redraw_flag = true;
|
|
7037 }
|
|
7038
|
|
7039 //for warlock
|
|
7040 if (has_dragon_flag && pParty->pPlayers[v49].classType == PLAYER_CLASS_WARLOCK)
|
|
7041 {
|
|
7042 if (pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana())
|
|
7043 ++pParty->pPlayers[v49].sMana;
|
|
7044 redraw_flag = true;
|
|
7045 }
|
|
7046
|
|
7047 //for lich
|
|
7048 if (pParty->pPlayers[v49].classType == PLAYER_CLASS_LICH)
|
|
7049 {
|
|
7050 for (v31 = 0; v31 < 126; ++v31)
|
|
7051 {
|
|
7052 if (pParty->pPlayers[v49].pInventoryItemList[v31].uItemID == ITEM_LICH_JAR_FULL)
|
|
7053 lich_jar_flag = true;
|
|
7054 }
|
|
7055 lich_flag = true;
|
|
7056 }
|
|
7057 if (lich_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead]
|
|
7058 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
|
|
7059 {
|
|
7060 if (pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2)
|
|
7061 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 2;
|
|
7062 if (pParty->pPlayers[v49].sMana > pParty->pPlayers[v49].GetMaxMana() / 2)
|
|
7063 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 2;
|
|
7064 }
|
|
7065 if (lich_jar_flag)
|
|
7066 {
|
|
7067 if (pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana())
|
|
7068 ++pParty->pPlayers[v49].sMana;
|
|
7069 }
|
|
7070
|
|
7071 //for zombie
|
|
7072 if (pParty->pPlayers[v49].pConditions[Condition_Zombie])
|
|
7073 zombie_flag = true;
|
|
7074 if (zombie_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead]
|
|
7075 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
|
|
7076 {
|
|
7077 if (pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2)
|
|
7078 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 1;
|
|
7079 if (pParty->pPlayers[v49].sMana > 0)
|
|
7080 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 1;
|
|
7081 }
|
|
7082 }
|
|
7083 pParty->uLastRegenerationTime = pParty->uTimePlayed;
|
|
7084 if (!viewparams->bRedrawGameUI)
|
|
7085 viewparams->bRedrawGameUI = redraw_flag;
|
|
7086 }
|
|
7087 }
|
|
7088
|
|
7089 //----- (00491E3A) --------------------------------------------------------
|
|
7090 void sub_491E3A()
|
|
7091 {
|
|
7092 signed int v1; // esi@3
|
|
7093 unsigned int v3; // eax@7
|
|
7094 unsigned int v4; // edx@8
|
|
7095 int v6; // edi@17
|
|
7096
|
|
7097 //__debugbreak();//Ritor1
|
|
7098 for (uint pl = 0; pl < 4; pl++)
|
|
7099 {
|
|
7100 if (SoundSetAction[24][0])
|
|
7101 {
|
|
7102 v3 = 0;
|
|
7103 for (v1 = 0; v1 < (signed int)pSoundList->sNumSounds; ++v1)
|
|
7104 {
|
|
7105 int ps = 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998;//6728
|
|
7106 if (pSoundList->pSL_Sounds[v1].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998)
|
|
7107 v3 = v1;
|
|
7108 }
|
|
7109 pSoundList->UnloadSound(v3, 1);
|
|
7110 for (v4 = 0; (signed int)v4 < (signed int)pSoundList->sNumSounds; ++v4)
|
|
7111 {
|
|
7112 if (pSoundList->pSL_Sounds[v4].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4999)
|
|
7113 pSoundList->UnloadSound(v4, 1);
|
|
7114 }
|
|
7115 }
|
|
7116 }
|
|
7117 v6 = pIcons_LOD->uNumLoadedFiles - 1;
|
|
7118 if (v6 >= pIcons_LOD->pFacesLock)
|
|
7119 {
|
|
7120 do
|
|
7121 {
|
|
7122 pIcons_LOD->pTextures[v6].Release();
|
|
7123 if (pIcons_LOD->pHardwareTextures)
|
|
7124 {
|
|
7125 if (pIcons_LOD->pHardwareTextures[v6])
|
|
7126 {
|
|
7127 pIcons_LOD->pHardwareTextures[v6]->Release();
|
|
7128 pIcons_LOD->pHardwareTextures[v6] = 0;
|
|
7129 }
|
|
7130 }
|
|
7131 if (pIcons_LOD->pHardwareSurfaces)
|
|
7132 {
|
|
7133 if (pIcons_LOD->pHardwareSurfaces[v6])
|
|
7134 {
|
|
7135 pIcons_LOD->pHardwareSurfaces[v6]->Release();
|
|
7136 pIcons_LOD->pHardwareSurfaces[v6] = 0;
|
|
7137 }
|
|
7138 }
|
|
7139 --v6;
|
|
7140 } while (v6 >= pIcons_LOD->pFacesLock);
|
|
7141 }
|
|
7142 pIcons_LOD->uNumLoadedFiles = pIcons_LOD->pFacesLock;
|
|
7143 pIcons_LOD->pFacesLock = 0;
|
|
7144 }
|
|
7145 // 4ED498: using guessed type char byte_4ED498;
|
|
7146
|
|
7147 //----- (00494820) --------------------------------------------------------
|
|
7148 unsigned int __fastcall _494820_training_time(unsigned int a1)
|
|
7149 {
|
|
7150 signed int v1; // eax@1
|
|
7151
|
|
7152 v1 = 5;
|
|
7153 if (a1 % 24 >= 5)
|
|
7154 v1 = 29;
|
|
7155 return v1 - a1 % 24;
|
|
7156 }
|
|
7157
|
|
7158 //----- (00494836) --------------------------------------------------------
|
|
7159 int stru339_spell_sound::AddPartySpellSound(int uSoundID, int a6)
|
|
7160 {
|
|
7161 int v3; // esi@1
|
|
7162 int result; // eax@1
|
|
7163 //stru339_spell_sound *v5; // ebx@1
|
|
7164 //int *v6; // edi@2
|
|
7165 unsigned int v7; // eax@3
|
|
7166 int v8; // [sp+Ch] [bp-8h]@3
|
|
7167 int v9; // [sp+10h] [bp-4h]@2
|
|
7168 int a2a; // [sp+1Ch] [bp+8h]@1
|
|
7169 //return 0;
|
|
7170 v3 = 0;
|
|
7171 result = word_4EE088_sound_ids[uSoundID];
|
|
7172 //v5 = this;
|
|
7173 a2a = word_4EE088_sound_ids[uSoundID];
|
|
7174 if (word_4EE088_sound_ids[uSoundID])
|
|
7175 {
|
|
7176 //v6 = this->pSoundsOffsets;
|
|
7177 for (v9 = 0; v9 < 2; ++v9)
|
|
7178 {
|
|
7179 v7 = a2a++;
|
|
7180 result = pSoundList->LoadSound(v7, (char *)this + v3, 44744 - v3, &v8, a6);
|
|
7181 if (!result)
|
|
7182 break;
|
|
7183 a6 += 4;
|
|
7184 result = v8 + 256;
|
|
7185 this->pSoundsOffsets[v9] = v3;
|
|
7186 v3 += result;
|
|
7187 this->pSoundsSizes[v9] = v8 + 256;
|
|
7188 //++v6;
|
|
7189 }
|
|
7190 }
|
|
7191 return result;
|
|
7192 }
|
|
7193 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
|
|
7194
|
|
7195 //----- (00443E31) --------------------------------------------------------
|
|
7196 void LoadLevel_InitializeLevelStr()
|
|
7197 {
|
|
7198
|
|
7199 // char Args[100];
|
|
7200 int string_num;
|
|
7201 int max_string_length;
|
|
7202 // int current_string_length;
|
|
7203 int prev_string_offset;
|
|
7204
|
|
7205 if (sizeof(pLevelStrOffsets) != 2000)
|
|
7206 Log::Warning(L"pLevelStrOffsets: deserialization warning");
|
|
7207 memset(pLevelStrOffsets.data(), 0, 2000);
|
|
7208
|
|
7209 max_string_length = 0;
|
|
7210 string_num = 1;
|
|
7211 prev_string_offset = 0;
|
|
7212 pLevelStrOffsets[0] = 0;
|
|
7213 for (uint i = 0; i < uLevelStrFileSize; ++i)
|
|
7214 {
|
|
7215 if (!pLevelStr[i])
|
|
7216 {
|
|
7217 pLevelStrOffsets[string_num] = i + 1;
|
|
7218 ++string_num;
|
|
7219 if (i - prev_string_offset > max_string_length)
|
|
7220 max_string_length = i - prev_string_offset;
|
|
7221 prev_string_offset = i;
|
|
7222 }
|
|
7223 }
|
|
7224
|
|
7225 uLevelStrNumStrings = string_num - 1;
|
|
7226 if (max_string_length > 800)
|
|
7227 Error("MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length + 1);
|
|
7228
|
|
7229 if (uLevelStrNumStrings > 0)
|
|
7230 {
|
|
7231 for (uint i = 0; i <uLevelStrNumStrings; ++i)
|
|
7232 {
|
|
7233 if (RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]])
|
|
7234 ++pLevelStrOffsets[i];
|
|
7235 }
|
|
7236 }
|
|
7237 }
|
|
7238
|
|
7239 //----- (00443F95) --------------------------------------------------------
|
|
7240 void OnMapLeave()
|
|
7241 {
|
|
7242 _evt_raw *test_event;
|
|
7243 if (uLevelEVT_NumEvents > 0)
|
|
7244 {
|
|
7245 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
|
|
7246 {
|
|
7247 test_event = (_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT];
|
|
7248 if (test_event->_e_type == EVENT_OnMapLeave)
|
|
7249 {
|
|
7250 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num);
|
|
7251 }
|
|
7252 }
|
|
7253 }
|
|
7254 }
|
|
7255
|
|
7256 //----- (00443FDC) --------------------------------------------------------
|
|
7257 void OnMapLoad()
|
|
7258 {
|
|
7259 int v6; // eax@9
|
|
7260 unsigned __int64 v8; // qax@26
|
|
7261 int hours; // ebx@26
|
|
7262 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
|
|
7263 unsigned int seconds; // [sp+14h] [bp-3Ch]@26
|
|
7264 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
|
|
7265 unsigned int minutes; // [sp+2Ch] [bp-24h]@26
|
|
7266 unsigned int years; // [sp+34h] [bp-1Ch]@26
|
|
7267 unsigned int weeks; // [sp+38h] [bp-18h]@26
|
|
7268 int v26; // [sp+3Ch] [bp-14h]@15
|
|
7269 unsigned int days; // [sp+3Ch] [bp-14h]@26
|
|
7270 unsigned int months; // [sp+40h] [bp-10h]@26
|
|
7271
|
|
7272 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
|
|
7273 {
|
|
7274 EventIndex pEvent = pLevelEVT_Index[i];
|
|
7275
|
|
7276 _evt_raw* _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]);
|
|
7277
|
|
7278 if (_evt->_e_type == EVENT_PlaySound)
|
|
7279 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0);
|
|
7280 else if (_evt->_e_type == EVENT_OnMapReload)
|
|
7281 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
|
|
7282 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
|
|
7283 {
|
|
7284 //v3 = &MapsLongTimersList[MapsLongTimers_count];
|
|
7285 v20 = pOutdoor->loc_time.uLastVisitDay;
|
|
7286 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
7287 v20 = pIndoor->stru1.uLastVisitDay;
|
|
7288
|
|
7289 MapsLongTimersList[MapsLongTimers_count].timer_evt_type = _evt->_e_type;
|
|
7290 MapsLongTimersList[MapsLongTimers_count].timer_evt_ID = pEvent.uEventID;
|
|
7291 MapsLongTimersList[MapsLongTimers_count].timer_evt_seq_num = pEvent.event_sequence_num;
|
|
7292
|
|
7293 MapsLongTimersList[MapsLongTimers_count].YearsInterval = _evt->v5;
|
|
7294 MapsLongTimersList[MapsLongTimers_count].MonthsInterval = _evt->v6;
|
|
7295 MapsLongTimersList[MapsLongTimers_count].WeeksInterval = _evt->v7;
|
|
7296 MapsLongTimersList[MapsLongTimers_count].HoursInterval = _evt->v8;
|
|
7297 MapsLongTimersList[MapsLongTimers_count].MinutesInterval = _evt->v9;
|
|
7298 MapsLongTimersList[MapsLongTimers_count].SecondsInterval = _evt->v10;
|
|
7299
|
|
7300
|
|
7301 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
|
|
7302
|
|
7303 MapsLongTimersList[MapsLongTimers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
|
|
7304 MapsLongTimersList[MapsLongTimers_count].IntervalHalfMins = ((unsigned short)_evt->v12 << 8) + _evt->v11;
|
|
7305 if (MapsLongTimersList[MapsLongTimers_count].timer_evt_type == EVENT_Initialize && !(short)v6)
|
|
7306 {
|
|
7307 if (v20)
|
|
7308 v18 = pParty->uTimePlayed - v20;
|
|
7309 else
|
|
7310 v18 = 0;
|
|
7311 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
|
|
7312
|
|
7313 if (v26 / 7 / 4 / 12 != 0 && MapsLongTimersList[MapsLongTimers_count].YearsInterval ||
|
|
7314 v26 / 7 / 4 != 0 && MapsLongTimersList[MapsLongTimers_count].MonthsInterval != 0 ||
|
|
7315 v26 / 7 != 0 && MapsLongTimersList[MapsLongTimers_count].WeeksInterval != 0 ||
|
|
7316 v26 != 0 || !v20)
|
|
7317 {
|
|
7318 ++MapsLongTimers_count;
|
|
7319 MapsLongTimersList[MapsLongTimers_count].NextStartTime = 0;
|
|
7320 continue;
|
|
7321 }
|
|
7322 }
|
|
7323 else
|
|
7324 {
|
|
7325 v8 = (__int64)((double)pParty->uTimePlayed * 0.234375);
|
|
7326 seconds = v8 % 60;
|
|
7327 minutes = (v8 / 60) % 60;
|
|
7328 hours = ((v8 / 60) / 60) % 24;
|
|
7329 days = (((v8 / 60) / 60) / 24) % 7;
|
|
7330 weeks = ((((v8 / 60) / 60) / 24) / 7) % 4;
|
|
7331 months = (((((v8 / 60) / 60) / 24) / 7) / 4) % 12;
|
|
7332 years = (((((v8 / 60) / 60) / 24) / 7) / 4) / 12;
|
|
7333
|
|
7334 if (MapsLongTimersList[MapsLongTimers_count].YearsInterval)
|
|
7335 ++years;
|
|
7336 else if (MapsLongTimersList[MapsLongTimers_count].MonthsInterval)
|
|
7337 ++months;
|
|
7338 else if (MapsLongTimersList[MapsLongTimers_count].WeeksInterval)
|
|
7339 ++weeks;
|
|
7340 else
|
|
7341 {
|
|
7342 ++days;
|
|
7343 hours = MapsLongTimersList[MapsLongTimers_count].HoursInterval;
|
|
7344 minutes = MapsLongTimersList[MapsLongTimers_count].MinutesInterval;
|
|
7345 seconds = MapsLongTimersList[MapsLongTimers_count].SecondsInterval;
|
|
7346 }
|
|
7347 MapsLongTimersList[MapsLongTimers_count].NextStartTime = (signed __int64)((double)((seconds
|
|
7348 + 60 * minutes
|
|
7349 + 3600 * hours
|
|
7350 + 86400 * days
|
|
7351 + 604800 * weeks
|
|
7352 + 2419200 * months
|
|
7353 + 29030400 * years) << 7)
|
|
7354 * 0.033333335);
|
|
7355
|
|
7356 ++MapsLongTimers_count;
|
|
7357 }
|
|
7358 }
|
|
7359 }
|
|
7360 }
|
|
7361
|
|
7362 //----- (00444360) --------------------------------------------------------
|
|
7363 void Level_LoadEvtAndStr(const char *pLevelName)
|
|
7364 {
|
|
7365 char pContainerName[120]; // [sp+8h] [bp-98h]@1
|
|
7366
|
|
7367 sprintf(pContainerName, "%s.evt", pLevelName);
|
|
7368 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216);
|
|
7369
|
|
7370 sprintf(pContainerName, "%s.str", pLevelName);
|
|
7371 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216);
|
|
7372 if (uLevelStrFileSize)
|
|
7373 LoadLevel_InitializeLevelStr();
|
|
7374 }
|
|
7375
|
|
7376 //----- (004452BB) --------------------------------------------------------
|
|
7377 void sub_4452BB()
|
|
7378 {
|
|
7379 pGUIWindow2->Release();
|
|
7380 pGUIWindow2 = 0;
|
|
7381 activeLevelDecoration = _591094_decoration;
|
|
7382 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
|
|
7383 activeLevelDecoration = nullptr;
|
|
7384 pEventTimer->Resume();
|
|
7385 }
|
|
7386
|
|
7387 //----- (0044100D) --------------------------------------------------------
|
|
7388 bool _44100D_should_alter_right_panel()
|
|
7389 {
|
|
7390 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
|
|
7391 pCurrentScreen == SCREEN_HOUSE || pCurrentScreen == SCREEN_E ||
|
|
7392 pCurrentScreen == SCREEN_CHANGE_LOCATION || pCurrentScreen == SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
|
|
7393 }
|
|
7394
|
|
7395 //----- (0044987B) --------------------------------------------------------
|
|
7396 void Transition_StopSound_Autosave(const char *pMapName, MapStartPoint start_point)
|
|
7397 {
|
|
7398 pAudioPlayer->StopChannels(-1, -1);
|
|
7399 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None);
|
|
7400 if (_stricmp(pCurrentMapName, pMapName))
|
|
7401 SaveGame(1, 0);
|
|
7402
|
|
7403 uGameState = GAME_STATE_CHANGE_LOCATION;
|
|
7404 strcpy(pCurrentMapName, pMapName);
|
|
7405 uLevel_StartingPointType = start_point;
|
|
7406 }
|
|
7407 // 6BE35C: using guessed type int uLevel_StartingPointType;
|
|
7408
|
|
7409 //----- (004451A8) --------------------------------------------------------
|
|
7410 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4)
|
|
7411 {
|
|
7412 if (!pGUIWindow2)
|
|
7413 {
|
|
7414 if (pParty->uFlags & 2)
|
|
7415 pGame->Draw();
|
|
7416 pAudioPlayer->StopChannels(-1, -1);
|
|
7417 pMiscTimer->Pause();
|
|
7418 pEventTimer->Pause();
|
|
7419 dword_5C3418 = a1;
|
|
7420 dword_5C341C = a2;
|
|
7421 _591094_decoration = activeLevelDecoration;
|
|
7422 pGUIWindow2 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_GreetingNPC, a4, 0);
|
|
7423 pGUIWindow2->CreateButton(61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
|
|
7424 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
|
|
7425 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
|
|
7426 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
|
|
7427 }
|
|
7428 }
|
|
7429
|
|
7430
|
|
7431
|
|
7432
|
|
7433 //----- (00448B67) --------------------------------------------------------
|
|
7434 void OnTimer(int)
|
|
7435 {
|
|
7436 if (pEventTimer->bPaused)
|
|
7437 return;
|
|
7438
|
|
7439 long long v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128;
|
|
7440 if (!v13)
|
|
7441 return;
|
|
7442
|
|
7443 //uint _v2v3 = pParty->uTimePlayed;
|
|
7444 //v3 = HIDWORD(pParty->uTimePlayed);
|
|
7445 //v2 = LODWORD(pParty->uTimePlayed);
|
|
7446
|
|
7447 _5773B8_event_timer = pParty->uTimePlayed;
|
|
7448
|
|
7449 for (uint i = 0; i < MapsLongTimers_count; ++i)
|
|
7450 {
|
|
7451 //v4 = (char *)&array_5B5928_timers[0].field_C;
|
|
7452 MapsLongTimer* timer = &MapsLongTimersList[i];
|
|
7453 //while ( 1 )
|
|
7454 //{
|
|
7455 //v5 = *(short *)v4;
|
|
7456 if (timer->time_left_to_fire)
|
|
7457 {
|
|
7458 if (v13 < timer->time_left_to_fire)
|
|
7459 timer->time_left_to_fire -= v13;
|
|
7460 else
|
|
7461 {
|
|
7462 timer->time_left_to_fire = timer->IntervalHalfMins;
|
|
7463 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
|
|
7464 }
|
|
7465 }
|
|
7466 else
|
|
7467 {
|
|
7468 if (timer->NextStartTime < pParty->uTimePlayed)
|
|
7469 {
|
|
7470 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day
|
|
7471 if (timer->YearsInterval)
|
|
7472 next_trigger_time = 336 * 60 * 60 * 24; // 1 year
|
|
7473 else if (timer->MonthsInterval)
|
|
7474 next_trigger_time = 28 * 60 * 60 * 24; // 1 month
|
|
7475 else if (timer->WeeksInterval)
|
|
7476 next_trigger_time = 7 * 60 * 60 * 24; // 1 week
|
|
7477
|
|
7478 timer->NextStartTime += (next_trigger_time * 128) / 3.0f;
|
|
7479 if (timer->NextStartTime < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
|
|
7480 timer->NextStartTime = pParty->uTimePlayed;
|
|
7481
|
|
7482 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
|
|
7483 }
|
|
7484 }
|
|
7485 }
|
|
7486 }
|
|
7487
|
|
7488
|
|
7489
|
|
7490
|
|
7491
|
|
7492
|
|
7493
|
|
7494 //----- (0044C28F) --------------------------------------------------------
|
|
7495 bool TeleportToNWCDungeon()
|
|
7496 {
|
|
7497 if (!_stricmp("nwc.blv", pCurrentMapName))
|
|
7498 return false;
|
|
7499
|
|
7500 _5B65A8_npcdata_uflags_or_other = 0;
|
|
7501 _5B65AC_npcdata_fame_or_other = 0;
|
|
7502 _5B65B0_npcdata_rep_or_other = 0;
|
|
7503 _5B65B4_npcdata_loword_house_or_other = 0;
|
|
7504 _5B65B8_npcdata_hiword_house_or_other = 0;
|
|
7505 dword_5B65BC = 0;
|
|
7506 dword_5B65C0 = 0;
|
|
7507
|
|
7508 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
|
|
7509 Transition_StopSound_Autosave("nwc.blv", MapStartPoint_Party);
|
|
7510 pCurrentScreen = SCREEN_GAME;
|
|
7511 return true;
|
|
7512 }
|
|
7513
|
|
7514 //----- (00401000) --------------------------------------------------------
|
|
7515 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int(*constructor)(int))
|
|
7516 {
|
|
7517 void *v4; // esi@2
|
|
7518
|
|
7519 if (numObjs > 0)
|
|
7520 {
|
|
7521 v4 = a1;
|
|
7522 for (int i = numObjs; i; --i)
|
|
7523 {
|
|
7524 constructor((int)v4);
|
|
7525 v4 = (char *)v4 + objSize;
|
|
7526 }
|
|
7527 }
|
|
7528 }
|
|
7529
|
|
7530
|
|
7531
|