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