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