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