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