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