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