137
|
1 #include <assert.h>
|
|
2
|
0
|
3 #include "Game.h"
|
|
4 #include "Party.h"
|
|
5 #include "IndoorCamera.h"
|
|
6 #include "Math.h"
|
|
7 #include "LightmapBuilder.h"
|
|
8 #include "Viewport.h"
|
|
9 #include "Time.h"
|
|
10 #include "Outdoor.h"
|
|
11 #include "Overlays.h"
|
|
12 #include "stru279.h"
|
|
13 #include "AudioPlayer.h"
|
|
14 #include "LOD.h"
|
|
15 #include "OSInfo.h"
|
|
16 #include "GUIWindow.h"
|
|
17 #include "Party.h"
|
|
18 #include "TurnEngine.h"
|
|
19 #include "stru157.h"
|
|
20 #include "VideoPlayer.h"
|
|
21 #include "Bink_Smacker.h"
|
|
22 #include "Events.h"
|
|
23 #include "Arcomage.h"
|
|
24
|
|
25 //#include "MM7.h"
|
|
26
|
|
27
|
|
28
|
|
29
|
|
30
|
|
31
|
|
32 Game *pGame;
|
|
33
|
|
34
|
|
35
|
|
36
|
|
37
|
|
38 //----- (00435694) --------------------------------------------------------
|
|
39 void Game::ToggleFlags2(unsigned int uFlag)
|
|
40 {
|
|
41 unsigned int v2; // eax@1
|
|
42
|
|
43 v2 = this->uFlags2;
|
|
44 if ( v2 & uFlag )
|
|
45 this->uFlags2 = v2 & ~uFlag;
|
|
46 else
|
|
47 this->uFlags2 = uFlag | v2;
|
|
48 }
|
|
49
|
|
50 //----- (0044103C) --------------------------------------------------------
|
|
51 void Game::Draw()
|
|
52 {
|
142
|
53 //float v2; // ST24_4@11
|
0
|
54 //double v3; // ST28_8@11
|
|
55 int v4; // edi@26
|
142
|
56 //int v5; // eax@35
|
0
|
57
|
|
58 uFlags2 &= 0xFFFFFFFDu;
|
|
59 if ( pParty->_497FC5_check_party_perception_against_level() )
|
|
60 uFlags2 |= 2u;
|
|
61 pIndoorCamera->sRotationX = pParty->sRotationX;
|
|
62 pIndoorCamera->sRotationY = pParty->sRotationY;
|
120
|
63 //pIndoorCamera->pos.x = pParty->vPosition.x - ((__int64)pParty->y_rotation_granularity * stru_5C6E00->SinCos(pIndoorCamera->sRotationY)) / 2048.0;//12552
|
|
64 //pIndoorCamera->pos.y = pParty->vPosition.y - ((__int64)pParty->y_rotation_granularity * stru_5C6E00->SinCos(pIndoorCamera->sRotationY)) / 2048.0;//800
|
|
65 pIndoorCamera->pos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * 3.141592653589 * pIndoorCamera->sRotationY / 2048.0);
|
|
66 pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * 3.141592653589 * pIndoorCamera->sRotationY / 2048.0);
|
66
|
67 pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353
|
0
|
68 pIndoorCamera->Initialize2();
|
|
69 pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff();
|
|
70 pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum();
|
|
71
|
|
72 if ( pVideoPlayer->AnyMovieLoaded() )
|
|
73 {
|
|
74 if ( pRenderer->pRenderD3D )
|
|
75 goto LABEL_22;
|
|
76 pRenderer->BeginSceneD3D();
|
|
77 pMouse->DrawCursorToTarget();
|
|
78 }
|
|
79 else
|
|
80 {
|
78
|
81 if ( pParty->vPosition.x != pParty->vPrevPosition.x | pParty->sRotationY != pParty->sPrevRotationY | pParty->vPosition.y != pParty->vPrevPosition.y
|
101
|
82 | pParty->sRotationX != pParty->sPrevRotationX | pParty->vPosition.z != pParty->vPrevPosition.z | pParty->sEyelevel != pParty->sPrevEyelevel )
|
0
|
83 pParty->uFlags |= 2u;
|
78
|
84 pParty->vPrevPosition = pParty->vPosition;
|
|
85 pParty->vPrevPosition.y = pParty->vPosition.y;
|
0
|
86 //v0 = &pRenderer;
|
|
87 pParty->sPrevRotationY = pParty->sRotationY;
|
78
|
88 pParty->vPrevPosition.z = pParty->vPosition.z;
|
0
|
89 pParty->sPrevRotationX = pParty->sRotationX;
|
|
90 pParty->sPrevEyelevel = pParty->sEyelevel;
|
|
91 pRenderer->BeginSceneD3D();
|
|
92
|
|
93 if ( !pRenderer->pRenderD3D )
|
|
94 pMouse->DrawCursorToTarget();
|
|
95 if ( !sub_4226C2() || viewparams->field_48 == 1 )
|
|
96 {
|
|
97 if ( pRenderer->pRenderD3D )
|
|
98 {
|
142
|
99 float v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0;
|
0
|
100 //v3 = v2 + 6.7553994e15;
|
|
101 //pRenderer->field_1036A8_bitmapid = LODWORD(v3);
|
|
102 pRenderer->field_1036A8_bitmapid = floorf(v2 + 0.5f);
|
|
103 }
|
|
104
|
|
105 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
106 pIndoor->Draw();
|
|
107 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
108 pOutdoor->Draw();
|
137
|
109 else assert(false);
|
0
|
110
|
|
111 if (pRenderer->pRenderD3D)
|
|
112 {
|
|
113 pDecalBuilder->DrawBloodsplats();
|
|
114 if (pRenderer->pRenderD3D)
|
|
115 pGame->pLightmapBuilder->DrawLightmaps(2);
|
|
116 }
|
|
117 }
|
|
118 }
|
|
119 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
|
|
120 LABEL_22:
|
|
121 pRenderer->BeginScene();
|
|
122 if (pRenderer->pRenderD3D)
|
|
123 pMouse->DrawCursorToTarget();
|
142
|
124 if (pOtherOverlayList->bRedraw)
|
|
125 viewparams->bRedrawGameUI = true;
|
0
|
126 v4 = viewparams->bRedrawGameUI;
|
|
127 GameUI_DrawStatusBar();
|
|
128 if (!viewparams->bRedrawGameUI)
|
|
129 {
|
|
130 GameUI_DrawRightPanelItems();
|
|
131 }
|
|
132 else
|
|
133 {
|
|
134 GameUI_DrawRightPanelFrames();
|
|
135 GameUI_DrawStatusBar_2();
|
|
136 viewparams->bRedrawGameUI = false;
|
|
137 }
|
|
138 if (!pVideoPlayer->pSmackerMovie)
|
|
139 {
|
|
140 GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, pParty->uFlags & 2);
|
|
141 if (v4)
|
|
142 {
|
142
|
143 if ( !sub_4226C2() && pRenderer->pRenderD3D) // clear game viewport with transparent color
|
0
|
144 pRenderer->FillRectFast(pViewport->uViewportX, pViewport->uViewportY, pViewport->uViewportZ - pViewport->uViewportX,
|
142
|
145 pViewport->uViewportW - pViewport->uViewportY + 1,
|
|
146 pRenderer->uTargetGMask | pRenderer->uTargetBMask);
|
0
|
147 viewparams->field_48 = 0;
|
|
148 }
|
|
149 }
|
142
|
150
|
|
151 viewparams->bRedrawGameUI = pOtherOverlayList->bRedraw;
|
|
152 pOtherOverlayList->bRedraw = 0;
|
|
153
|
0
|
154 GameUI_DrawPartySpells();
|
134
|
155 if (v4 || pParty->pHirelings[0]._anim_end_time || pParty->pHirelings[1]._anim_end_time )
|
|
156 DrawHiredNPCs();
|
0
|
157 GameUI_DrawPortraits(v4);
|
|
158 GameUI_DrawLifeManaBars();
|
|
159 GameUI_DrawCharacterSelectionFrame();
|
|
160 if ( sub_44100D() )
|
|
161 draw_right_panel();
|
|
162 if ( !pVideoPlayer->AnyMovieLoaded() )
|
|
163 {
|
|
164 pStru6Instance->DrawPlayerBuffAnims();
|
|
165 pOtherOverlayList->_441964(v4);
|
|
166 GameUI_DrawTorchlightAndWizardEye();
|
|
167 }
|
|
168 GUI_UpdateWindows();
|
130
|
169 pParty->UpdatePlayersAndHirelingsEmotions();
|
0
|
170 ++stru_51076C.field_8;
|
|
171 dword_5B5924 = 0;
|
|
172 if (v4)
|
|
173 pMouse->field_14 = 1;
|
|
174 pMouse->_469EA4();
|
|
175 pMouse->DrawCursor();
|
|
176 pMouse->_469E1C();
|
|
177 pRenderer->EndScene();
|
|
178 pRenderer->Present();
|
|
179 pParty->uFlags &= 0xFFFFFFFDu;
|
|
180 }
|
|
181
|
|
182
|
|
183 //----- (0047A815) --------------------------------------------------------
|
|
184 void Game::DrawParticles()
|
|
185 {
|
|
186 pParticleEngine->Draw();
|
|
187 }
|
|
188
|
|
189 //----- (00463149) --------------------------------------------------------
|
|
190 void Game::Loop()
|
|
191 {
|
|
192 //signed int v0; // ebp@3
|
|
193 //signed int v1; // esi@4
|
|
194 //Render *v2; // edi@7
|
|
195 //signed int v3; // esi@7
|
|
196 signed int pNewNPCsCount; // ecx@58
|
|
197 char *pFlags; // eax@59
|
|
198 Player *pPlayer; // esi@65
|
|
199 OtherOverlay *pOtherOverlay; // esi@67
|
|
200 signed int v8; // edi@67
|
|
201 int pPlayerNum; // edi@69
|
|
202 int *pHealth; // esi@71
|
|
203 signed int v11; // esi@78
|
|
204 int v12; // eax@83
|
|
205 const char *pLocationName; // [sp-4h] [bp-68h]@74
|
|
206 bool bLoading; // [sp+10h] [bp-54h]@1
|
|
207 signed int bLoadinga; // [sp+10h] [bp-54h]@19
|
|
208 signed int v16; // [sp+14h] [bp-50h]@8
|
|
209 int v17[4]; // [sp+18h] [bp-4Ch]@80
|
|
210 MSG Msg; // [sp+28h] [bp-3Ch]@20
|
|
211 char Source[64]; // [sp+44h] [bp-20h]@76
|
|
212
|
|
213 bLoading = uCurrentMenuID == MENU_LOAD;
|
|
214 SetCurrentMenuID((MENU_STATE)-1);
|
|
215 if (bLoading)
|
|
216 {
|
|
217 pParty->Reset();
|
|
218 dword_6BE340 = 0;
|
|
219 uGameState = 0;
|
|
220 LoadGame(uLoadGameUI_SelectedSlot);
|
|
221 }
|
|
222
|
|
223 for (uint i = 1; i < 5; ++i)
|
|
224 for (uint j = 1; j < 6; ++j)
|
|
225 {
|
|
226 sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j);
|
|
227 remove(pTmpBuf);
|
|
228 }
|
|
229
|
|
230 LoadPlayerPortraintsAndVoices();
|
|
231 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
|
|
232 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0);
|
|
233
|
|
234 while ( 2 )
|
|
235 {
|
|
236 v16 = 1;
|
|
237 if (pMessageQueue_50CBD0->uNumMessages)
|
|
238 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
239
|
|
240 pPartyActionQueue->uNumActions = 0;
|
|
241 if (pParty->bTurnBasedModeOn)
|
|
242 {
|
|
243 pTurnEngine->End(false);
|
|
244 pParty->bTurnBasedModeOn = false;
|
|
245 }
|
|
246 DoPrepareWorld(bLoading, 1);
|
|
247 pEventTimer->Resume();
|
|
248 dword_6BE364_game_settings_1 |= 0x80;
|
|
249 dword_6BE340 = 2;
|
|
250 // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
|
151
|
251 pCurrentScreen = SCREEN_GAME;
|
0
|
252 if (pAsyncMouse)
|
|
253 pAsyncMouse->Resume();
|
|
254 if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard )
|
|
255 pAsyncKeyboard->Resume();
|
|
256 if ( pRenderer->pRenderD3D )
|
|
257 pGame->pVisInstance->_4C1A02();
|
|
258 bLoadinga = 0;
|
|
259 do
|
|
260 {
|
|
261 while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) )
|
|
262 {
|
|
263 if ( Msg.message == WM_QUIT )
|
|
264 Game_DeinitializeAndTerminate(0);
|
|
265 TranslateMessage(&Msg);
|
|
266 DispatchMessageA(&Msg);
|
|
267 }
|
|
268 if (dword_6BE364_game_settings_1 & 0x0100 )
|
|
269 {
|
|
270 WaitMessage();
|
|
271 continue;
|
|
272 }
|
|
273 pGame->_44EEA7();
|
|
274 GameUI_WritePointedObjectStatusString();
|
|
275 ProcessInputActions();
|
|
276 GameUI_MsgProc();
|
|
277 if ( pArcomageGame->bGameInProgress )
|
|
278 {
|
|
279 ArcomageGame::Loop();
|
|
280 //LABEL_89:
|
|
281 pRenderer->Present();
|
|
282 continue;
|
|
283 }
|
|
284 if (pAsyncMouse)
|
|
285 pAsyncMouse->_46B736_consume_click_lists(1);
|
|
286 if ( pVideoPlayer->pSmackerMovie && !SmackWait(pVideoPlayer->pSmackerMovie) )
|
|
287 {
|
|
288 pRenderer->BeginScene();
|
|
289 pMouse->DrawCursorToTarget();
|
|
290 pVideoPlayer->SmackUpdatePalette(pVideoPlayer->hWindow);
|
|
291 pMouse->_469EA4();
|
|
292 pRenderer->EndScene();
|
|
293 }
|
|
294 if ( pVideoPlayer->pBinkMovie && !BinkWait(pVideoPlayer->pBinkMovie) )
|
|
295 {
|
|
296 pRenderer->BeginScene();
|
|
297 pMouse->DrawCursorToTarget();
|
|
298 pVideoPlayer->BinkUpdatePalette(pVideoPlayer->hWindow);
|
|
299 pMouse->_469EA4();
|
|
300 pRenderer->EndScene();
|
|
301 }
|
|
302 pEventTimer->Update();
|
|
303 pMiscTimer->Update();
|
|
304 OnTimer(0);
|
|
305 GameUI_StatusBar_UpdateTimedString(0);
|
|
306 if ( pMiscTimer->bPaused && !pEventTimer->bPaused )
|
|
307 pMiscTimer->Resume();
|
|
308 if ( pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn )
|
|
309 pEventTimer->bTackGameTime = 0;
|
|
310 if ( !pEventTimer->bPaused && !uGameState )
|
|
311 {
|
|
312 if ( !pEventTimer->bTackGameTime )
|
|
313 _494035_timed_effects__water_walking_damage__etc();
|
|
314 if ( dword_6BE364_game_settings_1 & 1 )
|
|
315 {
|
|
316 dword_6BE364_game_settings_1 &= 0xFFFFFFFEu;
|
|
317 }
|
|
318 else
|
|
319 {
|
|
320 sub_401A91_AI();
|
|
321 sub_46BDC0_UpdateUserInput_and_MapSpecificStuff();
|
|
322 }
|
|
323 }
|
|
324 if ( v16 )
|
|
325 {
|
|
326 v16 = 0;
|
|
327 viewparams->bRedrawGameUI = true;
|
|
328 }
|
11
|
329 //pAudioPlayer->_4AAFCF();//Ritor1: it's temporarily, game crash
|
0
|
330 if (uGameState == 1)
|
|
331 //goto LABEL_96;
|
4
|
332 {
|
|
333 bLoadinga = 1;
|
0
|
334 continue;
|
4
|
335 }
|
0
|
336 if (uGameState == 2)
|
|
337 {
|
|
338 pAudioPlayer->StopChannels(-1, -1);
|
|
339 PrepareWorld(0);
|
|
340 uGameState = 0;
|
|
341 continue;
|
|
342 }
|
|
343 if ( (signed int)uGameState <= 2 )
|
|
344 //goto LABEL_85;
|
4
|
345 {
|
|
346 pGame->Draw();
|
0
|
347 continue;
|
4
|
348 }
|
0
|
349 if ( (signed int)uGameState <= 5 || uGameState == 7 )
|
|
350 {
|
|
351 //LABEL_96:
|
|
352 bLoadinga = 1;
|
|
353 continue;
|
|
354 }
|
|
355 if ( uGameState != 8 )
|
|
356 {
|
|
357 if ( uGameState != 9 )
|
|
358 {
|
|
359 //LABEL_85:
|
|
360 pGame->Draw();
|
|
361 continue;
|
|
362 }
|
|
363 pRenderer->BeginScene();
|
|
364 GUI_UpdateWindows();
|
|
365 pRenderer->EndScene();
|
|
366 //goto LABEL_89;
|
4
|
367 pRenderer->Present();
|
0
|
368 continue;
|
|
369 }
|
4
|
370 pAudioPlayer->StopChannels(-1, -1);//äàëåå â ñëó÷àå ñìåðòè ãðóïïû
|
0
|
371 memset(pParty->pHirelings, 0, 0x4Cu);
|
|
372 memset(&pParty->pHirelings[1], 0, 0x4Cu);
|
|
373 pNewNPCsCount = 0;
|
|
374 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
|
|
375 {
|
|
376 pFlags = (char *)&pNPCStats->pNewNPCData[0].uFlags;
|
|
377 do
|
|
378 {
|
|
379 if ( *((int *)pFlags + 6) )
|
|
380 *pFlags &= 0x7Fu;
|
|
381 ++pNewNPCsCount;
|
|
382 pFlags += 76;
|
|
383 }
|
|
384 while ( pNewNPCsCount < (signed int)pNPCStats->uNumNewNPCs );
|
|
385 }
|
|
386 pVideoPlayer->PlayDeathMovie();
|
|
387 if ( pVideoPlayer->AnyMovieLoaded() )
|
|
388 pVideoPlayer->Unload();
|
|
389 SaveGame(0, 0);
|
|
390 ++pParty->uNumDeaths;
|
|
391 pPlayer = pParty->pPlayers;
|
|
392 do
|
|
393 {
|
|
394 pPlayer->SetVariable(VAR_Award, 85);
|
|
395 ++pPlayer;
|
|
396 }
|
|
397 while ( (signed int)pPlayer < (signed int)pParty->pHirelings );
|
|
398 pParty->field_764 = 0;
|
|
399 pParty->uTimePlayed += 0x276000ui64;
|
|
400 LOWORD(pParty->uFlags) &= 0xFDFBu;
|
|
401 pParty->SetGold(0);
|
|
402 pOtherOverlay = pOtherOverlayList->pOverlays;
|
|
403 v8 = 50;
|
|
404 do
|
|
405 {
|
|
406 pOtherOverlay->Reset();
|
|
407 ++pOtherOverlay;
|
|
408 --v8;
|
|
409 }
|
|
410 while ( v8 );
|
|
411 memset(pParty->pPartyBuffs, 0, 0x140u);
|
|
412 pPlayerNum = 1;
|
|
413 if ( pParty->bTurnBasedModeOn == 1 )
|
|
414 {
|
|
415 pTurnEngine->End(1);
|
|
416 pParty->bTurnBasedModeOn = 0;
|
|
417 }
|
|
418 pHealth = &pParty->pPlayers[0].sHealth;//193C
|
|
419 do
|
|
420 {
|
|
421 memset(pHealth - 0x64F, 0, 0xA0u);//(pConditions, 0, 160)
|
|
422 memset(pHealth - 0x67, 0, 0x180u);//(pPlayerBuffs[0], 0, 384)
|
|
423 *pHealth = 1;
|
|
424 pHealth += 1743; //6CF
|
|
425 uActiveCharacter = 1;
|
|
426 }
|
|
427 while ( (signed int)pHealth < (signed int)&pParty->field_871C[567] );
|
|
428 if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 136) )
|
|
429 {
|
|
430 pParty->vPosition.x = -17331; // respawn in harmondale
|
|
431 pParty->vPosition.y = 12547;
|
|
432 pParty->vPosition.z = 465;
|
|
433 pParty->sRotationY = 0;
|
|
434 pLocationName = "out02.odm";
|
|
435 }
|
|
436 else
|
|
437 {
|
|
438 pParty->vPosition.x = 12552; // respawn on emerald isle
|
|
439 pParty->vPosition.y = 1816;
|
|
440 pParty->vPosition.z = 0;
|
|
441 pParty->sRotationY = 512;
|
|
442 pLocationName = "out01.odm";
|
|
443 }
|
|
444 strcpy(Source, pLocationName);
|
|
445 pParty->uFallStartY = pParty->vPosition.z;
|
|
446 pParty->sRotationX = 0;
|
|
447 pParty->uFallSpeed = 0;
|
|
448 pParty->field_6E4 = 0;
|
|
449 pParty->field_6E0 = 0;
|
|
450 if ( _strcmpi(Source, pCurrentMapName) )
|
|
451 {
|
|
452 strcpy(pCurrentMapName, Source);
|
|
453 _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x;
|
|
454 _5B65AC_npcdata_fame_or_other = pParty->vPosition.y;
|
|
455 _5B65B0_npcdata_rep_or_other = pParty->vPosition.z;
|
|
456 _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY;
|
|
457 _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX;
|
|
458 dword_5B65C0 = 1;
|
|
459 PrepareWorld(1);
|
|
460 }
|
|
461 InitializeActors();
|
|
462 v11 = 0;
|
|
463 do
|
|
464 {
|
|
465 if ( pPlayers[pPlayerNum]->CanAct() )
|
|
466 v17[v11++] = pPlayerNum;
|
|
467 ++pPlayerNum;
|
|
468 }
|
|
469 while ( pPlayerNum <= 4 );
|
|
470 if ( v11 )
|
|
471 {
|
|
472 v12 = rand();
|
|
473 pPlayers[v17[v12 % v11]]->PlaySound(99, 0);
|
|
474 }
|
|
475 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2u);// "Once again you've cheated death!.." "Âû ñíîâà îáõèòðèëè ñìåðòü! …"
|
|
476 uGameState = 0;
|
|
477 }
|
|
478 while ( !bLoadinga );
|
|
479 dword_6BE340 = 0;
|
|
480 pEventTimer->Pause();
|
|
481 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
|
|
482 if ( uGameState == 3 )
|
|
483 {
|
|
484 sub_491E3A();
|
|
485 LoadPlayerPortraintsAndVoices();
|
|
486 uGameState = 0;
|
|
487 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
|
|
488 bLoading = true;
|
|
489 continue;
|
|
490 }
|
|
491 break;
|
|
492 }
|
151
|
493 pCurrentScreen = SCREEN_VIDEO;
|
0
|
494 sub_491E3A();
|
|
495 }
|
|
496
|
|
497
|
|
498
|
|
499 //----- (0044F192) --------------------------------------------------------
|
|
500 void Game::PrepareBloodsplats()
|
|
501 {
|
|
502 for (uint i = 0; i < uNumBloodsplats; ++i)
|
|
503 {
|
|
504 pBloodsplatContainer->AddBloodsplat(
|
|
505 pBloodsplats[i].x,
|
|
506 pBloodsplats[i].y,
|
|
507 pBloodsplats[i].z,
|
|
508 pBloodsplats[i].radius,
|
|
509 pBloodsplats[i].r,
|
|
510 pBloodsplats[i].g,
|
|
511 pBloodsplats[i].b);
|
|
512 }
|
|
513 }
|
|
514
|
|
515
|
|
516 //----- (0044F120) --------------------------------------------------------
|
|
517 void Game::PushStationaryLights(int a2)
|
|
518 {
|
|
519 signed int v3; // ebx@1
|
|
520 char *v4; // esi@2
|
|
521
|
|
522 auto v2 = this;
|
|
523 v3 = 0;
|
|
524 if ( (signed int)this->uNumStationaryLights > 0 )
|
|
525 {
|
|
526 v4 = (char *)&this->pStationaryLights[0].vRGBColor.y;
|
|
527 do
|
|
528 {
|
|
529 pStationaryLightsStack->AddLight(
|
|
530 (signed __int64)*((float *)v4 - 4),
|
|
531 (signed __int64)*((float *)v4 - 3),
|
|
532 (signed __int64)*((float *)v4 - 2),
|
|
533 (signed __int64)*((float *)v4 + 2),
|
|
534 (signed __int64)*((float *)v4 - 1),
|
|
535 (signed __int64)*(float *)v4,
|
|
536 (signed __int64)*((float *)v4 + 1),
|
|
537 byte_4E94D0);
|
|
538 ++v3;
|
|
539 v4 += 28;
|
|
540 }
|
|
541 while ( v3 < (signed int)v2->uNumStationaryLights );
|
|
542 }
|
|
543 }
|
|
544 // 4E94D0: using guessed type char byte_4E94D0;
|
|
545
|
|
546 //----- (0044F0FD) --------------------------------------------------------
|
|
547 void Game::_44F0FD()
|
|
548 {
|
|
549 ToggleFlags(0x40u);
|
|
550
|
|
551 if ( !(uFlags & 0x40) )
|
|
552 {
|
|
553 uNumBloodsplats = 0;
|
|
554 field_E0C = 0;
|
|
555 }
|
|
556 }
|
|
557
|
|
558 //----- (0044F0D8) --------------------------------------------------------
|
|
559 void Game::ToggleFlags(uint uMask)
|
|
560 {
|
|
561 if (uFlags & uMask)
|
|
562 uFlags &= ~uMask;
|
|
563 else
|
|
564 uFlags |= uMask;
|
|
565 }
|
|
566
|
|
567
|
|
568 //----- (0044F07B) --------------------------------------------------------
|
|
569 bool Game::_44F07B()
|
|
570 {
|
|
571 if (!pKeyboardInstance->IsKeyBeingHeld(VK_SHIFT) &&
|
|
572 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) &&
|
|
573 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) ||
|
|
574
|
|
575 (pKeyboardInstance->WasKeyPressed(VK_F11) == 0 &&
|
|
576 pKeyboardInstance->WasKeyPressed(VK_F11)))
|
|
577 return true;
|
|
578 return false;
|
|
579 }
|
|
580
|
|
581 //----- (0044EEA7) --------------------------------------------------------
|
|
582 bool Game::_44EEA7()
|
|
583 {
|
|
584 //Game *v1; // esi@1
|
|
585 double v2; // st7@2
|
|
586 float depth; // ST00_4@9
|
|
587 bool result; // eax@9
|
|
588 unsigned int v5; // eax@14
|
|
589 __int64 v6; // kr00_8@21
|
|
590 unsigned int y; // [sp+4h] [bp-24h]@2
|
|
591 unsigned int x; // [sp+8h] [bp-20h]@2
|
|
592 bool v9; // [sp+Ch] [bp-1Ch]@2
|
|
593 stru157 *v10; // [sp+10h] [bp-18h]@2
|
|
594 stru157 *v11; // [sp+14h] [bp-14h]@2
|
|
595 POINT a2; // [sp+20h] [bp-8h]@1
|
|
596
|
|
597 //v1 = this;
|
|
598 ++qword_5C6DF0;
|
|
599 pParticleEngine->UpdateParticles();
|
|
600 pMouseInstance->GetCursorPos(&a2);
|
|
601 if ( sub_4637E0_is_there_popup_onscreen() )
|
|
602 {
|
|
603 v11 = &a5;
|
|
604 v10 = &stru_F93E30;
|
|
605 v9 = 0;
|
|
606 x = a2.y;
|
|
607 y = a2.x;
|
|
608 v2 = GetPickDepth();
|
|
609 }
|
|
610 else
|
|
611 {
|
|
612 if ( uFlags2 & 0x10 )
|
|
613 {
|
|
614 v11 = &a5;
|
|
615 v10 = &stru_F93E1C;
|
|
616 }
|
|
617 else
|
|
618 {
|
|
619 static bool __init_flag = false;
|
|
620 static stru157 static_sub_44EEA7_stru157;
|
|
621 if (!__init_flag)
|
|
622 {
|
|
623 __init_flag = true;
|
|
624 static_sub_44EEA7_stru157.field_8 = -1;
|
|
625 static_sub_44EEA7_stru157.field_0 = 0;
|
|
626 static_sub_44EEA7_stru157.field_4 = 2;
|
|
627 static_sub_44EEA7_stru157.field_C = 0;
|
|
628 static_sub_44EEA7_stru157.field_10 = 0;
|
|
629 }
|
|
630 v11 = &a5;
|
|
631 v10 = &static_sub_44EEA7_stru157;
|
|
632 }
|
|
633 v2 = 5120.0;
|
|
634 v9 = 0;
|
|
635 x = a2.y;
|
|
636 y = a2.x;
|
|
637 }
|
|
638 depth = v2;
|
|
639
|
|
640 PickMouse(depth, y, x, v9, v10, v11);
|
|
641 pLightmapBuilder->std__vector_000004_size = 0;
|
|
642 pLightmapBuilder->std__vector_183808_size = 0;
|
|
643 pDecalBuilder->std__vector_pDecals_size = 0;
|
|
644 pDecalBuilder->field_308008 = 0;
|
|
645 result = _44F07B();
|
|
646 if ( result )
|
|
647 {
|
|
648 if ( uFlags & 8 )
|
|
649 LOBYTE(pStru10Instance->field_4) = 0;
|
|
650 if ( pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
651 {
|
|
652 v5 = GetLevelFogColor();
|
|
653 pRenderer->uFogColor = v5 & 0xFFFFFF;
|
|
654 }
|
|
655 if (uFlags & 0x0400)
|
|
656 uFlags2 |= 0x01;
|
|
657 if ( !pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor && pMobileLightsStack->uNumLightsActive )
|
|
658 {
|
|
659 uFlags2 |= 0x01;
|
|
660 field_E10 = qword_5C6DF0;
|
|
661 }
|
|
662 v6 = qword_5C6DF0 - field_E10;
|
|
663 if ( qword_5C6DF0 - field_E10 == 1 )
|
|
664 uFlags2 |= v6;
|
|
665 if (uNumStationaryLights_in_pStationaryLightsStack != pStationaryLightsStack->uNumLightsActive )
|
|
666 {
|
|
667 uFlags2 |= 1u;
|
|
668 uNumStationaryLights_in_pStationaryLightsStack = pStationaryLightsStack->uNumLightsActive;
|
|
669 }
|
|
670 _44E904();
|
|
671 LOBYTE(result) = 1;
|
|
672 }
|
|
673 return result;
|
|
674 }
|
|
675
|
|
676
|
|
677 //----- (0044EDE4) --------------------------------------------------------
|
|
678 bool Game::AlterGamma(BLVFace *pFace, unsigned int *pColor)
|
|
679 {
|
|
680 if (pGame->uFlags2 & 2 && pFace->uAttributes & 2)
|
|
681 {
|
|
682 *pColor = ReplaceHSV(*pColor, 1.0, fSaturation, -1.0);
|
|
683 return true;
|
|
684 }
|
|
685 else
|
|
686 return false;
|
|
687 }
|
|
688
|
|
689 //----- (0044EE30) --------------------------------------------------------
|
|
690 bool Game::_44EE30(ODMFace *a2, int a3)
|
|
691 {
|
|
692 if (uFlags2 & 0x2 && a2->uAttributes & 0x02)
|
|
693 {
|
|
694 *(int *)a3 = ReplaceHSV(*(int *)a3, 1.0, fSaturation, -1.0);
|
|
695 return true;
|
|
696 }
|
|
697 else
|
|
698 return false;
|
|
699 }
|
|
700
|
|
701
|
|
702 //----- (004645FA) --------------------------------------------------------
|
|
703 void Game::Deinitialize()
|
|
704 {
|
|
705 struct tagRECT Rect; // [sp+0h] [bp-10h]@6
|
|
706
|
|
707 if (pAsyncMouse)
|
|
708 pAsyncMouse->Suspend();
|
|
709 if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard)
|
|
710 pAsyncKeyboard->Suspend();
|
|
711 WriteWindowsRegistryInt("startinwindow", pRenderer->bWindowMode);
|
|
712 if ( GetWindowRect(hWnd, &Rect) && pRenderer->bWindowMode )
|
|
713 {
|
|
714 WriteWindowsRegistryInt("window X", Rect.left);
|
|
715 WriteWindowsRegistryInt("window Y", Rect.top);
|
|
716 }
|
|
717 WriteWindowsRegistryInt("debug flags", stru_51076C.registry_debug_flags);
|
|
718 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
|
|
719 pItemsTable->Release();
|
|
720 pNPCStats->Release();
|
|
721 if (pAsyncKeyboard)
|
|
722 pAsyncKeyboard->Release();
|
|
723 if (pAsyncMouse)
|
|
724 pAsyncMouse->Release();
|
|
725 if (pMouse)
|
|
726 pMouse->Deactivate();
|
|
727
|
|
728 pAudioPlayer->Release();//error
|
|
729 pNew_LOD->FreeSubIndexAndIO();
|
|
730 pGames_LOD->FreeSubIndexAndIO();
|
|
731 ClipCursor(0);
|
|
732 Game::Destroy();
|
|
733 }
|
|
734
|
|
735 //----- (0044EE7C) --------------------------------------------------------
|
|
736 bool Game::draw_debug_outlines()
|
|
737 {
|
|
738 if (uFlags & 0x04)
|
|
739 {
|
|
740 pLightmapBuilder->DrawDebugOutlines(-1);
|
|
741 pDecalBuilder->DrawDecalDebugOutlines();
|
|
742 }
|
|
743 return true;
|
|
744 }
|
|
745
|
|
746 //----- (0044EC23) --------------------------------------------------------
|
|
747 int Game::_44EC23(stru148 *a2, int *a3, signed int a4)
|
|
748 {
|
|
749 double v4; // st7@4
|
|
750 //double v5; // ST00_8@4
|
|
751 signed int v6; // eax@5
|
|
752 //double v7; // ST00_8@6
|
|
753 signed int result; // eax@8
|
|
754 //double v9; // ST00_8@9
|
|
755 //double v10; // ST00_8@11
|
|
756 float a2a; // [sp+14h] [bp+8h]@4
|
|
757 float a3a; // [sp+18h] [bp+Ch]@4
|
|
758 float a3b; // [sp+18h] [bp+Ch]@6
|
|
759 float a4a; // [sp+1Ch] [bp+10h]@9
|
|
760 float a4b; // [sp+1Ch] [bp+10h]@11
|
|
761
|
|
762 if ( this->uFlags2 & 2 && a2->field_59 == 5 && a2->pODMFace->uAttributes & 2 )
|
|
763 {
|
|
764 v4 = (double)a4;
|
|
765 a2a = v4;
|
|
766 *a3 |= 2u;
|
|
767 a3a = (1.0 - this->fSaturation) * v4;
|
|
768 //v5 = a3a + 6.7553994e15;
|
|
769 //if ( SLODWORD(v5) >= 0 )
|
|
770 if (floorf(a3a + 0.5f) >= 0 )
|
|
771 {
|
|
772 a3b = (1.0 - this->fSaturation) * a2a;
|
|
773 //v7 = a3b + 6.7553994e15;
|
|
774 //v6 = LODWORD(v7);
|
|
775 v6 = floorf(a3b + 0.5f);
|
|
776 }
|
|
777 else
|
|
778 {
|
|
779 v6 = 0;
|
|
780 }
|
|
781 if ( a4 >= v6 )
|
|
782 {
|
|
783 a4a = (1.0 - fSaturation) * a2a;
|
|
784 //v9 = a4a + 6.7553994e15;
|
|
785 //if ( SLODWORD(v9) >= 0 )
|
|
786 if (floorf(a4a + 0.5f) >= 0)
|
|
787 {
|
|
788 a4b = (1.0 - fSaturation) * a2a;
|
|
789 //v10 = a4b + 6.7553994e15;
|
|
790 //result = LODWORD(v10);
|
|
791 result = floorf(a4b + 0.5f);
|
|
792 }
|
|
793 else
|
|
794 {
|
|
795 result = 0;
|
|
796 }
|
|
797 }
|
|
798 else
|
|
799 {
|
|
800 result = a4;
|
|
801 }
|
|
802 }
|
|
803 else
|
|
804 {
|
|
805 result = -1;
|
|
806 }
|
|
807 return result;
|
|
808 }
|
|
809
|
|
810
|
|
811
|
|
812 //----- (00465C8B) --------------------------------------------------------
|
|
813 Game *Game::Create()
|
|
814 {
|
|
815 return new Game;
|
|
816 }
|
|
817
|
|
818 //----- (00465CF3) --------------------------------------------------------
|
|
819 void Game::Destroy()
|
|
820 {
|
|
821 if (pGame)
|
|
822 delete pGame;
|
|
823 pGame = nullptr;
|
|
824 }
|
|
825
|
|
826 //----- (0044ED0A) --------------------------------------------------------
|
|
827 signed int Game::_44ED0A(BLVFace *a2, int *a3, signed int a4)
|
|
828 {
|
|
829 double v4; // st7@3
|
|
830 //double v5; // ST00_8@3
|
|
831 signed int v6; // eax@4
|
|
832 //double v7; // ST00_8@5
|
|
833 signed int result; // eax@7
|
|
834 //double v9; // ST00_8@8
|
|
835 //double v10; // ST00_8@10
|
|
836 float v11; // [sp+14h] [bp+8h]@3
|
|
837 float v12; // [sp+18h] [bp+Ch]@3
|
|
838 float v13; // [sp+18h] [bp+Ch]@5
|
|
839 float v14; // [sp+1Ch] [bp+10h]@8
|
|
840 float v15; // [sp+1Ch] [bp+10h]@10
|
|
841
|
|
842 if ( this->uFlags2 & 2 && a2->uAttributes & 2 )
|
|
843 {
|
|
844 v4 = (double)a4;
|
|
845 v11 = v4;
|
|
846 *a3 |= 2u;
|
|
847 v12 = (1.0 - this->fSaturation) * v4;
|
|
848 //v5 = v12 + 6.7553994e15;
|
|
849 if (floorf(v12 + 0.5f)/* SLODWORD(v5)*/ >= 0 )
|
|
850 {
|
|
851 v13 = (1.0 - this->fSaturation) * v11;
|
|
852 //v7 = v13 + 6.7553994e15;
|
|
853 //v6 = LODWORD(v7);
|
|
854 v6 = floorf(v13 + 0.5f);
|
|
855 }
|
|
856 else
|
|
857 {
|
|
858 v6 = 0;
|
|
859 }
|
|
860 if ( a4 >= v6 )
|
|
861 {
|
|
862 v14 = (1.0 - fSaturation) * v11;
|
|
863 //v9 = v14 + 6.7553994e15;
|
|
864 if (floorf(v14 + 0.5f)/* SLODWORD(v9)*/ >= 0 )
|
|
865 {
|
|
866 v15 = (1.0 - fSaturation) * v11;
|
|
867 //v10 = v15 + 6.7553994e15;
|
|
868 //result = LODWORD(v10);
|
|
869 result = floorf(v15 + 0.5f);
|
|
870 }
|
|
871 else
|
|
872 {
|
|
873 result = 0;
|
|
874 }
|
|
875 }
|
|
876 else
|
|
877 {
|
|
878 result = a4;
|
|
879 }
|
|
880 }
|
|
881 else
|
|
882 {
|
|
883 result = -1;
|
|
884 }
|
|
885 return result;
|
|
886 }
|
|
887
|
|
888
|
|
889 //----- (0044E4B7) --------------------------------------------------------
|
|
890 Game::Game()
|
|
891 {
|
|
892 uNumStationaryLights = 0;
|
|
893 uNumBloodsplats = 0;
|
|
894 field_E0C = 0;
|
|
895 field_E10 = 0;
|
|
896 uNumStationaryLights_in_pStationaryLightsStack = 0;
|
|
897 bGammaControlInitialized = false;
|
|
898 uFlags = 0;
|
|
899 uFlags2 = 0;
|
|
900 uSomeGammaStartTime = 0;
|
|
901 uSomeGammaDeltaTime = 0;
|
|
902
|
|
903 pThreadWardInstance = new ThreadWard;
|
|
904 pParticleEngine = new ParticleEngine;
|
|
905 pMouse = pMouseInstance = new Mouse(pThreadWardInstance);
|
|
906 pLightmapBuilder = new LightmapBuilder;
|
|
907 pVisInstance = new Vis;
|
|
908 pStru6Instance = new stru6;
|
|
909 pIndoorCameraD3D = new IndoorCameraD3D;
|
|
910 pStru9Instance = new stru9;
|
|
911 pStru10Instance = new stru10;
|
|
912 pStru11Instance = new stru11;
|
|
913 pStru12Instance = new stru12(pStru11Instance);
|
|
914 pCShow = new CShow;
|
|
915 pKeyboardInstance = new Keyboard;
|
|
916 pGammaController = new GammaController;
|
|
917
|
|
918 uFlags |= 0x0800;
|
|
919 uFlags2 |= 0x24;
|
|
920
|
|
921 _44F0FD();
|
|
922
|
|
923 bWinNT4_0 = false;
|
|
924 if (pVersion->pVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
|
|
925 pVersion->pVersionInfo.dwMajorVersion == 4)
|
|
926 bWinNT4_0 = true;
|
|
927 }
|
|
928
|
|
929 //----- (0044E7F3) --------------------------------------------------------
|
|
930 Game::~Game()
|
|
931 {
|
|
932 if (pGammaController)
|
|
933 delete pGammaController;
|
|
934 if (pKeyboardInstance)
|
|
935 delete pKeyboardInstance;
|
|
936 if (pCShow)
|
|
937 delete pCShow;
|
|
938 if (pStru12Instance)
|
|
939 delete pStru12Instance;
|
|
940 if (pStru11Instance)
|
|
941 delete pStru11Instance;
|
|
942 if (pStru10Instance)
|
|
943 delete pStru10Instance;
|
|
944 if (pStru9Instance)
|
|
945 delete pStru9Instance;
|
|
946 if (pIndoorCameraD3D)
|
|
947 delete pIndoorCameraD3D;
|
|
948 if (pStru6Instance)
|
|
949 delete pStru6Instance;
|
|
950 if (pVisInstance)
|
|
951 delete pVisInstance;
|
|
952 if (pLightmapBuilder)
|
|
953 delete pLightmapBuilder;
|
|
954 if (pMouseInstance)
|
|
955 delete pMouseInstance;
|
|
956 if (pParticleEngine)
|
|
957 delete pParticleEngine;
|
|
958 if (pThreadWardInstance)
|
|
959 delete pThreadWardInstance;
|
|
960 }
|
|
961
|
|
962 //----- (0044E904) --------------------------------------------------------
|
|
963 void Game::_44E904()
|
|
964 {
|
|
965 //Game *v1; // esi@1
|
|
966 unsigned __int64 v2; // qax@1
|
|
967 unsigned int v3; // ecx@1
|
|
968 int v4; // edi@1
|
|
969 unsigned __int8 v5; // cf@7
|
|
970 double v6; // st7@13
|
|
971 double v7; // st7@15
|
|
972 signed __int64 v8; // [sp+Ch] [bp-8h]@1
|
|
973
|
|
974 //v1 = this;
|
|
975 v2 = pEventTimer->Time();
|
|
976 v4 = (v2 - uSomeGammaStartTime) >> 32;
|
|
977 v3 = v2 - LODWORD(uSomeGammaStartTime);
|
|
978 v8 = v2 - uSomeGammaStartTime;
|
|
979 if ( v4 < 0
|
|
980 || SHIDWORD(v2) < ((unsigned int)v2 < LODWORD(uSomeGammaStartTime)) + HIDWORD(uSomeGammaStartTime) | v4 == 0
|
|
981 && v3 <= 0x80 )
|
|
982 {
|
|
983 if ( v4 > 0 || v4 >= 0 )
|
|
984 goto LABEL_12;
|
|
985 v3 = 0;
|
|
986 v4 = 0;
|
|
987 }
|
|
988 else
|
|
989 {
|
|
990 if ( uSomeGammaDeltaTime )
|
|
991 {
|
|
992 LODWORD(uSomeGammaDeltaTime) = 0;
|
|
993 HIDWORD(uSomeGammaDeltaTime) = 0;
|
|
994 }
|
|
995 else
|
|
996 {
|
|
997 LODWORD(uSomeGammaDeltaTime) = v3;
|
|
998 HIDWORD(uSomeGammaDeltaTime) = v4;
|
|
999 }
|
|
1000 v5 = __CFADD__(v3, -128);
|
|
1001 v3 -= 128;
|
|
1002 v4 = v5 + v4 - 1;
|
|
1003 }
|
|
1004 uSomeGammaStartTime = v2;
|
|
1005 v8 = __PAIR__(v4, v3);
|
|
1006 LABEL_12:
|
|
1007 if ( uSomeGammaDeltaTime )
|
|
1008 v6 = (double)(signed __int64)(uSomeGammaDeltaTime - __PAIR__(v4, v3));
|
|
1009 else
|
|
1010 v6 = (double)v8;
|
|
1011 v7 = v6 * 0.0078125;
|
|
1012 if ( v7 < 0.0 || v7 <= 1.0 )
|
|
1013 {
|
|
1014 if ( v7 < 0.0 )
|
|
1015 v7 = 0.0;
|
|
1016 }
|
|
1017 else
|
|
1018 {
|
|
1019 v7 = 1.0;
|
|
1020 }
|
|
1021 if ( pRenderer->pRenderD3D )
|
|
1022 fSaturation = v7;
|
|
1023 else
|
|
1024 fSaturation = (1.0 - 0.5) * v7 + 0.5;
|
|
1025 }
|
|
1026
|
|
1027 //----- (0044EA17) --------------------------------------------------------
|
|
1028 bool Game::InitializeGammaController()
|
|
1029 {
|
|
1030 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
|
|
1031 pVersion->pVersionInfo.dwMajorVersion != 4 )
|
|
1032 pGammaController->InitializeFromSurface(pRenderer->pFrontBuffer4);
|
|
1033
|
|
1034 bGammaControlInitialized = true;
|
|
1035 uSomeGammaStartTime = pEventTimer->Time();
|
|
1036 return true;
|
|
1037 }
|
|
1038
|
|
1039 //----- (0044EA5E) --------------------------------------------------------
|
|
1040 char Game::PickMouse(float fPickDepth, unsigned int uMouseX, unsigned int uMouseY, bool bOutline, stru157 *a5, stru157 *a6)
|
|
1041 {
|
|
1042 char result; // al@3
|
|
1043 std::string v10; // [sp-4h] [bp-24h]@5
|
|
1044 float v11; // [sp+4h] [bp-1Ch]@10
|
|
1045 float v12; // [sp+8h] [bp-18h]@10
|
|
1046 const char *v13; // [sp+Ch] [bp-14h]@5
|
|
1047 int v14; // [sp+10h] [bp-10h]@5
|
|
1048 std::string *v15; // [sp+18h] [bp-8h]@5
|
|
1049 int a3; // [sp+1Fh] [bp-1h]@5
|
|
1050
|
|
1051 auto v7 = this;
|
|
1052 if (!pCurrentScreen && pRenderer->pRenderD3D)
|
|
1053 {
|
|
1054 if (!pVisInstance)
|
|
1055 {
|
|
1056 MessageBoxW(nullptr, L"The 'Vis' object pointer has not been instatiated, but CGame::Pick() is trying to call through it.", nullptr, 0);
|
|
1057 ExitProcess(0);
|
|
1058 }
|
|
1059
|
|
1060 if ( (signed int)uMouseX >= (signed int)pViewport->uScreenX
|
|
1061 && (signed int)uMouseX <= (signed int)pViewport->uScreenZ
|
|
1062 && (signed int)uMouseY >= (signed int)pViewport->uScreenY
|
|
1063 && (signed int)uMouseY <= (signed int)pViewport->uScreenW )
|
|
1064 {
|
|
1065 v14 = (int)a6;
|
|
1066 v12 = (double)(signed int)uMouseY;
|
|
1067 v11 = (double)(signed int)uMouseX;
|
|
1068 pVisInstance->PickMouse(fPickDepth, v11, v12, a5, a6);
|
|
1069
|
|
1070 if (bOutline)
|
|
1071 OutlineSelection();
|
|
1072 }
|
|
1073 return true;
|
|
1074 }
|
|
1075 return false;
|
|
1076 }
|
|
1077 // 4E28F8: using guessed type int pCurrentScreen;
|
|
1078
|
|
1079 //----- (0044EB12) --------------------------------------------------------
|
|
1080 bool Game::_44EB12(bool bOutline, stru157 *a3, stru157 *a4)
|
|
1081 {
|
|
1082 if ( !pCurrentScreen && pVisInstance && pRenderer->pRenderD3D )
|
|
1083 {
|
123
|
1084 bool r = pVisInstance->PickKeyboard(&pVisInstance->stru1, a3, a4);
|
0
|
1085
|
|
1086 if (bOutline)
|
|
1087 OutlineSelection();
|
|
1088 return r;
|
|
1089 }
|
|
1090 return false;
|
|
1091 }
|
123
|
1092 /*
|
|
1093 Result::Code Game::PickKeyboard(bool bOutline, struct unnamed_F93E6C *a3, struct unnamed_F93E6C *a4)
|
|
1094 {
|
|
1095 if (dword_4E28F8_PartyCantJumpIfTrue)
|
|
1096 return Result::Generic;
|
|
1097
|
|
1098 pVis->PickKeyboard(a3, a4);
|
|
1099 if (bOutline)
|
|
1100 Game_outline_selection((int)this);
|
|
1101 return Result::Success;
|
|
1102 }
|
|
1103 */
|
0
|
1104 // 4E28F8: using guessed type int pCurrentScreen;
|
|
1105
|
|
1106 //----- (0044EB5A) --------------------------------------------------------
|
|
1107 void Game::OutlineSelection()
|
|
1108 {
|
|
1109 Vis *v1; // eax@1
|
|
1110 Vis_stru1_stru0 *v2; // eax@3
|
|
1111 void *v3; // edx@9
|
|
1112 int v4; // eax@10
|
|
1113 int v5; // eax@11
|
|
1114 int v6; // eax@14
|
|
1115 int v7; // eax@15
|
|
1116 const char *v9; // [sp-8h] [bp-14h]@8
|
|
1117 int v10; // [sp-4h] [bp-10h]@8
|
|
1118 char v11; // [sp+0h] [bp-Ch]@18
|
|
1119 int a3; // [sp+Ah] [bp-2h]@8
|
|
1120
|
|
1121 v1 = this->pVisInstance;
|
|
1122 if ( v1 )
|
|
1123 {
|
|
1124 v2 = (Vis_stru1_stru0 *)((signed int)v1->stru1.uNumPointers <= 0 ? 0 : v1->stru1.array_1804[0]);
|
|
1125 if ( v2 )
|
|
1126 {
|
|
1127 if ( v2->uObjectType == 1 )
|
|
1128 {
|
|
1129 MessageBoxW(nullptr, L"Sprite outline currently Unsupported", nullptr, 0);
|
|
1130 ExitProcess(0);
|
|
1131 }
|
|
1132
|
|
1133 if ( v2->uObjectType == 2 )
|
|
1134 {
|
|
1135 v3 = v2->pObjectInfo; // TODO 2 objects for indoor/outdoor
|
|
1136 // some clues in header for Vis_stru1_stru0
|
|
1137 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
1138 {
|
|
1139 v4 = *((int *)v3 + 11);
|
|
1140 if ( v4 & 0x10000 )
|
|
1141 v5 = v4 & 0xFFFEFFFF;
|
|
1142 else
|
|
1143 v5 = v4 | 0x10000;
|
|
1144 *((int *)v3 + 11) = v5;
|
|
1145 }
|
|
1146 else
|
|
1147 {
|
|
1148 v6 = *((int *)v3 + 7);
|
|
1149 if ( v6 & 0x10000 )
|
|
1150 v7 = v6 & 0xFFFEFFFF;
|
|
1151 else
|
|
1152 v7 = v6 | 0x10000;
|
|
1153 *((int *)v3 + 7) = v7;
|
|
1154 }
|
|
1155 }
|
|
1156 else
|
|
1157 {
|
|
1158 MessageBoxW(nullptr, L"Undefined CObjectInfo type requested in CGame::outline_selection()", nullptr, 0);
|
|
1159 ExitProcess(0);
|
|
1160 }
|
|
1161 }
|
|
1162 }
|
|
1163 } |