Mercurial > mm7
annotate Game.cpp @ 2131:651b24553ae9
savegame screenshot fix
author | Ritor1 |
---|---|
date | Sat, 28 Dec 2013 16:49:21 +0600 |
parents | 4f6c52ed6f7c |
children | 49de109bbab5 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
4 |
1016 | 5 #include "Vis.h" |
2121 | 6 #include "Weather.h" |
1016 | 7 #include "LightmapBuilder.h" |
8 #include "DecalBuilder.h" | |
9 #include "ParticleEngine.h" | |
10 #include "Mouse.h" | |
11 #include "Keyboard.h" | |
12 #include "CShow.h" | |
13 #include "GammaControl.h" | |
14 #include "stru6.h" | |
15 #include "stru9.h" | |
16 #include "stru10.h" | |
17 | |
0 | 18 #include "Game.h" |
19 #include "Party.h" | |
20 #include "Viewport.h" | |
2044 | 21 #include "Timer.h" |
0 | 22 #include "Outdoor.h" |
1277 | 23 #include "Outdoor_stuff.h" |
0 | 24 #include "Overlays.h" |
25 #include "AudioPlayer.h" | |
26 #include "LOD.h" | |
27 #include "OSInfo.h" | |
28 #include "GUIWindow.h" | |
29 #include "TurnEngine.h" | |
30 #include "VideoPlayer.h" | |
31 #include "Bink_Smacker.h" | |
32 #include "Events.h" | |
33 #include "Arcomage.h" | |
189 | 34 #include "texts.h" |
791 | 35 #include "GUIFont.h" |
194 | 36 #include "Log.h" |
1262 | 37 #include "Lights.h" |
38 #include "mm7_data.h" | |
1915 | 39 #include "MapInfo.h" |
40 #include "CastSpellInfo.h" | |
41 #include "FrameTableInc.h" | |
42 #include "Actor.h" | |
43 #include "Events2D.h" | |
44 #include "GUIProgressBar.h" | |
45 #include "ObjectList.h" | |
46 #include "Level/Decoration.h" | |
47 #include "PaletteManager.h" | |
48 #include "UI\UIHouses.h" | |
49 #include "SaveLoad.h" | |
50 #include "SpriteObject.h" | |
51 #include "mm7.h" | |
52 #include "Sprites.h" | |
0 | 53 |
54 | |
55 | |
56 | |
57 | |
58 Game *pGame; | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 //----- (00435694) -------------------------------------------------------- | |
65 void Game::ToggleFlags2(unsigned int uFlag) | |
66 { | |
67 unsigned int v2; // eax@1 | |
68 | |
69 v2 = this->uFlags2; | |
70 if ( v2 & uFlag ) | |
71 this->uFlags2 = v2 & ~uFlag; | |
72 else | |
73 this->uFlags2 = uFlag | v2; | |
74 } | |
75 | |
76 //----- (0044103C) -------------------------------------------------------- | |
77 void Game::Draw() | |
78 { | |
142 | 79 //float v2; // ST24_4@11 |
0 | 80 //double v3; // ST28_8@11 |
81 int v4; // edi@26 | |
142 | 82 //int v5; // eax@35 |
0 | 83 |
1556 | 84 uFlags2 &= ~0x02; |
0 | 85 if ( pParty->_497FC5_check_party_perception_against_level() ) |
86 uFlags2 |= 2u; | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1556
diff
changeset
|
87 |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
88 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
89 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
90 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
|
91 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
|
92 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
|
93 |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1556
diff
changeset
|
94 //pIndoorCamera->Initialize2(); |
1642 | 95 pIndoorCameraD3D->CalculateRotations(pParty->sRotationX, pParty->sRotationY); |
0 | 96 pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff(); |
97 pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum(); | |
98 | |
99 if ( pVideoPlayer->AnyMovieLoaded() ) | |
100 { | |
1421 | 101 if ( !pRenderer->pRenderD3D ) |
102 { | |
103 pRenderer->BeginSceneD3D(); | |
104 pMouse->DrawCursorToTarget(); | |
105 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); | |
106 } | |
0 | 107 } |
108 else | |
109 { | |
1110 | 110 if ( pParty->vPosition.x != pParty->vPrevPosition.x || pParty->sRotationY != pParty->sPrevRotationY || pParty->vPosition.y != pParty->vPrevPosition.y |
111 || pParty->sRotationX != pParty->sPrevRotationX || pParty->vPosition.z != pParty->vPrevPosition.z || pParty->sEyelevel != pParty->sPrevEyelevel ) | |
0 | 112 pParty->uFlags |= 2u; |
847 | 113 pParty->vPrevPosition.x = pParty->vPosition.x; |
78 | 114 pParty->vPrevPosition.y = pParty->vPosition.y; |
847 | 115 pParty->vPrevPosition.z = pParty->vPosition.z; |
0 | 116 //v0 = &pRenderer; |
117 pParty->sPrevRotationY = pParty->sRotationY; | |
118 pParty->sPrevRotationX = pParty->sRotationX; | |
847 | 119 |
0 | 120 pParty->sPrevEyelevel = pParty->sEyelevel; |
121 pRenderer->BeginSceneD3D(); | |
122 | |
123 if ( !pRenderer->pRenderD3D ) | |
124 pMouse->DrawCursorToTarget(); | |
265 | 125 if ( !PauseGameDrawing() || viewparams->field_48 == 1 ) |
0 | 126 { |
127 if ( pRenderer->pRenderD3D ) | |
128 { | |
142 | 129 float v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0; |
0 | 130 //v3 = v2 + 6.7553994e15; |
131 //pRenderer->field_1036A8_bitmapid = LODWORD(v3); | |
265 | 132 pRenderer->hd_water_current_frame = floorf(v2 + 0.5f); |
0 | 133 } |
134 | |
135 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
136 pIndoor->Draw(); | |
137 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
138 pOutdoor->Draw(); | |
1545 | 139 else Error("Invalid level type: %u", uCurrentlyLoadedLevelType); |
0 | 140 |
141 if (pRenderer->pRenderD3D) | |
142 { | |
143 pDecalBuilder->DrawBloodsplats(); | |
1394 | 144 pGame->pLightmapBuilder->DrawLightmapsType(2); |
0 | 145 } |
146 } | |
1421 | 147 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); |
0 | 148 } |
791 | 149 |
150 //DEBUG: force redraw gui | |
151 viewparams->bRedrawGameUI = true; | |
152 | |
153 | |
0 | 154 pRenderer->BeginScene(); |
155 if (pRenderer->pRenderD3D) | |
156 pMouse->DrawCursorToTarget(); | |
142 | 157 if (pOtherOverlayList->bRedraw) |
158 viewparams->bRedrawGameUI = true; | |
0 | 159 v4 = viewparams->bRedrawGameUI; |
783 | 160 GameUI_Footer(); |
0 | 161 if (!viewparams->bRedrawGameUI) |
162 { | |
163 GameUI_DrawRightPanelItems(); | |
164 } | |
165 else | |
166 { | |
167 GameUI_DrawRightPanelFrames(); | |
783 | 168 GameUI_Footer_2(); |
0 | 169 viewparams->bRedrawGameUI = false; |
170 } | |
171 if (!pVideoPlayer->pSmackerMovie) | |
172 { | |
2070 | 173 GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, true);//redraw = pParty->uFlags & 2); |
0 | 174 if (v4) |
175 { | |
265 | 176 if ( !PauseGameDrawing() && pRenderer->pRenderD3D) // clear game viewport with transparent color |
693 | 177 pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pViewport->uViewportBR_X - pViewport->uViewportTL_X, |
178 pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, | |
142 | 179 pRenderer->uTargetGMask | pRenderer->uTargetBMask); |
0 | 180 viewparams->field_48 = 0; |
181 } | |
182 } | |
142 | 183 |
184 viewparams->bRedrawGameUI = pOtherOverlayList->bRedraw; | |
185 pOtherOverlayList->bRedraw = 0; | |
186 | |
0 | 187 GameUI_DrawPartySpells(); |
291 | 188 if (v4 || pParty->pHirelings[0].evt_C || pParty->pHirelings[1].evt_C ) |
994 | 189 GameUI_DrawHiredNPCs(); |
0 | 190 GameUI_DrawPortraits(v4); |
191 GameUI_DrawLifeManaBars(); | |
192 GameUI_DrawCharacterSelectionFrame(); | |
193 if ( sub_44100D() ) | |
994 | 194 GameUI_DrawRightPanel(); |
0 | 195 if ( !pVideoPlayer->AnyMovieLoaded() ) |
196 { | |
197 pStru6Instance->DrawPlayerBuffAnims(); | |
569 | 198 pOtherOverlayList->DrawTurnBasedIcon(v4); |
0 | 199 GameUI_DrawTorchlightAndWizardEye(); |
200 } | |
791 | 201 |
794 | 202 |
203 static bool render_framerate = false; | |
204 static float framerate = 0.0f; | |
205 static uint frames_this_second = 0; | |
206 static uint last_frame_time = GetTickCount(); | |
207 static uint framerate_time_elapsed = 0; | |
2123 | 208 if ( pCurrentScreen == SCREEN_GAME && uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
2122 | 209 pWeather->Draw();//Ritor1: my include |
794 | 210 |
1980 | 211 uint frame_dt = GetTickCount() - last_frame_time; |
794 | 212 last_frame_time = GetTickCount(); |
213 | |
214 framerate_time_elapsed += frame_dt; | |
215 if (framerate_time_elapsed >= 1000) | |
216 { | |
217 framerate = frames_this_second * (1000.0f / framerate_time_elapsed); | |
218 | |
219 framerate_time_elapsed = 0; | |
220 frames_this_second = 0; | |
221 render_framerate = true; | |
222 } | |
223 | |
224 ++frames_this_second; | |
225 | |
1507 | 226 extern bool debug_information; |
227 if ( debug_information ) | |
794 | 228 { |
1507 | 229 if (render_framerate) |
230 { | |
231 sprintf(pTmpBuf.data(), "FPS: % .4f", framerate); | |
2069 | 232 pPrimaryWindow->DrawText(pFontArrus, 494, 0, Color16(0, 0, 0), pTmpBuf.data(), 0, 0, 0); |
1507 | 233 } |
794 | 234 |
1507 | 235 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
236 { | |
1980 | 237 int sector_id = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); |
1507 | 238 sprintf(pTmpBuf.data(), "Party Sector ID: %u/%u\n", sector_id, pIndoor->uNumSectors); |
2069 | 239 pPrimaryWindow->DrawText(pFontArrus, 16, 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, -1); |
1507 | 240 } |
241 sprintf(pTmpBuf.data(), "Party Position: % d % d % d", pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
2069 | 242 pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, -1); |
1507 | 243 |
244 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
245 { | |
246 uint uFaceID; | |
1980 | 247 int sector_id = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); |
248 int floor_level = BLV_GetFloorLevel(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + 40, sector_id, &uFaceID); | |
1507 | 249 sprintf(pTmpBuf.data(), "BLV_GetFloorLevel: %d face_id %d\n", floor_level, uFaceID); |
250 } | |
251 else | |
252 { | |
253 int on_water, _a6; | |
1980 | 254 int floor_level = ODM_GetFloorLevel(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z, 0, &on_water, &_a6, false); |
1507 | 255 sprintf(pTmpBuf.data(), "ODM_GetFloorLevel: %d on_water: %s a6 = %d\n", floor_level, on_water ? "true" : "false", _a6); |
256 } | |
2069 | 257 pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16 + 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, -1); |
791 | 258 } |
259 | |
0 | 260 GUI_UpdateWindows(); |
130 | 261 pParty->UpdatePlayersAndHirelingsEmotions(); |
937 | 262 |
434 | 263 _unused_5B5924_is_travel_ui_drawn = false; |
0 | 264 if (v4) |
791 | 265 pMouse->bRedraw = true; |
0 | 266 pMouse->_469EA4(); |
267 pMouse->DrawCursor(); | |
268 pMouse->_469E1C(); | |
269 pRenderer->EndScene(); | |
270 pRenderer->Present(); | |
569 | 271 pParty->uFlags &= ~2; |
0 | 272 } |
273 | |
274 //----- (0047A815) -------------------------------------------------------- | |
275 void Game::DrawParticles() | |
276 { | |
277 pParticleEngine->Draw(); | |
278 } | |
279 | |
280 //----- (00463149) -------------------------------------------------------- | |
281 void Game::Loop() | |
282 { | |
283 const char *pLocationName; // [sp-4h] [bp-68h]@74 | |
284 bool bLoading; // [sp+10h] [bp-54h]@1 | |
285 signed int v16; // [sp+14h] [bp-50h]@8 | |
286 MSG Msg; // [sp+28h] [bp-3Ch]@20 | |
287 char Source[64]; // [sp+44h] [bp-20h]@76 | |
288 | |
2006 | 289 bLoading = sCurrentMenuID == MENU_LoadingProcInMainMenu; |
0 | 290 SetCurrentMenuID((MENU_STATE)-1); |
2126 | 291 if (bLoading) |
0 | 292 { |
293 pParty->Reset(); | |
982 | 294 uGameState = GAME_STATE_PLAYING; |
0 | 295 LoadGame(uLoadGameUI_SelectedSlot); |
296 } | |
297 | |
298 for (uint i = 1; i < 5; ++i) | |
299 for (uint j = 1; j < 6; ++j) | |
300 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
301 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
|
302 remove(pTmpBuf.data()); |
0 | 303 } |
304 | |
305 LoadPlayerPortraintsAndVoices(); | |
783 | 306 pIcons_LOD->_inlined_sub1(); |
328 | 307 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); |
0 | 308 |
309 while ( 2 ) | |
310 { | |
311 v16 = 1; | |
783 | 312 pMessageQueue_50CBD0->Flush(); |
0 | 313 |
314 pPartyActionQueue->uNumActions = 0; | |
315 if (pParty->bTurnBasedModeOn) | |
316 { | |
317 pTurnEngine->End(false); | |
318 pParty->bTurnBasedModeOn = false; | |
319 } | |
320 DoPrepareWorld(bLoading, 1); | |
321 pEventTimer->Resume(); | |
2061 | 322 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME; |
0 | 323 // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; |
151 | 324 pCurrentScreen = SCREEN_GAME; |
1038 | 325 |
0 | 326 if ( pRenderer->pRenderD3D ) |
327 pGame->pVisInstance->_4C1A02(); | |
982 | 328 |
329 bool game_finished = false; | |
0 | 330 do |
331 { | |
332 while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) ) | |
333 { | |
334 if ( Msg.message == WM_QUIT ) | |
335 Game_DeinitializeAndTerminate(0); | |
336 TranslateMessage(&Msg); | |
337 DispatchMessageA(&Msg); | |
338 } | |
2061 | 339 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) |
0 | 340 { |
341 WaitMessage(); | |
342 continue; | |
343 } | |
344 pGame->_44EEA7(); | |
345 GameUI_WritePointedObjectStatusString(); | |
346 ProcessInputActions(); | |
347 GameUI_MsgProc(); | |
348 if ( pArcomageGame->bGameInProgress ) | |
349 { | |
350 ArcomageGame::Loop(); | |
351 pRenderer->Present(); | |
352 continue; | |
353 } | |
1802 | 354 |
355 pVideoPlayer->_inlined_in_463149(); | |
983 | 356 |
357 pEventTimer->Update(); | |
358 pMiscTimer->Update(); | |
359 | |
0 | 360 OnTimer(0); |
361 GameUI_StatusBar_UpdateTimedString(0); | |
362 if ( pMiscTimer->bPaused && !pEventTimer->bPaused ) | |
363 pMiscTimer->Resume(); | |
364 if ( pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn ) | |
365 pEventTimer->bTackGameTime = 0; | |
982 | 366 if ( !pEventTimer->bPaused && uGameState == GAME_STATE_PLAYING) |
0 | 367 { |
368 if ( !pEventTimer->bTackGameTime ) | |
369 _494035_timed_effects__water_walking_damage__etc(); | |
2061 | 370 |
371 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0001) | |
372 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0001; | |
0 | 373 else |
374 { | |
783 | 375 UpdateActorAI(); |
376 UpdateUserInput_and_MapSpecificStuff(); | |
0 | 377 } |
378 } | |
379 if ( v16 ) | |
380 { | |
381 v16 = 0; | |
382 viewparams->bRedrawGameUI = true; | |
383 } | |
378 | 384 pAudioPlayer->UpdateSounds(); |
2124 | 385 if ( (signed int)uGameState == GAME_STATE_PLAYING ) |
386 { | |
387 pGame->Draw(); | |
388 continue; | |
389 } | |
978 | 390 if (uGameState == GAME_FINISHED) |
4 | 391 { |
982 | 392 game_finished = true; |
0 | 393 continue; |
4 | 394 } |
2124 | 395 if (uGameState == GAME_STATE_CHANGE_LOCATION)// ñìåíà ëîêàöèè |
0 | 396 { |
397 pAudioPlayer->StopChannels(-1, -1); | |
398 PrepareWorld(0); | |
982 | 399 uGameState = GAME_STATE_PLAYING; |
0 | 400 continue; |
401 } | |
2124 | 402 if ( (signed int)uGameState <= GAME_STATE_5 || uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU ) |
4 | 403 { |
2124 | 404 game_finished = true; |
0 | 405 continue; |
4 | 406 } |
2124 | 407 if ( uGameState == GAME_STATE_FINAL_WINDOW ) |
0 | 408 { |
2124 | 409 pRenderer->BeginScene(); |
410 GUI_UpdateWindows(); | |
411 pRenderer->EndScene(); | |
412 pRenderer->Present(); | |
0 | 413 continue; |
414 } | |
981 | 415 if ( uGameState != GAME_STATE_PARTY_DIED ) |
0 | 416 { |
2124 | 417 pGame->Draw(); |
418 continue; | |
419 } | |
420 if ( uGameState == GAME_STATE_PARTY_DIED ) | |
421 { | |
422 pAudioPlayer->StopChannels(-1, -1); | |
423 memset(&pParty->pHirelings[0], 0, 0x4Cu); | |
424 memset(&pParty->pHirelings[1], 0, 0x4Cu); | |
425 for ( int i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i ) | |
0 | 426 { |
2124 | 427 if ( pNPCStats->pNewNPCData[i].field_24 ) |
428 pNPCStats->pNewNPCData[i].uFlags &= 0xFFFFFF7Fu; | |
429 } | |
430 pVideoPlayer->PlayDeathMovie(); | |
431 if ( pVideoPlayer->AnyMovieLoaded() ) | |
432 pVideoPlayer->Unload(); | |
433 SaveGame(0, 0); | |
434 ++pParty->uNumDeaths; | |
435 for ( uint i = 0; i < 4; ++i ) | |
436 pParty->pPlayers[i].SetVariable(VAR_Award, 85); | |
437 pParty->days_played_without_rest = 0; | |
438 pParty->uTimePlayed += 0x276000ui64; | |
439 LOWORD(pParty->uFlags) &= ~0x204; | |
440 pParty->SetGold(0); | |
441 pOtherOverlayList->Reset(); | |
442 memset(pParty->pPartyBuffs.data(), 0, 0x140u); | |
443 | |
444 if ( pParty->bTurnBasedModeOn == 1 ) | |
445 { | |
446 pTurnEngine->End(true); | |
447 pParty->bTurnBasedModeOn = 0; | |
448 } | |
449 for( int i = 0; i < 4; ++i) | |
450 { | |
451 memset(pParty->pPlayers[i].pConditions.data(), 0, 0xA0u);//(pConditions, 0, 160) | |
452 memset(pParty->pPlayers[i].pPlayerBuffs.data(), 0, 0x180u);//(pPlayerBuffs[0], 0, 384) | |
453 pParty->pPlayers[i].sHealth = 1; | |
454 uActiveCharacter = 1; | |
455 } | |
456 if (_449B57_test_bit(pParty->_quest_bits, PARTY_QUEST_FINISHED_EMERALD_ISLE)) | |
457 { | |
458 pParty->vPosition.x = -17331; // respawn in harmondale | |
459 pParty->vPosition.y = 12547; | |
460 pParty->vPosition.z = 465; | |
461 pParty->sRotationY = 0; | |
462 pLocationName = "out02.odm"; | |
0 | 463 } |
981 | 464 else |
465 { | |
2124 | 466 pParty->vPosition.x = 12552; // respawn on emerald isle |
467 pParty->vPosition.y = 1816; | |
468 pParty->vPosition.z = 0; | |
469 pParty->sRotationY = 512; | |
470 pLocationName = "out01.odm"; | |
0 | 471 } |
2124 | 472 strcpy(Source, pLocationName); |
473 pParty->uFallStartY = pParty->vPosition.z; | |
474 pParty->sRotationX = 0; | |
475 pParty->uFallSpeed = 0; | |
476 pParty->field_6E4 = 0; | |
477 pParty->field_6E0 = 0; | |
478 if ( _stricmp(Source, pCurrentMapName) ) | |
479 { | |
480 strcpy(pCurrentMapName, Source); | |
481 _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x; | |
482 _5B65AC_npcdata_fame_or_other = pParty->vPosition.y; | |
483 _5B65B0_npcdata_rep_or_other = pParty->vPosition.z; | |
484 _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY; | |
485 _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX; | |
486 dword_5B65C0 = 1; | |
487 PrepareWorld(1); | |
488 } | |
489 InitializeActors(); | |
981 | 490 |
2124 | 491 int num_conscious_players = 0; |
492 int conscious_players_ids[4] = {-1, -1, -1, -1}; | |
493 for (int i = 0; i < 4; ++i) | |
494 { | |
495 if (pParty->pPlayers[i].CanAct()) | |
496 conscious_players_ids[num_conscious_players++] = i; | |
497 } | |
498 if (num_conscious_players) | |
499 { | |
500 int idx = conscious_players_ids[rand() % num_conscious_players]; | |
501 Assert(idx >= 0); | |
502 pParty->pPlayers[idx].PlaySound(SPEECH_99, 0); | |
503 } | |
504 | |
505 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2);// "Once again you've cheated death!.." "Âû ñíîâà îáõèòðèëè ñìåðòü! …" | |
506 uGameState = GAME_STATE_PLAYING; | |
0 | 507 } |
508 } | |
982 | 509 while (!game_finished); |
510 | |
0 | 511 pEventTimer->Pause(); |
512 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); | |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
513 if ( uGameState == GAME_STATE_LOADING_GAME ) |
0 | 514 { |
515 sub_491E3A(); | |
516 LoadPlayerPortraintsAndVoices(); | |
982 | 517 uGameState = GAME_STATE_PLAYING; |
0 | 518 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles; |
519 bLoading = true; | |
520 continue; | |
521 } | |
522 break; | |
523 } | |
151 | 524 pCurrentScreen = SCREEN_VIDEO; |
0 | 525 sub_491E3A(); |
526 } | |
527 | |
528 | |
529 //----- (0044F192) -------------------------------------------------------- | |
530 void Game::PrepareBloodsplats() | |
531 { | |
532 for (uint i = 0; i < uNumBloodsplats; ++i) | |
533 { | |
534 pBloodsplatContainer->AddBloodsplat( | |
535 pBloodsplats[i].x, | |
536 pBloodsplats[i].y, | |
537 pBloodsplats[i].z, | |
538 pBloodsplats[i].radius, | |
539 pBloodsplats[i].r, | |
540 pBloodsplats[i].g, | |
541 pBloodsplats[i].b); | |
542 } | |
543 } | |
544 | |
545 | |
546 //----- (0044F120) -------------------------------------------------------- | |
547 void Game::PushStationaryLights(int a2) | |
548 { | |
1094 | 549 Game__StationaryLight* pLight; |
550 | |
551 for( int i=0; i<uNumStationaryLights; ++i ) | |
552 { | |
553 pLight=&pStationaryLights[i]; | |
554 pStationaryLightsStack->AddLight( | |
555 pLight->vPosition.x, | |
556 pLight->vPosition.y, | |
557 pLight->vPosition.z, | |
558 pLight->flt_18, | |
559 pLight->vRGBColor.x, | |
560 pLight->vRGBColor.y, | |
561 pLight->vRGBColor.z, | |
562 byte_4E94D0); | |
563 } | |
0 | 564 } |
565 // 4E94D0: using guessed type char byte_4E94D0; | |
566 | |
567 //----- (0044F0FD) -------------------------------------------------------- | |
568 void Game::_44F0FD() | |
569 { | |
570 ToggleFlags(0x40u); | |
571 | |
572 if ( !(uFlags & 0x40) ) | |
573 { | |
574 uNumBloodsplats = 0; | |
575 field_E0C = 0; | |
576 } | |
577 } | |
578 | |
579 //----- (0044F0D8) -------------------------------------------------------- | |
580 void Game::ToggleFlags(uint uMask) | |
581 { | |
582 if (uFlags & uMask) | |
583 uFlags &= ~uMask; | |
584 else | |
585 uFlags |= uMask; | |
586 } | |
587 | |
588 | |
589 //----- (0044F07B) -------------------------------------------------------- | |
590 bool Game::_44F07B() | |
591 { | |
592 if (!pKeyboardInstance->IsKeyBeingHeld(VK_SHIFT) && | |
593 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) && | |
594 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) || | |
595 | |
596 (pKeyboardInstance->WasKeyPressed(VK_F11) == 0 && | |
597 pKeyboardInstance->WasKeyPressed(VK_F11))) | |
598 return true; | |
599 return false; | |
600 } | |
601 | |
602 //----- (0044EEA7) -------------------------------------------------------- | |
603 bool Game::_44EEA7() | |
604 { | |
605 //Game *v1; // esi@1 | |
194 | 606 //double v2; // st7@2 |
0 | 607 float depth; // ST00_4@9 |
194 | 608 //bool result; // eax@9 |
0 | 609 unsigned int v5; // eax@14 |
610 __int64 v6; // kr00_8@21 | |
611 unsigned int y; // [sp+4h] [bp-24h]@2 | |
612 unsigned int x; // [sp+8h] [bp-20h]@2 | |
194 | 613 Vis_SelectionFilter *v10; // [sp+10h] [bp-18h]@2 |
614 Vis_SelectionFilter *v11; // [sp+14h] [bp-14h]@2 | |
0 | 615 POINT a2; // [sp+20h] [bp-8h]@1 |
616 | |
617 //v1 = this; | |
618 ++qword_5C6DF0; | |
619 pParticleEngine->UpdateParticles(); | |
620 pMouseInstance->GetCursorPos(&a2); | |
194 | 621 |
622 x = a2.y; | |
623 y = a2.x; | |
0 | 624 if ( sub_4637E0_is_there_popup_onscreen() ) |
625 { | |
194 | 626 v11 = &vis_face_filter; |
627 v10 = &vis_sprite_filter_2; | |
871 | 628 depth = pGame->pIndoorCameraD3D->GetPickDepth(); |
0 | 629 } |
630 else | |
631 { | |
592 | 632 if ( uFlags2 & GAME_FLAGS_2_TARGETING_MODE ) |
0 | 633 { |
194 | 634 v11 = &vis_face_filter; |
635 v10 = &vis_sprite_filter_1; | |
0 | 636 } |
637 else | |
638 { | |
194 | 639 v11 = &vis_face_filter; |
640 v10 = &vis_sprite_filter_4; | |
0 | 641 } |
194 | 642 depth = 5120.0; |
0 | 643 } |
194 | 644 //depth = v2; |
0 | 645 |
323 | 646 PickMouse(depth, y, x, false, v10, v11); |
0 | 647 pLightmapBuilder->std__vector_000004_size = 0; |
648 pLightmapBuilder->std__vector_183808_size = 0; | |
649 pDecalBuilder->std__vector_pDecals_size = 0; | |
650 pDecalBuilder->field_308008 = 0; | |
194 | 651 if (!_44F07B()) |
652 return false; | |
653 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
638
diff
changeset
|
654 if ( uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS) |
794 | 655 pStru10Instance->bDoNotDrawPortalFrustum = false; |
0 | 656 if ( pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
657 { | |
658 v5 = GetLevelFogColor(); | |
659 pRenderer->uFogColor = v5 & 0xFFFFFF; | |
660 } | |
661 if (uFlags & 0x0400) | |
662 uFlags2 |= 0x01; | |
663 if ( !pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor && pMobileLightsStack->uNumLightsActive ) | |
664 { | |
665 uFlags2 |= 0x01; | |
666 field_E10 = qword_5C6DF0; | |
667 } | |
668 v6 = qword_5C6DF0 - field_E10; | |
669 if ( qword_5C6DF0 - field_E10 == 1 ) | |
670 uFlags2 |= v6; | |
671 if (uNumStationaryLights_in_pStationaryLightsStack != pStationaryLightsStack->uNumLightsActive ) | |
672 { | |
673 uFlags2 |= 1u; | |
674 uNumStationaryLights_in_pStationaryLightsStack = pStationaryLightsStack->uNumLightsActive; | |
675 } | |
676 _44E904(); | |
194 | 677 return true; |
0 | 678 } |
679 | |
680 | |
681 //----- (0044EDE4) -------------------------------------------------------- | |
2006 | 682 bool Game::AlterGamma_BLV(BLVFace *pFace, signed int *pColor) |
0 | 683 { |
638 | 684 if (uFlags2 & GAME_FLAGS_2_SATURATE_LIGHTMAPS && |
685 pFace->uAttributes & FACE_CAN_SATURATE_COLOR) | |
0 | 686 { |
687 *pColor = ReplaceHSV(*pColor, 1.0, fSaturation, -1.0); | |
688 return true; | |
689 } | |
690 else | |
691 return false; | |
692 } | |
693 | |
694 //----- (0044EE30) -------------------------------------------------------- | |
2006 | 695 bool Game::AlterGamma_ODM(ODMFace *pFace, signed int *pColor) |
0 | 696 { |
638 | 697 if (uFlags2 & GAME_FLAGS_2_SATURATE_LIGHTMAPS && |
698 pFace->uAttributes & FACE_CAN_SATURATE_COLOR) | |
0 | 699 { |
638 | 700 *pColor = ReplaceHSV(*pColor, 1.0, fSaturation, -1.0); |
0 | 701 return true; |
702 } | |
703 else | |
704 return false; | |
705 } | |
706 | |
707 | |
708 //----- (004645FA) -------------------------------------------------------- | |
709 void Game::Deinitialize() | |
710 { | |
711 WriteWindowsRegistryInt("startinwindow", pRenderer->bWindowMode); | |
2052 | 712 if (pRenderer->bWindowMode) |
0 | 713 { |
2052 | 714 WriteWindowsRegistryInt("window X", window->GetX()); |
715 WriteWindowsRegistryInt("window Y", window->GetY()); | |
1984 | 716 } |
0 | 717 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); |
718 pItemsTable->Release(); | |
719 pNPCStats->Release(); | |
1038 | 720 |
0 | 721 if (pMouse) |
722 pMouse->Deactivate(); | |
723 | |
1093 | 724 delete pRenderer; |
0 | 725 pAudioPlayer->Release();//error |
726 pNew_LOD->FreeSubIndexAndIO(); | |
727 pGames_LOD->FreeSubIndexAndIO(); | |
728 ClipCursor(0); | |
729 Game::Destroy(); | |
730 } | |
731 | |
732 //----- (0044EE7C) -------------------------------------------------------- | |
733 bool Game::draw_debug_outlines() | |
734 { | |
735 if (uFlags & 0x04) | |
736 { | |
737 pLightmapBuilder->DrawDebugOutlines(-1); | |
738 pDecalBuilder->DrawDecalDebugOutlines(); | |
739 } | |
740 return true; | |
741 } | |
742 | |
743 //----- (0044EC23) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1277
diff
changeset
|
744 int Game::_44EC23(struct Polygon *a2, int *a3, signed int a4) |
0 | 745 { |
746 double v4; // st7@4 | |
747 //double v5; // ST00_8@4 | |
748 signed int v6; // eax@5 | |
749 //double v7; // ST00_8@6 | |
750 signed int result; // eax@8 | |
751 //double v9; // ST00_8@9 | |
752 //double v10; // ST00_8@11 | |
753 float a2a; // [sp+14h] [bp+8h]@4 | |
754 float a3a; // [sp+18h] [bp+Ch]@4 | |
755 float a3b; // [sp+18h] [bp+Ch]@6 | |
756 float a4a; // [sp+1Ch] [bp+10h]@9 | |
757 float a4b; // [sp+1Ch] [bp+10h]@11 | |
758 | |
759 if ( this->uFlags2 & 2 && a2->field_59 == 5 && a2->pODMFace->uAttributes & 2 ) | |
760 { | |
761 v4 = (double)a4; | |
762 a2a = v4; | |
763 *a3 |= 2u; | |
764 a3a = (1.0 - this->fSaturation) * v4; | |
765 //v5 = a3a + 6.7553994e15; | |
766 //if ( SLODWORD(v5) >= 0 ) | |
767 if (floorf(a3a + 0.5f) >= 0 ) | |
768 { | |
769 a3b = (1.0 - this->fSaturation) * a2a; | |
770 //v7 = a3b + 6.7553994e15; | |
771 //v6 = LODWORD(v7); | |
772 v6 = floorf(a3b + 0.5f); | |
773 } | |
774 else | |
775 { | |
776 v6 = 0; | |
777 } | |
778 if ( a4 >= v6 ) | |
779 { | |
780 a4a = (1.0 - fSaturation) * a2a; | |
781 //v9 = a4a + 6.7553994e15; | |
782 //if ( SLODWORD(v9) >= 0 ) | |
783 if (floorf(a4a + 0.5f) >= 0) | |
784 { | |
785 a4b = (1.0 - fSaturation) * a2a; | |
786 //v10 = a4b + 6.7553994e15; | |
787 //result = LODWORD(v10); | |
788 result = floorf(a4b + 0.5f); | |
789 } | |
790 else | |
791 { | |
792 result = 0; | |
793 } | |
794 } | |
795 else | |
796 { | |
797 result = a4; | |
798 } | |
799 } | |
800 else | |
801 { | |
802 result = -1; | |
803 } | |
804 return result; | |
805 } | |
806 | |
807 | |
808 | |
809 //----- (00465C8B) -------------------------------------------------------- | |
810 Game *Game::Create() | |
811 { | |
812 return new Game; | |
813 } | |
814 | |
815 //----- (00465CF3) -------------------------------------------------------- | |
816 void Game::Destroy() | |
817 { | |
818 if (pGame) | |
819 delete pGame; | |
820 pGame = nullptr; | |
821 } | |
822 | |
823 //----- (0044ED0A) -------------------------------------------------------- | |
824 signed int Game::_44ED0A(BLVFace *a2, int *a3, signed int a4) | |
825 { | |
826 double v4; // st7@3 | |
827 //double v5; // ST00_8@3 | |
828 signed int v6; // eax@4 | |
829 //double v7; // ST00_8@5 | |
830 signed int result; // eax@7 | |
831 //double v9; // ST00_8@8 | |
832 //double v10; // ST00_8@10 | |
833 float v11; // [sp+14h] [bp+8h]@3 | |
834 float v12; // [sp+18h] [bp+Ch]@3 | |
835 float v13; // [sp+18h] [bp+Ch]@5 | |
836 float v14; // [sp+1Ch] [bp+10h]@8 | |
837 float v15; // [sp+1Ch] [bp+10h]@10 | |
838 | |
839 if ( this->uFlags2 & 2 && a2->uAttributes & 2 ) | |
840 { | |
841 v4 = (double)a4; | |
842 v11 = v4; | |
843 *a3 |= 2u; | |
844 v12 = (1.0 - this->fSaturation) * v4; | |
845 //v5 = v12 + 6.7553994e15; | |
846 if (floorf(v12 + 0.5f)/* SLODWORD(v5)*/ >= 0 ) | |
847 { | |
848 v13 = (1.0 - this->fSaturation) * v11; | |
849 //v7 = v13 + 6.7553994e15; | |
850 //v6 = LODWORD(v7); | |
851 v6 = floorf(v13 + 0.5f); | |
852 } | |
853 else | |
854 { | |
855 v6 = 0; | |
856 } | |
857 if ( a4 >= v6 ) | |
858 { | |
859 v14 = (1.0 - fSaturation) * v11; | |
860 //v9 = v14 + 6.7553994e15; | |
861 if (floorf(v14 + 0.5f)/* SLODWORD(v9)*/ >= 0 ) | |
862 { | |
863 v15 = (1.0 - fSaturation) * v11; | |
864 //v10 = v15 + 6.7553994e15; | |
865 //result = LODWORD(v10); | |
866 result = floorf(v15 + 0.5f); | |
867 } | |
868 else | |
869 { | |
870 result = 0; | |
871 } | |
872 } | |
873 else | |
874 { | |
875 result = a4; | |
876 } | |
877 } | |
878 else | |
879 { | |
880 result = -1; | |
881 } | |
882 return result; | |
883 } | |
884 | |
885 | |
886 //----- (0044E4B7) -------------------------------------------------------- | |
887 Game::Game() | |
888 { | |
889 uNumStationaryLights = 0; | |
890 uNumBloodsplats = 0; | |
891 field_E0C = 0; | |
892 field_E10 = 0; | |
893 uNumStationaryLights_in_pStationaryLightsStack = 0; | |
894 bGammaControlInitialized = false; | |
895 uFlags = 0; | |
896 uFlags2 = 0; | |
897 uSomeGammaStartTime = 0; | |
898 uSomeGammaDeltaTime = 0; | |
899 | |
1397 | 900 //pThreadWardInstance = new ThreadWard; |
901 pThreadWardInstance = nullptr; | |
0 | 902 pParticleEngine = new ParticleEngine; |
1802 | 903 pMouse = pMouseInstance = new Mouse; |
0 | 904 pLightmapBuilder = new LightmapBuilder; |
905 pVisInstance = new Vis; | |
906 pStru6Instance = new stru6; | |
907 pIndoorCameraD3D = new IndoorCameraD3D; | |
908 pStru9Instance = new stru9; | |
909 pStru10Instance = new stru10; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1277
diff
changeset
|
910 //pStru11Instance = new stru11; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1277
diff
changeset
|
911 pStru11Instance = nullptr; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1277
diff
changeset
|
912 //pStru12Instance = new stru12(pStru11Instance); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1277
diff
changeset
|
913 pStru12Instance = nullptr; |
1397 | 914 //pCShow = new CShow; |
915 pCShow = nullptr; | |
0 | 916 pKeyboardInstance = new Keyboard; |
917 pGammaController = new GammaController; | |
918 | |
919 uFlags |= 0x0800; | |
920 uFlags2 |= 0x24; | |
921 | |
922 _44F0FD(); | |
923 | |
924 bWinNT4_0 = false; | |
925 if (pVersion->pVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && | |
926 pVersion->pVersionInfo.dwMajorVersion == 4) | |
927 bWinNT4_0 = true; | |
928 } | |
929 | |
930 //----- (0044E7F3) -------------------------------------------------------- | |
931 Game::~Game() | |
932 { | |
933 if (pGammaController) | |
934 delete pGammaController; | |
935 if (pKeyboardInstance) | |
936 delete pKeyboardInstance; | |
1397 | 937 /*if (pCShow) |
0 | 938 delete pCShow; |
939 if (pStru12Instance) | |
940 delete pStru12Instance; | |
941 if (pStru11Instance) | |
1397 | 942 delete pStru11Instance;*/ |
0 | 943 if (pStru10Instance) |
944 delete pStru10Instance; | |
945 if (pStru9Instance) | |
946 delete pStru9Instance; | |
947 if (pIndoorCameraD3D) | |
948 delete pIndoorCameraD3D; | |
949 if (pStru6Instance) | |
950 delete pStru6Instance; | |
951 if (pVisInstance) | |
952 delete pVisInstance; | |
953 if (pLightmapBuilder) | |
954 delete pLightmapBuilder; | |
955 if (pMouseInstance) | |
956 delete pMouseInstance; | |
957 if (pParticleEngine) | |
958 delete pParticleEngine; | |
1397 | 959 //if (pThreadWardInstance) |
960 // delete pThreadWardInstance; | |
0 | 961 } |
962 | |
963 //----- (0044E904) -------------------------------------------------------- | |
964 void Game::_44E904() | |
965 { | |
966 //Game *v1; // esi@1 | |
967 unsigned __int64 v2; // qax@1 | |
968 unsigned int v3; // ecx@1 | |
969 int v4; // edi@1 | |
970 unsigned __int8 v5; // cf@7 | |
971 double v6; // st7@13 | |
972 double v7; // st7@15 | |
973 signed __int64 v8; // [sp+Ch] [bp-8h]@1 | |
974 | |
975 //v1 = this; | |
976 v2 = pEventTimer->Time(); | |
977 v4 = (v2 - uSomeGammaStartTime) >> 32; | |
978 v3 = v2 - LODWORD(uSomeGammaStartTime); | |
979 v8 = v2 - uSomeGammaStartTime; | |
980 if ( v4 < 0 | |
981 || SHIDWORD(v2) < ((unsigned int)v2 < LODWORD(uSomeGammaStartTime)) + HIDWORD(uSomeGammaStartTime) | v4 == 0 | |
982 && v3 <= 0x80 ) | |
983 { | |
1421 | 984 if ( v4 < 0 ) |
985 { | |
986 v3 = 0; | |
987 v4 = 0; | |
988 uSomeGammaStartTime = v2; | |
989 v8 = __PAIR__(v4, v3); | |
990 } | |
0 | 991 } |
992 else | |
993 { | |
994 if ( uSomeGammaDeltaTime ) | |
995 { | |
996 LODWORD(uSomeGammaDeltaTime) = 0; | |
997 HIDWORD(uSomeGammaDeltaTime) = 0; | |
998 } | |
999 else | |
1000 { | |
1001 LODWORD(uSomeGammaDeltaTime) = v3; | |
1002 HIDWORD(uSomeGammaDeltaTime) = v4; | |
1003 } | |
1004 v5 = __CFADD__(v3, -128); | |
1005 v3 -= 128; | |
1006 v4 = v5 + v4 - 1; | |
1421 | 1007 uSomeGammaStartTime = v2; |
1008 v8 = __PAIR__(v4, v3); | |
0 | 1009 } |
1010 if ( uSomeGammaDeltaTime ) | |
1011 v6 = (double)(signed __int64)(uSomeGammaDeltaTime - __PAIR__(v4, v3)); | |
1012 else | |
1013 v6 = (double)v8; | |
1014 v7 = v6 * 0.0078125; | |
1015 if ( v7 < 0.0 || v7 <= 1.0 ) | |
1016 { | |
1017 if ( v7 < 0.0 ) | |
1018 v7 = 0.0; | |
1019 } | |
1020 else | |
1021 { | |
1022 v7 = 1.0; | |
1023 } | |
1024 if ( pRenderer->pRenderD3D ) | |
1025 fSaturation = v7; | |
1026 else | |
1027 fSaturation = (1.0 - 0.5) * v7 + 0.5; | |
1028 } | |
1029 | |
1030 //----- (0044EA17) -------------------------------------------------------- | |
1031 bool Game::InitializeGammaController() | |
1032 { | |
1033 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || | |
1034 pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
1035 pGammaController->InitializeFromSurface(pRenderer->pFrontBuffer4); | |
1036 | |
1037 bGammaControlInitialized = true; | |
1038 uSomeGammaStartTime = pEventTimer->Time(); | |
1039 return true; | |
1040 } | |
1041 | |
1042 //----- (0044EA5E) -------------------------------------------------------- | |
194 | 1043 bool Game::PickMouse(float fPickDepth, unsigned int uMouseX, unsigned int uMouseY, bool bOutline, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter) |
0 | 1044 { |
227 | 1045 if (pCurrentScreen != SCREEN_GAME|| !pRenderer->pRenderD3D) |
194 | 1046 return false; |
0 | 1047 |
194 | 1048 if (!pVisInstance) |
0 | 1049 { |
194 | 1050 MessageBoxW(nullptr, L"The 'Vis' object pointer has not been instatiated, but CGame::Pick() is trying to call through it.", nullptr, 0); |
1051 return false; | |
1052 } | |
0 | 1053 |
692 | 1054 if (uMouseX >= (signed int)pViewport->uScreen_TL_X && |
1055 uMouseX <= (signed int)pViewport->uScreen_BR_X && | |
1056 uMouseY >= (signed int)pViewport->uScreen_TL_Y && | |
1057 uMouseY <= (signed int)pViewport->uScreen_BR_Y) | |
194 | 1058 { |
1059 pVisInstance->PickMouse(fPickDepth, uMouseX, uMouseY, sprite_filter, face_filter); | |
0 | 1060 |
194 | 1061 if (bOutline) |
1062 OutlineSelection(); | |
0 | 1063 } |
194 | 1064 |
1065 return true; | |
0 | 1066 } |
1067 // 4E28F8: using guessed type int pCurrentScreen; | |
1068 | |
1069 //----- (0044EB12) -------------------------------------------------------- | |
194 | 1070 bool Game::PickKeyboard(bool bOutline, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter) |
0 | 1071 { |
271 | 1072 if (pCurrentScreen == SCREEN_GAME && pVisInstance && pRenderer->pRenderD3D) |
0 | 1073 { |
194 | 1074 bool r = pVisInstance->PickKeyboard(&pVisInstance->default_list, sprite_filter, face_filter); |
0 | 1075 |
1076 if (bOutline) | |
1077 OutlineSelection(); | |
1078 return r; | |
1079 } | |
1080 return false; | |
1081 } | |
123 | 1082 /* |
1083 Result::Code Game::PickKeyboard(bool bOutline, struct unnamed_F93E6C *a3, struct unnamed_F93E6C *a4) | |
1084 { | |
1085 if (dword_4E28F8_PartyCantJumpIfTrue) | |
1086 return Result::Generic; | |
1087 | |
1088 pVis->PickKeyboard(a3, a4); | |
1089 if (bOutline) | |
1090 Game_outline_selection((int)this); | |
1091 return Result::Success; | |
1092 } | |
1093 */ | |
0 | 1094 // 4E28F8: using guessed type int pCurrentScreen; |
1095 | |
1096 //----- (0044EB5A) -------------------------------------------------------- | |
1097 void Game::OutlineSelection() | |
1098 { | |
194 | 1099 if (!pVisInstance) |
1100 return; | |
1101 | |
1102 if (!pVisInstance->default_list.uNumPointers) | |
1103 return; | |
0 | 1104 |
1980 | 1105 Vis_ObjectInfo* object_info = pVisInstance->default_list.object_pointers[0]; |
194 | 1106 if (object_info) |
1107 switch (object_info->object_type) | |
0 | 1108 { |
194 | 1109 case VisObjectType_Sprite: |
0 | 1110 { |
194 | 1111 Log::Warning(L"Sprite outline currently unsupported"); |
1112 return; | |
0 | 1113 } |
1114 | |
194 | 1115 case VisObjectType_Face: |
1116 { | |
1117 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 1118 { |
1980 | 1119 ODMFace* face = (ODMFace *)object_info->object; |
194 | 1120 if (face->uAttributes & FACE_OUTLINED) |
1121 face->uAttributes &= ~FACE_OUTLINED; | |
0 | 1122 else |
194 | 1123 face->uAttributes |= FACE_OUTLINED; |
1124 } | |
1125 else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1126 { | |
1980 | 1127 BLVFace* face = (BLVFace *)object_info->object; |
194 | 1128 if (face->uAttributes & FACE_OUTLINED) |
1129 face->uAttributes &= ~FACE_OUTLINED; | |
1130 else | |
1131 face->uAttributes |= FACE_OUTLINED; | |
0 | 1132 } |
1545 | 1133 else Error("Invalid level type", uCurrentlyLoadedLevelType); |
194 | 1134 } |
323 | 1135 break; |
194 | 1136 |
1137 default: | |
1138 { | |
1139 MessageBoxW(nullptr, L"Undefined CObjectInfo type requested in CGame::outline_selection()", nullptr, 0); | |
1140 ExitProcess(0); | |
1141 } | |
0 | 1142 } |
1915 | 1143 } |
1144 //----- (004304E7) -------------------------------------------------------- | |
1145 void GameUI_MsgProc() | |
1146 { | |
1147 //signed int v0; // edi@6 | |
1148 //char *v1; // esi@6 | |
1149 unsigned int v2; // edx@7 | |
1150 Actor *pActor; // ecx@13 | |
1151 int v4; // ecx@18 | |
1152 //NPCData *pNPCData0; // eax@18 | |
1153 //int v6; // edx@20 | |
1154 //int v7; // ecx@29 | |
1155 //unsigned int v8; // edx@59 | |
1156 //unsigned int v9; // ecx@60 | |
1157 unsigned int v10; // ecx@73 | |
1158 //unsigned int v11; // eax@75 | |
1159 unsigned __int8 v12; // sf@75 | |
1160 unsigned __int8 v13; // of@75 | |
1161 int v14; // eax@98 | |
1162 unsigned int v15; // eax@102 | |
1163 unsigned __int8 v16; // al@104 | |
1164 unsigned __int8 v17; // al@105 | |
1165 int v18; // eax@106 | |
1166 float v19; // ST64_4@121 | |
1167 unsigned int v20; // ecx@121 | |
1168 float v21; // ST64_4@126 | |
1169 float v22; // ST64_4@127 | |
1170 unsigned int v23; // ecx@135 | |
1171 unsigned int v24; // ecx@149 | |
1172 unsigned int v25; // ecx@165 | |
1173 GUIWindow *pWindow; // eax@204 | |
1174 unsigned int v27; // edx@204 | |
1175 unsigned int v28; // ecx@204 | |
1176 GUIWindow *pWindow2; // ecx@248 | |
1177 //int v30; // edx@258 | |
1178 //const char *v31; // ecx@262 | |
1179 signed int v32; // eax@269 | |
1180 unsigned int v33; // eax@277 | |
1181 unsigned __int8 v34; // al@279 | |
1182 unsigned __int8 v35; // al@280 | |
1183 //GUIWindow *pWindow3; // ecx@332 | |
1184 int v37; // eax@341 | |
1185 int v38; // eax@358 | |
1186 SHORT v39; // ax@365 | |
1187 //signed int v40; // eax@365 | |
1188 char *v41; // eax@380 | |
1189 int v42; // eax@396 | |
1190 POINT *pPoint; // eax@397 | |
1191 signed int v44; // eax@398 | |
1192 int v45; // edx@398 | |
1193 signed int v46; // ecx@398 | |
1194 char v47; // zf@399 | |
1195 char v48; // zf@405 | |
1196 BLVFace *pBLVFace; // ecx@410 | |
1197 ODMFace *pODMFace; // ecx@412 | |
1198 CastSpellInfo *pSpellInfo; // ecx@415 | |
1199 void *v52; // eax@424 | |
1200 __int16 v53; // ax@431 | |
1201 int v54; // eax@432 | |
1202 int v55; // ecx@432 | |
1203 int v56; // edx@432 | |
1204 int v57; // eax@432 | |
1205 Player *pPlayer; // edx@442 | |
1206 unsigned int pMapNum; // eax@445 | |
1207 signed int v60; // ST64_4@459 | |
1208 //NPCData *pNPCData2; // eax@467 | |
1209 //unsigned __int64 v62; // kr00_8@467 | |
1210 __int16 v63; // dx@479 | |
1211 unsigned int v64; // eax@486 | |
1212 int v65; // ecx@486 | |
1213 int v66; // eax@488 | |
1214 char *v67; // eax@489 | |
1215 __int16 v68; // dx@498 | |
1216 char *v69; // eax@512 | |
1217 int v70; // eax@525 | |
1218 int v71; // edi@527 | |
1219 NPCData *pNPCData3; // esi@527 | |
1220 char *v73; // ecx@533 | |
1221 signed int v74; // edi@535 | |
1222 int v75; // eax@535 | |
1223 int v76; // esi@535 | |
1224 int v77; // eax@537 | |
1225 Player *pPlayer2; // ecx@549 | |
1226 //int v79; // ecx@550 | |
1227 //unsigned int v80; // edx@550 | |
1228 signed int v81; // eax@552 | |
1229 POINT *pPoint2; // eax@553 | |
1230 signed int v83; // ecx@554 | |
1231 signed int v84; // ecx@554 | |
1232 GUIButton *pButton; // eax@578 | |
1233 unsigned int v86; // eax@583 | |
1234 const char *v87; // ecx@595 | |
1235 const char *v88; // ecx@596 | |
1236 //unsigned int v89; // eax@598 | |
1237 unsigned int v90; // eax@602 | |
1238 int v91; // edx@605 | |
1239 int v92; // eax@605 | |
1240 int v93; // edx@605 | |
1241 int pPlayerNum; // edx@611 | |
1242 int v95; // eax@611 | |
1243 //const char *v96; // ecx@621 | |
1244 unsigned int v97; // eax@624 | |
1245 int v98; // eax@636 | |
1246 unsigned __int8 v99; // al@643 | |
1247 Player *pPlayer3; // eax@648 | |
1248 int v101; // ecx@648 | |
1249 int v102; // edx@652 | |
1250 int v103; // eax@671 | |
1251 Player *pPlayer4; // ecx@718 | |
1252 int v105; // eax@718 | |
1253 Player *pPlayer5; // ST78_4@758 | |
1254 unsigned int v107; // eax@758 | |
1255 unsigned int v108; // eax@758 | |
1256 unsigned int v115; // eax@764 | |
1257 int v116; // eax@776 | |
1258 POINT *pPoint3; // eax@777 | |
1259 unsigned int v118; // eax@785 | |
1260 unsigned int v119; // ecx@786 | |
1261 unsigned int v120; // [sp-28h] [bp-624h]@86 | |
1262 unsigned int v121; // [sp-28h] [bp-624h]@711 | |
1263 unsigned int v122; // [sp-24h] [bp-620h]@86 | |
1264 unsigned int v123; // [sp-24h] [bp-620h]@711 | |
1265 unsigned int v124; // [sp-20h] [bp-61Ch]@86 | |
1266 unsigned int v125; // [sp-20h] [bp-61Ch]@711 | |
1267 unsigned int v126; // [sp-1Ch] [bp-618h]@86 | |
1268 int v127; // [sp-1Ch] [bp-618h]@107 | |
1269 unsigned int v128; // [sp-1Ch] [bp-618h]@711 | |
1270 int v129; // [sp-18h] [bp-614h]@86 | |
1271 //signed int v130; // [sp-18h] [bp-614h]@107 | |
1272 int v131; // [sp-14h] [bp-610h]@86 | |
1273 //unsigned int v132; // [sp-14h] [bp-610h]@107 | |
1274 //unsigned int v133; // [sp-10h] [bp-60Ch]@60 | |
1275 unsigned int v134; // [sp-10h] [bp-60Ch]@86 | |
1276 //signed int v135; // [sp-10h] [bp-60Ch]@107 | |
1277 unsigned int v136; // [sp-10h] [bp-60Ch]@121 | |
1278 //unsigned int v137; // [sp-Ch] [bp-608h]@60 | |
1279 unsigned int v138; // [sp-Ch] [bp-608h]@86 | |
1280 //signed int v139; // [sp-Ch] [bp-608h]@107 | |
1281 unsigned int v140; // [sp-Ch] [bp-608h]@121 | |
1282 enum WindowType pWindowType; // [sp-8h] [bp-604h]@56 | |
1283 //enum WindowType pWindowType1; // [sp-8h] [bp-604h]@60 | |
1284 unsigned __int8 v143; // [sp-8h] [bp-604h]@86 | |
1285 //int v144; // [sp-8h] [bp-604h]@107 | |
1286 enum WindowType pWindowType2; // [sp-8h] [bp-604h]@121 | |
1287 //const char *v146; // [sp-8h] [bp-604h]@449 | |
1288 //unsigned int v147; // [sp-8h] [bp-604h]@550 | |
1289 //int v148; // [sp-4h] [bp-600h]@56 | |
1290 GUIButton *pButton2; // [sp-4h] [bp-600h]@59 | |
1291 const char *v150; // [sp-4h] [bp-600h]@86 | |
1292 //unsigned int v151; // [sp-4h] [bp-600h]@107 | |
1293 int v152; // [sp-4h] [bp-600h]@121 | |
1294 int v153; // [sp-4h] [bp-600h]@135 | |
1295 //int v154; // [sp-4h] [bp-600h]@149 | |
1296 int v155; // [sp-4h] [bp-600h]@165 | |
1297 int v156; // [sp-4h] [bp-600h]@204 | |
1298 //const char *v157; // [sp-4h] [bp-600h]@444 | |
1299 //unsigned int v158; // [sp-4h] [bp-600h]@449 | |
1300 //__int16 v159; // [sp-4h] [bp-600h]@550 | |
1301 int v160; // [sp-4h] [bp-600h]@599 | |
1302 const char *v161; // [sp-4h] [bp-600h]@637 | |
1303 //int v162; // [sp+0h] [bp-5FCh]@56 | |
1304 //int v163; // [sp+0h] [bp-5FCh]@59 | |
1305 Texture *pTexture; // [sp+0h] [bp-5FCh]@86 | |
1306 //int v165; // [sp+0h] [bp-5FCh]@107 | |
1307 int v166; // [sp+0h] [bp-5FCh]@121 | |
1308 int v167; // [sp+0h] [bp-5FCh]@135 | |
1309 //int v168; // [sp+0h] [bp-5FCh]@149 | |
1310 int v169; // [sp+0h] [bp-5FCh]@165 | |
1311 int v170; // [sp+0h] [bp-5FCh]@204 | |
1312 //signed int v171; // [sp+0h] [bp-5FCh]@259 | |
1313 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 | |
1314 char *v173; // [sp+0h] [bp-5FCh]@444 | |
1315 char *v174; // [sp+0h] [bp-5FCh]@449 | |
1316 //int v175; // [sp+0h] [bp-5FCh]@550 | |
1317 int v176; // [sp+0h] [bp-5FCh]@599 | |
1318 const char *v177; // [sp+0h] [bp-5FCh]@629 | |
1319 char *v178; // [sp+0h] [bp-5FCh]@637 | |
1320 int v179; // [sp+4h] [bp-5F8h]@0 | |
1321 //signed int _this; // [sp+14h] [bp-5E8h]@22 | |
1322 signed int thisa; // [sp+14h] [bp-5E8h]@251 | |
1323 signed int thisb; // [sp+14h] [bp-5E8h]@272 | |
1324 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373 | |
1325 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377 | |
1326 char *pMapName; // [sp+14h] [bp-5E8h]@445 | |
1327 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455 | |
1328 int thisg; // [sp+14h] [bp-5E8h]@467 | |
1329 int thish; // [sp+14h] [bp-5E8h]@528 | |
1330 signed int thisi; // [sp+14h] [bp-5E8h]@535 | |
1331 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604 | |
1332 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641 | |
1333 int thisl; // [sp+14h] [bp-5E8h]@648 | |
1334 int uMessageParam; // [sp+18h] [bp-5E4h]@7 | |
1335 int uAction; // [sp+1Ch] [bp-5E0h]@18 | |
1336 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23 | |
1337 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18 | |
1338 char v197; // [sp+2Bh] [bp-5D1h]@101 | |
1339 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7 | |
1340 unsigned int v199; // [sp+30h] [bp-5CCh]@7 | |
1341 char *v200; // [sp+34h] [bp-5C8h]@518 | |
1342 POINT v201; // [sp+38h] [bp-5C4h]@553 | |
1343 POINT v202; // [sp+40h] [bp-5BCh]@141 | |
1344 POINT a2; // [sp+48h] [bp-5B4h]@127 | |
1345 POINT v204; // [sp+50h] [bp-5ACh]@777 | |
1346 POINT v205; // [sp+58h] [bp-5A4h]@171 | |
1347 POINT v206; // [sp+60h] [bp-59Ch]@553 | |
1348 POINT v207; // [sp+68h] [bp-594h]@155 | |
1349 POINT v208; // [sp+70h] [bp-58Ch]@397 | |
1350 POINT v209; // [sp+78h] [bp-584h]@777 | |
1351 POINT v210; // [sp+80h] [bp-57Ch]@397 | |
1352 POINT v211; // [sp+88h] [bp-574h]@704 | |
1353 //__int64 v212; // [sp+90h] [bp-56Ch]@467 | |
1354 int v213; // [sp+98h] [bp-564h]@385 | |
1355 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380 | |
1356 char pOut[32]; // [sp+BCh] [bp-540h]@370 | |
1357 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524 | |
1358 int v217[9]; // [sp+158h] [bp-4A4h]@652 | |
1359 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524 | |
1360 char a1[64]; // [sp+1F8h] [bp-404h]@467 | |
1361 char Str2[128]; // [sp+238h] [bp-3C4h]@527 | |
1362 Actor actor; // [sp+2B8h] [bp-344h]@4 | |
2128 | 1363 unsigned short* screenshot; |
1915 | 1364 |
1365 dword_50CDC8 = 0; | |
1366 if ( !pEventTimer->bPaused ) | |
1367 { | |
1368 pParty->sEyelevel = pParty->uDefaultEyelevel; | |
1369 pParty->uPartyHeight = pParty->uDefaultPartyHeight; | |
1370 } | |
1371 if ( bDialogueUI_InitializeActor_NPC_ID ) | |
1372 { | |
1373 //Actor::Actor(&actor); | |
1374 memset(&actor, 0, 0x344u); | |
1375 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID; | |
1376 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID; | |
1377 GameUI_InitializeDialogue(&actor, false); | |
1378 bDialogueUI_InitializeActor_NPC_ID = 0; | |
1379 } | |
1380 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1381 { | |
1382 //v1 = ""; | |
1383 while ( 2 ) | |
1384 { | |
1385 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
1386 break; | |
1387 | |
1388 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199); | |
1389 switch ( uMessage ) | |
1390 { | |
1391 case UIMSG_ChangeGameState: | |
1392 uGameState = GAME_FINISHED; | |
1393 continue; | |
1394 case UIMSG_PlayArcomage: | |
1395 pVideoPlayer->_4BF5B2(); | |
1396 pArcomageGame->bGameInProgress = 1; | |
1397 PrepareArcomage(); | |
1398 continue; | |
1399 case UIMSG_StartNPCDialogue: | |
1400 if ( !uActiveCharacter ) | |
1401 continue; | |
1402 viewparams->field_48 = 1; | |
1403 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1404 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1405 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; | |
1406 pActor = &pActors[uMessageParam]; | |
1407 //goto _actor_init_dlg; | |
1408 GameUI_InitializeDialogue(pActor, true); | |
1409 continue; | |
1410 case UIMSG_StartHireling1Dialogue: | |
1411 case UIMSG_StartHireling2Dialogue: | |
1412 { | |
1413 if (bNoNPCHiring || pCurrentScreen) | |
1414 continue; | |
1415 | |
1416 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1417 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1418 uAction = 0; | |
1419 int hireling_idx = uMessage - UIMSG_StartHireling1Dialogue; | |
1420 v4 = 0; | |
1421 | |
1422 for (uint i = 0; i < 2; ++i) | |
1423 //pNPCData0 = pParty->pHirelings; | |
1424 //do | |
1425 { | |
1426 if (pParty->pHirelings[i].pName) | |
1427 //{ | |
1428 //v6 = uAction++; | |
1429 pTmpBuf[uAction++] = i; | |
1430 //} | |
1431 //++pNPCData0; | |
1432 //++v4; | |
1433 } | |
1434 //while ( (signed int)pNPCData0 < (signed int)&pParty->pPickedItem ); | |
1435 | |
1436 //_this = 0; | |
1437 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
1438 { | |
1980 | 1439 NPCData* npc = &pNPCStats->pNewNPCData[i]; |
1915 | 1440 //do |
1441 //{ | |
1442 if (npc->Hired() && | |
1443 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) && | |
1444 (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) ) | |
1445 { | |
1446 //v7 =; | |
1447 pTmpBuf[uAction++] = i + 2; | |
1448 } | |
1449 //++_this; | |
1450 //++pNPCData4; | |
1451 //} | |
1452 //while ( _this < (signed int)pNPCStats->uNumNewNPCs ); | |
1453 } | |
1454 | |
1455 if ( (signed int)(hireling_idx + pParty->hirelingScrollPosition) < uAction ) | |
1456 { | |
1457 //Actor::Actor(&actor); | |
1458 memset(&actor, 0, 0x344u); | |
1459 actor.sNPC_ID += -1 - pParty->hirelingScrollPosition - hireling_idx; | |
1460 pActor = &actor; | |
1461 GameUI_InitializeDialogue(&actor, true); | |
1462 } | |
1463 } | |
1464 continue; | |
1465 | |
1466 case UIMSG_BuyInShop_Identify_Repair: | |
1467 UIShop_Buy_Identify_Repair(); | |
1468 continue; | |
1469 case UIMSG_ClickNPCTopic: | |
1470 ClickNPCTopic(uMessageParam); | |
1471 continue; | |
1472 case UIMSG_SelectShopDialogueOption: | |
1473 OnSelectShopDialogueOption(uMessageParam); | |
1474 continue; | |
1475 case UIMSG_SelectNPCDialogueOption: | |
1476 OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam); | |
1477 continue; | |
1478 case UIMSG_ClickHouseNPCPortrait: | |
1479 _4B4224_UpdateNPCTopics(uMessageParam); | |
1480 continue; | |
1481 case UIMSG_StartNewGame: | |
1482 if ( dword_6BE138 == 124 || uMessageParam ) | |
1483 { | |
1484 pIcons_LOD->SyncLoadedFilesCount(); | |
1485 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1486 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1487 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1488 pGUIWindow_CurrentMenu->Release(); | |
1489 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU; | |
1490 pCurrentScreen = SCREEN_GAME; | |
1491 viewparams->bRedrawGameUI = 1; | |
1492 } | |
1493 else | |
1494 { | |
1495 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2u);// "Are you sure? Click again to start a New Game" | |
1496 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); | |
1497 dword_6BE138 = 124; | |
1498 } | |
1499 stru_506E40.Release(); | |
1500 continue; | |
1501 case UIMSG_Game_OpenLoadGameDialog: | |
1502 pIcons_LOD->SyncLoadedFilesCount(); | |
1503 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1504 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1505 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1506 pGUIWindow_CurrentMenu->Release(); | |
1507 pCurrentScreen = SCREEN_LOADGAME; | |
1508 LoadUI_Load(1); | |
1509 continue; | |
1510 case UIMSG_Quit: | |
1511 if ( dword_6BE138 == 132 || uMessageParam ) | |
1512 { | |
1513 pIcons_LOD->SyncLoadedFilesCount(); | |
1514 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1515 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1516 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1517 pGUIWindow_CurrentMenu->Release(); | |
1518 pCurrentScreen = SCREEN_GAME; | |
1519 viewparams->bRedrawGameUI = 1; | |
1520 if ( !uMessageParam ) | |
1521 pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); | |
1522 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU; | |
1523 } | |
1524 else | |
1525 { | |
1526 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit" | |
1527 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); | |
1528 dword_6BE138 = 132; | |
1529 } | |
1530 stru_506E40.Release(); | |
1531 continue; | |
1532 case UIMSG_80: | |
1533 __debugbreak(); | |
1534 pIcons_LOD->SyncLoadedFilesCount(); | |
1535 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
1536 pGUIWindow_CurrentMenu->Release(); | |
1537 pCurrentScreen = SCREEN_OPTIONS; | |
1538 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0); | |
1539 continue; | |
1540 case UIMSG_ArrowUp: | |
1541 --pSaveListPosition; | |
1542 if ( pSaveListPosition < 0 ) | |
1543 pSaveListPosition = 0; | |
1544 GUIWindow::Create(215, 199, 17, 17, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); | |
1545 continue; | |
1546 case UIMSG_DownArrow: | |
1547 ++pSaveListPosition; | |
1548 if ( pSaveListPosition >= uMessageParam ) | |
1549 pSaveListPosition = uMessageParam - 1; | |
1550 GUIWindow::Create(215, 323, 17, 17, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); | |
1551 continue; | |
1552 case UIMSG_Cancel: | |
1553 GUIWindow::Create(350, 302, 106, 42, WINDOW_CloseRestWindowBtn, (int)pBtnCancel, 0); | |
1554 continue; | |
1555 case UIMSG_SaveLoadBtn: | |
1556 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
1557 continue; | |
1558 case UIMSG_SelectLoadSlot: | |
1559 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1560 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
1561 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) | |
1562 { | |
1563 v10 = pSaveListPosition + uMessageParam; | |
1564 if ( dword_6BE138 == pSaveListPosition + uMessageParam ) | |
1565 { | |
1566 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); | |
1567 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); | |
1568 } | |
1569 uLoadGameUI_SelectedSlot = v10; | |
1570 dword_6BE138 = v10; | |
1571 } | |
1572 else | |
1573 { | |
1574 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); | |
1575 if ( strcmp((const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pGlobalTXT_LocalizationStrings[72]) )// "Empty" | |
1576 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, (const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot]); | |
1577 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1578 } | |
1579 continue; | |
1580 case UIMSG_LoadGame: | |
1581 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) | |
1582 { | |
1583 LoadGame(uLoadGameUI_SelectedSlot); | |
1584 uGameState = GAME_STATE_LOADING_GAME; | |
1585 } | |
1586 stru_506E40.Release(); | |
1587 continue; | |
1588 case UIMSG_SaveGame: | |
1589 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1590 { | |
1591 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
1592 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); | |
1593 } | |
1594 DoSavegame(uLoadGameUI_SelectedSlot); | |
1595 stru_506E40.Release(); | |
1596 continue; | |
1597 case UIMSG_Game_OpenSaveGameDialog: | |
1598 pGUIWindow_CurrentMenu->Release(); | |
1599 pCurrentScreen = SCREEN_SAVEGAME; | |
1600 SaveUI_Load(); | |
1601 continue; | |
1602 case UIMSG_Game_OpenOptionsDialog://Open | |
1603 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1604 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1605 pGUIWindow_CurrentMenu->Release(); | |
1606 viewparams->field_48 = 1; | |
1607 pCurrentScreen = SCREEN_OPTIONS; | |
1608 | |
1609 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); | |
1610 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); | |
1611 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); | |
1612 options_menu_skin.uTextureID_TurnSpeed[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE); | |
1613 options_menu_skin.uTextureID_ArrowLeft = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); | |
1614 options_menu_skin.uTextureID_ArrowRight = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); | |
1615 options_menu_skin.uTextureID_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); | |
1616 options_menu_skin.uTextureID_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); | |
1617 options_menu_skin.uTextureID_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); | |
1618 options_menu_skin.uTextureID_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); | |
1619 options_menu_skin.uTextureID_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); | |
1620 options_menu_skin.uTextureID_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); | |
1621 options_menu_skin.uTextureID_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); | |
1622 options_menu_skin.uTextureID_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); | |
1623 options_menu_skin.uTextureID_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); | |
1624 options_menu_skin.uTextureID_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); | |
1625 options_menu_skin.uTextureID_FlipOnExit = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE); | |
1626 options_menu_skin.uTextureID_AlwaysRun = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); | |
1627 options_menu_skin.uTextureID_ShowDamage = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); | |
1628 options_menu_skin.uTextureID_WalkSound = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); | |
1629 | |
1630 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); | |
1631 pGUIWindow_CurrentMenu->CreateButton(22, 270, | |
1632 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth, | |
1633 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight, | |
1634 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0); | |
1635 pGUIWindow_CurrentMenu->CreateButton(93, 270, | |
1636 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth, | |
1637 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight, | |
1638 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0); | |
1639 pGUIWindow_CurrentMenu->CreateButton(164, 270, | |
1640 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth, | |
1641 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight, | |
1642 1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0); | |
1643 | |
1644 pGUIWindow_CurrentMenu->CreateButton(20, 303, | |
1645 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth, | |
1646 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight, | |
1647 1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0); | |
1648 pGUIWindow_CurrentMenu->CreateButton(128, 303, | |
1649 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth, | |
1650 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight, | |
1651 1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0); | |
1652 pGUIWindow_CurrentMenu->CreateButton(20, 325, | |
1653 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth, | |
1654 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight, | |
1655 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0); | |
1656 pGUIWindow_CurrentMenu->CreateButton(128, 325, | |
1657 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth, | |
1658 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight, | |
1659 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0); | |
1660 | |
1661 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
1662 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
1663 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0); | |
1664 | |
1665 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
1666 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
1667 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0); | |
1668 | |
1669 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
1670 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
1671 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0); | |
1672 | |
1673 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" | |
1674 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0); | |
1675 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0); | |
1676 continue; | |
1677 | |
1678 case UIMSG_OpenKeyMappingOptions://Open | |
1679 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1680 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1681 pGUIWindow_CurrentMenu->Release(); | |
1682 viewparams->field_48 = 1; | |
1683 pCurrentScreen = SCREEN_KEYBOARD_OPTIONS; | |
1684 uTextureID_Optkb[0] = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE); | |
1685 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); | |
1686 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); | |
1687 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); | |
1688 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); | |
1689 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0); | |
1690 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); | |
1691 pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0); | |
1692 pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0); | |
1693 pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0); | |
1694 pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0); | |
1695 pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0); | |
1696 pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 1u, 0, "", 0); | |
1697 pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 2u, 0, "", 0); | |
1698 pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 3u, 0, "", 0); | |
1699 pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, UIMSG_ChangeKeyButton, 4u, 0, "", 0); | |
1700 pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 5u, 0, "", 0); | |
1701 pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 6u, 0, "", 0); | |
1702 pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 7u, 0, "", 0); | |
1703 pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 8u, 0, "", 0); | |
1704 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0); | |
1705 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0); | |
1706 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); | |
1707 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); | |
1708 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); | |
1709 uGameMenuUI_CurentlySelectedKeyIdx = -1; | |
1710 KeyboardPageNum = 1; | |
1711 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); | |
1712 //*(_WORD *)KeyButtonArray[28] = 0; | |
1713 memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); | |
1714 //v1 = ""; | |
1715 //v0 = 1; | |
1716 continue; | |
1717 case UIMSG_ChangeKeyButton: | |
1718 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) | |
1719 { | |
1720 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1721 continue; | |
1722 } | |
1723 v14 = uMessageParam; | |
1724 if ( KeyboardPageNum != 1 ) | |
1725 v14 = uMessageParam + 14; | |
1726 uGameMenuUI_CurentlySelectedKeyIdx = v14; | |
1727 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); | |
1728 continue; | |
1729 case UIMSG_ResetKeyMapping: | |
1730 v197 = 1; | |
1731 pKeyActionMap->SetDefaultMapping(); | |
1732 uAction = 0; | |
1733 do | |
1734 { | |
1735 v15 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1736 if ( v15 != pPrevVirtualCidesMapping[uAction] ) | |
1737 { | |
1738 if ( v197 ) | |
1739 { | |
1740 v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1741 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, 1); | |
1742 v197 = 0; | |
1743 } | |
1744 else | |
1745 { | |
1746 v17 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1747 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v17, 0); | |
1748 } | |
1749 } | |
1750 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1751 v18 = uAction++; | |
1752 v13 = uAction > 28; | |
1753 v12 = uAction - 28 < 0; | |
1754 GameMenuUI_InvaligKeyBindingsFlags[v18] = 0; | |
1755 } | |
1756 while ( v12 ^ v13 ); | |
1757 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); | |
1758 continue; | |
1759 case UIMSG_SelectKeyPage1: | |
1760 KeyboardPageNum = 1; | |
1761 continue; | |
1762 case UIMSG_SelectKeyPage2: | |
1763 KeyboardPageNum = 2; | |
1764 continue; | |
1765 case UIMSG_OpenVideoOptions: | |
1766 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1767 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1768 pGUIWindow_CurrentMenu->Release(); | |
1769 viewparams->field_48 = 1; | |
1770 pCurrentScreen = SCREEN_VIDEO_OPTIONS; | |
1771 optvid_base_texture_id = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE); | |
1772 bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE); | |
1773 us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE); | |
1774 tinting_texture_id = pIcons_LOD->LoadTexture("opvdH-tn", TEXTURE_16BIT_PALETTE); | |
1775 uTextureID_507C20 = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); | |
1776 uTextureID_507C24 = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); | |
1777 pTextureIDs_GammaPositions[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); | |
1778 pTextureIDs_GammaPositions[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); | |
1779 pTextureIDs_GammaPositions[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); | |
1780 pTextureIDs_GammaPositions[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); | |
1781 pTextureIDs_GammaPositions[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); | |
1782 pTextureIDs_GammaPositions[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); | |
1783 pTextureIDs_GammaPositions[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); | |
1784 pTextureIDs_GammaPositions[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); | |
1785 pTextureIDs_GammaPositions[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); | |
1786 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); | |
1787 not_available_bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); | |
1788 not_available_us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); | |
1789 not_available_tinting_texture_id = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); | |
1790 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); | |
1791 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); | |
1792 if ( pRenderer->pRenderD3D ) | |
1793 { | |
1794 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0); | |
1795 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0); | |
1796 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0); | |
1797 } | |
1798 if ( !pRenderer->bWindowMode ) | |
1799 { | |
1800 //v0 = 1; | |
1801 if ( GammaController::IsGammaSupported() ) | |
1802 { | |
1803 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0); | |
1804 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0); | |
1805 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, "", 0); | |
1806 } | |
1807 } | |
1808 continue; | |
1809 case UIMSG_1A9: | |
1810 __debugbreak(); | |
1811 if ( uMessageParam == 4 ) | |
1812 { | |
1813 //--uGammaPos; | |
1814 if ( (uGammaPos -- -1) < 0 ) | |
1815 { | |
1816 uGammaPos = 0; | |
1817 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); | |
1818 continue; | |
1819 } | |
1820 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
1821 pGame->pGammaController->Initialize(v19); | |
1822 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); | |
1823 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); | |
1824 continue; | |
1825 } | |
1826 if ( uMessageParam == 5 ) | |
1827 { | |
1828 ++uGammaPos; | |
1829 if ( (signed int)uGammaPos <= 9 ) | |
1830 { | |
1831 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
1832 pGame->pGammaController->Initialize(v21); | |
1833 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); | |
1834 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); | |
1835 continue; | |
1836 } | |
1837 uGammaPos = 9; | |
1838 } | |
1839 else | |
1840 { | |
1841 uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17; | |
1842 v22 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
1843 pGame->pGammaController->Initialize(v22); | |
1844 } | |
1845 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); | |
1846 continue; | |
1847 case UIMSG_ToggleBloodsplats: | |
1848 pGame->ToggleFlags2(0x20u); | |
1849 continue; | |
1850 case UIMSG_ToggleColoredLights: | |
1851 pRenderer->bUseColoredLights = pRenderer->bUseColoredLights == 0; | |
1852 continue; | |
1853 case UIMSG_ToggleTint: | |
1854 pRenderer->bTinting = pRenderer->bTinting == 0; | |
1855 continue; | |
2113 | 1856 case UIMSG_ChangeMusicVolume: //ãðîìêîñòü ìóçûêè |
1857 if ( uMessageParam == 4 )//êíîïêà ïîíèæåíèÿ | |
1915 | 1858 { |
1859 --uMusicVolimeMultiplier; | |
1860 if ( (char)uMusicVolimeMultiplier < 1 ) | |
1861 uMusicVolimeMultiplier = 0; | |
2113 | 1862 GUIWindow::Create(243, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
2114 | 1863 if ( uMusicVolimeMultiplier ) |
1864 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); | |
1865 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
1915 | 1866 continue; |
1867 } | |
2113 | 1868 if ( uMessageParam == 5 )//êíîïêà ïîâûøåíèÿ |
1915 | 1869 { |
1870 ++uMusicVolimeMultiplier; | |
1871 if ( (char)uMusicVolimeMultiplier > 9 ) | |
1872 uMusicVolimeMultiplier = 9; | |
2113 | 1873 GUIWindow::Create(435, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
1915 | 1874 if ( uMusicVolimeMultiplier ) |
2114 | 1875 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); |
1876 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
1915 | 1877 continue; |
1878 } | |
2113 | 1879 uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//äëÿ çàäàíèÿ ãðîìêîñòè ìûøêîé |
1915 | 1880 if ( (char)uMusicVolimeMultiplier > 9 ) |
1881 uMusicVolimeMultiplier = 9; | |
1882 if ( uMusicVolimeMultiplier ) | |
2114 | 1883 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); |
1884 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
1915 | 1885 continue; |
1886 case UIMSG_ChangeSoundVolume: | |
1887 if ( uMessageParam == 4 )//reduce sound level button left | |
1888 { | |
1889 --uSoundVolumeMultiplier; | |
1890 if ( (char)uSoundVolumeMultiplier < 1 ) | |
1891 uSoundVolumeMultiplier = 0; | |
1892 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); | |
1893 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); | |
1894 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); | |
1895 continue; | |
1896 } | |
1897 if ( uMessageParam == 5 )//Increase sound level button right | |
1898 { | |
1899 ++uSoundVolumeMultiplier; | |
1900 if ( (char)uSoundVolumeMultiplier > 8 ) | |
1901 uSoundVolumeMultiplier = 9; | |
1902 //v168 = 1; | |
1903 v24 = 435; | |
1904 //v154 = (int)pBtn_SliderRight; | |
1905 GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); | |
1906 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); | |
1907 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); | |
1908 continue; | |
1909 } | |
1910 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; | |
1911 if ( (char)uSoundVolumeMultiplier > 8 ) | |
1912 uSoundVolumeMultiplier = 9; | |
1913 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); | |
1914 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); | |
1915 continue; | |
1916 case UIMSG_ToggleFlipOnExit: | |
1917 bFlipOnExit = bFlipOnExit == 0; | |
1918 continue; | |
1919 case UIMSG_ToggleAlwaysRun: | |
1920 bAlwaysRun = bAlwaysRun == 0; | |
1921 continue; | |
1922 case UIMSG_ToggleWalkSound: | |
1923 bWalkSound = bWalkSound == 0; | |
1924 continue; | |
1925 case UIMSG_ToggleShowDamage: | |
1926 bShowDamage = bShowDamage == 0; | |
1927 continue; | |
1928 case UIMSG_ChangeVoiceVolume: | |
1929 if ( uMessageParam == 4 ) | |
1930 { | |
1931 --uVoicesVolumeMultiplier; | |
1932 if ( (char)uVoicesVolumeMultiplier < 1 ) | |
1933 uVoicesVolumeMultiplier = 0; | |
1934 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); | |
1935 if ( !uVoicesVolumeMultiplier ) | |
1936 continue; | |
1937 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
1938 continue; | |
1939 } | |
1940 if ( uMessageParam == 5 ) | |
1941 { | |
1942 ++uVoicesVolumeMultiplier; | |
1943 if ( (char)uVoicesVolumeMultiplier > 8 ) | |
1944 uVoicesVolumeMultiplier = 9; | |
1945 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); | |
1946 if ( !uVoicesVolumeMultiplier ) | |
1947 continue; | |
1948 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
1949 continue; | |
1950 } | |
1951 uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17; | |
1952 if ( (char)uVoicesVolumeMultiplier > 8 ) | |
1953 uVoicesVolumeMultiplier = 9; | |
1954 if ( !uVoicesVolumeMultiplier ) | |
1955 continue; | |
1956 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); | |
1957 continue; | |
1958 case UIMSG_SetTurnSpeed: | |
1959 if ( uMessageParam ) | |
1960 pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam; | |
1961 uTurnSpeed = uMessageParam; | |
1962 continue; | |
1963 case UIMSG_SetGraphicsMode: | |
1964 if ( !bUseLoResSprites ) | |
1965 { | |
1966 byte_6BE388_graphicsmode = uMessageParam; | |
1967 MM7Initialization(); | |
1968 continue; | |
1969 } | |
1970 if ( uMessageParam ) | |
1971 { | |
1972 if ( uMessageParam == 1 ) | |
1973 { | |
1974 byte_6BE388_graphicsmode = 0; | |
1975 } | |
1976 else | |
1977 { | |
1978 if ( uMessageParam != 2 ) | |
1979 continue; | |
1980 byte_6BE388_graphicsmode = 1; | |
1981 } | |
1982 MM7Initialization(); | |
1983 continue; | |
1984 } | |
1985 ModalWindow(pNPCTopics[453].pText, UIMSG_0); | |
1986 continue; | |
1987 case UIMSG_GameMenu_ReturnToGame: | |
1988 pGUIWindow_CurrentMenu->Release(); | |
1989 pEventTimer->Resume(); | |
1990 pCurrentScreen = SCREEN_GAME; | |
1991 viewparams->bRedrawGameUI = 1; | |
1992 stru_506E40.Release(); | |
1993 continue; | |
1994 case UIMSG_OpenQuestBook: | |
1995 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1996 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1997 if ( pCurrentScreen ) | |
1998 pGUIWindow_CurrentMenu->Release(); | |
1999 pEventTimer->Pause(); | |
2000 pAudioPlayer->StopChannels(-1, -1); | |
2001 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); | |
2002 pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Quests, 0); | |
2003 bFlashQuestBook = 0; | |
2004 continue; | |
2005 case UIMSG_OpenAutonotes: | |
2006 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2007 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2008 if ( pCurrentScreen ) | |
2009 pGUIWindow_CurrentMenu->Release(); | |
2010 pEventTimer->Pause(); | |
2011 pAudioPlayer->StopChannels(-1, -1); | |
2012 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); | |
2013 pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Autonotes, 0); | |
2014 bFlashAutonotesBook = 0; | |
2015 continue; | |
2016 case UIMSG_OpenMapBook: | |
2017 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2018 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2019 if ( pCurrentScreen ) | |
2020 pGUIWindow_CurrentMenu->Release(); | |
2021 pEventTimer->Pause(); | |
2022 viewparams->sViewCenterX = pParty->vPosition.x; | |
2023 viewparams->sViewCenterY = pParty->vPosition.y; | |
2024 pAudioPlayer->StopChannels(-1, -1); | |
2025 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); | |
2026 pBooksWindow = GUIWindow::Create(546, 353, 0, 0, WINDOW_BooksWindow, (int)pBtn_Maps, 0); | |
2027 continue; | |
2028 case UIMSG_OpenCalendar: | |
2029 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2030 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2031 if ( pCurrentScreen ) | |
2032 pGUIWindow_CurrentMenu->Release(); | |
2033 pEventTimer->Pause(); | |
2034 pAudioPlayer->StopChannels(-1, -1); | |
2035 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); | |
2036 pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_BooksWindow, (int)pBtn_Calendar, 0); | |
2037 continue; | |
2038 case UIMSG_OpenHistoryBook: | |
2039 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2040 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2041 if ( pCurrentScreen ) | |
2042 pGUIWindow_CurrentMenu->Release(); | |
2043 pEventTimer->Pause(); | |
2044 pAudioPlayer->StopChannels(-1, -1); | |
2045 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); | |
2046 pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_BooksWindow, (int)pBtn_History, 0); | |
2047 bFlashHistoryBook = 0; | |
2048 continue; | |
2049 case UIMSG_Escape:// íàæàòèå Escape and return to game | |
2050 back_to_game(); | |
2051 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2052 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2053 switch ( pCurrentScreen ) | |
2054 { | |
2055 case SCREEN_E: | |
2056 __debugbreak(); | |
2057 case SCREEN_NPC_DIALOGUE: | |
2058 case SCREEN_CHEST: | |
2059 case SCREEN_CHEST_INVENTORY: | |
2060 case SCREEN_CHANGE_LOCATION: | |
2061 case SCREEN_INPUT_BLV: | |
2062 case SCREEN_QUICK_REFERENCE: | |
2063 if ( dword_50CDC8 ) | |
2064 break; | |
2065 CloseWindowBackground(); | |
2066 uMessageParam = 1; | |
2067 break; | |
2068 case SCREEN_HOUSE: | |
2069 if ( !dword_50CDC8 && !dword_5C35C8 ) | |
2070 { | |
2071 CloseWindowBackground(); | |
2072 dword_5C35C8 = 0; | |
2073 uMessageParam = 1; | |
2074 break; | |
2075 } | |
2076 break; | |
2077 } | |
2078 if ( !pModalWindow ) | |
2079 { | |
2080 pRenderer->ClearZBuffer(0, 479); | |
2081 viewparams->bRedrawGameUI = 1; | |
2082 viewparams->field_48 = 1; | |
2083 if ( pCurrentScreen ) | |
2084 { | |
2085 if ( pCurrentScreen > SCREEN_67 ) | |
2086 { | |
2087 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE ) | |
2088 { | |
2089 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2090 if ( pGUIWindow_Settings ) | |
2091 { | |
2092 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2093 { | |
2094 pMouse->SetCursorBitmap("MICON2"); | |
2095 } | |
2096 else | |
2097 { | |
2098 pGUIWindow_Settings->Release(); | |
2099 pGUIWindow_Settings = 0; | |
2100 pMouse->SetCursorBitmap("MICON1"); | |
2101 GameUI_Footer_TimeLeft = 0; | |
2102 _50C9A0_IsEnchantingInProgress = 0; | |
2103 back_to_game(); | |
2104 } | |
2105 } | |
2106 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2107 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2108 pGUIWindow_CurrentMenu->Release(); | |
2109 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2110 window_SpeakInHouse = 0; | |
2111 pGUIWindow_CurrentMenu = 0; | |
2112 pEventTimer->Resume(); | |
2113 pCurrentScreen = SCREEN_GAME; | |
2114 viewparams->bRedrawGameUI = 1; | |
2115 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2116 continue; | |
2117 } | |
2118 } | |
2119 else | |
2120 { | |
2121 if ( pCurrentScreen < SCREEN_64 ) | |
2122 { | |
2123 switch ( pCurrentScreen ) | |
2124 { | |
2125 case SCREEN_CASTING: | |
2126 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2127 if ( some_active_character ) | |
2128 { | |
2129 uActiveCharacter = some_active_character; | |
2130 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2131 some_active_character = 0; | |
2132 if ( pParty->bTurnBasedModeOn ) | |
2133 pTurnEngine->ApplyPlayerAction(); | |
2134 _50C9D0_AfterEnchClickEventId = 0; | |
2135 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
2136 _50C9D8_AfterEnchClickEventTimeout = 0; | |
2137 } | |
2138 if ( ptr_50C9A4_ItemToEnchant && ptr_50C9A4_ItemToEnchant->uItemID ) | |
2139 { | |
2140 LOBYTE(ptr_50C9A4_ItemToEnchant->uAttributes) &= 0xFu; | |
2141 _50C9A8_item_enchantment_timer = 0; | |
2142 ptr_50C9A4_ItemToEnchant = 0; | |
2143 } | |
2144 if ( pGUIWindow_Settings ) | |
2145 { | |
2146 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2147 { | |
2148 pMouse->SetCursorBitmap("MICON2"); | |
2149 } | |
2150 else | |
2151 { | |
2152 pGUIWindow_Settings->Release(); | |
2153 pGUIWindow_Settings = 0; | |
2154 pMouse->SetCursorBitmap("MICON1"); | |
2155 GameUI_Footer_TimeLeft = 0; | |
2156 _50C9A0_IsEnchantingInProgress = 0; | |
2157 back_to_game(); | |
2158 } | |
2159 } | |
2160 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2161 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2162 pGUIWindow_CurrentMenu->Release(); | |
2163 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2164 window_SpeakInHouse = 0; | |
2165 pGUIWindow_CurrentMenu = 0; | |
2166 pEventTimer->Resume(); | |
2167 pCurrentScreen = SCREEN_GAME; | |
2168 viewparams->bRedrawGameUI = 1; | |
2169 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2170 continue; | |
2171 case SCREEN_BOOKS: | |
2172 pBooksWindow->Release(); | |
2173 //crt_deconstruct_ptr_6A0118(); | |
2174 pBooksWindow = 0; | |
2175 pEventTimer->Resume(); | |
2176 if ( pGUIWindow_Settings ) | |
2177 { | |
2178 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2179 { | |
2180 pMouse->SetCursorBitmap("MICON2"); | |
2181 } | |
2182 else | |
2183 { | |
2184 pGUIWindow_Settings->Release(); | |
2185 pGUIWindow_Settings = 0; | |
2186 pMouse->SetCursorBitmap("MICON1"); | |
2187 GameUI_Footer_TimeLeft = 0; | |
2188 _50C9A0_IsEnchantingInProgress = 0; | |
2189 back_to_game(); | |
2190 } | |
2191 } | |
2192 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2193 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2194 pGUIWindow_CurrentMenu->Release(); | |
2195 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2196 window_SpeakInHouse = 0; | |
2197 pGUIWindow_CurrentMenu = 0; | |
2198 pEventTimer->Resume(); | |
2199 pCurrentScreen = SCREEN_GAME; | |
2200 viewparams->bRedrawGameUI = 1; | |
2201 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2202 continue; | |
2203 case SCREEN_SAVEGAME: | |
2204 case SCREEN_LOADGAME: | |
2205 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2206 //crt_deconstruct_ptr_6A0118(); | |
2207 stru_506E40.Release(); | |
2208 break; | |
2209 case SCREEN_CHEST_INVENTORY: | |
2210 pCurrentScreen = SCREEN_CHEST; | |
2211 continue; | |
2212 case SCREEN_CHEST: | |
2213 pWindow2 = pChestWindow; | |
2214 pWindow2->Release(); | |
2215 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2216 pCurrentScreen = SCREEN_GAME; | |
2217 viewparams->bRedrawGameUI = 1; | |
2218 pEventTimer->Resume(); | |
2219 continue; | |
2220 case SCREEN_19: | |
2221 __debugbreak(); | |
2222 pWindow2 = ptr_507BC8; | |
2223 pWindow2->Release(); | |
2224 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2225 pCurrentScreen = SCREEN_GAME; | |
2226 viewparams->bRedrawGameUI = 1; | |
2227 pEventTimer->Resume(); | |
2228 continue; | |
2229 case SCREEN_OPTIONS://Close | |
2230 options_menu_skin.Relaease(); | |
2231 pIcons_LOD->SyncLoadedFilesCount(); | |
2232 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); | |
2233 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); | |
2234 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier); | |
2235 WriteWindowsRegistryInt("WalkSound", bWalkSound); | |
2236 WriteWindowsRegistryInt("ShowDamage", bShowDamage); | |
2237 WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode); | |
2238 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); | |
2239 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit); | |
2240 if ( !uTurnSpeed ) | |
2241 { | |
2242 WriteWindowsRegistryInt("TurnDelta", 3); | |
2243 stru_506E40.Release(); | |
2244 break; | |
2245 } | |
2246 if ( uTurnSpeed == 64 ) | |
2247 { | |
2248 WriteWindowsRegistryInt("TurnDelta", 2); | |
2249 stru_506E40.Release(); | |
2250 break; | |
2251 } | |
2252 if ( uTurnSpeed != 128 ) | |
2253 { | |
2254 stru_506E40.Release(); | |
2255 break; | |
2256 } | |
2257 WriteWindowsRegistryInt("TurnDelta", 1); | |
2258 stru_506E40.Release(); | |
2259 break; | |
2260 case SCREEN_MENU: | |
2261 pIcons_LOD->SyncLoadedFilesCount(); | |
2262 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2263 pIcons_LOD->SyncLoadedFilesCount(); | |
2264 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2265 stru_506E40.Release(); | |
2266 break; | |
2267 case SCREEN_VIDEO_OPTIONS: | |
2268 if ( pRenderer->pRenderD3D ) | |
2269 { | |
2270 WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights); | |
2271 WriteWindowsRegistryInt("Tinting", pRenderer->bTinting); | |
2272 WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1); | |
2273 } | |
2274 if ( pRenderer->bWindowMode ) | |
2275 { | |
2276 stru_506E40.Release(); | |
2277 break; | |
2278 } | |
2279 //v30 = uGammaPos; | |
2280 //v31 = "GammaPos"; | |
2281 WriteWindowsRegistryInt("GammaPos", uGammaPos); | |
2282 stru_506E40.Release(); | |
2283 break; | |
2284 | |
2285 case SCREEN_KEYBOARD_OPTIONS://Return to game | |
2286 v197 = 1; | |
2287 v32 = 0; | |
2288 while ( !GameMenuUI_InvaligKeyBindingsFlags[v32]) | |
2289 { | |
2290 ++v32; | |
2291 if ( v32 >= 28 ) | |
2292 { | |
2293 thisb = (signed int)&uTextureID_Optkb; | |
2294 assert(false && "Invalid condition values"); | |
2295 do | |
2296 { | |
2297 if ( *(int *)thisb ) | |
2298 pIcons_LOD->pTextures[*(int *)thisb].Release(); | |
2299 thisb += 4; | |
2300 } | |
2301 while ( thisb < (signed int)0x00507C08 ); | |
2302 | |
2303 memset(&uTextureID_Optkb, 0, 0x14u); | |
2304 pIcons_LOD->SyncLoadedFilesCount(); | |
2305 uAction = 0; | |
2306 do | |
2307 { | |
2308 v33 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
2309 if ( v33 != pPrevVirtualCidesMapping[uAction] ) | |
2310 { | |
2311 if ( v197 ) | |
2312 { | |
2313 v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
2314 GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), 1); | |
2315 v197 = 0; | |
2316 } | |
2317 else | |
2318 { | |
2319 v35 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
2320 GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0); | |
2321 } | |
2322 } | |
2323 if ( uAction && uAction != 2 && uAction != 3 && uAction != 1 && uAction != 25 && uAction != 26 ) | |
2324 pKeyToggleType = (KeyToggleType)1; | |
2325 else | |
2326 pKeyToggleType = (KeyToggleType)0; | |
2327 pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType); | |
2328 ++uAction; | |
2329 } | |
2330 while ( uAction < 28 ); | |
2331 pKeyActionMap->StoreMappings(); | |
2332 stru_506E40.Release(); | |
2333 break; | |
2334 } | |
2335 } | |
2336 break; | |
2337 case SCREEN_REST://close rest screen | |
2338 if ( dword_506F14 ) | |
2339 { | |
2340 Rest(_506F18_num_minutes_to_sleep); | |
2341 pParty->pPlayers[3].SetAsleep(false); | |
2342 pParty->pPlayers[2].SetAsleep(false); | |
2343 pParty->pPlayers[1].SetAsleep(false); | |
2344 pParty->pPlayers[0].SetAsleep(false); | |
2345 } | |
2346 pTexture_RestUI_CurrentSkyFrame->Release(); | |
2347 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
2348 pTexture_RestUI_CurrentHourglassFrame = 0; | |
2349 pTexture_RestUI_CurrentSkyFrame = 0; | |
2350 pIcons_LOD->SyncLoadedFilesCount(); | |
2351 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2352 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
2353 { | |
2354 pOutdoor->UpdateSunlightVectors(); | |
2355 pOutdoor->UpdateFog(); | |
2356 } | |
2357 _506F18_num_minutes_to_sleep = 0; | |
2358 dword_506F14 = 0; | |
2359 dword_507B94 = 1; | |
2360 if ( pGUIWindow_Settings ) | |
2361 { | |
2362 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2363 { | |
2364 pMouse->SetCursorBitmap("MICON2"); | |
2365 } | |
2366 else | |
2367 { | |
2368 pGUIWindow_Settings->Release(); | |
2369 pGUIWindow_Settings = 0; | |
2370 pMouse->SetCursorBitmap("MICON1"); | |
2371 GameUI_Footer_TimeLeft = 0; | |
2372 _50C9A0_IsEnchantingInProgress = 0; | |
2373 back_to_game(); | |
2374 } | |
2375 } | |
2376 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2377 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2378 pGUIWindow_CurrentMenu->Release(); | |
2379 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2380 window_SpeakInHouse = 0; | |
2381 pGUIWindow_CurrentMenu = 0; | |
2382 pEventTimer->Resume(); | |
2383 pCurrentScreen = SCREEN_GAME; | |
2384 viewparams->bRedrawGameUI = 1; | |
2385 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2386 continue; | |
2387 case SCREEN_E: | |
2388 __debugbreak(); | |
2389 pGUIWindow_CurrentMenu->Release(); | |
2390 pCurrentScreen = SCREEN_HOUSE; | |
2391 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2392 continue; | |
2393 case SCREEN_HOUSE: | |
2394 if ( uDialogueType ) | |
2395 uDialogueType = 0; | |
2124 | 2396 if ( uGameState == GAME_STATE_CHANGE_LOCATION ) |
1915 | 2397 { |
1919 | 2398 while ( HouseDialogPressCloseBtn() ) |
1915 | 2399 ; |
2400 } | |
2401 else | |
2402 { | |
1919 | 2403 if ( HouseDialogPressCloseBtn() ) |
1915 | 2404 continue; |
2405 } | |
2406 GetHouseGoodbyeSpeech(); | |
2407 pAudioPlayer->PlaySound(SOUND_7, 814, 0, -1, 0, 0, 0, 0); | |
2408 pVideoPlayer->Unload(); | |
2409 pGUIWindow_CurrentMenu = window_SpeakInHouse; | |
2410 if ( pGUIWindow_Settings ) | |
2411 { | |
2412 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2413 { | |
2414 pMouse->SetCursorBitmap("MICON2"); | |
2415 } | |
2416 else | |
2417 { | |
2418 pGUIWindow_Settings->Release(); | |
2419 pGUIWindow_Settings = 0; | |
2420 pMouse->SetCursorBitmap("MICON1"); | |
2421 GameUI_Footer_TimeLeft = 0; | |
2422 _50C9A0_IsEnchantingInProgress = 0; | |
2423 back_to_game(); | |
2424 } | |
2425 } | |
2426 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2427 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2428 pGUIWindow_CurrentMenu->Release(); | |
2429 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2430 window_SpeakInHouse = 0; | |
2431 pGUIWindow_CurrentMenu = 0; | |
2432 pEventTimer->Resume(); | |
2433 pCurrentScreen = SCREEN_GAME; | |
2434 viewparams->bRedrawGameUI = true; | |
2435 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2436 continue; | |
2437 case SCREEN_INPUT_BLV://click escape | |
2438 if ( uCurrentHouse_Animation == 153 ) | |
2439 PlayHouseSound(0x99u, HouseSound_Greeting_2); | |
2440 pVideoPlayer->Unload(); | |
2441 if ( npcIdToDismissAfterDialogue ) | |
2442 { | |
2443 pParty->hirelingScrollPosition = 0; | |
2444 LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu; | |
2445 pParty->CountHirelings(); | |
2446 viewparams->bRedrawGameUI = true; | |
2447 npcIdToDismissAfterDialogue = 0; | |
2448 } | |
2449 DialogueEnding(); | |
2450 pCurrentScreen = SCREEN_GAME; | |
2451 viewparams->bRedrawGameUI = true; | |
2452 continue; | |
2453 case SCREEN_NPC_DIALOGUE://click escape | |
2454 if ( npcIdToDismissAfterDialogue ) | |
2455 { | |
2456 pParty->hirelingScrollPosition = 0; | |
2457 LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu; | |
2458 pParty->CountHirelings(); | |
2459 viewparams->bRedrawGameUI = true; | |
2460 npcIdToDismissAfterDialogue = 0; | |
2461 } | |
2462 //goto LABEL_317; | |
2463 DialogueEnding(); | |
2464 pCurrentScreen = SCREEN_GAME; | |
2465 viewparams->bRedrawGameUI = true; | |
2466 continue; | |
2467 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape | |
2468 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); | |
2469 sub_4452BB(); | |
2470 DialogueEnding(); | |
2471 pCurrentScreen = SCREEN_GAME; | |
2472 viewparams->bRedrawGameUI = true; | |
2473 continue; | |
2474 case SCREEN_CHANGE_LOCATION://click escape | |
2475 if ( pParty->vPosition.x < -22528 ) | |
2476 pParty->vPosition.x = -22528; | |
2477 if ( pParty->vPosition.x > 22528 ) | |
2478 pParty->vPosition.x = 22528; | |
2479 if ( pParty->vPosition.y < -22528 ) | |
2480 pParty->vPosition.y = -22528; | |
2481 if ( pParty->vPosition.y > 22528 ) | |
2482 pParty->vPosition.y = 22528; | |
2483 DialogueEnding(); | |
2484 pCurrentScreen = SCREEN_GAME; | |
2485 viewparams->bRedrawGameUI = true; | |
2486 continue; | |
2487 case SCREEN_VIDEO: | |
2488 pVideoPlayer->Unload(); | |
2489 continue; | |
2490 case SCREEN_CHARACTERS: | |
2491 CharacterUI_ReleaseButtons(); | |
2492 ReleaseAwardsScrollBar(); | |
2493 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2494 if ( pGUIWindow_Settings ) | |
2495 { | |
2496 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2497 { | |
2498 pMouse->SetCursorBitmap("MICON2"); | |
2499 } | |
2500 else | |
2501 { | |
2502 pGUIWindow_Settings->Release(); | |
2503 pGUIWindow_Settings = 0; | |
2504 pMouse->SetCursorBitmap("MICON1"); | |
2505 GameUI_Footer_TimeLeft = 0; | |
2506 _50C9A0_IsEnchantingInProgress = 0; | |
2507 back_to_game(); | |
2508 } | |
2509 } | |
2510 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2511 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2512 pGUIWindow_CurrentMenu->Release(); | |
2513 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2514 window_SpeakInHouse = 0; | |
2515 pGUIWindow_CurrentMenu = 0; | |
2516 pEventTimer->Resume(); | |
2517 pCurrentScreen = SCREEN_GAME; | |
2518 viewparams->bRedrawGameUI = true; | |
2519 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2520 continue; | |
2521 default: | |
2522 if ( pGUIWindow_Settings ) | |
2523 { | |
2524 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2525 { | |
2526 pMouse->SetCursorBitmap("MICON2"); | |
2527 } | |
2528 else | |
2529 { | |
2530 pGUIWindow_Settings->Release(); | |
2531 pGUIWindow_Settings = 0; | |
2532 pMouse->SetCursorBitmap("MICON1"); | |
2533 GameUI_Footer_TimeLeft = 0; | |
2534 _50C9A0_IsEnchantingInProgress = 0; | |
2535 back_to_game(); | |
2536 } | |
2537 } | |
2538 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2539 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2540 pGUIWindow_CurrentMenu->Release(); | |
2541 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2542 window_SpeakInHouse = 0; | |
2543 pGUIWindow_CurrentMenu = 0; | |
2544 pEventTimer->Resume(); | |
2545 pCurrentScreen = SCREEN_GAME; | |
2546 viewparams->bRedrawGameUI = 1; | |
2547 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2548 continue; | |
2549 } | |
2550 if ( pGUIWindow_Settings ) | |
2551 { | |
2552 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2553 { | |
2554 pMouse->SetCursorBitmap("MICON2"); | |
2555 } | |
2556 else | |
2557 { | |
2558 pGUIWindow_Settings->Release(); | |
2559 pGUIWindow_Settings = 0; | |
2560 pMouse->SetCursorBitmap("MICON1"); | |
2561 GameUI_Footer_TimeLeft = 0; | |
2562 _50C9A0_IsEnchantingInProgress = 0; | |
2563 back_to_game(); | |
2564 } | |
2565 } | |
2566 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2567 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2568 pGUIWindow_CurrentMenu->Release(); | |
2569 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2570 window_SpeakInHouse = 0; | |
2571 pGUIWindow_CurrentMenu = 0; | |
2572 pEventTimer->Resume(); | |
2573 pCurrentScreen = SCREEN_GAME; | |
2574 viewparams->bRedrawGameUI = true; | |
2575 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2576 continue; | |
2577 } | |
2578 CharacterUI_ReleaseButtons(); | |
2579 ReleaseAwardsScrollBar(); | |
2580 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2581 } | |
2582 if ( pGUIWindow_Settings ) | |
2583 { | |
2584 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
2585 { | |
2586 pMouse->SetCursorBitmap("MICON2"); | |
2587 } | |
2588 else | |
2589 { | |
2590 pGUIWindow_Settings->Release(); | |
2591 pGUIWindow_Settings = 0; | |
2592 pMouse->SetCursorBitmap("MICON1"); | |
2593 GameUI_Footer_TimeLeft = 0; | |
2594 _50C9A0_IsEnchantingInProgress = 0; | |
2595 back_to_game(); | |
2596 } | |
2597 } | |
2598 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
2599 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2600 pGUIWindow_CurrentMenu->Release(); | |
2601 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
2602 window_SpeakInHouse = 0; | |
2603 pGUIWindow_CurrentMenu = 0; | |
2604 pEventTimer->Resume(); | |
2605 pCurrentScreen = SCREEN_GAME; | |
2606 viewparams->bRedrawGameUI = true; | |
2607 pIcons_LOD->RemoveTexturesFromTextureList(); | |
2608 continue; | |
2609 } | |
2610 if ( !pGUIWindow_Settings )//Draw Menu | |
2611 { | |
2612 dword_6BE138 = -1; | |
2613 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, (char *)1); | |
2614 pEventTimer->Pause(); | |
2615 pAudioPlayer->StopChannels(-1, -1); | |
2616 pCurrentScreen = SCREEN_MENU; | |
2617 | |
2618 ++pIcons_LOD->uTexturePacksCount; | |
2619 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2620 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
2621 | |
2622 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); | |
2623 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); | |
2624 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); | |
2625 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); | |
2626 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE); | |
2627 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE); | |
2628 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); | |
2629 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE); | |
2630 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu, | |
2631 pGlobalTXT_LocalizationStrings[614],// "New Game" | |
2632 pIcons_LOD->GetTexture(uTextureID_New1), 0); | |
2633 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u, | |
2634 pGlobalTXT_LocalizationStrings[615],// "Save Game" | |
2635 pIcons_LOD->GetTexture(uTextureID_Save1), 0); | |
2636 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu, | |
2637 pGlobalTXT_LocalizationStrings[616],// "Load Game" | |
2638 pIcons_LOD->GetTexture(uTextureID_Load1), 0); | |
2639 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u, | |
2640 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:"" | |
2641 pIcons_LOD->GetTexture(uTextureID_Controls1), 0); | |
2642 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u, | |
2643 pGlobalTXT_LocalizationStrings[618],// "Quit" | |
2644 pIcons_LOD->GetTexture(uTextureID_Quit1), 0); | |
2645 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u, | |
2646 pGlobalTXT_LocalizationStrings[619],// "Return to Game" | |
2647 pIcons_LOD->GetTexture(uTextureID_Resume1), 0); | |
2648 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0); | |
2649 viewparams->field_48 = 1; | |
2650 stru_506E40.Release(); | |
2128 | 2651 screenshot = MakeScreenshot(155, 117); |
2652 pRenderer->SavePCXImage("gamma.pcx", screenshot, 155, 117); | |
2653 free(screenshot); | |
2131 | 2654 stru_506E40.LoadPCXFile("gamma.pcx", 0); |
1915 | 2655 continue; |
2656 } | |
2657 pGUIWindow_Settings->Release(); | |
2658 pGUIWindow_Settings = 0; | |
2659 pMouse->SetCursorBitmap("MICON1"); | |
2660 GameUI_Footer_TimeLeft = 0; | |
2661 _50C9A0_IsEnchantingInProgress = 0; | |
2662 back_to_game(); | |
2663 continue; | |
2664 } | |
2665 ModalWindow_Release(); | |
2666 continue; | |
2667 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel | |
2668 if ( uMessageParam ) | |
2669 { | |
2670 GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0); | |
2671 v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2; | |
2672 if ( pParty->hirelingScrollPosition < v37 ) | |
2673 { | |
2674 ++pParty->hirelingScrollPosition;//??? maybe number of the first cell??? | |
2675 if ( pParty->hirelingScrollPosition >= v37 ) | |
2676 pParty->hirelingScrollPosition = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2; | |
2677 } | |
2678 } | |
2679 else | |
2680 { | |
2681 GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0); | |
2682 /*if ( pParty->field_709 ) | |
2683 { | |
2684 --pParty->field_709; | |
2685 if ( pParty->field_709 < 1 ) | |
2686 pParty->field_709 = 0; | |
2687 }*/ | |
2688 } | |
2689 GameUI_DrawHiredNPCs(); | |
2690 continue; | |
2691 case UIMSG_TransitionUI_Confirm: | |
2692 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2693 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2694 dword_50CDC8 = 1; | |
2695 sub_42FBDD(); | |
2696 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
2697 pVideoPlayer->Unload(); | |
2698 DialogueEnding(); | |
2124 | 2699 viewparams->bRedrawGameUI = true; |
1915 | 2700 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz ) |
2701 { | |
2702 if ( dword_59117C_teleportx ) | |
2703 { | |
2704 pParty->vPosition.x = dword_59117C_teleportx; | |
2705 _5B65A8_npcdata_uflags_or_other = dword_59117C_teleportx; | |
2706 } | |
2707 if ( dword_591178_teleporty ) | |
2708 { | |
2709 pParty->vPosition.y = dword_591178_teleporty; | |
2710 _5B65AC_npcdata_fame_or_other = dword_591178_teleporty; | |
2711 } | |
2712 if ( dword_591174_teleportz ) | |
2713 { | |
2714 pParty->vPosition.z = dword_591174_teleportz; | |
2715 _5B65B0_npcdata_rep_or_other = dword_591174_teleportz; | |
2716 pParty->uFallStartY = dword_591174_teleportz; | |
2717 } | |
2718 if ( dword_591170_teleport_directiony ) | |
2719 { | |
2720 pParty->sRotationY = dword_591170_teleport_directiony; | |
2721 _5B65B4_npcdata_loword_house_or_other = dword_591170_teleport_directiony; | |
2722 } | |
2723 if ( dword_59116C_teleport_directionx ) | |
2724 { | |
2725 pParty->sRotationX = dword_59116C_teleport_directionx; | |
2726 _5B65B8_npcdata_hiword_house_or_other = dword_59116C_teleport_directionx; | |
2727 v38 = dword_591168_teleport_speedz; | |
2728 pParty->uFallSpeed = dword_591168_teleport_speedz; | |
2729 dword_5B65BC = dword_591168_teleport_speedz; | |
2730 } | |
2731 else | |
2732 v38 = dword_5B65BC; | |
2733 if ( *dword_591164_teleport_map_name != 48 ) | |
2734 { | |
2735 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)2; | |
2736 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; | |
2737 OnMapLeave(); | |
2101 | 2738 Transition_StopSound_Autosave(dword_591164_teleport_map_name, MapStartPoint_Party); |
1915 | 2739 } |
2740 } | |
2741 else | |
2742 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); | |
2743 if ( !_stricmp(byte_6BE3B0.data(), "d05.blv") ) | |
2744 pParty->uTimePlayed += 1474560i64; | |
2745 continue; | |
2746 case UIMSG_TransitionWindowCloseBtn: | |
2747 CloseWindowBackground(); | |
2748 pVideoPlayer->Unload(); | |
2749 DialogueEnding(); | |
2750 viewparams->bRedrawGameUI = true; | |
2751 continue; | |
2752 case UIMSG_CycleCharacters: | |
2753 v39 = GetAsyncKeyState(VK_SHIFT); | |
2754 uActiveCharacter = CycleCharacter(v39); | |
2755 viewparams->bRedrawGameUI = true; | |
2756 continue; | |
2757 case UIMSG_OnTravelByFoot: | |
2758 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2759 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2760 dword_50CDC8 = 1; | |
2761 sub_42FBDD(); | |
2762 //pNPCData4 = (NPCData *)GetTravelTime(); | |
2763 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); | |
2764 if ( bUnderwater != 1 && pParty->bFlying | |
2765 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) | |
2766 { | |
2767 viewparams->bRedrawGameUI = 1; | |
2768 CloseWindowBackground(); | |
2769 if ( pParty->vPosition.x < -22528 ) | |
2770 pParty->vPosition.x = -22528; | |
2771 if ( pParty->vPosition.x > 22528 ) | |
2772 pParty->vPosition.x = 22528; | |
2773 if ( pParty->vPosition.y < -22528 ) | |
2774 pParty->vPosition.y = -22528; | |
2775 if ( pParty->vPosition.y > 22528 ) | |
2776 pParty->vPosition.y = 22528; | |
2777 DialogueEnding(); | |
2778 pCurrentScreen = SCREEN_GAME; | |
2779 } | |
2780 else | |
2781 { | |
2782 pParty->field_6E4 = 0; | |
2783 pParty->field_6E0 = 0; | |
2784 CastSpellInfoHelpers::_427D48(); | |
2785 DialogueEnding(); | |
2786 pEventTimer->Pause(); | |
2787 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); | |
2788 ++pGameLoadingUI_ProgressBar->uProgressMax; | |
2789 SaveGame(1, 0); | |
2790 pGameLoadingUI_ProgressBar->Progress(); | |
2791 RestAndHeal(1440 * (signed int)GetTravelTime()); | |
2792 if ( pParty->uNumFoodRations ) | |
2793 { | |
2794 pParty->RestAndHeal(); | |
2795 if ( ((pParty->uNumFoodRations - (signed int)GetTravelTime()) & 0x80000000u) != 0 ) | |
2796 { | |
2797 pPlayer7 = pParty->pPlayers.data(); | |
2798 do | |
2799 { | |
2800 pPlayer7->SetCondition(1, 0); | |
2801 ++pPlayer7; | |
2802 } | |
2803 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings.data() ); | |
2804 ++pParty->days_played_without_rest; | |
2805 } | |
2806 Party::TakeFood((unsigned int)GetTravelTime()); | |
2807 } | |
2808 else | |
2809 { | |
2810 pPlayer8 = pParty->pPlayers.data(); | |
2811 do | |
2812 { | |
2813 pPlayer8->SetCondition(1, 0); | |
2814 ++pPlayer8; | |
2815 } | |
2816 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings.data() ); | |
2817 ++pParty->days_played_without_rest; | |
2818 } | |
2819 pPaletteManager->ResetNonLocked(); | |
2820 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
2821 strcpy(pCurrentMapName, pOut); | |
2822 strcpy(pLevelName, pCurrentMapName); | |
2823 v41 = strtok(pLevelName, "."); | |
2824 strcpy(pLevelName, v41); | |
2825 Level_LoadEvtAndStr(pLevelName); | |
2826 pDecalBuilder->Reset(0); | |
2827 LoadLevel_InitializeLevelEvt(); | |
2828 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName); | |
2829 bUnderwater = 0; | |
2830 bNoNPCHiring = 0; | |
2831 pGame->uFlags2 &= 0xFFFFFFF7u; | |
2832 if ( Is_out15odm_underwater() ) | |
2833 { | |
2834 bUnderwater = 1; | |
2835 pGame->uFlags2 |= 8u; | |
2836 } | |
2837 if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") ) | |
2838 bNoNPCHiring = 1; | |
2839 PrepareToLoadODM(1u, (ODMRenderParams *)1); | |
2840 pAudioPlayer->SetMapEAX(); | |
2841 bDialogueUI_InitializeActor_NPC_ID = 0; | |
2842 OnMapLoad(); | |
2843 pOutdoor->SetFog(); | |
2844 TeleportToStartingPoint(uLevel_StartingPointType); | |
2845 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0); | |
2846 pParty->uFallStartY = pParty->vPosition.z; | |
2847 _461103_load_level_sub(); | |
2848 pEventTimer->Resume(); | |
2849 viewparams->bRedrawGameUI = 1; | |
2850 pCurrentScreen = SCREEN_GAME; | |
2851 pGameLoadingUI_ProgressBar->Release(); | |
2852 } | |
2853 viewparams->bRedrawGameUI = 1; | |
2854 continue; | |
2855 case UIMSG_CHANGE_LOCATION_ClickCencelBtn: | |
2856 CloseWindowBackground(); | |
2857 if ( pParty->vPosition.x < -22528 ) | |
2858 pParty->vPosition.x = -22528; | |
2859 if ( pParty->vPosition.x > 22528 ) | |
2860 pParty->vPosition.x = 22528; | |
2861 if ( pParty->vPosition.y < -22528 ) | |
2862 pParty->vPosition.y = -22528; | |
2863 if ( pParty->vPosition.y > 22528 ) | |
2864 pParty->vPosition.y = 22528; | |
2865 DialogueEnding(); | |
2866 pCurrentScreen = SCREEN_GAME; | |
2867 viewparams->bRedrawGameUI = 1; | |
2868 continue; | |
2869 case UIMSG_CastSpell_Telekinesis: | |
2870 if ( pRenderer->pRenderD3D ) | |
2871 LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
2872 else | |
2873 { | |
2874 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | |
2875 pPoint = pMouse->GetCursorPos(&v208); | |
2876 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | |
2877 } | |
2878 v44 = (unsigned __int16)v42; | |
2879 v45 = PID_TYPE(v44); | |
2880 uNumSeconds = v44; | |
2881 v46 = PID_ID(v44); | |
2882 if ( v45 == 3 ) | |
2883 { | |
2884 v47 = pActors[v46].uAIState == Dead; | |
2885 if ( !v47 ) | |
2886 continue; | |
2887 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
2888 pSpellInfo->uFlags &= ~0x40u; | |
2889 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2890 pSpellInfo->spell_target_pid = v44; | |
2891 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2892 pGUIWindow_Settings->Release(); | |
2893 pGUIWindow_Settings = 0; | |
2894 pMouse->SetCursorBitmap("MICON1"); | |
2895 GameUI_Footer_TimeLeft = 0; | |
2896 _50C9A0_IsEnchantingInProgress = 0; | |
2897 back_to_game(); | |
2898 continue; | |
2899 } | |
2900 if ( v45 == 2 ) | |
2901 { | |
2902 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; | |
2903 if ( !v47 ) | |
2904 continue; | |
2905 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
2906 pSpellInfo->uFlags &= ~0x40u; | |
2907 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2908 pSpellInfo->spell_target_pid = v44; | |
2909 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2910 pGUIWindow_Settings->Release(); | |
2911 pGUIWindow_Settings = 0; | |
2912 pMouse->SetCursorBitmap("MICON1"); | |
2913 GameUI_Footer_TimeLeft = 0; | |
2914 _50C9A0_IsEnchantingInProgress = 0; | |
2915 back_to_game(); | |
2916 continue; | |
2917 } | |
2918 if ( v45 == 5 ) | |
2919 { | |
2920 v48 = pLevelDecorations[v46].uEventID == 0; | |
2921 } | |
2922 else | |
2923 { | |
2924 if ( v45 != 6 ) | |
2925 continue; | |
2926 if ( uCurrentlyLoadedLevelType != 1 ) | |
2927 { | |
2928 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; | |
2092 | 2929 if ( !pODMFace->Clickable() || !pODMFace->sCogTriggeredID ) |
1915 | 2930 continue; |
2931 v44 = uNumSeconds; | |
2932 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
2933 pSpellInfo->uFlags &= ~0x40u; | |
2934 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2935 pSpellInfo->spell_target_pid = v44; | |
2936 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2937 pGUIWindow_Settings->Release(); | |
2938 pGUIWindow_Settings = 0; | |
2939 pMouse->SetCursorBitmap("MICON1"); | |
2940 GameUI_Footer_TimeLeft = 0; | |
2941 _50C9A0_IsEnchantingInProgress = 0; | |
2942 back_to_game(); | |
2943 continue; | |
2944 } | |
2945 pBLVFace = &pIndoor->pFaces[v46]; | |
2092 | 2946 if ( !pBLVFace->Clickable() ) |
1915 | 2947 continue; |
2948 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0; | |
2949 } | |
2950 if ( v48 ) | |
2951 continue; | |
2952 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
2953 pSpellInfo->uFlags &= ~0x40u; | |
2954 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2955 pSpellInfo->spell_target_pid = v44; | |
2956 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2957 pGUIWindow_Settings->Release(); | |
2958 pGUIWindow_Settings = 0; | |
2959 pMouse->SetCursorBitmap("MICON1"); | |
2960 GameUI_Footer_TimeLeft = 0; | |
2961 _50C9A0_IsEnchantingInProgress = 0; | |
2962 back_to_game(); | |
2963 continue; | |
2964 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) | |
2965 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure | |
2966 case UIMSG_HiredNPC_CastSpell: | |
2967 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2968 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2969 if ( _50C9A0_IsEnchantingInProgress ) | |
2970 { | |
2971 uActiveCharacter = uMessageParam; | |
2972 viewparams->bRedrawGameUI = 1; | |
2973 } | |
2974 else | |
2975 { | |
2976 if ( pGUIWindow_Settings ) | |
2977 { | |
2978 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
2979 switch ( uMessage ) | |
2980 { | |
2981 case UIMSG_CastSpell_Character_Big_Improvement: | |
2982 pSpellInfo->uFlags &= ~0x02u; | |
2983 break; | |
2984 case UIMSG_CastSpell_Character_Small_Improvement: | |
2985 pSpellInfo->uFlags &= ~0x0100u; | |
2986 break; | |
2987 case UIMSG_HiredNPC_CastSpell: | |
2988 pSpellInfo->uFlags &= ~0x0200u; | |
2989 break; | |
2990 } | |
2991 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2992 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2993 pGUIWindow_Settings->Release(); | |
2994 pGUIWindow_Settings = 0; | |
2995 pEventTimer->Resume(); | |
2996 pMouse->SetCursorBitmap("MICON1"); | |
2997 GameUI_Footer_TimeLeft = 0; | |
2998 _50C9A0_IsEnchantingInProgress = 0; | |
2999 } | |
3000 } | |
3001 continue; | |
3002 case UIMSG_BF: | |
3003 __debugbreak(); | |
3004 dword_50CDC8 = 1; | |
3005 sub_42FBDD(); | |
3006 SaveGame(1, 0); | |
3007 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); | |
2061 | 3008 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; |
2124 | 3009 uGameState = GAME_STATE_CHANGE_LOCATION; |
1915 | 3010 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; |
3011 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; | |
3012 if ( v53 < 0 ) | |
3013 { | |
3014 v54 = abs(v53) - 1; | |
3015 _5B65B8_npcdata_hiword_house_or_other = 0; | |
3016 dword_5B65BC = 0; | |
3017 v55 = dword_4E4560[v54]; | |
3018 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54]; | |
3019 v56 = dword_4E4590[v54]; | |
3020 v57 = dword_4E45A8[v54]; | |
3021 _5B65A8_npcdata_uflags_or_other = v55; | |
3022 _5B65B4_npcdata_loword_house_or_other = v57; | |
3023 _5B65B0_npcdata_rep_or_other = v56; | |
3024 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57; | |
3025 } | |
1919 | 3026 HouseDialogPressCloseBtn(); |
1915 | 3027 //goto LABEL_434; |
3028 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
3029 { | |
3030 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
3031 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; | |
3032 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3033 ++pMessageQueue_50CBD0->uNumMessages; | |
3034 }*/ | |
3035 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3036 continue; | |
3037 | |
3038 case UIMSG_OnCastTownPortal: | |
3039 pAudioPlayer->StopChannels(-1, -1); | |
3040 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, (char *)uMessageParam); | |
3041 continue; | |
3042 | |
3043 case UIMSG_OnCastLloydsBeacon: | |
3044 pAudioPlayer->StopChannels(-1, -1); | |
3045 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_LloydsBeacon, 0); | |
3046 continue; | |
3047 | |
3048 case UIMSG_LloydsBeacon_FlippingBtn: | |
3049 bRecallingBeacon = uMessageParam; | |
3050 v127 = uMessageParam + 204; | |
3051 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); | |
3052 continue; | |
3053 case UIMSG_HintBeaconSlot: | |
3054 if ( !pGUIWindow_CurrentMenu ) | |
3055 continue; | |
3056 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1]; | |
3057 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; | |
3058 if ( bRecallingBeacon ) | |
3059 { | |
3060 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) ) | |
3061 continue; | |
3062 v173 = pMapStats->pInfos[sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName; | |
3063 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" | |
3064 GameUI_SetFooterString(pTmpBuf.data()); | |
3065 continue; | |
3066 } | |
3067 pMapNum = pMapStats->GetMapInfo(pCurrentMapName); | |
3068 pMapName = "Not in Map Stats"; | |
3069 if ( pMapNum ) | |
3070 pMapName = pMapStats->pInfos[pMapNum].pName; | |
3071 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) || !pMapNum ) | |
3072 { | |
3073 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], pMapName);// "Set to %s" | |
3074 GameUI_SetFooterString(pTmpBuf.data()); | |
3075 continue; | |
3076 } | |
3077 v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; | |
3078 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], (unsigned int)pMapName, v174);// "Set %s over %s" | |
3079 GameUI_SetFooterString(pTmpBuf.data()); | |
3080 continue; | |
3081 case UIMSG_CloseAfterInstallBeacon: | |
3082 dword_50CDC8 = 1; | |
3083 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
3084 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
3085 continue; | |
3086 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
3087 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
3088 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3089 ++pMessageQueue_50CBD0->uNumMessages;*/ | |
3090 continue; | |
3091 case UIMSG_InstallBeacon: | |
3092 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1]; | |
3093 if ( !pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime && bRecallingBeacon ) | |
3094 continue; | |
3095 byte_506360 = 1; | |
3096 pPlayer9->CanCastSpell(uRequiredMana); | |
3097 if ( pParty->bTurnBasedModeOn ) | |
3098 { | |
3099 v60 = sRecoveryTime; | |
3100 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; | |
3101 pPlayer9->SetRecoveryTime(v60); | |
3102 pTurnEngine->ApplyPlayerAction(); | |
3103 } | |
3104 else | |
3105 { | |
3106 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
3107 } | |
3108 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); | |
3109 if ( bRecallingBeacon ) | |
3110 { | |
3111 if ( _stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) ) | |
3112 { | |
3113 SaveGame(1, 0); | |
3114 OnMapLeave(); | |
3115 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); | |
2061 | 3116 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; |
2124 | 3117 uGameState = GAME_STATE_CHANGE_LOCATION; |
1915 | 3118 _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; |
3119 _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | |
3120 _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | |
3121 _5B65B4_npcdata_loword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; | |
3122 _5B65B8_npcdata_hiword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; | |
3123 dword_5B65C0 = 1; | |
3124 } | |
3125 else | |
3126 { | |
3127 pParty->vPosition.x = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; | |
3128 pParty->vPosition.y = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | |
3129 pParty->vPosition.z = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | |
3130 pParty->uFallStartY = pParty->vPosition.z; | |
3131 pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; | |
3132 pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; | |
3133 } | |
3134 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3135 pBooksWindow->Release(); | |
3136 pGUIWindow_CurrentMenu->Release(); | |
3137 pBooksWindow = 0; | |
3138 pGUIWindow_CurrentMenu = 0; | |
3139 } | |
3140 else | |
3141 { | |
3142 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); | |
3143 SaveScreenshot(a1); | |
3144 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); | |
3145 pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335); | |
3146 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x; | |
3147 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y = pParty->vPosition.y; | |
3148 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z = pParty->vPosition.z; | |
3149 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X = LOWORD(pParty->sRotationY); | |
3150 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX); | |
3151 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) | |
3152 continue; | |
3153 for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg ) | |
3154 { | |
3155 if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) ) | |
3156 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; | |
3157 } | |
3158 } | |
3159 continue; | |
3160 case UIMSG_ClickTownInTP: | |
3161 if ( uMessageParam ) | |
3162 { | |
3163 switch ( uMessageParam ) | |
3164 { | |
3165 case 1: | |
3166 v63 = 208; | |
3167 break; | |
3168 case 2: | |
3169 v63 = 207; | |
3170 break; | |
3171 case 3: | |
3172 v63 = 211; | |
3173 break; | |
3174 case 4: | |
3175 v63 = 209; | |
3176 break; | |
3177 default: | |
3178 if ( uMessageParam != 5 ) | |
3179 { | |
3180 LABEL_486: | |
3181 SaveGame(1, 0); | |
3182 v64 = pMapStats->GetMapInfo(pCurrentMapName); | |
3183 v65 = uMessageParam; | |
3184 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) | |
3185 { | |
3186 pParty->vPosition.x = TownPortalList[v65].pos.x; | |
3187 pParty->vPosition.y = TownPortalList[v65].pos.y; | |
3188 pParty->vPosition.z = TownPortalList[v65].pos.z; | |
3189 pParty->uFallStartY = pParty->vPosition.z; | |
3190 pParty->sRotationY = TownPortalList[v65].rot_y; | |
3191 pParty->sRotationX = TownPortalList[v65].rot_x; | |
3192 } | |
3193 else | |
3194 { | |
3195 SaveGame(1, 0); | |
3196 OnMapLeave(); | |
2061 | 3197 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; |
2124 | 3198 uGameState = GAME_STATE_CHANGE_LOCATION; |
1915 | 3199 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); |
3200 dword_5B65C0 = 1; | |
3201 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; | |
3202 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | |
3203 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | |
3204 v66 = TownPortalList[uMessageParam].rot_x; | |
3205 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; | |
3206 _5B65B8_npcdata_hiword_house_or_other = v66; | |
3207 InitializeActors(); | |
3208 } | |
3209 v67 = (char*)pGUIWindow_CurrentMenu->Hint; | |
3210 if ( v67 ) | |
3211 *((int *)v67 + 17) = 1; | |
3212 else | |
3213 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); | |
3214 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
3215 { | |
3216 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
3217 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; | |
3218 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3219 ++pMessageQueue_50CBD0->uNumMessages; | |
3220 }*/ | |
3221 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3222 continue; | |
3223 } | |
3224 v63 = 210; | |
3225 break; | |
3226 } | |
3227 } | |
3228 else | |
3229 { | |
3230 v63 = 206; | |
3231 } | |
3232 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) ) | |
3233 return; | |
3234 goto LABEL_486; | |
3235 case UIMSG_HintTownPortal: | |
3236 if ( uMessageParam ) | |
3237 { | |
3238 switch ( uMessageParam ) | |
3239 { | |
3240 case 1: | |
3241 v68 = 208; | |
3242 break; | |
3243 case 2: | |
3244 v68 = 207; | |
3245 break; | |
3246 case 3: | |
3247 v68 = 211; | |
3248 break; | |
3249 case 4: | |
3250 v68 = 209; | |
3251 break; | |
3252 default: | |
3253 if ( uMessageParam != 5 ) | |
3254 //goto LABEL_506; | |
3255 { | |
3256 if ( uMessageParam ) | |
3257 { | |
3258 switch ( uMessageParam ) | |
3259 { | |
3260 case 1: | |
3261 v69 = pMapStats->pInfos[4].pName; | |
3262 break; | |
3263 case 2: | |
3264 v69 = pMapStats->pInfos[3].pName; | |
3265 break; | |
3266 case 3: | |
3267 v69 = pMapStats->pInfos[10].pName; | |
3268 break; | |
3269 case 4: | |
3270 v69 = pMapStats->pInfos[7].pName; | |
3271 break; | |
3272 default: | |
3273 if ( uMessageParam != 5 ) | |
3274 { | |
3275 __debugbreak(); // warning C4700: uninitialized local variable 'v200' used | |
3276 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); | |
3277 GameUI_SetFooterString(pTmpBuf.data()); | |
3278 continue; | |
3279 } | |
3280 v69 = pMapStats->pInfos[8].pName; | |
3281 break; | |
3282 } | |
3283 } | |
3284 else | |
3285 { | |
3286 v69 = pMapStats->pInfos[21].pName; | |
3287 } | |
3288 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); | |
3289 GameUI_SetFooterString(pTmpBuf.data()); | |
3290 continue; | |
3291 } | |
3292 v68 = 210; | |
3293 break; | |
3294 } | |
3295 } | |
3296 else | |
3297 { | |
3298 v68 = 206; | |
3299 } | |
3300 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) ) | |
3301 { | |
3302 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | |
3303 continue; | |
3304 } | |
3305 //LABEL_506: | |
3306 if ( uMessageParam ) | |
3307 { | |
3308 switch ( uMessageParam ) | |
3309 { | |
3310 case 1: | |
3311 v69 = pMapStats->pInfos[4].pName; | |
3312 break; | |
3313 case 2: | |
3314 v69 = pMapStats->pInfos[3].pName; | |
3315 break; | |
3316 case 3: | |
3317 v69 = pMapStats->pInfos[10].pName; | |
3318 break; | |
3319 case 4: | |
3320 v69 = pMapStats->pInfos[7].pName; | |
3321 break; | |
3322 default: | |
3323 if ( uMessageParam != 5 ) | |
3324 //goto LABEL_519; | |
3325 { | |
3326 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); | |
3327 GameUI_SetFooterString(pTmpBuf.data()); | |
3328 continue; | |
3329 } | |
3330 v69 = pMapStats->pInfos[8].pName; | |
3331 break; | |
3332 } | |
3333 } | |
3334 else | |
3335 { | |
3336 v69 = pMapStats->pInfos[21].pName; | |
3337 } | |
3338 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); | |
3339 GameUI_SetFooterString(pTmpBuf.data()); | |
3340 continue; | |
3341 case UIMSG_ShowFinalWindow: | |
3342 sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." | |
3343 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." | |
3344 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." | |
3345 ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose); | |
3346 uGameState = GAME_STATE_FINAL_WINDOW; | |
3347 continue; | |
3348 case UIMSG_OnFinalWindowClose: | |
3349 __debugbreak(); | |
3350 uGameState = GAME_STATE_PLAYING; | |
3351 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); | |
3352 __debugbreak(); // missed break/continue? | |
3353 case UIMSG_DD: | |
3354 __debugbreak(); | |
3355 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); | |
3356 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); | |
3357 if ( v216.uPropCount == 1 ) | |
3358 { | |
3359 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); | |
3360 v70 = atoi(v216.pProperties[0]); | |
3361 if ( v70 <= 0 || v70 >= 77 ) | |
3362 continue; | |
3363 v71 = v70; | |
3364 strcpy(Str2, pMapStats->pInfos[v70].pFilename); | |
3365 pNPCData3 = 0; | |
3366 if ( (signed int)pNPCData4 > 0 ) | |
3367 { | |
3368 thish = 0; | |
3369 do | |
3370 { | |
3371 if ( !_stricmp((const char *)&pGames_LOD->pSubIndices[thish], Str2) ) | |
3372 break; | |
3373 ++thish; | |
3374 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | |
3375 } | |
3376 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); | |
3377 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) | |
3378 { | |
3379 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); | |
2061 | 3380 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; |
2124 | 3381 uGameState = GAME_STATE_CHANGE_LOCATION; |
1915 | 3382 OnMapLeave(); |
3383 continue; | |
3384 } | |
3385 } | |
3386 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); | |
3387 v73 = Str2; | |
3388 } | |
3389 else | |
3390 { | |
3391 if ( v216.uPropCount != 3 ) | |
3392 continue; | |
3393 v74 = atoi(v216.pProperties[0]); | |
3394 thisi = atoi(v216.pProperties[1]); | |
3395 v75 = atoi(v216.pProperties[2]); | |
3396 v76 = v75; | |
3397 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
3398 { | |
3399 if ( pIndoor->GetSector(v74, thisi, v75) ) | |
3400 { | |
3401 v77 = thisi; | |
3402 pParty->vPosition.x = v74; | |
3403 pParty->vPosition.y = v77; | |
3404 pParty->vPosition.z = v76; | |
3405 pParty->uFallStartY = v76; | |
3406 continue; | |
3407 } | |
3408 } | |
3409 else | |
3410 { | |
3411 if ( v74 > -32768 ) | |
3412 { | |
3413 if ( v74 < 32768 ) | |
3414 { | |
3415 v77 = thisi; | |
3416 if ( thisi > -32768 ) | |
3417 { | |
3418 if ( thisi < 32768 && v76 >= 0 && v76 < 10000 ) | |
3419 { | |
3420 pParty->vPosition.x = v74; | |
3421 pParty->vPosition.y = v77; | |
3422 pParty->vPosition.z = v76; | |
3423 pParty->uFallStartY = v76; | |
3424 continue; | |
3425 } | |
3426 } | |
3427 } | |
3428 } | |
3429 } | |
3430 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
3431 v73 = "Can't jump to that location!"; | |
3432 } | |
3433 ShowStatusBarString(v73, 6u); | |
3434 continue; | |
3435 case UIMSG_CastQuickSpell: | |
3436 if ( bUnderwater == 1 ) | |
3437 { | |
3438 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
3439 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
3440 continue; | |
3441 } | |
3442 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) | |
3443 continue; | |
3444 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); | |
3445 continue; | |
3446 case UIMSG_CastSpell_Monster_Improvement: | |
3447 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, | |
3448 if ( pRenderer->pRenderD3D ) | |
3449 { | |
3450 v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
3451 } | |
3452 else | |
3453 { | |
3454 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206); | |
3455 pPoint2 = pMouse->GetCursorPos(&v201); | |
3456 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | |
3457 } | |
3458 v83 = v81; | |
3459 v44 = (unsigned __int16)v81; | |
3460 v84 = v83 >> 16; | |
3461 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) | |
3462 continue; | |
3463 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; | |
3464 if ( uMessage == UIMSG_CastSpell_Shoot_Monster ) | |
3465 { | |
3466 pSpellInfo->uFlags &= ~0x08; | |
3467 } | |
3468 else | |
3469 { | |
3470 if ( uMessage == UIMSG_CastSpell_Monster_Improvement ) | |
3471 pSpellInfo->uFlags &= ~0x0100u; | |
3472 else | |
3473 pSpellInfo->uFlags &= ~0x0200u; | |
3474 } | |
3475 pSpellInfo->uPlayerID_2 = uMessageParam; | |
3476 pSpellInfo->spell_target_pid = v44; | |
3477 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
3478 pGUIWindow_Settings->Release(); | |
3479 pGUIWindow_Settings = 0; | |
3480 pMouse->SetCursorBitmap("MICON1"); | |
3481 GameUI_Footer_TimeLeft = 0; | |
3482 _50C9A0_IsEnchantingInProgress = 0; | |
3483 back_to_game(); | |
3484 continue; | |
3485 case UIMSG_1C: | |
3486 __debugbreak(); | |
3487 if ( !uActiveCharacter || pCurrentScreen ) | |
3488 continue; | |
3489 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); | |
3490 pCurrentScreen = SCREEN_19; | |
3491 pEventTimer->Pause(); | |
3492 continue; | |
3493 case UIMSG_STEALFROMACTOR: | |
3494 if ( !uActiveCharacter ) | |
3495 continue; | |
3496 if ( pParty->bTurnBasedModeOn != 1 ) | |
3497 { | |
3498 if ( pActors[uMessageParam].uAIState == 5 ) | |
1966
7840fe323f67
stru319::LootActor(struct Actor *pActor) to Actor::LootActor
Grumpy7
parents:
1936
diff
changeset
|
3499 pActors[uMessageParam].LootActor(); |
1915 | 3500 else |
3501 Actor::StealFrom(uMessageParam); | |
3502 continue; | |
3503 } | |
3504 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3 ) | |
3505 continue; | |
3506 if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) ) | |
3507 { | |
3508 if ( pActors[uMessageParam].uAIState == 5 ) | |
1966
7840fe323f67
stru319::LootActor(struct Actor *pActor) to Actor::LootActor
Grumpy7
parents:
1936
diff
changeset
|
3509 pActors[uMessageParam].LootActor(); |
1915 | 3510 else |
3511 Actor::StealFrom(uMessageParam); | |
3512 } | |
3513 continue; | |
3514 | |
3515 case UIMSG_Attack: | |
3516 if ( !uActiveCharacter ) | |
3517 continue; | |
3518 if ( pParty->bTurnBasedModeOn != 1 ) | |
3519 { | |
3520 _42ECB5_PlayerAttacksActor(); | |
3521 continue; | |
3522 } | |
3523 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3 ) | |
3524 continue; | |
3525 if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) ) | |
3526 _42ECB5_PlayerAttacksActor(); | |
3527 continue; | |
3528 case UIMSG_ExitRest: | |
3529 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" | |
3530 continue; | |
3531 case UIMSG_Wait5Minutes: | |
3532 if ( dword_506F14 == 2 ) | |
3533 { | |
3534 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
3535 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
3536 continue; | |
3537 } | |
3538 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, | |
3539 (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" | |
3540 dword_506F14 = 1; | |
3541 _506F18_num_minutes_to_sleep = 5; | |
3542 continue; | |
3543 case UIMSG_Wait1Hour: | |
3544 if ( dword_506F14 == 2 ) | |
3545 { | |
3546 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
3547 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
3548 continue; | |
3549 } | |
3550 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, | |
3551 (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" | |
3552 dword_506F14 = 1; | |
3553 _506F18_num_minutes_to_sleep = 60; | |
3554 continue; | |
3555 case UIMSG_RentRoom: | |
3556 dword_506F14 = 2; | |
3557 RestUI_Load(); | |
3558 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; | |
3559 _506F18_num_minutes_to_sleep = v86; | |
3560 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) // 107 = Emerald Isle tavern | |
3561 _506F18_num_minutes_to_sleep = v86 + 12 * 60; | |
3562 dword_506F14 = 2; | |
3563 pParty->RestAndHeal(); | |
3564 pParty->days_played_without_rest = 0; | |
3565 pParty->pPlayers[3].SetAsleep(1); | |
3566 pParty->pPlayers[2].SetAsleep(1); | |
3567 pParty->pPlayers[1].SetAsleep(1); | |
3568 pParty->pPlayers[0].SetAsleep(1); | |
3569 continue; | |
3570 case UIMSG_RestWindow: | |
3571 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3572 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3573 if ( pCurrentScreen ) | |
3574 continue; | |
1936 | 3575 if ( CheckActors_proximity() ) |
1915 | 3576 { |
3577 if ( pParty->bTurnBasedModeOn == 1 ) | |
3578 { | |
3579 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
3580 continue; | |
3581 } | |
3582 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
3583 if ( pParty->uFlags & 0x88 ) | |
3584 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
3585 ShowStatusBarString(v88, 2); | |
3586 if ( !uActiveCharacter ) | |
3587 continue; | |
3588 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); | |
3589 continue; | |
3590 } | |
3591 if ( pParty->bTurnBasedModeOn == 1 ) | |
3592 { | |
3593 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
3594 continue; | |
3595 } | |
3596 if ( !(pParty->uFlags & 0x88) ) | |
3597 { | |
3598 RestUI_Load(); | |
3599 continue; | |
3600 } | |
3601 if ( pParty->bTurnBasedModeOn == 1 ) | |
3602 { | |
3603 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
3604 continue; | |
3605 } | |
3606 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
3607 if ( pParty->uFlags & 0x88 ) | |
3608 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
3609 ShowStatusBarString(v88, 2u); | |
3610 if ( !uActiveCharacter ) | |
3611 continue; | |
3612 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); | |
3613 continue; | |
3614 case UIMSG_Rest8Hour: | |
3615 if ( dword_506F14 ) | |
3616 { | |
3617 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
3618 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
3619 continue; | |
3620 } | |
3621 if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest ) | |
3622 { | |
3623 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest" | |
3624 if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() ) | |
3625 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0); | |
3626 } | |
3627 else | |
3628 { | |
3629 pParty->pPlayers[3].pConditions[2] = pParty->uTimePlayed; | |
3630 pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; | |
3631 pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; | |
3632 pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; | |
3633 v90 = pMapStats->GetMapInfo(pCurrentMapName); | |
3634 if ( !v90 ) | |
3635 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | |
3636 pMapInfo = &pMapStats->pInfos[v90]; | |
3637 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) | |
3638 { | |
3639 v91 = rand() % 100; | |
3640 v92 = pMapInfo->EncM1percent; | |
3641 v93 = v91 + 1; | |
3642 if ( v93 > v92 ) | |
3643 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); | |
3644 else | |
3645 pNPCData4 = (NPCData *)1; | |
3646 if ( !_45063B_spawn_some_monster(pMapInfo, (int)pNPCData4) ) | |
3647 pNPCData4 = 0; | |
3648 if ( pNPCData4 ) | |
3649 { | |
3650 pPlayerNum = rand() % 4; | |
3651 LODWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
3652 HIDWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
3653 v95 = rand(); | |
3654 Rest(v95 % 6 + 60); | |
3655 _506F18_num_minutes_to_sleep = 0; | |
3656 dword_506F14 = 0; | |
3657 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
3658 { | |
3659 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
3660 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
3661 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3662 ++pMessageQueue_50CBD0->uNumMessages; | |
3663 }*/ | |
3664 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
3665 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" | |
3666 pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0); | |
3667 continue; | |
3668 } | |
3669 } | |
3670 Party::TakeFood(uRestUI_FoodRequiredToRest); | |
3671 _506F18_num_minutes_to_sleep = 480; | |
3672 dword_506F14 = 2; | |
3673 pParty->RestAndHeal(); | |
3674 pParty->days_played_without_rest = 0; | |
3675 pParty->pPlayers[3].SetAsleep(1); | |
3676 pParty->pPlayers[2].SetAsleep(1); | |
3677 pParty->pPlayers[1].SetAsleep(1); | |
3678 pParty->pPlayers[0].SetAsleep(1); | |
3679 } | |
3680 continue; | |
3681 case UIMSG_AlreadyResting: | |
3682 if ( dword_506F14 == 2 ) | |
3683 { | |
3684 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
3685 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
3686 continue; | |
3687 } | |
3688 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, | |
3689 (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" | |
3690 v97 = _494820_training_time(pParty->uCurrentHour); | |
3691 dword_506F14 = 1; | |
3692 _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute; | |
3693 continue; | |
3694 case UIMSG_HintSelectRemoveQuickSpellBtn: | |
3695 if ( quick_spell_at_page && byte_506550 ) | |
3696 { | |
3697 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName; | |
3698 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173); | |
3699 } | |
3700 else | |
3701 { | |
3702 if ( pPlayers[uActiveCharacter]->uQuickSpell ) | |
3703 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell" | |
3704 else | |
3705 v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell" | |
3706 strcpy(pTmpBuf.data(), v177); | |
3707 } | |
3708 GameUI_SetFooterString(pTmpBuf.data()); | |
3709 continue; | |
3710 case UIMSG_SPellbook_ShowHightlightedSpellInfo: | |
3711 if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], | |
3712 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) ) | |
3713 continue; | |
3714 if ( sub_4637E0_is_there_popup_onscreen() ) | |
3715 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1; | |
3716 v98 = *(char *)(uNumSeconds + 6734); | |
3717 if ( quick_spell_at_page - 1 == uMessageParam ) | |
3718 { | |
3719 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
3720 v161 = pGlobalTXT_LocalizationStrings[485]; | |
3721 } | |
3722 else | |
3723 { | |
3724 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
3725 v161 = pGlobalTXT_LocalizationStrings[486]; | |
3726 } | |
3727 sprintfex(pTmpBuf.data(), v161, v178); | |
3728 GameUI_SetFooterString(pTmpBuf.data()); | |
3729 continue; | |
3730 case UIMSG_ClickInstallRemoveQuickSpellBtn: | |
3731 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); | |
3732 if ( !uActiveCharacter ) | |
3733 continue; | |
3734 pPlayer10 = pPlayers[uActiveCharacter]; | |
3735 if ( !byte_506550 || !quick_spell_at_page ) | |
3736 { | |
3737 pPlayer10->uQuickSpell = 0; | |
3738 quick_spell_at_page = 0; | |
3739 pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0); | |
3740 continue; | |
3741 } | |
3742 v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; | |
3743 pPlayers[uActiveCharacter]->uQuickSpell = v99; | |
3744 stru_AA1058[uActiveCharacter - 1]._494836(v99, uActiveCharacter); | |
3745 if ( uActiveCharacter ) | |
3746 pPlayer10->PlaySound(SPEECH_12, 0); | |
3747 byte_506550 = 0; | |
3748 continue; | |
3749 case UIMSG_SpellBook_PressTab: | |
3750 //__debugbreak(); | |
3751 if ( !uActiveCharacter ) | |
3752 continue; | |
3753 pPlayer3 = pPlayers[uActiveCharacter]; | |
3754 pNPCData4 = 0; | |
3755 uAction = 0; | |
3756 v101 = 0; | |
3757 thisl = (int)&pPlayer3->pActiveSkills[12]; | |
3758 do | |
3759 { | |
3760 if ( *(short *)thisl ) | |
3761 { | |
3762 if ( pPlayer3->lastOpenedSpellbookPage == v101 ) | |
3763 uAction = (int)pNPCData4; | |
3764 v102 = (int)pNPCData4; | |
3765 pNPCData4 = (NPCData *)((char *)pNPCData4 + 1); | |
3766 v217[v102] = v101; | |
3767 } | |
3768 thisl += 2; | |
3769 ++v101; | |
3770 } | |
3771 while ( v101 < 9 ); | |
3772 if ( !pNPCData4 ) | |
3773 { | |
3774 v127 = rand() % 2 + 204; | |
3775 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); | |
3776 continue; | |
3777 } | |
3778 if ( GetAsyncKeyState(16) ) | |
3779 { | |
3780 --uAction; | |
3781 if ( uAction < 0 ) | |
3782 uAction = (int)((char *)pNPCData4 - 1); | |
3783 } | |
3784 else | |
3785 { | |
3786 ++uAction; | |
3787 if ( uAction >= (signed int)pNPCData4 ) | |
3788 uAction = 0; | |
3789 } | |
3790 OnCloseSpellBookPage(); | |
3791 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); | |
3792 pGUIWindow_CurrentMenu->OpenSpellBook(); | |
3793 v127 = rand() % 2 + 204; | |
3794 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); | |
3795 continue; | |
3796 case UIMSG_OpenSpellbookPage: | |
3797 if ( pTurnEngine->turn_stage == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) | |
3798 continue; | |
3799 OnCloseSpellBookPage(); | |
3800 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; | |
3801 pGUIWindow_CurrentMenu->OpenSpellBook(); | |
3802 v127 = rand() % 2 + 204; | |
3803 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); | |
3804 continue; | |
3805 case UIMSG_SelectSpell: | |
3806 { | |
3807 if (pTurnEngine->turn_stage == 3) | |
3808 continue; | |
3809 if (!uActiveCharacter) | |
3810 continue; | |
3811 | |
3812 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter]; | |
1980 | 3813 Player* player = pPlayers[uActiveCharacter]; |
1915 | 3814 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam]) |
3815 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) ) | |
3816 { | |
3817 if ( quick_spell_at_page - 1 == uMessageParam ) | |
3818 { | |
3819 pGUIWindow_CurrentMenu->Release(); | |
3820 pEventTimer->Resume(); | |
3821 viewparams->bRedrawGameUI = 1; | |
3822 pCurrentScreen = SCREEN_GAME; | |
3823 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
3824 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; | |
3825 /*if ( dword_50C9E8 < 40 ) | |
3826 { | |
3827 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; | |
3828 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; | |
3829 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; | |
3830 ++dword_50C9E8; | |
3831 }*/ | |
3832 pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
3833 // pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
3834 } | |
3835 else | |
3836 { | |
3837 byte_506550 = 1; | |
3838 quick_spell_at_page = uMessageParam + 1; | |
3839 } | |
3840 } | |
3841 } | |
3842 continue; | |
3843 | |
3844 case UIMSG_CastSpellFromBook: | |
3845 if ( pTurnEngine->turn_stage != 3 ) | |
3846 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); | |
3847 continue; | |
3848 | |
3849 case UIMSG_SpellScrollUse: | |
3850 __debugbreak(); | |
3851 if ( pTurnEngine->turn_stage != 3 ) | |
3852 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); | |
3853 continue; | |
3854 case UIMSG_SpellBookWindow: | |
3855 if ( pTurnEngine->turn_stage == 3 ) | |
3856 continue; | |
3857 if ( bUnderwater == 1 ) | |
3858 { | |
3859 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
3860 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
3861 } | |
3862 else | |
3863 { | |
3864 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3865 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3866 if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery ) | |
3867 { | |
3868 if ( !pCurrentScreen ) | |
3869 { | |
3870 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); | |
3871 pCurrentScreen = SCREEN_SPELL_BOOK; | |
3872 pEventTimer->Pause(); | |
3873 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); | |
3874 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); | |
3875 viewparams->field_48 = 1; | |
3876 continue; | |
3877 } | |
3878 if ( pCurrentScreen != SCREEN_REST | |
3879 && pCurrentScreen != SCREEN_CHARACTERS | |
3880 && (pCurrentScreen <= SCREEN_63 | |
3881 || pCurrentScreen > SCREEN_67) ) | |
3882 { | |
3883 pGUIWindow_CurrentMenu->Release(); | |
3884 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); | |
3885 pCurrentScreen = SCREEN_SPELL_BOOK; | |
3886 pEventTimer->Pause(); | |
3887 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); | |
3888 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); | |
3889 viewparams->field_48 = 1; | |
3890 continue; | |
3891 } | |
3892 } | |
3893 } | |
3894 continue; | |
3895 case UIMSG_QuickReference: | |
3896 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3897 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3898 if ( pCurrentScreen ) | |
3899 pGUIWindow_CurrentMenu->Release(); | |
3900 ++pIcons_LOD->uTexturePacksCount; | |
3901 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
3902 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
3903 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0); | |
3904 viewparams->bRedrawGameUI = 1; | |
3905 pEventTimer->Pause(); | |
3906 pAudioPlayer->StopChannels(-1, -1); | |
3907 pCurrentScreen = SCREEN_QUICK_REFERENCE; | |
3908 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); | |
3909 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); | |
3910 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, | |
3911 pGlobalTXT_LocalizationStrings[79],// "Exit" | |
3912 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); | |
3913 continue; | |
3914 case UIMSG_GameMenuButton: | |
3915 if ( pCurrentScreen ) | |
3916 { | |
3917 pGUIWindow_CurrentMenu->Release(); | |
3918 pEventTimer->Resume(); | |
3919 pCurrentScreen = SCREEN_GAME; | |
3920 viewparams->bRedrawGameUI = 1; | |
3921 } | |
3922 stru_506E40.Release(); | |
2128 | 3923 screenshot = MakeScreenshot(155, 117); |
3924 pRenderer->SavePCXImage("gamma.pcx", screenshot, 155, 117); | |
3925 free(screenshot); | |
2131 | 3926 stru_506E40.LoadPCXFile("gamma.pcx", 0); |
1915 | 3927 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0); |
3928 //LABEL_453: | |
3929 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
3930 continue; | |
3931 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
3932 //goto LABEL_770; | |
3933 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
3934 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3935 ++pMessageQueue_50CBD0->uNumMessages;*/ | |
3936 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
3937 continue; | |
3938 case UIMSG_ClickAwardScrollBar: | |
3939 books_page_number = 1; | |
3940 if ( pMouse->GetCursorPos(&v211)->y > 178 ) | |
3941 books_page_number = -1; | |
3942 continue; | |
3943 case UIMSG_ClickAwardsUpBtn: | |
3944 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); | |
3945 BtnUp_flag = 1; | |
3946 continue; | |
3947 case UIMSG_ClickAwardsDownBtn: | |
3948 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); | |
3949 BtnDown_flag = 1; | |
3950 continue; | |
3951 case UIMSG_ChangeDetaliz: | |
3952 bRingsShownInCharScreen ^= 1; | |
3953 pCharacterScreen_DetalizBtn->Release(); | |
3954 pCharacterScreen_DollBtn->Release(); | |
3955 if ( bRingsShownInCharScreen ) | |
3956 { | |
3957 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; | |
3958 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; | |
3959 v123 = 445; | |
3960 v121 = 470; | |
3961 } | |
3962 else | |
3963 { | |
3964 v128 = 30; | |
3965 v125 = 30; | |
3966 v123 = 300; | |
3967 v121 = 600; | |
3968 } | |
3969 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, | |
3970 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" | |
3971 0); | |
3972 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); | |
3973 viewparams->bRedrawGameUI = 1; | |
3974 continue; | |
3975 case UIMSG_ClickPaperdoll: | |
3976 OnPaperdollLeftClick(); | |
3977 continue; | |
3978 case UIMSG_ClickStatsBtn: | |
3979 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; | |
3980 CharacterUI_ReleaseButtons(); | |
3981 ReleaseAwardsScrollBar(); | |
3982 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); | |
3983 continue; | |
3984 case UIMSG_ClickSkillsBtn: | |
3985 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; | |
3986 CharacterUI_ReleaseButtons(); | |
3987 ReleaseAwardsScrollBar(); | |
3988 CharacterUI_SkillsTab_CreateButtons(); | |
3989 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); | |
3990 continue; | |
3991 case UIMSG_SkillUp: | |
3992 pPlayer4 = pPlayers[uActiveCharacter]; | |
3993 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; | |
3994 LOWORD(v2) = *(short *)v105; | |
3995 uNumSeconds = v2; | |
3996 if ( pPlayer4->uSkillPoints < (v2 & 0x3F) + 1 ) | |
3997 { | |
3998 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!" | |
3999 } | |
4000 else | |
4001 { | |
4002 if ( (uNumSeconds & 0x3F) < 0x3C ) | |
4003 { | |
4004 *(short *)v105 = uNumSeconds + 1; | |
4005 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; | |
4006 pPlayer4->PlaySound(SPEECH_14, 0); | |
4007 pAudioPlayer->PlaySound((SoundID)20001, 0, 0, -1, 0, 0, 0, 0); | |
4008 continue; | |
4009 } | |
4010 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" | |
4011 } | |
4012 ShowStatusBarString(v87, 2); | |
4013 continue; | |
4014 case UIMSG_ClickInventoryBtn: | |
4015 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
4016 ReleaseAwardsScrollBar(); | |
4017 CharacterUI_ReleaseButtons(); | |
4018 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); | |
4019 continue; | |
4020 case UIMSG_ClickExitCharacterWindowBtn: | |
4021 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); | |
4022 continue; | |
4023 case UIMSG_ClickAwardsBtn: | |
4024 ReleaseAwardsScrollBar(); | |
4025 CharacterUI_ReleaseButtons(); | |
4026 CreateAwardsScrollBar(); | |
4027 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; | |
4028 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); | |
4029 FillAwardsData(); | |
4030 continue; | |
4031 case UIMSG_ClickBooksBtn: | |
4032 switch ( uMessageParam ) | |
4033 { | |
4034 case 11://Page UP | |
4035 BtnUp_flag = 1; | |
4036 pButton = pBtn_Book_2; | |
4037 break; | |
4038 case 10://Page DOWN | |
4039 BtnDown_flag = 1; | |
4040 pButton = pBtn_Book_1; | |
4041 break; | |
4042 case 0://Zoom plus | |
4043 pButton = pBtn_Book_1; | |
4044 BtnDown_flag = 1; | |
4045 break; | |
4046 case 1://Zoom minus | |
4047 pButton = pBtn_Book_2; | |
4048 BtnUp_flag = 1; | |
4049 break; | |
4050 case 2://Potions | |
4051 Book_PageBtn3_flag = 1; | |
4052 if ( dword_506364 ) | |
4053 continue; | |
4054 pButton = pBtn_Book_3; | |
4055 break; | |
4056 case 3://fountains | |
4057 Book_PageBtn4_flag = 1; | |
4058 if ( dword_506364 ) | |
4059 continue; | |
4060 pButton = pBtn_Book_4; | |
4061 break; | |
4062 case 4://obelisks | |
4063 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag | |
4064 if ( dword_506364 ) | |
4065 continue; | |
4066 pButton = pBtn_Book_5; | |
4067 break; | |
4068 case 5://seer | |
4069 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag | |
4070 if ( dword_506364 ) | |
4071 continue; | |
4072 pButton = pBtn_Book_6; | |
4073 break; | |
4074 case 6://misc | |
4075 pButton = pBtn_Autonotes_Misc; | |
4076 Autonotes_Misc_page_flag = 1; | |
4077 break; | |
4078 case 7://Instructors | |
4079 pButton = pBtn_Autonotes_Instructors; | |
4080 Autonotes_Instructors_page_flag = 1; | |
4081 break; | |
4082 default: | |
4083 continue; | |
4084 } | |
4085 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); | |
4086 continue; | |
4087 case UIMSG_SelectCharacter: | |
4088 if ( pMessageQueue_50CBD0->uNumMessages ) | |
4089 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
4090 GameUI_OnPlayerPortraitLeftClick(uMessageParam); | |
4091 continue; | |
4092 case UIMSG_ShowStatus_Funds: | |
4093 v174 = (char *)pParty->uNumGoldInBank; | |
4094 //v158 = pParty->uNumGold + pParty->uNumGoldInBank; | |
4095 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], pParty->uNumGold + pParty->uNumGoldInBank, v174);// "You have %d total gold, %d in the Bank" | |
4096 GameUI_SetFooterString(pTmpBuf.data()); | |
4097 continue; | |
4098 case UIMSG_ShowStatus_DateTime: | |
4099 pNPCData4 = (NPCData *)pParty->uCurrentHour; | |
4100 if ( (signed int)pParty->uCurrentHour <= 12 ) | |
4101 { | |
4102 if ( !pNPCData4 ) | |
4103 pNPCData4 = (NPCData *)12; | |
4104 } | |
4105 else | |
4106 { | |
4107 pNPCData4 = (NPCData *)((char *)pNPCData4 - 12); | |
4108 } | |
4109 if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) ) | |
4110 uNumSeconds = 0; | |
4111 sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], | |
4112 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear); | |
4113 GameUI_SetFooterString(pTmpBuf.data()); | |
4114 continue; | |
4115 case UIMSG_ShowStatus_Food: | |
4116 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food" | |
4117 GameUI_SetFooterString(pTmpBuf.data()); | |
4118 continue; | |
4119 case UIMSG_ShowStatus_Player: | |
4120 pPlayer5 = pPlayers[uMessageParam]; | |
4121 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s" | |
4122 strcat(pTmpBuf.data(), ": "); | |
4123 v107 = pPlayer5->GetMajorConditionIdx(); | |
4124 strcat(pTmpBuf.data(), aCharacterConditionNames[v107]); | |
4125 GameUI_SetFooterString(pTmpBuf.data()); | |
4126 v108 = 8 * uMessageParam - 8; | |
4127 LOBYTE(v108) = v108 | 4; | |
4128 pMouse->uPointingObjectID = PID(OBJECT_Player,v108); | |
4129 continue; | |
4130 case UIMSG_ShowStatus_ManaHP: | |
4131 sprintf(pTmpBuf.data(), "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), | |
4132 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), | |
4133 pGlobalTXT_LocalizationStrings[212]); | |
4134 GameUI_SetFooterString(pTmpBuf.data()); | |
4135 continue; | |
4136 case UIMSG_CHEST_ClickItem: | |
4137 if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) | |
4138 { | |
4139 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); | |
4140 continue; | |
4141 } | |
4142 OnChestLeftClick(); | |
4143 continue; | |
4144 case UIMSG_InventoryLeftClick: | |
4145 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); | |
4146 continue; | |
4147 case UIMSG_MouseLeftClickInGame: | |
4148 if ( !pRenderer->pRenderD3D ) | |
4149 { | |
4150 if ( pMessageQueue_50CBD0->uNumMessages ) | |
4151 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
4152 OnGameViewportClick(); | |
4153 continue; | |
4154 } | |
4155 v115 = pMessageQueue_50CBD0->uNumMessages; | |
4156 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
4157 { | |
4158 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
4159 /*if ( (signed int)v115 < 40 ) | |
4160 //goto LABEL_769; | |
4161 { | |
4162 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
4163 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
4164 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
4165 ++pMessageQueue_50CBD0->uNumMessages; | |
4166 continue; | |
4167 }*/ | |
4168 continue; | |
4169 } | |
4170 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) | |
4171 { | |
4172 pMessageQueue_50CBD0->uNumMessages = 1; | |
4173 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
4174 /*v115 = v0; | |
4175 pMessageQueue_50CBD0->uNumMessages = v0; | |
4176 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
4177 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
4178 //goto LABEL_771; | |
4179 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
4180 ++pMessageQueue_50CBD0->uNumMessages;*/ | |
4181 continue; | |
4182 } | |
4183 v115 = 0; | |
4184 pMessageQueue_50CBD0->uNumMessages = 0; | |
4185 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); | |
4186 /*if ( (signed int)v115 < 40 ) | |
4187 //goto LABEL_769; | |
4188 { | |
4189 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; | |
4190 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
4191 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
4192 ++pMessageQueue_50CBD0->uNumMessages; | |
4193 continue; | |
4194 }*/ | |
4195 continue; | |
4196 case UIMSG_MouseLeftClickInScreen://ñðàáàòûâàåò ïðè íàæàòèè íà ïðàâóþ êíîïêó ìûøè ïîñëå UIMSG_MouseLeftClickInGame | |
4197 if ( pMessageQueue_50CBD0->uNumMessages ) | |
4198 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
4199 OnGameViewportClick(); | |
4200 continue; | |
4201 case UIMSG_F: | |
4202 __debugbreak(); | |
4203 if ( pRenderer->pRenderD3D ) | |
4204 { | |
4205 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
4206 } | |
4207 else | |
4208 { | |
4209 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); | |
4210 pPoint3 = pMouse->GetCursorPos(&v204); | |
4211 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; | |
4212 } | |
4213 pButton2 = (GUIButton *)(unsigned __int16)v116; | |
4214 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); | |
4215 continue; | |
4216 case UIMSG_54: | |
4217 __debugbreak(); | |
4218 pButton2 = (GUIButton *)uMessageParam; | |
4219 GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); | |
4220 continue; | |
4221 case UIMSG_Game_Action: | |
4222 if ( pMessageQueue_50CBD0->uNumMessages ) | |
4223 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
4224 OnPressSpace(); | |
4225 continue; | |
4226 case UIMSG_ClickZoomOutBtn: | |
4227 if ( pCurrentScreen ) | |
4228 continue; | |
4229 pParty->uFlags |= 2u; | |
4230 GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0); | |
4231 uNumSeconds = 131072; | |
4232 v118 = 2 * viewparams->uMinimapZoom; | |
4233 ++viewparams->field_28; | |
4234 viewparams->uMinimapZoom *= 2; | |
4235 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
4236 { | |
4237 if ( (signed int)v118 > 4096 ) | |
4238 { | |
4239 viewparams->uMinimapZoom = 4096; | |
4240 viewparams->field_28 = 12; | |
4241 } | |
4242 continue; | |
4243 } | |
4244 v119 = 2048; | |
4245 if ( (signed int)v118 <= 2048 ) | |
4246 { | |
4247 _576E2C_current_minimap_zoom = v118; | |
4248 dword_576E28 = viewparams->field_28; | |
4249 break; | |
4250 } | |
4251 viewparams->field_28 = 11; | |
4252 viewparams->uMinimapZoom = v119; | |
4253 _576E2C_current_minimap_zoom = v119; | |
4254 dword_576E28 = viewparams->field_28; | |
4255 break; | |
4256 case UIMSG_ClickZoomInBtn: | |
4257 if ( pCurrentScreen ) | |
4258 continue; | |
4259 pParty->uFlags |= 2u; | |
4260 GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0); | |
4261 uNumSeconds = 32768; | |
4262 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
4263 --viewparams->field_28; | |
4264 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
4265 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4266 { | |
4267 v119 = 512; | |
4268 if ( (signed int)v118 < 512 ) | |
4269 { | |
4270 viewparams->field_28 = 9; | |
4271 v118 = v119; | |
4272 viewparams->uMinimapZoom = v119; | |
4273 } | |
4274 _576E2C_current_minimap_zoom = v118; | |
4275 dword_576E28 = viewparams->field_28; | |
4276 } | |
4277 else | |
4278 { | |
4279 if ( (signed int)v118 < 256 ) | |
4280 { | |
4281 viewparams->uMinimapZoom = 256; | |
4282 viewparams->field_28 = 8; | |
4283 } | |
4284 } | |
4285 default: | |
4286 continue; | |
4287 } | |
4288 } | |
4289 } | |
4290 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8; | |
4291 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages); | |
4292 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); | |
4293 //dword_50C9E8 = 0; | |
4294 | |
4295 | |
4296 pMessageQueue_50C9E8->uNumMessages=0; | |
4297 if ( dword_50C9DC ) | |
4298 { | |
4299 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
4300 { | |
4301 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; | |
4302 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0; | |
4303 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
4304 ++pMessageQueue_50CBD0->uNumMessages; | |
4305 }*/ | |
4306 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); | |
4307 dword_50C9DC = 0; | |
4308 } | |
4309 else | |
4310 { | |
4311 if ( _50C9D0_AfterEnchClickEventId > 0 ) | |
4312 { | |
4313 _50C9D8_AfterEnchClickEventTimeout -= pEventTimer->uTimeElapsed; | |
4314 if ( _50C9D8_AfterEnchClickEventTimeout <= 0 ) | |
4315 { | |
4316 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
4317 { | |
4318 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0; | |
4319 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4; | |
4320 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
4321 ++pMessageQueue_50CBD0->uNumMessages; | |
4322 }*/ | |
4323 pMessageQueue_50CBD0->AddMessage((UIMessageType)_50C9D0_AfterEnchClickEventId, _50C9D4_AfterEnchClickEventSecondParam, 0); | |
4324 _50C9D0_AfterEnchClickEventId = 0; | |
4325 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
4326 _50C9D8_AfterEnchClickEventTimeout = 0; | |
4327 } | |
4328 } | |
4329 } | |
4330 CastSpellInfoHelpers::_427E01_cast_spell(); | |
4331 } | |
4332 //----- (00435748) -------------------------------------------------------- | |
4333 void GUI_MainMenuMessageProc() | |
4334 { | |
4335 Player *pPlayer; // ebx@2 | |
4336 void *v3; // edi@21 | |
4337 signed int v4; // eax@29 | |
4338 int v5; // ecx@29 | |
4339 PLAYER_SKILL_TYPE v6; // edi@37 | |
4340 GUIWindow *pWindow; // eax@56 | |
4341 GUIButton *pButton; // eax@59 | |
4342 int v15; // edi@70 | |
4343 char v20; // dl@116 | |
4344 unsigned int v21; // eax@116 | |
4345 unsigned int v25; // eax@120 | |
4346 unsigned int v26; // ecx@127 | |
4347 SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36 | |
4348 signed int v41; // [sp-10h] [bp-20h]@29 | |
4349 int pParam; // [sp+4h] [bp-Ch]@3 | |
4350 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 | |
4351 int pSex; // [sp+Ch] [bp-4h]@3 | |
4352 | |
4353 if ( pMessageQueue_50CBD0->uNumMessages ) | |
4354 { | |
4355 pPlayer = pParty->pPlayers.data(); | |
4356 do | |
4357 { | |
4358 int param2; | |
4359 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, ¶m2); | |
1916 | 4360 //auto player = &pParty->pPlayers[pParam]; |
1915 | 4361 |
4362 switch (pUIMessageType) // For buttons of window MainMenu | |
4363 { | |
4364 case UIMSG_MainMenu_ShowPartyCreationWnd: | |
4365 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); | |
4366 SetCurrentMenuID(MENU_NEWGAME); | |
4367 break; | |
4368 case UIMSG_MainMenu_ShowLoadWindow: | |
4369 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0); | |
4370 SetCurrentMenuID(MENU_SAVELOAD); | |
4371 break; | |
4372 case UIMSG_ShowCredits: | |
4373 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0); | |
4374 SetCurrentMenuID(MENU_CREDITS); | |
4375 break; | |
4376 case UIMSG_ExitToWindows: | |
4377 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); | |
4378 SetCurrentMenuID(MENU_EXIT_GAME); | |
4379 break; | |
4380 case UIMSG_PlayerCreation_SelectAttribute: | |
4381 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | |
4382 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | |
4383 uPlayerCreationUI_SelectedCharacter = pParam; | |
4384 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); | |
4385 break; | |
4386 case UIMSG_PlayerCreation_VoicePrev: | |
1916 | 4387 pSex = pParty->pPlayers[pParam].GetSexByVoice(); |
1915 | 4388 do |
4389 { | |
1916 | 4390 if (pParty->pPlayers[pParam].uVoiceID == 0) |
4391 pParty->pPlayers[pParam].uVoiceID = 19; | |
4392 else --pParty->pPlayers[pParam].uVoiceID; | |
1915 | 4393 } |
1916 | 4394 while (pParty->pPlayers[pParam].GetSexByVoice() != pSex); |
1915 | 4395 pButton = pCreationUI_BtnPressLeft2[pParam]; |
4396 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); | |
4397 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); | |
1916 | 4398 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); |
1915 | 4399 break; |
4400 case UIMSG_PlayerCreation_VoiceNext: | |
1916 | 4401 pSex = pParty->pPlayers[pParam].GetSexByVoice(); |
1915 | 4402 do |
4403 { | |
1916 | 4404 pParty->pPlayers[pParam].uVoiceID = (pParty->pPlayers[pParam].uVoiceID + 1) % 20; |
1915 | 4405 } |
1916 | 4406 while (pParty->pPlayers[pParam].GetSexByVoice() != pSex); |
1915 | 4407 pButton = pCreationUI_BtnPressRight2[pParam]; |
4408 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); | |
4409 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); | |
1916 | 4410 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); |
1915 | 4411 break; |
4412 case UIMSG_PlayerCreation_FacePrev: | |
1916 | 4413 //pPlayer = &pParty->pPlayers[pParam]; |
4414 if (!pParty->pPlayers[pParam].uCurrentFace) | |
4415 pParty->pPlayers[pParam].uCurrentFace = 19; | |
1915 | 4416 else |
1916 | 4417 pParty->pPlayers[pParam].uCurrentFace -= 1; |
4418 pParty->pPlayers[pParam].uVoiceID = pParty->pPlayers[pParam].uCurrentFace; | |
4419 pParty->pPlayers[pParam].SetInitialStats(); | |
4420 pParty->pPlayers[pParam].SetSexByVoice(); | |
4421 pParty->pPlayers[pParam].RandomizeName(); | |
1915 | 4422 v25 = pParam; |
4423 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | |
4424 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | |
4425 uPlayerCreationUI_SelectedCharacter = v25; | |
4426 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], (char *)1); | |
4427 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); | |
1916 | 4428 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); |
1915 | 4429 break; |
4430 case UIMSG_PlayerCreation_FaceNext: | |
1916 | 4431 //pPlayer = &pParty->pPlayers[pParam]; |
4432 v20 = (char)((int)pParty->pPlayers[pParam].uCurrentFace + 1) % 20; | |
4433 pParty->pPlayers[pParam].uCurrentFace = v20; | |
4434 pParty->pPlayers[pParam].uVoiceID = v20; | |
4435 pParty->pPlayers[pParam].SetInitialStats(); | |
4436 pParty->pPlayers[pParam].SetSexByVoice(); | |
4437 pParty->pPlayers[pParam].RandomizeName(); | |
1915 | 4438 v21 = pParam; |
4439 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | |
4440 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | |
4441 uPlayerCreationUI_SelectedCharacter = v21; | |
4442 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], (char *)1); | |
4443 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); | |
1916 | 4444 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); |
1915 | 4445 break; |
4446 case UIMSG_PlayerCreationClickPlus: | |
4447 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, (char *)1); | |
4448 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); | |
4449 pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); | |
4450 break; | |
4451 case UIMSG_PlayerCreationClickMinus: | |
4452 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, (char *)1); | |
4453 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); | |
4454 pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); | |
4455 break; | |
4456 case UIMSG_PlayerCreationSelectActiveSkill: | |
4457 if ( pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37 ) | |
4458 pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pParam + 4)] = 1; | |
4459 pAudioPlayer->PlaySound(SOUND_24, 0, 0, -1, 0, 0, 0, 0); | |
4460 break; | |
4461 case UIMSG_PlayerCreationSelectClass: | |
4462 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); | |
4463 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); | |
4464 break; | |
4465 case UIMSG_PlayerCreationClickOK: | |
4466 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); | |
4467 if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills() ) | |
4468 GameUI_Footer_TimeLeft = GetTickCount() + 4000; | |
4469 else | |
4470 uGameState = GAME_STATE_STARTING_NEW_GAME; | |
4471 break; | |
4472 case UIMSG_PlayerCreationClickReset: | |
4473 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); | |
4474 pParty->Reset(); | |
4475 break; | |
4476 case UIMSG_PlayerCreationRemoveUpSkill: | |
4477 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
4478 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
|
4479 if ( pPlayer[pParam].GetSkillIdxByOrder(2) != 37 )//37 - None(Íåò) |
18b0ff5e1bf1
pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Ðет)
Ritor1
parents:
2101
diff
changeset
|
4480 pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(2)] = 0; |
1915 | 4481 break; |
4482 case UIMSG_PlayerCreationRemoveDownSkill: | |
4483 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
4484 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
|
4485 if ( pPlayer[pParam].GetSkillIdxByOrder(3) != 37 )//37 - None(Íåò) |
18b0ff5e1bf1
pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Ðет)
Ritor1
parents:
2101
diff
changeset
|
4486 pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(3)] = 0; |
1915 | 4487 break; |
4488 case UIMSG_PlayerCreationChangeName: | |
4489 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
4490 v3 = (void *)pParam; | |
4491 uPlayerCreationUI_SelectedCharacter = pParam; | |
4492 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); | |
4493 pGUIWindow_CurrentMenu->ptr_1C = v3; | |
4494 break; | |
4495 case UIMSG_ChangeGameState: | |
4496 uGameState = GAME_FINISHED; | |
4497 break; | |
4498 case UIMSG_ChangeCursor: | |
4499 pMouse->SetCursorBitmap("MICON2"); | |
4500 break; | |
4501 case UIMSG_3A: | |
4502 SetCurrentMenuID(MENU_DebugBLVLevel); | |
4503 break; | |
4504 case UIMSG_LoadGame: | |
4505 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) | |
4506 break; | |
4507 SetCurrentMenuID(MENU_LoadingProcInMainMenu); | |
4508 break; | |
4509 case UIMSG_SelectLoadSlot: | |
4510 //main menu save/load wnd clicking on savegame lines | |
4511 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
4512 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
4513 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) | |
4514 { | |
4515 //load clicked line | |
4516 v26 = pParam + pSaveListPosition; | |
4517 if ( dword_6BE138 == pParam + pSaveListPosition ) | |
4518 { | |
4519 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); | |
4520 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); | |
4521 } | |
4522 uLoadGameUI_SelectedSlot = v26; | |
4523 dword_6BE138 = v26; | |
4524 } | |
4525 else | |
4526 { | |
4527 //typing in the line | |
4528 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); | |
4529 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); | |
4530 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); | |
4531 } | |
4532 break; | |
4533 case UIMSG_SaveLoadBtn: | |
4534 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
4535 break; | |
4536 case UIMSG_DownArrow: | |
4537 ++pSaveListPosition; | |
4538 if ( pSaveListPosition >= pParam ) | |
4539 pSaveListPosition = pParam - 1; | |
4540 if ( pSaveListPosition < 1 ) | |
4541 pSaveListPosition = 0; | |
4542 pWindow = pGUIWindow_CurrentMenu; | |
4543 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); | |
4544 break; | |
4545 case UIMSG_Cancel: | |
4546 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0); | |
4547 break; | |
4548 case UIMSG_ArrowUp: | |
4549 --pSaveListPosition; | |
4550 if ( pSaveListPosition < 0 ) | |
4551 pSaveListPosition = 0; | |
4552 pWindow = pGUIWindow_CurrentMenu; | |
4553 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); | |
4554 break; | |
4555 case UIMSG_AD: | |
4556 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); | |
4557 SetCurrentMenuID(MENU_LoadingProcInMainMenu); | |
4558 break; | |
4559 case UIMSG_AE: | |
4560 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); | |
4561 SetCurrentMenuID(MENU_DebugBLVLevel); | |
4562 break; | |
4563 case UIMSG_Escape: | |
4564 if ( pModalWindow ) | |
4565 { | |
4566 ModalWindow_Release(); | |
4567 break; | |
4568 } | |
2061 | 4569 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_4000)) |
1915 | 4570 break; |
4571 v15 = 1; | |
4572 pVideoPlayer->bStopBeforeSchedule = 1; | |
4573 viewparams->bRedrawGameUI = 1; | |
4574 viewparams->field_48 = 1; | |
4575 if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) | |
4576 { | |
4577 if ( pCurrentScreen == SCREEN_VIDEO ) | |
4578 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
4579 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
4580 { | |
4581 SetCurrentMenuID(MENU_CREATEPARTY); | |
4582 break; | |
4583 } | |
4584 if (GetCurrentMenuID() == MENU_CREDITSPROC) | |
4585 { | |
4586 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
4587 break; | |
4588 } | |
4589 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); | |
4590 break; | |
4591 } | |
4592 if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen ) | |
4593 { | |
4594 if ( pCurrentScreen == SCREEN_VIDEO ) | |
4595 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
4596 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
4597 { | |
4598 SetCurrentMenuID(MENU_CREATEPARTY); | |
4599 break; | |
4600 } | |
4601 if (GetCurrentMenuID() == MENU_CREDITSPROC) | |
4602 { | |
4603 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
4604 break; | |
4605 } | |
4606 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); | |
4607 break; | |
4608 } | |
4609 if ( pCurrentScreen == SCREEN_LOADGAME ) | |
4610 { | |
4611 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
4612 //crt_deconstruct_ptr_6A0118(); | |
4613 pTexture_PCX.Release(); | |
4614 pTexture_PCX.Load("title.pcx", 0); | |
4615 SetCurrentMenuID(MENU_MAIN); | |
4616 v15 = 1; | |
4617 pGUIWindow_CurrentMenu->Release(); | |
4618 pGUIWindow2->Release(); | |
4619 pGUIWindow2 = 0; | |
4620 pEventTimer->Resume(); | |
4621 pCurrentScreen = SCREEN_GAME; | |
4622 viewparams->bRedrawGameUI = v15; | |
4623 break; | |
4624 } | |
4625 if ( pCurrentScreen == SCREEN_VIDEO ) | |
4626 { | |
4627 pVideoPlayer->Unload(); | |
4628 } | |
4629 else | |
4630 { | |
4631 if ( pCurrentScreen != SCREEN_1B ) | |
4632 { | |
4633 pGUIWindow_CurrentMenu->Release(); | |
4634 pGUIWindow2->Release(); | |
4635 pGUIWindow2 = 0; | |
4636 pEventTimer->Resume(); | |
4637 pCurrentScreen = SCREEN_GAME; | |
4638 viewparams->bRedrawGameUI = v15; | |
4639 break; | |
4640 } | |
4641 //VideoPlayer::dtor(); | |
4642 } | |
4643 break; | |
4644 default: | |
4645 break; | |
4646 } | |
4647 } | |
4648 while ( pMessageQueue_50CBD0->uNumMessages ); | |
4649 } | |
0 | 4650 } |