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