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