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