annotate Game.cpp @ 189:038a4d09406f

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