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