annotate Game.cpp @ 1638:ccde94f02b75

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