annotate Game.cpp @ 978:9334a8c59c8d

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