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