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