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