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