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