Mercurial > mm7
annotate Indoor.cpp @ 2088:6c0dbff26f5d
m
author | Ritor1 |
---|---|
date | Fri, 06 Dec 2013 11:14:33 +0600 |
parents | 0d535449c04f |
children | 48b790721bdc |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1132
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1132
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1132
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1132
diff
changeset
|
4 |
1016 | 5 #include "LightmapBuilder.h" |
6 #include "DecalBuilder.h" | |
7 #include "stru9.h" | |
8 #include "stru10.h" | |
1078 | 9 #include "stru367.h" |
1016 | 10 |
11 #include "BSPModel.h" | |
0 | 12 #include "Outdoor.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
13 #include "SpriteObject.h" |
0 | 14 #include "Events.h" |
15 #include "Game.h" | |
16 #include "Viewport.h" | |
2044 | 17 #include "Timer.h" |
0 | 18 #include "Party.h" |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2027
diff
changeset
|
19 #include "OurMath.h" |
0 | 20 #include "LOD.h" |
21 #include "DecorationList.h" | |
22 #include "ObjectList.h" | |
23 #include "Actor.h" | |
24 #include "Chest.h" | |
25 #include "GUIProgressBar.h" | |
26 #include "stru123.h" | |
27 #include "AudioPlayer.h" | |
28 #include "Log.h" | |
29 #include "TurnEngine.h" | |
30 #include "PaletteManager.h" | |
31 #include "MapInfo.h" | |
1262 | 32 #include "Lights.h" |
0 | 33 |
34 #include "mm7_data.h" | |
831 | 35 #include "MM7.h" |
1295 | 36 #include "Sprites.h" |
37 #include "Game.h" | |
38 #include "stru6.h" | |
39 #include "ParticleEngine.h" | |
40 #include "Outdoor_stuff.h" | |
1297 | 41 #include "texts.h" |
42 #include "GUIWindow.h" | |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1809
diff
changeset
|
43 #include "Level/Decoration.h" |
0 | 44 |
45 | |
46 | |
47 | |
48 | |
49 IndoorLocation *pIndoor = new IndoorLocation; | |
50 BLVRenderParams *pBLVRenderParams = new BLVRenderParams; | |
51 | |
52 struct DecorationList *pDecorationList; | |
53 | |
1202 | 54 std::array<LevelDecoration, 3000> pLevelDecorations; |
0 | 55 size_t uNumLevelDecorations; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
56 LevelDecoration* activeLevelDecoration; |
0 | 57 |
58 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null; | |
59 | |
60 stru320 stru_F8AD28; // idb | |
61 stru337 stru_F81018; | |
1376 | 62 BspRenderer_PortalViewportData stru_F8A590; |
0 | 63 BspRenderer *pBspRenderer = new BspRenderer; // idb |
1546 | 64 stru141_actor_collision_object stru_721530; |
1202 | 65 std::array<stru352, 480> stru_F83B80; |
0 | 66 |
67 | |
68 | |
69 unsigned __int16 pDoorSoundIDsByLocationID[78] = | |
70 { | |
71 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, | |
72 300, 300, 300, 404, 302, 306, 308, 304, 308, 302, 400, 302, 300, | |
73 308, 308, 306, 308, 308, 304, 300, 404, 406, 300, 400, 406, 404, | |
74 306, 302, 408, 304, 300, 300, 300, 300, 300, 300, 300, 300, 300, | |
75 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 404, 304, | |
76 400, 300, 300, 404, 304, 400, 300, 300, 404, 304, 400, 300, 300 | |
77 }; | |
78 | |
79 | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
80 std::array<const char *, 11> _4E6BDC_loc_names= |
1006 | 81 { |
82 "mdt12.blv", | |
83 "d18.blv", | |
84 "mdt14.blv", | |
85 "d37.blv", | |
86 "mdk01.blv", | |
87 "mdt01.blv", | |
88 "mdr01.blv", | |
89 "mdt10.blv", | |
90 "mdt09.blv", | |
91 "mdt15.blv", | |
92 "mdt11.blv" | |
93 }; | |
94 | |
0 | 95 |
96 //----- (0043F39E) -------------------------------------------------------- | |
1641 | 97 void __fastcall PrepareDrawLists_BLV() |
0 | 98 { |
99 //int *v1; // ecx@1 | |
100 //double v2; // ST30_8@3 | |
101 //double v3; // ST30_8@6 | |
102 //double v4; // ST28_8@6 | |
103 int v5; // eax@4 | |
707 | 104 //int v6; // eax@7 |
0 | 105 unsigned int v7; // ebx@8 |
106 BLVSector *v8; // esi@8 | |
707 | 107 //unsigned __int16 *v9; // edi@8 |
108 //int i; // [sp+18h] [bp-8h]@7 | |
0 | 109 //unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3 |
707 | 110 //signed int v12; // [sp+1Ch] [bp-4h]@8 |
0 | 111 |
1641 | 112 pBLVRenderParams->Reset(); |
0 | 113 pMobileLightsStack->uNumLightsActive = 0; |
114 //uNumMobileLightsApplied = 0; | |
115 uNumDecorationsDrawnThisFrame = 0; | |
116 uNumSpritesDrawnThisFrame = 0; | |
117 uNumBillboardsToDraw = 0; | |
707 | 118 |
119 if ( !byte_4D864C || !(pGame->uFlags & 0x1000) ) // lightspot around party | |
0 | 120 { |
121 //v2 = pParty->flt_TorchlightColorB + 6.7553994e15; | |
122 //v11 = LOBYTE(v2); | |
123 v5 = 800; | |
124 if (pParty->TorchlightActive()) | |
707 | 125 v5 *= pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; |
0 | 126 //LOBYTE(v1) = byte_4E94D0; |
127 //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; | |
128 //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
129 pMobileLightsStack->AddLight(pGame->pIndoorCameraD3D->vPartyPos.x, |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
130 pGame->pIndoorCameraD3D->vPartyPos.y, |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
131 pGame->pIndoorCameraD3D->vPartyPos.z, |
707 | 132 pBLVRenderParams->uPartySectorID, |
133 v5, | |
134 floorf(pParty->flt_TorchlightColorR + 0.5f), | |
135 floorf(pParty->flt_TorchlightColorG + 0.5f), | |
136 floorf(pParty->flt_TorchlightColorB + 0.5f), | |
137 byte_4E94D0); | |
0 | 138 } |
139 PrepareBspRenderList_BLV(); | |
140 PrepareItemsRenderList_BLV(); | |
141 PrepareActorRenderList_BLV(); | |
707 | 142 |
143 //v6 = 0; | |
144 for (uint i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i) | |
0 | 145 { |
707 | 146 v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]; |
147 //v12 = 0; | |
148 v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]]; | |
149 //v9 = v8->pDecorationIDs; | |
150 | |
151 for (uint j = 0; j < v8->uNumDecorations; ++j) | |
152 //if ( v8->uNumDecorations > 0 ) | |
0 | 153 { |
707 | 154 // do |
155 PrepareDecorationsRenderList_BLV(v8->pDecorationIDs[j], v7); | |
156 // while ( v12 < v8->uNumDecorations ); | |
0 | 157 } |
707 | 158 //v6 = i + 1; |
0 | 159 } |
657 | 160 FindBillboardsLightLevels_BLV(); |
0 | 161 pGame->PrepareBloodsplats(); |
162 } | |
163 | |
164 | |
165 | |
166 //----- (004407D9) -------------------------------------------------------- | |
1641 | 167 void BLVRenderParams::Reset() |
0 | 168 { |
1641 | 169 //IndoorLocation_drawstru *v2; // ebx@1 |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
170 //int v4; // ST08_4@1 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
171 //int v5; // ST04_4@1 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
172 //int v6; // ST00_4@1 |
0 | 173 int v7; // eax@1 |
174 int v8; // ST08_4@2 | |
175 int v9; // ST04_4@2 | |
176 int v10; // ST00_4@2 | |
1641 | 177 //unsigned int v11; // edi@4 |
178 //unsigned int v12; // ecx@4 | |
179 //int v13; // edx@4 | |
180 //signed int v14; // ecx@4 | |
181 //unsigned int v15; // edx@4 | |
182 //unsigned int v16; // eax@4 | |
0 | 183 double v17; // st7@5 |
184 int v18; // eax@5 | |
185 double v19; // st7@5 | |
186 int v20; // eax@5 | |
187 double v21; // st7@5 | |
188 int v22; // eax@5 | |
189 unsigned int v23; // edx@5 | |
190 unsigned int v24; // ecx@5 | |
191 int v25; // eax@5 | |
192 int v26; // eax@5 | |
193 signed int v27; // eax@6 | |
1641 | 194 //int result; // eax@6 |
0 | 195 int v29; // [sp+24h] [bp+8h]@5 |
196 | |
1641 | 197 this->field_0_timer_ = pEventTimer->uTotalGameTimeElapsed; |
198 | |
1642 | 199 pGame->pIndoorCameraD3D->debug_flags = 0; |
1641 | 200 if (viewparams->draw_sw_outlines) |
1642 | 201 pGame->pIndoorCameraD3D->debug_flags |= BLV_RENDER_DRAW_SW_OUTLINES; |
1641 | 202 if (viewparams->draw_d3d_outlines) |
1642 | 203 pGame->pIndoorCameraD3D->debug_flags |= BLV_RENDER_DRAW_D3D_OUTLINES; |
1641 | 204 |
205 //v2 = a2; | |
206 //this->field_0_timer_ = a2->field_0_timer; | |
207 //this->uFlags = a2->uFlags; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
208 //this->vPartyPos.x = a2->vPosition.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
209 //this->vPartyPos.y = a2->vPosition.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
210 //this->vPartyPos.z = a2->vPosition.z; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
211 //v4 = this->vPartyPos.z; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
212 //v5 = this->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
213 //this->sPartyRotY = a2->sRotationY; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
214 //v6 = this->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
215 //this->sPartyRotX = a2->sRotationX; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
216 v7 = pIndoor->GetSector(pGame->pIndoorCameraD3D->vPartyPos.x, |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
217 pGame->pIndoorCameraD3D->vPartyPos.y, |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
218 pGame->pIndoorCameraD3D->vPartyPos.z); |
1006 | 219 this->uPartySectorID = v7; |
0 | 220 if ( !v7 ) |
221 { | |
1983 | 222 //__debugbreak(); // shouldnt happen, please provide savegame |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
223 /*v8 = this->vPartyPos.z; |
1006 | 224 this->vPartyPos.x = pParty->vPosition.x; |
0 | 225 v9 = pParty->vPosition.y; |
1006 | 226 v10 = this->vPartyPos.x; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
227 this->vPartyPos.y = pParty->vPosition.y;*/ |
1983 | 228 this->uPartySectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); |
0 | 229 } |
230 if ( pRenderer->pRenderD3D ) | |
231 { | |
1642 | 232 //this->sCosineY = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); |
233 //this->sSineY = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); | |
234 //this->sCosineNegX = stru_5C6E00->Cos(-pGame->pIndoorCameraD3D->sRotationX); | |
235 //this->sSineNegX = stru_5C6E00->Sin(-pGame->pIndoorCameraD3D->sRotationX); | |
236 //this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); | |
237 //this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); | |
238 //this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); | |
239 //this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); | |
1641 | 240 this->field_64 = pViewport->field_30; |
241 | |
242 this->uViewportX = pViewport->uScreen_TL_X; | |
243 this->uViewportY = pViewport->uScreen_TL_Y; | |
244 this->uViewportZ = pViewport->uScreen_BR_X; | |
245 this->uViewportW = pViewport->uScreen_BR_Y; | |
246 | |
247 this->uViewportWidth = uViewportZ - uViewportX + 1; | |
248 this->uViewportHeight = uViewportW - uViewportY + 1; | |
249 this->uViewportCenterX = (uViewportZ + uViewportX) / 2; | |
250 this->uViewportCenterY = (uViewportY + uViewportW) / 2; | |
0 | 251 } |
252 else | |
253 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
254 __debugbreak(); // no sw |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
255 /*this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY); |
1006 | 256 this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY); |
257 this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX); | |
258 this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX); | |
259 v17 = cos((double)-this->sPartyRotY * 0.0030664064); | |
260 v18 = this->sPartyRotY; | |
261 this->fCosineY = v17; | |
0 | 262 v19 = sin((double)-v18 * 0.0030664064); |
1006 | 263 v20 = this->sPartyRotX; |
264 this->fSineY = v19; | |
0 | 265 v21 = cos((double)-v20 * 0.0030664064); |
1006 | 266 v22 = this->sPartyRotX; |
267 this->fCosineNegX = v21; | |
268 this->fSineNegX = sin((double)-v22 * 0.0030664064); | |
269 v23 = this->uViewportX; | |
270 this->field_64 = a2->field_3C; | |
271 v24 = this->uViewportZ; | |
272 this->field_70 = this->uViewportZ - v23 + 1; | |
273 v25 = this->uViewportW - this->uViewportY + 1; | |
274 this->uViewportHeight = v25; | |
0 | 275 v29 = v25; |
1006 | 276 v26 = this->field_64; |
277 this->uViewportCenterX = (signed int)(v24 + v23) >> 1; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
278 this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);*/ |
0 | 279 } |
1641 | 280 //v27 = (unsigned int)(signed __int64)((double)this->uViewportWidth * 0.5 |
281 // / tan((double)(v2->fov_deg >> 1) * 0.01745329) | |
282 // + 0.5) << 16; | |
283 extern float _calc_fov(int viewport_width, int angle_degree); | |
284 this->fov_rad_fixpoint = fixpoint_from_int(_calc_fov(uViewportWidth, 65), 0); | |
285 this->fov_rad_inv_fixpoint = 0x100000000i64 / this->fov_rad_fixpoint; | |
286 this->pRenderTarget = pRenderer->pTargetSurface; | |
287 this->uTargetWidth = 640; | |
288 this->uTargetHeight = 480; | |
289 this->pTargetZBuffer = pRenderer->pActiveZBuffer; | |
1006 | 290 this->field_8C = 0; |
291 this->field_84 = 0; | |
292 this->uNumFacesRenderedThisFrame = 0; | |
293 this->field_88 = 0; | |
0 | 294 pBLVRenderParams->field_90 = 64; |
295 pBLVRenderParams->field_94 = 6; | |
296 } | |
297 | |
298 //----- (00440B44) -------------------------------------------------------- | |
299 void IndoorLocation::ExecDraw(bool bD3D) | |
300 { | |
301 int v2; // eax@3 | |
795 | 302 //IndoorCameraD3D_Vec4 *v3; // edx@4 |
303 //unsigned int v5; // ecx@9 | |
304 //RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4 | |
0 | 305 |
306 if (bD3D) | |
307 { | |
308 pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
309 for (uint i = 0; i < pBspRenderer->num_faces; ++i) |
0 | 310 { |
1187 | 311 //v2 = pBspRenderer->faces[i].uNodeID; |
312 if (pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].viewing_portal_id == -1) | |
795 | 313 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, nullptr, 4, nullptr); |
1187 | 314 else |
315 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].std__vector_0007AC, 4, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].pPortalBounding); | |
0 | 316 } |
317 } | |
795 | 318 else for (uint j = 0; j < pBspRenderer->num_faces; ++j ) |
0 | 319 { |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
320 __debugbreak(); // no SW |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
321 //pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].PortalScreenData; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
322 //IndoorLocation::ExecDraw_sw(pBspRenderer->faces[j].uFaceID); |
0 | 323 } |
324 } | |
325 | |
1641 | 326 |
327 /* | |
0 | 328 //----- (00440BED) -------------------------------------------------------- |
329 void __fastcall sub_440BED(IndoorLocation_drawstru *_this) | |
330 { | |
331 unsigned __int16 *v1; // edi@7 | |
1074 | 332 BspRenderer_stru0 *v2; // esi@8 |
0 | 333 int v3; // ecx@9 |
334 unsigned int v4; // edx@9 | |
1074 | 335 short *v5; // eax@10 |
0 | 336 signed int v6; // [sp+8h] [bp-8h]@7 |
337 int v7; // [sp+Ch] [bp-4h]@8 | |
1074 | 338 short *v8; |
0 | 339 |
340 PrepareDrawLists_BLV(_this); | |
341 if (pBLVRenderParams->uPartySectorID) | |
342 IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0); | |
343 pRenderer->DrawBillboardList_BLV(); | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
344 |
1641 | 345 if ( !pRenderer->pRenderD3D ) |
0 | 346 { |
486 | 347 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_D3D_OUTLINES) |
348 pBspRenderer->DrawFaceOutlines(); | |
349 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES) | |
0 | 350 { |
351 v1 = pBLVRenderParams->pRenderTarget; | |
1074 | 352 v7 = 0; |
353 for(int i=0; i < pBspRenderer->num_nodes; i++) | |
354 { | |
355 BspRenderer_stru0 *pNode = &pBspRenderer->nodes[i]; | |
1376 | 356 v4 = pRenderer->uTargetSurfacePitch * pNode->PortalScreenData._viewport_space_y; |
357 if ( pNode->PortalScreenData._viewport_space_y <= pNode->PortalScreenData._viewport_space_w ) | |
1074 | 358 { |
359 //v5 = (char *)&pBspRenderer->nodes[0].field_C.array_3D8[pNode->field_C._viewport_space_y + v7]; | |
1376 | 360 v5 = &pNode->PortalScreenData.viewport_right_side[pNode->PortalScreenData._viewport_space_y]; |
361 v8 = &pNode->PortalScreenData.viewport_left_side[pNode->PortalScreenData._viewport_space_y]; | |
1074 | 362 do |
363 { | |
364 v1[v4 + *v8] = 255; | |
1376 | 365 ++pNode->PortalScreenData._viewport_space_y; |
1074 | 366 v1[v4 + *v5] = 255; |
367 v4 += pRenderer->uTargetSurfacePitch; | |
368 ++v5; | |
369 ++v8; | |
370 } | |
1376 | 371 while ( pNode->PortalScreenData._viewport_space_y <= pNode->PortalScreenData._viewport_space_w ); |
1074 | 372 } |
373 } | |
0 | 374 } |
1641 | 375 } |
0 | 376 } |
1641 | 377 */ |
0 | 378 |
379 | |
380 | |
381 | |
382 //----- (00441BD4) -------------------------------------------------------- | |
383 void IndoorLocation::Draw() | |
384 { | |
186 | 385 //int v0; // eax@1 |
1641 | 386 //IndoorLocation_drawstru _this; // [sp+0h] [bp-4Ch]@5 |
0 | 387 int v2; // [sp+44h] [bp-8h]@5 |
388 int v3; // [sp+48h] [bp-4h]@5 | |
389 | |
1641 | 390 /*_this.uFlags = 0; |
186 | 391 if (viewparams->draw_sw_outlines) |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1583
diff
changeset
|
392 _this.uFlags |= BLV_RENDER_DRAW_SW_OUTLINES; |
186 | 393 if (viewparams->draw_d3d_outlines) |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1583
diff
changeset
|
394 _this.uFlags |= BLV_RENDER_DRAW_D3D_OUTLINES; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1583
diff
changeset
|
395 |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1583
diff
changeset
|
396 _this.uFlags |= BLV_RENDER_DRAW_SW_OUTLINES; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1583
diff
changeset
|
397 _this.uFlags |= BLV_RENDER_DRAW_D3D_OUTLINES; |
791 | 398 |
0 | 399 _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; |
1641 | 400 //_this.fov_deg = 65; |
1643 | 401 //_this.vPosition.x = pParty->vPosition.x - fixpoint_mul(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity); |
402 //_this.vPosition.y = pParty->vPosition.y - fixpoint_mul(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity); | |
1641 | 403 //_this.vPosition.z = pParty->vPosition.z + pParty->sEyelevel; |
404 //_this.sRotationX = pParty->sRotationX; | |
405 //_this.sRotationY = pParty->sRotationY; | |
0 | 406 _this.pRenderTarget = pRenderer->pTargetSurface; |
692 | 407 _this.uViewportX = pViewport->uScreen_TL_X; |
408 _this.uViewportY = pViewport->uScreen_TL_Y; | |
409 _this.uViewportZ = pViewport->uScreen_BR_X; | |
410 _this.uViewportW = pViewport->uScreen_BR_Y; | |
0 | 411 _this.field_3C = pViewport->field_30; |
581 | 412 |
0 | 413 _this.uTargetWidth = 640; |
414 _this.uTargetHeight = 480; | |
1641 | 415 _this.pTargetZ = pRenderer->pActiveZBuffer;*/ |
416 | |
417 //sub_440BED(&_this); -- inlined | |
418 { | |
419 PrepareDrawLists_BLV(); | |
420 if (pBLVRenderParams->uPartySectorID) | |
421 IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0); | |
422 pRenderer->DrawBillboardList_BLV(); | |
423 } | |
424 | |
569 | 425 pParty->uFlags &= ~2; |
0 | 426 pGame->DrawParticles(); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1408
diff
changeset
|
427 trail_particle_generator.UpdateParticles(); |
0 | 428 } |
429 | |
430 //----- (004C0EF2) -------------------------------------------------------- | |
1025 | 431 void BLVFace::FromODM(ODMFace *face) |
0 | 432 { |
1025 | 433 this->pFacePlane_old.vNormal.x = face->pFacePlane.vNormal.x; |
434 this->pFacePlane_old.vNormal.y = face->pFacePlane.vNormal.y; | |
435 this->pFacePlane_old.vNormal.z = face->pFacePlane.vNormal.z; | |
436 this->pFacePlane_old.dist = face->pFacePlane.dist; | |
437 this->pFacePlane.vNormal.x = (double)(face->pFacePlane.vNormal.x & 0xFFFF) * 0.000015259022 | |
438 + (double)(face->pFacePlane.vNormal.x >> 16); | |
439 this->pFacePlane.vNormal.y = (double)(face->pFacePlane.vNormal.y & 0xFFFF) * 0.000015259022 | |
440 + (double)(face->pFacePlane.vNormal.y >> 16); | |
441 this->pFacePlane.vNormal.z = (double)(face->pFacePlane.vNormal.z & 0xFFFF) * 0.000015259022 | |
442 + (double)(face->pFacePlane.vNormal.z >> 16); | |
443 this->pFacePlane.dist = (double)(face->pFacePlane.dist & 0xFFFF) * 0.000015259022 + (double)(face->pFacePlane.dist >> 16); | |
444 this->uAttributes = face->uAttributes; | |
445 this->pBounding.x1 = face->pBoundingBox.x1; | |
446 this->pBounding.y1 = face->pBoundingBox.y1; | |
447 this->pBounding.z1 = face->pBoundingBox.z1; | |
448 this->pBounding.x2 = face->pBoundingBox.x2; | |
449 this->pBounding.y2 = face->pBoundingBox.y2; | |
450 this->pBounding.z2 = face->pBoundingBox.z2; | |
451 this->zCalc1 = face->zCalc1; | |
452 this->zCalc2 = face->zCalc2; | |
453 this->zCalc3 = face->zCalc3; | |
454 this->pXInterceptDisplacements = face->pXInterceptDisplacements; | |
455 this->pYInterceptDisplacements = face->pYInterceptDisplacements; | |
456 this->pZInterceptDisplacements = face->pZInterceptDisplacements; | |
457 this->uPolygonType = (PolygonType)face->uPolygonType; | |
458 this->uNumVertices = face->uNumVertices; | |
459 this->uBitmapID = face->uTextureID; | |
460 this->pVertexIDs = face->pVertexIDs; | |
0 | 461 } |
462 | |
463 //----- (004B0A25) -------------------------------------------------------- | |
794 | 464 void IndoorLocation::ExecDraw_d3d(unsigned int uFaceID, IndoorCameraD3D_Vec4 *pVertices, unsigned int uNumVertices, RenderVertexSoft *pPortalBounding) |
0 | 465 { |
466 //unsigned int v4; // esi@1 | |
467 char *v5; // eax@4 | |
468 signed int v6; // ecx@4 | |
469 char *v7; // eax@8 | |
470 signed int v8; // ecx@8 | |
471 //BLVFace *v9; // esi@13 | |
472 //IndoorCameraD3D *v10; // edi@16 | |
473 //int v11; // ebx@17 | |
474 //Vec3_short_ *v12; // ecx@18 | |
475 //char *v13; // edx@18 | |
476 //int v14; // eax@19 | |
477 //unsigned __int8 v15; // sf@19 | |
478 //unsigned __int8 v16; // of@19 | |
479 int v17; // ebx@25 | |
480 //double v18; // st7@27 | |
481 //double v19; // st6@27 | |
482 //double v20; // st5@27 | |
483 //char v21; // dl@27 | |
484 //unsigned int v22; // eax@44 | |
485 unsigned int v23; // eax@35 | |
486 //DWORD v24; // eax@37 | |
487 //int v25; // eax@38 | |
488 //char *v26; // edi@38 | |
489 IDirect3DTexture2 *v27; // eax@42 | |
1999 | 490 //Texture *v28; // [sp+Ch] [bp-1Ch]@15 |
0 | 491 //int i; // [sp+10h] [bp-18h]@38 |
492 //LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16 | |
493 //IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16 | |
494 //IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1 | |
495 //unsigned int uFaceID_; // [sp+20h] [bp-8h]@1 | |
496 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17 | |
497 int a4a; // [sp+34h] [bp+Ch]@25 | |
498 //unsigned int a4b; // [sp+34h] [bp+Ch]@38 | |
499 | |
500 if (uFaceID >= pIndoor->uNumFaces) | |
501 return; | |
502 | |
503 static RenderVertexSoft static_vertices_F7C228[64]; | |
504 static RenderVertexSoft static_vertices_F7B628[64]; | |
505 static stru154 stru_F7B60C; // idb | |
506 | |
1980 | 507 BLVFace* pFace = &pIndoor->pFaces[uFaceID]; |
0 | 508 if (pFace->uNumVertices < 3) |
509 return; | |
510 | |
511 | |
512 if (pFace->Invisible()) | |
513 return; | |
514 | |
515 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
516 pFace->uAttributes |= 0x80u; | |
517 | |
518 if (!pFace->GetTexture()) | |
519 return; | |
520 | |
521 if (!pGame->pIndoorCameraD3D->IsCulled(pFace)) | |
522 { | |
523 uNumVerticesa = pFace->uNumVertices; | |
524 for (uint i = 0; i < pFace->uNumVertices; ++i) | |
525 { | |
526 static_vertices_F7C228[i].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[i]].x; | |
527 static_vertices_F7C228[i].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[i]].y; | |
528 static_vertices_F7C228[i].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[i]].z; | |
529 static_vertices_F7C228[i].u = (signed short)pFace->pVertexUIDs[i]; | |
530 static_vertices_F7C228[i].v = (signed short)pFace->pVertexVIDs[i]; | |
531 } | |
532 | |
533 if (!pVertices || | |
1187 | 534 (pGame->pStru9Instance->_498377(pPortalBounding, 4, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) ) |
0 | 535 { |
795 | 536 if (pGame->pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa, |
581 | 537 static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa ) |
0 | 538 { |
539 a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel); | |
1006 | 540 v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) |
541 | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8); | |
0 | 542 sub_4B0E07(uFaceID); |
543 pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID); | |
544 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID); | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
545 pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
546 pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0); |
0 | 547 pGame->pLightmapBuilder->std__vector_000004_size = 0; |
1999 | 548 if (stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0) |
0 | 549 { |
550 stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x; | |
551 stru_F7B60C.polygonType = pFace->uPolygonType; | |
552 stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y; | |
553 stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z; | |
554 stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist; | |
555 } | |
556 | |
1922 | 557 if (stru_F8AD28.uNumLightsApplied > 0 && !(pFace->uAttributes & FACE_INDOOR_SKY)) |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
558 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0); |
0 | 559 |
560 if (pDecalBuilder->uNumDecals > 0) | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
561 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID); |
0 | 562 |
791 | 563 if (pFace->Fluid()) |
0 | 564 { |
831 | 565 if (pFace->uBitmapID == pRenderer->hd_water_tile_id) |
1999 | 566 v27 = pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]]; |
805 | 567 else |
831 | 568 { |
569 //auto v24 = GetTickCount() / 4; | |
570 //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi; | |
571 uint eightSeconds = GetTickCount() % 8000; | |
572 float angle = (eightSeconds / 8000.0f) * 2 * 3.1415f; | |
573 | |
574 //animte lava back and forth | |
575 for (uint i = 0; i < uNumVerticesa; ++i) | |
576 //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8)); | |
577 array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle); | |
1999 | 578 v27 = pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID]; |
831 | 579 } |
0 | 580 } |
595 | 581 else if (pFace->uAttributes & 0x4000) |
1999 | 582 v27 = pBitmaps_LOD->pHardwareTextures[pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_)]; |
831 | 583 else |
584 { | |
1394 | 585 v17 = 0xFF808080; |
1999 | 586 v27 = pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID]; |
831 | 587 } |
588 | |
1922 | 589 if (pFace->uAttributes & FACE_INDOOR_SKY) |
1923 | 590 pRenderer->DrawIndoorSky(uNumVerticesa, uFaceID); |
805 | 591 else |
1999 | 592 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), v17, 0); |
831 | 593 return; |
0 | 594 } |
595 } | |
596 } | |
597 } | |
598 | |
599 //----- (004B0E07) -------------------------------------------------------- | |
600 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) | |
601 { | |
602 unsigned int result; // eax@1 | |
1999 | 603 |
604 stru_F8AD28.pDeltaUV[0] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaU; | |
605 stru_F8AD28.pDeltaUV[1] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaV; | |
606 result = GetTickCount() >> 3; | |
607 if ( pIndoor->pFaces[uFaceID].uAttributes & 4 ) | |
0 | 608 { |
1999 | 609 stru_F8AD28.pDeltaUV[1] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1; |
0 | 610 } |
611 else | |
612 { | |
1999 | 613 if ( pIndoor->pFaces[uFaceID].uAttributes & 0x20 ) |
614 stru_F8AD28.pDeltaUV[1] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1; | |
0 | 615 } |
1999 | 616 if ( BYTE1(pIndoor->pFaces[uFaceID].uAttributes) & 8 ) |
0 | 617 { |
1999 | 618 stru_F8AD28.pDeltaUV[0] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1; |
0 | 619 } |
620 else | |
621 { | |
1999 | 622 if ( pIndoor->pFaces[uFaceID].uAttributes & 0x40 ) |
623 stru_F8AD28.pDeltaUV[0] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1; | |
0 | 624 } |
625 return result; | |
626 } | |
627 | |
628 //----- (004B0EA8) -------------------------------------------------------- | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
629 void BspRenderer::AddFaceToRenderList_d3d(unsigned int node_id, unsigned int uFaceID) |
0 | 630 { |
631 //unsigned int v3; // edx@1 | |
632 //stru170 *v4; // ebx@1 | |
633 //BLVFace *v5; // eax@1 | |
634 //int v6; // ecx@2 | |
1319 | 635 unsigned __int16 pTransitionSector; // ax@11 |
0 | 636 Vec3_short_ *v8; // esi@15 |
637 int v9; // edx@15 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
638 //signed int v10; // eax@18 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
639 //signed int v11; // edi@19 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
640 //signed int v12; // ecx@19 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
641 //signed int v13; // esi@19 |
0 | 642 signed int v14; // edx@20 |
643 int v15; // edx@24 | |
644 //int v16; // esi@29 | |
645 //BLVFace *v17; // edi@34 | |
1319 | 646 //unsigned __int16 v18; // ax@34 |
0 | 647 char *v19; // eax@38 |
648 signed int v20; // ecx@38 | |
649 char *v21; // eax@42 | |
650 signed int v22; // ecx@42 | |
651 //signed int v23; // edx@45 | |
652 //char *v24; // ecx@46 | |
653 //int v25; // eax@47 | |
654 //Vec3_short_ *v26; // eax@47 | |
655 //double v27; // st7@47 | |
656 //signed int v28; // ST28_4@47 | |
657 char v29; // al@48 | |
795 | 658 //signed int v30; // eax@51 |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
659 //int v31; // eax@52 |
0 | 660 //unsigned int v32; // eax@55 |
661 //__int16 v33; // cx@56 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
662 //signed int v34; // [sp+Ch] [bp-14h]@18 |
0 | 663 //int a0; // [sp+14h] [bp-Ch]@2 |
664 //IndoorCameraD3D *a0a; // [sp+14h] [bp-Ch]@36 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
665 //signed int v37; // [sp+18h] [bp-8h]@19 |
0 | 666 //stru10 *v38; // [sp+18h] [bp-8h]@36 |
667 //BLVFace *v39; // [sp+1Ch] [bp-4h]@1 | |
668 | |
669 //v3 = uFaceID; | |
670 //v4 = this; | |
671 //v5 = &pIndoor->pFaces[uFaceID]; | |
795 | 672 nodes[num_nodes].viewing_portal_id = -1; |
0 | 673 //v39 = &pIndoor->pFaces[uFaceID]; |
674 | |
1980 | 675 BLVFace* pFace = &pIndoor->pFaces[uFaceID]; |
1309 | 676 |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
677 if (!pFace->Portal()) |
0 | 678 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
679 if (num_faces < 1000) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
680 { |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
681 faces[num_faces].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
682 faces[num_faces++].uNodeID = node_id; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
683 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
684 return; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
685 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
686 |
1319 | 687 if (nodes[node_id].uFaceID == uFaceID) |
688 return; | |
689 if (!node_id && | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
690 pGame->pIndoorCameraD3D->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
691 pGame->pIndoorCameraD3D->vPartyPos.x <= pFace->pBounding.x2 + 16 && |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
692 pGame->pIndoorCameraD3D->vPartyPos.y >= pFace->pBounding.y1 - 16 && |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
693 pGame->pIndoorCameraD3D->vPartyPos.y <= pFace->pBounding.y2 + 16 && |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
694 pGame->pIndoorCameraD3D->vPartyPos.z >= pFace->pBounding.z1 - 16 && |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
695 pGame->pIndoorCameraD3D->vPartyPos.z <= pFace->pBounding.z2 + 16 ) |
1319 | 696 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
697 if ( abs(pFace->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
698 + pGame->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
699 + pGame->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane |
0 | 700 { |
1319 | 701 pTransitionSector = pFace->uSectorID; |
702 if ( nodes[0].uSectorID == pTransitionSector ) // draw back sector | |
703 pTransitionSector = pFace->uBackSectorID; | |
704 nodes[num_nodes].uSectorID = pTransitionSector; | |
705 nodes[num_nodes].uFaceID = uFaceID; | |
706 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; | |
707 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; | |
708 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; | |
709 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; | |
1376 | 710 nodes[num_nodes].PortalScreenData.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, |
1319 | 711 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); |
712 AddBspNodeToRenderList(++num_nodes - 1); | |
713 return; | |
0 | 714 } |
1319 | 715 } |
716 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
717 v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pGame->pIndoorCameraD3D->vPartyPos.x) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
718 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pGame->pIndoorCameraD3D->vPartyPos.y) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
719 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pGame->pIndoorCameraD3D->vPartyPos.z); |
1319 | 720 if (nodes[node_id].uSectorID != pFace->uSectorID) |
721 v9 = -v9; | |
722 if (v9 >= 0) | |
723 return; | |
724 | |
1980 | 725 int num_vertices = GetPortalScreenCoord(uFaceID); |
1319 | 726 if (num_vertices < 2) |
727 return; | |
728 | |
1980 | 729 int face_min_screenspace_x = PortalFace._screen_space_x[0], |
1344 | 730 face_max_screenspace_x = PortalFace._screen_space_x[0]; |
1980 | 731 int face_min_screenspace_y = PortalFace._screen_space_y[0], |
1344 | 732 face_max_screenspace_y = PortalFace._screen_space_y[0]; |
1319 | 733 for (uint i = 1; i < num_vertices; ++i) |
734 { | |
1344 | 735 if (face_min_screenspace_x > PortalFace._screen_space_x[i]) |
736 face_min_screenspace_x = PortalFace._screen_space_x[i]; | |
737 if (face_max_screenspace_x < PortalFace._screen_space_x[i]) | |
738 face_max_screenspace_x = PortalFace._screen_space_x[i]; | |
739 | |
740 if (face_min_screenspace_y > PortalFace._screen_space_y[i]) | |
741 face_min_screenspace_y = PortalFace._screen_space_y[i]; | |
742 if (face_max_screenspace_y < PortalFace._screen_space_y[i]) | |
743 face_max_screenspace_y = PortalFace._screen_space_y[i]; | |
1319 | 744 } |
1132 | 745 //_screen_space_x = 719, 568, 493 |
746 //savegame: qw , 0Bh and 0x1D4h | |
747 //problem here when standing near/on portal, condition is false because of face_min_screenspace_x > p->uViewportZ | |
1319 | 748 if (face_max_screenspace_x >= nodes[node_id].uViewportX && |
749 face_min_screenspace_x <= nodes[node_id].uViewportZ && | |
750 face_max_screenspace_y >= nodes[node_id].uViewportY && | |
751 face_min_screenspace_y <= nodes[node_id].uViewportW && | |
1376 | 752 PortalFrustrum(num_vertices, &nodes[num_nodes].PortalScreenData, &nodes[node_id].PortalScreenData, uFaceID)) |
1319 | 753 { |
754 pTransitionSector = pFace->uSectorID; | |
755 if (nodes[node_id].uSectorID == pTransitionSector ) | |
756 pTransitionSector = pFace->uBackSectorID; | |
757 nodes[num_nodes].uSectorID = pTransitionSector; | |
758 nodes[num_nodes].uFaceID = uFaceID; | |
759 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; | |
760 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; | |
761 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; | |
762 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; | |
763 v29 = false; | |
764 if (nodes[node_id].viewing_portal_id == -1)//первый портал на который я смотрю | |
765 v29 = pGame->pStru10Instance->CalcPortalShape(pFace, nodes[num_nodes].std__vector_0007AC, nodes[num_nodes].pPortalBounding); | |
766 else//следующие порталы в портале | |
767 { | |
768 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F7AA08[64]; | |
769 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F79E08[64]; | |
770 | |
771 for (uint k = 0; k < pFace->uNumVertices; ++k) | |
772 { | |
773 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[k]].x; | |
774 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[k]].y; | |
775 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[k]].z; | |
776 } | |
777 | |
778 unsigned int pNewNumVertices = pFace->uNumVertices; | |
779 pGame->pIndoorCameraD3D->CalcPortalShape(static_subAddFaceToRenderList_d3d_stru_F7AA08, &pNewNumVertices, | |
780 static_subAddFaceToRenderList_d3d_stru_F79E08, nodes[node_id].std__vector_0007AC, 4, 0, 0); | |
781 | |
782 v29 = pGame->pStru10Instance->_49C5DA(pFace, static_subAddFaceToRenderList_d3d_stru_F79E08, &pNewNumVertices, | |
783 nodes[num_nodes].std__vector_0007AC, nodes[num_nodes].pPortalBounding); | |
784 } | |
785 if ( 1 ) | |
786 { | |
787 assert(num_nodes < 150); | |
788 | |
789 nodes[num_nodes].viewing_portal_id = uFaceID; | |
790 AddBspNodeToRenderList(++num_nodes - 1); | |
791 } | |
1642 | 792 if (pGame->pIndoorCameraD3D->debug_flags & BLV_RENDER_DRAW_SW_OUTLINES) |
1319 | 793 pGame->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF); |
794 //pGame->pIndoorCameraD3D->DebugDrawPortal(pFace); | |
795 } | |
0 | 796 } |
797 | |
798 | |
799 //----- (004AFB86) -------------------------------------------------------- | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
800 void BspRenderer::AddFaceToRenderList_sw(unsigned int node_id, unsigned int uFaceID) |
0 | 801 { |
802 BspRenderer *v3; // ebx@1 | |
803 BLVFace *v4; // eax@1 | |
804 char *v5; // ecx@2 | |
805 unsigned __int16 v6; // ax@11 | |
806 int v7; // ecx@13 | |
807 Vec3_short_ *v8; // esi@16 | |
808 int v9; // edx@16 | |
809 signed int v10; // eax@19 | |
810 signed int v11; // edi@20 | |
811 signed int v12; // ecx@20 | |
812 signed int v13; // esi@20 | |
813 int v14; // edx@21 | |
814 int v15; // edx@25 | |
815 unsigned __int16 v16; // ax@35 | |
816 signed int v17; // eax@37 | |
817 int v18; // eax@38 | |
818 signed int v19; // [sp+Ch] [bp-14h]@19 | |
819 char *v20; // [sp+14h] [bp-Ch]@2 | |
820 BLVFace *v21; // [sp+18h] [bp-8h]@1 | |
821 signed int v22; // [sp+1Ch] [bp-4h]@20 | |
822 signed int v23; // [sp+28h] [bp+8h]@20 | |
823 | |
824 v3 = this; | |
825 v4 = &pIndoor->pFaces[uFaceID]; | |
826 v21 = v4; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
827 if (v4->Portal()) |
0 | 828 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
829 v5 = (char *)this + 2252 * node_id; |
0 | 830 v20 = v5; |
831 if ( uFaceID == *((short *)v5 + 2982) ) | |
832 return; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
833 if (!node_id |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
834 && pGame->pIndoorCameraD3D->vPartyPos.x >= v4->pBounding.x1 - 16 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
835 && pGame->pIndoorCameraD3D->vPartyPos.x <= v4->pBounding.x2 + 16 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
836 && pGame->pIndoorCameraD3D->vPartyPos.y >= v4->pBounding.y1 - 16 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
837 && pGame->pIndoorCameraD3D->vPartyPos.y <= v4->pBounding.y2 + 16 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
838 && pGame->pIndoorCameraD3D->vPartyPos.z >= v4->pBounding.z1 - 16 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
839 && pGame->pIndoorCameraD3D->vPartyPos.z <= v4->pBounding.z2 + 16 ) |
0 | 840 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
841 if ( abs(v4->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * v4->pFacePlane_old.vNormal.x |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
842 + pGame->pIndoorCameraD3D->vPartyPos.y * v4->pFacePlane_old.vNormal.y |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
843 + pGame->pIndoorCameraD3D->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) |
0 | 844 { |
845 v6 = v21->uSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
846 if ( v3->nodes[0].uSectorID == v6 ) |
0 | 847 v6 = v21->uBackSectorID; |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
848 v3->nodes[v3->num_nodes].uSectorID = v6; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
849 v3->nodes[v3->num_nodes].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
850 v3->nodes[v3->num_nodes].uViewportX = LOWORD(pBLVRenderParams->uViewportX); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
851 v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
852 v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
853 v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW); |
1376 | 854 v3->nodes[v3->num_nodes++].PortalScreenData.GetViewportData( |
0 | 855 SLOWORD(pBLVRenderParams->uViewportX), |
856 pBLVRenderParams->uViewportY, | |
857 SLOWORD(pBLVRenderParams->uViewportZ), | |
858 pBLVRenderParams->uViewportW); | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
859 v7 = v3->num_nodes - 1; |
0 | 860 goto LABEL_14; |
861 } | |
862 v4 = v21; | |
863 v5 = v20; | |
864 } | |
865 v8 = &pIndoor->pVertices[*v4->pVertexIDs]; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
866 v9 = v4->pFacePlane_old.vNormal.x * (v8->x - pGame->pIndoorCameraD3D->vPartyPos.x) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
867 + v4->pFacePlane_old.vNormal.y * (v8->y - pGame->pIndoorCameraD3D->vPartyPos.y) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
868 + v4->pFacePlane_old.vNormal.z * (v8->z - pGame->pIndoorCameraD3D->vPartyPos.z); |
0 | 869 if ( *((short *)v5 + 2004) != v4->uSectorID ) |
870 v9 = -v9; | |
871 if ( v9 < 0 ) | |
872 { | |
1344 | 873 v10 = GetPortalScreenCoord(uFaceID); |
0 | 874 v19 = v10; |
875 if ( v10 ) | |
876 { | |
1344 | 877 v11 = PortalFace._screen_space_x[0]; |
878 v12 = PortalFace._screen_space_y[0]; | |
879 v23 = PortalFace._screen_space_x[0]; | |
0 | 880 v13 = 1; |
1344 | 881 v22 = PortalFace._screen_space_y[0]; |
0 | 882 if ( v10 > 1 ) |
883 { | |
884 do | |
885 { | |
1344 | 886 v14 = PortalFace._screen_space_x[v13]; |
0 | 887 if ( v14 < v23 ) |
1344 | 888 v23 = PortalFace._screen_space_x[v13]; |
0 | 889 if ( v14 > v11 ) |
1344 | 890 v11 = PortalFace._screen_space_x[v13]; |
891 v15 = PortalFace._screen_space_y[v13]; | |
0 | 892 if ( v15 < v22 ) |
1344 | 893 v22 = PortalFace._screen_space_y[v13]; |
0 | 894 if ( v15 > v12 ) |
1344 | 895 v12 = PortalFace._screen_space_y[v13]; |
0 | 896 v10 = v19; |
897 ++v13; | |
898 } | |
899 while ( v13 < v19 ); | |
900 } | |
901 if ( v11 >= *((short *)v20 + 2005) | |
902 && v23 <= *((short *)v20 + 2007) | |
903 && v12 >= *((short *)v20 + 2006) | |
904 && v22 <= *((short *)v20 + 2008) | |
1376 | 905 && PortalFrustrum(v10, &v3->nodes[v3->num_nodes].PortalScreenData, (BspRenderer_PortalViewportData *)(v20 + 4020), uFaceID) ) |
0 | 906 { |
907 v16 = v21->uSectorID; | |
908 if ( *((short *)v20 + 2004) == v16 ) | |
909 v16 = v21->uBackSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
910 v3->nodes[v3->num_nodes].uSectorID = v16; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
911 v3->nodes[v3->num_nodes].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
912 v3->nodes[v3->num_nodes].uViewportX = LOWORD(pBLVRenderParams->uViewportX); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
913 v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
914 v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
915 v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
916 v17 = v3->num_nodes; |
0 | 917 if ( v17 < 150 ) |
918 { | |
919 v18 = v17 + 1; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
920 v3->num_nodes = v18; |
0 | 921 v7 = v18 - 1; |
922 LABEL_14: | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
923 AddBspNodeToRenderList(v7); |
0 | 924 return; |
925 } | |
926 } | |
927 } | |
928 } | |
929 } | |
930 else | |
931 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
932 if (num_faces < 1000) |
0 | 933 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
934 faces[num_faces].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
935 faces[num_faces++].uNodeID = node_id; |
0 | 936 } |
937 } | |
938 } | |
939 | |
940 | |
941 //----- (004AE5BA) -------------------------------------------------------- | |
942 Texture *BLVFace::GetTexture() | |
943 { | |
944 unsigned int v1; // ecx@2 | |
945 | |
946 if ( uAttributes & 0x4000 ) | |
947 v1 = pTextureFrameTable->GetFrameTexture(this->uBitmapID, pBLVRenderParams->field_0_timer_); | |
948 else | |
949 v1 = uBitmapID; | |
945 | 950 return pBitmaps_LOD->GetTexture(v1); |
0 | 951 } |
952 | |
953 | |
954 //----- (00498B15) -------------------------------------------------------- | |
955 void IndoorLocation::Release() | |
956 { | |
957 IndoorLocation *v1; // esi@1 | |
958 char *v2; // ebp@1 | |
959 void *v3; // ST00_4@1 | |
960 | |
961 v1 = this; | |
962 v2 = (char *)&this->ptr_0002B4_doors_ddata; | |
1583 | 963 free(this->ptr_0002B4_doors_ddata); |
0 | 964 *(int *)v2 = 0; |
1583 | 965 free(v1->ptr_0002B0_sector_rdata); |
0 | 966 v1->ptr_0002B0_sector_rdata = 0; |
1583 | 967 free(v1->ptr_0002B8_sector_lrdata); |
0 | 968 v1->ptr_0002B8_sector_lrdata = 0; |
1583 | 969 free(v1->pLFaces); |
1006 | 970 v1->pLFaces = 0; |
1583 | 971 free(v1->pSpawnPoints); |
0 | 972 v3 = v1->pVertices; |
973 v1->pSpawnPoints = 0; | |
974 v1->uNumSectors = 0; | |
975 v1->uNumFaces = 0; | |
976 v1->uNumVertices = 0; | |
977 v1->uNumNodes = 0; | |
978 v1->uNumDoors = 0; | |
979 v1->uNumLights = 0; | |
1583 | 980 free(v3); |
981 free(v1->pFaces); | |
982 free(v1->pFaceExtras); | |
983 free(v1->pSectors); | |
984 free(v1->pLights); | |
985 free(v1->pDoors); | |
986 free(v1->pNodes); | |
987 free(v1->pMapOutlines); | |
0 | 988 v1->pVertices = 0; |
989 v1->pFaces = 0; | |
990 v1->pFaceExtras = 0; | |
991 v1->pSectors = 0; | |
992 v1->pLights = 0; | |
993 v1->pDoors = 0; | |
994 v1->pNodes = 0; | |
995 v1->pMapOutlines = 0; | |
996 v1->bLoaded = 0; | |
997 } | |
998 | |
999 //----- (00498C45) -------------------------------------------------------- | |
711 | 1000 bool IndoorLocation::Alloc() |
1001 { | |
1583 | 1002 pVertices = (Vec3_short_ *) malloc(15000 * sizeof(Vec3_short_));//0x15F90u |
1003 pFaces = (BLVFace *) malloc(10000 * sizeof(BLVFace));//0xEA600u | |
1004 pFaceExtras = (BLVFaceExtra *) malloc(5000 * sizeof(BLVFaceExtra)); //0x2BF20u | |
1005 pSectors = (BLVSector *) malloc(512 * sizeof(BLVSector));//0xE800u | |
1006 pLights = (BLVLightMM7 *) malloc(400 * sizeof(BLVLightMM7));//0x1900u | |
1007 pDoors = (BLVDoor *) malloc(200 * sizeof(BLVDoor));//0x3E80u | |
1008 pNodes = (BSPNode *) malloc(5000 * sizeof(BSPNode));//0x9C40u | |
1009 pMapOutlines =(BLVMapOutlines *)malloc(sizeof(BLVMapOutlines));//0x14824u | |
711 | 1010 if (pVertices && pFaces && pFaceExtras && pSectors && pLights && pDoors && pNodes && pMapOutlines ) |
0 | 1011 { |
711 | 1012 memset(pVertices, 0, 15000*sizeof(Vec3_short_)); |
1013 memset(pFaces, 0, 10000*sizeof(BLVFace)); | |
1014 memset(pFaceExtras,0, 5000*sizeof(BLVFaceExtra)); | |
1015 memset(pSectors, 0, 512*sizeof(BLVSector)); | |
1016 memset(pLights, 0, 400*sizeof(BLVLightMM7)); | |
1017 memset(pDoors, 0, 200*sizeof(BLVDoor)); | |
1018 memset(pNodes, 0, 5000*sizeof(BSPNode)); | |
1019 memset(pMapOutlines,0, sizeof(BLVMapOutlines)); | |
1020 return true; | |
0 | 1021 } |
1022 else | |
1023 { | |
711 | 1024 return false; |
0 | 1025 } |
1026 } | |
1027 | |
1028 | |
1029 | |
1030 //----- (00444810) -------------------------------------------------------- | |
1031 unsigned int IndoorLocation::GetLocationIndex(const char *Str1) | |
1032 { | |
1033 const char *v1; // edi@1 | |
1034 signed int v2; // esi@1 | |
1035 | |
434 | 1036 for (uint i = 0; i < 11; ++i) |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1132
diff
changeset
|
1037 if (!_stricmp(Str1, _4E6BDC_loc_names[i])) |
434 | 1038 return i + 1; |
1039 return 0; | |
0 | 1040 } |
1041 | |
1042 | |
1043 | |
1044 //----- (004488F7) -------------------------------------------------------- | |
711 | 1045 void IndoorLocation::ToggleLight(signed int sLightID, unsigned int bToggle) |
0 | 1046 { |
711 | 1047 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (sLightID <= pIndoor->uNumLights - 1) && (sLightID >= 0) ) |
0 | 1048 { |
1049 if ( bToggle ) | |
1063 | 1050 pIndoor->pLights[sLightID].uAtributes &= 0xFFFFFFF7u; |
0 | 1051 else |
1063 | 1052 pIndoor->pLights[sLightID].uAtributes |= 8u; |
0 | 1053 pParty->uFlags |= 2u; |
1054 } | |
1055 } | |
1056 | |
1057 | |
1058 //----- (00498E0A) -------------------------------------------------------- | |
1059 bool IndoorLocation::Load(char *pFilename, int a3, size_t _i, char *pDest) | |
1060 { | |
1061 /*unsigned int v5; // ebx@1 | |
1062 //IndoorLocation *v6; // esi@1 | |
1063 FILE *v7; // edi@3 | |
1064 bool result; // eax@3 | |
1065 char *v9; // ecx@4 | |
1066 void *v10; // eax@4 | |
1067 //unsigned __int8 v11; // zf@4 | |
1068 //unsigned __int8 v12; // sf@4 | |
1069 int v13; // eax@5 | |
1070 size_t v14; // ecx@6 | |
1071 char *v15; // ecx@6 | |
1072 int v16; // edx@6 | |
1073 size_t v17; // ecx@6 | |
1074 char *v18; // ecx@6 | |
1075 int v19; // edx@6 | |
1076 unsigned __int16 *v20; // edx@6 | |
1077 unsigned __int16 *v21; // edx@6 | |
1078 unsigned __int16 *v22; // edx@6 | |
1079 __int16 v23; // ax@10 | |
1080 char *v24; // ecx@10 | |
1081 __int16 v25; // cx@10 | |
1082 __int16 v26; // ax@11 | |
1083 char *v27; // ecx@11 | |
1084 unsigned __int16 v28; // ax@17 | |
1085 BLVFaceExtra *v29; // ecx@17 | |
1086 char *v30; // edx@17 | |
1087 int v31; // ecx@20 | |
1088 void *v32; // eax@25 | |
1089 int v33; // eax@26 | |
1090 unsigned __int16 *v34; // edx@27 | |
1091 size_t v35; // ecx@27 | |
1092 char *v36; // ecx@27 | |
1093 int v37; // edx@27 | |
1094 size_t v38; // ecx@27 | |
1095 char *v39; // ecx@27 | |
1096 int v40; // edx@27 | |
1097 unsigned __int16 *v41; // edx@27 | |
1098 unsigned __int16 *v42; // edx@27 | |
1099 unsigned __int16 *v43; // edx@27 | |
1100 unsigned __int16 *v44; // edx@27 | |
1101 size_t v45; // ecx@27 | |
1102 unsigned __int16 *v46; // edx@27 | |
1103 void *v47; // eax@28 | |
1104 BLVSector *v48; // eax@29 | |
1105 size_t v49; // ecx@29 | |
1106 unsigned __int16 *v50; // edx@31 | |
1107 void *v51; // eax@32 | |
1108 int v52; // eax@33 | |
1109 unsigned __int16 *v53; // edx@34 | |
1110 size_t v54; // ecx@34 | |
1111 char *v55; // ecx@34 | |
1112 int v56; // edx@34 | |
1113 size_t v57; // ecx@34 | |
1114 char *v58; // ecx@34 | |
1115 int v59; // edx@34 | |
1116 unsigned __int16 *v60; // edx@34 | |
1117 unsigned __int16 *v61; // edx@34 | |
1118 unsigned __int16 *v62; // edx@34 | |
1119 unsigned __int16 *v63; // edx@34 | |
1120 int v64; // ecx@34 | |
1121 BLVDoor *v65; // ecx@36 | |
1122 char *v66; // eax@37 | |
1123 int v67; // edx@38 | |
1124 int v68; // ecx@38 | |
1125 BLVFace *v69; // edx@38 | |
1126 int v70; // ecx@38 | |
1127 int v71; // edx@38 | |
1128 int v72; // eax@38 | |
1129 unsigned __int16 v73; // ax@42 | |
1130 char *v74; // ecx@42 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
1131 SpriteObject *v75; // ecx@44 |
0 | 1132 size_t v76; // eax@45 |
1133 int j; // edx@46 | |
1134 unsigned __int16 v78; // ax@50 | |
1135 void *v79; // eax@52 | |
1136 void **v80; // esi@52 | |
1137 unsigned int v145; // eax@103 | |
1138 void *v146; // eax@103 | |
1139 unsigned int v147; // ecx@103 | |
1140 int v148; // ebx@103 | |
1141 unsigned int *v149; // ecx@103*/ | |
1142 //size_t v150; // eax@103 | |
1143 //unsigned int v151; // ebx@109 | |
1144 //unsigned int v152; // ecx@116 | |
1145 //unsigned int v153; // eax@117 | |
1146 //size_t v154; // ebx@126 | |
1147 //unsigned int v155; // ebx@134 | |
1148 //size_t v156; // eax@140 | |
1149 //signed int v157; // ebx@142 | |
1150 //int v158; // ebx@148 | |
1151 //BLVFace *v159; // eax@149 | |
1152 // BLVFaceExtra *v160; // ecx@149 | |
1153 //BLVFaceExtra *v161; // ecx@149 | |
1154 //signed int v162; // ebx@154 | |
1155 //unsigned int v163; // ebx@157 | |
1156 //unsigned int v164; // ebx@157 | |
1157 //unsigned int v165; // edx@158 | |
1158 //char *v166; // ecx@158 | |
1159 //unsigned __int16 v167; // ax@161 | |
1160 //__int16 v168; // ax@165 | |
1161 //unsigned int v169; // ebx@168 | |
1162 //void *v170; // eax@168 | |
1163 //size_t v171; // ebx@168 | |
1164 //int v172; // edx@168 | |
1165 //BLVDoor *v173; // ecx@169 | |
1166 //int k; // eax@169 | |
1167 //BLVDoor *v175; // ecx@172 | |
1168 //int v176; // edx@172 | |
1169 //BLVDoor *v177; // ecx@172 | |
1170 //int v178; // edx@172 | |
1171 //BLVDoor *v179; // ecx@172 | |
1172 //int v180; // edx@172 | |
1173 //BLVDoor *v181; // ecx@172 | |
1174 //int v182; // edx@172 | |
1175 //BLVDoor *v183; // ecx@172 | |
1176 //int v184; // edx@172 | |
1177 //BLVDoor *v185; // ecx@172 | |
1178 //int v186; // edx@172 | |
1179 //BLVDoor *v187; // ecx@172 | |
1180 //int v188; // edx@172 | |
1181 //unsigned __int16 *v189; // ebx@172 | |
1182 //char *v190; // edx@173 | |
1183 //BLVDoor *v191; // ecx@174 | |
1184 //BLVDoor *l; // eax@175 | |
1185 //signed int v193; // ebx@176 | |
1186 //int v194; // ecx@176 | |
1187 //BLVFaceExtra *v195; // ecx@176 | |
1188 //BLVFace *v196; // ebx@178 | |
1189 //std::string v197; // [sp-18h] [bp-680h]@66 | |
1190 //void *v198; // [sp-14h] [bp-67Ch]@72 | |
1191 //size_t v199; // [sp-10h] [bp-678h]@72 | |
1192 //size_t v200; // [sp-Ch] [bp-674h]@72 | |
1193 //const char *v201; // [sp-8h] [bp-670h]@4 | |
1194 //int v202; // [sp-4h] [bp-66Ch]@4 | |
1195 char v203[875]; // [sp+Ch] [bp-65Ch]@130 | |
1196 char FileName[260]; // [sp+378h] [bp-2F0h]@1 | |
1197 //char DstBuf; // [sp+47Ch] [bp-1ECh]@4 | |
1198 __int32 Offset; // [sp+480h] [bp-1E8h]@4 | |
1199 __int32 v207; // [sp+48Ch] [bp-1DCh]@4 | |
1200 __int32 v208; // [sp+498h] [bp-1D0h]@4 | |
1201 __int32 v209; // [sp+4A4h] [bp-1C4h]@4 | |
1202 __int32 v210; // [sp+4B0h] [bp-1B8h]@4 | |
1203 __int32 v211; // [sp+4BCh] [bp-1ACh]@15 | |
1204 __int32 v212; // [sp+4C8h] [bp-1A0h]@15 | |
1205 __int32 v213; // [sp+4D4h] [bp-194h]@25 | |
1206 __int32 v214; // [sp+4E0h] [bp-188h]@25 | |
1207 __int32 v215; // [sp+4ECh] [bp-17Ch]@32 | |
1208 __int32 v216; // [sp+4F8h] [bp-170h]@32 | |
1209 __int32 v217; // [sp+504h] [bp-164h]@40 | |
1210 __int32 v218; // [sp+510h] [bp-158h]@40 | |
1211 __int32 v219; // [sp+51Ch] [bp-14Ch]@43 | |
1212 __int32 v220; // [sp+528h] [bp-140h]@43 | |
1213 __int32 v221; // [sp+534h] [bp-134h]@52 | |
1214 __int32 v222; // [sp+540h] [bp-128h]@52 | |
1215 __int32 v223; // [sp+54Ch] [bp-11Ch]@52 | |
1216 __int32 v224; // [sp+558h] [bp-110h]@52 | |
1217 __int32 v225; // [sp+564h] [bp-104h]@52 | |
1218 __int32 v226; // [sp+570h] [bp-F8h]@52 | |
1219 __int32 v227; // [sp+57Ch] [bp-ECh]@52 | |
1220 __int32 v228; // [sp+588h] [bp-E0h]@52 | |
1221 __int32 v229; // [sp+594h] [bp-D4h]@52 | |
1222 __int32 v230; // [sp+5A0h] [bp-C8h]@52 | |
1223 __int32 v231; // [sp+5ACh] [bp-BCh]@52 | |
1224 __int32 v232; // [sp+5B8h] [bp-B0h]@52 | |
1225 __int32 v233; // [sp+5C4h] [bp-A4h]@52 | |
1226 __int32 v234; // [sp+5D0h] [bp-98h]@52 | |
1227 //char pName[40]; // [sp+5FCh] [bp-6Ch]@42 | |
1228 //size_t pSource; // [sp+624h] [bp-44h]@67 | |
1229 //char Dst[12]; // [sp+628h] [bp-40h]@9 | |
1230 //char *v238; // [sp+634h] [bp-34h]@38 | |
1231 ODMHeader header; // [sp+638h] [bp-30h]@61 | |
1232 //void *ptr; // [sp+648h] [bp-20h]@66 | |
1233 //size_t Count; // [sp+64Ch] [bp-1Ch]@109 | |
1234 //int uSourceLen; // [sp+653h] [bp-15h]@66 | |
1235 FILE *File; // [sp+658h] [bp-10h]@56 | |
1236 //BLVSector *v244; // [sp+65Ch] [bp-Ch]@72 | |
1237 //int v245; // [sp+660h] [bp-8h]@72 | |
1238 //BLVFace *Src; // [sp+664h] [bp-4h]@73 | |
1239 signed int Argsa; // [sp+670h] [bp+8h]@4 | |
1240 signed int Argsb; // [sp+670h] [bp+8h]@7 | |
1241 signed int Argsc; // [sp+670h] [bp+8h]@15 | |
1242 signed int Argsd; // [sp+670h] [bp+8h]@18 | |
1243 int Argse; // [sp+670h] [bp+8h]@25 | |
1244 int Argsf; // [sp+670h] [bp+8h]@28 | |
1245 int Argsg; // [sp+670h] [bp+8h]@32 | |
1246 int Argsh; // [sp+670h] [bp+8h]@35 | |
1247 signed int Argsi; // [sp+670h] [bp+8h]@40 | |
1248 signed int Argsj; // [sp+670h] [bp+8h]@45 | |
1249 //int Argsk; // [sp+670h] [bp+8h]@143 | |
1250 //void *Argsl; // [sp+670h] [bp+8h]@155 | |
1251 //signed int Argsm; // [sp+670h] [bp+8h]@161 | |
1252 //signed int Argsn; // [sp+670h] [bp+8h]@175 | |
1253 | |
1254 //v5 = 0; | |
1255 //v6 = this; | |
1256 _6807E0_num_decorations_with_sounds_6807B8 = 0; | |
1257 | |
1258 #pragma region "loading from txt" | |
1259 /*sprintf(FileName, "levels\\%s", pFilename); | |
1260 if ( GetFileAttributesA(FileName) != -1 ) | |
1261 { | |
1262 Release(); | |
1263 if ( Alloc() ) | |
1264 { | |
1265 v7 = fopen(FileName, "rb"); | |
1266 result = 1; | |
1267 if ( !v7 ) | |
1268 return result; | |
1269 v9 = pDest; | |
1270 bLoaded = 1; | |
1271 v202 = (int)v7; | |
1272 v201 = (const char *)1; | |
1273 *(int *)v9 = 1; | |
1274 fread(&DstBuf, 0x180u, (size_t)v201, (FILE *)v202); | |
1275 fseek(v7, Offset, 0); | |
1276 fread(&blv, 0x88u, 1u, v7); | |
1277 fseek(v7, v207, 0); | |
1278 fread(&uNumVertices, 1u, 4u, v7); | |
1279 fseek(v7, v208, 0); | |
1280 fread(pVertices, 6u, uNumVertices, v7); | |
1281 fseek(v7, v209, 0); | |
1282 fread(&uNumFaces, 4u, 1u, v7); | |
1283 fseek(v7, v210, 0); | |
1284 fread(pFaces, 0x60u, uNumFaces, v7); | |
1583 | 1285 v10 = malloc(ptr_2AC, blv.uFaces_fdata_Size, "L.FData"); |
0 | 1286 v202 = (int)v7; |
1287 ptr_2AC = (unsigned __int16 *)v10; | |
1288 fread(v10, 1u, blv.uFaces_fdata_Size, (FILE *)v202); | |
1289 v11 = uNumFaces == 0; | |
1290 v12 = (uNumFaces & 0x80000000u) != 0; | |
1291 pDest = 0; | |
1292 Argsa = 0; | |
1293 if ( !(v12 | v11) ) | |
1294 { | |
1295 v13 = 0; | |
1296 do | |
1297 { | |
1298 pFaces[v13].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)ptr_2AC]; | |
1299 v14 = (size_t)&pFaces[v13]; | |
1300 i = v14; | |
1301 v15 = &pDest[2 * *(char *)(v14 + 93) + 2]; | |
1302 v16 = (int)&v15[(unsigned int)ptr_2AC]; | |
1303 pDest = v15; | |
1304 *(int *)(i + 52) = v16; | |
1305 v17 = (size_t)&pFaces[v13]; | |
1306 i = v17; | |
1307 v18 = &pDest[2 * *(char *)(v17 + 93) + 2]; | |
1308 v19 = (int)&v18[(unsigned int)ptr_2AC]; | |
1309 pDest = v18; | |
1310 *(int *)(i + 56) = v19; | |
1311 i = (size_t)&pFaces[v13]; | |
1312 v20 = ptr_2AC; | |
1313 pDest += 2 * *(char *)(i + 93) + 2; | |
1314 *(int *)(i + 60) = (int)(char *)v20 + (int)pDest; | |
1315 i = (size_t)&pFaces[v13]; | |
1316 v21 = ptr_2AC; | |
1317 pDest += 2 * *(char *)(i + 93) + 2; | |
1318 *(int *)(i + 64) = (int)(char *)v21 + (int)pDest; | |
1319 i = (size_t)&pFaces[v13]; | |
1320 ++v13; | |
1321 v22 = ptr_2AC; | |
1322 pDest += 2 * *(char *)(i + 93) + 2; | |
1323 ++Argsa; | |
1324 *(int *)(i + 68) = (int)(char *)v22 + (int)pDest; | |
1325 pDest += 2 * *((char *)&pFaces[v13] - 3) + 2; | |
1326 } | |
1327 while ( Argsa < (signed int)uNumFaces ); | |
1328 } | |
1329 Argsb = 0; | |
1330 if ( (signed int)uNumFaces > 0 ) | |
1331 { | |
1332 pDest = 0; | |
1333 do | |
1334 { | |
1335 fread(Dst, 1u, 0xAu, v7); | |
1336 if ( pDest[(unsigned int)pFaces + 45] & 0x40 ) | |
1337 { | |
1338 v23 = pTextureFrameTable->FindTextureByName(Dst); | |
1339 v24 = pDest; | |
1340 *(short *)&pDest[(unsigned int)pFaces + 74] = v23; | |
1341 v25 = *(short *)&v24[(unsigned int)pFaces + 74]; | |
1342 if ( v25 ) | |
1343 { | |
1344 pTextureFrameTable->LoadAnimationSequenceAndPalettes(v25); | |
1345 } | |
1346 else | |
1347 { | |
1348 v26 = pBitmaps_LOD->LoadTexture(Dst); | |
1349 v27 = pDest; | |
1350 *(short *)&pDest[(unsigned int)pFaces + 74] = v26; | |
1351 v27[(unsigned int)pFaces + 45] &= 0xBFu; | |
1352 } | |
1353 } | |
1354 else | |
1355 { | |
1356 *(short *)&pDest[(unsigned int)pFaces + 74] = pBitmaps_LOD->LoadTexture(Dst); | |
1357 } | |
1358 ++Argsb; | |
1359 pDest += 96; | |
1360 } | |
1361 while ( Argsb < (signed int)uNumFaces ); | |
1362 } | |
1363 fseek(v7, v211, 0); | |
1364 fread(&uNumFaceExtras, 4u, 1u, v7); | |
1365 fseek(v7, v212, 0); | |
1366 fread(pFaceExtras, 0x24u, uNumFaceExtras, v7); | |
1367 Argsc = 0; | |
1368 if ( (signed int)uNumFaceExtras > 0 ) | |
1369 { | |
1370 pDest = 0; | |
1371 do | |
1372 { | |
1373 fread(Dst, 1u, 0xAu, v7); | |
1374 v28 = pBitmaps_LOD->LoadTexture(Dst); | |
1375 v29 = pFaceExtras; | |
1376 v30 = pDest; | |
1377 ++Argsc; | |
1378 pDest += 36; | |
1379 *(unsigned __int16 *)((char *)&v29->uAdditionalBitmapID + (int)v30) = v28; | |
1380 } | |
1381 while ( Argsc < (signed int)uNumFaceExtras ); | |
1382 } | |
1383 Argsd = 0; | |
1384 if ( (signed int)uNumFaces > 0 ) | |
1385 { | |
1386 pDest = 0; | |
1387 do | |
1388 { | |
1389 v31 = (int)&pFaceExtras[*(short *)&pDest[(unsigned int)pFaces + 72]]; | |
1390 if ( *(short *)(v31 + 26) ) | |
1391 { | |
1392 if ( ((BLVFaceExtra *)v31)->HasEventint() ) | |
1393 pDest[(unsigned int)pFaces + 46] |= 0x10u; | |
1394 else | |
1395 pDest[(unsigned int)pFaces + 46] &= 0xEFu; | |
1396 } | |
1397 ++Argsd; | |
1398 pDest += 96; | |
1399 } | |
1400 while ( Argsd < (signed int)uNumFaces ); | |
1401 } | |
1402 fseek(v7, v213, 0); | |
1403 fread(&uNumSectors, 4u, 1u, v7); | |
1404 fseek(v7, v214, 0); | |
1405 fread(pSectors, 0x74u, uNumSectors, v7); | |
1583 | 1406 v32 = malloc(ptr_0002B0_sector_rdata, blv.uSector_rdata_Size, "L.RData"); |
0 | 1407 v202 = (int)v7; |
1408 ptr_0002B0_sector_rdata = (unsigned __int16 *)v32; | |
1409 fread(v32, 1u, blv.uSector_rdata_Size, (FILE *)v202); | |
1410 v11 = uNumSectors == 0; | |
1411 v12 = uNumSectors < 0; | |
1412 pDest = 0; | |
1413 Argse = 0; | |
1414 if ( !(v12 | v11) ) | |
1415 { | |
1416 v33 = 0; | |
1417 do | |
1418 { | |
1419 pSectors[v33].pFloors = (unsigned __int16 *)&pDest[(unsigned int)ptr_0002B0_sector_rdata]; | |
1420 i = (size_t)&pSectors[v33]; | |
1421 v34 = ptr_0002B0_sector_rdata; | |
1422 pDest += 2 * *(short *)(i + 4); | |
1423 *(int *)(i + 16) = (int)(char *)v34 + (int)pDest; | |
1424 v35 = (size_t)&pSectors[v33]; | |
1425 i = v35; | |
1426 v36 = &pDest[2 * *(short *)(v35 + 12)]; | |
1427 v37 = (int)&v36[(unsigned int)ptr_0002B0_sector_rdata]; | |
1428 pDest = v36; | |
1429 *(int *)(i + 24) = v37; | |
1430 v38 = (size_t)&pSectors[v33]; | |
1431 i = v38; | |
1432 v39 = &pDest[2 * *(short *)(v38 + 20)]; | |
1433 v40 = (int)&v39[(unsigned int)ptr_0002B0_sector_rdata]; | |
1434 pDest = v39; | |
1435 *(int *)(i + 32) = v40; | |
1436 i = (size_t)&pSectors[v33]; | |
1437 v41 = ptr_0002B0_sector_rdata; | |
1438 pDest += 2 * *(short *)(i + 28); | |
1439 *(int *)(i + 40) = (int)(char *)v41 + (int)pDest; | |
1440 i = (size_t)&pSectors[v33]; | |
1441 v42 = ptr_0002B0_sector_rdata; | |
1442 pDest += 2 * *(short *)(i + 36); | |
1443 *(int *)(i + 48) = (int)(char *)v42 + (int)pDest; | |
1444 i = (size_t)&pSectors[v33]; | |
1445 v43 = ptr_0002B0_sector_rdata; | |
1446 pDest += 2 * *(short *)(i + 44); | |
1447 *(int *)(i + 64) = (int)(char *)v43 + (int)pDest; | |
1448 i = (size_t)&pSectors[v33]; | |
1449 v44 = ptr_0002B0_sector_rdata; | |
1450 pDest += 2 * *(short *)(i + 60); | |
1451 *(int *)(i + 72) = (int)(char *)v44 + (int)pDest; | |
1452 v45 = (size_t)&pSectors[v33]; | |
1453 ++v33; | |
1454 i = v45; | |
1455 v46 = ptr_0002B0_sector_rdata; | |
1456 pDest += 2 * *(short *)(v45 + 68); | |
1457 ++Argse; | |
1458 *(int *)(v45 + 80) = (int)(char *)v46 + (int)pDest; | |
1459 pDest += 2 * *((short *)&pSectors[v33] - 20); | |
1460 } | |
1461 while ( Argse < uNumSectors ); | |
1462 } | |
1583 | 1463 v47 = malloc( |
0 | 1464 ptr_0002B8_sector_lrdata, |
1465 blv.uSector_lrdata_Size, | |
1466 "L.RLData"); | |
1467 v202 = (int)v7; | |
1468 ptr_0002B8_sector_lrdata = (unsigned __int16 *)v47; | |
1469 fread(v47, 1u, blv.uSector_lrdata_Size, (FILE *)v202); | |
1470 v11 = uNumSectors == 0; | |
1471 v12 = uNumSectors < 0; | |
1472 pDest = 0; | |
1473 Argsf = 0; | |
1474 if ( !(v12 | v11) ) | |
1475 { | |
1476 v48 = pSectors; | |
1477 v49 = 0; | |
1478 for ( i = 0; ; v49 = i ) | |
1479 { | |
1480 v50 = ptr_0002B8_sector_lrdata; | |
1481 i += 116; | |
1482 ++Argsf; | |
1483 *(BLVLightMM7 **)((char *)&v48->pLights + v49) = (BLVLightMM7 *)((char *)v50 + (int)pDest); | |
1484 v48 = pSectors; | |
1485 pDest += 2 * *(__int16 *)((char *)&v48->uNumLights + v49); | |
1486 if ( Argsf >= uNumSectors ) | |
1487 break; | |
1488 } | |
1489 } | |
1490 fseek(v7, v215, 0); | |
1491 fread(&uNumDoors, 4u, 1u, v7); | |
1492 fseek(v7, v216, 0); | |
1493 fread(pDoors, 0x50u, 0xC8u, v7); | |
1583 | 1494 v51 = malloc(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData"); |
0 | 1495 v202 = (int)v7; |
1496 ptr_0002B4_doors_ddata = (unsigned __int16 *)v51; | |
1497 fread(v51, 1u, blv.uDoors_ddata_Size, (FILE *)v202); | |
1498 v11 = uNumDoors == 0; | |
1499 v12 = uNumDoors < 0; | |
1500 pDest = 0; | |
1501 Argsg = 0; | |
1502 if ( !(v12 | v11) ) | |
1503 { | |
1504 v52 = 0; | |
1505 do | |
1506 { | |
1507 pDoors[v52].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)ptr_0002B4_doors_ddata]; | |
1508 i = (size_t)&pDoors[v52]; | |
1509 v53 = ptr_0002B4_doors_ddata; | |
1510 pDest += 2 * *(short *)(i + 68); | |
1511 *(int *)(i + 40) = (int)(char *)v53 + (int)pDest; | |
1512 v54 = (size_t)&pDoors[v52]; | |
1513 i = v54; | |
1514 v55 = &pDest[2 * *(short *)(v54 + 70)]; | |
1515 v56 = (int)&v55[(unsigned int)ptr_0002B4_doors_ddata]; | |
1516 pDest = v55; | |
1517 *(int *)(i + 44) = v56; | |
1518 v57 = (size_t)&pDoors[v52]; | |
1519 i = v57; | |
1520 v58 = &pDest[2 * *(short *)(v57 + 72)]; | |
1521 v59 = (int)&v58[(unsigned int)ptr_0002B4_doors_ddata]; | |
1522 pDest = v58; | |
1523 *(int *)(i + 48) = v59; | |
1524 i = (size_t)&pDoors[v52]; | |
1525 v60 = ptr_0002B4_doors_ddata; | |
1526 pDest += 2 * *(short *)(i + 70); | |
1527 *(int *)(i + 52) = (int)(char *)v60 + (int)pDest; | |
1528 i = (size_t)&pDoors[v52]; | |
1529 v61 = ptr_0002B4_doors_ddata; | |
1530 pDest += 2 * *(short *)(i + 70); | |
1531 *(int *)(i + 56) = (int)(char *)v61 + (int)pDest; | |
1532 i = (size_t)&pDoors[v52]; | |
1533 v62 = ptr_0002B4_doors_ddata; | |
1534 pDest += 2 * *(short *)(i + 74); | |
1535 *(int *)(i + 60) = (int)(char *)v62 + (int)pDest; | |
1536 i = (size_t)&pDoors[v52]; | |
1537 v63 = ptr_0002B4_doors_ddata; | |
1538 pDest += 2 * *(short *)(i + 74); | |
1539 *(int *)(i + 64) = (int)(char *)v63 + (int)pDest; | |
1540 ++Argsg; | |
1541 v64 = pDoors[v52].uNumOffsets; | |
1542 ++v52; | |
1543 pDest += 2 * v64; | |
1544 } | |
1545 while ( Argsg < uNumDoors ); | |
1546 } | |
1547 Argsh = 0; | |
1548 if ( uNumDoors > 0 ) | |
1549 { | |
1550 v65 = pDoors; | |
1551 pDest = 0; | |
1552 do | |
1553 { | |
1554 i = 0; | |
1555 v66 = &pDest[(int)v65]; | |
1556 if ( *(short *)&pDest[(int)v65 + 70] > 0 ) | |
1557 { | |
1558 do | |
1559 { | |
1560 v67 = *((int *)v66 + 10); | |
1561 a3 = 2 * i; | |
1562 v68 = *(short *)(v67 + 2 * i); | |
1563 v69 = pFaces; | |
1564 ++i; | |
1565 v70 = (int)&pFaceExtras[v69[v68].uFaceExtraID]; | |
1566 v71 = *((int *)v66 + 12); | |
1567 v72 = a3; | |
1568 v238 = (char *)v70; | |
1569 *(short *)(a3 + v71) = *(short *)(v70 + 20); | |
1570 *(__int16 *)(*(char **)((char *)&pDoors->pDeltaVs + (unsigned int)pDest) + v72) = *((short *)v238 + 11); | |
1571 v65 = pDoors; | |
1572 v66 = &pDest[(int)v65]; | |
1573 } | |
1574 while ( (signed int)i < *(short *)&pDest[(int)v65 + 70] ); | |
1575 } | |
1576 ++Argsh; | |
1577 pDest += 80; | |
1578 } | |
1579 while ( Argsh < uNumDoors ); | |
1580 } | |
1581 fseek(v7, v217, 0); | |
1582 fread(&uNumLevelDecorations, 4u, 1u, v7); | |
1583 fseek(v7, v218, 0); | |
1584 fread(pLevelDecorations, 0x20u, uNumLevelDecorations, v7); | |
1585 Argsi = 0; | |
1586 if ( (signed int)uNumLevelDecorations > 0 ) | |
1587 { | |
1588 pDest = (char *)pLevelDecorations; | |
1589 do | |
1590 { | |
1591 fread(pName, 1u, 0x20u, v7); | |
1592 v73 = pDecorationList->GetDecorIdByName(pName); | |
1593 v74 = pDest; | |
1594 ++Argsi; | |
1595 pDest += 32; | |
1596 *(short *)v74 = v73; | |
1597 } | |
1598 while ( Argsi < (signed int)uNumLevelDecorations ); | |
1599 } | |
1600 fseek(v7, v219, 0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
1601 fread(&uNumSpriteObjects, 4u, 1u, v7); |
0 | 1602 fseek(v7, v220, 0); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
1603 fread(pSpriteObjects, 0x70u, uNumSpriteObjects, v7); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
1604 if ( (signed int)uNumSpriteObjects > 0 ) |
0 | 1605 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
1606 v75 = pSpriteObjects; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
1607 pDest = (char *)uNumSpriteObjects; |
0 | 1608 do |
1609 { | |
1610 Argsj = 0; | |
1611 v76 = 48 * v75->stru_24.uItemID; | |
1612 v11 = pObjectList->uNumObjects == 0; | |
1613 v12 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1614 LOWORD(v76) = *(unsigned __int16 *)((char *)&pItemsTable->pItems[0].uSpriteID + v76); | |
1615 i = v76; | |
1616 v75->uItemType = v76; | |
1617 if ( v12 | v11 ) | |
1618 { | |
1619 LABEL_50: | |
1620 v78 = 0; | |
1621 } | |
1622 else | |
1623 { | |
1624 for ( j = (int)&pObjectList->pObjects->uObjectID; (short)v76 != *(short *)j; j = a3 ) | |
1625 { | |
1626 ++Argsj; | |
1627 a3 = j + 56; | |
1628 if ( Argsj >= (signed int)pObjectList->uNumObjects ) | |
1629 goto LABEL_50; | |
1630 LOWORD(v76) = i; | |
1631 } | |
1632 v78 = Argsj; | |
1633 } | |
1634 v75->uObjectDescID = v78; | |
1635 ++v75; | |
1636 --pDest; | |
1637 } | |
1638 while ( pDest ); | |
1639 } | |
1640 fseek(v7, v221, 0); | |
1641 fread(&uNumActors, 4u, 1u, v7); | |
1642 fseek(v7, v222, 0); | |
1643 fread(pActors, 0x344u, uNumActors, v7); | |
1644 fseek(v7, v228, 0); | |
1645 fread(&uNumChests, 4u, 1u, v7); | |
1646 fseek(v7, v229, 0); | |
1647 fread(pChests, 0x14CCu, uNumChests, v7); | |
1648 fseek(v7, v224, 0); | |
1649 fread(&uNumLights, 4u, 1u, v7); | |
1650 fseek(v7, v225, 0); | |
1651 fread(pLights, 0x10u, uNumLights, v7); | |
1652 fseek(v7, v226, 0); | |
1653 fread(&uNumNodes, 4u, 1u, v7); | |
1654 fseek(v7, v227, 0); | |
1655 fread(pNodes, 8u, uNumNodes, v7); | |
1656 fseek(v7, v230, 0); | |
1657 fread(&uNumSpawnPoints, 4u, 1u, v7); | |
1583 | 1658 v79 = malloc(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn"); |
0 | 1659 v202 = 0; |
1660 pSpawnPoints = (SpawnPointMM7 *)v79; | |
1661 fseek(v7, v231, v202); | |
1662 fread(pSpawnPoints, 0x18u, uNumSpawnPoints, v7); | |
1663 fseek(v7, v232, 0); | |
1664 fread(&dlv, 0x28u, 1u, v7); | |
1665 fseek(v7, v233, 0); | |
1666 fread(&stru_5E4C90, 1u, 0xC8u, v7); | |
1667 fseek(v7, v234, 0); | |
1668 fread(&uLastVisitDay, 1u, 0x38u, v7); | |
1669 fseek(v7, v223, 0); | |
1670 v80 = (void **)&pMapOutlines; | |
1671 fread(*v80, 4u, 1u, v7); | |
1672 fread((char *)*v80 + 4, 0xCu, *(int *)*v80, v7); | |
1673 fclose(v7); | |
1674 goto LABEL_179; | |
1675 } | |
1676 return 4; | |
1677 }*/ | |
1678 #pragma endregion | |
1679 | |
1680 if (bLoaded) | |
1681 { | |
1682 Log::Warning(L"BLV is already loaded"); | |
1683 return 3; | |
1684 } | |
1685 | |
1686 if ( !pGames_LOD->DoesContainerExist(pFilename) ) | |
1545 | 1687 Error("Unable to find %s in Games.LOD", pFilename); |
0 | 1688 |
1689 //v238 = pFilename - 4; | |
1690 //v81 = strlen(pFilename); | |
1691 strcpy(this->pFilename, pFilename); | |
1692 strcpy(&pFilename[strlen(pFilename) - 4], ".blv"); | |
1693 File = pGames_LOD->FindContainer(pFilename, 1); | |
1694 //File = v82; | |
1695 | |
1696 Release(); | |
1697 if ( !Alloc() ) | |
1698 return 4; | |
1699 | |
1700 header.uVersion = 91969; | |
1701 header.pMagic[0] = 'm'; | |
1702 header.pMagic[1] = 'v'; | |
1703 header.pMagic[2] = 'i'; | |
1704 header.pMagic[3] = 'i'; | |
1705 header.uCompressedSize = 0; | |
1706 header.uDecompressedSize = 0; | |
1707 fread(&header, sizeof(ODMHeader), 1u, File); | |
1708 if (header.uVersion != 91969 || | |
1709 header.pMagic[0] != 'm' || | |
1710 header.pMagic[1] != 'v' || | |
1711 header.pMagic[2] != 'i' || | |
1712 header.pMagic[3] != 'i' ) | |
1713 { | |
1714 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:792", 0); | |
1715 } | |
1716 //v83 = header.uCompressedSize; | |
1717 //pSource = header.uDecompressedSize; | |
1718 //v84 = malloc(header.uDecompressedSize); | |
1719 //v85 = v84; | |
1720 //ptr = v84; | |
1980 | 1721 void* pRawBLV = malloc(header.uDecompressedSize); |
0 | 1722 memset(pRawBLV, 0, header.uDecompressedSize); |
1723 | |
1724 if (header.uCompressedSize == header.uDecompressedSize) | |
1725 fread(pRawBLV, header.uDecompressedSize, 1, File); | |
1726 else if (header.uCompressedSize < header.uDecompressedSize) | |
1727 { | |
1980 | 1728 void* pTmpMem = malloc(header.uCompressedSize); |
0 | 1729 { |
1730 fread(pTmpMem, header.uCompressedSize, 1, File); | |
1731 | |
1732 uint uDecompressedSize = header.uDecompressedSize; | |
1733 zlib::MemUnzip(pRawBLV, &uDecompressedSize, pTmpMem, header.uCompressedSize); | |
1734 | |
1735 if (uDecompressedSize != header.uDecompressedSize) | |
1736 Log::Warning(L"uDecompressedSize != header.uDecompressedSize in BLV"); | |
1737 } | |
1738 free(pTmpMem); | |
1739 } | |
1740 else | |
1741 { | |
1742 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:803", 0); | |
1743 return 0; | |
1744 } | |
1745 | |
1746 bLoaded = true; | |
1747 | |
1980 | 1748 char* pData = (char *)pRawBLV; |
0 | 1749 |
1750 pGameLoadingUI_ProgressBar->Progress(); | |
1751 | |
1752 memcpy(&blv, pData, 136); | |
1753 memcpy(&uNumVertices, pData += 136, 4); | |
1754 memcpy(pVertices, pData += 4, uNumVertices * sizeof(Vec3_short_)); | |
1755 | |
1756 pGameLoadingUI_ProgressBar->Progress(); | |
1757 | |
1758 memcpy(&uNumFaces, pData += uNumVertices * sizeof(Vec3_short_), 4); | |
1759 | |
1760 pGameLoadingUI_ProgressBar->Progress(); | |
1761 | |
1762 memcpy(pFaces, pData += 4, uNumFaces * sizeof (BLVFace)); | |
1583 | 1763 pLFaces = (unsigned __int16 *)malloc(blv.uFaces_fdata_Size); |
1006 | 1764 |
1765 memcpy(pLFaces, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size); | |
0 | 1766 |
1767 for (uint i = 0, j = 0; i < uNumFaces; ++i) | |
1768 { | |
1980 | 1769 BLVFace* pFace = &pFaces[i]; |
1770 | |
1771 pFace->pVertexIDs = &pLFaces[j]; | |
0 | 1772 |
1773 j += pFace->uNumVertices + 1; | |
1980 | 1774 pFace->pXInterceptDisplacements = (short *)(&pLFaces[j]); |
0 | 1775 |
1776 j += pFace->uNumVertices + 1; | |
1980 | 1777 pFace->pYInterceptDisplacements = (short *)(&pLFaces[j]); |
0 | 1778 |
1779 j += pFace->uNumVertices + 1; | |
1980 | 1780 pFace->pZInterceptDisplacements = (short *)(&pLFaces[j]); |
0 | 1781 |
1782 j += pFace->uNumVertices + 1; | |
1980 | 1783 pFace->pVertexUIDs = (__int16 *)(&pLFaces[j]); |
0 | 1784 |
1785 j += pFace->uNumVertices + 1; | |
1980 | 1786 pFace->pVertexVIDs = (__int16 *)(&pLFaces[j]); |
0 | 1787 |
1788 j += pFace->uNumVertices + 1; | |
1789 /*v93 = &pFaces[v92]; | |
1790 Src = v93; | |
1791 v94 = (BLVSector *)((char *)v244 + 2 * v93->uNumVertices + 2); | |
1792 v95 = (unsigned __int16 *)((char *)v94 + (unsigned int)ptr_2AC); | |
1793 v244 = v94; | |
1794 Src->pXInterceptDisplacements = v95; | |
1795 v96 = (int)&pFaces[v92]; | |
1796 Src = (BLVFace *)v96; | |
1797 v97 = (BLVSector *)((char *)v244 + 2 * *(char *)(v96 + 93) + 2); | |
1798 v98 = (unsigned __int16 *)((char *)v97 + (unsigned int)ptr_2AC); | |
1799 v244 = v97; | |
1800 Src->pYInterceptDisplacements = v98; | |
1801 Src = &pFaces[v92]; | |
1802 v99 = ptr_2AC; | |
1803 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
1804 Src->pZInterceptDisplacements = (unsigned __int16 *)((char *)v99 + (int)v244); | |
1805 Src = &pFaces[v92]; | |
1806 v100 = ptr_2AC; | |
1807 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
1808 Src->pVertexUIDs = (unsigned __int16 *)((char *)v100 + (int)v244); | |
1809 Src = &pFaces[v92]; | |
1810 ++v92; | |
1811 v101 = ptr_2AC; | |
1812 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
1813 ++v245; | |
1814 Src->pVertexVIDs = (unsigned __int16 *)((char *)v101 + (int)v244); | |
1815 v244 = (BLVSector *)((char *)v244 + 2 * *((char *)&pFaces[v92] - 3) + 2);*/ | |
1816 } | |
1817 | |
1818 pGameLoadingUI_ProgressBar->Progress(); | |
1819 | |
1820 pData += blv.uFaces_fdata_Size; | |
1821 | |
1822 for (uint i = 0; i < uNumFaces; ++i) | |
1823 { | |
1980 | 1824 BLVFace* pFace = &pFaces[i]; |
0 | 1825 |
1826 char pTexName[16]; | |
1827 strncpy(pTexName, pData, 10); | |
1828 pData += 10; | |
1829 | |
1830 if (pFace->uAttributes & 0x4000) | |
1831 { | |
1832 pFace->uBitmapID = pTextureFrameTable->FindTextureByName(pTexName); | |
1833 if (pFace->uBitmapID) | |
1834 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pFace->uBitmapID); | |
1835 else | |
1836 { | |
1837 pFace->uBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
1838 pFace->uAttributes &= ~0x4000; | |
1839 } | |
1840 } | |
1841 else | |
1842 pFace->uBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
1843 } | |
1844 | |
1845 pGameLoadingUI_ProgressBar->Progress(); | |
1846 | |
1847 memcpy(&uNumFaceExtras, pData, 4u); | |
1848 memcpy(pFaceExtras, pData += 4, uNumFaceExtras * sizeof(BLVFaceExtra)); | |
1849 pData += uNumFaceExtras * sizeof(BLVFaceExtra); | |
1850 | |
1851 pGameLoadingUI_ProgressBar->Progress(); | |
1852 | |
1853 //v108 = (char *)v107 + 36 * uNumFaceExtras; | |
1854 //v245 = 0; | |
1855 //*(int *)((char *)&uSourceLen + 1) = 0; | |
1856 for (uint i = 0; i < uNumFaceExtras; ++i) | |
1857 { | |
1858 char pTexName[32]; | |
1859 strncpy(pTexName, pData, 10); | |
1860 pData += 10; | |
1861 | |
1862 if (!strcmp(pTexName, "")) | |
1863 pFaceExtras[i].uAdditionalBitmapID = -1; | |
1864 else | |
1865 pFaceExtras[i].uAdditionalBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
1866 } | |
1867 | |
1868 | |
1869 for (uint i = 0; i < uNumFaces; ++i) | |
1870 { | |
1980 | 1871 BLVFace* pFace = &pFaces[i]; |
1872 BLVFaceExtra* pFaceExtra = &pFaceExtras[pFace->uFaceExtraID]; | |
0 | 1873 |
1874 if (pFaceExtra->uEventID) | |
1875 { | |
1876 if (pFaceExtra->HasEventint()) | |
1877 pFace->uAttributes |= 0x100000; | |
1878 else | |
1879 pFace->uAttributes &= ~0x100000; | |
1880 } | |
1881 } | |
1882 | |
1883 pGameLoadingUI_ProgressBar->Progress(); | |
1884 | |
1885 memcpy(&uNumSectors, pData, 4); | |
1886 memcpy(pSectors, pData + 4, uNumSectors * sizeof(BLVSector)); | |
1887 pData += 4 + uNumSectors * sizeof(BLVSector); | |
1888 | |
1889 pGameLoadingUI_ProgressBar->Progress(); | |
1890 | |
1583 | 1891 ptr_0002B0_sector_rdata = (unsigned short *)malloc(blv.uSector_rdata_Size);//, "L.RData"); |
0 | 1892 memcpy(ptr_0002B0_sector_rdata, pData, blv.uSector_rdata_Size); |
1893 pData += blv.uSector_rdata_Size; | |
1894 | |
1895 for (uint i = 0, j = 0; i < uNumSectors; ++i) | |
1896 { | |
1980 | 1897 BLVSector* pSector = &pSectors[i]; |
1898 | |
1899 pSector->pFloors = &ptr_0002B0_sector_rdata[j]; | |
0 | 1900 j += pSector->uNumFloors; |
1901 | |
1980 | 1902 pSector->pWalls = &ptr_0002B0_sector_rdata[j]; |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
1903 j += pSector->uNumWalls; |
0 | 1904 |
1980 | 1905 pSector->pCeilings = &ptr_0002B0_sector_rdata[j]; |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
1906 j += pSector->uNumCeilings; |
0 | 1907 |
1980 | 1908 pSector->pFluids = &ptr_0002B0_sector_rdata[j]; |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
1909 j += pSector->uNumFluids; |
0 | 1910 |
1980 | 1911 pSector->pPortals = &ptr_0002B0_sector_rdata[j]; |
0 | 1912 j += pSector->uNumPortals; |
1913 | |
1980 | 1914 pSector->pFaceIDs = &ptr_0002B0_sector_rdata[j]; |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
1915 j += pSector->uNumFaces; |
0 | 1916 |
1980 | 1917 pSector->pCogs = &ptr_0002B0_sector_rdata[j]; |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
1918 j += pSector->uNumCogs; |
0 | 1919 |
1980 | 1920 pSector->pDecorationIDs = &ptr_0002B0_sector_rdata[j]; |
0 | 1921 j += pSector->uNumDecorations; |
1922 | |
1980 | 1923 pSector->pMarkers = &ptr_0002B0_sector_rdata[j]; |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
1924 j += pSector->uNumMarkers; |
0 | 1925 |
1926 | |
1927 //do | |
1928 //{ | |
1929 /*pSectors[v118].pFloors = (unsigned __int16 *)((char *)Src + (unsigned int)ptr_0002B0_sector_rdata); | |
1930 v244 = &pSectors[v118]; | |
1931 v119 = ptr_0002B0_sector_rdata; | |
1932 Src = (BLVFace *)((char *)Src + 2 * v244->field_4); | |
1933 v244->pWalls = (unsigned __int16 *)((char *)v119 + (int)Src); | |
1934 v120 = (int)&pSectors[v118]; | |
1935 v244 = (BLVSector *)v120; | |
1936 v121 = (BLVFace *)((char *)Src + 2 * *(short *)(v120 + 12)); | |
1937 v122 = (unsigned __int16 *)((char *)v121 + (unsigned int)ptr_0002B0_sector_rdata); | |
1938 Src = v121; | |
1939 v244->pCeilings = v122; | |
1940 v123 = (int)&pSectors[v118]; | |
1941 v244 = (BLVSector *)v123; | |
1942 v124 = (BLVFace *)((char *)Src + 2 * *(short *)(v123 + 20)); | |
1943 v125 = (unsigned __int16 *)((char *)v124 + (unsigned int)ptr_0002B0_sector_rdata); | |
1944 Src = v124; | |
1945 v244->pFluids = v125; | |
1946 v244 = &pSectors[v118]; | |
1947 v126 = ptr_0002B0_sector_rdata; | |
1948 Src = (BLVFace *)((char *)Src + 2 * v244->field_1C); | |
1949 v244->pPortals = (unsigned __int16 *)((char *)v126 + (int)Src); | |
1950 v244 = &pSectors[v118]; | |
1951 v127 = ptr_0002B0_sector_rdata; | |
1952 Src = (BLVFace *)((char *)Src + 2 * v244->uNumPortals); | |
1953 v244->pFaceIDs = (unsigned __int16 *)((char *)v127 + (int)Src); | |
1954 v244 = &pSectors[v118]; | |
1955 v128 = ptr_0002B0_sector_rdata; | |
1956 Src = (BLVFace *)((char *)Src + 2 * v244->field_2C); | |
1957 v244->pCogs = (unsigned __int16 *)((char *)v128 + (int)Src); | |
1958 v244 = &pSectors[v118]; | |
1959 v129 = ptr_0002B0_sector_rdata; | |
1960 Src = (BLVFace *)((char *)Src + 2 * v244->field_3C); | |
1961 v244->pDecorationIDs = (unsigned __int16 *)((char *)v129 + (int)Src); | |
1962 v130 = (int)&pSectors[v118]; | |
1963 ++v118; | |
1964 v244 = (BLVSector *)v130; | |
1965 v131 = ptr_0002B0_sector_rdata; | |
1966 Src = (BLVFace *)((char *)Src + 2 * *(short *)(v130 + 68)); | |
1967 ++v245; | |
1968 *(int *)(v130 + 80) = (int)(char *)v131 + (int)Src; | |
1969 Src = (BLVFace *)((char *)Src + 2 * *((short *)&pSectors[v118] - 20));*/ | |
1970 //} | |
1971 //while ( v245 < uNumSectors ); | |
1972 } | |
1973 | |
1583 | 1974 ptr_0002B8_sector_lrdata = (unsigned __int16 *)malloc(blv.uSector_lrdata_Size);//, "L.RLData"); |
0 | 1975 memcpy(ptr_0002B8_sector_lrdata, pData, blv.uSector_lrdata_Size); |
1976 pData += blv.uSector_lrdata_Size; | |
1977 | |
1978 pGameLoadingUI_ProgressBar->Progress(); | |
1979 | |
1980 for (uint i = 0, j = 0; i < uNumSectors; ++i) | |
1981 { | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
1982 pSectors[i].pLights = ptr_0002B8_sector_lrdata + j; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
1983 j += pSectors[i].uNumLights; |
0 | 1984 } |
1985 | |
1986 pGameLoadingUI_ProgressBar->Progress(); | |
1987 | |
1988 memcpy(&uNumDoors, pData, 4); | |
1989 pData += 4; | |
1990 | |
1991 pGameLoadingUI_ProgressBar->Progress(); | |
1992 pGameLoadingUI_ProgressBar->Progress(); | |
1993 | |
1994 memcpy(&uNumLevelDecorations, pData, 4); | |
1202 | 1995 memcpy(pLevelDecorations.data(), pData + 4, uNumLevelDecorations * sizeof(LevelDecoration)); |
0 | 1996 pData += 4 + uNumLevelDecorations * sizeof(LevelDecoration); |
1997 | |
1998 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
1999 { | |
2000 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pData); | |
2001 | |
2002 pData += 32; | |
2003 } | |
2004 | |
2005 pGameLoadingUI_ProgressBar->Progress(); | |
2006 | |
2007 memcpy(&uNumLights, pData, 4); | |
2008 memcpy(pLights, pData + 4, uNumLights * sizeof(BLVLightMM7)); | |
2009 pData += 4 + uNumLights * sizeof(BLVLightMM7); | |
2010 | |
2011 pGameLoadingUI_ProgressBar->Progress(); | |
2012 pGameLoadingUI_ProgressBar->Progress(); | |
2013 | |
2014 memcpy(&uNumNodes, pData, 4); | |
2015 memcpy(pNodes, pData + 4, uNumNodes * sizeof(BSPNode)); | |
2016 pData += 4 + uNumNodes * sizeof(BSPNode); | |
2017 | |
2018 pGameLoadingUI_ProgressBar->Progress(); | |
2019 pGameLoadingUI_ProgressBar->Progress(); | |
2020 | |
2021 memcpy(&uNumSpawnPoints, pData, 4); | |
1583 | 2022 pSpawnPoints = (SpawnPointMM7 *)malloc(uNumSpawnPoints * sizeof(SpawnPointMM7)); |
0 | 2023 memcpy(pSpawnPoints, pData + 4, uNumSpawnPoints * sizeof(SpawnPointMM7)); |
2024 pData += 4 + uNumSpawnPoints * sizeof(SpawnPointMM7); | |
2025 | |
2026 pGameLoadingUI_ProgressBar->Progress(); | |
2027 pGameLoadingUI_ProgressBar->Progress(); | |
2028 | |
2029 //v201 = (const char *)v148; | |
2030 //v200 = (size_t)pMapOutlines; | |
2031 memcpy(&pMapOutlines->uNumOutlines, pData, 4); | |
2032 memcpy(pMapOutlines->pOutlines, pData + 4, pMapOutlines->uNumOutlines * sizeof(BLVMapOutline)); | |
2033 //v149 = pMapOutlines; | |
2034 //v199 = 12 * *v149; | |
2035 //memcpy(v149 + 1, (const void *)(v148 + 4), v199); | |
2036 free(pRawBLV); | |
2037 pRawBLV = nullptr; | |
2038 | |
2039 void *pRawDLV = nullptr; | |
2040 strcpy(&pFilename[strlen(pFilename) - 4], ".dlv"); | |
2041 File = pNew_LOD->FindContainer(pFilename, 1); | |
2042 fread(&header, 0x10u, 1u, File);//(FILE *)v245); | |
2043 bool _v244 = false; | |
2044 if (header.uVersion != 91969 || | |
2045 header.pMagic[0] != 'm' || | |
2046 header.pMagic[1] != 'v' || | |
2047 header.pMagic[2] != 'i' || | |
2048 header.pMagic[3] != 'i' ) | |
2049 { | |
2050 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1090", 0); | |
2051 _v244 = true; | |
2052 } | |
2053 else | |
2054 { | |
2055 pRawDLV = malloc(header.uDecompressedSize); | |
2056 if (header.uCompressedSize == header.uDecompressedSize) | |
2057 fread(pRawDLV, 1, header.uCompressedSize, File); | |
2058 else if (header.uCompressedSize < header.uDecompressedSize) | |
2059 { | |
1980 | 2060 void* pTmpMem = malloc(header.uCompressedSize); |
0 | 2061 { |
2062 fread(pTmpMem, header.uCompressedSize, 1, File); | |
2063 | |
2064 uint uDecompressedSize = header.uDecompressedSize; | |
2065 zlib::MemUnzip(pRawDLV, &uDecompressedSize, pTmpMem, header.uCompressedSize); | |
2066 | |
2067 if (uDecompressedSize != header.uDecompressedSize) | |
2068 Log::Warning(L"uDecompressedSize != header.uDecompressedSize in DLV"); | |
2069 } | |
2070 free(pTmpMem); | |
2071 } | |
2072 else | |
2073 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1108", 0); | |
2074 | |
2075 pData = (char *)pRawDLV; | |
2076 } | |
2077 | |
2078 memcpy(&dlv, pData, 40); | |
2079 pData += 40; | |
2080 | |
2081 //v152 = dlv.uNumFacesInBModels; | |
2082 if (dlv.uNumFacesInBModels) | |
2083 { | |
2084 //v153 = dlv.uNumDecorations; | |
2085 if (dlv.uNumDecorations) | |
2086 { | |
2087 if (dlv.uNumFacesInBModels != uNumFaces || | |
2088 dlv.uNumDecorations != uNumLevelDecorations) | |
2089 _v244 = true; | |
2090 } | |
2091 } | |
2092 | |
2061 | 2093 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_2000 ) |
2094 _i = 0x1BAF800; | |
0 | 2095 bool _a = false; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1458
diff
changeset
|
2096 if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName, "d29.dlv") ) |
0 | 2097 _a = true; |
2098 | |
2099 //v154 = 875; | |
2100 if (_v244) | |
2101 { | |
2102 memset(v203, 0, 0x36B); | |
2103 goto LABEL_132; | |
2104 } | |
2105 if (_a || !dlv.uLastRepawnDay ) | |
2106 { | |
2107 memcpy(v203, pData, 0x36B); | |
2108 LABEL_132: | |
435 | 2109 free(pRawDLV); |
0 | 2110 dlv.uLastRepawnDay = a3; |
2111 if (_v244) | |
2112 ++dlv.uNumRespawns; | |
2113 //v201 = pFilename; | |
2114 *(int *)pDest = 1; | |
2115 File = pGames_LOD->FindContainer(pFilename, 0); | |
2116 fread(&header, 0x10u, 1u, File); | |
1980 | 2117 uint v155 = header.uCompressedSize; |
2118 uint Count = header.uDecompressedSize; | |
2119 BLVFace* Src = (BLVFace *)malloc(header.uDecompressedSize); | |
435 | 2120 pRawDLV = Src; |
0 | 2121 if ( v155 <= Count ) |
2122 { | |
2123 if ( v155 == Count ) | |
2124 { | |
2125 fread(Src, 1u, Count, File); | |
2126 } | |
2127 else | |
2128 { | |
1980 | 2129 void* _uSourceLen = malloc(v155); |
0 | 2130 fread(_uSourceLen, v155, 1u, File); |
2131 zlib::MemUnzip(Src, &Count, _uSourceLen, v155); | |
2132 free(_uSourceLen); | |
2133 } | |
2134 } | |
2135 else | |
2136 { | |
2137 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0); | |
2138 } | |
2139 pData = ((char *)Src + 40); | |
2140 //v154 = 875; | |
2141 goto LABEL_140; | |
2142 } | |
2143 *(int *)pDest = 0; | |
2144 LABEL_140: | |
2145 //v202 = (int)".blv"; | |
2146 //v156 = strlen(pFilename); | |
2147 strcpy(&pFilename[strlen(pFilename) - 4], ".blv"); | |
2148 memcpy(_visible_outlines, pData, 875); | |
2149 pData += 875; | |
2150 | |
2151 if ( *(int *)pDest ) | |
2152 memcpy(_visible_outlines, v203, 875); | |
2153 | |
2154 for (uint i = 0; i < pMapOutlines->uNumOutlines; ++i) | |
2155 { | |
1980 | 2156 BLVMapOutline* pVertex = &pMapOutlines->pOutlines[i]; |
0 | 2157 if ((unsigned __int8)(1 << (7 - i % 8)) & _visible_outlines[i / 8]) |
2158 pVertex->uFlags |= 1; | |
2159 } | |
2160 | |
2161 | |
2162 for (uint i = 0; i < uNumFaces; ++i) | |
2163 { | |
1980 | 2164 BLVFace* pFace = &pFaces[i]; |
2165 BLVFaceExtra* pFaceExtra = &pFaceExtras[pFace->uFaceExtraID]; | |
0 | 2166 |
2167 memcpy(&pFace->uAttributes, pData, 4); | |
2168 pData += 4; | |
2169 | |
2170 if (pFaceExtra->uEventID) | |
2171 { | |
2172 if (pFaceExtra->HasEventint()) | |
2173 pFace->uAttributes |= 0x100000; | |
2174 else | |
2175 pFace->uAttributes &= ~0x100000; | |
2176 } | |
2177 } | |
2178 | |
2179 pGameLoadingUI_ProgressBar->Progress(); | |
2180 | |
2181 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2182 { | |
1489 | 2183 memcpy(&pLevelDecorations[i].uFlags, pData, 2); |
0 | 2184 pData += 2; |
2185 } | |
2186 | |
2187 pGameLoadingUI_ProgressBar->Progress(); | |
2188 | |
2189 memcpy(&uNumActors, pData, 4); | |
1202 | 2190 memcpy(pActors.data(), pData + 4, uNumActors * sizeof(Actor)); |
0 | 2191 pData += 4 + uNumActors * sizeof(Actor); |
2192 | |
2193 pGameLoadingUI_ProgressBar->Progress(); | |
2194 pGameLoadingUI_ProgressBar->Progress(); | |
2195 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2196 memcpy(&uNumSpriteObjects, pData, 4); |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2197 memcpy(pSpriteObjects.data(), pData + 4, uNumSpriteObjects * sizeof(SpriteObject)); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2198 pData += 4 + uNumSpriteObjects * sizeof(SpriteObject); |
0 | 2199 |
2200 pGameLoadingUI_ProgressBar->Progress(); | |
2201 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2202 for (uint i = 0; i < uNumSpriteObjects; ++i) |
0 | 2203 { |
1980 | 2204 SpriteObject* pItem = &pSpriteObjects[i]; |
0 | 2205 |
2206 if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100)) | |
2207 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2208 pItem->uType = pItemsTable->pItems[pItem->stru_24.uItemID - 1].uSpriteID; |
0 | 2209 |
2210 uint uObjectID = 0; | |
2211 for (uint j = 0; j < pObjectList->uNumObjects; ++j) | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2212 if (pItem->uType == pObjectList->pObjects[j].uObjectID) |
0 | 2213 { |
2214 pItem->uObjectDescID = j; | |
2215 break; | |
2216 } | |
2217 } | |
2218 } | |
2219 | |
2220 pGameLoadingUI_ProgressBar->Progress(); | |
2221 | |
2222 memcpy(&uNumChests, pData, 4); | |
1202 | 2223 memcpy(pChests.data(), pData + 4, uNumChests * sizeof(Chest)); |
0 | 2224 pData += 4 + uNumChests * sizeof(Chest); |
2225 | |
2226 pGameLoadingUI_ProgressBar->Progress(); | |
2227 pGameLoadingUI_ProgressBar->Progress(); | |
2228 | |
2229 memcpy(pDoors, pData, 0x3E80); | |
2230 pData += 0x3E80; | |
2231 | |
2232 //v201 = (const char *)blv.uDoors_ddata_Size; | |
2233 //v200 = (size_t)ptr_0002B4_doors_ddata; | |
1583 | 2234 //v170 = malloc(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData"); |
0 | 2235 //v171 = blv.uDoors_ddata_Size; |
1583 | 2236 ptr_0002B4_doors_ddata = (unsigned __int16 *)malloc(blv.uDoors_ddata_Size);//, "L.DData"); |
0 | 2237 memcpy(ptr_0002B4_doors_ddata, pData, blv.uDoors_ddata_Size); |
2238 pData += blv.uDoors_ddata_Size; | |
2239 | |
2240 //Src = (BLVFace *)((char *)Src + v171); | |
2241 //v172 = 0; | |
2242 //v245 = 0; | |
2243 //if (uNumDoors > 0) | |
2244 for (uint i = 0, j = 0; i < uNumDoors; ++i) | |
2245 { | |
1980 | 2246 BLVDoor* pDoor = &pDoors[i]; |
2247 | |
2248 pDoor->pVertexIDs = &ptr_0002B4_doors_ddata[j]; | |
0 | 2249 j += pDoor->uNumVertices; |
2250 | |
1980 | 2251 pDoor->pFaceIDs = &ptr_0002B4_doors_ddata[j]; |
0 | 2252 j += pDoor->uNumFaces; |
2253 | |
1980 | 2254 pDoor->pSectorIDs = &ptr_0002B4_doors_ddata[j]; |
0 | 2255 j += pDoor->field_48; |
2256 | |
1980 | 2257 pDoor->pDeltaUs = (short *)(&ptr_0002B4_doors_ddata[j]); |
0 | 2258 j += pDoor->uNumFaces; |
2259 | |
1980 | 2260 pDoor->pDeltaVs = (short *)(&ptr_0002B4_doors_ddata[j]); |
0 | 2261 j += pDoor->uNumFaces; |
2262 | |
1980 | 2263 pDoor->pXOffsets = &ptr_0002B4_doors_ddata[j]; |
0 | 2264 j += pDoor->uNumOffsets; |
2265 | |
1980 | 2266 pDoor->pYOffsets = &ptr_0002B4_doors_ddata[j]; |
0 | 2267 j += pDoor->uNumOffsets; |
2268 | |
1980 | 2269 pDoor->pZOffsets = &ptr_0002B4_doors_ddata[j]; |
0 | 2270 j += pDoor->uNumOffsets; |
2271 /*v173 = pDoors; | |
2272 for ( k = 0; ; v172 = v188 + 2 * *((short *)&v173[k] - 3) ) | |
2273 { | |
2274 v173[k].pVertexIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v172); | |
2275 v175 = &pDoors[k]; | |
2276 v176 = v172 + 2 * v175->uNumVertices; | |
2277 v175->pFaceIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v176); | |
2278 v177 = &pDoors[k]; | |
2279 v178 = v176 + 2 * v177->uNumFaces; | |
2280 v177->pSectorIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v178); | |
2281 v179 = &pDoors[k]; | |
2282 v180 = v178 + 2 * v179->field_48; | |
2283 v179->pDeltaUs = (__int16 *)((char *)ptr_0002B4_doors_ddata + v180); | |
2284 v181 = &pDoors[k]; | |
2285 v182 = v180 + 2 * v181->uNumFaces; | |
2286 v181->pDeltaVs = (__int16 *)((char *)ptr_0002B4_doors_ddata + v182); | |
2287 v183 = &pDoors[k]; | |
2288 v184 = v182 + 2 * v183->uNumFaces; | |
2289 v183->pXOffsets = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v184); | |
2290 v185 = &pDoors[k]; | |
2291 v186 = v184 + 2 * v185->uNumOffsets; | |
2292 v185->pYOffsets = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v186); | |
2293 v187 = &pDoors[k]; | |
2294 ++k; | |
2295 v188 = v186 + 2 * v187->uNumOffsets; | |
2296 v189 = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v188); | |
2297 ++v245; | |
2298 v187->pZOffsets = v189; | |
2299 v173 = pDoors; | |
2300 if ( v245 >= uNumDoors ) | |
2301 break; | |
2302 }*/ | |
2303 } | |
2304 //v190 = 0; | |
2305 //v245 = 0; | |
2306 for (uint i = 0; i < uNumDoors; ++i) | |
2307 { | |
1980 | 2308 BLVDoor* pDoor = &pDoors[i]; |
0 | 2309 |
2310 for (uint j = 0; j < pDoor->uNumFaces; ++j) | |
2311 { | |
1980 | 2312 BLVFace* pFace = &pFaces[pDoor->pFaceIDs[j]]; |
2313 BLVFaceExtra* pFaceExtra = &pFaceExtras[pFace->uFaceExtraID]; | |
0 | 2314 |
2315 pDoor->pDeltaUs[j] = pFaceExtra->sTextureDeltaU; | |
2316 pDoor->pDeltaVs[j] = pFaceExtra->sTextureDeltaV; | |
2317 } | |
2318 //v191 = pDoors; | |
2319 //pDest = 0; | |
2320 //do | |
2321 // { | |
2322 /*Argsn = 0; | |
2323 for ( l = (BLVDoor *)&v190[(int)v191]; | |
2324 Argsn < *(short *)&v190[(int)v191 + 70]; | |
2325 l = (BLVDoor *)&v190[(int)v191] ) | |
2326 { | |
2327 v193 = Argsn; | |
2328 v194 = l->pFaceIDs[Argsn++]; | |
2329 v195 = &pFaceExtras[pFaces[v194].uFaceExtraID]; | |
2330 l->pDeltaUs[v193] = v195->sTextureDeltaU; | |
2331 v190 = pDest; | |
2332 *(short *)(v193 * 2 + *(int *)&pDest[(unsigned int)pDoors + 52]) = v195->sTextureDeltaV; | |
2333 v191 = pDoors; | |
2334 } | |
2335 ++v245; | |
2336 v190 += 80; | |
2337 pDest = v190;*/ | |
2338 //} | |
2339 //while ( v245 < uNumDoors ); | |
2340 } | |
2341 | |
2342 | |
2343 pGameLoadingUI_ProgressBar->Progress(); | |
2344 | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1705
diff
changeset
|
2345 memcpy(&stru_5E4C90_MapPersistVars, pData, 0xC8); |
0 | 2346 pData += 0xC8; |
2347 | |
2348 pGameLoadingUI_ProgressBar->Progress(); | |
2349 | |
2350 memcpy(&stru1, pData, 0x38u); | |
2351 pData += 0x38; | |
2352 | |
2353 free(pRawDLV); | |
2354 //v5 = 0; | |
2355 | |
2356 pSoundList->LoadSound(64, 0); | |
2357 pSoundList->LoadSound(103, 0); | |
2358 pSoundList->LoadSound(63, 0); | |
2359 pSoundList->LoadSound(102, 0); | |
2360 pSoundList->LoadSound(50, 0); | |
2361 pSoundList->LoadSound(89, 0); | |
2362 | |
2363 return 0; | |
2364 } | |
2365 | |
2366 | |
2367 //----- (0049AC17) -------------------------------------------------------- | |
2368 int IndoorLocation::GetSector(int sX, int sY, int sZ) | |
2369 { | |
2370 int v4; // esi@1 | |
2371 //unsigned __int8 v5; // zf@1 | |
2372 //unsigned __int8 v6; // sf@1 | |
2373 //unsigned __int8 v7; // of@1 | |
2374 //BLVSector *v8; // eax@3 | |
2375 //int v9; // edi@9 | |
2376 //int v10; // eax@9 | |
2377 //int v11; // edx@9 | |
2378 //int v12; // eax@10 | |
2379 //unsigned __int16 v13; // ax@12 | |
2380 //int v14; // edi@14 | |
2381 //BLVFace *v15; // eax@14 | |
2382 //BLVFace *v16; // edi@14 | |
2383 //PolygonType v17; // al@14 | |
2384 //unsigned __int16 *pVertexIDs; // esi@16 | |
2385 //Vec3_short_ *v19; // eax@16 | |
2386 //int v20; // edx@16 | |
2387 //unsigned __int16 *v21; // esi@17 | |
2388 //int v22; // edi@19 | |
2389 //int v23; // edi@20 | |
2390 //Vec3_short_ *v24; // edx@20 | |
2391 signed int v25; // edx@21 | |
2392 int v26; // ebx@23 | |
2393 //int v27; // edx@26 | |
2394 //signed __int64 v28; // qtt@26 | |
2395 ///Vec3_short_ *v29; // eax@26 | |
2396 //Vec3_short_ *v30; // edx@26 | |
2397 //int v31; // edx@26 | |
791 | 2398 //signed int v32; // edi@27 |
0 | 2399 signed __int64 v33; // qtt@27 |
2400 //Vec3_short_ *v34; // edx@27 | |
791 | 2401 //int v35; // edx@32 |
0 | 2402 int v37; // edi@38 |
717 | 2403 int pSectorID; // ebx@40 |
0 | 2404 int v39; // eax@41 |
717 | 2405 BLVFace *pFace; // esi@42 |
2406 PolygonType pPolygonType; // dl@42 | |
0 | 2407 int v42; // edx@43 |
2408 int v43[50]; // [sp+Ch] [bp-108h]@1 | |
2409 //int v44; // [sp+D4h] [bp-40h]@9 | |
2410 //int v45; // [sp+D8h] [bp-3Ch]@14 | |
2411 //int v46; // [sp+DCh] [bp-38h]@14 | |
2412 //int v47; // [sp+E0h] [bp-34h]@19 | |
2413 //int v48; // [sp+E4h] [bp-30h]@9 | |
2414 //Vec3_short_ *v49; // [sp+E8h] [bp-2Ch]@19 | |
2415 bool v50; // [sp+ECh] [bp-28h]@19 | |
2416 int v51; // [sp+F0h] [bp-24h]@9 | |
2417 //unsigned int v52; // [sp+F4h] [bp-20h]@2 | |
2418 int v53; // [sp+F8h] [bp-1Ch]@10 | |
2419 int v54; // [sp+FCh] [bp-18h]@16 | |
2420 int v55; // [sp+100h] [bp-14h]@1 | |
2421 int v56; // [sp+104h] [bp-10h]@1 | |
2422 int v57; // [sp+108h] [bp-Ch]@16 | |
2423 //Vec3_short_ *v58; // [sp+10Ch] [bp-8h]@20 | |
2424 int v59; // [sp+110h] [bp-4h]@16 | |
2425 | |
2426 v4 = 0; | |
791 | 2427 v43[0] = 0; |
2428 | |
0 | 2429 v55 = 0; |
791 | 2430 |
0 | 2431 if (uNumSectors < 2) |
2432 return 0; | |
2433 | |
2434 for (uint i = 1; i < uNumSectors; ++i) | |
2435 { | |
1980 | 2436 BLVSector* pSector = &pSectors[i]; |
0 | 2437 |
791 | 2438 if (pSector->pBounding.x1 > sX || pSector->pBounding.x2 < sX || |
2439 pSector->pBounding.y1 > sY || pSector->pBounding.y2 < sY || | |
2440 pSector->pBounding.z1 - 64 > sZ || pSector->pBounding.z2 + 64 < sZ) | |
2441 continue; | |
2442 | |
618
5cfb5dadf330
Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents:
595
diff
changeset
|
2443 //Log::Warning(L"Sector[%u]", i); |
791 | 2444 v51 = pSector->uNumFloors + pSector->uNumPortals; |
2445 if (!v51) | |
2446 continue; | |
2447 | |
2448 | |
2449 for (uint j = 0; j < v51; ++j) | |
2450 { | |
2451 uint uFaceID; | |
2452 if (j < pSector->uNumFloors) | |
2453 uFaceID = pSector->pFloors[j]; | |
2454 else | |
2455 uFaceID = pSector->pPortals[j - pSector->uNumFloors]; | |
2456 | |
1980 | 2457 BLVFace* pFace = &pFaces[uFaceID]; |
791 | 2458 if (pFace->uPolygonType != POLYGON_Floor && |
2459 pFace->uPolygonType != POLYGON_InBetweenFloorAndWall) | |
2460 continue; | |
2461 | |
2462 v54 = 0; | |
2463 v50 = pVertices[pFace->pVertexIDs[0]].y >= sY; | |
2464 | |
793 | 2465 for (uint k = 1; k <= pFace->uNumVertices; k++) |
791 | 2466 { |
2467 v59 = v50; | |
2468 | |
2469 if (v54 >= 2) | |
2470 break; | |
2471 | |
1980 | 2472 Vec3<int16_t>* v2 = &pVertices[pFace->pVertexIDs[k]]; |
791 | 2473 v50 = v2->y >= sY; |
2474 | |
793 | 2475 if (v59 == v50) |
791 | 2476 continue; |
2477 | |
1980 | 2478 Vec3<int16_t>* v1 = &pVertices[pFace->pVertexIDs[k - 1]]; |
791 | 2479 v25 = v2->x >= sX ? 0 : 2; |
2480 v26 = v25 | (v1->x < sX); | |
2481 | |
2482 if (v26 == 3) | |
2483 continue; | |
2484 | |
2485 if (!v26) | |
2486 ++v54; | |
2487 else | |
2488 { | |
2489 if (v1->x >= v2->x) | |
2490 { | |
2491 /*int _a58; | |
0 | 2492 int _a59; |
2493 | |
2494 v32 = v1->x - v2->x; | |
2495 LODWORD(v33) = v32 << 16; | |
791 | 2496 HIDWORD(v33) = v32 >> 16;*/ |
2497 //fixpoint_div(v1->x - v2->x, v1->y - v2->y); | |
2498 //_a58 = v33 / (v1->y - v2->y); | |
1643 | 2499 //_a59 = fixpoint_mul(_a58, sY - v2->y); |
1980 | 2500 long long x_div_y = fixpoint_div(v1->x - v2->x, v1->y - v2->y); |
2501 long long res = fixpoint_mul(x_div_y, sY - v2->y); // a / b * c - looks like projection | |
793 | 2502 if (res + v2->x > sX) |
791 | 2503 ++v54; |
2504 } | |
2505 else | |
2506 { | |
1980 | 2507 long long x_div_y = fixpoint_div(v2->x - v1->x, v2->y - v1->y); |
2508 long long res = fixpoint_mul(x_div_y, sY - v1->y); | |
791 | 2509 |
2510 if (res + v1->x > sX) | |
2511 ++v54; | |
2512 | |
2513 /*int _a58; | |
0 | 2514 int _a59; |
791 | 2515 auto v32 = v2->x - v1->x; |
0 | 2516 LODWORD(v33) = v32 << 16; |
2517 HIDWORD(v33) = v32 >> 16; | |
2518 _a58 = v33 / (v2->y - v1->y); | |
1643 | 2519 _a59 = fixpoint_mul(_a58, sY - v1->y); |
0 | 2520 |
787 | 2521 if (_a59 + pVertices[k].x > sX) |
791 | 2522 ++v54;*/ |
0 | 2523 } |
717 | 2524 } |
791 | 2525 } |
2526 | |
2527 if (pFace->uNumVertices && v54 == 1) | |
2528 v43[v55++] = uFaceID; | |
2529 } | |
0 | 2530 } |
2531 | |
791 | 2532 v4 = v43[0]; |
0 | 2533 if ( v55 == 1 ) |
2534 return this->pFaces[v4].uSectorID; | |
2535 v37 = 0; | |
2536 if ( !v55 ) | |
2537 return 0; | |
717 | 2538 pSectorID = 0; |
0 | 2539 v53 = 0xFFFFFFu; |
2540 if ( v55 > 0 ) | |
2541 { | |
2542 v39 = sY; | |
2543 while ( 1 ) | |
2544 { | |
717 | 2545 pFace = &this->pFaces[v43[v37]]; |
2546 //pPolygonType = pFace->uPolygonType; | |
2547 if ( pFace->uPolygonType == POLYGON_Floor ) | |
0 | 2548 { |
717 | 2549 v42 = this->pVertices[*pFace->pVertexIDs].z; |
2550 v39 = sZ - v42; | |
2551 //goto LABEL_47; | |
2552 } | |
2553 if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall ) | |
2554 { | |
2555 //v51 = pFace->zCalc1; | |
2556 v57 = (unsigned __int64)(pFace->zCalc1 * (signed __int64)(sX << 16)) >> 16; | |
2557 //v56 = sY << 16; | |
2558 //v51 = pFace->zCalc2; | |
2559 v56 = (unsigned __int64)(pFace->zCalc2 * (signed __int64)(sY << 16)) >> 16; | |
2560 v42 = (v56 + pFace->zCalc3 + v57 + 32768) >> 16; | |
662 | 2561 v39 = sZ - v42; |
0 | 2562 } |
717 | 2563 //LABEL_47: |
0 | 2564 if ( v39 >= 0 ) |
2565 { | |
2566 if ( v39 < v53 ) | |
2567 { | |
717 | 2568 pSectorID = pFace->uSectorID; |
0 | 2569 v53 = v39; |
2570 } | |
2571 } | |
2572 ++v37; | |
2573 if ( v37 >= v55 ) | |
717 | 2574 return pSectorID; |
0 | 2575 } |
2576 } | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1104
diff
changeset
|
2577 return pSectorID; |
0 | 2578 } |
2579 // 49AC17: using guessed type int var_108[50]; | |
2580 | |
2581 | |
2582 //----- (00498A41) -------------------------------------------------------- | |
2583 char BLVFace::_get_normals(Vec3_int_ *a2, Vec3_int_ *a3) | |
2584 { | |
2585 BLVFace *v3; // ebx@1 | |
2586 int v4; // eax@1 | |
2587 signed __int64 v5; // qax@2 | |
2588 double v6; // st7@8 | |
2589 Vec3_float_ a1; // [sp+Ch] [bp-Ch]@8 | |
2590 | |
2591 v3 = this; | |
2592 LOBYTE(v4) = this->uPolygonType; | |
2593 if ( (char)v4 == POLYGON_VerticalWall ) | |
2594 { | |
2595 a2->x = -this->pFacePlane_old.vNormal.y; | |
2596 LODWORD(v5) = this->pFacePlane_old.vNormal.x; | |
2597 LABEL_9: | |
2598 a2->y = v5; | |
2599 v4 = 0; | |
2600 a2->z = 0; | |
2601 a3->y = 0; | |
2602 a3->z = 0xFFFF0000u; | |
2603 LABEL_11: | |
2604 a3->x = v4; | |
2605 goto LABEL_12; | |
2606 } | |
2607 if ( (char)v4 == POLYGON_Floor || (char)v4 == POLYGON_Ceiling ) | |
2608 { | |
2609 LABEL_10: | |
2610 v4 = 0; | |
2611 a2->x = 0x10000u; | |
2612 a2->z = 0; | |
2613 a2->y = 0; | |
2614 a3->y = 0xFFFF0000u; | |
2615 a3->z = 0; | |
2616 goto LABEL_11; | |
2617 } | |
2618 if ( (char)v4 == POLYGON_InBetweenFloorAndWall || (char)v4 == POLYGON_InBetweenCeilingAndWall ) | |
2619 { | |
2620 if ( abs(this->pFacePlane_old.vNormal.z) < 46441 ) | |
2621 { | |
2622 a1.x = (double)-v3->pFacePlane_old.vNormal.y; | |
2623 a1.y = (double)v3->pFacePlane_old.vNormal.x; | |
2624 a1.z = 0.0; | |
2625 a1.Normalize(); | |
2626 v6 = a1.y * 65536.0; | |
2627 a2->x = (signed __int64)(a1.x * 65536.0); | |
2628 v5 = (signed __int64)v6; | |
2629 goto LABEL_9; | |
2630 } | |
2631 goto LABEL_10; | |
2632 } | |
2633 LABEL_12: | |
2634 if ( BYTE2(v3->uAttributes) & 0x80 ) | |
2635 { | |
2636 a2->x = -a2->x; | |
2637 a2->y = -a2->y; | |
2638 a2->z = -a2->z; | |
2639 } | |
2640 if ( BYTE3(v3->uAttributes) & 1 ) | |
2641 { | |
2642 a3->x = -a3->x; | |
2643 a3->y = -a3->y; | |
2644 a3->z = -a3->z; | |
2645 } | |
2646 return v4; | |
2647 } | |
2648 | |
2649 //----- (0044C23B) -------------------------------------------------------- | |
428 | 2650 bool BLVFaceExtra::HasEventint() |
2651 { | |
2652 signed int event_index; // eax@1 | |
2653 _evt_raw* start_evt; | |
2654 _evt_raw* end_evt; | |
2655 | |
2656 event_index = 0; | |
2657 if ( (uLevelEVT_NumEvents - 1) <= 0 ) | |
2658 return false; | |
2659 while ( pLevelEVT_Index[event_index].uEventID != this->uEventID ) | |
0 | 2660 { |
428 | 2661 ++event_index; |
2662 if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) | |
2663 return false; | |
0 | 2664 } |
428 | 2665 end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; |
2666 start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
2667 if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) | |
2668 return false; | |
0 | 2669 else |
428 | 2670 return true; |
0 | 2671 } |
2672 | |
2673 | |
2674 | |
2675 | |
2676 //----- (0046F228) -------------------------------------------------------- | |
1458 | 2677 void BLV_UpdateDoors() |
0 | 2678 { |
472 | 2679 //int v0; // ebx@1 |
2680 //int v1; // edi@1 | |
2681 //BLVDoor *v2; // esi@3 | |
2682 //unsigned __int16 v3; // ax@3 | |
2683 //unsigned int v4; // ecx@5 | |
2684 //int v5; // eax@8 | |
2685 //int v6; // ecx@8 | |
2686 //int v7; // eax@12 | |
2687 //int v8; // eax@16 | |
2688 //unsigned __int8 v9; // zf@18 | |
2689 //char v10; // sf@18 | |
2690 //unsigned __int8 v11; // of@18 | |
2691 //int v12; // edi@19 | |
2692 //int v13; // ecx@19 | |
2693 //__int16 v14; // ax@19 | |
0 | 2694 BLVFace *v15; // ebx@24 |
472 | 2695 //unsigned __int16 *v16; // ecx@24 |
0 | 2696 Vec3_short_ *v17; // esi@24 |
2697 int v18; // eax@24 | |
2698 int v19; // edx@24 | |
2699 signed int v20; // eax@24 | |
472 | 2700 //Vec3_short_ *v21; // ecx@24 |
2701 //double v22; // st7@24 | |
2702 //double v23; // st6@24 | |
0 | 2703 int v24; // esi@25 |
2704 int v25; // eax@25 | |
472 | 2705 //BLVDoor *v26; // edi@25 |
0 | 2706 signed __int64 v27; // qtt@27 |
2707 BLVFaceExtra *v28; // esi@32 | |
2708 int v29; // ecx@34 | |
2709 int v30; // edx@34 | |
2710 unsigned __int64 v31; // qax@34 | |
2711 int v32; // eax@34 | |
472 | 2712 //unsigned __int16 *v33; // eax@35 |
0 | 2713 Vec3_short_ *v34; // eax@35 |
2714 int v35; // ecx@35 | |
2715 int v36; // edx@35 | |
2716 signed int v37; // eax@35 | |
2717 signed int v38; // edx@35 | |
2718 int v39; // eax@35 | |
2719 int v40; // edx@35 | |
472 | 2720 //unsigned __int8 v41; // cf@35 |
2721 //unsigned __int16 *v42; // edi@36 | |
0 | 2722 Vec3_short_ *v43; // edi@36 |
472 | 2723 //int v44; // ecx@36 |
2724 //int v45; // edi@36 | |
2725 //int v46; // ecx@36 | |
2726 //__int16 *v47; // edx@44 | |
2727 //int v48; // ecx@44 | |
0 | 2728 unsigned int v49; // ecx@46 |
2729 unsigned __int16 v50; // ax@48 | |
2730 unsigned int v51; // eax@51 | |
2731 unsigned __int16 v52; // ax@54 | |
2732 int v53; // ecx@57 | |
472 | 2733 //int v54; // edx@57 |
0 | 2734 unsigned __int64 v55; // qax@57 |
2735 int v56; // ecx@58 | |
2736 int v57; // eax@58 | |
472 | 2737 //int v58; // eax@59 |
2738 //SoundID v59; // [sp-24h] [bp-88h]@12 | |
2739 //signed int v60; // [sp-20h] [bp-84h]@12 | |
2740 //unsigned int v61; // [sp-1Ch] [bp-80h]@12 | |
2741 //signed int v62; // [sp-18h] [bp-7Ch]@12 | |
2742 //signed int v63; // [sp-14h] [bp-78h]@12 | |
2743 //int v64; // [sp-10h] [bp-74h]@12 | |
2744 //unsigned int v65; // [sp-Ch] [bp-70h]@12 | |
2745 //int v66; // [sp-8h] [bp-6Ch]@12 | |
2746 Vec3_int_ v67; | |
2747 //int v67; // [sp+8h] [bp-5Ch]@31 | |
2748 //int v68; // [sp+Ch] [bp-58h]@34 | |
2749 //int v69; // [sp+10h] [bp-54h]@34 | |
2750 Vec3_int_ v70; | |
2751 //int v70; // [sp+14h] [bp-50h]@31 | |
2752 //int v71; // [sp+18h] [bp-4Ch]@34 | |
2753 //int v72; // [sp+1Ch] [bp-48h]@34 | |
0 | 2754 int v73; // [sp+20h] [bp-44h]@24 |
472 | 2755 //__int16 v74; // [sp+24h] [bp-40h]@24 |
0 | 2756 int v75; // [sp+28h] [bp-3Ch]@36 |
2757 int v76; // [sp+2Ch] [bp-38h]@36 | |
2758 int v77; // [sp+30h] [bp-34h]@36 | |
472 | 2759 //int v78; // [sp+34h] [bp-30h]@36 |
2760 //int v79; // [sp+38h] [bp-2Ch]@19 | |
2761 //unsigned int v80; // [sp+3Ch] [bp-28h]@2 | |
2762 //int v81; // [sp+40h] [bp-24h]@1 | |
0 | 2763 int v82; // [sp+44h] [bp-20h]@35 |
2764 int v83; // [sp+48h] [bp-1Ch]@34 | |
2765 int v84; // [sp+4Ch] [bp-18h]@34 | |
2766 int v85; // [sp+50h] [bp-14h]@19 | |
2767 SoundID eDoorSoundID; // [sp+54h] [bp-10h]@1 | |
472 | 2768 //BLVDoor *v87; // [sp+58h] [bp-Ch]@3 |
0 | 2769 int v88; // [sp+5Ch] [bp-8h]@18 |
2770 int v89; // [sp+60h] [bp-4h]@6 | |
2771 | |
472 | 2772 //v0 = 0; |
2773 //v1 = 0; | |
0 | 2774 eDoorSoundID = (SoundID)pDoorSoundIDsByLocationID[dword_6BE13C_uCurrentlyLoadedLocationID]; |
472 | 2775 //v81 = 0; |
2776 //if ( pIndoor->uNumDoors > 0 ) | |
2777 for (uint i = 0; i < pIndoor->uNumDoors; ++i) | |
0 | 2778 { |
1980 | 2779 BLVDoor* door = &pIndoor->pDoors[i]; |
472 | 2780 //v80 = 0; |
2781 //do | |
2782 //{ | |
2783 //v2 = &pIndoor->pDoors[v80 / 0x50]; | |
2784 //v87 = &pIndoor->pDoors[v80 / 0x50]; | |
2785 //v3 = door->uState; | |
2786 if (door->uState == BLVDoor::Closed || door->uState == BLVDoor::Open) | |
0 | 2787 { |
472 | 2788 door->uAttributes &= 0xFFFFFFFDu; |
0 | 2789 goto LABEL_62; |
2790 } | |
472 | 2791 door->uTimeSinceTriggered += pEventTimer->uTimeElapsed; |
2792 //v4 = door->uTimeSinceTriggered; | |
2793 if (door->uState == BLVDoor::Opening) | |
0 | 2794 { |
472 | 2795 v89 = (signed int)(door->uTimeSinceTriggered * door->uCloseSpeed) / 128; |
2796 if ( v89 >= door->uMoveLength ) | |
0 | 2797 { |
472 | 2798 v89 = door->uMoveLength; |
2799 door->uState = BLVDoor::Open; | |
0 | 2800 LABEL_10: |
472 | 2801 if ( !(door->uAttributes & 6) && door->uNumVertices != 0) |
0 | 2802 { |
472 | 2803 //v66 = 0; |
2804 //v65 = 0; | |
2805 //v64 = 0; | |
862 | 2806 //v7 = PID(OBJECT_BLVDoor,i); |
472 | 2807 //v63 = 0; |
2808 //v62 = -1; | |
862 | 2809 //LOBYTE(v7) = PID(OBJECT_BLVDoor,i); |
472 | 2810 //v61 = 0; |
862 | 2811 //v60 = PID(OBJECT_BLVDoor,i); |
472 | 2812 //v59 = (SoundID)((int)eDoorSoundID + 1); |
2813 //LABEL_17: | |
862 | 2814 pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), PID(OBJECT_BLVDoor,i), 0, -1, 0, 0, 0, 0); |
472 | 2815 //goto LABEL_18; |
0 | 2816 } |
2817 goto LABEL_18; | |
2818 } | |
2819 } | |
2820 else | |
2821 { | |
1980 | 2822 signed int v5 = (signed int)(door->uTimeSinceTriggered * door->uOpenSpeed) / 128; |
472 | 2823 //v6 = door->uMoveLength; |
2824 if ( v5 >= door->uMoveLength) | |
0 | 2825 { |
472 | 2826 v89 = 0; |
2827 door->uState = BLVDoor::Closed; | |
0 | 2828 goto LABEL_10; |
2829 } | |
472 | 2830 v89 = door->uMoveLength - v5; |
0 | 2831 } |
472 | 2832 if ( !(door->uAttributes & 6) && door->uNumVertices) |
0 | 2833 { |
472 | 2834 //v66 = 0; |
2835 //v65 = 0; | |
2836 //v64 = 0; | |
862 | 2837 //v8 = PID(OBJECT_BLVDoor,i); |
472 | 2838 //v63 = 0; |
2839 //v62 = -1; | |
2840 //LOBYTE(v8) = 8 * v1 | 1; | |
2841 //v61 = 1; | |
862 | 2842 //v60 = PID(OBJECT_BLVDoor,i); |
472 | 2843 //v59 = eDoorSoundID; |
862 | 2844 pAudioPlayer->PlaySound(eDoorSoundID, PID(OBJECT_BLVDoor,i), 1, -1, 0, 0, 0, 0); |
472 | 2845 //goto LABEL_18; |
0 | 2846 } |
2847 LABEL_18: | |
472 | 2848 //v11 = __OFSUB__(v2->uNumVertices, 0); |
2849 //v9 = v2->uNumVertices == 0; | |
2850 //v10 = (signed __int16)(v2->uNumVertices - 0) < 0; | |
2851 //v88 = 0; | |
2852 //if (door->uNumVertices > 0) | |
2853 for (uint j = 0; j < door->uNumVertices; ++j) | |
0 | 2854 { |
472 | 2855 //do |
2856 //{ | |
2857 //v12 = v88; | |
2858 //v13 = door->pVertexIDs[v88]; | |
2859 //v85 = v89; | |
2860 //v79 = door->vDirection.x; | |
2861 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
2862 //v13 *= 6; | |
2863 pIndoor->pVertices[door->pVertexIDs[j]].x = ((unsigned int)(door->vDirection.x * v89) >> 16) + door->pXOffsets[j]; | |
2864 //v85 = v89; | |
2865 //v79 = door->vDirection.y; | |
2866 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
2867 pIndoor->pVertices[door->pVertexIDs[j]].y = ((unsigned int)(door->vDirection.y * v89) >> 16) + door->pYOffsets[j]; | |
2868 //v85 = v89; | |
2869 //v79 = door->vDirection.z; | |
2870 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
2871 //v14 = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; | |
2872 pIndoor->pVertices[door->pVertexIDs[j]].z = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; | |
2873 //++v88; | |
2874 //} | |
2875 //while ( v88 < door->uNumVertices ); | |
2876 //v1 = v81; | |
0 | 2877 } |
472 | 2878 //v11 = __OFSUB__(v2->uNumFaces, 0); |
2879 //v9 = v2->uNumFaces == 0; | |
2880 //v10 = (signed __int16)(v2->uNumFaces - 0) < 0; | |
2881 v88 = 0; | |
2882 if (door->uNumFaces > 0) | |
0 | 2883 { |
2884 while ( 1 ) | |
2885 { | |
472 | 2886 v15 = &pIndoor->pFaces[door->pFaceIDs[v88]]; |
2887 //v16 = v15->pVertexIDs; | |
2888 v17 = &pIndoor->pVertices[v15->pVertexIDs[0]]; | |
0 | 2889 v18 = v15->pFacePlane_old.vNormal.y; |
2890 v73 = *(int *)&v17->x; | |
472 | 2891 //v74 = v17->z; |
0 | 2892 v19 = v15->pFacePlane_old.vNormal.z; |
472 | 2893 v20 = -(v19 * (int)v17->z + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); |
0 | 2894 v15->pFacePlane_old.dist = v20; |
472 | 2895 //v21 = &pIndoor->pVertices[v15->pVertexIDs[0]]; |
2896 //v79 = v21->x; | |
2897 //v22 = (double)v21->x; | |
2898 //v23 = (double)v21->y; | |
2899 //v79 = v21->z; | |
2900 v15->pFacePlane.dist = -((double)v17->z * v15->pFacePlane.vNormal.z | |
2901 + (double)v17->y * v15->pFacePlane.vNormal.y | |
2902 + (double)v17->x * v15->pFacePlane.vNormal.x); | |
0 | 2903 if ( v19 ) |
2904 { | |
2905 v24 = abs(v20 >> 15); | |
2906 v25 = abs(v15->pFacePlane_old.vNormal.z); | |
472 | 2907 //v26 = v87; |
0 | 2908 if ( v24 > v25 ) |
1545 | 2909 Error("Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", |
472 | 2910 door->uDoorID, |
2911 door->pFaceIDs[v88], | |
0 | 2912 v15->pFacePlane_old.dist, |
2913 v15->pFacePlane_old.vNormal.z); | |
472 | 2914 //v79 = v15->pFacePlane_old.vNormal.z; |
2915 //v85 = v15->pFacePlane_old.dist; | |
2916 LODWORD(v27) = v15->pFacePlane_old.dist << 16; | |
2917 HIDWORD(v27) = v15->pFacePlane_old.dist >> 16; | |
2918 //v85 = v27 / v15->pFacePlane_old.vNormal.z; | |
2919 v15->zCalc3 = -v27 / v15->pFacePlane_old.vNormal.z; | |
0 | 2920 } |
472 | 2921 /*else |
0 | 2922 { |
2923 v26 = v87; | |
472 | 2924 }*/ |
0 | 2925 if ( BYTE2(v15->uAttributes) & 4 || pRenderer->pRenderD3D ) |
472 | 2926 v15->_get_normals(&v70, &v67); |
0 | 2927 v28 = &pIndoor->pFaceExtras[v15->uFaceExtraID]; |
2928 if ( !pRenderer->pRenderD3D ) | |
2929 { | |
2930 if ( !(BYTE2(v15->uAttributes) & 4) ) | |
2931 goto LABEL_59; | |
472 | 2932 //v79 = door->vDirection.x; |
2933 v83 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; | |
2934 //v85 = v71; | |
2935 //v79 = door->vDirection.y; | |
2936 v85 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; | |
2937 //v84 = v72; | |
2938 //v79 = door->vDirection.z; | |
2939 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; | |
2940 //v79 = v83 + v85 + v84; | |
0 | 2941 v29 = v89; |
472 | 2942 //v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; |
2943 v28->sTextureDeltaU = -((v83 + v85 + v84) * (signed __int64)v89) >> 16; | |
2944 //v79 = door->vDirection.x; | |
2945 v85 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; | |
2946 //v83 = v68; | |
2947 //v79 = door->vDirection.y; | |
2948 v83 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; | |
2949 //v84 = v69; | |
2950 //v79 = door->vDirection.z; | |
2951 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; | |
2952 //v30 = v83 + v84; | |
2953 //v79 = v85 + v30; | |
2954 v31 = (v85 + v83 + v84) * (signed __int64)v29; | |
2955 //v83 = v31 >> 16; | |
0 | 2956 v32 = v31 >> 16; |
2957 goto LABEL_58; | |
2958 } | |
2959 v28->sTextureDeltaU = 0; | |
2960 v28->sTextureDeltaV = 0; | |
472 | 2961 //v33 = v15->pVertexIDs; |
2962 //v85 = 1; | |
2963 v34 = &pIndoor->pVertices[v15->pVertexIDs[0]]; | |
0 | 2964 v35 = v34->z; |
2965 v36 = v34->y; | |
2966 v82 = v34->x; | |
472 | 2967 //v79 = v36; |
2968 v37 = v70.x * v82 + v70.y * v36 + v70.z * v35; | |
2969 v38 = v67.x * v82 + v67.y * v36 + v67.z * v35; | |
0 | 2970 v39 = v37 >> 16; |
2971 *v15->pVertexUIDs = v39; | |
2972 v40 = v38 >> 16; | |
2973 *v15->pVertexVIDs = v40; | |
472 | 2974 //v41 = v15->uNumVertices < 1u; |
2975 //v9 = v15->uNumVertices == 1; | |
2976 //v83 = v40; | |
0 | 2977 v84 = v39; |
2978 v82 = v40; | |
472 | 2979 //if (v15->uNumVertices > 1) |
2980 for (uint j = 1; j < v15->uNumVertices; ++j) | |
0 | 2981 { |
472 | 2982 //do |
2983 //{ | |
2984 //v42 = v15->pVertexIDs; | |
2985 //v75 = 2 * v85; | |
2986 v43 = &pIndoor->pVertices[v15->pVertexIDs[j]]; | |
2987 //v79 = v43->z; | |
2988 //v44 = v43->y; | |
2989 //v45 = v43->x; | |
2990 //v78 = v43->y; | |
2991 v76 = ((__int64)v70.z * v43->z + (__int64)v70.x * v43->x + (__int64)v70.y * v43->y) >> 16; | |
2992 //v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; | |
2993 v77 = ((__int64)v67.x * v43->x + (__int64)v67.y * v43->y + (__int64)v43->z * v67.z) >> 16; | |
0 | 2994 if ( v76 < v39 ) |
2995 v39 = v76; | |
472 | 2996 if ( v77 < v40 ) |
2997 v40 = v77; | |
0 | 2998 if ( v76 > v84 ) |
2999 v84 = v76; | |
472 | 3000 if ( v77 > v82 ) |
3001 v82 = v77; | |
3002 //v40 = v83; | |
3003 //v47 = v15->pVertexUIDs; | |
3004 //v48 = v75; | |
3005 //++v85; | |
3006 v15->pVertexUIDs[j] = v76; | |
3007 v15->pVertexVIDs[j] = v77; | |
3008 //} | |
3009 //while ( v85 < v15->uNumVertices ); | |
3010 //v26 = v87; | |
0 | 3011 } |
3012 v49 = v15->uAttributes; | |
3013 if ( BYTE1(v49) & 0x10 ) | |
3014 goto LABEL_50; | |
3015 if ( SBYTE1(v49) < 0 ) | |
3016 { | |
3017 v50 = v15->uBitmapID; | |
3018 if ( v50 != -1 ) | |
3019 break; | |
3020 } | |
3021 LABEL_51: | |
3022 v51 = v15->uAttributes; | |
3023 if ( v51 & 8 ) | |
3024 { | |
3025 v28->sTextureDeltaV -= v40; | |
3026 } | |
3027 else | |
3028 { | |
3029 if ( v51 & 0x20000 ) | |
3030 { | |
3031 v52 = v15->uBitmapID; | |
3032 if ( v52 != -1 ) | |
945 | 3033 v28->sTextureDeltaV -= v82 + pBitmaps_LOD->GetTexture(v52)->uTextureHeight; |
0 | 3034 } |
3035 } | |
3036 if ( BYTE2(v15->uAttributes) & 4 ) | |
3037 { | |
472 | 3038 //v75 = door->vDirection.x; |
3039 v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; | |
3040 //v82 = v71; | |
3041 //v75 = door->vDirection.y; | |
3042 v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; | |
3043 //v83 = v72; | |
3044 //v75 = door->vDirection.z; | |
3045 v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; | |
3046 v75 = v84 + v82 + v83; | |
0 | 3047 v53 = v89; |
3048 v82 = (unsigned __int64)(v75 * (signed __int64)v89) >> 16; | |
472 | 3049 v28->sTextureDeltaU = -v82; |
3050 //v75 = door->vDirection.x; | |
3051 v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; | |
3052 //v82 = v68; | |
3053 //v75 = door->vDirection.y; | |
3054 v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; | |
3055 //v83 = v69; | |
3056 //v75 = door->vDirection.z; | |
3057 v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; | |
3058 //v54 = v82 + v83; | |
3059 v75 = v84 + v82 + v83; | |
3060 v55 = v75 * (signed __int64)v53; | |
3061 //v82 = v55 >> 16; | |
0 | 3062 v32 = v55 >> 16; |
3063 LABEL_58: | |
3064 v56 = v88; | |
3065 v57 = -v32; | |
3066 v28->sTextureDeltaV = v57; | |
472 | 3067 v28->sTextureDeltaU += door->pDeltaUs[v56]; |
3068 v28->sTextureDeltaV = v57 + door->pDeltaVs[v56]; | |
0 | 3069 } |
3070 LABEL_59: | |
472 | 3071 //v58 = door->uNumFaces; |
0 | 3072 ++v88; |
472 | 3073 if ( v88 >= door->uNumFaces) |
0 | 3074 { |
472 | 3075 //v1 = v81; |
3076 //v0 = 0; | |
0 | 3077 goto LABEL_62; |
3078 } | |
472 | 3079 //v2 = v87; |
0 | 3080 } |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3081 LOWORD(v39) = v84; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3082 if (v15->uBitmapID != -1) |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3083 LOWORD(v39) += pBitmaps_LOD->pTextures[v15->uBitmapID].uTextureWidth; |
0 | 3084 LABEL_50: |
3085 v28->sTextureDeltaU -= v39; | |
3086 goto LABEL_51; | |
3087 } | |
3088 LABEL_62: | |
472 | 3089 ; |
3090 //v80 += 80; | |
3091 //++v1; | |
3092 //v81 = v1; | |
3093 //} | |
3094 //while ( v1 < pIndoor->uNumDoors ); | |
0 | 3095 } |
3096 } | |
3097 // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID; | |
3098 | |
3099 //----- (0046F90C) -------------------------------------------------------- | |
1458 | 3100 void UpdateActors_BLV() |
0 | 3101 { |
3102 Actor *v0; // esi@2 | |
3103 unsigned __int16 v1; // ax@2 | |
3104 int v2; // edi@6 | |
3105 int v3; // eax@6 | |
3106 int v4; // eax@8 | |
3107 __int16 v5; // ax@11 | |
3108 signed int v6; // ebx@14 | |
3109 unsigned __int8 v7; // zf@14 | |
3110 unsigned __int8 v8; // sf@14 | |
3111 signed __int16 v9; // ax@17 | |
3112 signed __int64 v10; // qax@18 | |
3113 unsigned __int16 v11; // ax@21 | |
3114 int v12; // eax@29 | |
3115 unsigned __int64 v13; // qax@29 | |
3116 int v14; // eax@30 | |
3117 unsigned __int64 v15; // qax@30 | |
3118 int v16; // ecx@33 | |
3119 BLVFace *v17; // edx@33 | |
3120 int v18; // ecx@33 | |
3121 BLVFace *v19; // eax@34 | |
3122 int v20; // ecx@46 | |
1546 | 3123 //int v21; // eax@46 |
0 | 3124 int v22; // edi@46 |
3125 int v23; // eax@48 | |
3126 unsigned int v24; // eax@51 | |
3127 int v25; // eax@52 | |
3128 int v26; // ebx@54 | |
3129 int v27; // ST08_4@54 | |
3130 int v28; // edi@54 | |
3131 int v29; // eax@54 | |
3132 int v30; // ecx@62 | |
3133 int v31; // ebx@62 | |
3134 int v32; // eax@62 | |
3135 int v33; // eax@64 | |
3136 unsigned int v34; // ecx@64 | |
3137 int v35; // ecx@64 | |
3138 signed int v36; // edx@85 | |
3139 signed int v37; // ebx@85 | |
3140 BLVFace *v38; // edi@89 | |
3141 int v39; // ecx@90 | |
3142 int v40; // ebx@90 | |
3143 PolygonType v41; // al@94 | |
3144 int v42; // eax@96 | |
3145 __int16 v43; // dx@96 | |
3146 int v44; // ecx@96 | |
3147 int v45; // edi@101 | |
1546 | 3148 //int v46; // edi@101 |
3149 //int v47; // eax@101 | |
3150 //unsigned __int64 v48; // qax@101 | |
0 | 3151 unsigned __int8 v49; // zf@103 |
3152 unsigned __int8 v50; // sf@103 | |
3153 unsigned __int8 v51; // of@103 | |
3154 AIDirection v52; // [sp+0h] [bp-60h]@75 | |
3155 AIDirection v53; // [sp+1Ch] [bp-44h]@116 | |
3156 int v54; // [sp+38h] [bp-28h]@53 | |
3157 unsigned int uSectorID; // [sp+3Ch] [bp-24h]@6 | |
3158 int v56; // [sp+40h] [bp-20h]@6 | |
3159 unsigned int _this; // [sp+44h] [bp-1Ch]@51 | |
3160 int v58; // [sp+48h] [bp-18h]@51 | |
3161 int v59; // [sp+4Ch] [bp-14h]@8 | |
3162 unsigned int uFaceID; // [sp+50h] [bp-10h]@6 | |
3163 int v61; // [sp+54h] [bp-Ch]@14 | |
3164 int v62; // [sp+58h] [bp-8h]@6 | |
3165 unsigned int v63; // [sp+5Ch] [bp-4h]@1 | |
3166 | |
3167 v63 = 0; | |
3168 if ( (signed int)uNumActors > 0 ) | |
3169 { | |
3170 while ( 1 ) | |
3171 { | |
3172 v0 = &pActors[v63]; | |
3173 v1 = v0->uAIState; | |
3174 if ( v1 == 11 || v1 == 19 || v1 == 17 || !v0->uMovementSpeed ) | |
3175 goto LABEL_123; | |
3176 uSectorID = v0->uSectorID; | |
783 | 3177 v2 = collide_against_floor(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, &uSectorID, &uFaceID); |
0 | 3178 v0->uSectorID = uSectorID; |
3179 v3 = v0->pMonsterInfo.uFlying; | |
3180 v56 = v2; | |
3181 v62 = v3; | |
3182 if ( !v0->CanAct() ) | |
3183 v62 = 0; | |
3184 v4 = v0->vPosition.z; | |
3185 v59 = 0; | |
3186 if ( v4 > v2 + 1 ) | |
3187 v59 = 1; | |
3188 if ( v2 <= -30000 ) | |
3189 { | |
3190 v5 = pIndoor->GetSector(v0->vPosition.x, v0->vPosition.y, v4); | |
3191 v0->uSectorID = v5; | |
3192 if ( !v5 | |
723 | 3193 || (v56 = BLV_GetFloorLevel(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &uFaceID), v56 == -30000) ) |
0 | 3194 goto LABEL_123; |
3195 } | |
305 | 3196 if ( v0->uCurrentActionAnimation == ANIM_Walking) |
0 | 3197 { |
3198 v6 = v0->uMovementSpeed; | |
1951 | 3199 v7 = HIDWORD(v0->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime) == 0; |
3200 v8 = SHIDWORD(v0->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime) < 0; | |
0 | 3201 v61 = v0->uMovementSpeed; |
1951 | 3202 if ( !v8 && (!(v8 | v7) || LODWORD(v0->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime)) ) |
0 | 3203 { |
1951 | 3204 v9 = v0->pActorBuffs[ACTOR_BUFF_SLOWED].uPower; |
0 | 3205 if ( v9 ) |
3206 LODWORD(v10) = v6 / (unsigned __int16)v9; | |
3207 else | |
3208 v10 = (signed __int64)((double)v61 * 0.5); | |
3209 v6 = v10; | |
3210 v61 = v10; | |
3211 } | |
3212 v11 = v0->uAIState; | |
3213 if ( v11 == 6 || v11 == 7 ) | |
3214 { | |
3215 v6 *= 2; | |
3216 v61 = v6; | |
3217 } | |
1340 | 3218 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 1 ) |
0 | 3219 v6 = (signed __int64)((double)v61 * flt_6BE3AC_debug_recmod1_x_1_6); |
3220 if ( v6 > 1000 ) | |
3221 v6 = 1000; | |
323 | 3222 v12 = stru_5C6E00->Cos(v0->uYawAngle); |
0 | 3223 uSectorID = v12; |
3224 v13 = v12 * (signed __int64)v6; | |
3225 v61 = v13 >> 16; | |
3226 v0->vVelocity.x = WORD1(v13); | |
323 | 3227 uSectorID = stru_5C6E00->Sin(v0->uYawAngle); |
0 | 3228 v61 = (unsigned __int64)(uSectorID * (signed __int64)v6) >> 16; |
3229 v7 = v62 == 0; | |
3230 v0->vVelocity.y = (unsigned int)(uSectorID * v6) >> 16; | |
3231 if ( !v7 ) | |
3232 { | |
323 | 3233 v14 = stru_5C6E00->Sin(v0->uPitchAngle); |
0 | 3234 uSectorID = v14; |
3235 v15 = v14 * (signed __int64)v6; | |
3236 v61 = v15 >> 16; | |
3237 v0->vVelocity.z = WORD1(v15); | |
3238 } | |
3239 } | |
3240 else | |
3241 { | |
3242 v61 = v0->vVelocity.x; | |
3243 uSectorID = 55000; | |
3244 v61 = (unsigned __int64)(55000i64 * v61) >> 16; | |
3245 v0->vVelocity.x = v61; | |
3246 v61 = v0->vVelocity.y; | |
3247 v61 = (unsigned __int64)(uSectorID * (signed __int64)v61) >> 16; | |
3248 v7 = v62 == 0; | |
3249 v0->vVelocity.y = v61; | |
3250 if ( !v7 ) | |
3251 { | |
3252 uSectorID = 55000; | |
3253 v61 = v0->vVelocity.z; | |
3254 v61 = (unsigned __int64)(55000i64 * v61) >> 16; | |
3255 v0->vVelocity.z = v61; | |
3256 } | |
3257 } | |
3258 v16 = v0->vPosition.z; | |
3259 v17 = pIndoor->pFaces; | |
3260 v51 = __OFSUB__(v16, v56); | |
3261 v8 = v16 - v56 < 0; | |
3262 v18 = uFaceID; | |
3263 if ( v8 ^ v51 ) | |
3264 { | |
3265 v0->vPosition.z = v56 + 1; | |
3266 v19 = &v17[v18]; | |
3267 if ( v19->uPolygonType == 3 ) | |
3268 { | |
3269 if ( v0->vVelocity.z < 0 ) | |
3270 v0->vVelocity.z = 0; | |
3271 } | |
3272 else | |
3273 { | |
3274 if ( v19->pFacePlane_old.vNormal.z < 45000 ) | |
3275 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
3276 } | |
3277 } | |
3278 else | |
3279 { | |
3280 if ( v59 && !v62 ) | |
3281 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
3282 } | |
3283 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y + v0->vVelocity.z * v0->vVelocity.z >= 400 ) | |
3284 break; | |
3285 v0->vVelocity.z = 0; | |
3286 v0->vVelocity.y = 0; | |
3287 v0->vVelocity.x = 0; | |
3288 if ( BYTE2(v17[v18].uAttributes) & 0x40 ) | |
3289 { | |
3290 if (v0->uAIState == Dead) | |
3291 v0->uAIState = Removed; | |
3292 } | |
3293 LABEL_123: | |
3294 ++v63; | |
3295 if ( (signed int)v63 >= (signed int)uNumActors ) | |
3296 return; | |
3297 } | |
3298 v20 = v0->uActorRadius; | |
3299 stru_721530.field_84 = -1; | |
3300 stru_721530.field_70 = 0; | |
3301 uSectorID = 0; | |
3302 stru_721530.field_0 = 1; | |
1546 | 3303 stru_721530.field_8_radius = v20; |
0 | 3304 stru_721530.prolly_normal_d = v20; |
1546 | 3305 stru_721530.height = v0->uActorHeight; |
0 | 3306 v22 = 0; |
3307 while ( 1 ) | |
3308 { | |
1546 | 3309 stru_721530.position.x = v0->vPosition.x; |
3310 stru_721530.normal.x = stru_721530.position.x; | |
3311 stru_721530.position.y = v0->vPosition.y; | |
3312 stru_721530.normal.y = stru_721530.position.y; | |
0 | 3313 v23 = v0->vPosition.z; |
3314 stru_721530.normal.z = v23 + v20 + 1; | |
1546 | 3315 stru_721530.position.z = v23 - v20 + stru_721530.height - 1; |
3316 if ( stru_721530.position.z < stru_721530.normal.z ) | |
3317 stru_721530.position.z = v23 + v20 + 1; | |
3318 stru_721530.velocity.x = v0->vVelocity.x; | |
3319 stru_721530.velocity.y = v0->vVelocity.y; | |
3320 stru_721530.velocity.z = v0->vVelocity.z; | |
0 | 3321 stru_721530.uSectorID = v0->uSectorID; |
3322 if ( !stru_721530._47050A(v22) ) | |
3323 { | |
3324 v58 = v22; | |
3325 v24 = 8 * v63; | |
862 | 3326 LOBYTE(v24) = PID(OBJECT_Actor,v63); |
0 | 3327 v61 = v22; |
3328 _this = v24; | |
3329 do | |
3330 { | |
3331 _46E44E_collide_against_faces_and_portals(1u); | |
3332 _46E0B2_collide_against_decorations(); | |
3333 _46EF01_collision_chech_player(0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
3334 _46ED8A_collide_against_sprite_objects(_this); |
0 | 3335 v25 = 0; |
3336 v56 = 0; | |
3337 if ( ai_arrays_size > v22 ) | |
3338 { | |
3339 do | |
3340 { | |
390 | 3341 v54 = ai_near_actors_ids[v25]; |
0 | 3342 if ( v54 != v63 ) |
3343 { | |
3344 v26 = v54; | |
3345 v27 = abs(pActors[v54].vPosition.z - v0->vPosition.z); | |
3346 v28 = abs(pActors[v26].vPosition.y - v0->vPosition.y); | |
3347 v29 = abs(pActors[v26].vPosition.x - v0->vPosition.x); | |
322 | 3348 if ( int_get_vector_length(v29, v28, v27) >= v0->uActorRadius + (signed int)pActors[v26].uActorRadius |
1897
436553b0603c
_46DF1A_collide_against_actor cleaned up, moved to Actor.h
Grumpy7
parents:
1844
diff
changeset
|
3349 && Actor::_46DF1A_collide_against_actor(v54, 40) ) |
0 | 3350 ++v58; |
3351 v22 = 0; | |
3352 } | |
3353 v25 = v56++ + 1; | |
3354 } | |
3355 while ( v56 < ai_arrays_size ); | |
3356 } | |
3357 if ( _46F04E_collide_against_portals() ) | |
3358 break; | |
3359 ++v61; | |
3360 } | |
3361 while ( v61 < 100 ); | |
3362 v56 = v58 > 1; | |
3363 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
3364 { | |
3365 v30 = stru_721530.normal2.x; | |
3366 v31 = stru_721530.normal2.y; | |
3367 v32 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
3368 } | |
3369 else | |
3370 { | |
1643 | 3371 v30 = v0->vPosition.x + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); |
3372 v31 = v0->vPosition.y + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); | |
3373 v32 = v0->vPosition.z + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); | |
0 | 3374 } |
783 | 3375 v33 = collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID); |
0 | 3376 v34 = pIndoor->pFaces[uFaceID].uAttributes; |
3377 v35 = v34 & 0x400000; | |
3378 if (v35 && v0->uAIState == Dead) | |
3379 { | |
3380 v0->uAIState = Removed; | |
3381 goto LABEL_120; | |
3382 } | |
3383 if ( v59 != v22 || v62 != v22 || v35 == v22 ) | |
3384 { | |
3385 if ( v33 == -30000 ) | |
3386 goto LABEL_120; | |
3387 if ( v0->uCurrentActionAnimation != 1 || v33 >= v0->vPosition.z - 100 || v59 != v22 || v62 != v22 ) | |
3388 { | |
3389 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
3390 { | |
3391 v0->vPosition.x = LOWORD(stru_721530.normal2.x); | |
3392 v0->vPosition.y = LOWORD(stru_721530.normal2.y); | |
3393 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | |
3394 v0->uSectorID = LOWORD(stru_721530.uSectorID); | |
3395 goto LABEL_123; | |
3396 } | |
1546 | 3397 //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16; |
1643 | 3398 v0->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); |
1546 | 3399 //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16; |
1643 | 3400 v0->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); |
1546 | 3401 //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16; |
0 | 3402 v36 = stru_721530.uFaceID; |
1643 | 3403 v0->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); |
0 | 3404 v0->uSectorID = LOWORD(stru_721530.uSectorID); |
3405 stru_721530.field_70 += stru_721530.field_7C; | |
848 | 3406 v37 = PID_ID(v36); |
3407 if ( PID_TYPE(v36) != OBJECT_Actor) | |
0 | 3408 { |
848 | 3409 if ( PID_TYPE(v36) != OBJECT_Player) |
0 | 3410 { |
848 | 3411 if ( PID_TYPE(v36) == OBJECT_Decoration) |
0 | 3412 { |
295 | 3413 _this = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); |
0 | 3414 v45 = stru_5C6E00->Atan2( |
3415 v0->vPosition.x - pLevelDecorations[v37].vPosition.x, | |
3416 v0->vPosition.y - pLevelDecorations[v37].vPosition.y); | |
1643 | 3417 v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v45), _this); |
3418 v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v45), _this); | |
0 | 3419 goto LABEL_119; |
3420 } | |
848 | 3421 if ( PID_TYPE(v36) == OBJECT_BModel) |
0 | 3422 { |
3423 stru_721530.field_84 = v36 >> 3; | |
3424 v38 = &pIndoor->pFaces[v37]; | |
3425 if ( v38->uPolygonType == 3 ) | |
3426 { | |
3427 v39 = v0->vVelocity.x; | |
3428 v40 = v0->vVelocity.y * v0->vVelocity.y; | |
3429 v0->vVelocity.z = 0; | |
3430 v0->vPosition.z = pIndoor->pVertices[*v38->pVertexIDs].z + 1; | |
3431 if ( v39 * v39 + v40 < 400 ) | |
3432 { | |
3433 v0->vVelocity.y = 0; | |
3434 v0->vVelocity.x = 0; | |
3435 goto LABEL_119; | |
3436 } | |
3437 } | |
3438 else | |
3439 { | |
3440 v61 = abs(v38->pFacePlane_old.vNormal.x * v0->vVelocity.x + v38->pFacePlane_old.vNormal.y | |
3441 * v0->vVelocity.y | |
3442 + v38->pFacePlane_old.vNormal.z | |
3443 * v0->vVelocity.z) >> 16; | |
1546 | 3444 if ( (stru_721530.speed >> 3) > v61 ) |
3445 v61 = stru_721530.speed >> 3; | |
3446 | |
1643 | 3447 v0->vVelocity.x += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.x); |
3448 v0->vVelocity.y += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.y); | |
3449 v0->vVelocity.z += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.z); | |
0 | 3450 v41 = v38->uPolygonType; |
3451 if ( v41 != 4 && v41 != 3 ) | |
3452 { | |
3453 v42 = v38->pFacePlane_old.vNormal.x; | |
3454 v43 = v0->vPosition.z; | |
3455 v44 = stru_721530.prolly_normal_d | |
3456 - ((v38->pFacePlane_old.dist | |
3457 + v38->pFacePlane_old.vNormal.z * v0->vPosition.z | |
3458 + v38->pFacePlane_old.vNormal.y * v0->vPosition.y | |
3459 + v42 * v0->vPosition.x) >> 16); | |
3460 if ( v44 > 0 ) | |
3461 { | |
3462 v0->vPosition.x += (unsigned int)(v44 * v42) >> 16; | |
3463 v0->vPosition.y += (unsigned int)(v44 * v38->pFacePlane_old.vNormal.y) >> 16; | |
3464 v0->vPosition.z = v43 + ((unsigned int)(v44 * v38->pFacePlane_old.vNormal.z) >> 16); | |
3465 } | |
3466 v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y); | |
3467 } | |
3468 } | |
3469 if ( BYTE3(v38->uAttributes) & 8 ) | |
3470 EventProcessor(pIndoor->pFaceExtras[v38->uFaceExtraID].uEventID, 0, 1); | |
3471 } | |
3472 LABEL_119: | |
1643 | 3473 v0->vVelocity.x = fixpoint_mul(58500, v0->vVelocity.x); |
3474 v0->vVelocity.y = fixpoint_mul(58500, v0->vVelocity.y); | |
3475 v0->vVelocity.z = fixpoint_mul(58500, v0->vVelocity.z); | |
0 | 3476 v22 = 0; |
3477 goto LABEL_120; | |
3478 } | |
3479 if ( v0->GetActorsRelation(0) ) | |
3480 { | |
1167 | 3481 v51 = __OFSUB__(HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime), v22); |
3482 v49 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == v22; | |
3483 v50 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) - v22 < 0; | |
0 | 3484 v0->vVelocity.y = v22; |
3485 v0->vVelocity.x = v22; | |
3486 if ( !(v50 ^ v51) | |
1167 | 3487 && (!((unsigned __int8)(v50 ^ v51) | v49) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > v22) ) |
3488 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 3489 viewparams->bRedrawGameUI = 1; |
3490 goto LABEL_119; | |
3491 } | |
3492 v36 = stru_721530.uFaceID; | |
3493 LABEL_118: | |
1060 | 3494 Actor::AI_FaceObject(v63, v36, v22, (AIDirection *)v22); |
0 | 3495 goto LABEL_119; |
3496 } | |
1340 | 3497 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 2 || pTurnEngine->turn_stage == 3) ) |
0 | 3498 goto LABEL_119; |
3499 if ( v0->pMonsterInfo.uHostilityType ) | |
3500 { | |
3501 if ( v56 == v22 ) | |
3502 goto LABEL_114; | |
3503 } | |
3504 else | |
3505 { | |
3506 if ( v56 == v22 ) | |
3507 { | |
3508 if ( !pActors[v37].pMonsterInfo.uHostilityType ) | |
3509 goto LABEL_118; | |
3510 LABEL_114: | |
1060 | 3511 Actor::AI_Flee(v63, v36, v22, (AIDirection *)v22); |
0 | 3512 goto LABEL_119; |
3513 } | |
3514 } | |
414 | 3515 Actor::AI_StandOrBored(v63, 4, v22, &v53); |
0 | 3516 goto LABEL_119; |
3517 } | |
3518 if ( v0->vPosition.x & 1 ) | |
3519 v0->uYawAngle += 100; | |
3520 else | |
3521 v0->uYawAngle -= 100; | |
3522 } | |
3523 else | |
3524 { | |
1340 | 3525 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 2 || pTurnEngine->turn_stage == 3) ) |
0 | 3526 goto LABEL_123; |
3527 if ( !v0->pMonsterInfo.uHostilityType || v56 != v22 ) | |
3528 { | |
414 | 3529 Actor::AI_StandOrBored(v63, 4, v22, &v52); |
0 | 3530 goto LABEL_123; |
3531 } | |
3532 } | |
3533 } | |
3534 LABEL_120: | |
3535 ++uSectorID; | |
3536 if ( uSectorID >= 100 ) | |
3537 goto LABEL_123; | |
3538 v20 = stru_721530.prolly_normal_d; | |
3539 } | |
3540 } | |
3541 } | |
3542 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
3543 // 4F75D8: using guessed type int ai_arrays_size; | |
3544 | |
3545 | |
3546 | |
3547 | |
3548 | |
3549 | |
3550 //----- (00460A78) -------------------------------------------------------- | |
1458 | 3551 void PrepareToLoadBLV(unsigned int bLoading) |
0 | 3552 { |
3553 unsigned int v1; // ebx@1 | |
3554 unsigned int v2; // eax@8 | |
3555 MapInfo *v3; // edi@9 | |
3556 int v4; // eax@11 | |
3557 int v5; // eax@12 | |
3558 int v6; // eax@13 | |
3559 int v7; // esi@27 | |
3560 SpawnPointMM7 *v8; // edx@28 | |
3561 //char v9; // bl@33 | |
3562 //int v10; // eax@34 | |
3563 //char *v11; // ecx@37 | |
3564 //int v12; // edi@44 | |
3565 //unsigned int v13; // edi@48 | |
3566 char *v14; // esi@49 | |
3567 __int16 v15; // ax@50 | |
3568 int v16; // ecx@52 | |
3569 DecorationDesc *v17; // eax@54 | |
3570 int v18; // ecx@55 | |
3571 //int *v19; // edi@58 | |
3572 //unsigned char v20; // dl@58 | |
3573 int v21; // eax@64 | |
3574 char v22; // cl@64 | |
3575 //signed int v23; // ebx@67 | |
3576 //char *v24; // esi@68 | |
3577 //int v25; // eax@70 | |
3578 //char *v26; // esi@78 | |
3579 //int v27; // eax@79 | |
3580 char v28; // zf@81 | |
3581 __int16 v29; // ax@85 | |
3582 signed int v30; // edi@94 | |
3583 int v31; // esi@94 | |
1545 | 3584 //char Args; // [sp+350h] [bp-C4h]@16 |
0 | 3585 int v34[4]; // [sp+3E8h] [bp-2Ch]@96 |
3586 int v35; // [sp+3F8h] [bp-1Ch]@1 | |
3587 //char b[4]; // [sp+3FCh] [bp-18h]@58 | |
3588 MapInfo *v37; // [sp+400h] [bp-14h]@1 | |
3589 int v38; // [sp+404h] [bp-10h]@1 | |
3590 unsigned int v39; // [sp+408h] [bp-Ch]@8 | |
3591 int pDest; // [sp+40Ch] [bp-8h]@1 | |
3592 //int i; // [sp+410h] [bp-4h]@27 | |
3593 | |
3594 v37 = (MapInfo *)bLoading; | |
3595 v1 = 0; | |
3596 v35 = 0; | |
3597 pGameLoadingUI_ProgressBar->Reset(0x20u); | |
3598 bUnderwater = 0; | |
3599 bNoNPCHiring = 0; | |
3600 v38 = 0; | |
3601 pDest = 1; | |
3602 uCurrentlyLoadedLevelType = LEVEL_Indoor; | |
3603 pGame->uFlags2 &= 0xFFFFFFF7u; | |
3604 if ( Is_out15odm_underwater() ) | |
3605 { | |
3606 bUnderwater = 1; | |
3607 pGame->uFlags2 |= 8u; | |
3608 } | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1458
diff
changeset
|
3609 if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d23.blv") ) |
0 | 3610 bNoNPCHiring = 1; |
3611 pPaletteManager->pPalette_tintColor[0] = 0; | |
3612 pPaletteManager->pPalette_tintColor[1] = 0; | |
3613 pPaletteManager->pPalette_tintColor[2] = 0; | |
3614 pPaletteManager->RecalculateAll(); | |
3615 if ( qword_A750D8 ) | |
3616 qword_A750D8 = 0i64; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1458
diff
changeset
|
3617 v2 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 3618 v39 = v2; |
3619 if ( v2 ) | |
3620 { | |
3621 v3 = &pMapStats->pInfos[v2]; | |
3622 v1 = v3->uRespawnIntervalDays; | |
3623 v38 = GetAlertStatus(); | |
3624 } | |
3625 else | |
3626 { | |
3627 v3 = v37; | |
3628 } | |
3629 dword_6BE13C_uCurrentlyLoadedLocationID = v39; | |
1583 | 3630 free(ptr_6A0D08); |
0 | 3631 ptr_6A0D08 = 0; |
3632 _6A0D0C_txt_lod_loading = 0; | |
3633 TryLoadLevelFromLOD(); | |
3634 pStationaryLightsStack->uNumLightsActive = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1458
diff
changeset
|
3635 v4 = pIndoor->Load(pCurrentMapName, |
0 | 3636 (unsigned int)(signed __int64)((double)pParty->uTimePlayed * 0.234375) / 60 / 60 / 24 + 1, |
3637 v1, | |
3638 (char *)&pDest) | |
3639 - 1; | |
3640 if ( !v4 ) | |
1545 | 3641 Error("Unable to open %s", pCurrentMapName); |
3642 | |
0 | 3643 v5 = v4 - 1; |
3644 if ( !v5 ) | |
1545 | 3645 Error("File %s is not a BLV File", pCurrentMapName); |
3646 | |
0 | 3647 v6 = v5 - 1; |
3648 if ( !v6 ) | |
1545 | 3649 Error("Attempt to open new level before clearing old"); |
0 | 3650 if ( v6 == 1 ) |
1545 | 3651 Error("Out of memory loading indoor level"); |
2061 | 3652 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) ) |
0 | 3653 { |
3654 InitializeActors(); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
3655 InitializeSpriteObjects(); |
0 | 3656 } |
2061 | 3657 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000; |
0 | 3658 if ( !v39 ) |
3659 pDest = 0; | |
3660 if ( pDest == 1 ) | |
3661 { | |
3662 v7 = 0; | |
3663 for (uint i = 0; i < pIndoor->uNumSpawnPoints; ++v7 ) | |
3664 { | |
3665 v8 = &pIndoor->pSpawnPoints[v7]; | |
3666 if ( pIndoor->pSpawnPoints[v7].uKind == 3 ) | |
3667 SpawnEncounter(v3, v8, 0, 0, 0); | |
3668 else | |
3669 v3->SpawnRandomTreasure(v8); | |
3670 ++i; | |
3671 } | |
3672 RespawnGlobalDecorations(); | |
3673 } | |
3674 | |
3675 pSoundList->LoadSound(pDoorSoundIDsByLocationID[v39], 0); | |
3676 pSoundList->LoadSound(pDoorSoundIDsByLocationID[v39] + 1, 0); | |
3677 | |
3678 for (uint i = 0; i < pIndoor->uNumDoors; ++i) | |
3679 { | |
1980 | 3680 BLVDoor* pDoor = &pIndoor->pDoors[i]; |
0 | 3681 |
3682 if (pDoor->uAttributes & 0x01) | |
3683 { | |
3684 pDoor->uState = BLVDoor::Opening; | |
3685 pDoor->uTimeSinceTriggered = 15360; | |
3686 pDoor->uAttributes = 2; | |
3687 } | |
3688 | |
3689 if (pDoor->uState == BLVDoor::Closed) | |
3690 { | |
3691 pDoor->uState = BLVDoor::Closing; | |
3692 pDoor->uTimeSinceTriggered = 15360; | |
3693 pDoor->uAttributes = 2; | |
3694 } | |
3695 else if (pDoor->uState == BLVDoor::Open) | |
3696 { | |
3697 pDoor->uState = BLVDoor::Opening; | |
3698 pDoor->uTimeSinceTriggered = 15360; | |
3699 pDoor->uAttributes = 2; | |
3700 } | |
3701 } | |
3702 | |
3703 /* | |
3704 i = 0; | |
3705 v9 = 2; | |
3706 if ( pIndoor->uNumDoors > 0 ) | |
3707 { | |
3708 v10 = 0; | |
3709 while ( 1 ) | |
3710 { | |
3711 if ( pIndoor->pDoors[v10].uAttributes & 1 ) | |
3712 { | |
3713 pIndoor->pDoors[v10].uState = 1; | |
3714 pIndoor->pDoors[v10].uTimeSinceTriggered = 15360; | |
3715 pIndoor->pDoors[v10].uAttributes = 2; | |
3716 } | |
3717 v11 = (char *)&pIndoor->pDoors[v10].uState; | |
3718 if ( !*(short *)v11 ) | |
3719 break; | |
3720 if ( *(short *)v11 == 2 ) | |
3721 { | |
3722 *(short *)v11 = 1; | |
3723 goto LABEL_41; | |
3724 } | |
3725 LABEL_42: | |
3726 ++i; | |
3727 ++v10; | |
3728 if ( i >= pIndoor->uNumDoors ) | |
3729 goto LABEL_43; | |
3730 } | |
3731 *(short *)v11 = 3; | |
3732 LABEL_41: | |
3733 pIndoor->pDoors[v10].uTimeSinceTriggered = 15360; | |
3734 pIndoor->pDoors[v10].uAttributes = 2; | |
3735 goto LABEL_42; | |
3736 } | |
3737 LABEL_43: | |
3738 */ | |
3739 | |
3740 for (uint i = 0; i < pIndoor->uNumFaces; ++i) | |
3741 { | |
1980 | 3742 BLVFace* pFace = &pIndoor->pFaces[i]; |
0 | 3743 if (!pFace->uBitmapID != -1) |
3744 pBitmaps_LOD->pTextures[pFace->uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[pFace->uBitmapID].palette_id1); | |
3745 } | |
3746 | |
3747 pGameLoadingUI_ProgressBar->Progress(); | |
3748 | |
3749 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
3750 { | |
1980 | 3751 LevelDecoration* pDecortaion = &pLevelDecorations[i]; |
0 | 3752 |
3753 pDecorationList->InitializeDecorationSprite(pDecortaion->uDecorationDescID); | |
3754 | |
3755 v15 = pDecorationList->pDecorations[pDecortaion->uDecorationDescID].uSoundID; | |
3756 if (v15 && _6807E0_num_decorations_with_sounds_6807B8 < 9) | |
3757 { | |
3758 pSoundList->LoadSound(v15, 0); | |
3759 v16 = _6807E0_num_decorations_with_sounds_6807B8++; | |
3760 _6807B8_level_decorations_ids[v16] = i; | |
3761 } | |
3762 | |
1489 | 3763 if (!(pDecortaion->uFlags & LEVEL_DECORATION_INVISIBLE)) |
0 | 3764 { |
3765 v17 = &pDecorationList->pDecorations[pDecortaion->uDecorationDescID]; | |
380 | 3766 if (!v17->DontDraw()) |
0 | 3767 { |
3768 v18 = v17->uLightRadius; | |
3769 if ( v18 ) | |
3770 { | |
3771 unsigned char r = 255, | |
3772 g = 255, | |
3773 b = 255; | |
3774 if (pRenderer->pRenderD3D && pRenderer->bUseColoredLights) | |
3775 { | |
3776 r = v17->uColoredLightRed; | |
3777 g = v17->uColoredLightGreen; | |
3778 b = v17->uColoredLightBlue; | |
3779 } | |
3780 pStationaryLightsStack->AddLight(pDecortaion->vPosition.x, | |
3781 pDecortaion->vPosition.y, | |
3782 pDecortaion->vPosition.z + v17->uDecorationHeight, | |
3783 v18, | |
3784 r, | |
3785 g, | |
3786 b, | |
3787 byte_4E94D0); | |
3788 } | |
3789 } | |
3790 } | |
3791 | |
1514
965af46e8793
Rename LevelDecoration::field_16_event_id to LevelDecoration::uEventID.
yoctozepto
parents:
1493
diff
changeset
|
3792 if (!pDecortaion->uEventID) |
0 | 3793 { |
3794 if (pDecortaion->IsInteractive()) | |
3795 { | |
3796 if ( v35 < 124 ) | |
3797 { | |
3798 v21 = v35 + 1; | |
3799 pDecortaion->_idx_in_stru123 = v35 + 75; | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1705
diff
changeset
|
3800 v22 = stru_5E4C90_MapPersistVars._decor_events[v21 + 74 - 75]; |
0 | 3801 v35 = v21; |
3802 if ( !v22 ) | |
1489 | 3803 pDecortaion->uFlags |= LEVEL_DECORATION_INVISIBLE; |
0 | 3804 } |
3805 } | |
3806 } | |
3807 } | |
3808 | |
3809 pGameLoadingUI_ProgressBar->Progress(); | |
3810 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
3811 for (uint i = 0; i < uNumSpriteObjects; ++i) |
0 | 3812 { |
1980 | 3813 SpriteObject* p = &pSpriteObjects[i]; |
0 | 3814 if (p->uObjectDescID) |
3815 { | |
1980 | 3816 int uItemID = p->stru_24.uItemID; |
0 | 3817 if (uItemID) |
3818 { | |
3819 if (uItemID != 220 && pItemsTable->pItems[uItemID].uEquipType == EQUIP_POTION && | |
570 | 3820 !p->stru_24.uEnchantmentType) |
3821 p->stru_24.uEnchantmentType = rand() % 15 + 5; | |
0 | 3822 pItemsTable->SetSpecialBonus(&p->stru_24); |
3823 } | |
3824 } | |
3825 } | |
3826 | |
1988 | 3827 // INDOOR initialize actors |
0 | 3828 for (uint i = 0; i < uNumActors; ++i) |
3829 //if ( (signed int)uNumActors > (signed int)v13 ) | |
3830 { | |
1202 | 3831 Actor *pActor = &pActors[i]; |
0 | 3832 //v26 = (char *)&pActors[0].uAttributes; |
3833 //do | |
3834 //{ | |
3835 //v27 = *(int *)v26; | |
3836 if (pActor->uAttributes & 0x100000) | |
3837 { | |
3838 if ( !v39 ) | |
3839 { | |
3840 pActor->pMonsterInfo.field_3E = 19; | |
3841 pActor->uAttributes |= 0x10000; | |
3842 continue; | |
3843 } | |
3844 v28 = v38 == 0; | |
3845 } | |
3846 else | |
3847 { | |
3848 v28 = v38 == 1; | |
3849 } | |
3850 | |
3851 if ( !v28 ) | |
3852 { | |
3853 pActor->PrepareSprites(0); | |
3854 v29 = pActor->pMonsterInfo.field_3E; | |
3855 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
3856 if ( v29 != 11 && v29 != 19 && (!pActor->sCurrentHP || !pActor->pMonsterInfo.uHP) ) | |
3857 { | |
3858 pActor->pMonsterInfo.field_3E = 5; | |
3859 pActor->UpdateAnimation(); | |
3860 } | |
3861 } | |
3862 else | |
3863 { | |
3864 pActor->pMonsterInfo.field_3E = 19; | |
3865 pActor->uAttributes |= 0x10000; | |
3866 } | |
3867 //} | |
3868 //while ( i < (signed int)uNumActors ); | |
3869 } | |
3870 | |
3871 pGameLoadingUI_ProgressBar->Progress(); | |
3872 | |
3873 Actor this_; | |
3874 this_.pMonsterInfo.uID = 45; | |
3875 this_.PrepareSprites(0); | |
3876 if ( !v37 ) | |
3877 { | |
3878 pParty->sRotationX = 0; | |
3879 pParty->sRotationY = 0; | |
3880 pParty->vPosition.z = 0; | |
3881 pParty->vPosition.y = 0; | |
3882 pParty->vPosition.x = 0; | |
3883 pParty->uFallStartY = 0; | |
3884 pParty->uFallSpeed = 0; | |
3885 TeleportToStartingPoint(uLevel_StartingPointType); | |
3886 } | |
3887 viewparams->_443365(); | |
3888 PlayLevelMusic(); | |
3889 if ( !v37 ) | |
3890 { | |
3891 v30 = 0; | |
3892 v31 = 1; | |
3893 do | |
3894 { | |
3895 if ( pPlayers[v31]->CanAct() ) | |
3896 v34[v30++] = v31; | |
3897 ++v31; | |
3898 } | |
3899 while ( v31 <= 4 ); | |
3900 if ( v30 ) | |
3901 { | |
3902 if ( pDest ) | |
3903 { | |
3904 qword_A750D8 = 256i64; | |
1406 | 3905 PlayerSpeechID = SPEECH_46; |
1407 | 3906 uSpeakingCharacter = LOWORD(v34[rand() % v30]); |
0 | 3907 } |
3908 } | |
3909 } | |
1295 | 3910 } |
3911 //----- (0046CEC3) -------------------------------------------------------- | |
3912 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) | |
3913 { | |
3914 int v13; // ecx@13 | |
3915 signed int v14; // ebx@14 | |
3916 int v15; // eax@16 | |
3917 //int v16; // edx@19 | |
3918 //int v17; // ST18_4@19 | |
3919 //signed int v18; // edx@19 | |
3920 //signed __int64 v19; // qtt@19 | |
3921 int v21; // eax@27 | |
3922 //int v22; // ecx@29 | |
3923 signed int v28; // eax@45 | |
3924 int v29; // ebx@47 | |
3925 int v30; // edx@49 | |
3926 //int v31; // ST10_4@49 | |
3927 //signed int v32; // edx@49 | |
3928 signed __int64 v33; // qtt@49 | |
3929 //signed int v34; // eax@54 | |
3930 //signed int v35; // esi@56 | |
3931 //int result; // eax@57 | |
3932 int v38; // edx@62 | |
3933 //int v44; // [sp+20h] [bp-20h]@10 | |
3934 bool v47; // [sp+24h] [bp-1Ch]@43 | |
3935 bool v48; // [sp+28h] [bp-18h]@10 | |
3936 bool v49; // [sp+28h] [bp-18h]@41 | |
3937 bool v50; // [sp+2Ch] [bp-14h]@12 | |
3938 signed int v53; // [sp+30h] [bp-10h]@10 | |
3939 signed int v54; // [sp+30h] [bp-10h]@41 | |
3940 signed int v55; // [sp+34h] [bp-Ch]@1 | |
3941 | |
3942 //LOG_DECOMPILATION_WARNING(); | |
3943 | |
3944 static int blv_floor_id[50]; // 00721200 | |
3945 static int blv_floor_level[50]; // 007212C8 | |
3946 | |
2075 | 3947 static __int16 blv_floor_face_vert_coord_Y[104]; // word_721390_ys |
3948 static __int16 blv_floor_face_vert_coord_X[104]; // word_721460_xs | |
1295 | 3949 |
1980 | 3950 BLVSector* pSector = &pIndoor->pSectors[uSectorID]; |
1295 | 3951 v55 = 0; |
3952 for (uint i = 0; i < pSector->uNumFloors; ++i) | |
3953 { | |
1980 | 3954 BLVFace* pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; |
2027 | 3955 if (pFloor->Ethereal()) |
1295 | 3956 continue; |
3957 | |
3958 assert(pFloor->uNumVertices); | |
3959 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && | |
3960 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
3961 { | |
3962 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
3963 { | |
2075 | 3964 blv_floor_face_vert_coord_X[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
3965 blv_floor_face_vert_coord_X[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
3966 blv_floor_face_vert_coord_Y[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
3967 blv_floor_face_vert_coord_Y[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
1295 | 3968 } |
2075 | 3969 blv_floor_face_vert_coord_X[2 * pFloor->uNumVertices] = blv_floor_face_vert_coord_X[0]; |
3970 blv_floor_face_vert_coord_Y[2 * pFloor->uNumVertices] = blv_floor_face_vert_coord_Y[0]; | |
3971 | |
3972 v50 = blv_floor_face_vert_coord_Y[0] >= y; | |
1295 | 3973 v53 = 0; |
3974 | |
3975 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) | |
3976 { | |
3977 if (v53 >= 2) | |
3978 break; | |
3979 | |
3980 v48 = v50; | |
2075 | 3981 v50 = blv_floor_face_vert_coord_Y[j + 1] >= y; |
3982 | |
3983 v13 = i; | |
3984 if (v48 == v50) | |
3985 continue; | |
3986 | |
3987 v14 = blv_floor_face_vert_coord_X[j + 1] >= x ? 0 : 2; | |
3988 v15 = v14 | (blv_floor_face_vert_coord_X[j] < x); | |
3989 | |
3990 if (v15 == 3) | |
3991 continue; | |
3992 else if (!v15) | |
3993 ++v53; | |
3994 else | |
3995 { | |
3996 long long a_div_b = fixpoint_div(y - blv_floor_face_vert_coord_Y[j], blv_floor_face_vert_coord_Y[j + 1] - blv_floor_face_vert_coord_Y[j]); | |
3997 long long res = fixpoint_mul((signed int)blv_floor_face_vert_coord_X[j + 1] - (signed int)blv_floor_face_vert_coord_X[j], a_div_b); | |
3998 | |
3999 if (res + blv_floor_face_vert_coord_X[j] >= x) | |
1295 | 4000 ++v53; |
4001 } | |
4002 } | |
4003 | |
4004 | |
4005 if ( v53 == 1 ) | |
4006 { | |
4007 if ( v55 >= 50 ) | |
4008 break; | |
4009 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) | |
4010 { | |
4011 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; | |
4012 } | |
4013 else | |
4014 { | |
1643 | 4015 v21 = fixpoint_mul(pFloor->zCalc1, x) + fixpoint_mul(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
1295 | 4016 } |
4017 blv_floor_level[v55] = v21; | |
4018 blv_floor_id[v55] = pSector->pFloors[i]; | |
4019 v55++; | |
4020 } | |
4021 } | |
4022 } | |
4023 | |
4024 | |
4025 if ( pSector->field_0 & 8 ) | |
4026 { | |
4027 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
4028 { | |
1980 | 4029 BLVFace* portal = &pIndoor->pFaces[pSector->pPortals[i]]; |
1295 | 4030 if (portal->uPolygonType != POLYGON_Floor) |
4031 continue; | |
4032 | |
4033 if (!portal->uNumVertices) | |
4034 continue; | |
4035 | |
4036 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && | |
4037 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
4038 { | |
4039 for (uint j = 0; j < portal->uNumVertices; ++j) | |
4040 { | |
2075 | 4041 blv_floor_face_vert_coord_X[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
4042 blv_floor_face_vert_coord_X[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
4043 blv_floor_face_vert_coord_Y[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
4044 blv_floor_face_vert_coord_Y[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
1295 | 4045 } |
2075 | 4046 blv_floor_face_vert_coord_X[2 * portal->uNumVertices] = blv_floor_face_vert_coord_X[0]; |
4047 blv_floor_face_vert_coord_Y[2 * portal->uNumVertices] = blv_floor_face_vert_coord_Y[0]; | |
1295 | 4048 v54 = 0; |
2075 | 4049 v47 = blv_floor_face_vert_coord_Y[0] >= y; |
1295 | 4050 |
4051 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
4052 { | |
4053 v49 = v47; | |
4054 if ( v54 >= 2 ) | |
4055 break; | |
2075 | 4056 v47 = blv_floor_face_vert_coord_Y[j + 1] >= y; |
1295 | 4057 if ( v49 != v47 ) |
4058 { | |
2075 | 4059 v28 = blv_floor_face_vert_coord_X[j + 1] >= x ? 0 : 2; |
4060 v29 = v28 | (blv_floor_face_vert_coord_X[j] < x); | |
1295 | 4061 if ( v29 != 3 ) |
4062 { | |
4063 if ( !v29 ) | |
4064 ++v54; | |
4065 else | |
4066 { | |
2075 | 4067 long long a_div_b = fixpoint_div(y - blv_floor_face_vert_coord_Y[j], blv_floor_face_vert_coord_Y[j + 1] - blv_floor_face_vert_coord_Y[j]); |
4068 long long res = fixpoint_mul(blv_floor_face_vert_coord_X[j + 1] - blv_floor_face_vert_coord_X[j], a_div_b); | |
4069 if (res + blv_floor_face_vert_coord_X[j] >= x) | |
1295 | 4070 ++v54; |
4071 } | |
4072 } | |
4073 } | |
4074 } | |
4075 if ( v54 == 1 ) | |
4076 { | |
4077 if ( v55 >= 50 ) | |
4078 break; | |
4079 blv_floor_level[v55] = -29000; | |
4080 blv_floor_id[v55] = pSector->pPortals[i]; | |
4081 v55++; | |
4082 } | |
4083 } | |
4084 } | |
4085 } | |
4086 if ( v55 == 1 ) | |
4087 { | |
4088 *pFaceID = blv_floor_id[0]; | |
4089 return blv_floor_level[0]; | |
4090 } | |
4091 if ( !v55 ) | |
4092 return -30000; | |
4093 *pFaceID = blv_floor_id[0]; | |
4094 //result = blv_floor_level[0]; | |
4095 | |
4096 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
4097 { | |
4098 if ( blv_floor_level[0] <= z + 5 ) | |
4099 { | |
4100 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
4101 continue; | |
4102 blv_floor_level[0] = blv_floor_level[v35]; | |
4103 *pFaceID = blv_floor_id[v35]; | |
4104 continue; | |
4105 } | |
4106 if ( blv_floor_level[v35] < blv_floor_level[0] ) | |
4107 { | |
4108 blv_floor_level[0] = blv_floor_level[v35]; | |
4109 *pFaceID = blv_floor_id[v35]; | |
4110 } | |
4111 }*/ | |
4112 | |
4113 | |
4114 int result = blv_floor_level[0]; | |
4115 for (uint i = 1; i < v55; ++i) | |
4116 { | |
4117 v38 = blv_floor_level[i]; | |
4118 if ( result <= z + 5 ) | |
4119 { | |
4120 if ( v38 > result && v38 <= z + 5 ) | |
4121 { | |
4122 result = blv_floor_level[i]; | |
4123 *pFaceID = blv_floor_id[i]; | |
4124 } | |
4125 } | |
4126 else if ( v38 < result ) | |
4127 { | |
4128 result = blv_floor_level[i]; | |
4129 *pFaceID = blv_floor_id[i]; | |
4130 } | |
4131 } | |
4132 | |
4133 return result; | |
4134 } | |
4135 //----- (004016FA) -------------------------------------------------------- | |
1458 | 4136 int MakeActorAIList_BLV() |
1295 | 4137 { |
4138 Actor *v0; // esi@2 | |
4139 int v1; // eax@4 | |
4140 int v2; // ebx@4 | |
4141 unsigned int v3; // ecx@4 | |
4142 int v4; // edx@5 | |
4143 int v5; // edx@7 | |
4144 unsigned int v6; // edx@9 | |
4145 unsigned int v7; // ST24_4@10 | |
4146 int v8; // eax@10 | |
4147 int v9; // edi@10 | |
4148 int v10; // ebx@14 | |
4149 char v11; // zf@16 | |
4150 int v12; // eax@22 | |
4151 int v13; // edx@24 | |
4152 int v14; // ecx@25 | |
4153 int v15; // ebx@26 | |
4154 unsigned int *v16; // ecx@27 | |
4155 unsigned int v17; // esi@27 | |
4156 int v18; // ecx@31 | |
4157 signed int v19; // edi@31 | |
4158 Actor *v20; // esi@32 | |
4159 bool v21; // eax@33 | |
4160 int v22; // eax@34 | |
4161 signed int v23; // ebx@36 | |
4162 Actor *v24; // esi@37 | |
4163 signed int v25; // eax@40 | |
4164 int v26; // eax@43 | |
4165 int v27; // ebx@45 | |
4166 int j; // edi@45 | |
4167 unsigned int v29; // eax@46 | |
4168 int v30; // eax@48 | |
4169 int v31; // ecx@51 | |
4170 int v32; // eax@51 | |
4171 signed int v33; // eax@53 | |
4172 __int64 v34; // qax@55 | |
4173 char *v35; // ecx@56 | |
4174 int v37; // [sp+Ch] [bp-18h]@1 | |
4175 int v38; // [sp+10h] [bp-14h]@4 | |
4176 int v39; // [sp+14h] [bp-10h]@4 | |
4177 int v40; // [sp+18h] [bp-Ch]@10 | |
4178 int v41; // [sp+18h] [bp-Ch]@29 | |
4179 int i; // [sp+18h] [bp-Ch]@31 | |
4180 signed int v43; // [sp+1Ch] [bp-8h]@1 | |
4181 signed int v44; // [sp+1Ch] [bp-8h]@25 | |
4182 int v45; // [sp+20h] [bp-4h]@1 | |
4183 | |
4184 // __debugbreak(); // refactor for blv ai | |
4185 pParty->uFlags &= 0xFFFFFFCFu; | |
4186 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
4187 v45 = 0; | |
4188 v43 = 0; | |
4189 if ( (signed int)uNumActors > 0 ) | |
4190 { | |
4191 v0 = pActors.data();//[0].uAttributes; | |
4192 do | |
4193 { | |
4194 BYTE1(v0->uAttributes) &= 0xFBu; | |
4195 if ( ! v0->CanAct() ) | |
4196 goto LABEL_60; | |
4197 v39 = abs(pParty->vPosition.z - v0->vPosition.z); | |
4198 v38 = abs(pParty->vPosition.y - v0->vPosition.y); | |
4199 v1 = abs(pParty->vPosition.x - v0->vPosition.x); | |
4200 v2 = v38; | |
4201 v3 = v39; | |
4202 if ( v1 < v38 ) | |
4203 { | |
4204 v4 = v1; | |
4205 v1 = v38; | |
4206 v2 = v4; | |
4207 } | |
4208 if ( v1 < v39 ) | |
4209 { | |
4210 v5 = v1; | |
4211 v1 = v39; | |
4212 v3 = v5; | |
4213 } | |
4214 if ( v2 < (signed int)v3 ) | |
4215 { | |
4216 v6 = v3; | |
4217 v3 = v2; | |
4218 v2 = v6; | |
4219 } | |
4220 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | |
4221 v8 = v0->uActorRadius; | |
4222 v9 = v7 - v8; | |
4223 v40 = v7 - v8; | |
4224 if ( v40 < 0 ) | |
4225 { | |
4226 v9 = 0; | |
4227 v40 = 0; | |
4228 } | |
4229 if ( v9 < 10240 ) | |
4230 { | |
4231 v10 = v0->uAttributes & 0xFEFFFFFF; | |
4232 v0->uAttributes = v10; | |
4233 if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) | |
4234 { | |
4235 v11 = (pParty->uFlags & 0x10) == 0; | |
4236 v0->uAttributes = v10 | 0x1000000; | |
4237 if ( v11 && (double)v40 < 307.2 ) | |
4238 pParty->uFlags |= 0x10u; | |
4239 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) | |
4240 pParty->uFlags |= 0x20u; | |
4241 } | |
4242 v12 = v45++; | |
4243 ai_near_actors_distances[v12] = v9; | |
4244 ai_near_actors_ids[v12] = v43; | |
4245 } | |
4246 else | |
4247 { | |
4248 LABEL_60: | |
4249 BYTE1(v0->uAttributes) &= 0xBFu; | |
4250 } | |
4251 ++v43; | |
4252 ++v0; | |
4253 } | |
4254 while ( v43 < (signed int)uNumActors ); | |
4255 } | |
4256 v13 = 0; | |
4257 if ( v45 > 0 ) | |
4258 { | |
4259 v14 = 1; | |
4260 v44 = 1; | |
4261 do | |
4262 { | |
4263 while ( 1 ) | |
4264 { | |
4265 v41 = v14; | |
4266 if ( v14 >= v45 ) | |
4267 break; | |
4268 v15 = ai_near_actors_distances[v13]; | |
4269 if ( v15 > ai_near_actors_distances[v14] ) | |
4270 { | |
4271 v16 = &ai_near_actors_ids[v14]; | |
4272 v17 = ai_near_actors_ids[v13]; | |
4273 ai_near_actors_ids[v13] = *v16; | |
4274 *v16 = v17; | |
4275 v14 = v41; | |
4276 ai_near_actors_distances[v13] = ai_near_actors_distances[v41]; | |
4277 ai_near_actors_distances[v41] = v15; | |
4278 } | |
4279 ++v14; | |
4280 } | |
4281 ++v13; | |
4282 v14 = v44 + 1; | |
4283 v44 = v14; | |
4284 } | |
4285 while ( v14 - 1 < v45 ); | |
4286 } | |
4287 v18 = 0; | |
4288 v19 = 0; | |
4289 for ( i = 0; v18 < v45; i = v18 ) | |
4290 { | |
4291 v20 = &pActors[ai_near_actors_ids[v18]]; | |
4292 if ( v20->uAttributes & 0x8000 | |
1493 | 4293 || (v21 = sub_4070EF_prolly_detect_player(PID(OBJECT_Actor,ai_near_actors_ids[v18]), 4u), v18 = i, v21) ) |
1295 | 4294 { |
4295 v22 = ai_near_actors_ids[v18]; | |
4296 v20->uAttributes |= 0x8000u; | |
4297 ai_array_4F6638_actor_ids[v19] = v22; | |
4298 ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; | |
4299 if ( v19 >= 30 ) | |
4300 break; | |
4301 } | |
4302 ++v18; | |
4303 } | |
4304 v23 = 0; | |
4305 ai_arrays_size = v19; | |
4306 if ( (signed int)uNumActors > 0 ) | |
4307 { | |
4308 v24 = pActors.data();//[0].uAttributes; | |
4309 do | |
4310 { | |
4311 if ( v24->CanAct() && v24->uSectorID == v37 ) | |
4312 { | |
4313 v25 = 0; | |
4314 if ( v19 <= 0 ) | |
4315 { | |
4316 LABEL_43: | |
4317 v26 = ai_arrays_size; | |
4318 BYTE1(v24->uAttributes) |= 0x40u; | |
4319 ++ai_arrays_size; | |
4320 ai_array_4F6638_actor_ids[v26] = v23; | |
4321 } | |
4322 else | |
4323 { | |
4324 while ( ai_array_4F6638_actor_ids[v25] != v23 ) | |
4325 { | |
4326 ++v25; | |
4327 if ( v25 >= v19 ) | |
4328 goto LABEL_43; | |
4329 } | |
4330 } | |
4331 } | |
4332 ++v23; | |
4333 ++v24; | |
4334 } | |
4335 while ( v23 < (signed int)uNumActors ); | |
4336 } | |
4337 v27 = ai_arrays_size; | |
4338 for ( j = 0; j < v45; ++j ) | |
4339 { | |
4340 v29 = ai_near_actors_ids[j]; | |
4341 if ( pActors[v29].uAttributes & 0xC000 && pActors[v29].CanAct() ) | |
4342 { | |
4343 v30 = 0; | |
4344 if ( v27 <= 0 ) | |
4345 { | |
4346 LABEL_51: | |
4347 v31 = ai_arrays_size; | |
4348 v32 = ai_near_actors_ids[j]; | |
4349 ++ai_arrays_size; | |
4350 ai_array_4F6638_actor_ids[v31] = v32; | |
4351 } | |
4352 else | |
4353 { | |
4354 while ( ai_array_4F6638_actor_ids[v30] != ai_near_actors_ids[j] ) | |
4355 { | |
4356 ++v30; | |
4357 if ( v30 >= v27 ) | |
4358 goto LABEL_51; | |
4359 } | |
4360 } | |
4361 } | |
4362 } | |
4363 v33 = ai_arrays_size; | |
4364 if ( ai_arrays_size > 30 ) | |
4365 { | |
4366 v33 = 30; | |
4367 ai_arrays_size = 30; | |
4368 } | |
4369 memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * v33); | |
4370 memcpy(ai_near_actors_distances.data(), ai_array_4F5E68.data(), 4 * ai_arrays_size); | |
4371 v34 = (unsigned int)ai_arrays_size; | |
4372 if ( ai_arrays_size > 0 ) | |
4373 { | |
4374 do | |
4375 { | |
4376 v35 = (char *)&pActors[ai_near_actors_ids[HIDWORD(v34)]].uAttributes; | |
4377 v35[1] |= 4u; | |
4378 ++HIDWORD(v34); | |
4379 } | |
4380 while ( SHIDWORD(v34) < (signed int)v34 ); | |
4381 } | |
4382 return v34; | |
4383 } | |
4384 //----- (0043FDED) -------------------------------------------------------- | |
4385 void PrepareActorRenderList_BLV() | |
4386 { | |
4387 RenderBillboard *v0; // esi@0 | |
4388 unsigned __int16 v3; // ax@3 | |
4389 unsigned int v4; // eax@5 | |
4390 unsigned __int16 v5; // cx@5 | |
4391 int v6; // esi@5 | |
4392 unsigned int v7; // eax@7 | |
4393 int v8; // eax@10 | |
4394 SpriteFrame *v9; // eax@16 | |
4395 SpriteFrame *v10; // ebx@18 | |
4396 //int *v11; // eax@18 | |
4397 int v12; // ecx@28 | |
4398 //IndoorCameraD3D **v14; // eax@36 | |
4399 double v15; // st7@36 | |
4400 float v16; // eax@36 | |
4401 //double v17; // ST30_8@36 | |
4402 signed __int64 v18; // qtt@36 | |
4403 int v19; // ST5C_4@36 | |
4404 signed __int64 v20; // qtt@37 | |
4405 int v21; // ST5C_4@37 | |
4406 signed __int16 v22; // cx@39 | |
4407 int v23; // ST50_4@40 | |
4408 signed int v24; // ecx@40 | |
4409 int v25; // edx@44 | |
4410 __int16 v26; // ax@44 | |
4411 //MonsterDesc *v27; // edx@44 | |
4412 //int v28; // ecx@44 | |
4413 unsigned __int8 v29; // zf@44 | |
4414 unsigned __int8 v30; // sf@44 | |
4415 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
4416 int v32; // [sp+1Ch] [bp-38h]@5 | |
4417 int a3; // [sp+20h] [bp-34h]@5 | |
4418 int a2; // [sp+24h] [bp-30h]@5 | |
4419 int a1a; // [sp+28h] [bp-2Ch]@5 | |
4420 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
4421 int a5a; // [sp+2Ch] [bp-28h]@36 | |
4422 int a5b; // [sp+2Ch] [bp-28h]@40 | |
4423 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
4424 int a6; // [sp+40h] [bp-14h]@34 | |
4425 int v43; // [sp+44h] [bp-10h]@34 | |
4426 int z; // [sp+48h] [bp-Ch]@32 | |
4427 signed int y; // [sp+4Ch] [bp-8h]@32 | |
4428 int x; // [sp+50h] [bp-4h]@32 | |
4429 | |
4430 for (uint i = 0; i < uNumActors; ++i) | |
4431 { | |
1980 | 4432 Actor* p = &pActors[i]; |
1295 | 4433 |
4434 if (p->uAIState == Removed || | |
4435 p->uAIState == Disabled) | |
4436 continue; | |
4437 | |
4438 a5 = p->uSectorID; | |
4439 a2 = p->vPosition.y; | |
4440 a1a = p->vPosition.x; | |
4441 a3 = p->vPosition.z; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4442 v4 = stru_5C6E00->Atan2(a1a - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y); |
1295 | 4443 LOWORD(v0) = p->uYawAngle; |
4444 v5 = p->uCurrentActionAnimation; | |
4445 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
4446 v32 = v6; | |
4447 if ( pParty->bTurnBasedModeOn ) | |
4448 { | |
4449 if ( v5 == 1 ) | |
4450 { | |
4451 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
4452 goto LABEL_10; | |
4453 } | |
4454 } | |
4455 else | |
4456 { | |
4457 if ( v5 == 1 ) | |
4458 { | |
4459 v7 = pBLVRenderParams->field_0_timer_; | |
4460 LABEL_10: | |
4461 v8 = i * 32 + v7; | |
4462 goto LABEL_12; | |
4463 } | |
4464 } | |
4465 v8 = p->uCurrentActionTime; | |
4466 LABEL_12: | |
1946
aa3ca49a10f5
pActorBuffs[6] to pActorBuffs[ACTOR_BUFF_PARALYZED]
Grumpy7
parents:
1945
diff
changeset
|
4467 if (p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0i64 || p->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0i64 ) |
1295 | 4468 v8 = 0; |
4469 v31 = p->pSpriteIDs[v5]; | |
4470 if (p->uAIState == Resurrected) | |
4471 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
4472 else | |
4473 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
4474 v41 = 0; | |
4475 v10 = v9; | |
4476 //v11 = (int *)v9->uFlags; | |
4477 if (v9->uFlags & 2) | |
4478 v41 = 2; | |
4479 if (v9->uFlags & 0x40000) | |
4480 v41 |= 0x40u; | |
4481 if (v9->uFlags & 0x20000) | |
4482 LOBYTE(v41) = v41 | 0x80; | |
4483 v0 = (RenderBillboard *)(256 << v6); | |
4484 if ( (unsigned int)v0 & v9->uFlags) | |
4485 v41 |= 4u; | |
4486 if ( v10->uGlowRadius ) | |
4487 { | |
4488 //LOBYTE(v11) = byte_4E94D3; | |
4489 pMobileLightsStack->AddLight( | |
4490 a1a, | |
4491 a2, | |
4492 a3, | |
4493 a5, | |
4494 v10->uGlowRadius, | |
4495 0xFFu, | |
4496 0xFFu, | |
4497 0xFFu, | |
4498 byte_4E94D3); | |
4499 } | |
4500 v12 = 0; | |
4501 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
4502 continue; | |
4503 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
4504 { | |
4505 ++v12; | |
4506 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
4507 goto _continue; | |
4508 } | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4509 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1a, a2, a3, &x, &y, &z, 1) |
1295 | 4510 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) |
4511 continue; | |
4512 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
4513 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
4514 if (uNumBillboardsToDraw >= 500) | |
4515 break; | |
4516 ++uNumBillboardsToDraw; | |
4517 ++uNumSpritesDrawnThisFrame; | |
4518 p->uAttributes |= 8u; | |
4519 v29 = pRenderer->pRenderD3D == 0; | |
4520 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
4521 v0->uPalette = v10->uPaletteIndex; | |
4522 v0->uIndoorSectorID = a5; | |
4523 if ( v29 ) | |
4524 { | |
1641 | 4525 LODWORD(v20) = pBLVRenderParams->fov_rad_fixpoint << 16; |
4526 HIDWORD(v20) = pBLVRenderParams->fov_rad_fixpoint >> 16; | |
1295 | 4527 v21 = v20 / x; |
4528 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; | |
4529 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; | |
4530 } | |
4531 else | |
4532 { | |
4533 //v14 = &pGame->pIndoorCameraD3D; | |
4534 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
4535 v15 = pGame->pIndoorCameraD3D->fov_y; | |
4536 v16 = v0->fov_x; | |
4537 v0->fov_y = v15; | |
4538 //v17 = v16 + 6.7553994e15; | |
4539 LODWORD(v18) = 0; | |
4540 HIDWORD(v18) = floorf(v16 + 0.5f); | |
4541 v19 = v18 / x; | |
4542 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; | |
4543 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; | |
4544 } | |
4545 v0->_screenspace_y_scaler_packedfloat = a5a; | |
1949 | 4546 if ( (signed __int64)p->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 ) |
1295 | 4547 { |
1954
730166317ed0
pActorBuffs[10] to pActorBuffs[ACTOR_BUFF_MASS_DISTORTION]
Grumpy7
parents:
1951
diff
changeset
|
4548 if ( (signed __int64)p->pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0 ) |
1295 | 4549 { |
4550 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; | |
4551 goto LABEL_43; | |
4552 } | |
4553 } | |
4554 else | |
4555 { | |
1949 | 4556 v22 = p->pActorBuffs[ACTOR_BUFF_SHRINK].uPower; |
1295 | 4557 if ( v22 ) |
4558 { | |
4559 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; | |
1949 | 4560 v24 = p->pActorBuffs[ACTOR_BUFF_SHRINK].uPower; |
1295 | 4561 v0->_screenspace_x_scaler_packedfloat = v23; |
4562 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; | |
4563 LABEL_43: | |
4564 v0->_screenspace_y_scaler_packedfloat = a5b; | |
4565 goto LABEL_44; | |
4566 } | |
4567 } | |
4568 LABEL_44: | |
4569 HIWORD(v25) = HIWORD(x); | |
4570 v0->world_x = a1a; | |
4571 v0->world_y = a2; | |
4572 v0->world_z = a3; | |
4573 v0->uScreenSpaceX = v43; | |
4574 v0->uScreenSpaceY = a6; | |
4575 LOWORD(v25) = 0; | |
4576 LOBYTE(v26) = v41; | |
4577 | |
4578 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); | |
4579 v0->actual_z = HIWORD(x); | |
4580 v0->object_pid = PID(OBJECT_Actor,i); | |
4581 | |
1945 | 4582 v29 = HIDWORD(p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) == 0; |
4583 v30 = HIDWORD(p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) < 0; | |
1295 | 4584 v0->field_1E = v41; |
4585 v0->pSpriteFrame = v10; | |
2006 | 4586 v0->sTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].sTintColor; |
1945 | 4587 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime)) ) |
1295 | 4588 { |
4589 HIBYTE(v26) = HIBYTE(v41) | 1; | |
4590 v0->field_1E = v26; | |
4591 } | |
4592 | |
4593 _continue: | |
4594 ; | |
4595 } | |
4596 } | |
4597 //----- (0044028F) -------------------------------------------------------- | |
4598 void PrepareItemsRenderList_BLV() | |
4599 { | |
4600 ObjectDesc *v1; // ebx@4 | |
4601 __int16 v2; // ax@5 | |
4602 RenderBillboard *v3; // esi@12 | |
4603 SpriteFrame *v4; // eax@12 | |
4604 SpriteFrame *v5; // ebx@12 | |
4605 unsigned int v6; // eax@12 | |
4606 int v7; // ecx@12 | |
4607 int v8; // edx@12 | |
4608 int v9; // ecx@12 | |
4609 unsigned __int16 v10; // ax@12 | |
4610 int *v11; // eax@20 | |
4611 //char v12; // zf@26 | |
4612 __int64 v18; // ST5C_4@27 | |
4613 signed __int64 v19; // qtt@28 | |
4614 int v20; // ST5C_4@28 | |
4615 //int v21; // edx@29 | |
4616 __int16 v22; // ax@29 | |
4617 //int v23; // eax@29 | |
4618 SpriteFrame *v24; // [sp+1Ch] [bp-40h]@12 | |
4619 //__int16 a5; // [sp+28h] [bp-34h]@12 | |
4620 int a6; // [sp+2Ch] [bp-30h]@12 | |
4621 int a2; // [sp+30h] [bp-2Ch]@12 | |
4622 int a1; // [sp+34h] [bp-28h]@12 | |
4623 int v30; // [sp+38h] [bp-24h]@12 | |
4624 int v31; // [sp+38h] [bp-24h]@27 | |
4625 int a3; // [sp+40h] [bp-1Ch]@12 | |
4626 signed __int16 v34; // [sp+44h] [bp-18h]@14 | |
4627 int v35; // [sp+48h] [bp-14h]@25 | |
4628 int v36; // [sp+4Ch] [bp-10h]@25 | |
4629 signed int z; // [sp+50h] [bp-Ch]@24 | |
4630 signed int y; // [sp+54h] [bp-8h]@24 | |
4631 signed int x; // [sp+58h] [bp-4h]@24 | |
4632 | |
4633 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
4634 { | |
1980 | 4635 SpriteObject* p = &pSpriteObjects[i]; |
1295 | 4636 if (p->uObjectDescID) |
4637 { | |
4638 v1 = &pObjectList->pObjects[p->uObjectDescID]; | |
4639 if ( !(v1->uFlags & 1) ) | |
4640 { | |
4641 if ( ((v2 = p->uType, v2 < 1000) || v2 >= 10000) | |
4642 && (v2 < 500 || v2 >= 600) | |
4643 && (v2 < 811 || v2 >= 815) | |
4644 || pGame->pStru6Instance->_4A81CA(p)) | |
4645 { | |
4646 //a5 = p->uSectorID; | |
4647 a1 = p->vPosition.x; | |
4648 a2 = p->vPosition.y; | |
4649 a3 = p->vPosition.z; | |
4650 v3 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
4651 v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, p->uSpriteFrameID); | |
4652 v5 = v4; | |
4653 v24 = v4; | |
4654 v30 = v4->uFlags; | |
4655 a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4656 v6 = stru_5C6E00->Atan2(p->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4657 p->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); |
1295 | 4658 LOWORD(v7) = p->uFacing; |
4659 v8 = v30; | |
4660 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; | |
4661 v10 = v5->pHwSpriteIDs[v9]; | |
4662 v3->uHwSpriteID = v10; | |
4663 if ( v30 & 0x20 ) | |
4664 { | |
4665 v8 = v30; | |
4666 a3 -= (signed int)((unsigned __int64)(v5->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; | |
4667 } | |
4668 v34 = 0; | |
4669 if ( v8 & 2 ) | |
4670 v34 = 2; | |
4671 if ( v8 & 0x40000 ) | |
4672 v34 |= 0x40u; | |
4673 if ( v8 & 0x20000 ) | |
4674 LOBYTE(v34) = v34 | 0x80; | |
4675 v11 = (int *)(256 << v9); | |
4676 if ( (256 << v9) & v8 ) | |
4677 v34 |= 4u; | |
4678 if ( a6 ) | |
4679 { | |
4680 LOBYTE(v11) = byte_4E94D3; | |
4681 pMobileLightsStack->AddLight( | |
4682 a1, | |
4683 a2, | |
4684 a3, | |
4685 p->uSectorID, | |
4686 a6, | |
4687 v1->uParticleTrailColorR, | |
4688 v1->uParticleTrailColorG, | |
4689 v1->uParticleTrailColorB, | |
4690 byte_4E94D3); | |
4691 } | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4692 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV( |
1295 | 4693 a1, |
4694 a2, | |
4695 a3, | |
4696 &x, | |
4697 &y, | |
4698 &z, | |
4699 1) ) | |
4700 { | |
4701 pGame->pIndoorCameraD3D->Project(x, y, z, &v36, &v35); | |
4702 | |
4703 assert(uNumBillboardsToDraw < 500); | |
4704 //if ( (signed int)uNumBillboardsToDraw >= 500 ) | |
4705 // return; | |
4706 ++uNumBillboardsToDraw; | |
4707 ++uNumSpritesDrawnThisFrame; | |
4708 p->uAttributes |= 1u; | |
4709 //v12 = pRenderer->pRenderD3D == 0; | |
4710 v3->uPalette = v24->uPaletteIndex; | |
4711 v3->uIndoorSectorID = p->uSectorID; | |
4712 if ( pRenderer->pRenderD3D ) | |
4713 { | |
4714 v3->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
4715 v3->fov_y = pGame->pIndoorCameraD3D->fov_y; | |
4716 LODWORD(v18) = 0; | |
4717 HIDWORD(v18) = (int)floorf(v3->fov_x + 0.5f); | |
4718 v18 = v18 / x; | |
4719 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16; | |
4720 v31 = (unsigned __int64)(v24->scale * v18) >> 16; | |
4721 } | |
4722 else | |
4723 { | |
1544 | 4724 __debugbreak(); // sw rendering |
4725 /*LODWORD(v19) = pBLVRenderParams->field_40 << 16; | |
1295 | 4726 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16; |
4727 v20 = v19 / x; | |
4728 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16; | |
1544 | 4729 v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16;*/ |
1295 | 4730 } |
4731 //HIWORD(v21) = HIWORD(x); | |
4732 //LOWORD(v21) = 0; | |
4733 v3->_screenspace_y_scaler_packedfloat = v31; | |
4734 v3->field_1E = v34; | |
4735 v3->world_x = a1; | |
4736 v3->world_y = a2; | |
4737 v3->world_z = a3; | |
4738 v3->uScreenSpaceX = v36; | |
4739 v22 = v35; | |
2006 | 4740 v3->sTintColor = 0; |
1295 | 4741 v3->uScreenSpaceY = v22; |
4742 //v23 = 8 * i; | |
4743 //LOBYTE(v23) = PID(OBJECT_Item,i); | |
4744 v3->pSpriteFrame = v24; | |
4745 //v12 = (p->uAttributes & 0x20) == 0; | |
4746 //v3->sZValue = v21 + v23; | |
4747 v3->actual_z = HIWORD(x); | |
4748 v3->object_pid = PID(OBJECT_Item,i); | |
4749 if (p->uAttributes & 0x20) | |
4750 { | |
4751 if ( !pRenderer->pRenderD3D ) | |
4752 v3->sZValue = 0; | |
4753 } | |
4754 } | |
4755 } | |
4756 } | |
4757 } | |
4758 } | |
4759 } | |
4760 | |
4761 //----- (00440639) -------------------------------------------------------- | |
4762 void AddBspNodeToRenderList(unsigned int node_id) | |
4763 { | |
4764 BLVSector *pSector; // esi@1 | |
4765 | |
4766 pSector = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID]; | |
4767 if ( pRenderer->pRenderD3D ) | |
4768 { | |
4769 for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) | |
4770 //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); | |
4771 pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]); | |
4772 } | |
4773 else | |
4774 { | |
4775 for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) | |
4776 pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[i]); | |
4777 } | |
4778 if ( pSector->field_0 & 0x10 ) | |
4779 sub_4406BC(node_id, pSector->uFirstBSPNode); | |
4780 } | |
4781 | |
4782 //----- (004406BC) -------------------------------------------------------- | |
4783 void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode) | |
4784 { | |
4785 BLVSector *pSector; // esi@2 | |
4786 BSPNode *pNode; // edi@2 | |
4787 BLVFace *pFace; // eax@2 | |
4788 int v5; // ecx@2 | |
4789 __int16 v6; // ax@6 | |
4790 int v7; // ebp@10 | |
4791 int v8; // ebx@10 | |
4792 __int16 v9; // di@18 | |
4793 //int v10; // [sp+10h] [bp-Ch]@1 | |
4794 //bool v11; // [sp+14h] [bp-8h]@5 | |
4795 BspRenderer_stru0 *node; // [sp+18h] [bp-4h]@1 | |
4796 | |
4797 //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); | |
4798 | |
4799 //v10 = a1; | |
4800 node = &pBspRenderer->nodes[node_id]; | |
4801 while ( 1 ) | |
4802 { | |
4803 pSector = &pIndoor->pSectors[node->uSectorID]; | |
4804 pNode = &pIndoor->pNodes[uFirstNode]; | |
4805 pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]]; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4806 v5 = pFace->pFacePlane_old.dist + |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4807 pGame->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x + |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4808 pGame->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4809 pGame->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation |
1295 | 4810 if (pFace->Portal() && pFace->uSectorID != node->uSectorID ) |
4811 v5 = -v5; | |
4812 //v11 = v5 > 0; | |
4813 if ( v5 <= 0 ) | |
4814 v6 = pNode->uFront; | |
4815 else | |
4816 v6 = pNode->uBack; | |
4817 if ( v6 != -1 ) | |
4818 sub_4406BC(node_id, v6); | |
4819 v7 = pNode->uCoplanarOffset; | |
4820 v8 = v7 + pNode->uCoplanarSize; | |
4821 | |
4822 //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]); | |
4823 | |
4824 if ( pRenderer->pRenderD3D ) | |
4825 { | |
4826 while ( v7 < v8 ) | |
4827 pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[v7++]); | |
4828 } | |
4829 else | |
4830 { | |
4831 while ( v7 < v8 ) | |
4832 pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[v7++]); | |
4833 } | |
4834 v9 = v5 > 0 ? pNode->uFront : pNode->uBack; | |
4835 if ( v9 == -1 ) | |
4836 break; | |
4837 uFirstNode = v9; | |
4838 } | |
4839 } | |
4840 //----- (0043FA33) -------------------------------------------------------- | |
1544 | 4841 void PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID) |
1295 | 4842 { |
4843 LevelDecoration *v2; // esi@1 | |
4844 DecorationDesc *v3; // ebx@2 | |
4845 __int16 v4; // ax@2 | |
4846 double v5; // st7@3 | |
4847 int v6; // eax@5 | |
4848 int v7; // edx@5 | |
4849 unsigned int v8; // edi@5 | |
4850 int v9; // edi@5 | |
4851 int v10; // eax@7 | |
4852 SpriteFrame *v11; // eax@7 | |
4853 SpriteFrame *v12; // esi@7 | |
4854 int v13; // eax@7 | |
4855 int v14; // ebx@16 | |
4856 RenderBillboard *v15; // ecx@17 | |
4857 char v16; // zf@18 | |
4858 IndoorCameraD3D **v17; // eax@19 | |
4859 double v18; // st7@19 | |
4860 //float v19; // eax@19 | |
4861 signed __int64 v20; // qtt@19 | |
4862 signed __int64 v21; // qtt@20 | |
4863 //int v22; // edx@21 | |
4864 //int v23; // eax@21 | |
4865 Particle_sw local_0; // [sp+Ch] [bp-A0h]@3 | |
4866 //double v25; // [sp+74h] [bp-38h]@19 | |
4867 //unsigned int v26; // [sp+7Ch] [bp-30h]@1 | |
4868 int a2; // [sp+80h] [bp-2Ch]@5 | |
4869 int a3; // [sp+84h] [bp-28h]@5 | |
4870 int a1; // [sp+88h] [bp-24h]@5 | |
4871 int v30; // [sp+8Ch] [bp-20h]@7 | |
4872 //float v31; // [sp+90h] [bp-1Ch]@1 | |
4873 int a5; // [sp+94h] [bp-18h]@17 | |
4874 int z; // [sp+98h] [bp-14h]@15 | |
4875 int a6; // [sp+9Ch] [bp-10h]@17 | |
4876 int y; // [sp+A0h] [bp-Ch]@15 | |
4877 int x; // [sp+A4h] [bp-8h]@15 | |
4878 int v37; // [sp+A8h] [bp-4h]@5 | |
4879 | |
4880 //v26 = uDecorationID; | |
4881 //LODWORD(v31) = uSectorID; | |
4882 v2 = &pLevelDecorations[uDecorationID]; | |
1489 | 4883 if (v2->uFlags & LEVEL_DECORATION_INVISIBLE) |
1295 | 4884 return; |
4885 | |
4886 v3 = &pDecorationList->pDecorations[v2->uDecorationDescID]; | |
4887 v4 = v3->uFlags; | |
1479
59d1da1863df
Rename DECORATION_FLAGS to DECORATION_DESC_FLAGS.
yoctozepto
parents:
1477
diff
changeset
|
4888 if (v3->uFlags & DECORATION_DESC_EMITS_FIRE) |
1295 | 4889 { |
4890 memset(&local_0, 0, 0x68u); // fire, like at the Pit's tavern | |
4891 v5 = (double)v2->vPosition.x; | |
4892 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | |
4893 local_0.uDiffuse = 0xFF3C1E; | |
4894 local_0.x = v5; | |
4895 local_0.y = (double)v2->vPosition.y; | |
4896 local_0.z = (double)v2->vPosition.z; | |
1390 | 4897 local_0.r = 0.0; |
4898 local_0.g = 0.0; | |
4899 local_0.b = 0.0; | |
1295 | 4900 local_0.flt_28 = 1.0; |
4901 local_0.timeToLive = (rand() & 0x80) + 128; | |
4902 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | |
4903 pGame->pParticleEngine->AddParticle(&local_0); | |
4904 return; | |
4905 } | |
4906 | |
4907 | |
1479
59d1da1863df
Rename DECORATION_FLAGS to DECORATION_DESC_FLAGS.
yoctozepto
parents:
1477
diff
changeset
|
4908 if (v4 & DECORATION_DESC_DONT_DRAW) |
1295 | 4909 return; |
4910 | |
4911 v6 = v2->vPosition.x; | |
4912 v7 = v2->vPosition.z; | |
4913 a2 = v2->vPosition.y; | |
4914 a1 = v6; | |
4915 a3 = v7; | |
4916 v8 = v2->field_10_y_rot | |
4917 + ((signed int)stru_5C6E00->uIntegerPi >> 3) | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4918 - stru_5C6E00->Atan2(v6 - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y); |
1295 | 4919 v37 = pBLVRenderParams->field_0_timer_; |
4920 v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7; | |
4921 if (pParty->bTurnBasedModeOn) | |
4922 v37 = pMiscTimer->uTotalGameTimeElapsed; | |
4923 v10 = abs(v2->vPosition.x + v2->vPosition.y); | |
4924 v11 = pSpriteFrameTable->GetFrame(v3->uSpriteID, v37 + v10); | |
4925 v30 = 0; | |
4926 v12 = v11; | |
4927 v13 = v11->uFlags; | |
4928 if ( v13 & 2 ) | |
4929 v30 = 2; | |
4930 if ( v13 & 0x40000 ) | |
4931 v30 |= 0x40u; | |
4932 if ( v13 & 0x20000 ) | |
4933 LOBYTE(v30) = v30 | 0x80; | |
4934 if ( (256 << v9) & v13 ) | |
4935 v30 |= 4u; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4936 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1, a2, a3, &x, &y, &z, 1) ) |
1295 | 4937 { |
4938 v14 = abs(x); | |
4939 if ( v14 >= abs(y) ) | |
4940 { | |
4941 pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6); | |
4942 | |
4943 v15 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
4944 assert(uNumBillboardsToDraw < 500); | |
4945 | |
4946 ++uNumBillboardsToDraw; | |
4947 ++uNumDecorationsDrawnThisFrame; | |
4948 v16 = pRenderer->pRenderD3D == 0; | |
4949 v15->uHwSpriteID = v12->pHwSpriteIDs[v9]; | |
4950 v15->uPalette = v12->uPaletteIndex; | |
4951 v15->uIndoorSectorID = uSectorID; | |
4952 if ( v16 ) | |
4953 { | |
1641 | 4954 LODWORD(v21) = pBLVRenderParams->fov_rad_fixpoint << 16; |
4955 HIDWORD(v21) = pBLVRenderParams->fov_rad_fixpoint >> 16; | |
1295 | 4956 v37 = v21 / x; |
4957 //LODWORD(v31) = v12->scale; | |
4958 v37 = v21 / x; | |
4959 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v21 / x) >> 16; | |
4960 v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16; | |
4961 } | |
4962 else | |
4963 { | |
4964 v17 = &pGame->pIndoorCameraD3D; | |
4965 v15->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
4966 v18 = (*v17)->fov_y; | |
4967 //v19 = v15->fov_x; | |
4968 v15->fov_y = v18; | |
4969 //v31 = v19; | |
4970 //v25 = v19 + 6.7553994e15; | |
4971 //v25 = floorf(v15->fov_x + 0.5f); | |
4972 LODWORD(v20) = 0; | |
4973 HIDWORD(v20) = floorf(v15->fov_x + 0.5f); | |
4974 v37 = v20 / x; | |
4975 //LODWORD(v31) = v12->scale; | |
4976 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
4977 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
4978 //v31 = v15->fov_y; | |
4979 //v25 = v31 + 6.7553994e15; | |
4980 //v25 = floorf(v15->fov_y + 0.5f); | |
4981 LODWORD(v20) = 0; | |
4982 HIDWORD(v20) = floorf(v15->fov_y + 0.5f); | |
4983 v37 = v20 / x; | |
4984 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
4985 } | |
4986 //HIWORD(v22) = HIWORD(x); | |
4987 //LOWORD(v22) = 0; | |
4988 v15->_screenspace_y_scaler_packedfloat = v37; | |
4989 v15->field_1E = v30; | |
4990 v15->world_x = a1; | |
4991 v15->world_y = a2; | |
4992 v15->world_z = a3; | |
4993 v15->uScreenSpaceX = a5; | |
4994 v15->uScreenSpaceY = a6; | |
4995 //v23 = 8 * uDecorationID; | |
4996 //LOBYTE(v23) = PID(OBJECT_Decoration,uDecorationID); | |
4997 | |
4998 //v15->sZValue = v22 + v23; | |
4999 v15->actual_z = HIWORD(x); | |
5000 v15->object_pid = PID(OBJECT_Decoration,uDecorationID); | |
5001 | |
2006 | 5002 v15->sTintColor = 0; |
1295 | 5003 v15->pSpriteFrame = v12; |
5004 } | |
5005 } | |
5006 } | |
5007 //----- (0043F953) -------------------------------------------------------- | |
5008 void PrepareBspRenderList_BLV() | |
5009 { | |
5010 pBspRenderer->num_faces = 0; | |
5011 | |
5012 if (pBLVRenderParams->uPartySectorID) | |
5013 { | |
5014 pBspRenderer->nodes[0].uSectorID = pBLVRenderParams->uPartySectorID; | |
5015 pBspRenderer->nodes[0].uViewportW = pBLVRenderParams->uViewportW; | |
5016 pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ; | |
5017 pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY; | |
5018 pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX; | |
1376 | 5019 pBspRenderer->nodes[0].PortalScreenData.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, |
1295 | 5020 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); |
5021 pBspRenderer->nodes[0].uFaceID = -1; | |
5022 pBspRenderer->nodes[0].viewing_portal_id = -1; | |
5023 pBspRenderer->num_nodes = 1; | |
5024 AddBspNodeToRenderList(0); | |
5025 } | |
5026 | |
5027 pBspRenderer->MakeVisibleSectorList(); | |
5028 } | |
5029 | |
5030 //----- (0043F9E1) -------------------------------------------------------- | |
1376 | 5031 void BspRenderer_PortalViewportData::GetViewportData(__int16 x, int y, __int16 z, int w) |
1295 | 5032 { |
5033 _viewport_space_y = y; | |
5034 _viewport_space_w = w; | |
5035 | |
5036 for (uint i = 0; i < 480; ++i) | |
5037 { | |
5038 if ( i < y || i > w ) | |
5039 { | |
5040 viewport_left_side[i] = 640; | |
5041 viewport_right_side[i] = -1; | |
5042 } | |
5043 else | |
5044 { | |
5045 viewport_left_side[i] = x; | |
5046 viewport_right_side[i] = z; | |
5047 } | |
5048 } | |
5049 } | |
5050 //----- (0048653D) -------------------------------------------------------- | |
1544 | 5051 void stru149::_48653D_frustum_blv(int a2, int a3, int a4, int a5, int a6, int a7)//portal frustum culling |
1295 | 5052 { |
1544 | 5053 //stru149 *v7; // esi@1 |
1295 | 5054 int v8; // edi@1 |
5055 int v9; // eax@1 | |
5056 //int v10; // edx@1 | |
5057 //int v11; // ecx@1 | |
1544 | 5058 //int v12; // eax@1 |
5059 //int v13; // ebx@2 | |
5060 //int v14; // ecx@2 | |
5061 //int v15; // eax@2 | |
1295 | 5062 int v16; // ST14_4@3 |
5063 int v17; // ST10_4@3 | |
1544 | 5064 //int v18; // eax@5 |
1295 | 5065 int v19; // ST10_4@6 |
1544 | 5066 //int v20; // eax@8 |
1295 | 5067 int v21; // ST10_4@9 |
1544 | 5068 //int v22; // eax@10 |
5069 //int v23; // ecx@10 | |
5070 //int v24; // eax@10 | |
5071 //int result; // eax@10 | |
1295 | 5072 //int v26; // [sp+14h] [bp-14h]@1 |
1544 | 5073 //int v27; // [sp+18h] [bp-10h]@1 |
1295 | 5074 int v28; // [sp+1Ch] [bp-Ch]@1 |
5075 int v29; // [sp+24h] [bp-4h]@1 | |
1544 | 5076 //int v30; // [sp+30h] [bp+8h]@10 |
5077 //int v31; // [sp+3Ch] [bp+14h]@10 | |
5078 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5079 v8 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5080 v29 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5081 v28 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5082 v9 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); |
1295 | 5083 //v11 = -pBLVRenderParams->vPartyPos.y; |
5084 //v26 = -pBLVRenderParams->vPartyPos.x; | |
1544 | 5085 //v27 = v9; |
5086 //v12 = -pBLVRenderParams->vPartyPos.z; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5087 if (pGame->pIndoorCameraD3D->sRotationX) |
1295 | 5088 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5089 v16 = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5090 v17 = -65536 * pGame->pIndoorCameraD3D->vPartyPos.z; |
1643 | 5091 this->field_0_party_dir_x = fixpoint_mul(v16, v28) + fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v9); |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5092 this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x; |
1643 | 5093 this->field_8_party_dir_z = fixpoint_mul(v17, v28) - fixpoint_mul(v16, v9); |
1295 | 5094 } |
5095 else | |
5096 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5097 this->field_0_party_dir_x = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5098 this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5099 this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
1295 | 5100 } |
1544 | 5101 |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5102 if (pGame->pIndoorCameraD3D->sRotationX) |
1295 | 5103 { |
1643 | 5104 v19 = fixpoint_mul(a2, v8) + fixpoint_mul(a3, v29); |
5105 | |
1809 | 5106 this->angle_from_north = fixpoint_mul(v19, v28) + fixpoint_mul(a4, v9); |
5107 this->angle_from_west = fixpoint_mul(a3, v8) - fixpoint_mul(a2, v29); | |
1844 | 5108 this->viewing_angle_from_west_east = fixpoint_mul(a4, v28) - fixpoint_mul(v19, v9); |
1295 | 5109 } |
5110 else | |
5111 { | |
1809 | 5112 this->angle_from_north = fixpoint_mul(a2, v8) + fixpoint_mul(a3, v29); |
5113 this->angle_from_west = fixpoint_mul(a3, v8) - fixpoint_mul(a2, v29); | |
1844 | 5114 this->viewing_angle_from_west_east = a4; |
1295 | 5115 } |
1544 | 5116 |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
5117 if (pGame->pIndoorCameraD3D->sRotationX) |
1295 | 5118 { |
1643 | 5119 v21 = fixpoint_mul(a5, v8) + fixpoint_mul(a6, v29); |
5120 | |
1809 | 5121 this->angle_from_east = fixpoint_mul(v21, v28) + fixpoint_mul(a7, v9); |
5122 this->angle_from_south = fixpoint_mul(a6, v8) - fixpoint_mul(a5, v29); | |
1844 | 5123 this->viewing_angle_from_north_south = fixpoint_mul(a7, v28) - fixpoint_mul(v21, v9); |
1295 | 5124 } |
5125 else | |
5126 { | |
1809 | 5127 this->angle_from_east = fixpoint_mul(a5, v8) + fixpoint_mul(a6, v29); |
5128 this->angle_from_south = fixpoint_mul(a6, v8) - fixpoint_mul(a5, v29); | |
1844 | 5129 this->viewing_angle_from_north_south = a7; |
1295 | 5130 } |
1544 | 5131 |
1809 | 5132 this->angle_from_east = -this->angle_from_east; |
5133 this->angle_from_south = -this->angle_from_south; | |
1844 | 5134 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south; |
1544 | 5135 |
1809 | 5136 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x, |
5137 this->angle_from_west, this->field_4_party_dir_y, | |
1844 | 5138 this->viewing_angle_from_west_east, this->field_8_party_dir_z); |
1809 | 5139 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x, |
5140 this->angle_from_south, this->field_4_party_dir_y, | |
1844 | 5141 this->viewing_angle_from_north_south, this->field_8_party_dir_z); |
1297 | 5142 } |
5143 //----- (00407A1C) -------------------------------------------------------- | |
5144 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) | |
5145 { | |
5146 unsigned int v4; // esi@1 | |
5147 Vec3_int_ v5; // ST08_12@2 | |
5148 int v6; // edi@2 | |
5149 int v7; // ebx@2 | |
5150 int v8; // esi@2 | |
5151 signed int v9; // ecx@2 | |
5152 int v10; // eax@2 | |
5153 int v11; // ecx@4 | |
5154 int v12; // eax@4 | |
5155 int v13; // ebx@4 | |
5156 int v14; // edx@6 | |
5157 char *v15; // edi@16 | |
5158 ODMFace *v16; // esi@19 | |
5159 int v17; // ST34_4@25 | |
5160 int v18; // ST38_4@25 | |
5161 int v19; // eax@25 | |
5162 char v20; // zf@25 | |
5163 int v21; // ebx@25 | |
5164 int v22; // eax@26 | |
5165 signed int v23; // edi@26 | |
5166 int v24; // ST34_4@30 | |
1556 | 5167 //signed __int64 v25; // qtt@31 |
5168 //int v26; // eax@31 | |
1297 | 5169 Vec3_int_ v27; // ST08_12@37 |
5170 Vec3_int_ v28; // ST08_12@37 | |
5171 int v29; // edi@37 | |
5172 int v30; // ebx@37 | |
5173 int v31; // esi@37 | |
5174 signed int v32; // ecx@37 | |
5175 int v33; // eax@37 | |
5176 int v34; // ecx@39 | |
5177 int v35; // eax@39 | |
5178 int v36; // ebx@39 | |
5179 int v37; // edx@41 | |
5180 char *v38; // edi@51 | |
5181 ODMFace *v39; // esi@54 | |
5182 int v40; // ebx@60 | |
5183 int v41; // eax@61 | |
5184 signed int v42; // edi@61 | |
1556 | 5185 //signed __int64 v43; // qtt@66 |
5186 //int v44; // eax@66 | |
1297 | 5187 Vec3_int_ v45; // ST08_12@73 |
5188 int v46; // edi@73 | |
5189 int v47; // ebx@73 | |
5190 int v48; // esi@73 | |
5191 signed int v49; // ecx@73 | |
5192 int v50; // eax@73 | |
5193 int v51; // edx@75 | |
5194 int v52; // ecx@75 | |
5195 int v53; // eax@75 | |
5196 int v54; // ebx@75 | |
5197 int v55; // edi@77 | |
5198 int v56; // ecx@77 | |
5199 int v57; // eax@81 | |
5200 int v58; // esi@81 | |
5201 int v59; // eax@90 | |
5202 BLVSector *v60; // edx@90 | |
5203 int v61; // ecx@90 | |
5204 BLVFace *v62; // esi@91 | |
5205 int v63; // ST34_4@98 | |
5206 int v64; // ST30_4@98 | |
5207 int v65; // eax@98 | |
5208 int v66; // ebx@98 | |
5209 int v67; // eax@99 | |
5210 signed int v68; // edi@99 | |
5211 int v69; // ST2C_4@103 | |
1556 | 5212 //signed __int64 v70; // qtt@104 |
5213 //int v71; // eax@104 | |
1297 | 5214 Vec3_int_ v72; // ST08_12@111 |
5215 Vec3_int_ v73; // ST08_12@111 | |
5216 int v74; // edi@111 | |
5217 int v75; // ebx@111 | |
5218 int v76; // esi@111 | |
5219 signed int v77; // ecx@111 | |
5220 int v78; // eax@111 | |
5221 int v79; // edx@113 | |
5222 int v80; // ecx@113 | |
5223 int v81; // eax@113 | |
5224 int v82; // ebx@113 | |
5225 int v83; // edi@115 | |
5226 int v84; // ecx@115 | |
5227 int v85; // eax@119 | |
5228 int v86; // esi@119 | |
5229 int v87; // ecx@128 | |
5230 BLVSector *v88; // eax@128 | |
5231 int v89; // ecx@128 | |
5232 BLVFace *v90; // esi@129 | |
5233 int v91; // ebx@136 | |
5234 int v92; // eax@137 | |
5235 signed int v93; // edi@137 | |
1556 | 5236 //signed __int64 v94; // qtt@142 |
5237 //int v95; // eax@142 | |
1297 | 5238 Vec3_int_ v97; // [sp-18h] [bp-94h]@1 |
5239 int v98; // [sp-Ch] [bp-88h]@88 | |
5240 int v99; // [sp-Ch] [bp-88h]@126 | |
5241 int v100; // [sp-8h] [bp-84h]@88 | |
5242 int v101; // [sp-8h] [bp-84h]@126 | |
5243 int v102; // [sp-4h] [bp-80h]@88 | |
5244 int v103; // [sp-4h] [bp-80h]@126 | |
5245 int v104; // [sp+Ch] [bp-70h]@13 | |
5246 int v105; // [sp+Ch] [bp-70h]@48 | |
5247 int v106; // [sp+10h] [bp-6Ch]@18 | |
5248 int v107; // [sp+10h] [bp-6Ch]@98 | |
5249 int v108; // [sp+10h] [bp-6Ch]@104 | |
5250 int v109; // [sp+18h] [bp-64h]@25 | |
5251 int v110; // [sp+18h] [bp-64h]@31 | |
5252 int i; // [sp+18h] [bp-64h]@90 | |
5253 int v112; // [sp+18h] [bp-64h]@128 | |
5254 signed int v113; // [sp+20h] [bp-5Ch]@1 | |
5255 signed int v114; // [sp+24h] [bp-58h]@1 | |
1544 | 5256 //unsigned __int64 a4; // [sp+28h] [bp-54h]@1 |
1297 | 5257 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 |
5258 int v117; // [sp+34h] [bp-48h]@4 | |
5259 int v118; // [sp+34h] [bp-48h]@39 | |
5260 int v119; // [sp+34h] [bp-48h]@75 | |
5261 int v120; // [sp+34h] [bp-48h]@113 | |
5262 int v121; // [sp+38h] [bp-44h]@4 | |
5263 int v122; // [sp+38h] [bp-44h]@39 | |
5264 int v123; // [sp+38h] [bp-44h]@76 | |
5265 int v124; // [sp+38h] [bp-44h]@114 | |
5266 int v125; // [sp+3Ch] [bp-40h]@4 | |
5267 int v126; // [sp+3Ch] [bp-40h]@39 | |
5268 int v127; // [sp+3Ch] [bp-40h]@77 | |
5269 int v128; // [sp+3Ch] [bp-40h]@115 | |
5270 int v129; // [sp+40h] [bp-3Ch]@11 | |
5271 int v130; // [sp+40h] [bp-3Ch]@46 | |
5272 int v131; // [sp+40h] [bp-3Ch]@78 | |
5273 int v132; // [sp+40h] [bp-3Ch]@116 | |
5274 int v133; // [sp+44h] [bp-38h]@10 | |
5275 int v134; // [sp+44h] [bp-38h]@45 | |
5276 int v135; // [sp+44h] [bp-38h]@81 | |
5277 int v136; // [sp+44h] [bp-38h]@119 | |
5278 int v137; // [sp+48h] [bp-34h]@7 | |
5279 int v138; // [sp+48h] [bp-34h]@42 | |
5280 int v139; // [sp+48h] [bp-34h]@82 | |
5281 int v140; // [sp+48h] [bp-34h]@120 | |
5282 int v141; // [sp+4Ch] [bp-30h]@6 | |
5283 int v142; // [sp+4Ch] [bp-30h]@41 | |
5284 int v143; // [sp+4Ch] [bp-30h]@75 | |
5285 int v144; // [sp+4Ch] [bp-30h]@113 | |
5286 int v145; // [sp+50h] [bp-2Ch]@5 | |
5287 int v146; // [sp+50h] [bp-2Ch]@40 | |
5288 int v147; // [sp+50h] [bp-2Ch]@75 | |
5289 int v148; // [sp+50h] [bp-2Ch]@113 | |
5290 int v149; // [sp+54h] [bp-28h]@4 | |
5291 int v150; // [sp+54h] [bp-28h]@39 | |
5292 int v151; // [sp+54h] [bp-28h]@75 | |
5293 int v152; // [sp+54h] [bp-28h]@113 | |
5294 int sDepth; // [sp+58h] [bp-24h]@17 | |
5295 int sDeptha; // [sp+58h] [bp-24h]@52 | |
5296 int sDepthb; // [sp+58h] [bp-24h]@90 | |
5297 char *a5; // [sp+5Ch] [bp-20h]@16 | |
5298 char *a5a; // [sp+5Ch] [bp-20h]@51 | |
5299 signed int a5b; // [sp+5Ch] [bp-20h]@83 | |
5300 signed int a5c; // [sp+5Ch] [bp-20h]@121 | |
5301 signed int v160; // [sp+60h] [bp-1Ch]@12 | |
5302 signed int v161; // [sp+60h] [bp-1Ch]@47 | |
5303 int v162; // [sp+60h] [bp-1Ch]@128 | |
5304 int v163; // [sp+64h] [bp-18h]@2 | |
5305 int outx; // [sp+68h] [bp-14h]@2 | |
5306 int outy; // [sp+6Ch] [bp-10h]@2 | |
5307 int outz; // [sp+70h] [bp-Ch]@2 | |
5308 Vec3_int_ pOut; // [sp+74h] [bp-8h]@2 | |
5309 int ya; // [sp+84h] [bp+8h]@60 | |
5310 int yb; // [sp+84h] [bp+8h]@136 | |
5311 int ve; // [sp+88h] [bp+Ch]@60 | |
5312 int va; // [sp+88h] [bp+Ch]@60 | |
5313 int vb; // [sp+88h] [bp+Ch]@66 | |
5314 int vf; // [sp+88h] [bp+Ch]@136 | |
5315 int vc; // [sp+88h] [bp+Ch]@136 | |
5316 int vd; // [sp+88h] [bp+Ch]@142 | |
5317 int v_4; // [sp+8Ch] [bp+10h]@60 | |
5318 int v_4a; // [sp+8Ch] [bp+10h]@65 | |
5319 int v_4b; // [sp+8Ch] [bp+10h]@136 | |
5320 int v_4c; // [sp+8Ch] [bp+10h]@141 | |
5321 int v_8; // [sp+90h] [bp+14h]@53 | |
5322 | |
1705 | 5323 //__debugbreak(); |
1458 | 5324 |
1297 | 5325 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); |
5326 v114 = 0; | |
5327 v97.z = y; | |
1544 | 5328 v97.x = x; |
5329 v97.y = z; | |
1297 | 5330 v113 = 0; |
5331 a4_8 = v4; | |
5332 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
5333 { | |
5334 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
5335 v45.z = v.z; | |
1556 | 5336 v45.x = v.x; |
5337 v45.y = v.y; | |
1297 | 5338 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163); |
5339 v46 = outy - pOut.y; | |
5340 v47 = v163 - outz; | |
5341 v48 = outx - pOut.x; | |
5342 v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47); | |
5343 v50 = 65536; | |
5344 if ( v49 ) | |
5345 v50 = 65536 / v49; | |
5346 v51 = outx; | |
5347 v143 = v48 * v50; | |
5348 v52 = v46 * v50; | |
5349 v53 = v47 * v50; | |
5350 v54 = pOut.x; | |
5351 v147 = v52; | |
5352 v151 = v53; | |
5353 v119 = pOut.x; | |
5354 if ( pOut.x < outx ) | |
5355 { | |
5356 v123 = outx; | |
5357 } | |
5358 else | |
5359 { | |
5360 v119 = outx; | |
5361 v123 = pOut.x; | |
5362 } | |
5363 v55 = pOut.y; | |
5364 v56 = outy; | |
5365 v127 = pOut.y; | |
5366 if ( pOut.y < outy ) | |
5367 { | |
5368 v131 = outy; | |
5369 } | |
5370 else | |
5371 { | |
5372 v127 = outy; | |
5373 v131 = pOut.y; | |
5374 } | |
5375 v57 = v163; | |
5376 v58 = outz; | |
5377 v135 = outz; | |
5378 if ( outz < v163 ) | |
5379 { | |
5380 v139 = v163; | |
5381 } | |
5382 else | |
5383 { | |
5384 v135 = v163; | |
5385 v139 = outz; | |
5386 } | |
5387 a5b = 0; | |
5388 while ( !v114 ) | |
5389 { | |
5390 if ( a5b ) | |
5391 { | |
5392 v102 = v58; | |
5393 v100 = v55; | |
5394 v98 = v54; | |
5395 } | |
5396 else | |
5397 { | |
5398 v102 = v57; | |
5399 v100 = v56; | |
5400 v98 = v51; | |
5401 } | |
5402 v59 = pIndoor->GetSector(v98, v100, v102); | |
5403 v60 = pIndoor->pSectors; | |
5404 v61 = 116 * v59; | |
5405 sDepthb = 0; | |
5406 for ( i = 116 * v59; | |
5407 sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61) | |
5408 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); | |
5409 ++sDepthb ) | |
5410 { | |
5411 v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; | |
5412 if ( v62->Portal() | |
5413 || v119 > v62->pBounding.x2 | |
5414 || v123 < v62->pBounding.x1 | |
5415 || v127 > v62->pBounding.y2 | |
5416 || v131 < v62->pBounding.y1 | |
5417 || v135 > v62->pBounding.z2 | |
5418 || v139 < v62->pBounding.z1 | |
5419 || (v63 = (unsigned __int64)(v143 * (signed __int64)v62->pFacePlane_old.vNormal.x) >> 16, | |
5420 v64 = (unsigned __int64)(v151 * (signed __int64)v62->pFacePlane_old.vNormal.z) >> 16, | |
5421 v65 = (unsigned __int64)(v147 * (signed __int64)v62->pFacePlane_old.vNormal.y) >> 16, | |
5422 v20 = v63 + v64 + v65 == 0, | |
5423 v66 = v63 + v64 + v65, | |
5424 v107 = v63 + v64 + v65, | |
5425 v20) ) | |
5426 goto LABEL_107; | |
5427 v67 = outz * v62->pFacePlane_old.vNormal.z; | |
5428 v68 = -(v62->pFacePlane_old.dist | |
5429 + v67 | |
5430 + pOut.y * v62->pFacePlane_old.vNormal.y | |
5431 + pOut.x * v62->pFacePlane_old.vNormal.x); | |
5432 if ( v66 <= 0 ) | |
5433 { | |
5434 if ( v62->pFacePlane_old.dist | |
5435 + v67 | |
5436 + pOut.y * v62->pFacePlane_old.vNormal.y | |
5437 + pOut.x * v62->pFacePlane_old.vNormal.x < 0 ) | |
5438 goto LABEL_107; | |
5439 } | |
5440 else | |
5441 { | |
5442 if ( v62->pFacePlane_old.dist | |
5443 + v67 | |
5444 + pOut.y * v62->pFacePlane_old.vNormal.y | |
5445 + pOut.x * v62->pFacePlane_old.vNormal.x > 0 ) | |
5446 goto LABEL_107; | |
5447 } | |
5448 v69 = abs(-(v62->pFacePlane_old.dist | |
5449 + v67 | |
5450 + pOut.y * v62->pFacePlane_old.vNormal.y | |
5451 + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14; | |
5452 if ( v69 <= abs(v66) ) | |
5453 { | |
1556 | 5454 //LODWORD(v70) = v68 << 16; |
5455 //HIDWORD(v70) = v68 >> 16; | |
5456 //v71 = v70 / v107; | |
5457 //v108 = v70 / v107; | |
5458 v108 = fixpoint_div(v68, v107); | |
5459 if ( v108 >= 0 ) | |
1297 | 5460 { |
5461 if ( sub_4075DB( | |
1643 | 5462 pOut.x + ((signed int)(fixpoint_mul(v108, v143) + 32768) >> 16), |
5463 pOut.y + ((signed int)(fixpoint_mul(v108, v147) + 32768) >> 16), | |
5464 outz + ((signed int)(fixpoint_mul(v108, v151) + 32768) >> 16), | |
1297 | 5465 v62) ) |
5466 { | |
5467 v114 = 1; | |
5468 break; | |
5469 } | |
5470 } | |
5471 } | |
5472 v61 = i; | |
5473 LABEL_107: | |
5474 v60 = pIndoor->pSectors; | |
5475 } | |
5476 ++a5b; | |
5477 if ( a5b >= 2 ) | |
5478 break; | |
5479 v57 = v163; | |
5480 v56 = outy; | |
5481 v51 = outx; | |
5482 v58 = outz; | |
5483 v55 = pOut.y; | |
5484 v54 = pOut.x; | |
5485 } | |
5486 v72.z = y; | |
1544 | 5487 v72.x = x; |
5488 v72.y = z; | |
1297 | 5489 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); |
5490 v73.z = v.z; | |
1544 | 5491 v73.x = v.x; |
5492 v73.y = v.y; | |
1297 | 5493 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); |
5494 v74 = outy - pOut.y; | |
5495 v75 = v163 - outz; | |
5496 v76 = outx - pOut.x; | |
5497 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); | |
5498 v78 = 65536; | |
5499 if ( v77 ) | |
5500 v78 = 65536 / v77; | |
5501 v79 = outx; | |
5502 v144 = v76 * v78; | |
5503 v80 = v74 * v78; | |
5504 v81 = v75 * v78; | |
5505 v82 = pOut.x; | |
5506 v148 = v80; | |
5507 v152 = v81; | |
5508 v120 = pOut.x; | |
5509 if ( pOut.x < outx ) | |
5510 { | |
5511 v124 = outx; | |
5512 } | |
5513 else | |
5514 { | |
5515 v120 = outx; | |
5516 v124 = pOut.x; | |
5517 } | |
5518 v83 = pOut.y; | |
5519 v84 = outy; | |
5520 v128 = pOut.y; | |
5521 if ( pOut.y < outy ) | |
5522 { | |
5523 v132 = outy; | |
5524 } | |
5525 else | |
5526 { | |
5527 v128 = outy; | |
5528 v132 = pOut.y; | |
5529 } | |
5530 v85 = v163; | |
5531 v86 = outz; | |
5532 v136 = outz; | |
5533 if ( outz < v163 ) | |
5534 { | |
5535 v140 = v163; | |
5536 } | |
5537 else | |
5538 { | |
5539 v136 = v163; | |
5540 v140 = outz; | |
5541 } | |
5542 a5c = 0; | |
5543 while ( 1 ) | |
5544 { | |
5545 if ( v113 ) | |
5546 return !v114 || !v113; | |
5547 if ( a5c ) | |
5548 { | |
5549 v103 = v86; | |
5550 v101 = v83; | |
5551 v99 = v82; | |
5552 } | |
5553 else | |
5554 { | |
5555 v103 = v85; | |
5556 v101 = v84; | |
5557 v99 = v79; | |
5558 } | |
5559 v87 = pIndoor->GetSector(v99, v101, v103); | |
5560 v88 = pIndoor->pSectors; | |
5561 v89 = 116 * v87; | |
5562 v162 = 0; | |
5563 v112 = v89; | |
5564 if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) | |
5565 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) | |
5566 break; | |
5567 LABEL_148: | |
5568 ++a5c; | |
5569 if ( a5c >= 2 ) | |
5570 return !v114 || !v113; | |
5571 v85 = v163; | |
5572 v84 = outy; | |
5573 v79 = outx; | |
5574 v86 = outz; | |
5575 v83 = pOut.y; | |
5576 v82 = pOut.x; | |
5577 } | |
5578 while ( 1 ) | |
5579 { | |
5580 v90 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]]; | |
5581 if ( v90->Portal() | |
5582 || v120 > v90->pBounding.x2 | |
5583 || v124 < v90->pBounding.x1 | |
5584 || v128 > v90->pBounding.y2 | |
5585 || v132 < v90->pBounding.y1 | |
5586 || v136 > v90->pBounding.z2 | |
5587 || v140 < v90->pBounding.z1 | |
1643 | 5588 || (yb = fixpoint_mul(v144, v90->pFacePlane_old.vNormal.x), |
5589 v_4b = fixpoint_mul(v148, v90->pFacePlane_old.vNormal.y), | |
5590 vf = fixpoint_mul(v152, v90->pFacePlane_old.vNormal.z), | |
1297 | 5591 v20 = yb + vf + v_4b == 0, |
5592 v91 = yb + vf + v_4b, | |
5593 vc = yb + vf + v_4b, | |
5594 v20) ) | |
5595 goto LABEL_145; | |
5596 v92 = outz * v90->pFacePlane_old.vNormal.z; | |
5597 v93 = -(v90->pFacePlane_old.dist | |
5598 + v92 | |
5599 + pOut.y * v90->pFacePlane_old.vNormal.y | |
5600 + pOut.x * v90->pFacePlane_old.vNormal.x); | |
5601 if ( v91 <= 0 ) | |
5602 { | |
5603 if ( v90->pFacePlane_old.dist | |
5604 + v92 | |
5605 + pOut.y * v90->pFacePlane_old.vNormal.y | |
5606 + pOut.x * v90->pFacePlane_old.vNormal.x < 0 ) | |
5607 goto LABEL_145; | |
5608 } | |
5609 else | |
5610 { | |
5611 if ( v90->pFacePlane_old.dist | |
5612 + v92 | |
5613 + pOut.y * v90->pFacePlane_old.vNormal.y | |
5614 + pOut.x * v90->pFacePlane_old.vNormal.x > 0 ) | |
5615 goto LABEL_145; | |
5616 } | |
5617 v_4c = abs(-(v90->pFacePlane_old.dist | |
5618 + v92 | |
5619 + pOut.y * v90->pFacePlane_old.vNormal.y | |
5620 + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14; | |
5621 if ( v_4c <= abs(v91) ) | |
5622 { | |
1556 | 5623 //LODWORD(v94) = v93 << 16; |
5624 //HIDWORD(v94) = v93 >> 16; | |
5625 //v95 = v94 / vc; | |
5626 //vd = v94 / vc; | |
5627 vd = fixpoint_div(v93, vc); | |
5628 if ( vd >= 0 ) | |
1297 | 5629 { |
5630 if ( sub_4075DB( | |
1643 | 5631 pOut.x + ((signed int)(fixpoint_mul(vd, v144) + 32768) >> 16), |
5632 pOut.y + ((signed int)(fixpoint_mul(vd, v148) + 32768) >> 16), | |
5633 outz + ((signed int)(fixpoint_mul(vd, v152) + 32768) >> 16), | |
1297 | 5634 v90) ) |
5635 { | |
5636 v113 = 1; | |
5637 goto LABEL_148; | |
5638 } | |
5639 } | |
5640 } | |
5641 v89 = v112; | |
5642 LABEL_145: | |
5643 v88 = pIndoor->pSectors; | |
5644 ++v162; | |
5645 if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) | |
5646 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) | |
5647 goto LABEL_148; | |
5648 } | |
5649 } | |
5650 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
5651 v5.z = v.z; | |
1556 | 5652 v5.x = v.x; |
5653 v5.y = v.y; | |
1297 | 5654 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163); |
5655 v6 = outy - pOut.y; | |
5656 v7 = v163 - outz; | |
5657 v8 = outx - pOut.x; | |
5658 v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7); | |
5659 v10 = 65536; | |
5660 if ( v9 ) | |
5661 v10 = 65536 / v9; | |
5662 v125 = v8 * v10; | |
5663 v11 = v10; | |
5664 v12 = v7 * v10; | |
5665 v13 = pOut.x; | |
5666 v117 = v12; | |
5667 v121 = v6 * v11; | |
5668 v149 = pOut.x; | |
5669 if ( pOut.x < outx ) | |
5670 { | |
5671 v145 = outx; | |
5672 } | |
5673 else | |
5674 { | |
5675 v149 = outx; | |
5676 v145 = pOut.x; | |
5677 } | |
5678 v14 = outy; | |
5679 v141 = pOut.y; | |
5680 if ( pOut.y < outy ) | |
5681 { | |
5682 v137 = outy; | |
5683 } | |
5684 else | |
5685 { | |
5686 v141 = outy; | |
5687 v137 = pOut.y; | |
5688 } | |
5689 v133 = outz; | |
5690 if ( outz < v163 ) | |
5691 { | |
5692 v129 = v163; | |
5693 } | |
5694 else | |
5695 { | |
5696 v133 = v163; | |
5697 v129 = outz; | |
5698 } | |
5699 v160 = 0; | |
5700 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
5701 { | |
5702 v104 = 0; | |
5703 while ( 1 ) | |
5704 { | |
5705 v15 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
5706 a5 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
5707 if ( sub_4088E9(v13, pOut.y, outx, v14, pOutdoor->pBModels[v104].vPosition.x, pOutdoor->pBModels[v104].vPosition.y) <= pOutdoor->pBModels[v104].sBoundingRadius + 128 ) | |
5708 { | |
5709 sDepth = 0; | |
5710 if ( *((int *)v15 + 2) > 0 ) | |
5711 break; | |
5712 } | |
5713 LABEL_36: | |
5714 ++v160; | |
5715 ++v104; | |
5716 if ( v160 >= (signed int)pOutdoor->uNumBModels ) | |
5717 goto LABEL_37; | |
5718 v14 = outy; | |
5719 v13 = pOut.x; | |
5720 } | |
5721 v106 = 0; | |
5722 while ( 1 ) | |
5723 { | |
5724 v16 = (ODMFace *)(v106 + *((int *)a5 + 4)); | |
5725 if ( v149 > v16->pBoundingBox.x2 | |
5726 || v145 < v16->pBoundingBox.x1 | |
5727 || v141 > v16->pBoundingBox.y2 | |
5728 || v137 < v16->pBoundingBox.y1 | |
5729 || v133 > v16->pBoundingBox.z2 | |
5730 || v129 < v16->pBoundingBox.z1 | |
1643 | 5731 || (v17 = fixpoint_mul(v125, v16->pFacePlane.vNormal.x), |
5732 v18 = fixpoint_mul(v121, v16->pFacePlane.vNormal.y), | |
5733 v19 = fixpoint_mul(v117, v16->pFacePlane.vNormal.z), | |
1297 | 5734 v20 = v17 + v18 + v19 == 0, |
5735 v21 = v17 + v18 + v19, | |
5736 v109 = v17 + v18 + v19, | |
5737 v20) ) | |
5738 goto LABEL_33; | |
5739 v22 = pOut.y * v16->pFacePlane.vNormal.y; | |
5740 v23 = -(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x); | |
5741 if ( v21 <= 0 ) | |
5742 { | |
5743 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x < 0 ) | |
5744 goto LABEL_33; | |
5745 } | |
5746 else | |
5747 { | |
5748 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x > 0 ) | |
5749 goto LABEL_33; | |
5750 } | |
5751 v24 = abs(-(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x)) >> 14; | |
5752 if ( v24 <= abs(v21) ) | |
5753 { | |
1556 | 5754 //LODWORD(v25) = v23 << 16; |
5755 //HIDWORD(v25) = v23 >> 16; | |
5756 //v26 = v25 / v109; | |
5757 //v110 = v25 / v109; | |
5758 v110 = fixpoint_div(v23, v109); | |
5759 if ( v110 >= 0 ) | |
1297 | 5760 { |
5761 if ( sub_4077F1( | |
1643 | 5762 pOut.x + ((signed int)(fixpoint_mul(v110, v125) + 32768) >> 16), |
5763 pOut.y + ((signed int)(fixpoint_mul(v110, v121) + 32768) >> 16), | |
5764 outz + ((signed int)(fixpoint_mul(v110, v117) + 32768) >> 16), | |
1297 | 5765 v16, |
5766 (BSPVertexBuffer *)a5) ) | |
5767 { | |
5768 v114 = 1; | |
5769 goto LABEL_36; | |
5770 } | |
5771 } | |
5772 } | |
5773 LABEL_33: | |
5774 ++sDepth; | |
5775 v106 += 308; | |
5776 if ( sDepth >= *((int *)a5 + 2) ) | |
5777 goto LABEL_36; | |
5778 } | |
5779 } | |
5780 LABEL_37: | |
5781 v27.z = y; | |
1544 | 5782 v27.x = x; |
5783 v27.y = z; | |
1297 | 5784 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); |
5785 v28.z = v.z; | |
1544 | 5786 v28.x = v.x; |
5787 v28.y = v.y; | |
1297 | 5788 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); |
5789 v29 = outy - pOut.y; | |
5790 v30 = v163 - outz; | |
5791 v31 = outx - pOut.x; | |
5792 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); | |
5793 v33 = 65536; | |
5794 if ( v32 ) | |
5795 v33 = 65536 / v32; | |
5796 v126 = v31 * v33; | |
5797 v34 = v33; | |
5798 v35 = v30 * v33; | |
5799 v36 = pOut.x; | |
5800 v118 = v35; | |
5801 v122 = v29 * v34; | |
5802 v150 = pOut.x; | |
5803 if ( pOut.x < outx ) | |
5804 { | |
5805 v146 = outx; | |
5806 } | |
5807 else | |
5808 { | |
5809 v150 = outx; | |
5810 v146 = pOut.x; | |
5811 } | |
5812 v37 = outy; | |
5813 v142 = pOut.y; | |
5814 if ( pOut.y < outy ) | |
5815 { | |
5816 v138 = outy; | |
5817 } | |
5818 else | |
5819 { | |
5820 v142 = outy; | |
5821 v138 = pOut.y; | |
5822 } | |
5823 v134 = outz; | |
5824 if ( outz < v163 ) | |
5825 { | |
5826 v130 = v163; | |
5827 } | |
5828 else | |
5829 { | |
5830 v134 = v163; | |
5831 v130 = outz; | |
5832 } | |
5833 v161 = 0; | |
5834 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
5835 { | |
5836 v105 = 0; | |
5837 while ( 1 ) | |
5838 { | |
5839 v38 = (char *)&pOutdoor->pBModels[v105].pVertices; | |
5840 a5a = (char *)&pOutdoor->pBModels[v105].pVertices; | |
5841 if ( sub_4088E9(v36, pOut.y, outx, v37, pOutdoor->pBModels[v105].vPosition.x, pOutdoor->pBModels[v105].vPosition.y) <= pOutdoor->pBModels[v105].sBoundingRadius + 128 ) | |
5842 { | |
5843 sDeptha = 0; | |
5844 if ( *((int *)v38 + 2) > 0 ) | |
5845 break; | |
5846 } | |
5847 LABEL_71: | |
5848 ++v161; | |
5849 ++v105; | |
5850 if ( v161 >= (signed int)pOutdoor->uNumBModels ) | |
5851 return !v114 || !v113; | |
5852 v37 = outy; | |
5853 v36 = pOut.x; | |
5854 } | |
5855 v_8 = 0; | |
5856 while ( 1 ) | |
5857 { | |
5858 v39 = (ODMFace *)(v_8 + *((int *)a5a + 4)); | |
5859 if ( v150 > v39->pBoundingBox.x2 | |
5860 || v146 < v39->pBoundingBox.x1 | |
5861 || v142 > v39->pBoundingBox.y2 | |
5862 || v138 < v39->pBoundingBox.y1 | |
5863 || v134 > v39->pBoundingBox.z2 | |
5864 || v130 < v39->pBoundingBox.z1 | |
1643 | 5865 || (ya = fixpoint_mul(v126, v39->pFacePlane.vNormal.x), |
5866 ve = fixpoint_mul(v122, v39->pFacePlane.vNormal.y), | |
5867 v_4 = fixpoint_mul(v118, v39->pFacePlane.vNormal.z), | |
1297 | 5868 v20 = ya + ve + v_4 == 0, |
5869 v40 = ya + ve + v_4, | |
5870 va = ya + ve + v_4, | |
5871 v20) ) | |
5872 goto LABEL_68; | |
5873 v41 = pOut.y * v39->pFacePlane.vNormal.y; | |
5874 v42 = -(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x); | |
5875 if ( v40 <= 0 ) | |
5876 { | |
5877 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x < 0 ) | |
5878 goto LABEL_68; | |
5879 } | |
5880 else | |
5881 { | |
5882 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x > 0 ) | |
5883 goto LABEL_68; | |
5884 } | |
5885 v_4a = abs(-(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x)) >> 14; | |
5886 if ( v_4a <= abs(v40) ) | |
5887 { | |
1556 | 5888 //LODWORD(v43) = v42 << 16; |
5889 //HIDWORD(v43) = v42 >> 16; | |
5890 //vb = v43 / va; | |
5891 vb = fixpoint_div(v42, va); | |
5892 if ( vb >= 0 ) | |
1297 | 5893 { |
5894 if ( sub_4077F1( | |
1643 | 5895 pOut.x + ((signed int)(fixpoint_mul(vb, v126) + 32768) >> 16), |
5896 pOut.y + ((signed int)(fixpoint_mul(vb, v122) + 32768) >> 16), | |
5897 outz + ((signed int)(fixpoint_mul(vb, v118) + 32768) >> 16), | |
1297 | 5898 v39, |
5899 (BSPVertexBuffer *)a5a) ) | |
5900 { | |
5901 v113 = 1; | |
5902 goto LABEL_71; | |
5903 } | |
5904 } | |
5905 } | |
5906 LABEL_68: | |
5907 ++sDeptha; | |
5908 v_8 += 308; | |
5909 if ( sDeptha >= *((int *)a5a + 2) ) | |
5910 goto LABEL_71; | |
5911 } | |
5912 } | |
5913 return !v114 || !v113; | |
5914 } | |
5915 //----- (0043F333) -------------------------------------------------------- | |
5916 void BspRenderer::MakeVisibleSectorList() | |
5917 { | |
5918 int v6; // ebx@3 | |
5919 | |
5920 uNumVisibleNotEmptySectors = 0; | |
5921 for (uint i = 0; i < num_nodes; ++i) | |
5922 { | |
5923 if (!uNumVisibleNotEmptySectors) | |
5924 { | |
5925 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; | |
5926 continue; | |
5927 } | |
5928 | |
5929 v6 = 0; | |
5930 while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID ) | |
5931 { | |
5932 ++v6; | |
5933 if ( v6 >= uNumVisibleNotEmptySectors) | |
5934 { | |
5935 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; | |
5936 } | |
5937 } | |
5938 | |
5939 } | |
5940 } | |
5941 //----- (0046A334) -------------------------------------------------------- | |
5942 char __fastcall DoInteractionWithTopmostZObject(int a1, int a2) | |
5943 { | |
5944 int v2; // edx@1 | |
5945 BLVFace *v4; // eax@9 | |
5946 unsigned int v5; // ecx@9 | |
5947 unsigned __int16 v6; // ax@11 | |
5948 //ODMFace *v7; // eax@16 | |
5949 LevelDecoration *v8; // esi@19 | |
5950 __int16 v9; // ax@19 | |
5951 int v10; // eax@22 | |
5952 int v11; // ecx@22 | |
5953 int v12; // edi@23 | |
5954 Actor *v13; // esi@23 | |
5955 unsigned __int16 v14; // ax@23 | |
5956 unsigned __int16 v15; // ax@33 | |
5957 const char *v16; // eax@34 | |
5958 int v17; // edi@36 | |
5959 int v18; // eax@36 | |
5960 ItemGen *v19; // esi@39 | |
5961 unsigned int v20; // eax@39 | |
5962 int v21; // ecx@40 | |
5963 std::string v22; // [sp-18h] [bp-2Ch]@5 | |
5964 const char *v23; // [sp-8h] [bp-1Ch]@5 | |
5965 int v24; // [sp-4h] [bp-18h]@5 | |
5966 char v25; // [sp+8h] [bp-Ch]@5 | |
5967 int v26; // [sp+Ch] [bp-8h]@1 | |
5968 int a3; // [sp+13h] [bp-1h]@5 | |
5969 | |
5970 v26 = a2; | |
5971 v2 = a1; | |
5972 switch ( PID_TYPE(a1) ) | |
5973 { | |
5974 case OBJECT_Item: // take the item | |
5975 v17 = PID_ID(a1); | |
5976 v26 = PID_ID(a1); | |
5977 v18 = PID_ID(a1); | |
5978 if ( pObjectList->pObjects[pSpriteObjects[v18].uObjectDescID].uFlags & 0x10 | |
5979 || v17 >= 1000 | |
5980 || !pSpriteObjects[v18].uObjectDescID ) | |
5981 return 1; | |
5982 v19 = &pSpriteObjects[v18].stru_24; | |
5983 v20 = pSpriteObjects[v18].stru_24.uItemID; | |
5984 if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD) | |
5985 { | |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1809
diff
changeset
|
5986 pParty->PartyFindsGold(v19->uSpecEnchantmentType, 0); |
1297 | 5987 viewparams->bRedrawGameUI = 1; |
5988 v21 = v17; | |
5989 } | |
5990 else | |
5991 { | |
5992 if ( pParty->pPickedItem.uItemID ) | |
5993 return 1; | |
5994 v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName; | |
5995 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v24); | |
5996 ShowStatusBarString(pTmpBuf2.data(), 2u); | |
5997 if ( v19->uItemID == 506 ) | |
5998 _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u); | |
5999 if ( v19->uItemID == 455 ) | |
6000 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u); | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1546
diff
changeset
|
6001 if ( !pParty->AddItemToParty(v19) ) |
1297 | 6002 pParty->SetHoldingItem(v19); |
6003 v21 = v26; | |
6004 } | |
6005 SpriteObject::OnInteraction(v21); | |
6006 break; | |
6007 | |
6008 case OBJECT_Actor: | |
6009 v12 = PID_ID(a1); | |
6010 v13 = &pActors[PID_ID(a1)]; | |
6011 v14 = v13->uAIState; | |
6012 if ( v14 == 4 || v14 == 17 ) | |
6013 return 1; | |
6014 if ( v14 == 5 ) | |
6015 { | |
1966
7840fe323f67
stru319::LootActor(struct Actor *pActor) to Actor::LootActor
Grumpy7
parents:
1954
diff
changeset
|
6016 pActors[PID_ID(a1)].LootActor(); |
1297 | 6017 } |
6018 else | |
6019 { | |
6020 if ( !v13->GetActorsRelation(0) && !(BYTE2(v13->uAttributes) & 8) && v13->CanAct() ) | |
6021 { | |
6022 Actor::AI_FaceObject(v12, 4u, 0, 0); | |
6023 if ( v13->sNPC_ID ) | |
6024 { | |
6025 pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0); | |
6026 } | |
6027 else | |
6028 { | |
6029 v15 = pNPCStats->pGroups_copy[v13->uGroup]; | |
6030 if ( v15 ) | |
6031 { | |
6032 v16 = pNPCStats->pCatchPhrases[v15]; | |
6033 if ( v16 ) | |
6034 { | |
6035 pParty->uFlags |= 2u; | |
6036 strcpy(byte_5B0938.data(), v16); | |
6037 sub_4451A8_press_any_key(0, 0, 0); | |
6038 } | |
6039 } | |
6040 } | |
6041 } | |
6042 } | |
6043 break; | |
6044 | |
6045 case OBJECT_Decoration: | |
6046 v8 = &pLevelDecorations[PID_ID(a1)]; | |
1514
965af46e8793
Rename LevelDecoration::field_16_event_id to LevelDecoration::uEventID.
yoctozepto
parents:
1493
diff
changeset
|
6047 v9 = v8->uEventID; |
1297 | 6048 if ( v9 ) |
6049 { | |
6050 EventProcessor(v9, a1, 1); | |
1489 | 6051 v8->uFlags |= LEVEL_DECORATION_VISIBLE_ON_MAP; |
1297 | 6052 } |
6053 else | |
6054 { | |
6055 if ( !pLevelDecorations[PID_ID(a1)].IsInteractive() ) | |
6056 return 1; | |
6057 v10 = v8->_idx_in_stru123; | |
6058 v24 = 1; | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1705
diff
changeset
|
6059 v11 = stru_5E4C90_MapPersistVars._decor_events[v10 - 75] + 380; |
1297 | 6060 activeLevelDecoration = v8; |
6061 EventProcessor(v11, 0, 1); | |
6062 activeLevelDecoration = NULL; | |
6063 } | |
6064 break; | |
6065 | |
6066 default: | |
6067 MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0); | |
6068 return 1; | |
6069 | |
6070 case OBJECT_BModel: | |
6071 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
6072 { | |
6073 int bmodel_id = a1 >> 9, | |
6074 face_id = PID_ID(a1) & 0x3F; | |
6075 if (bmodel_id >= pOutdoor->uNumBModels) | |
6076 return 1; | |
1980 | 6077 ODMFace* face = &pOutdoor->pBModels[bmodel_id].pFaces[face_id]; |
1297 | 6078 if (face->uAttributes & 0x100000 || face->sCogTriggeredID == 0 ) |
6079 return 1; | |
6080 EventProcessor((signed __int16)face->sCogTriggeredID, v2, 1); | |
6081 } | |
6082 else | |
6083 { | |
6084 v4 = &pIndoor->pFaces[PID_ID(a1)]; | |
6085 v5 = v4->uAttributes; | |
6086 if ( !(v5 & 0x2000000) ) | |
6087 { | |
6088 ShowNothingHereStatus(); | |
6089 return 1; | |
6090 } | |
6091 if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 ) | |
6092 return 1; | |
6093 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) | |
6094 EventProcessor((signed __int16)v6, v2, 1); | |
6095 } | |
6096 return 0; | |
6097 break; | |
6098 } | |
6099 return 0; | |
6100 } | |
6101 //----- (0046BDF1) -------------------------------------------------------- | |
1458 | 6102 void BLV_UpdateUserInputAndOther() |
1297 | 6103 { |
6104 UpdateObjects(); | |
6105 BLV_ProcessPartyActions(); | |
6106 UpdateActors_BLV(); | |
6107 BLV_UpdateDoors(); | |
6108 check_event_triggers(); | |
6109 } | |
6110 //----- (00424829) -------------------------------------------------------- | |
1378 | 6111 // Finds out if current portal can be seen through the previous portal |
1376 | 6112 bool PortalFrustrum(int pNumVertices, BspRenderer_PortalViewportData *far_portal, BspRenderer_PortalViewportData *near_portal, int uFaceID) |
1297 | 6113 { |
6114 int min_y; // esi@5 | |
6115 int max_y; // edx@5 | |
1372 | 6116 int current_ID; // eax@12 |
1297 | 6117 int v13; // eax@22 |
6118 int v15; // ecx@29 | |
6119 int v18; // eax@39 | |
6120 int v19; // eax@44 | |
6121 int v20; // ecx@44 | |
6122 int v22; // edi@46 | |
6123 int v24; // edx@48 | |
6124 int v26; // eax@55 | |
6125 signed int v27; // edi@55 | |
6126 int v29; // edx@57 | |
6127 int v31; // eax@64 | |
6128 signed int v32; // edi@64 | |
6129 int v34; // eax@66 | |
6130 int v35; // dx@66 | |
6131 __int16 v36; // dx@67 | |
1379 | 6132 //__int16 v37; // di@67 |
1297 | 6133 __int16 v38; // dx@67 |
6134 int v46; // edx@87 | |
6135 int v49; // esi@93 | |
6136 int v53; // [sp+Ch] [bp-34h]@44 | |
6137 int v54; // [sp+10h] [bp-30h]@0 | |
1372 | 6138 int min_y_ID2; // [sp+14h] [bp-2Ch]@12 |
1297 | 6139 int v59; // [sp+14h] [bp-2Ch]@87 |
6140 int v61; // [sp+1Ch] [bp-24h]@29 | |
6141 int v62; // [sp+20h] [bp-20h]@0 | |
1372 | 6142 signed int direction1; // [sp+24h] [bp-1Ch]@3 |
6143 signed int direction2; // [sp+28h] [bp-18h]@3 | |
6144 int min_y_ID; // [sp+2Ch] [bp-14h]@5 | |
1297 | 6145 int v69; // [sp+34h] [bp-Ch]@29 |
6146 int v70; // [sp+34h] [bp-Ch]@46 | |
1370 | 6147 |
1297 | 6148 if ( pNumVertices <= 1 ) |
6149 return false; | |
1344 | 6150 min_y = PortalFace._screen_space_y[0]; |
1372 | 6151 min_y_ID = 0; |
1344 | 6152 max_y = PortalFace._screen_space_y[0]; |
1372 | 6153 //face direction(направление фейса) |
1344 | 6154 if ( !PortalFace.direction ) |
1297 | 6155 { |
1372 | 6156 direction1 = 1; |
6157 direction2 = -1; | |
1297 | 6158 } |
6159 else | |
6160 { | |
1372 | 6161 direction1 = -1; |
6162 direction2 = 1; | |
6163 } | |
6164 | |
6165 //get min and max y for portal(дать минимальное и максимальное значение y для портала) | |
6166 for ( uint i = 1; i < pNumVertices; ++i ) | |
6167 { | |
1378 | 6168 if (PortalFace._screen_space_y[i] < min_y) |
1297 | 6169 { |
1372 | 6170 min_y_ID = i; |
6171 min_y = PortalFace._screen_space_y[i]; | |
1297 | 6172 } |
1378 | 6173 else if (PortalFace._screen_space_y[i] > max_y) |
6174 { | |
6175 max_y = PortalFace._screen_space_y[i]; | |
6176 } | |
1297 | 6177 } |
6178 if ( max_y == min_y ) | |
6179 return false; | |
6180 | |
1372 | 6181 //***************************************************************************************************************************** |
1376 | 6182 far_portal->_viewport_space_y = min_y; |
6183 far_portal->_viewport_space_w = max_y; | |
1372 | 6184 current_ID = min_y_ID; |
6185 min_y_ID2 = min_y_ID; | |
6186 | |
6187 for ( uint i = 0; i < pNumVertices; ++i ) | |
6188 { | |
6189 current_ID += direction2; | |
6190 if ( current_ID < pNumVertices ) | |
1297 | 6191 { |
1372 | 6192 if ( current_ID < 0 ) |
6193 current_ID += pNumVertices; | |
1297 | 6194 } |
6195 else | |
1372 | 6196 current_ID -= pNumVertices; |
6197 if ( PortalFace._screen_space_y[current_ID] <= PortalFace._screen_space_y[min_y_ID] )//определение минимальной у | |
1297 | 6198 { |
1372 | 6199 min_y_ID2 = current_ID; |
6200 min_y_ID = current_ID; | |
1297 | 6201 } |
1372 | 6202 if ( PortalFace._screen_space_y[current_ID] == max_y ) |
1297 | 6203 break; |
6204 } | |
1372 | 6205 |
6206 v13 = min_y_ID2 + direction2; | |
1297 | 6207 if ( v13 < pNumVertices ) |
6208 { | |
6209 if ( v13 < 0 ) | |
6210 v13 += pNumVertices; | |
6211 } | |
6212 else | |
6213 v13 -= pNumVertices; | |
1372 | 6214 if ( PortalFace._screen_space_y[v13] != PortalFace._screen_space_y[min_y_ID2] ) |
6215 { | |
6216 v62 = PortalFace._screen_space_x[min_y_ID2] << 16; | |
1378 | 6217 v54 = ((PortalFace._screen_space_x[v13] - PortalFace._screen_space_x[min_y_ID2]) << 16) / |
6218 (PortalFace._screen_space_y[v13] - PortalFace._screen_space_y[min_y_ID2]); | |
6219 far_portal->viewport_left_side[min_y] = (short)PortalFace._screen_space_x[min_y_ID2]; | |
1372 | 6220 } |
6221 //**************************************************************************************************************************************** | |
6222 // | |
6223 v15 = min_y_ID; | |
6224 v61 = min_y_ID; | |
1297 | 6225 for ( v69 = 0; v69 < pNumVertices; ++v69 ) |
6226 { | |
1372 | 6227 v15 += direction1; |
1297 | 6228 if ( v15 < pNumVertices ) |
6229 { | |
6230 if ( v15 < 0 ) | |
6231 v15 += pNumVertices; | |
6232 } | |
6233 else | |
6234 v15 -= pNumVertices; | |
1372 | 6235 if ( PortalFace._screen_space_y[v15] <= PortalFace._screen_space_y[min_y_ID] ) |
1297 | 6236 { |
6237 v61 = v15; | |
1372 | 6238 min_y_ID = v15; |
1297 | 6239 } |
1344 | 6240 if ( PortalFace._screen_space_y[v15] == max_y ) |
1297 | 6241 break; |
6242 } | |
1372 | 6243 v18 = direction1 + v61; |
1297 | 6244 if ( v18 < pNumVertices ) |
6245 { | |
6246 if ( v18 < 0 ) | |
6247 v18 += pNumVertices; | |
6248 } | |
6249 else | |
6250 v18 -= pNumVertices; | |
6251 v19 = v18; | |
6252 v20 = v61; | |
1344 | 6253 if ( PortalFace._screen_space_y[v19] != PortalFace._screen_space_y[v61] ) |
6254 { | |
6255 v61 = PortalFace._screen_space_x[v20] << 16; | |
1378 | 6256 v53 = ((PortalFace._screen_space_x[v19] - PortalFace._screen_space_x[v20]) << 16) / |
6257 (PortalFace._screen_space_y[v19] - PortalFace._screen_space_y[v20]); | |
6258 far_portal->viewport_right_side[max_y] = (short)PortalFace._screen_space_x[v20]; | |
1372 | 6259 } |
6260 //**************************************************************************************************************************************** | |
1297 | 6261 v22 = min_y; |
6262 if ( min_y <= max_y ) | |
6263 { | |
6264 for ( v70 = min_y; v70 <= max_y; ++v70 ) | |
6265 { | |
6266 v24 = v13; | |
1344 | 6267 if ( v22 >= PortalFace._screen_space_y[v13] && v22 != max_y ) |
1297 | 6268 { |
1372 | 6269 v13 = direction2 + v13; |
1297 | 6270 if ( v13 < pNumVertices ) |
6271 { | |
6272 if ( v13 < 0 ) | |
6273 v13 += pNumVertices; | |
6274 } | |
6275 else | |
6276 v13 -= pNumVertices; | |
6277 v26 = v13; | |
1344 | 6278 if ( PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24] > 0 ) |
1297 | 6279 { |
1378 | 6280 v54 = ((PortalFace._screen_space_x[v26] - PortalFace._screen_space_x[v24]) << 16) / (PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]); |
1344 | 6281 v62 = PortalFace._screen_space_x[v24] << 16; |
1297 | 6282 } |
6283 } | |
6284 v29 = v18; | |
1344 | 6285 if ( v70 >= PortalFace._screen_space_y[v18] && v70 != max_y ) |
1297 | 6286 { |
1372 | 6287 v18 += direction1; |
1297 | 6288 if ( v18 < pNumVertices ) |
6289 { | |
6290 if ( v18 < 0 ) | |
6291 v18 += pNumVertices; | |
6292 } | |
6293 else | |
6294 v18 -= pNumVertices; | |
6295 v31 = v18; | |
1344 | 6296 if ( PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29] > 0 ) |
1297 | 6297 { |
1378 | 6298 v53 = ((PortalFace._screen_space_x[v31] - PortalFace._screen_space_x[v29]) << 16) / (PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]); |
1344 | 6299 v61 = PortalFace._screen_space_x[v29] << 16; |
1297 | 6300 } |
6301 } | |
1376 | 6302 far_portal->viewport_left_side[v70] = HIWORD(v62); |
6303 far_portal->viewport_right_side[v70] = HIWORD(v61); | |
6304 if ( far_portal->viewport_left_side[v70] > far_portal->viewport_right_side[v70] ) | |
1297 | 6305 { |
1376 | 6306 v36 = far_portal->viewport_left_side[v70] ^ far_portal->viewport_right_side[v70]; |
1379 | 6307 //v37 = far_portal->viewport_right_side[v70]; |
1376 | 6308 far_portal->viewport_left_side[v70] = v36; |
1379 | 6309 v38 = far_portal->viewport_right_side[v70] ^ v36; |
1376 | 6310 far_portal->viewport_left_side[v70] ^= v38; |
6311 far_portal->viewport_right_side[v70] = v38; | |
1297 | 6312 } |
6313 v62 += v54; | |
6314 v22 = v70 + 1; | |
6315 v61 += v53; | |
6316 } | |
6317 } | |
1376 | 6318 //***************************************************************************************************************************** |
6319 // check portals coordinates and determine max, min(проверка координат порталов и определение макс, мин-ой у) | |
6320 if ( max_y < near_portal->_viewport_space_y ) | |
1297 | 6321 return false; |
1376 | 6322 if ( min_y > near_portal->_viewport_space_w ) |
1297 | 6323 return false; |
1376 | 6324 if ( min_y < near_portal->_viewport_space_y ) |
6325 min_y = near_portal->_viewport_space_y; | |
6326 if ( max_y > near_portal->_viewport_space_w ) | |
6327 max_y = near_portal->_viewport_space_w; | |
1297 | 6328 if ( min_y <= max_y ) |
6329 { | |
1376 | 6330 for ( min_y; min_y <= max_y; ++min_y ) |
1297 | 6331 { |
1376 | 6332 if ( far_portal->viewport_right_side[min_y] >= near_portal->viewport_left_side[min_y] |
6333 && far_portal->viewport_left_side[min_y] <= near_portal->viewport_right_side[min_y] ) | |
1297 | 6334 break; |
6335 } | |
6336 } | |
6337 if ( max_y < min_y ) | |
6338 return false; | |
1376 | 6339 for ( max_y; max_y >= min_y; --max_y ) |
6340 { | |
6341 if ( far_portal->viewport_right_side[max_y] >= near_portal->viewport_left_side[max_y] | |
6342 && far_portal->viewport_left_side[max_y] <= near_portal->viewport_right_side[max_y] ) | |
1297 | 6343 break; |
6344 } | |
6345 if ( min_y >= max_y ) | |
1390 | 6346 return false; |
1376 | 6347 //************************************************************************************************************************************* |
1297 | 6348 v59 = min_y; |
6349 for ( v46 = max_y - min_y + 1; v46; --v46 ) | |
6350 { | |
1376 | 6351 if ( far_portal->viewport_left_side[v59] < near_portal->viewport_left_side[v59] ) |
6352 far_portal->viewport_left_side[v59] = near_portal->viewport_left_side[v59]; | |
6353 if ( far_portal->viewport_right_side[v59] > near_portal->viewport_right_side[v59] ) | |
6354 far_portal->viewport_right_side[v59] = near_portal->viewport_right_side[v59]; | |
1297 | 6355 ++v59; |
1376 | 6356 } |
6357 far_portal->_viewport_space_y = min_y; | |
6358 far_portal->_viewport_space_w = max_y; | |
6359 far_portal->_viewport_space_x = far_portal->viewport_left_side[min_y]; | |
1379 | 6360 far_portal->_viewport_space_z = far_portal->viewport_right_side[min_y]; |
1376 | 6361 far_portal->_viewport_x_minID = min_y; |
6362 far_portal->_viewport_z_maxID = min_y; | |
1297 | 6363 v49 = min_y + 1; |
6364 if ( v49 <= max_y ) | |
6365 { | |
6366 for ( v49; v49 <= max_y; ++v49 ) | |
6367 { | |
1376 | 6368 if ( far_portal->viewport_left_side[v49] < far_portal->_viewport_space_x ) |
1297 | 6369 { |
1376 | 6370 far_portal->_viewport_space_x = far_portal->viewport_left_side[v49]; |
6371 far_portal->_viewport_x_minID = v49; | |
1297 | 6372 } |
1376 | 6373 if ( far_portal->viewport_right_side[v49] > far_portal->_viewport_space_z ) |
1297 | 6374 { |
1376 | 6375 far_portal->_viewport_space_z = far_portal->viewport_right_side[v49]; |
6376 far_portal->_viewport_z_maxID = v49; | |
1297 | 6377 } |
6378 } | |
6379 } | |
6380 return true; | |
6381 } | |
6382 //----- (00423B5D) -------------------------------------------------------- | |
1344 | 6383 int __fastcall GetPortalScreenCoord(unsigned int uFaceID) |
1297 | 6384 { |
6385 BLVFace *pFace; // ebx@1 | |
1344 | 6386 int pNextVertices; // edx@11 |
6387 int t; // ST28_4@12 | |
6388 int pScreenX; // eax@22 | |
6389 int pScreenY; // eax@27 | |
6390 signed int left_num_vertices; // edi@31 | |
6391 signed int right_num_vertices; // ebx@41 | |
6392 signed int top_num_vertices; // edi@51 | |
6393 int bottom_num_vertices; // ebx@61 | |
1297 | 6394 signed int v62; // edx@75 |
6395 int v63; // ecx@76 | |
6396 int v64; // esi@76 | |
6397 int v65; // ecx@83 | |
6398 signed int v71; // [sp+14h] [bp-14h]@75 | |
1301 | 6399 bool current_vertices_flag; // [sp+18h] [bp-10h]@9 |
1297 | 6400 int thisf; // [sp+18h] [bp-10h]@74 |
1301 | 6401 signed int depth_num_vertices; // [sp+1Ch] [bp-Ch]@9 |
1297 | 6402 int v80; // [sp+1Ch] [bp-Ch]@76 |
1301 | 6403 bool next_vertices_flag; // [sp+20h] [bp-8h]@10 |
1784 | 6404 //Доп инфо "Программирование трёхмерных игр для windows" Ламот стр 910 |
1297 | 6405 |
6406 pFace = &pIndoor->pFaces[uFaceID]; | |
1344 | 6407 memset(&PortalFace, 0, sizeof(stru367)); |
6408 | |
6409 //get direction the face(определение направленности фейса)********************************************************************************* | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6410 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pGame->pIndoorCameraD3D->vPartyPos.x) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6411 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pGame->pIndoorCameraD3D->vPartyPos.y) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6412 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pGame->pIndoorCameraD3D->vPartyPos.z) < 0 ) |
1297 | 6413 { |
1344 | 6414 PortalFace.direction = true; |
1297 | 6415 } |
6416 else | |
6417 { | |
1344 | 6418 PortalFace.direction = false; |
1301 | 6419 if ( !(pFace->Portal()) ) |
1297 | 6420 return 0; |
6421 } | |
1344 | 6422 //***************************************************************************************************************************************** |
6423 //generate/cinvertetion in camera location coordinates(генерация/конвертирование в координаты пространства камеры) | |
6424 | |
6425 //for new coordinates: | |
6426 //int x = 0x AAAA BBBB; | |
6427 //AAAA - integer(целая часть), BBBB - fractional(дробная) | |
6428 //float v = HIWORD(x) + LOWORD(x) / 65535.0f; | |
6429 //0x0351A281 это 849(351 в шестнадцатиричной) в целой части и A281 в дробной(хотя как точно BBBB считалась не помню) | |
6430 //if in HIWORD: FFFF = -1 | |
6431 //FFFE = -2 | |
6432 //FFFD = -3 | |
6433 //.... | |
6434 //8000 = -32767 | |
6435 //7FFF = 32767 | |
6436 //7FFE = 32766 | |
6437 //если в LOWORD например лежит FFFF то не совсем понятно, что это | |
6438 //потому что если и hiword и loword равны FFFF FFFF то двойное отрицание как бы, нужно тестировать что конкретно получается чтобы понять что это значит | |
6439 //всё что больше 7FFF для верхнего слова это идёт уже с минусом/Nomad/ | |
6440 | |
1297 | 6441 if ( (signed int)pFace->uNumVertices > 0 ) |
6442 { | |
1301 | 6443 for (uint i = 0; i < pFace->uNumVertices; ++i) |
1297 | 6444 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6445 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pIndoor->pVertices[pFace->pVertexIDs[i]].x, |
1344 | 6446 pIndoor->pVertices[pFace->pVertexIDs[i]].y, |
6447 pIndoor->pVertices[pFace->pVertexIDs[i]].z, | |
6448 &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0); | |
1297 | 6449 } |
1301 | 6450 } |
1344 | 6451 //***************************************************************************************************************************************** |
6452 //check vertices for the nearest plane(проверка вершин есть ли в области за ближайшей плоскостью) | |
1301 | 6453 if ( pFace->uNumVertices <= 0 ) |
1297 | 6454 return 0; |
1301 | 6455 bool bFound = false; |
6456 for (uint i = 0; i < pFace->uNumVertices; ++i) | |
6457 { | |
1344 | 6458 if ( PortalFace._view_transformed_z[i + 3] >= 524288 )// 8.0(0x80000) |
1301 | 6459 { |
6460 bFound = true; | |
1297 | 6461 break; |
1301 | 6462 } |
6463 } | |
6464 if ( !bFound ) | |
1297 | 6465 return 0; |
1344 | 6466 //***************************************************************************************************************************************** |
6467 //check for near clip plane(проверка по ближней границе) | |
6468 // | |
6469 // v0 v1 | |
6470 // ._________________. | |
6471 // / \ | |
6472 // / \ | |
6473 // v5. . v2 | |
6474 // | | | |
6475 // | | | |
6476 // | | | |
6477 // ---------------------------- 8.0(near_clip) | |
6478 // | | | |
6479 // ._______________________. | |
6480 // v4 v3 | |
1301 | 6481 depth_num_vertices = 0; |
1344 | 6482 PortalFace._view_transformed_z[pFace->uNumVertices + 3] = PortalFace._view_transformed_z[3]; |
6483 PortalFace._view_transformed_x[pFace->uNumVertices + 3] = PortalFace._view_transformed_x[3]; | |
6484 PortalFace._view_transformed_y[pFace->uNumVertices + 3] = PortalFace._view_transformed_y[3]; | |
6485 current_vertices_flag = PortalFace._view_transformed_z[3] >= 524288;// 8.0(0x80000) | |
1301 | 6486 if ( pFace->uNumVertices >= 1 ) |
6487 { | |
6488 for ( uint i = 1; i <= pFace->uNumVertices; ++i) | |
1297 | 6489 { |
1344 | 6490 next_vertices_flag = PortalFace._view_transformed_z[i + 3] >= 524288;// 8.0(0x80000) |
6491 if ( current_vertices_flag ^ next_vertices_flag )//или текущая или следующая вершина за ближней границей | |
1297 | 6492 { |
1344 | 6493 if ( next_vertices_flag )//следующая вершина за ближней границей |
1297 | 6494 { |
1344 | 6495 //t = near_clip - v0.z / v1.z - v0.z |
1370 | 6496 t = fixpoint_div(524288 - PortalFace._view_transformed_z[i + 2], PortalFace._view_transformed_z[i + 3] - PortalFace._view_transformed_z[i + 2]); |
1344 | 6497 //New_x = (v1.x - v0.x)*t + v0.x |
6498 PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 3] | |
6499 - PortalFace._view_transformed_x[i + 2]) * t) >> 16) + PortalFace._view_transformed_x[i + 2]; | |
6500 //New_y = (v1.y - v0.y)*t + v0.y | |
6501 PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 3] - PortalFace._view_transformed_y[i + 2]) | |
6502 * t) >> 16) + PortalFace._view_transformed_y[i + 2]; | |
6503 //New_z = 8.0(0x80000) | |
6504 PortalFace._view_transformed_z[depth_num_vertices] = 524288; | |
1297 | 6505 } |
1344 | 6506 else// текущая вершина за ближней границей |
1297 | 6507 { |
1344 | 6508 //t = near_clip - v1.z / v0.z - v1.z |
1370 | 6509 t = fixpoint_div(524288 - PortalFace._view_transformed_z[i + 3], PortalFace._view_transformed_z[i + 2] - PortalFace._view_transformed_z[i + 3]); |
1344 | 6510 //New_x = (v0.x - v1.x)*t + v1.x |
6511 PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 2] | |
6512 - PortalFace._view_transformed_x[i + 3]) * t) >> 16) + PortalFace._view_transformed_x[i + 3]; | |
6513 //New_y = (v0.x - v1.y)*t + v1.y | |
6514 PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 2] - PortalFace._view_transformed_y[i + 3]) | |
6515 * t) >> 16) + PortalFace._view_transformed_y[i + 3]; | |
6516 //New_z = 8.0(0x80000) | |
6517 PortalFace._view_transformed_z[depth_num_vertices] = 524288; | |
1297 | 6518 } |
1344 | 6519 depth_num_vertices++; |
1297 | 6520 } |
1344 | 6521 if ( next_vertices_flag )//если следующая вершина за ближней границей |
1297 | 6522 { |
1344 | 6523 pNextVertices = depth_num_vertices++; |
6524 PortalFace._view_transformed_z[pNextVertices] = PortalFace._view_transformed_z[i + 3]; | |
6525 PortalFace._view_transformed_x[pNextVertices] = PortalFace._view_transformed_x[i + 3]; | |
6526 PortalFace._view_transformed_y[pNextVertices] = PortalFace._view_transformed_y[i + 3]; | |
1297 | 6527 } |
1301 | 6528 current_vertices_flag = next_vertices_flag; |
1297 | 6529 } |
1301 | 6530 } |
1344 | 6531 //результат: нет моргания на границе портала(когда проходим сквозь портал) |
6532 //************************************************************************************************************************************ | |
6533 //convertion in screen coordinates(конвертирование в координаты экрана) | |
6534 PortalFace._view_transformed_z[depth_num_vertices] = PortalFace._view_transformed_z[0]; | |
6535 PortalFace._view_transformed_x[depth_num_vertices] = PortalFace._view_transformed_x[0]; | |
6536 PortalFace._view_transformed_y[depth_num_vertices] = PortalFace._view_transformed_y[0]; | |
6537 for ( uint i = 0; i < depth_num_vertices; ++i ) | |
6538 { | |
6539 if ( (abs(PortalFace._view_transformed_x[i]) >> 13) <= abs(PortalFace._view_transformed_z[i]) ) | |
6540 pScreenX = fixpoint_div(PortalFace._view_transformed_x[i], PortalFace._view_transformed_z[i]); | |
1297 | 6541 else |
6542 { | |
1344 | 6543 if ( PortalFace._view_transformed_x[i] >= 0 ) |
1297 | 6544 { |
1344 | 6545 if (PortalFace._view_transformed_z[i] >= 0) |
6546 pScreenX = 0x400000; // 64.0 | |
1301 | 6547 else |
1344 | 6548 pScreenX = 0xFFC00000; // -63.0 |
1297 | 6549 } |
6550 else | |
6551 { | |
1344 | 6552 if (PortalFace._view_transformed_z[i] >= 0) |
6553 pScreenX = 0xFFC00000; // -63.0 | |
1301 | 6554 else |
1344 | 6555 pScreenX = 0x400000; // 64.0 |
1297 | 6556 } |
6557 } | |
1301 | 6558 |
1344 | 6559 if ( (abs(PortalFace._view_transformed_y[i]) >> 13) <= abs(PortalFace._view_transformed_z[i]) ) |
6560 pScreenY = fixpoint_div(PortalFace._view_transformed_y[i], PortalFace._view_transformed_z[i]); | |
1297 | 6561 else |
6562 { | |
1344 | 6563 if ( PortalFace._view_transformed_y[i] >= 0 ) |
1297 | 6564 { |
1344 | 6565 if (PortalFace._view_transformed_z[i] >= 0) |
6566 pScreenY = 0x400000; // 64.0 | |
1301 | 6567 else |
1344 | 6568 pScreenY = 0xFFC00000; // -63.0 |
1297 | 6569 } |
6570 else | |
6571 { | |
1344 | 6572 if (PortalFace._view_transformed_z[i] >= 0) |
6573 pScreenY = 0xFFC00000; // -63.0 | |
1301 | 6574 else |
1344 | 6575 pScreenY = 0x400000; // 64.0 |
1297 | 6576 } |
6577 } | |
1641 | 6578 PortalFace._screen_space_x[i + 12] = pBLVRenderParams->uViewportCenterX - ((unsigned __int64)(SHIWORD(pBLVRenderParams->fov_rad_fixpoint) * (signed __int64)pScreenX) >> 16); |
6579 PortalFace._screen_space_y[i + 12] = pBLVRenderParams->uViewportCenterY - ((unsigned __int64)(SHIWORD(pBLVRenderParams->fov_rad_fixpoint) * (signed __int64)pScreenY) >> 16); | |
1344 | 6580 } |
6581 // результат: при повороте камеры, когда граница портала сдвигается к краю экрана, портал остается прозрачным(видимым) | |
6582 //****************************************************************************************************************************************** | |
1381 | 6583 //координаты как в Ида-базе игры так и в данном проекте перевёрнутые,т.е. портал который в правой части экрана имеет экранные координаты |
6584 //которые для левой части экрана. Например, x(оригинал) = 8, у нас х = 468(противоположный край экрана), точно также и с у. | |
6585 // | |
1344 | 6586 //check for left_clip plane(порверка по левой границе) |
6587 left_num_vertices = 0; | |
6588 PortalFace._screen_space_x[depth_num_vertices + 12] = PortalFace._screen_space_x[12]; | |
6589 PortalFace._screen_space_y[depth_num_vertices + 12] = PortalFace._screen_space_y[12]; | |
1370 | 6590 current_vertices_flag = PortalFace._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX;//8.0 |
1301 | 6591 if ( depth_num_vertices < 1 ) |
1297 | 6592 return 0; |
1344 | 6593 for ( uint i = 1; i <= depth_num_vertices; ++i ) |
6594 { | |
6595 next_vertices_flag = PortalFace._screen_space_x[i + 12] >= (signed int)pBLVRenderParams->uViewportX; | |
6596 if ( current_vertices_flag ^ next_vertices_flag ) | |
1297 | 6597 { |
1344 | 6598 if ( next_vertices_flag ) |
1297 | 6599 { |
1344 | 6600 //t = left_clip - v0.x / v1.x - v0.x |
1370 | 6601 t = fixpoint_div(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 11], PortalFace._screen_space_x[i + 12] - PortalFace._screen_space_x[i + 11]); |
1344 | 6602 //New_y = (v1.y - v0.y)*t + v0.y |
1370 | 6603 PortalFace._screen_space_y[left_num_vertices + 9] = ((signed int)((PortalFace._screen_space_y[i + 12]- PortalFace._screen_space_y[i + 11]) |
6604 * t) >> 16) + PortalFace._screen_space_y[i + 11]; | |
1344 | 6605 //New_x = left_clip |
6606 PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX; | |
1297 | 6607 } |
6608 else | |
6609 { | |
1344 | 6610 //t = left_clip - v1.x / v0.x - v1.x |
1370 | 6611 t = fixpoint_div(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 12], PortalFace._screen_space_x[i + 11] - PortalFace._screen_space_x[i + 12]); |
1344 | 6612 //New_y = (v0.y - v1.y)*t + v1.y |
1370 | 6613 PortalFace._screen_space_y[left_num_vertices + 9] = ((signed int)(( PortalFace._screen_space_y[i + 11] - PortalFace._screen_space_y[i + 12]) |
6614 * t) >> 16) + PortalFace._screen_space_y[i + 12]; | |
1344 | 6615 //New_x = left_clip |
6616 PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX; | |
1297 | 6617 } |
1344 | 6618 left_num_vertices++; |
1297 | 6619 } |
1344 | 6620 if ( next_vertices_flag ) |
1297 | 6621 { |
1344 | 6622 pNextVertices = left_num_vertices++; |
6623 PortalFace._screen_space_x[pNextVertices + 9] = PortalFace._screen_space_x[i + 12]; | |
6624 PortalFace._screen_space_y[pNextVertices + 9] = PortalFace._screen_space_y[i + 12]; | |
1297 | 6625 } |
1344 | 6626 current_vertices_flag = next_vertices_flag; |
6627 } | |
6628 //********************************************************************************************************************************* | |
6629 //for right_clip plane(проверка по правой плоскости) | |
6630 right_num_vertices = 0; | |
6631 PortalFace._screen_space_x[left_num_vertices + 9] = PortalFace._screen_space_x[9]; | |
6632 PortalFace._screen_space_y[left_num_vertices + 9] = PortalFace._screen_space_y[9]; | |
1370 | 6633 current_vertices_flag = PortalFace._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ;//468.0 |
1344 | 6634 if (left_num_vertices < 1) |
1297 | 6635 return 0; |
1344 | 6636 for ( uint i = 1; i <= left_num_vertices; ++i ) |
6637 { | |
6638 next_vertices_flag = PortalFace._screen_space_x[i + 9] <= (signed int)pBLVRenderParams->uViewportZ; | |
6639 if ( current_vertices_flag ^ next_vertices_flag ) | |
1297 | 6640 { |
1344 | 6641 if ( next_vertices_flag ) |
1297 | 6642 { |
1344 | 6643 //t = right_clip - v1.x / v0.x - v1.x |
1370 | 6644 t = fixpoint_div(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 8], PortalFace._screen_space_x[i + 9] - PortalFace._screen_space_x[i + 8]); |
1344 | 6645 //New_y = (v0.y - v1.y)*t + v1.y |
1370 | 6646 PortalFace._screen_space_y[right_num_vertices + 6] = ((signed int)((PortalFace._screen_space_y[i + 9] - PortalFace._screen_space_y[i + 8]) |
6647 * t) >> 16) + PortalFace._screen_space_y[i + 8]; | |
1344 | 6648 //New_x = right_clip |
6649 PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ; | |
1297 | 6650 } |
6651 else | |
6652 { | |
1344 | 6653 //t = right_clip - v0.x / v1.x - v0.x |
1370 | 6654 t = fixpoint_div(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 9], PortalFace._screen_space_x[i + 8] - PortalFace._screen_space_x[i + 9]); |
1344 | 6655 //New_y = (v1.y - v0.y)*t + v0.y |
1370 | 6656 PortalFace._screen_space_y[right_num_vertices + 6] = ((signed int)((PortalFace._screen_space_y[i + 8] - PortalFace._screen_space_y[i + 9]) |
6657 * t) >> 16) + PortalFace._screen_space_y[i + 9]; | |
1344 | 6658 //New_x = right_clip |
6659 PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ; | |
1297 | 6660 } |
1344 | 6661 right_num_vertices++; |
1297 | 6662 } |
1344 | 6663 if ( next_vertices_flag ) |
1297 | 6664 { |
1344 | 6665 pNextVertices = right_num_vertices++; |
6666 PortalFace._screen_space_x[pNextVertices + 6] = PortalFace._screen_space_x[i + 9]; | |
6667 PortalFace._screen_space_y[pNextVertices + 6] = PortalFace._screen_space_y[i + 9]; | |
1297 | 6668 } |
1344 | 6669 current_vertices_flag = next_vertices_flag; |
6670 } | |
6671 //************************************************************************************************************************************ | |
6672 // for top clip plane | |
6673 top_num_vertices = 0; | |
6674 PortalFace._screen_space_x[right_num_vertices + 6] = PortalFace._screen_space_x[6]; | |
6675 PortalFace._screen_space_y[right_num_vertices + 6] = PortalFace._screen_space_y[6]; | |
6676 | |
1370 | 6677 current_vertices_flag = PortalFace._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY;//8.0 |
1344 | 6678 if ( right_num_vertices < 1 ) |
1297 | 6679 return 0; |
1344 | 6680 for ( uint i = 1; i <= right_num_vertices; ++i ) |
6681 { | |
6682 next_vertices_flag = PortalFace._screen_space_y[i + 6] >= (signed int)pBLVRenderParams->uViewportY; | |
6683 if ( current_vertices_flag ^ next_vertices_flag ) | |
1297 | 6684 { |
1344 | 6685 if ( next_vertices_flag ) |
1297 | 6686 { |
1370 | 6687 t = fixpoint_div(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 5], PortalFace._screen_space_y[i + 6] - PortalFace._screen_space_y[i + 5]); |
6688 PortalFace._screen_space_x[top_num_vertices + 3] = ((signed int)((PortalFace._screen_space_x[i + 6] - PortalFace._screen_space_x[i + 5]) | |
6689 * t) >> 16) + PortalFace._screen_space_x[i + 5]; | |
1344 | 6690 PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY; |
1297 | 6691 } |
6692 else | |
6693 { | |
1370 | 6694 t = fixpoint_div(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 6], PortalFace._screen_space_y[i + 5] - PortalFace._screen_space_y[i + 6]); |
6695 PortalFace._screen_space_x[top_num_vertices + 3] = ((signed int)((PortalFace._screen_space_x[i + 5]- PortalFace._screen_space_x[i + 6]) | |
6696 * t) >> 16) + PortalFace._screen_space_x[i + 6]; | |
1344 | 6697 PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY; |
1297 | 6698 } |
1344 | 6699 top_num_vertices++; |
1297 | 6700 } |
1344 | 6701 current_vertices_flag = next_vertices_flag; |
6702 if ( next_vertices_flag ) | |
1297 | 6703 { |
1344 | 6704 pNextVertices = top_num_vertices++; |
6705 PortalFace._screen_space_x[pNextVertices + 3] = PortalFace._screen_space_x[i + 6]; | |
6706 PortalFace._screen_space_y[pNextVertices + 3] = PortalFace._screen_space_y[i + 6]; | |
1297 | 6707 } |
1344 | 6708 } |
6709 //********************************************************************************************************************************** | |
6710 //for bottom_clip plane(проверка по нижней плоскости) | |
6711 bottom_num_vertices = 0; | |
6712 PortalFace._screen_space_x[top_num_vertices + 3] = PortalFace._screen_space_x[3]; | |
6713 PortalFace._screen_space_y[top_num_vertices + 3] = PortalFace._screen_space_y[3]; | |
1370 | 6714 current_vertices_flag = PortalFace._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW;//351.0 |
1344 | 6715 if ( top_num_vertices < 1 ) |
1297 | 6716 return 0; |
1344 | 6717 for ( uint i =1; i <= top_num_vertices; ++i ) |
6718 { | |
6719 next_vertices_flag = PortalFace._screen_space_y[i + 3] <= (signed int)pBLVRenderParams->uViewportW; | |
6720 if ( current_vertices_flag ^ next_vertices_flag ) | |
1297 | 6721 { |
1344 | 6722 if ( next_vertices_flag ) |
1297 | 6723 { |
1370 | 6724 t = fixpoint_div(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 2], PortalFace._screen_space_y[i + 3] - PortalFace._screen_space_y[i + 2]); |
6725 PortalFace._screen_space_x[bottom_num_vertices] = ((signed int)((PortalFace._screen_space_x[i + 3] - PortalFace._screen_space_x[i + 2]) | |
6726 * t) >> 16) + PortalFace._screen_space_x[i + 2]; | |
1344 | 6727 PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW; |
1297 | 6728 } |
6729 else | |
6730 { | |
1370 | 6731 t = fixpoint_div(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 3], PortalFace._screen_space_y[i + 2] - PortalFace._screen_space_y[i + 3]); |
6732 PortalFace._screen_space_x[bottom_num_vertices] = ((signed int)((PortalFace._screen_space_x[i + 2] - PortalFace._screen_space_x[i + 3]) | |
6733 * t) >> 16) + PortalFace._screen_space_x[i + 3]; | |
1344 | 6734 PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW; |
1297 | 6735 } |
1344 | 6736 bottom_num_vertices++; |
1297 | 6737 } |
1344 | 6738 if ( next_vertices_flag ) |
1297 | 6739 { |
1344 | 6740 pNextVertices = bottom_num_vertices++; |
6741 PortalFace._screen_space_x[pNextVertices] = PortalFace._screen_space_x[i + 3]; | |
6742 PortalFace._screen_space_y[pNextVertices] = PortalFace._screen_space_y[i + 3]; | |
1297 | 6743 } |
1344 | 6744 current_vertices_flag = next_vertices_flag; |
6745 } | |
6746 //*************************************************************************************************************************************** | |
6747 | |
6748 if ( !bottom_num_vertices ) | |
1297 | 6749 return 0; |
1344 | 6750 PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0]; |
6751 PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0]; | |
6752 //check for software(проверка для софтвар) | |
6753 if ( !pRenderer->pRenderD3D && bottom_num_vertices > 3 ) | |
6754 { | |
6755 PortalFace._screen_space_x[bottom_num_vertices + 1] = PortalFace._screen_space_x[1]; | |
6756 PortalFace._screen_space_y[bottom_num_vertices + 1] = PortalFace._screen_space_y[1]; | |
6757 thisf = PortalFace.direction == true ? 1 : - 1; | |
6758 if ( bottom_num_vertices > 0 ) | |
1297 | 6759 { |
6760 v62 = 1; | |
6761 v71 = 1; | |
6762 do | |
6763 { | |
6764 v63 = v62 - 1; | |
6765 v64 = v62 + 1; | |
6766 v80 = v62 + 1; | |
1344 | 6767 if ( v62 - 1 >= bottom_num_vertices ) |
6768 v63 -= bottom_num_vertices; | |
6769 if ( v62 >= bottom_num_vertices ) | |
6770 v62 -= bottom_num_vertices; | |
6771 if ( v64 >= bottom_num_vertices ) | |
6772 v64 -= bottom_num_vertices; | |
6773 if ( thisf * ((PortalFace._screen_space_y[v64] - PortalFace._screen_space_y[v63]) | |
6774 * (PortalFace._screen_space_x[v62] - PortalFace._screen_space_x[v63]) | |
6775 - (PortalFace._screen_space_y[v62] - PortalFace._screen_space_y[v63]) | |
6776 * (PortalFace._screen_space_x[v64] - PortalFace._screen_space_x[v63])) < 0 ) | |
1297 | 6777 { |
6778 v62 = v80; | |
6779 v71 = v80; | |
6780 } | |
6781 else | |
6782 { | |
6783 v62 = v71; | |
6784 v65 = v71; | |
1344 | 6785 if ( v71 < bottom_num_vertices || (v65 = v71 - bottom_num_vertices, v71 - bottom_num_vertices < bottom_num_vertices) ) |
1297 | 6786 { |
1344 | 6787 memcpy(&PortalFace._screen_space_y[v65], &PortalFace._screen_space_y[v65 + 1], |
6788 4 * ((unsigned int)(4 * (bottom_num_vertices - v65)) >> 2)); | |
6789 memcpy(&PortalFace._screen_space_x[v65], &PortalFace._screen_space_x[v65 + 1], | |
6790 4 * ((unsigned int)(4 * (bottom_num_vertices - v65)) >> 2)); | |
1297 | 6791 } |
1344 | 6792 --bottom_num_vertices; |
1297 | 6793 } |
6794 } | |
1344 | 6795 while ( v62 - 1 < bottom_num_vertices ); |
1297 | 6796 } |
1344 | 6797 PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0]; |
6798 PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0]; | |
6799 } | |
6800 return bottom_num_vertices; | |
1408 | 6801 } |
6802 | |
6803 //----- (004AAEA6) -------------------------------------------------------- | |
6804 int __fastcall sub_4AAEA6_transform(RenderVertexSoft *a1) | |
6805 { | |
6806 double v4; // st5@2 | |
6807 double v5; // st4@3 | |
6808 float v11; // [sp+8h] [bp-8h]@2 | |
6809 float v12; // [sp+8h] [bp-8h]@6 | |
6810 float v13; // [sp+Ch] [bp-4h]@2 | |
6811 float v14; // [sp+Ch] [bp-4h]@6 | |
6812 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6813 if (pGame->pIndoorCameraD3D->sRotationX) |
1408 | 6814 { |
6815 v13 = a1->vWorldPosition.x - (double)pParty->vPosition.x; | |
6816 v11 = a1->vWorldPosition.y - (double)pParty->vPosition.y; | |
6817 v4 = a1->vWorldPosition.z - (double)pParty->vPosition.z; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6818 //if ( pRenderer->pRenderD3D ) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6819 //{ |
1642 | 6820 v5 = v11 * pGame->pIndoorCameraD3D->fRotationYSine + v13 * pGame->pIndoorCameraD3D->fRotationYCosine; |
6821 a1->vWorldViewPosition.y = v13 * pGame->pIndoorCameraD3D->fRotationYSine - v11 * pGame->pIndoorCameraD3D->fRotationYCosine; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6822 /*} |
1408 | 6823 else |
6824 { | |
6825 v5 = v13 * pBLVRenderParams->fCosineY - v11 * pBLVRenderParams->fSineY; | |
6826 a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY + v11 * pBLVRenderParams->fCosineY; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6827 }*/ |
1642 | 6828 a1->vWorldViewPosition.x = v5 * pGame->pIndoorCameraD3D->fRotationXCosine - v4 * pGame->pIndoorCameraD3D->fRotationXSine; |
6829 a1->vWorldViewPosition.z = v5 * pGame->pIndoorCameraD3D->fRotationXSine + v4 * pGame->pIndoorCameraD3D->fRotationXCosine; | |
1408 | 6830 } |
6831 else | |
6832 { | |
6833 v14 = a1->vWorldPosition.x - (double)pParty->vPosition.x; | |
6834 v12 = a1->vWorldPosition.y - (double)pParty->vPosition.y; | |
6835 a1->vWorldViewPosition.z = a1->vWorldPosition.z - (double)pParty->vPosition.z; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6836 //if ( pRenderer->pRenderD3D ) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6837 //{ |
1642 | 6838 a1->vWorldViewPosition.x = v12 * pGame->pIndoorCameraD3D->fRotationYSine + v14 * pGame->pIndoorCameraD3D->fRotationYCosine; |
6839 a1->vWorldViewPosition.y = v14 * pGame->pIndoorCameraD3D->fRotationYSine - v12 * pGame->pIndoorCameraD3D->fRotationYCosine; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6840 /*} |
1408 | 6841 else |
6842 { | |
6843 a1->vWorldViewPosition.x = v14 * pBLVRenderParams->fCosineY - v12 * pBLVRenderParams->fSineY; | |
6844 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
6845 }*/ |
1408 | 6846 } |
6847 return 0; | |
0 | 6848 } |