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