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