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;
|
|
257 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
|
2
|
258 if (pAsyncMouse)
|
0
|
259 pAsyncMouse->Resume();
|
|
260 if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard )
|
|
261 pAsyncKeyboard->Resume();
|
|
262 if ( pRenderer->pRenderD3D )
|
|
263 pGame->pVisInstance->_4C1A02();
|
|
264 bLoadinga = 0;
|
|
265 do
|
|
266 {
|
27
|
267 while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) )
|
0
|
268 {
|
|
269 if ( Msg.message == WM_QUIT )
|
|
270 Game_DeinitializeAndTerminate(0);
|
|
271 TranslateMessage(&Msg);
|
|
272 DispatchMessageA(&Msg);
|
|
273 }
|
|
274 if ( BYTE1(dword_6BE364_game_settings_1) & 1 )
|
|
275 {
|
|
276 WaitMessage();
|
|
277 continue;
|
|
278 }
|
|
279 pGame->_44EEA7();
|
|
280 GameUI_WritePointedObjectStatusString();
|
|
281 ProcessInputActions();
|
|
282 GameUI_MsgProc();
|
|
283 if ( pArcomageGame->bGameInProgress )
|
|
284 {
|
|
285 ArcomageGame::Loop();
|
|
286 LABEL_89:
|
27
|
287 pRenderer->Present();
|
0
|
288 continue;
|
|
289 }
|
2
|
290 if (pAsyncMouse)
|
27
|
291 pAsyncMouse->_46B736_consume_click_lists(1);
|
0
|
292 if ( pVideoPlayer->pSmackerMovie && !SmackWait(pVideoPlayer->pSmackerMovie) )
|
|
293 {
|
27
|
294 pRenderer->BeginScene();
|
0
|
295 pMouse->_469E3B();
|
|
296 pVideoPlayer->SmackUpdatePalette(pVideoPlayer->hWindow);
|
|
297 pMouse->_469EA4();
|
27
|
298 pRenderer->EndScene();
|
0
|
299 }
|
|
300 if ( pVideoPlayer->pBinkMovie && !BinkWait(pVideoPlayer->pBinkMovie) )
|
|
301 {
|
27
|
302 pRenderer->BeginScene();
|
0
|
303 pMouse->_469E3B();
|
|
304 pVideoPlayer->BinkUpdatePalette(pVideoPlayer->hWindow);
|
|
305 pMouse->_469EA4();
|
27
|
306 pRenderer->EndScene();
|
0
|
307 }
|
|
308 pEventTimer->Update();
|
|
309 pMiscTimer->Update();
|
|
310 OnTimer(0);
|
|
311 GameUI_StatusBar_UpdateTimedString(0);
|
|
312 if ( pMiscTimer->bPaused && !pEventTimer->bPaused )
|
|
313 pMiscTimer->Resume();
|
|
314 if ( pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn )
|
|
315 pEventTimer->bTackGameTime = 0;
|
|
316 if ( !pEventTimer->bPaused && !uGameState )
|
|
317 {
|
|
318 if ( !pEventTimer->bTackGameTime )
|
|
319 _494035_timed_effects__water_walking_damage__etc();
|
|
320 if ( dword_6BE364_game_settings_1 & 1 )
|
|
321 {
|
|
322 dword_6BE364_game_settings_1 &= 0xFFFFFFFEu;
|
|
323 }
|
|
324 else
|
|
325 {
|
|
326 sub_401A91_AI();
|
|
327 sub_46BDC0_UpdateUserInput_and_MapSpecificStuff();
|
|
328 }
|
|
329 }
|
|
330 if ( v16 )
|
|
331 {
|
|
332 v16 = 0;
|
27
|
333 viewparams->bRedrawGameUI = true;
|
0
|
334 }
|
|
335 pAudioPlayer->_4AAFCF();
|
27
|
336 if (uGameState == 1)
|
0
|
337 goto LABEL_96;
|
27
|
338 if (uGameState == 2)
|
0
|
339 {
|
|
340 pAudioPlayer->StopChannels(-1, -1);
|
|
341 PrepareWorld(0);
|
|
342 uGameState = 0;
|
|
343 continue;
|
|
344 }
|
|
345 if ( (signed int)uGameState <= 2 )
|
|
346 goto LABEL_85;
|
|
347 if ( (signed int)uGameState <= 5 || uGameState == 7 )
|
|
348 {
|
|
349 LABEL_96:
|
27
|
350 bLoadinga = 1;
|
0
|
351 continue;
|
|
352 }
|
|
353 if ( uGameState != 8 )
|
|
354 {
|
|
355 if ( uGameState != 9 )
|
|
356 {
|
|
357 LABEL_85:
|
|
358 pGame->Draw();
|
|
359 continue;
|
|
360 }
|
|
361 pRenderer->BeginScene();
|
|
362 GUI_UpdateWindows();
|
|
363 pRenderer->EndScene();
|
|
364 goto LABEL_89;
|
|
365 }
|
|
366 pAudioPlayer->StopChannels(-1, -1);
|
|
367 memset(pParty->pHirelings, 0, 0x4Cu);
|
|
368 memset(&pParty->pHirelings[1], 0, 0x4Cu);
|
|
369 v4 = 0;
|
|
370 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
|
|
371 {
|
|
372 v5 = (char *)&pNPCStats->pNewNPCData[0].uFlags;
|
|
373 do
|
|
374 {
|
|
375 if ( *((int *)v5 + 6) )
|
|
376 *v5 &= 0x7Fu;
|
|
377 ++v4;
|
|
378 v5 += 76;
|
|
379 }
|
|
380 while ( v4 < (signed int)pNPCStats->uNumNewNPCs );
|
|
381 }
|
|
382 pVideoPlayer->PlayDeathMovie();
|
|
383 if ( pVideoPlayer->AnyMovieLoaded() )
|
|
384 pVideoPlayer->Unload();
|
|
385 SaveGame(0, 0);
|
|
386 ++pParty->uNumDeaths;
|
|
387 v6 = pParty->pPlayers;
|
|
388 do
|
|
389 {
|
|
390 v6->SetVariable(VAR_Award, 85);
|
|
391 ++v6;
|
|
392 }
|
|
393 while ( (signed int)v6 < (signed int)pParty->pHirelings );
|
|
394 pParty->field_764 = 0;
|
|
395 pParty->uTimePlayed += 0x276000ui64;
|
|
396 LOWORD(pParty->uFlags) &= 0xFDFBu;
|
|
397 pParty->SetGold(0);
|
|
398 v7 = pOtherOverlayList->pOverlays;
|
|
399 v8 = 50;
|
|
400 do
|
|
401 {
|
|
402 v7->Reset();
|
|
403 ++v7;
|
|
404 --v8;
|
|
405 }
|
|
406 while ( v8 );
|
|
407 memset(pParty->pPartyBuffs, 0, 0x140u);
|
|
408 v9 = 1;
|
|
409 if ( pParty->bTurnBasedModeOn == 1 )
|
|
410 {
|
|
411 pTurnEngine->End(1u);
|
|
412 pParty->bTurnBasedModeOn = 0;
|
|
413 }
|
|
414 pHealth = &pParty->pPlayers[0].sHealth;
|
|
415 do
|
|
416 {
|
|
417 memset(pHealth - 0x64F, 0, 0xA0u);
|
|
418 memset(pHealth - 0x67, 0, 0x180u);
|
|
419 *pHealth = 1;
|
|
420 pHealth += 1743;
|
|
421 uActiveCharacter = 1;
|
|
422 }
|
|
423 while ( (signed int)pHealth < (signed int)&pParty->field_871C[567] );
|
|
424 if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 136) )
|
|
425 {
|
|
426 pParty->vPosition.x = -17331; // respawn in harmondale
|
|
427 pParty->vPosition.z = 12547;
|
|
428 pParty->vPosition.y = 465;
|
|
429 pParty->sRotationY = 0;
|
|
430 v13 = "out02.odm";
|
|
431 }
|
|
432 else
|
|
433 {
|
|
434 pParty->vPosition.x = 12552; // respawn on emerald isle
|
|
435 pParty->vPosition.z = 1816;
|
|
436 pParty->vPosition.y = 0;
|
|
437 pParty->sRotationY = 512;
|
|
438 v13 = "out01.odm";
|
|
439 }
|
|
440 strcpy(Source, v13);
|
|
441 pParty->uFallStartY = pParty->vPosition.y;
|
|
442 pParty->sRotationX = 0;
|
|
443 pParty->uFallSpeed = 0;
|
|
444 pParty->field_6E4 = 0;
|
|
445 pParty->field_6E0 = 0;
|
|
446 if ( _strcmpi(Source, pCurrentMapName) )
|
|
447 {
|
|
448 strcpy(pCurrentMapName, Source);
|
|
449 _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x;
|
|
450 _5B65AC_npcdata_fame_or_other = pParty->vPosition.z;
|
|
451 _5B65B0_npcdata_rep_or_other = pParty->vPosition.y;
|
|
452 _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY;
|
|
453 _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX;
|
|
454 dword_5B65C0 = 1;
|
|
455 PrepareWorld(1u);
|
|
456 }
|
|
457 UpdateActors();
|
|
458 v11 = 0;
|
|
459 do
|
|
460 {
|
|
461 if ( pPlayers[v9]->CanAct() )
|
|
462 v17[v11++] = v9;
|
|
463 ++v9;
|
|
464 }
|
|
465 while ( v9 <= 4 );
|
|
466 if ( v11 )
|
|
467 {
|
|
468 v12 = rand();
|
|
469 pPlayers[v17[v12 % v11]]->PlaySound(99, 0);
|
|
470 }
|
|
471 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2u);// "Once again you've cheated death!.."
|
|
472 uGameState = 0;
|
|
473 }
|
|
474 while ( !bLoadinga );
|
|
475 dword_6BE340 = 0;
|
|
476 pEventTimer->Pause();
|
|
477 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
|
|
478 if ( uGameState == 3 )
|
|
479 {
|
|
480 sub_491E3A();
|
|
481 LoadPlayerPortraintsAndVoices();
|
|
482 uGameState = 0;
|
|
483 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
|
27
|
484 bLoading = true;
|
0
|
485 continue;
|
|
486 }
|
|
487 break;
|
|
488 }
|
|
489 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 16;
|
|
490 sub_491E3A();
|
|
491 }
|
3
|
492
|
0
|
493
|
|
494
|
|
495
|
|
496 //----- (0044F192) --------------------------------------------------------
|
|
497 void Game::PushStru165s()
|
|
498 {
|
|
499 Game *v1; // edi@1
|
|
500 int v2; // ebx@1
|
|
501 float *v3; // esi@2
|
|
502
|
|
503 auto a1 = this;
|
|
504 v1 = a1;
|
|
505 v2 = 0;
|
|
506 if ( a1->array_708_size > 0 )
|
|
507 {
|
|
508 v3 = &a1->array_708[0].flt_10;
|
|
509 do
|
|
510 {
|
|
511 pBloodsplatContainer->AddBloodsplat(
|
|
512 *(v3 - 4),
|
|
513 *(v3 - 3),
|
|
514 *(v3 - 2),
|
|
515 v3[2],
|
|
516 (signed __int64)*(v3 - 1),
|
|
517 (signed __int64)*v3,
|
|
518 (signed __int64)v3[1]);
|
|
519 ++v2;
|
|
520 v3 += 7;
|
|
521 }
|
|
522 while ( v2 < v1->array_708_size );
|
|
523 }
|
|
524 }
|
|
525
|
|
526
|
|
527 //----- (0044F120) --------------------------------------------------------
|
|
528 void Game::PushStationaryLights(int a2)
|
|
529 {
|
|
530 signed int v3; // ebx@1
|
|
531 char *v4; // esi@2
|
|
532
|
|
533 auto v2 = this;
|
|
534 v3 = 0;
|
|
535 if ( (signed int)this->uNumStationaryLights > 0 )
|
|
536 {
|
|
537 v4 = (char *)&this->pStationaryLights[0].vRGBColor.y;
|
|
538 do
|
|
539 {
|
|
540 pStationaryLightsStack->AddLight(
|
|
541 (signed __int64)*((float *)v4 - 4),
|
|
542 (signed __int64)*((float *)v4 - 3),
|
|
543 (signed __int64)*((float *)v4 - 2),
|
|
544 (signed __int64)*((float *)v4 + 2),
|
29
|
545 (signed __int64)*((float *)v4 - 1),
|
0
|
546 (signed __int64)*(float *)v4,
|
|
547 (signed __int64)*((float *)v4 + 1),
|
|
548 byte_4E94D0);
|
|
549 ++v3;
|
|
550 v4 += 28;
|
|
551 }
|
|
552 while ( v3 < (signed int)v2->uNumStationaryLights );
|
|
553 }
|
|
554 }
|
|
555 // 4E94D0: using guessed type char byte_4E94D0;
|
|
556
|
|
557 //----- (0044F0FD) --------------------------------------------------------
|
|
558 void Game::_44F0FD()
|
|
559 {
|
|
560 ToggleFlags(0x40u);
|
|
561
|
|
562 if ( !(uFlags & 0x40) )
|
|
563 {
|
|
564 array_708_size = 0;
|
|
565 field_E0C = 0;
|
|
566 }
|
|
567 }
|
|
568
|
|
569 //----- (0044F0D8) --------------------------------------------------------
|
|
570 void Game::ToggleFlags(uint uMask)
|
|
571 {
|
|
572 if (uFlags & uMask)
|
|
573 uFlags &= ~uMask;
|
|
574 else
|
|
575 uFlags |= uMask;
|
|
576 }
|
|
577
|
|
578
|
|
579 //----- (0044F07B) --------------------------------------------------------
|
|
580 bool Game::_44F07B()
|
|
581 {
|
|
582 if (!pKeyboardInstance->IsKeyBeingHeld(VK_SHIFT) &&
|
|
583 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) &&
|
|
584 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) ||
|
|
585
|
|
586 (pKeyboardInstance->WasKeyPressed(VK_F11) == 0 &&
|
|
587 pKeyboardInstance->WasKeyPressed(VK_F11)))
|
|
588 return true;
|
|
589 return false;
|
|
590 }
|
|
591
|
|
592 //----- (0044EEA7) --------------------------------------------------------
|
|
593 bool Game::_44EEA7()
|
|
594 {
|
|
595 Game *v1; // esi@1
|
|
596 double v2; // st7@2
|
|
597 float depth; // ST00_4@9
|
|
598 bool result; // eax@9
|
|
599 unsigned int v5; // eax@14
|
|
600 __int64 v6; // kr00_8@21
|
|
601 unsigned int y; // [sp+4h] [bp-24h]@2
|
|
602 unsigned int x; // [sp+8h] [bp-20h]@2
|
|
603 bool v9; // [sp+Ch] [bp-1Ch]@2
|
|
604 stru157 *v10; // [sp+10h] [bp-18h]@2
|
|
605 stru157 *v11; // [sp+14h] [bp-14h]@2
|
|
606 POINT a2; // [sp+20h] [bp-8h]@1
|
|
607
|
|
608 v1 = this;
|
|
609 ++qword_5C6DF0;
|
|
610 pParticleEngine->UpdateParticles();
|
|
611 pMouseInstance->GetCursorPos(&a2);
|
|
612 if ( sub_4637E0_is_there_popup_onscreen() )
|
|
613 {
|
|
614 v11 = &a5;
|
|
615 v10 = &stru_F93E30;
|
|
616 v9 = 0;
|
|
617 x = a2.y;
|
|
618 y = a2.x;
|
|
619 v2 = GetPickDepth();
|
|
620 }
|
|
621 else
|
|
622 {
|
|
623 if ( v1->uFlags2 & 0x10 )
|
|
624 {
|
|
625 v11 = &a5;
|
|
626 v10 = &stru_F93E1C;
|
|
627 }
|
|
628 else
|
|
629 {
|
|
630 static bool __init_flag = false;
|
|
631 static stru157 static_sub_44EEA7_stru157;
|
|
632 if (!__init_flag)
|
|
633 {
|
|
634 __init_flag = true;
|
|
635 static_sub_44EEA7_stru157.field_8 = -1;
|
|
636 static_sub_44EEA7_stru157.field_0 = 0;
|
|
637 static_sub_44EEA7_stru157.field_4 = 2;
|
|
638 static_sub_44EEA7_stru157.field_C = 0;
|
|
639 static_sub_44EEA7_stru157.field_10 = 0;
|
|
640 }
|
|
641 v11 = &a5;
|
|
642 v10 = &static_sub_44EEA7_stru157;
|
|
643 }
|
|
644 v2 = 5120.0;
|
|
645 v9 = 0;
|
|
646 x = a2.y;
|
|
647 y = a2.x;
|
|
648 }
|
|
649 depth = v2;
|
|
650
|
|
651 PickMouse(depth, y, x, v9, v10, v11);
|
|
652 v1->pLightmapBuilder->std__vector_000004_size = 0;
|
|
653 v1->pLightmapBuilder->std__vector_183808_size = 0;
|
|
654 pDecalBuilder->std__vector_pDecals_size = 0;
|
|
655 pDecalBuilder->field_308008 = 0;
|
|
656 result = _44F07B();
|
|
657 if ( result )
|
|
658 {
|
|
659 if ( uFlags & 8 )
|
|
660 LOBYTE(pStru10Instance->field_4) = 0;
|
|
661 if ( pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
662 {
|
|
663 v5 = GetLevelFogColor();
|
|
664 LODWORD(pRenderer->uFogColor) = v5 & 0xFFFFFF;
|
|
665 }
|
|
666 if (uFlags & 0x0400)
|
|
667 uFlags2 |= 0x01;
|
|
668 if ( !pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor && uNumMobileLightsApplied )
|
|
669 {
|
|
670 uFlags2 |= 0x01;
|
|
671 field_E10 = qword_5C6DF0;
|
|
672 }
|
|
673 v6 = qword_5C6DF0 - v1->field_E10;
|
|
674 if ( qword_5C6DF0 - v1->field_E10 == 1 )
|
|
675 v1->uFlags2 |= v6;
|
|
676 if ( v1->uNumStationaryLights_in_pStationaryLightsStack != uNumStationaryLightsApplied )
|
|
677 {
|
|
678 v1->uFlags2 |= 1u;
|
|
679 v1->uNumStationaryLights_in_pStationaryLightsStack = uNumStationaryLightsApplied;
|
|
680 }
|
|
681 _44E904();
|
|
682 LOBYTE(result) = 1;
|
|
683 }
|
|
684 return result;
|
|
685 }
|
|
686 // 519AB4: using guessed type int uNumStationaryLightsApplied;
|
|
687 // 5C6DEC: using guessed type char static_sub_44EEA7_byte_5C6DEC__init_flag;
|
|
688 // 5C6DF0: using guessed type __int64 qword_5C6DF0;
|
|
689 // F93E1C: using guessed type stru157 stru_F93E1C;
|
|
690 // F93E30: using guessed type stru157 stru_F93E30;
|
|
691
|
|
692 //----- (0044EDE4) --------------------------------------------------------
|
|
693 bool Game::_44EDE4(BLVFace *pFace, int *a3)
|
|
694 {
|
|
695 bool result; // eax@1
|
|
696
|
|
697 result = (bool)pGame;
|
|
698 if ( pGame->uFlags2 & 2 && (result = (bool)pFace, pFace->uAttributes & 2) )
|
|
699 {
|
|
700 result = sub_48A959(*a3, 1.0, this->_E28_timed_gamma_strength, -1.0);
|
|
701 *a3 = result;
|
|
702 LOBYTE(result) = 1;
|
|
703 }
|
|
704 else
|
|
705 {
|
|
706 LOBYTE(result) = 0;
|
|
707 }
|
|
708 return result;
|
|
709 }
|
|
710
|
|
711 //----- (0044EE30) --------------------------------------------------------
|
|
712 bool Game::_44EE30(ODMFace *a2, int a3)
|
|
713 {
|
|
714 if (uFlags2 & 0x2 && a2->uFaceAttributes & 0x02)
|
|
715 {
|
|
716 *(int *)a3 = sub_48A959(*(int *)a3, 1.0, _E28_timed_gamma_strength, -1.0);
|
|
717 return true;
|
|
718 }
|
|
719 else
|
|
720 return false;
|
|
721 }
|
|
722
|
|
723
|
|
724 //----- (004645FA) --------------------------------------------------------
|
|
725 void Game::Deinitialize()
|
|
726 {
|
|
727 struct tagRECT Rect; // [sp+0h] [bp-10h]@6
|
|
728
|
2
|
729 if (pAsyncMouse)
|
0
|
730 pAsyncMouse->Suspend();
|
2
|
731 if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard)
|
0
|
732 pAsyncKeyboard->Suspend();
|
|
733 WriteWindowsRegistryInt("startinwindow", pRenderer->bWindowMode);
|
|
734 if ( GetWindowRect(hWnd, &Rect) && pRenderer->bWindowMode )
|
|
735 {
|
|
736 WriteWindowsRegistryInt("window X", Rect.left);
|
|
737 WriteWindowsRegistryInt("window Y", Rect.top);
|
|
738 }
|
|
739 WriteWindowsRegistryInt("debug flags", stru_51076C.registry_debug_flags);
|
|
740 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
|
|
741 pItemsTable->Release();
|
|
742 pNPCStats->Release();
|
2
|
743 if (pAsyncKeyboard)
|
|
744 pAsyncKeyboard->Release();
|
|
745 if (pAsyncMouse)
|
|
746 pAsyncMouse->Release();
|
|
747 if (pMouse)
|
0
|
748 pMouse->Deactivate();
|
2
|
749
|
0
|
750 pAudioPlayer->Release();
|
|
751 pNew_LOD->FreeSubIndexAndIO();
|
|
752 pGames_LOD->FreeSubIndexAndIO();
|
|
753 ClipCursor(0);
|
|
754 Game::Destroy();
|
|
755 }
|
|
756
|
|
757 //----- (0044EE7C) --------------------------------------------------------
|
|
758 bool Game::draw_debug_outlines()
|
|
759 {
|
|
760 if (uFlags & 0x04)
|
|
761 {
|
|
762 pLightmapBuilder->DrawDebugOutlines(-1);
|
|
763 pDecalBuilder->DrawDecalDebugOutlines();
|
|
764 }
|
|
765 return true;
|
|
766 }
|
|
767
|
|
768 //----- (0044EC23) --------------------------------------------------------
|
|
769 int Game::_44EC23(stru148 *a2, int *a3, signed int a4)
|
|
770 {
|
|
771 double v4; // st7@4
|
2
|
772 //double v5; // ST00_8@4
|
0
|
773 signed int v6; // eax@5
|
2
|
774 //double v7; // ST00_8@6
|
0
|
775 signed int result; // eax@8
|
2
|
776 //double v9; // ST00_8@9
|
|
777 //double v10; // ST00_8@11
|
0
|
778 float a2a; // [sp+14h] [bp+8h]@4
|
|
779 float a3a; // [sp+18h] [bp+Ch]@4
|
|
780 float a3b; // [sp+18h] [bp+Ch]@6
|
|
781 float a4a; // [sp+1Ch] [bp+10h]@9
|
|
782 float a4b; // [sp+1Ch] [bp+10h]@11
|
|
783
|
|
784 if ( this->uFlags2 & 2 && a2->field_59 == 5 && a2->pODMFace->uFaceAttributes & 2 )
|
|
785 {
|
|
786 v4 = (double)a4;
|
|
787 a2a = v4;
|
|
788 *a3 |= 2u;
|
|
789 a3a = (1.0 - this->_E28_timed_gamma_strength) * v4;
|
2
|
790 //v5 = a3a + 6.7553994e15;
|
|
791 //if ( SLODWORD(v5) >= 0 )
|
3
|
792 if (floorf(a3a + 0.5f) >= 0 )
|
0
|
793 {
|
|
794 a3b = (1.0 - this->_E28_timed_gamma_strength) * a2a;
|
2
|
795 //v7 = a3b + 6.7553994e15;
|
|
796 //v6 = LODWORD(v7);
|
3
|
797 v6 = floorf(a3b + 0.5f);
|
0
|
798 }
|
|
799 else
|
|
800 {
|
|
801 v6 = 0;
|
|
802 }
|
|
803 if ( a4 >= v6 )
|
|
804 {
|
2
|
805 a4a = (1.0 - _E28_timed_gamma_strength) * a2a;
|
|
806 //v9 = a4a + 6.7553994e15;
|
|
807 //if ( SLODWORD(v9) >= 0 )
|
3
|
808 if (floorf(a4a + 0.5f) >= 0)
|
0
|
809 {
|
2
|
810 a4b = (1.0 - _E28_timed_gamma_strength) * a2a;
|
|
811 //v10 = a4b + 6.7553994e15;
|
|
812 //result = LODWORD(v10);
|
3
|
813 result = floorf(a4b + 0.5f);
|
0
|
814 }
|
|
815 else
|
|
816 {
|
|
817 result = 0;
|
|
818 }
|
|
819 }
|
|
820 else
|
|
821 {
|
|
822 result = a4;
|
|
823 }
|
|
824 }
|
|
825 else
|
|
826 {
|
|
827 result = -1;
|
|
828 }
|
|
829 return result;
|
|
830 }
|
|
831
|
|
832
|
|
833
|
|
834 //----- (00465C8B) --------------------------------------------------------
|
|
835 Game *Game::Create()
|
|
836 {
|
|
837 return new Game;
|
|
838 }
|
|
839
|
|
840 //----- (00465CF3) --------------------------------------------------------
|
|
841 void Game::Destroy()
|
|
842 {
|
|
843 if (pGame)
|
|
844 delete pGame;
|
|
845 pGame = nullptr;
|
|
846 }
|
|
847
|
|
848 //----- (0044ED0A) --------------------------------------------------------
|
|
849 signed int Game::_44ED0A(BLVFace *a2, int *a3, signed int a4)
|
|
850 {
|
|
851 double v4; // st7@3
|
|
852 double v5; // ST00_8@3
|
|
853 signed int v6; // eax@4
|
2
|
854 //double v7; // ST00_8@5
|
0
|
855 signed int result; // eax@7
|
|
856 double v9; // ST00_8@8
|
2
|
857 //double v10; // ST00_8@10
|
0
|
858 float v11; // [sp+14h] [bp+8h]@3
|
|
859 float v12; // [sp+18h] [bp+Ch]@3
|
|
860 float v13; // [sp+18h] [bp+Ch]@5
|
|
861 float v14; // [sp+1Ch] [bp+10h]@8
|
|
862 float v15; // [sp+1Ch] [bp+10h]@10
|
|
863
|
|
864 if ( this->uFlags2 & 2 && a2->uAttributes & 2 )
|
|
865 {
|
|
866 v4 = (double)a4;
|
|
867 v11 = v4;
|
|
868 *a3 |= 2u;
|
|
869 v12 = (1.0 - this->_E28_timed_gamma_strength) * v4;
|
|
870 v5 = v12 + 6.7553994e15;
|
|
871 if ( SLODWORD(v5) >= 0 )
|
|
872 {
|
|
873 v13 = (1.0 - this->_E28_timed_gamma_strength) * v11;
|
2
|
874 //v7 = v13 + 6.7553994e15;
|
|
875 //v6 = LODWORD(v7);
|
3
|
876 v6 = floorf(v13 + 0.5f);
|
0
|
877 }
|
|
878 else
|
|
879 {
|
|
880 v6 = 0;
|
|
881 }
|
|
882 if ( a4 >= v6 )
|
|
883 {
|
2
|
884 v14 = (1.0 - _E28_timed_gamma_strength) * v11;
|
0
|
885 v9 = v14 + 6.7553994e15;
|
|
886 if ( SLODWORD(v9) >= 0 )
|
|
887 {
|
2
|
888 v15 = (1.0 - _E28_timed_gamma_strength) * v11;
|
|
889 //v10 = v15 + 6.7553994e15;
|
|
890 //result = LODWORD(v10);
|
3
|
891 result = floorf(v15 + 0.5f);
|
0
|
892 }
|
|
893 else
|
|
894 {
|
|
895 result = 0;
|
|
896 }
|
|
897 }
|
|
898 else
|
|
899 {
|
|
900 result = a4;
|
|
901 }
|
|
902 }
|
|
903 else
|
|
904 {
|
|
905 result = -1;
|
|
906 }
|
|
907 return result;
|
|
908 }
|
|
909
|
|
910
|
|
911 //----- (0044E4B7) --------------------------------------------------------
|
|
912 Game::Game()
|
|
913 {
|
|
914 uNumStationaryLights = 0;
|
|
915 array_708_size = 0;
|
|
916 field_E0C = 0;
|
|
917 field_E10 = 0;
|
|
918 uNumStationaryLights_in_pStationaryLightsStack = 0;
|
|
919 bGammaControlInitialized = false;
|
|
920 uFlags = 0;
|
|
921 uFlags2 = 0;
|
|
922 uSomeGammaStartTime = 0;
|
|
923 uSomeGammaDeltaTime = 0;
|
|
924
|
|
925 pThreadWardInstance = new ThreadWard;
|
|
926 pParticleEngine = new ParticleEngine;
|
|
927 pMouseInstance = new Mouse(pThreadWardInstance);
|
|
928 pLightmapBuilder = new LightmapBuilder;
|
|
929 pVisInstance = new Vis;
|
|
930 pStru6Instance = new stru6;
|
|
931 pIndoorCameraD3D = new IndoorCameraD3D;
|
|
932 pStru9Instance = new stru9;
|
|
933 pStru10Instance = new stru10;
|
|
934 pStru11Instance = new stru11;
|
|
935 pStru12Instance = new stru12(pStru11Instance);
|
|
936 pCShow = new CShow;
|
|
937 pKeyboardInstance = new Keyboard;
|
|
938 pGammaController = new GammaController;
|
|
939
|
|
940 uFlags |= 0x0800;
|
|
941 uFlags2 |= 0x24;
|
|
942
|
|
943 _44F0FD();
|
|
944
|
|
945 bWinNT4_0 = false;
|
|
946 if (pVersion->pVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
|
|
947 pVersion->pVersionInfo.dwMajorVersion == 4)
|
|
948 bWinNT4_0 = true;
|
|
949 }
|
|
950
|
|
951 //----- (0044E7F3) --------------------------------------------------------
|
|
952 Game::~Game()
|
|
953 {
|
|
954 if (pGammaController)
|
|
955 delete pGammaController;
|
|
956 if (pKeyboardInstance)
|
|
957 delete pKeyboardInstance;
|
|
958 if (pCShow)
|
|
959 delete pCShow;
|
|
960 if (pStru12Instance)
|
|
961 delete pStru12Instance;
|
|
962 if (pStru11Instance)
|
|
963 delete pStru11Instance;
|
|
964 if (pStru10Instance)
|
|
965 delete pStru10Instance;
|
|
966 if (pStru9Instance)
|
|
967 delete pStru9Instance;
|
|
968 if (pIndoorCameraD3D)
|
|
969 delete pIndoorCameraD3D;
|
|
970 if (pStru6Instance)
|
|
971 delete pStru6Instance;
|
|
972 if (pVisInstance)
|
|
973 delete pVisInstance;
|
|
974 if (pLightmapBuilder)
|
|
975 delete pLightmapBuilder;
|
|
976 if (pMouseInstance)
|
|
977 delete pMouseInstance;
|
|
978 if (pParticleEngine)
|
|
979 delete pParticleEngine;
|
|
980 if (pThreadWardInstance)
|
|
981 delete pThreadWardInstance;
|
|
982 }
|
|
983
|
|
984 //----- (0044E904) --------------------------------------------------------
|
|
985 void Game::_44E904()
|
|
986 {
|
|
987 Game *v1; // esi@1
|
|
988 unsigned __int64 v2; // qax@1
|
|
989 unsigned int v3; // ecx@1
|
|
990 int v4; // edi@1
|
|
991 unsigned __int8 v5; // cf@7
|
|
992 double v6; // st7@13
|
|
993 double v7; // st7@15
|
|
994 signed __int64 v8; // [sp+Ch] [bp-8h]@1
|
|
995
|
|
996 v1 = this;
|
|
997 v2 = pEventTimer->Time();
|
|
998 v4 = (v2 - v1->uSomeGammaStartTime) >> 32;
|
|
999 v3 = v2 - LODWORD(v1->uSomeGammaStartTime);
|
|
1000 v8 = v2 - v1->uSomeGammaStartTime;
|
|
1001 if ( v4 < 0
|
|
1002 || SHIDWORD(v2) < ((unsigned int)v2 < LODWORD(v1->uSomeGammaStartTime)) + HIDWORD(v1->uSomeGammaStartTime) | v4 == 0
|
|
1003 && v3 <= 0x80 )
|
|
1004 {
|
|
1005 if ( v4 > 0 || v4 >= 0 )
|
|
1006 goto LABEL_12;
|
|
1007 v3 = 0;
|
|
1008 v4 = 0;
|
|
1009 }
|
|
1010 else
|
|
1011 {
|
|
1012 if ( v1->uSomeGammaDeltaTime )
|
|
1013 {
|
|
1014 LODWORD(v1->uSomeGammaDeltaTime) = 0;
|
|
1015 HIDWORD(v1->uSomeGammaDeltaTime) = 0;
|
|
1016 }
|
|
1017 else
|
|
1018 {
|
|
1019 LODWORD(v1->uSomeGammaDeltaTime) = v3;
|
|
1020 HIDWORD(v1->uSomeGammaDeltaTime) = v4;
|
|
1021 }
|
|
1022 v5 = __CFADD__(v3, -128);
|
|
1023 v3 -= 128;
|
|
1024 v4 = v5 + v4 - 1;
|
|
1025 }
|
|
1026 v1->uSomeGammaStartTime = v2;
|
|
1027 v8 = __PAIR__(v4, v3);
|
|
1028 LABEL_12:
|
|
1029 if ( v1->uSomeGammaDeltaTime )
|
|
1030 v6 = (double)(signed __int64)(v1->uSomeGammaDeltaTime - __PAIR__(v4, v3));
|
|
1031 else
|
|
1032 v6 = (double)v8;
|
|
1033 v7 = v6 * 0.0078125;
|
|
1034 if ( v7 < 0.0 || v7 <= 1.0 )
|
|
1035 {
|
|
1036 if ( v7 < 0.0 )
|
|
1037 v7 = 0.0;
|
|
1038 }
|
|
1039 else
|
|
1040 {
|
|
1041 v7 = 1.0;
|
|
1042 }
|
|
1043 if ( pRenderer->pRenderD3D )
|
|
1044 v1->_E28_timed_gamma_strength = v7;
|
|
1045 else
|
|
1046 v1->_E28_timed_gamma_strength = (1.0 - 0.5) * v7 + 0.5;
|
|
1047 }
|
|
1048
|
|
1049 //----- (0044EA17) --------------------------------------------------------
|
|
1050 bool Game::InitializeGammaController()
|
|
1051 {
|
|
1052 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
|
|
1053 pVersion->pVersionInfo.dwMajorVersion != 4 )
|
|
1054 pGammaController->InitializeFromSurface(pRenderer->pFrontBuffer4);
|
|
1055
|
|
1056 bGammaControlInitialized = true;
|
|
1057 uSomeGammaStartTime = pEventTimer->Time();
|
|
1058 return true;
|
|
1059 }
|
|
1060
|
|
1061 //----- (0044EA5E) --------------------------------------------------------
|
|
1062 char Game::PickMouse(float fPickDepth, unsigned int uMouseX, unsigned int uMouseY, bool bOutline, stru157 *a5, stru157 *a6)
|
|
1063 {
|
|
1064 char result; // al@3
|
|
1065 std::string v10; // [sp-4h] [bp-24h]@5
|
|
1066 float v11; // [sp+4h] [bp-1Ch]@10
|
|
1067 float v12; // [sp+8h] [bp-18h]@10
|
|
1068 const char *v13; // [sp+Ch] [bp-14h]@5
|
|
1069 int v14; // [sp+10h] [bp-10h]@5
|
|
1070 std::string *v15; // [sp+18h] [bp-8h]@5
|
|
1071 int a3; // [sp+1Fh] [bp-1h]@5
|
|
1072
|
|
1073 auto v7 = this;
|
|
1074 if (!uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions
|
|
1075 && pRenderer->pRenderD3D)
|
|
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 }
|
|
1100 // 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
|
|
1101
|
|
1102 //----- (0044EB12) --------------------------------------------------------
|
|
1103 bool Game::_44EB12(bool bOutline, stru157 *a3, stru157 *a4)
|
|
1104 {
|
|
1105 if ( !uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions
|
|
1106 && pVisInstance
|
|
1107 && pRenderer->pRenderD3D )
|
|
1108 {
|
|
1109 bool r = pVisInstance->_4C05CC(&pVisInstance->stru1, a3, a4);
|
|
1110
|
|
1111 if (bOutline)
|
|
1112 OutlineSelection();
|
|
1113 return r;
|
|
1114 }
|
|
1115 return false;
|
|
1116 }
|
|
1117 // 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
|
|
1118
|
|
1119 //----- (0044EB5A) --------------------------------------------------------
|
|
1120 void Game::OutlineSelection()
|
|
1121 {
|
|
1122 Vis *v1; // eax@1
|
|
1123 Vis_stru1_stru0 *v2; // eax@3
|
|
1124 void *v3; // edx@9
|
|
1125 int v4; // eax@10
|
|
1126 int v5; // eax@11
|
|
1127 int v6; // eax@14
|
|
1128 int v7; // eax@15
|
|
1129 const char *v9; // [sp-8h] [bp-14h]@8
|
|
1130 int v10; // [sp-4h] [bp-10h]@8
|
|
1131 char v11; // [sp+0h] [bp-Ch]@18
|
|
1132 int a3; // [sp+Ah] [bp-2h]@8
|
|
1133
|
|
1134 v1 = this->pVisInstance;
|
|
1135 if ( v1 )
|
|
1136 {
|
|
1137 v2 = (Vis_stru1_stru0 *)((signed int)v1->stru1.uNumPointers <= 0 ? 0 : v1->stru1.array_1804[0]);
|
|
1138 if ( v2 )
|
|
1139 {
|
|
1140 if ( v2->uObjectType == 1 )
|
|
1141 {
|
|
1142 MessageBoxW(nullptr, L"Sprite outline currently Unsupported", nullptr, 0);
|
|
1143 ExitProcess(0);
|
|
1144 }
|
|
1145
|
|
1146 if ( v2->uObjectType == 2 )
|
|
1147 {
|
|
1148 v3 = v2->pObjectInfo; // TODO 2 objects for indoor/outdoor
|
|
1149 // some clues in header for Vis_stru1_stru0
|
|
1150 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
1151 {
|
|
1152 v4 = *((int *)v3 + 11);
|
|
1153 if ( v4 & 0x10000 )
|
|
1154 v5 = v4 & 0xFFFEFFFF;
|
|
1155 else
|
|
1156 v5 = v4 | 0x10000;
|
|
1157 *((int *)v3 + 11) = v5;
|
|
1158 }
|
|
1159 else
|
|
1160 {
|
|
1161 v6 = *((int *)v3 + 7);
|
|
1162 if ( v6 & 0x10000 )
|
|
1163 v7 = v6 & 0xFFFEFFFF;
|
|
1164 else
|
|
1165 v7 = v6 | 0x10000;
|
|
1166 *((int *)v3 + 7) = v7;
|
|
1167 }
|
|
1168 }
|
|
1169 else
|
|
1170 {
|
|
1171 MessageBoxW(nullptr, L"Undefined CObjectInfo type requested in CGame::outline_selection()", nullptr, 0);
|
|
1172 ExitProcess(0);
|
|
1173 }
|
|
1174 }
|
|
1175 }
|
|
1176 } |