Mercurial > mm7
annotate Indoor.cpp @ 1016:c45d51b3f4f4
Included header files cleanup
author | Grumpy7 |
---|---|
date | Sun, 19 May 2013 17:55:19 +0200 |
parents | 0d96349d8c87 |
children | 9ac94d00012e |
rev | line source |
---|---|
0 | 1 #include <assert.h> |
2 | |
1016 | 3 #include "LightmapBuilder.h" |
4 #include "DecalBuilder.h" | |
5 #include "ParticleEngine.h" | |
6 #include "stru9.h" | |
7 #include "stru10.h" | |
8 | |
9 #include "BSPModel.h" | |
0 | 10 #include "Outdoor.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
11 #include "SpriteObject.h" |
0 | 12 #include "Events.h" |
13 #include "Game.h" | |
14 #include "Viewport.h" | |
15 #include "Time.h" | |
16 #include "Party.h" | |
17 #include "Math.h" | |
18 #include "Allocator.h" | |
19 #include "LOD.h" | |
20 #include "DecorationList.h" | |
21 #include "ObjectList.h" | |
22 #include "Actor.h" | |
23 #include "Chest.h" | |
24 #include "GUIProgressBar.h" | |
25 #include "stru123.h" | |
26 #include "AudioPlayer.h" | |
27 #include "Log.h" | |
28 #include "TurnEngine.h" | |
29 #include "PaletteManager.h" | |
30 #include "MapInfo.h" | |
186 | 31 #include "IndoorCamera.h" |
0 | 32 |
33 #include "mm7_data.h" | |
831 | 34 #include "MM7.h" |
0 | 35 |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 IndoorLocation *pIndoor = new IndoorLocation; | |
45 BLVRenderParams *pBLVRenderParams = new BLVRenderParams; | |
46 | |
47 struct DecorationList *pDecorationList; | |
48 | |
49 LevelDecoration pLevelDecorations[3000]; | |
50 size_t uNumLevelDecorations; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
51 LevelDecoration* activeLevelDecoration; |
0 | 52 |
53 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null; | |
54 | |
55 stru320 stru_F8AD28; // idb | |
56 stru337 stru_F81018; | |
57 stru167_wrap array_5118E8; | |
58 BspRenderer_stru2 stru_F8A590; | |
59 BspRenderer *pBspRenderer = new BspRenderer; // idb | |
60 stru141 stru_721530; | |
61 stru352 stru_F83B80[480]; | |
62 | |
63 | |
64 | |
65 unsigned __int16 pDoorSoundIDsByLocationID[78] = | |
66 { | |
67 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, | |
68 300, 300, 300, 404, 302, 306, 308, 304, 308, 302, 400, 302, 300, | |
69 308, 308, 306, 308, 308, 304, 300, 404, 406, 300, 400, 406, 404, | |
70 306, 302, 408, 304, 300, 300, 300, 300, 300, 300, 300, 300, 300, | |
71 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 404, 304, | |
72 400, 300, 300, 404, 304, 400, 300, 300, 404, 304, 400, 300, 300 | |
73 }; | |
74 | |
75 | |
76 | |
77 //----- (0043F39E) -------------------------------------------------------- | |
78 void __fastcall PrepareDrawLists_BLV(IndoorLocation_drawstru *_this) | |
79 { | |
80 //int *v1; // ecx@1 | |
81 //double v2; // ST30_8@3 | |
82 //double v3; // ST30_8@6 | |
83 //double v4; // ST28_8@6 | |
84 int v5; // eax@4 | |
707 | 85 //int v6; // eax@7 |
0 | 86 unsigned int v7; // ebx@8 |
87 BLVSector *v8; // esi@8 | |
707 | 88 //unsigned __int16 *v9; // edi@8 |
89 //int i; // [sp+18h] [bp-8h]@7 | |
0 | 90 //unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3 |
707 | 91 //signed int v12; // [sp+1Ch] [bp-4h]@8 |
0 | 92 |
93 pBLVRenderParams->Reset(_this); | |
94 pMobileLightsStack->uNumLightsActive = 0; | |
95 //uNumMobileLightsApplied = 0; | |
96 uNumDecorationsDrawnThisFrame = 0; | |
97 _unused000 = 0; | |
98 uNumSpritesDrawnThisFrame = 0; | |
99 uNumBillboardsToDraw = 0; | |
707 | 100 |
101 if ( !byte_4D864C || !(pGame->uFlags & 0x1000) ) // lightspot around party | |
0 | 102 { |
103 //v2 = pParty->flt_TorchlightColorB + 6.7553994e15; | |
104 //v11 = LOBYTE(v2); | |
105 v5 = 800; | |
106 if (pParty->TorchlightActive()) | |
707 | 107 v5 *= pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; |
0 | 108 //LOBYTE(v1) = byte_4E94D0; |
109 //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; | |
110 //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; | |
707 | 111 pMobileLightsStack->AddLight(pBLVRenderParams->vPartyPos.x, |
112 pBLVRenderParams->vPartyPos.y, | |
113 pBLVRenderParams->vPartyPos.z, | |
114 pBLVRenderParams->uPartySectorID, | |
115 v5, | |
116 floorf(pParty->flt_TorchlightColorR + 0.5f), | |
117 floorf(pParty->flt_TorchlightColorG + 0.5f), | |
118 floorf(pParty->flt_TorchlightColorB + 0.5f), | |
119 byte_4E94D0); | |
0 | 120 } |
121 PrepareBspRenderList_BLV(); | |
122 PrepareItemsRenderList_BLV(); | |
123 PrepareActorRenderList_BLV(); | |
707 | 124 |
125 //v6 = 0; | |
126 for (uint i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i) | |
0 | 127 { |
707 | 128 v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]; |
129 //v12 = 0; | |
130 v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]]; | |
131 //v9 = v8->pDecorationIDs; | |
132 | |
133 for (uint j = 0; j < v8->uNumDecorations; ++j) | |
134 //if ( v8->uNumDecorations > 0 ) | |
0 | 135 { |
707 | 136 // do |
137 PrepareDecorationsRenderList_BLV(v8->pDecorationIDs[j], v7); | |
138 // while ( v12 < v8->uNumDecorations ); | |
0 | 139 } |
707 | 140 //v6 = i + 1; |
0 | 141 } |
657 | 142 FindBillboardsLightLevels_BLV(); |
0 | 143 pGame->PrepareBloodsplats(); |
144 } | |
145 | |
146 | |
147 | |
148 //----- (004407D9) -------------------------------------------------------- | |
149 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2) | |
150 { | |
151 IndoorLocation_drawstru *v2; // ebx@1 | |
152 BLVRenderParams *v3; // esi@1 | |
153 int v4; // ST08_4@1 | |
154 int v5; // ST04_4@1 | |
155 int v6; // ST00_4@1 | |
156 int v7; // eax@1 | |
157 int v8; // ST08_4@2 | |
158 int v9; // ST04_4@2 | |
159 int v10; // ST00_4@2 | |
160 unsigned int v11; // edi@4 | |
161 unsigned int v12; // ecx@4 | |
162 int v13; // edx@4 | |
163 signed int v14; // ecx@4 | |
164 unsigned int v15; // edx@4 | |
165 unsigned int v16; // eax@4 | |
166 double v17; // st7@5 | |
167 int v18; // eax@5 | |
168 double v19; // st7@5 | |
169 int v20; // eax@5 | |
170 double v21; // st7@5 | |
171 int v22; // eax@5 | |
172 unsigned int v23; // edx@5 | |
173 unsigned int v24; // ecx@5 | |
174 int v25; // eax@5 | |
175 int v26; // eax@5 | |
176 signed int v27; // eax@6 | |
177 int result; // eax@6 | |
178 int v29; // [sp+24h] [bp+8h]@5 | |
179 | |
180 v2 = a2; | |
181 v3 = this; | |
182 this->field_0_timer_ = a2->field_0_timer; | |
183 this->uFlags = a2->uFlags; | |
184 this->vPartyPos.x = a2->vPosition.x; | |
185 this->vPartyPos.y = a2->vPosition.y; | |
186 this->vPartyPos.z = a2->vPosition.z; | |
187 v4 = this->vPartyPos.z; | |
188 v5 = this->vPartyPos.y; | |
189 this->sPartyRotY = a2->sRotationY; | |
190 v6 = this->vPartyPos.x; | |
191 this->sPartyRotX = a2->sRotationX; | |
192 v7 = pIndoor->GetSector(v6, v5, v4); | |
193 v3->uPartySectorID = v7; | |
194 if ( !v7 ) | |
195 { | |
196 v8 = v3->vPartyPos.z; | |
197 v3->vPartyPos.x = pParty->vPosition.x; | |
198 v9 = pParty->vPosition.y; | |
199 v10 = v3->vPartyPos.x; | |
200 v3->vPartyPos.y = pParty->vPosition.y; | |
201 v3->uPartySectorID = pIndoor->GetSector(v10, v9, v8); | |
202 } | |
203 if ( pRenderer->pRenderD3D ) | |
204 { | |
323 | 205 v3->sCosineY = stru_5C6E00->Cos(v3->sPartyRotY); |
206 v3->sSineY = stru_5C6E00->Sin(v3->sPartyRotY); | |
207 v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX); | |
208 v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX); | |
0 | 209 v3->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); |
210 v3->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); | |
211 v3->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125); | |
212 v3->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125); | |
213 v3->field_64 = a2->field_3C; | |
214 v11 = v3->uViewportW; | |
215 v12 = v3->uViewportX; | |
216 v13 = v3->uViewportZ - v12; | |
217 v14 = v3->uViewportZ + v12; | |
218 v3->field_70 = v13 + 1; | |
219 v15 = v3->uViewportY; | |
220 v3->uViewportHeight = v11 - v15 + 1; | |
221 v16 = v3->uViewportW; | |
222 v3->uViewportCenterX = v14 >> 1; | |
223 v3->uViewportCenterY = (signed int)(v16 + v15) >> 1; | |
224 } | |
225 else | |
226 { | |
323 | 227 v3->sCosineY = stru_5C6E00->Cos(-v3->sPartyRotY); |
228 v3->sSineY = stru_5C6E00->Sin(-v3->sPartyRotY); | |
229 v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX); | |
230 v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX); | |
0 | 231 v17 = cos((double)-v3->sPartyRotY * 0.0030664064); |
232 v18 = v3->sPartyRotY; | |
233 v3->fCosineY = v17; | |
234 v19 = sin((double)-v18 * 0.0030664064); | |
235 v20 = v3->sPartyRotX; | |
236 v3->fSineY = v19; | |
237 v21 = cos((double)-v20 * 0.0030664064); | |
238 v22 = v3->sPartyRotX; | |
239 v3->fCosineNegX = v21; | |
240 v3->fSineNegX = sin((double)-v22 * 0.0030664064); | |
241 v23 = v3->uViewportX; | |
242 v3->field_64 = a2->field_3C; | |
243 v24 = v3->uViewportZ; | |
244 v3->field_70 = v3->uViewportZ - v23 + 1; | |
245 v25 = v3->uViewportW - v3->uViewportY + 1; | |
246 v3->uViewportHeight = v25; | |
247 v29 = v25; | |
248 v26 = v3->field_64; | |
249 v3->uViewportCenterX = (signed int)(v24 + v23) >> 1; | |
250 v3->uViewportCenterY = v3->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16); | |
251 } | |
252 v27 = (unsigned int)(signed __int64)((double)v3->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329) | |
253 + 0.5) << 16; | |
254 v3->field_40 = v27; | |
255 LODWORD(v3->field_44) = 4294967296i64 / v27; | |
256 v3->pRenderTarget = v2->pRenderTarget; | |
257 v3->uTargetWidth = v2->uTargetWidth; | |
258 v3->uTargetHeight = v2->uTargetHeight; | |
259 v3->uViewportX = v2->uViewportX; | |
260 v3->uViewportY = v2->uViewportY; | |
261 v3->uViewportZ = v2->uViewportZ; | |
262 v3->uViewportW = v2->uViewportW; | |
263 v3->pTargetZBuffer = v2->pTargetZ; | |
264 result = 0; | |
265 v3->field_8C = 0; | |
266 v3->field_84 = 0; | |
267 v3->uNumFacesRenderedThisFrame = 0; | |
268 v3->field_88 = 0; | |
269 pBLVRenderParams->field_90 = 64; | |
270 pBLVRenderParams->field_94 = 6; | |
271 return result; | |
272 } | |
273 | |
274 //----- (00440B44) -------------------------------------------------------- | |
275 void IndoorLocation::ExecDraw(bool bD3D) | |
276 { | |
277 int v2; // eax@3 | |
795 | 278 //IndoorCameraD3D_Vec4 *v3; // edx@4 |
279 //unsigned int v5; // ecx@9 | |
280 //RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4 | |
0 | 281 |
282 if (bD3D) | |
283 { | |
284 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
|
285 for (uint i = 0; i < pBspRenderer->num_faces; ++i) |
0 | 286 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
287 v2 = pBspRenderer->faces[i].uNodeID; |
795 | 288 if (pBspRenderer->nodes[v2].viewing_portal_id == -1) |
289 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, nullptr, 4, nullptr); | |
0 | 290 else |
795 | 291 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[v2].std__vector_0007AC, 4, pBspRenderer->nodes[v2].pPortalBounding); |
0 | 292 } |
293 } | |
795 | 294 else for (uint j = 0; j < pBspRenderer->num_faces; ++j ) |
0 | 295 { |
795 | 296 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].field_C; |
297 IndoorLocation::ExecDraw_sw(pBspRenderer->faces[j].uFaceID); | |
0 | 298 } |
299 } | |
300 | |
301 //----- (00440BED) -------------------------------------------------------- | |
302 void __fastcall sub_440BED(IndoorLocation_drawstru *_this) | |
303 { | |
304 unsigned __int16 *v1; // edi@7 | |
305 char *v2; // esi@8 | |
306 int v3; // ecx@9 | |
307 unsigned int v4; // edx@9 | |
308 char *v5; // eax@10 | |
309 signed int v6; // [sp+8h] [bp-8h]@7 | |
310 int v7; // [sp+Ch] [bp-4h]@8 | |
311 | |
312 PrepareDrawLists_BLV(_this); | |
313 if (pBLVRenderParams->uPartySectorID) | |
314 IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0); | |
315 pRenderer->DrawBillboardList_BLV(); | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
316 |
0 | 317 if ( !pRenderer->pRenderD3D ) |
318 { | |
486 | 319 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_D3D_OUTLINES) |
320 pBspRenderer->DrawFaceOutlines(); | |
321 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES) | |
0 | 322 { |
323 v1 = pBLVRenderParams->pRenderTarget; | |
324 v6 = 0; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
325 if ( (signed int)pBspRenderer->num_nodes > 0 ) |
0 | 326 { |
327 v7 = 0; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
328 v2 = (char *)&pBspRenderer->nodes[0].field_C._viewport_space_w; |
0 | 329 do |
330 { | |
331 v3 = *((int *)v2 - 1); | |
332 v4 = pRenderer->uTargetSurfacePitch * *((int *)v2 - 1); | |
333 if ( v3 <= *(int *)v2 ) | |
334 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
335 v5 = (char *)&pBspRenderer->nodes[0].field_C.array_3D8[v3 + v7]; |
0 | 336 do |
337 { | |
338 v1[v4 + *((short *)v5 - 480)] = 255; | |
339 ++v3; | |
340 v1[v4 + *(short *)v5] = 255; | |
341 v4 += pRenderer->uTargetSurfacePitch; | |
342 v5 += 2; | |
343 } | |
344 while ( v3 <= *(int *)v2 ); | |
345 } | |
346 ++v6; | |
347 v7 += 1126; | |
348 v2 += 2252; | |
349 } | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
350 while ( v6 < (signed int)pBspRenderer->num_nodes ); |
0 | 351 } |
352 } | |
353 } | |
354 } | |
355 | |
356 | |
357 | |
358 | |
359 | |
360 //----- (00441BD4) -------------------------------------------------------- | |
361 void IndoorLocation::Draw() | |
362 { | |
186 | 363 //int v0; // eax@1 |
0 | 364 IndoorLocation_drawstru _this; // [sp+0h] [bp-4Ch]@5 |
365 int v2; // [sp+44h] [bp-8h]@5 | |
366 int v3; // [sp+48h] [bp-4h]@5 | |
367 | |
186 | 368 _this.uFlags = 0; |
369 if (viewparams->draw_sw_outlines) | |
370 _this.uFlags |= INDOOR_CAMERA_DRAW_SW_OUTLINES; | |
371 if (viewparams->draw_d3d_outlines) | |
372 _this.uFlags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; | |
373 | |
791 | 374 _this.uFlags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; |
375 _this.uFlags |= INDOOR_CAMERA_DRAW_SW_OUTLINES; | |
376 //INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES | |
377 | |
0 | 378 _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; |
379 _this.field_1C_mb_fov = 65; | |
871 | 380 _this.vPosition.x = pParty->vPosition.x - fixpoint_sub0(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity); |
381 _this.vPosition.y = pParty->vPosition.y - fixpoint_sub0(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity); | |
581 | 382 _this.vPosition.z = pParty->vPosition.z + pParty->sEyelevel; |
383 _this.sRotationX = pParty->sRotationX; | |
0 | 384 _this.sRotationY = pParty->sRotationY; |
385 _this.pRenderTarget = pRenderer->pTargetSurface; | |
692 | 386 _this.uViewportX = pViewport->uScreen_TL_X; |
387 _this.uViewportY = pViewport->uScreen_TL_Y; | |
388 _this.uViewportZ = pViewport->uScreen_BR_X; | |
389 _this.uViewportW = pViewport->uScreen_BR_Y; | |
0 | 390 _this.field_3C = pViewport->field_30; |
581 | 391 |
0 | 392 _this.uTargetWidth = 640; |
393 _this.uTargetHeight = 480; | |
394 _this.pTargetZ = pRenderer->pActiveZBuffer; | |
395 sub_440BED(&_this); | |
569 | 396 pParty->uFlags &= ~2; |
0 | 397 pGame->DrawParticles(); |
398 array_5118E8._440F07(); | |
399 } | |
400 | |
401 //----- (004C0EF2) -------------------------------------------------------- | |
402 void BLVFace::FromODM(ODMFace *a2) | |
403 { | |
404 this->pFacePlane_old.vNormal.x = a2->pFacePlane.vNormal.x; | |
405 this->pFacePlane_old.vNormal.y = a2->pFacePlane.vNormal.y; | |
406 this->pFacePlane_old.vNormal.z = a2->pFacePlane.vNormal.z; | |
407 this->pFacePlane_old.dist = a2->pFacePlane.dist; | |
408 this->pFacePlane.vNormal.x = (double)(a2->pFacePlane.vNormal.x & 0xFFFF) * 0.000015259022 | |
409 + (double)(a2->pFacePlane.vNormal.x >> 16); | |
410 this->pFacePlane.vNormal.y = (double)(a2->pFacePlane.vNormal.y & 0xFFFF) * 0.000015259022 | |
411 + (double)(a2->pFacePlane.vNormal.y >> 16); | |
412 this->pFacePlane.vNormal.z = (double)(a2->pFacePlane.vNormal.z & 0xFFFF) * 0.000015259022 | |
413 + (double)(a2->pFacePlane.vNormal.z >> 16); | |
414 this->pFacePlane.dist = (double)(a2->pFacePlane.dist & 0xFFFF) * 0.000015259022 + (double)(a2->pFacePlane.dist >> 16); | |
415 this->uAttributes = a2->uAttributes; | |
416 this->pBounding.x1 = a2->pBoundingBox.x1; | |
417 this->pBounding.y1 = a2->pBoundingBox.y1; | |
418 this->pBounding.z1 = a2->pBoundingBox.z1; | |
419 this->pBounding.x2 = a2->pBoundingBox.x2; | |
420 this->pBounding.y2 = a2->pBoundingBox.y2; | |
421 this->pBounding.z2 = a2->pBoundingBox.z2; | |
422 this->zCalc1 = a2->zCalc1; | |
423 this->zCalc2 = a2->zCalc2; | |
424 this->zCalc3 = a2->zCalc3; | |
425 this->pXInterceptDisplacements = a2->pXInterceptDisplacements; | |
426 this->pYInterceptDisplacements = a2->pYInterceptDisplacements; | |
427 this->pZInterceptDisplacements = a2->pZInterceptDisplacements; | |
428 this->uPolygonType = (PolygonType)a2->uPolygonType; | |
429 this->uNumVertices = a2->uNumVertices; | |
430 this->uBitmapID = a2->uTextureID; | |
431 this->pVertexIDs = a2->pVertexIDs; | |
432 } | |
433 | |
434 //----- (004B0A25) -------------------------------------------------------- | |
794 | 435 void IndoorLocation::ExecDraw_d3d(unsigned int uFaceID, IndoorCameraD3D_Vec4 *pVertices, unsigned int uNumVertices, RenderVertexSoft *pPortalBounding) |
0 | 436 { |
437 //unsigned int v4; // esi@1 | |
438 char *v5; // eax@4 | |
439 signed int v6; // ecx@4 | |
440 char *v7; // eax@8 | |
441 signed int v8; // ecx@8 | |
442 //BLVFace *v9; // esi@13 | |
443 //IndoorCameraD3D *v10; // edi@16 | |
444 //int v11; // ebx@17 | |
445 //Vec3_short_ *v12; // ecx@18 | |
446 //char *v13; // edx@18 | |
447 //int v14; // eax@19 | |
448 //unsigned __int8 v15; // sf@19 | |
449 //unsigned __int8 v16; // of@19 | |
450 int v17; // ebx@25 | |
451 //double v18; // st7@27 | |
452 //double v19; // st6@27 | |
453 //double v20; // st5@27 | |
454 //char v21; // dl@27 | |
455 //unsigned int v22; // eax@44 | |
456 unsigned int v23; // eax@35 | |
457 //DWORD v24; // eax@37 | |
458 //int v25; // eax@38 | |
459 //char *v26; // edi@38 | |
460 IDirect3DTexture2 *v27; // eax@42 | |
461 Texture *v28; // [sp+Ch] [bp-1Ch]@15 | |
462 //int i; // [sp+10h] [bp-18h]@38 | |
463 //LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16 | |
464 //IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16 | |
465 //IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1 | |
466 //unsigned int uFaceID_; // [sp+20h] [bp-8h]@1 | |
467 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17 | |
468 int a4a; // [sp+34h] [bp+Ch]@25 | |
469 //unsigned int a4b; // [sp+34h] [bp+Ch]@38 | |
470 | |
471 //v4 = uFaceID; | |
472 //a7 = pVertices; | |
473 //uFaceID_ = uFaceID; | |
474 if (uFaceID >= pIndoor->uNumFaces) | |
475 return; | |
476 | |
477 static RenderVertexSoft static_vertices_F7C228[64]; | |
478 static RenderVertexSoft static_vertices_F7B628[64]; | |
479 static stru154 stru_F7B60C; // idb | |
480 | |
481 //v9 = &pIndoor->pFaces[uFaceID]; | |
482 auto pFace = &pIndoor->pFaces[uFaceID]; | |
483 if (pFace->uNumVertices < 3) | |
484 return; | |
485 | |
486 | |
487 if (pFace->Invisible()) | |
488 return; | |
489 | |
490 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
491 pFace->uAttributes |= 0x80u; | |
492 | |
493 if (!pFace->GetTexture()) | |
494 return; | |
495 | |
496 v28 = pFace->GetTexture(); | |
497 | |
498 if (!pGame->pIndoorCameraD3D->IsCulled(pFace)) | |
499 { | |
500 uNumVerticesa = pFace->uNumVertices; | |
501 for (uint i = 0; i < pFace->uNumVertices; ++i) | |
502 { | |
503 static_vertices_F7C228[i].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[i]].x; | |
504 static_vertices_F7C228[i].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[i]].y; | |
505 static_vertices_F7C228[i].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[i]].z; | |
506 static_vertices_F7C228[i].u = (signed short)pFace->pVertexUIDs[i]; | |
507 static_vertices_F7C228[i].v = (signed short)pFace->pVertexVIDs[i]; | |
508 } | |
509 | |
510 if (!pVertices || | |
794 | 511 (pGame->pStru9Instance->_498377(pPortalBounding, 4u, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) ) |
0 | 512 { |
795 | 513 if (pGame->pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa, |
581 | 514 static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa ) |
0 | 515 { |
516 a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel); | |
517 v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8); | |
518 sub_4B0E07(uFaceID); | |
519 pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID); | |
520 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID); | |
521 pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); | |
522 pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0); | |
523 pGame->pLightmapBuilder->std__vector_000004_size = 0; | |
524 if (stru_F8AD28.uNumLightsApplied > 0 || | |
525 pDecalBuilder->uNumDecals > 0) | |
526 { | |
527 stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x; | |
528 stru_F7B60C.polygonType = pFace->uPolygonType; | |
529 stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y; | |
530 stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z; | |
531 stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist; | |
532 } | |
533 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
534 if (stru_F8AD28.uNumLightsApplied > 0 && !(pFace->uAttributes & FACE_DO_NOT_LIGHT)) |
581 | 535 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0); |
0 | 536 |
537 if (pDecalBuilder->uNumDecals > 0) | |
581 | 538 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID); |
0 | 539 |
791 | 540 if (pFace->Fluid()) |
0 | 541 { |
831 | 542 if (pFace->uBitmapID == pRenderer->hd_water_tile_id) |
543 { | |
544 v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; | |
545 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | |
546 } | |
805 | 547 else |
831 | 548 { |
549 //auto v24 = GetTickCount() / 4; | |
550 //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi; | |
551 uint eightSeconds = GetTickCount() % 8000; | |
552 float angle = (eightSeconds / 8000.0f) * 2 * 3.1415f; | |
553 | |
554 //animte lava back and forth | |
555 for (uint i = 0; i < uNumVerticesa; ++i) | |
556 //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8)); | |
557 array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle); | |
558 v23 = pFace->uBitmapID; | |
559 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | |
560 } | |
0 | 561 } |
595 | 562 else if (pFace->uAttributes & 0x4000) |
0 | 563 { |
581 | 564 v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_); |
565 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | |
0 | 566 } |
831 | 567 else |
568 { | |
569 v17 = 0xFFD0D0D0; | |
570 v23 = pFace->uBitmapID; | |
571 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | |
572 } | |
573 | |
805 | 574 if (pFace->uAttributes & FACE_DO_NOT_LIGHT) |
575 _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); | |
576 else | |
831 | 577 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0); |
578 return; | |
0 | 579 } |
580 } | |
581 } | |
582 } | |
583 | |
584 //----- (004AFF79) -------------------------------------------------------- | |
585 void IndoorLocation::ExecDraw_sw(unsigned int uFaceID) | |
586 { | |
587 unsigned int v1; // ebx@1 | |
588 BLVFace *v2; // esi@3 | |
589 unsigned int v3; // eax@3 | |
590 Texture *v4; // eax@8 | |
591 Texture *v5; // edi@8 | |
592 int v6; // eax@9 | |
593 int v7; // eax@9 | |
594 int v8; // ecx@17 | |
595 int v9; // ebx@17 | |
596 int v10; // eax@17 | |
597 int v11; // esi@17 | |
598 unsigned int v12; // eax@17 | |
599 int j; // ecx@19 | |
600 int v14; // edx@20 | |
601 int v15; // eax@20 | |
602 int v16; // edx@20 | |
603 int i; // ebx@22 | |
604 int v18; // ecx@23 | |
605 int v19; // eax@23 | |
606 int v20; // eax@23 | |
607 int v21; // eax@24 | |
608 unsigned __int8 *v22; // ecx@24 | |
609 int v23; // ebx@24 | |
610 int v24; // esi@25 | |
611 int v25; // eax@28 | |
612 unsigned __int16 *v26; // eax@28 | |
613 unsigned int v27; // eax@29 | |
614 int v28; // eax@30 | |
615 char *v29; // esi@31 | |
616 int v30; // eax@33 | |
617 int v31; // eax@33 | |
618 int v32; // eax@35 | |
619 int v33; // edx@35 | |
620 signed int v34; // ebx@35 | |
621 int v35; // eax@35 | |
622 int v36; // ebx@35 | |
623 signed int v37; // ebx@35 | |
624 signed int v38; // edi@35 | |
625 unsigned int v39; // edi@36 | |
626 int v40; // edx@40 | |
627 int v41; // ecx@40 | |
628 signed int v42; // edx@40 | |
629 int v43; // edx@42 | |
630 int v44; // eax@42 | |
631 unsigned __int16 *v45; // eax@43 | |
632 int *v46; // esi@44 | |
633 unsigned __int16 *v47; // edi@44 | |
634 unsigned int v48; // edx@44 | |
635 int v49; // ebx@44 | |
636 char v50; // cl@44 | |
637 char v51; // ch@44 | |
638 unsigned int v52; // ebx@46 | |
639 int v53; // edx@46 | |
640 unsigned int v54; // ebx@46 | |
641 int v55; // edx@46 | |
642 unsigned int v56; // ebx@47 | |
643 int v57; // edx@47 | |
644 int v58; // ebx@47 | |
645 int v59; // edx@47 | |
646 unsigned __int16 *v60; // eax@50 | |
647 int *v61; // esi@51 | |
648 unsigned __int16 *v62; // edi@51 | |
649 unsigned int v63; // edx@51 | |
650 int v64; // ebx@51 | |
651 char v65; // cl@51 | |
652 char v66; // ch@51 | |
653 unsigned int v67; // ebx@53 | |
654 int v68; // edx@53 | |
655 unsigned int v69; // ebx@53 | |
656 int v70; // edx@53 | |
657 unsigned int v71; // ebx@54 | |
658 int v72; // edx@54 | |
659 int v73; // ebx@54 | |
660 int v74; // edx@54 | |
661 unsigned __int16 *v75; // eax@58 | |
662 int *v76; // esi@59 | |
663 int v77; // edi@59 | |
664 unsigned int v78; // edx@59 | |
665 int v79; // ebx@59 | |
666 char v80; // cl@59 | |
667 char v81; // ch@59 | |
668 int v82; // ebx@61 | |
669 int v83; // edx@61 | |
670 unsigned int v84; // ebx@62 | |
671 int v85; // edx@62 | |
672 unsigned __int16 *v86; // eax@65 | |
673 int *v87; // esi@66 | |
674 int v88; // edi@66 | |
675 unsigned int v89; // edx@66 | |
676 int v90; // ebx@66 | |
677 char v91; // cl@66 | |
678 char v92; // ch@66 | |
679 int v93; // ebx@68 | |
680 int v94; // edx@68 | |
681 unsigned __int16 v95; // bx@69 | |
682 int v96; // edx@69 | |
683 unsigned __int8 *v97; // [sp+Ch] [bp-9Ch]@24 | |
684 unsigned __int8 *v98; // [sp+10h] [bp-98h]@24 | |
685 unsigned __int8 *v99; // [sp+14h] [bp-94h]@24 | |
686 unsigned __int8 *v100; // [sp+18h] [bp-90h]@24 | |
687 int v101; // [sp+1Ch] [bp-8Ch]@40 | |
688 int v102; // [sp+20h] [bp-88h]@31 | |
689 BLVFace *v103; // [sp+24h] [bp-84h]@3 | |
690 unsigned __int16 *v104; // [sp+28h] [bp-80h]@24 | |
691 int v105; // [sp+2Ch] [bp-7Ch]@30 | |
692 int v106; // [sp+30h] [bp-78h]@24 | |
693 int v107; // [sp+34h] [bp-74h]@9 | |
694 Texture *v108; // [sp+38h] [bp-70h]@8 | |
695 int v109; // [sp+3Ch] [bp-6Ch]@9 | |
696 unsigned int v110; // [sp+40h] [bp-68h]@24 | |
697 unsigned int v111; // [sp+44h] [bp-64h]@1 | |
698 int *k; // [sp+48h] [bp-60h]@31 | |
699 int v113; // [sp+4Ch] [bp-5Ch]@35 | |
700 int v114; // [sp+50h] [bp-58h]@35 | |
701 int v115; // [sp+54h] [bp-54h]@42 | |
702 unsigned __int8 *v116; // [sp+58h] [bp-50h]@35 | |
703 int v117; // [sp+5Ch] [bp-4Ch]@33 | |
704 int a1; // [sp+60h] [bp-48h]@27 | |
705 int v119; // [sp+64h] [bp-44h]@17 | |
706 int v120; // [sp+68h] [bp-40h]@23 | |
707 unsigned int v121; // [sp+6Ch] [bp-3Ch]@40 | |
708 unsigned int v122; // [sp+70h] [bp-38h]@35 | |
709 int v123; // [sp+74h] [bp-34h]@30 | |
710 int v124; // [sp+78h] [bp-30h]@17 | |
711 int v125; // [sp+7Ch] [bp-2Ch]@35 | |
712 unsigned int v126; // [sp+80h] [bp-28h]@9 | |
713 int v127; // [sp+84h] [bp-24h]@17 | |
714 int v128; // [sp+88h] [bp-20h]@9 | |
715 int *pZPixel; // [sp+8Ch] [bp-1Ch]@28 | |
716 int a2; // [sp+90h] [bp-18h]@16 | |
717 unsigned int v131; // [sp+94h] [bp-14h]@17 | |
718 unsigned __int16 *pColorPixel; // [sp+98h] [bp-10h]@28 | |
719 int v133; // [sp+9Ch] [bp-Ch]@17 | |
720 int v134; // [sp+A0h] [bp-8h]@17 | |
721 int v135; // [sp+A4h] [bp-4h]@24 | |
722 | |
723 v1 = uFaceID; | |
724 v111 = pRenderer->uTargetSurfacePitch; | |
725 if ( (uFaceID & 0x80000000u) == 0 ) | |
726 { | |
727 if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) | |
728 { | |
729 v2 = &pIndoor->pFaces[uFaceID]; | |
730 v103 = v2; | |
731 v3 = v2->uAttributes; | |
732 if ( !(BYTE1(v3) & 0x20) ) | |
733 { | |
734 if ( v3 & 0x400000 ) | |
735 { | |
736 sub_4ADD1D(uFaceID); | |
737 return; | |
738 } | |
739 if ( !(v3 & 0x10) || (sub_4AD504(uFaceID), pRenderer->pRenderD3D) ) | |
740 { | |
741 v4 = v2->GetTexture(); | |
742 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
743 v5 = v4; | |
744 v108 = v4; | |
745 if ( v4 ) | |
746 { | |
747 v6 = v4->palette_id2; | |
748 LOBYTE(v2->uAttributes) |= 0x80u; | |
749 v109 = v6; | |
750 sub_4AE5F1(v1); | |
751 v126 = stru_F8AD28.pDeltaUV[0]; | |
752 v128 = stru_F8AD28.pDeltaUV[1]; | |
753 v107 = bUseLoResSprites; | |
754 v7 = sub_423B5D(v1); | |
755 if ( v7 ) | |
756 { | |
757 if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | |
758 { | |
759 if ( v2->uPolygonType == 1 ) | |
760 { | |
761 for ( i = 0; i < stru_F8AD28.uNumLightsApplied; stru_F8AD28._blv_lights_ys[v18] = v20 ) | |
762 { | |
763 v18 = i; | |
764 v120 = stru_F8AD28._blv_lights_xs[i]; | |
765 v134 = (unsigned __int64)(v120 * (signed __int64)-stru_F8AD28.plane_4.vNormal.y) >> 16; | |
766 v133 = stru_F8AD28.plane_4.vNormal.x; | |
767 v120 = stru_F8AD28._blv_lights_ys[i]; | |
768 v133 = (unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16; | |
769 v19 = v128; | |
770 stru_F8AD28._blv_lights_xs[i] = v126 | |
771 + v134 | |
772 + ((unsigned __int64)(v120 | |
773 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16); | |
774 v20 = v19 - stru_F8AD28._blv_lights_zs[i++]; | |
775 } | |
776 } | |
777 else | |
778 { | |
779 if ( v2->uPolygonType != 3 ) | |
780 { | |
781 if ( v2->uPolygonType == 4 ) | |
782 { | |
783 LABEL_16: | |
784 a2 = 0; | |
785 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
786 { | |
787 do | |
788 { | |
789 v8 = a2; | |
790 v9 = stru_F8AD28._blv_lights_xs[a2]; | |
791 v131 = stru_F8AD28._blv_lights_ys[a2]; | |
792 v10 = stru_F8AD28._blv_lights_zs[a2]; | |
793 v11 = (signed int)(v10 * stru_F8AD28.plane_4.vNormal.z | |
794 + stru_F8AD28.plane_4.dist | |
795 + v9 * stru_F8AD28.plane_4.vNormal.x | |
796 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16; | |
797 v119 = v9 | |
798 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
799 * (signed __int64)((signed int)(v10 * stru_F8AD28.plane_4.vNormal.z | |
800 + stru_F8AD28.plane_4.dist | |
801 + v9 * stru_F8AD28.plane_4.vNormal.x | |
802 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16)) >> 16); | |
803 v131 -= (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)v11) >> 16; | |
804 v127 = v10 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)v11) >> 16); | |
805 stru_F8AD28._blv_lights_xs[a2] = ((unsigned __int64)(v119 | |
806 * (signed __int64)stru_F8AD28.vec_14.x) >> 16) | |
807 + ((unsigned __int64)((signed int)v131 | |
808 * (signed __int64)stru_F8AD28.vec_14.y) >> 16); | |
809 v124 = (unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_20.x) >> 16; | |
810 v134 = (unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16; | |
811 v133 = (unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16; | |
812 v12 = v126; | |
813 stru_F8AD28._blv_lights_ys[v8] = v124 | |
814 + ((unsigned __int64)((signed int)v131 | |
815 * (signed __int64)stru_F8AD28.vec_20.y) >> 16) | |
816 + ((unsigned __int64)(v127 | |
817 * (signed __int64)stru_F8AD28.vec_20.z) >> 16); | |
818 stru_F8AD28._blv_lights_xs[v8] += v12; | |
819 stru_F8AD28._blv_lights_ys[v8] += v128; | |
820 ++a2; | |
821 } | |
822 while ( a2 < stru_F8AD28.uNumLightsApplied ); | |
823 v2 = v103; | |
824 } | |
825 goto LABEL_24; | |
826 } | |
827 if ( v2->uPolygonType != 5 ) | |
828 { | |
829 if ( v2->uPolygonType != 6 ) | |
830 goto LABEL_24; | |
831 goto LABEL_16; | |
832 } | |
833 } | |
834 for ( j = 0; j < stru_F8AD28.uNumLightsApplied; *(int *)v15 = v16 ) | |
835 { | |
836 v14 = v128; | |
837 stru_F8AD28._blv_lights_xs[j] += v126; | |
838 v15 = 4 * j + 16297672; | |
839 v16 = v14 - stru_F8AD28._blv_lights_ys[j++]; | |
840 } | |
841 } | |
842 LABEL_24: | |
843 v135 = 1; | |
844 pGame->_44ED0A(v2, &v135, 31); | |
845 v104 = sr_sub_47C24C_get_palette(v2, v109, 0, 1); | |
846 v134 = stru_F8AD28.field_44; | |
847 v106 = stru_F8AD28.field_48; | |
848 v21 = stru_F8A590._viewport_space_y; | |
849 a2 = stru_F8A590._viewport_space_y; | |
850 v110 = v111 * stru_F8A590._viewport_space_y; | |
710 | 851 v97 = v5->pLevelOfDetail0_prolly_alpha_mask; |
0 | 852 v98 = v5->pLevelOfDetail1; |
853 v99 = v5->pLevelOfDetail2; | |
854 v22 = v5->pLevelOfDetail3; | |
855 v23 = 640 * stru_F8A590._viewport_space_y; | |
856 v119 = 640 * stru_F8A590._viewport_space_y; | |
857 v100 = v22; | |
858 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
859 { | |
860 v24 = 2 * stru_F8A590._viewport_space_y; | |
861 v120 = 2 * stru_F8A590._viewport_space_y; | |
862 while ( 1 ) | |
863 { | |
864 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v24); | |
865 sub_4AE313(a1, v21, &stru_F81018.field_0); | |
866 if ( LOBYTE(viewparams->field_20) ) | |
867 { | |
868 v27 = v111 * (v24 - pBLVRenderParams->uViewportY); | |
869 pZPixel = &pBLVRenderParams->pTargetZBuffer[2 | |
870 * (*(__int16 *)((char *)stru_F8A590.array_18 + v24) | |
871 + 320 * (v24 - pBLVRenderParams->uViewportY)) | |
872 - pBLVRenderParams->uViewportX]; | |
873 pColorPixel = &pBLVRenderParams->pRenderTarget[v27 | |
874 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v24) | |
875 - pBLVRenderParams->uViewportX]; | |
876 v26 = &pBLVRenderParams->pRenderTarget[v27 | |
877 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v24) | |
878 - pBLVRenderParams->uViewportX]; | |
879 v23 = v119; | |
880 } | |
881 else | |
882 { | |
883 v25 = *(__int16 *)((char *)stru_F8A590.array_18 + v24); | |
884 pZPixel = &pBLVRenderParams->pTargetZBuffer[v25 + v23]; | |
885 pColorPixel = &pBLVRenderParams->pRenderTarget[v25 + v110]; | |
886 v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v24)]; | |
887 } | |
888 v131 = (unsigned int)v26; | |
889 HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0); | |
890 LOWORD(v28) = 0; | |
891 v105 = stru_F8AD28.field_0 | v28; | |
892 v123 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
893 if ( (unsigned int)pColorPixel < v131 ) | |
894 { | |
895 v102 = v107 + v106; | |
896 v29 = (char *)&stru_F81018.field_34.field_8; | |
897 a1 += v134; | |
898 for ( k = &stru_F81018.field_34.field_8; ; v29 = (char *)k ) | |
899 { | |
900 sub_4AE313(a1, a2, (stru337_stru0 *)(v29 - 8)); | |
901 v30 = *((int *)v29 - 2); | |
902 LOWORD(v30) = 0; | |
903 v117 = v105; | |
904 v31 = stru_F8AD28.field_0 | v30; | |
905 if ( v105 <= (unsigned int)v31 ) | |
906 v117 = v31; | |
907 v105 = v31; | |
908 v32 = *((int *)v29 - 14); | |
909 v122 = *((int *)v29 - 14) >> v107; | |
910 v33 = *((int *)v29 - 13); | |
911 v125 = *((int *)v29 - 13) >> v107; | |
912 v34 = *((int *)v29 - 1) - v32; | |
913 v113 = (*(int *)v29 - v33) >> v102; | |
914 v35 = *((int *)v29 - 11); | |
915 v114 = v34 >> v102; | |
916 v116 = (&v97)[4 * v35]; | |
917 v36 = v35 + 16 - v5->uWidthLn2; | |
918 v133 = v35 + 16; | |
919 v127 = v35 + v36; | |
920 v37 = v5->uWidthMinus1 >> v35; | |
921 v38 = v5->uHeightMinus1 >> v35 << (v35 + 16); | |
922 v128 = v37; | |
923 v126 = v38; | |
924 v39 = (unsigned int)(LOBYTE(viewparams->field_20) ? &pColorPixel[2 * v134] : &pColorPixel[v134]); | |
925 if ( v39 > v131 ) | |
926 v39 = v131; | |
927 v40 = *((short *)v29 + 1); | |
928 v41 = *((short *)v29 - 1); | |
929 v121 = v39; | |
930 v42 = sub_4AE491(v41, v40); | |
931 v101 = v42; | |
932 v124 = (signed int)(v39 - (int)pColorPixel) >> 1; | |
933 if ( v123 >> 16 == v42 >> 16 || v135 & 2 ) | |
934 { | |
935 v123 = (int)sr_sub_47C24C_get_palette(v103, v109, v123 >> 16, 1); | |
936 if ( LOBYTE(viewparams->field_20) ) | |
937 { | |
938 v86 = pColorPixel; | |
939 if ( (unsigned int)pColorPixel < v121 ) | |
940 { | |
941 v87 = pZPixel; | |
942 v88 = v123; | |
943 v89 = v122; | |
944 v90 = v125; | |
945 v91 = v133; | |
946 v92 = v127; | |
947 if ( v124 & 2 ) | |
948 { | |
949 *pZPixel = v117; | |
950 v87 -= 2; | |
951 v86 = pColorPixel + 2; | |
952 goto LABEL_69; | |
953 } | |
954 do | |
955 { | |
956 v86 += 4; | |
957 v93 = *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92)); | |
958 v94 = v117; | |
959 LOWORD(v93) = *(short *)(v88 + 2 * v93); | |
960 *v87 = v117; | |
961 v87[1] = v94; | |
962 v87[640] = v94; | |
963 v87[641] = v94; | |
964 *(v86 - 4) = v93; | |
965 *(v86 - 3) = v93; | |
966 v86[636] = v93; | |
967 v86[637] = v93; | |
968 v87[2] = v94; | |
969 v87[3] = v94; | |
970 v87[642] = v94; | |
971 v87[643] = v94; | |
972 v122 += v114; | |
973 v125 += v113; | |
974 v89 = v122; | |
975 v90 = v125; | |
976 LABEL_69: | |
977 v87 += 4; | |
978 v95 = *(short *)(v88 + 2 * *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92))); | |
979 v96 = v114; | |
980 *(v86 - 2) = v95; | |
981 *(v86 - 1) = v95; | |
982 v86[638] = v95; | |
983 v86[639] = v95; | |
984 v122 += v96; | |
985 v125 += v113; | |
986 v89 = v122; | |
987 v90 = v125; | |
988 } | |
989 while ( (unsigned int)v86 < v121 ); | |
990 pColorPixel = v86; | |
991 pZPixel = v87; | |
992 } | |
993 } | |
994 else | |
995 { | |
996 v75 = pColorPixel; | |
997 if ( (unsigned int)pColorPixel < v121 ) | |
998 { | |
999 v76 = pZPixel; | |
1000 v77 = v123; | |
1001 v78 = v122; | |
1002 v79 = v125; | |
1003 v80 = v133; | |
1004 v81 = v127; | |
1005 if ( v124 & 1 ) | |
1006 { | |
1007 *pZPixel = v117; | |
1008 --v76; | |
1009 v75 = pColorPixel + 1; | |
1010 goto LABEL_62; | |
1011 } | |
1012 do | |
1013 { | |
1014 v75 += 2; | |
1015 v82 = *(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); | |
1016 v83 = v117; | |
1017 LOWORD(v82) = *(short *)(v77 + 2 * v82); | |
1018 *v76 = v117; | |
1019 *(v75 - 2) = v82; | |
1020 v76[1] = v83; | |
1021 v122 += v114; | |
1022 v125 += v113; | |
1023 v78 = v122; | |
1024 v79 = v125; | |
1025 LABEL_62: | |
1026 v84 = (unsigned int)(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); | |
1027 v76 += 2; | |
1028 v85 = v114; | |
1029 *(v75 - 1) = *(short *)(v77 + 2 * *(char *)v84); | |
1030 v122 += v85; | |
1031 v125 += v113; | |
1032 v78 = v122; | |
1033 v79 = v125; | |
1034 } | |
1035 while ( (unsigned int)v75 < v121 ); | |
1036 pColorPixel = v75; | |
1037 pZPixel = v76; | |
1038 } | |
1039 } | |
1040 } | |
1041 else | |
1042 { | |
1043 v43 = (v42 - v123) >> v106; | |
1044 v44 = v123 - v43; | |
1045 v123 = v43; | |
1046 v115 = v44; | |
1047 if ( LOBYTE(viewparams->field_20) ) | |
1048 { | |
1049 v60 = pColorPixel; | |
1050 if ( (unsigned int)pColorPixel < v121 ) | |
1051 { | |
1052 v61 = pZPixel; | |
1053 v62 = v104; | |
1054 v63 = v122; | |
1055 v64 = v125; | |
1056 v65 = v133; | |
1057 v66 = v127; | |
1058 if ( v124 & 2 ) | |
1059 { | |
1060 *pZPixel = v117; | |
1061 v61 += 2; | |
1062 v60 = pColorPixel + 2; | |
1063 goto LABEL_54; | |
1064 } | |
1065 do | |
1066 { | |
1067 v67 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); | |
1068 v68 = v123 + v115; | |
1069 v60 += 4; | |
1070 v115 = v68; | |
1071 v69 = ((v68 & 0xFFFF0000u) >> 8) + v116[v67]; | |
1072 v70 = v117; | |
1073 LOWORD(v69) = v62[v69]; | |
1074 *v61 = v117; | |
1075 v61[1] = v70; | |
1076 v61[640] = v70; | |
1077 v61[641] = v70; | |
1078 *(v60 - 4) = v69; | |
1079 *(v60 - 3) = v69; | |
1080 v60[636] = v69; | |
1081 v60[637] = v69; | |
1082 v61[2] = v70; | |
1083 v61[3] = v70; | |
1084 v61[642] = v70; | |
1085 v61[643] = v70; | |
1086 v122 += v114; | |
1087 v125 += v113; | |
1088 v63 = v122; | |
1089 v64 = v125; | |
1090 v61 += 4; | |
1091 LABEL_54: | |
1092 v71 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); | |
1093 v72 = v123 + v115; | |
1094 v73 = v116[v71]; | |
1095 v115 = v72; | |
1096 LOWORD(v73) = v62[((v72 & 0xFFFF0000u) >> 8) + v73]; | |
1097 v74 = v114; | |
1098 *(v60 - 2) = v73; | |
1099 *(v60 - 1) = v73; | |
1100 v60[638] = v73; | |
1101 v60[639] = v73; | |
1102 v122 += v74; | |
1103 v125 += v113; | |
1104 v63 = v122; | |
1105 v64 = v125; | |
1106 } | |
1107 while ( (unsigned int)v60 < v121 ); | |
1108 pColorPixel = v60; | |
1109 pZPixel = v61; | |
1110 } | |
1111 } | |
1112 else | |
1113 { | |
1114 v45 = pColorPixel; | |
1115 if ( (unsigned int)pColorPixel < v121 ) | |
1116 { | |
1117 v46 = pZPixel; | |
1118 v47 = v104; | |
1119 v48 = v122; | |
1120 v49 = v125; | |
1121 v50 = v133; | |
1122 v51 = v127; | |
1123 if ( v124 & 1 ) | |
1124 { | |
1125 *pZPixel = v117; | |
1126 ++v46; | |
1127 v45 = pColorPixel + 1; | |
1128 goto LABEL_47; | |
1129 } | |
1130 do | |
1131 { | |
1132 v52 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); | |
1133 v53 = v123 + v115; | |
1134 v45 += 2; | |
1135 v115 = v53; | |
1136 v54 = ((v53 & 0xFFFF0000u) >> 8) + v116[v52]; | |
1137 v55 = v117; | |
1138 LOWORD(v54) = v47[v54]; | |
1139 *v46 = v117; | |
1140 *(v45 - 2) = v54; | |
1141 v46[1] = v55; | |
1142 v122 += v114; | |
1143 v125 += v113; | |
1144 v48 = v122; | |
1145 v49 = v125; | |
1146 v46 += 2; | |
1147 LABEL_47: | |
1148 v56 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); | |
1149 v57 = v123 + v115; | |
1150 v58 = v116[v56]; | |
1151 v115 = v57; | |
1152 LOWORD(v58) = v47[((v57 & 0xFFFF0000u) >> 8) + v58]; | |
1153 v59 = v114; | |
1154 *(v45 - 1) = v58; | |
1155 v122 += v59; | |
1156 v125 += v113; | |
1157 v48 = v122; | |
1158 v49 = v125; | |
1159 } | |
1160 while ( (unsigned int)v45 < v121 ); | |
1161 pColorPixel = v45; | |
1162 pZPixel = v46; | |
1163 } | |
1164 } | |
1165 } | |
1166 k += 13; | |
1167 v5 = v108; | |
1168 v123 = v101; | |
1169 a1 += v134; | |
1170 if ( (unsigned int)pColorPixel >= v131 ) | |
1171 break; | |
1172 } | |
1173 v23 = v119; | |
1174 v24 = v120; | |
1175 } | |
1176 ++a2; | |
1177 v110 += v111; | |
1178 v23 += 640; | |
1179 v24 += 2; | |
1180 v120 = v24; | |
1181 v119 = v23; | |
1182 if ( a2 > stru_F8A590._viewport_space_w ) | |
1183 break; | |
1184 v21 = a2; | |
1185 } | |
1186 } | |
1187 return; | |
1188 } | |
1189 } | |
1190 } | |
1191 } | |
1192 } | |
1193 } | |
1194 } | |
1195 } | |
1196 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
1197 | |
1198 | |
1199 | |
1200 //----- (004B0E07) -------------------------------------------------------- | |
1201 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) | |
1202 { | |
1203 BLVFace *v1; // edi@1 | |
1204 BLVFaceExtra *v2; // ecx@1 | |
1205 Texture *v3; // esi@1 | |
1206 unsigned int v4; // eax@1 | |
1207 unsigned int v5; // ecx@1 | |
1208 unsigned int result; // eax@1 | |
1209 unsigned int v7; // ecx@5 | |
1210 | |
1211 v1 = &pIndoor->pFaces[uFaceID]; | |
1212 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
945 | 1213 v3 = pBitmaps_LOD->GetTexture(v1->uBitmapID); |
0 | 1214 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; |
1215 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
1216 v4 = GetTickCount(); | |
1217 v5 = v1->uAttributes; | |
1218 result = v4 >> 3; | |
1219 if ( v5 & 4 ) | |
1220 { | |
1221 stru_F8AD28.pDeltaUV[1] -= result & v3->uHeightMinus1; | |
1222 } | |
1223 else | |
1224 { | |
1225 if ( v5 & 0x20 ) | |
1226 stru_F8AD28.pDeltaUV[1] += result & v3->uHeightMinus1; | |
1227 } | |
1228 v7 = v1->uAttributes; | |
1229 if ( BYTE1(v7) & 8 ) | |
1230 { | |
1231 stru_F8AD28.pDeltaUV[0] -= result & v3->uWidthMinus1; | |
1232 } | |
1233 else | |
1234 { | |
1235 if ( v7 & 0x40 ) | |
1236 stru_F8AD28.pDeltaUV[0] += result & v3->uWidthMinus1; | |
1237 } | |
1238 return result; | |
1239 } | |
1240 | |
1241 //----- (004B0EA8) -------------------------------------------------------- | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1242 void BspRenderer::AddFaceToRenderList_d3d(unsigned int node_id, unsigned int uFaceID) |
0 | 1243 { |
1244 //unsigned int v3; // edx@1 | |
1245 //stru170 *v4; // ebx@1 | |
1246 //BLVFace *v5; // eax@1 | |
1247 //int v6; // ecx@2 | |
1248 unsigned __int16 v7; // ax@11 | |
1249 Vec3_short_ *v8; // esi@15 | |
1250 int v9; // edx@15 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1251 //signed int v10; // eax@18 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1252 //signed int v11; // edi@19 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1253 //signed int v12; // ecx@19 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1254 //signed int v13; // esi@19 |
0 | 1255 signed int v14; // edx@20 |
1256 int v15; // edx@24 | |
1257 //int v16; // esi@29 | |
1258 //BLVFace *v17; // edi@34 | |
1259 unsigned __int16 v18; // ax@34 | |
1260 char *v19; // eax@38 | |
1261 signed int v20; // ecx@38 | |
1262 char *v21; // eax@42 | |
1263 signed int v22; // ecx@42 | |
1264 //signed int v23; // edx@45 | |
1265 //char *v24; // ecx@46 | |
1266 //int v25; // eax@47 | |
1267 //Vec3_short_ *v26; // eax@47 | |
1268 //double v27; // st7@47 | |
1269 //signed int v28; // ST28_4@47 | |
1270 char v29; // al@48 | |
795 | 1271 //signed int v30; // eax@51 |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1272 //int v31; // eax@52 |
0 | 1273 //unsigned int v32; // eax@55 |
1274 //__int16 v33; // cx@56 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1275 //signed int v34; // [sp+Ch] [bp-14h]@18 |
0 | 1276 //int a0; // [sp+14h] [bp-Ch]@2 |
1277 //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
|
1278 //signed int v37; // [sp+18h] [bp-8h]@19 |
0 | 1279 //stru10 *v38; // [sp+18h] [bp-8h]@36 |
1280 //BLVFace *v39; // [sp+1Ch] [bp-4h]@1 | |
1281 | |
1282 //v3 = uFaceID; | |
1283 //v4 = this; | |
1284 //v5 = &pIndoor->pFaces[uFaceID]; | |
795 | 1285 nodes[num_nodes].viewing_portal_id = -1; |
0 | 1286 //v39 = &pIndoor->pFaces[uFaceID]; |
1287 | |
1288 auto pFace = &pIndoor->pFaces[uFaceID]; | |
830 | 1289 auto p = &nodes[node_id]; |
0 | 1290 |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1291 if (!pFace->Portal()) |
0 | 1292 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1293 if (num_faces < 1000) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1294 { |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1295 faces[num_faces].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1296 faces[num_faces++].uNodeID = node_id; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1297 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1298 return; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1299 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1300 |
830 | 1301 |
1302 | |
0 | 1303 if (p->uFaceID == uFaceID) |
1304 return; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1305 if (!node_id && |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1306 pBLVRenderParams->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane |
0 | 1307 pBLVRenderParams->vPartyPos.x <= pFace->pBounding.x2 + 16 && |
1308 pBLVRenderParams->vPartyPos.y >= pFace->pBounding.y1 - 16 && | |
1309 pBLVRenderParams->vPartyPos.y <= pFace->pBounding.y2 + 16 && | |
1310 pBLVRenderParams->vPartyPos.z >= pFace->pBounding.z1 - 16 && | |
1311 pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 ) | |
1312 { | |
1313 if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x | |
830 | 1314 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y |
1315 + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane | |
0 | 1316 { |
1317 v7 = pFace->uSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1318 if ( nodes[0].uSectorID == v7 ) // draw back sector |
0 | 1319 v7 = pFace->uBackSectorID; |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1320 nodes[num_nodes].uSectorID = v7; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1321 nodes[num_nodes].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1322 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1323 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1324 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1325 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; |
830 | 1326 nodes[num_nodes].field_C._43F9E1(pBLVRenderParams->uViewportX, |
1327 pBLVRenderParams->uViewportY, | |
1328 pBLVRenderParams->uViewportZ, | |
1329 pBLVRenderParams->uViewportW); | |
1330 AddBspNodeToRenderList(++num_nodes - 1); | |
0 | 1331 return; |
1332 } | |
1333 //v5 = v39; | |
1334 //v6 = a0; | |
1335 } | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1336 |
0 | 1337 v8 = &pIndoor->pVertices[pFace->pVertexIDs[0]]; |
1338 v9 = pFace->pFacePlane_old.vNormal.x * (v8->x - pBLVRenderParams->vPartyPos.x) | |
1339 + pFace->pFacePlane_old.vNormal.y * (v8->y - pBLVRenderParams->vPartyPos.y) | |
1340 + pFace->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); | |
1341 if (p->uSectorID != pFace->uSectorID) | |
1342 v9 = -v9; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1343 if (v9 >= 0) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1344 return; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1345 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1346 auto num_vertices = sub_423B5D(uFaceID); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1347 if (num_vertices < 2) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1348 return; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1349 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1350 auto face_min_screenspace_x = _50BAC8_screen_space_x[0], |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1351 face_max_screenspace_x = _50BAC8_screen_space_x[0]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1352 auto face_min_screenspace_y = _50B9D8_screen_space_y[0], |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1353 face_max_screenspace_y = _50B9D8_screen_space_y[0]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1354 for (uint i = 1; i < num_vertices; ++i) |
0 | 1355 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1356 if (face_min_screenspace_x > _50BAC8_screen_space_x[i]) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1357 face_min_screenspace_x = _50BAC8_screen_space_x[i]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1358 if (face_max_screenspace_x < _50BAC8_screen_space_x[i]) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1359 face_max_screenspace_x = _50BAC8_screen_space_x[i]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1360 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1361 if (face_min_screenspace_y > _50B9D8_screen_space_y[i]) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1362 face_min_screenspace_y = _50B9D8_screen_space_y[i]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1363 if (face_max_screenspace_y < _50B9D8_screen_space_y[i]) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1364 face_max_screenspace_y = _50B9D8_screen_space_y[i]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1365 } |
830 | 1366 |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1367 if (face_max_screenspace_x >= p->uViewportX && |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1368 face_min_screenspace_x <= p->uViewportZ && |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1369 face_max_screenspace_y >= p->uViewportY && |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1370 face_min_screenspace_y <= p->uViewportW && |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1371 sub_424829(num_vertices, &nodes[num_nodes].field_C, &p->field_C, uFaceID)) |
0 | 1372 { |
1373 //v17 = v39; | |
1374 v18 = pFace->uSectorID; | |
1375 if (p->uSectorID == v18 ) | |
1376 v18 = pFace->uBackSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1377 nodes[num_nodes].uSectorID = v18; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1378 nodes[num_nodes].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1379 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1380 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1381 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1382 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; |
0 | 1383 //v38 = pGame->pStru10Instance; |
1384 //a0a = pGame->pIndoorCameraD3D; | |
795 | 1385 v29 = false; |
1386 if (p->viewing_portal_id == -1) | |
0 | 1387 { |
795 | 1388 v29 = pGame->pStru10Instance->CalcPortalShape(pFace, nodes[num_nodes].std__vector_0007AC, nodes[num_nodes].pPortalBounding); |
0 | 1389 } |
1390 else | |
1391 { | |
618
5cfb5dadf330
Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents:
595
diff
changeset
|
1392 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F7AA08[64]; |
5cfb5dadf330
Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents:
595
diff
changeset
|
1393 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F79E08[64]; |
0 | 1394 |
1395 for (uint k = 0; k < pFace->uNumVertices; ++k) | |
1396 { | |
795 | 1397 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[k]].x; |
1398 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[k]].y; | |
1399 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[k]].z; | |
0 | 1400 } |
795 | 1401 |
1402 | |
1403 unsigned int a2 = pFace->uNumVertices; | |
1404 pGame->pIndoorCameraD3D->CalcPortalShape(static_subAddFaceToRenderList_d3d_stru_F7AA08, | |
1405 &a2, | |
1406 static_subAddFaceToRenderList_d3d_stru_F79E08, | |
1407 p->std__vector_0007AC, 4, 0, 0); | |
1408 | |
1409 v29 = pGame->pStru10Instance->_49C5DA(pFace, static_subAddFaceToRenderList_d3d_stru_F79E08, &a2, | |
1410 nodes[num_nodes].std__vector_0007AC, | |
1411 nodes[num_nodes].pPortalBounding); | |
0 | 1412 } |
1413 if ( v29 ) | |
1414 { | |
795 | 1415 assert(num_nodes < 150); |
1416 | |
1417 nodes[num_nodes].viewing_portal_id = uFaceID; | |
1418 AddBspNodeToRenderList(++num_nodes - 1); | |
0 | 1419 } |
486 | 1420 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES) |
0 | 1421 pGame->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF); |
791 | 1422 //pGame->pIndoorCameraD3D->DebugDrawPortal(pFace); |
0 | 1423 } |
1424 } | |
1425 | |
1426 | |
1427 //----- (004AFB86) -------------------------------------------------------- | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1428 void BspRenderer::AddFaceToRenderList_sw(unsigned int node_id, unsigned int uFaceID) |
0 | 1429 { |
1430 BspRenderer *v3; // ebx@1 | |
1431 BLVFace *v4; // eax@1 | |
1432 char *v5; // ecx@2 | |
1433 unsigned __int16 v6; // ax@11 | |
1434 int v7; // ecx@13 | |
1435 Vec3_short_ *v8; // esi@16 | |
1436 int v9; // edx@16 | |
1437 signed int v10; // eax@19 | |
1438 signed int v11; // edi@20 | |
1439 signed int v12; // ecx@20 | |
1440 signed int v13; // esi@20 | |
1441 int v14; // edx@21 | |
1442 int v15; // edx@25 | |
1443 unsigned __int16 v16; // ax@35 | |
1444 signed int v17; // eax@37 | |
1445 int v18; // eax@38 | |
1446 signed int v19; // [sp+Ch] [bp-14h]@19 | |
1447 char *v20; // [sp+14h] [bp-Ch]@2 | |
1448 BLVFace *v21; // [sp+18h] [bp-8h]@1 | |
1449 signed int v22; // [sp+1Ch] [bp-4h]@20 | |
1450 signed int v23; // [sp+28h] [bp+8h]@20 | |
1451 | |
1452 v3 = this; | |
1453 v4 = &pIndoor->pFaces[uFaceID]; | |
1454 v21 = v4; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1455 if (v4->Portal()) |
0 | 1456 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1457 v5 = (char *)this + 2252 * node_id; |
0 | 1458 v20 = v5; |
1459 if ( uFaceID == *((short *)v5 + 2982) ) | |
1460 return; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1461 if (!node_id |
0 | 1462 && pBLVRenderParams->vPartyPos.x >= v4->pBounding.x1 - 16 |
1463 && pBLVRenderParams->vPartyPos.x <= v4->pBounding.x2 + 16 | |
1464 && pBLVRenderParams->vPartyPos.y >= v4->pBounding.y1 - 16 | |
1465 && pBLVRenderParams->vPartyPos.y <= v4->pBounding.y2 + 16 | |
1466 && pBLVRenderParams->vPartyPos.z >= v4->pBounding.z1 - 16 | |
1467 && pBLVRenderParams->vPartyPos.z <= v4->pBounding.z2 + 16 ) | |
1468 { | |
1469 if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x | |
1470 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y | |
1471 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) | |
1472 { | |
1473 v6 = v21->uSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1474 if ( v3->nodes[0].uSectorID == v6 ) |
0 | 1475 v6 = v21->uBackSectorID; |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1476 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
|
1477 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
|
1478 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
|
1479 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
|
1480 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
|
1481 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
|
1482 v3->nodes[v3->num_nodes++].field_C._43F9E1( |
0 | 1483 SLOWORD(pBLVRenderParams->uViewportX), |
1484 pBLVRenderParams->uViewportY, | |
1485 SLOWORD(pBLVRenderParams->uViewportZ), | |
1486 pBLVRenderParams->uViewportW); | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1487 v7 = v3->num_nodes - 1; |
0 | 1488 goto LABEL_14; |
1489 } | |
1490 v4 = v21; | |
1491 v5 = v20; | |
1492 } | |
1493 v8 = &pIndoor->pVertices[*v4->pVertexIDs]; | |
1494 v9 = v4->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x) | |
1495 + v4->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y) | |
1496 + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); | |
1497 if ( *((short *)v5 + 2004) != v4->uSectorID ) | |
1498 v9 = -v9; | |
1499 if ( v9 < 0 ) | |
1500 { | |
1501 v10 = sub_423B5D(uFaceID); | |
1502 v19 = v10; | |
1503 if ( v10 ) | |
1504 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1505 v11 = _50BAC8_screen_space_x[0]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1506 v12 = _50B9D8_screen_space_y[0]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1507 v23 = _50BAC8_screen_space_x[0]; |
0 | 1508 v13 = 1; |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1509 v22 = _50B9D8_screen_space_y[0]; |
0 | 1510 if ( v10 > 1 ) |
1511 { | |
1512 do | |
1513 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1514 v14 = _50BAC8_screen_space_x[v13]; |
0 | 1515 if ( v14 < v23 ) |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1516 v23 = _50BAC8_screen_space_x[v13]; |
0 | 1517 if ( v14 > v11 ) |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1518 v11 = _50BAC8_screen_space_x[v13]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1519 v15 = _50B9D8_screen_space_y[v13]; |
0 | 1520 if ( v15 < v22 ) |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1521 v22 = _50B9D8_screen_space_y[v13]; |
0 | 1522 if ( v15 > v12 ) |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1523 v12 = _50B9D8_screen_space_y[v13]; |
0 | 1524 v10 = v19; |
1525 ++v13; | |
1526 } | |
1527 while ( v13 < v19 ); | |
1528 } | |
1529 if ( v11 >= *((short *)v20 + 2005) | |
1530 && v23 <= *((short *)v20 + 2007) | |
1531 && v12 >= *((short *)v20 + 2006) | |
1532 && v22 <= *((short *)v20 + 2008) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1533 && sub_424829(v10, &v3->nodes[v3->num_nodes].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) ) |
0 | 1534 { |
1535 v16 = v21->uSectorID; | |
1536 if ( *((short *)v20 + 2004) == v16 ) | |
1537 v16 = v21->uBackSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1538 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
|
1539 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
|
1540 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
|
1541 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
|
1542 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
|
1543 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
|
1544 v17 = v3->num_nodes; |
0 | 1545 if ( v17 < 150 ) |
1546 { | |
1547 v18 = v17 + 1; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1548 v3->num_nodes = v18; |
0 | 1549 v7 = v18 - 1; |
1550 LABEL_14: | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1551 AddBspNodeToRenderList(v7); |
0 | 1552 return; |
1553 } | |
1554 } | |
1555 } | |
1556 } | |
1557 } | |
1558 else | |
1559 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1560 if (num_faces < 1000) |
0 | 1561 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1562 faces[num_faces].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1563 faces[num_faces++].uNodeID = node_id; |
0 | 1564 } |
1565 } | |
1566 } | |
1567 | |
1568 //----- (004B0967) -------------------------------------------------------- | |
486 | 1569 void BspRenderer::DrawFaceOutlines() |
0 | 1570 { |
1571 signed int i; // edi@1 | |
1572 int v1; // esi@2 | |
1573 unsigned int v2; // ecx@4 | |
1574 int v3; // eax@4 | |
1575 int v4; // eax@6 | |
1576 unsigned __int16 *v5; // edx@6 | |
1577 int v6; // ecx@7 | |
1578 int v7; // esi@8 | |
1579 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1580 for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i ) |
0 | 1581 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1582 v1 = pBspRenderer->faces[i].uFaceID; |
0 | 1583 if ( v1 >= 0 ) |
1584 { | |
1585 if ( v1 < (signed int)pIndoor->uNumFaces ) | |
1586 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1587 v2 = pBspRenderer->faces[i].uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1588 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].field_C; |
0 | 1589 v3 = sub_423B5D(v2); |
1590 if ( v3 ) | |
1591 { | |
1592 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | |
1593 { | |
1594 v4 = stru_F8A590._viewport_space_y; | |
1595 v5 = pBLVRenderParams->pRenderTarget; | |
1596 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
1597 { | |
1598 v6 = 640 * stru_F8A590._viewport_space_y; | |
1599 do | |
1600 { | |
1601 v5[v6 + stru_F8A590.array_18[v4]] = -1; | |
1602 v7 = v6 + stru_F8A590.array_3D8[v4]; | |
1603 v6 += 640; | |
1604 v5[v7] = -1; | |
1605 ++v4; | |
1606 } | |
1607 while ( v4 <= stru_F8A590._viewport_space_w ); | |
1608 } | |
1609 } | |
1610 } | |
1611 } | |
1612 } | |
1613 } | |
1614 } | |
1615 | |
1616 | |
1617 //----- (004AE5BA) -------------------------------------------------------- | |
1618 Texture *BLVFace::GetTexture() | |
1619 { | |
1620 unsigned int v1; // ecx@2 | |
1621 | |
1622 if ( uAttributes & 0x4000 ) | |
1623 v1 = pTextureFrameTable->GetFrameTexture(this->uBitmapID, pBLVRenderParams->field_0_timer_); | |
1624 else | |
1625 v1 = uBitmapID; | |
945 | 1626 return pBitmaps_LOD->GetTexture(v1); |
0 | 1627 } |
1628 | |
1629 | |
1630 //----- (00498B15) -------------------------------------------------------- | |
1631 void IndoorLocation::Release() | |
1632 { | |
1633 IndoorLocation *v1; // esi@1 | |
1634 char *v2; // ebp@1 | |
1635 void *v3; // ST00_4@1 | |
1636 | |
1637 v1 = this; | |
1638 v2 = (char *)&this->ptr_0002B4_doors_ddata; | |
1639 pAllocator->FreeChunk(this->ptr_0002B4_doors_ddata); | |
1640 *(int *)v2 = 0; | |
1641 pAllocator->FreeChunk(v1->ptr_0002B0_sector_rdata); | |
1642 v1->ptr_0002B0_sector_rdata = 0; | |
1643 pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata); | |
1644 v1->ptr_0002B8_sector_lrdata = 0; | |
1645 pAllocator->FreeChunk(v1->ptr_2AC); | |
1646 v1->ptr_2AC = 0; | |
1647 pAllocator->FreeChunk(v1->pSpawnPoints); | |
1648 v3 = v1->pVertices; | |
1649 v1->pSpawnPoints = 0; | |
1650 v1->uNumSectors = 0; | |
1651 v1->uNumFaces = 0; | |
1652 v1->uNumVertices = 0; | |
1653 v1->uNumNodes = 0; | |
1654 v1->uNumDoors = 0; | |
1655 v1->uNumLights = 0; | |
1656 pAllocator->FreeChunk(v3); | |
1657 pAllocator->FreeChunk(v1->pFaces); | |
1658 pAllocator->FreeChunk(v1->pFaceExtras); | |
1659 pAllocator->FreeChunk(v1->pSectors); | |
1660 pAllocator->FreeChunk(v1->pLights); | |
1661 pAllocator->FreeChunk(v1->pDoors); | |
1662 pAllocator->FreeChunk(v1->pNodes); | |
1663 pAllocator->FreeChunk(v1->pMapOutlines); | |
1664 v1->pVertices = 0; | |
1665 v1->pFaces = 0; | |
1666 v1->pFaceExtras = 0; | |
1667 v1->pSectors = 0; | |
1668 v1->pLights = 0; | |
1669 v1->pDoors = 0; | |
1670 v1->pNodes = 0; | |
1671 v1->pMapOutlines = 0; | |
1672 v1->bLoaded = 0; | |
1673 } | |
1674 | |
1675 //----- (00498C45) -------------------------------------------------------- | |
711 | 1676 bool IndoorLocation::Alloc() |
1677 { | |
1678 pVertices = (Vec3_short_ *) pAllocator->AllocNamedChunk(pVertices, 15000*sizeof(Vec3_short_), "L.V");//0x15F90u | |
1679 pFaces = (BLVFace *) pAllocator->AllocNamedChunk(pFaces, 10000*sizeof(BLVFace), "L.F");//0xEA600u | |
1680 pFaceExtras = (BLVFaceExtra *) pAllocator->AllocNamedChunk(pFaceExtras,5000*sizeof(BLVFaceExtra), "L.FX"); //0x2BF20u | |
1681 pSectors = (BLVSector *) pAllocator->AllocNamedChunk(pSectors, 512*sizeof(BLVSector), "L.R");//0xE800u | |
1682 pLights = (BLVLightMM7 *) pAllocator->AllocNamedChunk(pLights, 400*sizeof(BLVLightMM7), "L.L");//0x1900u | |
1683 pDoors = (BLVDoor *) pAllocator->AllocNamedChunk(pDoors, 200*sizeof(BLVDoor), "L.D");//0x3E80u | |
1684 pNodes = (BSPNode *) pAllocator->AllocNamedChunk(pNodes, 5000*sizeof(BSPNode), "L.BSP");//0x9C40u | |
1685 pMapOutlines =(BLVMapOutlines *)pAllocator->AllocNamedChunk(pMapOutlines, sizeof(BLVMapOutlines), "L.Map");//0x14824u | |
1686 if (pVertices && pFaces && pFaceExtras && pSectors && pLights && pDoors && pNodes && pMapOutlines ) | |
0 | 1687 { |
711 | 1688 memset(pVertices, 0, 15000*sizeof(Vec3_short_)); |
1689 memset(pFaces, 0, 10000*sizeof(BLVFace)); | |
1690 memset(pFaceExtras,0, 5000*sizeof(BLVFaceExtra)); | |
1691 memset(pSectors, 0, 512*sizeof(BLVSector)); | |
1692 memset(pLights, 0, 400*sizeof(BLVLightMM7)); | |
1693 memset(pDoors, 0, 200*sizeof(BLVDoor)); | |
1694 memset(pNodes, 0, 5000*sizeof(BSPNode)); | |
1695 memset(pMapOutlines,0, sizeof(BLVMapOutlines)); | |
1696 return true; | |
0 | 1697 } |
1698 else | |
1699 { | |
711 | 1700 return false; |
0 | 1701 } |
1702 } | |
1703 | |
1704 | |
1705 | |
1706 //----- (00444810) -------------------------------------------------------- | |
1707 unsigned int IndoorLocation::GetLocationIndex(const char *Str1) | |
1708 { | |
1709 const char *v1; // edi@1 | |
1710 signed int v2; // esi@1 | |
1711 | |
434 | 1712 for (uint i = 0; i < 11; ++i) |
1713 if (!strcmpi(Str1, _4E6BDC_loc_names[i])) | |
1714 return i + 1; | |
1715 return 0; | |
0 | 1716 } |
1717 | |
1718 | |
1719 | |
1720 //----- (004488F7) -------------------------------------------------------- | |
711 | 1721 void IndoorLocation::ToggleLight(signed int sLightID, unsigned int bToggle) |
0 | 1722 { |
1723 char *v2; // eax@4 | |
1724 | |
711 | 1725 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (sLightID <= pIndoor->uNumLights - 1) && (sLightID >= 0) ) |
0 | 1726 { |
711 | 1727 v2 = (char *)&pIndoor->pLights[sLightID].uAtributes; |
0 | 1728 if ( bToggle ) |
1729 *v2 &= 0xF7u; | |
1730 else | |
1731 *v2 |= 8u; | |
1732 pParty->uFlags |= 2u; | |
1733 } | |
1734 } | |
1735 | |
1736 | |
1737 //----- (00498E0A) -------------------------------------------------------- | |
1738 bool IndoorLocation::Load(char *pFilename, int a3, size_t _i, char *pDest) | |
1739 { | |
1740 /*unsigned int v5; // ebx@1 | |
1741 //IndoorLocation *v6; // esi@1 | |
1742 FILE *v7; // edi@3 | |
1743 bool result; // eax@3 | |
1744 char *v9; // ecx@4 | |
1745 void *v10; // eax@4 | |
1746 //unsigned __int8 v11; // zf@4 | |
1747 //unsigned __int8 v12; // sf@4 | |
1748 int v13; // eax@5 | |
1749 size_t v14; // ecx@6 | |
1750 char *v15; // ecx@6 | |
1751 int v16; // edx@6 | |
1752 size_t v17; // ecx@6 | |
1753 char *v18; // ecx@6 | |
1754 int v19; // edx@6 | |
1755 unsigned __int16 *v20; // edx@6 | |
1756 unsigned __int16 *v21; // edx@6 | |
1757 unsigned __int16 *v22; // edx@6 | |
1758 __int16 v23; // ax@10 | |
1759 char *v24; // ecx@10 | |
1760 __int16 v25; // cx@10 | |
1761 __int16 v26; // ax@11 | |
1762 char *v27; // ecx@11 | |
1763 unsigned __int16 v28; // ax@17 | |
1764 BLVFaceExtra *v29; // ecx@17 | |
1765 char *v30; // edx@17 | |
1766 int v31; // ecx@20 | |
1767 void *v32; // eax@25 | |
1768 int v33; // eax@26 | |
1769 unsigned __int16 *v34; // edx@27 | |
1770 size_t v35; // ecx@27 | |
1771 char *v36; // ecx@27 | |
1772 int v37; // edx@27 | |
1773 size_t v38; // ecx@27 | |
1774 char *v39; // ecx@27 | |
1775 int v40; // edx@27 | |
1776 unsigned __int16 *v41; // edx@27 | |
1777 unsigned __int16 *v42; // edx@27 | |
1778 unsigned __int16 *v43; // edx@27 | |
1779 unsigned __int16 *v44; // edx@27 | |
1780 size_t v45; // ecx@27 | |
1781 unsigned __int16 *v46; // edx@27 | |
1782 void *v47; // eax@28 | |
1783 BLVSector *v48; // eax@29 | |
1784 size_t v49; // ecx@29 | |
1785 unsigned __int16 *v50; // edx@31 | |
1786 void *v51; // eax@32 | |
1787 int v52; // eax@33 | |
1788 unsigned __int16 *v53; // edx@34 | |
1789 size_t v54; // ecx@34 | |
1790 char *v55; // ecx@34 | |
1791 int v56; // edx@34 | |
1792 size_t v57; // ecx@34 | |
1793 char *v58; // ecx@34 | |
1794 int v59; // edx@34 | |
1795 unsigned __int16 *v60; // edx@34 | |
1796 unsigned __int16 *v61; // edx@34 | |
1797 unsigned __int16 *v62; // edx@34 | |
1798 unsigned __int16 *v63; // edx@34 | |
1799 int v64; // ecx@34 | |
1800 BLVDoor *v65; // ecx@36 | |
1801 char *v66; // eax@37 | |
1802 int v67; // edx@38 | |
1803 int v68; // ecx@38 | |
1804 BLVFace *v69; // edx@38 | |
1805 int v70; // ecx@38 | |
1806 int v71; // edx@38 | |
1807 int v72; // eax@38 | |
1808 unsigned __int16 v73; // ax@42 | |
1809 char *v74; // ecx@42 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
1810 SpriteObject *v75; // ecx@44 |
0 | 1811 size_t v76; // eax@45 |
1812 int j; // edx@46 | |
1813 unsigned __int16 v78; // ax@50 | |
1814 void *v79; // eax@52 | |
1815 void **v80; // esi@52 | |
1816 unsigned int v145; // eax@103 | |
1817 void *v146; // eax@103 | |
1818 unsigned int v147; // ecx@103 | |
1819 int v148; // ebx@103 | |
1820 unsigned int *v149; // ecx@103*/ | |
1821 //size_t v150; // eax@103 | |
1822 //unsigned int v151; // ebx@109 | |
1823 //unsigned int v152; // ecx@116 | |
1824 //unsigned int v153; // eax@117 | |
1825 //size_t v154; // ebx@126 | |
1826 //unsigned int v155; // ebx@134 | |
1827 //size_t v156; // eax@140 | |
1828 //signed int v157; // ebx@142 | |
1829 //int v158; // ebx@148 | |
1830 //BLVFace *v159; // eax@149 | |
1831 // BLVFaceExtra *v160; // ecx@149 | |
1832 //BLVFaceExtra *v161; // ecx@149 | |
1833 //signed int v162; // ebx@154 | |
1834 //unsigned int v163; // ebx@157 | |
1835 //unsigned int v164; // ebx@157 | |
1836 //unsigned int v165; // edx@158 | |
1837 //char *v166; // ecx@158 | |
1838 //unsigned __int16 v167; // ax@161 | |
1839 //__int16 v168; // ax@165 | |
1840 //unsigned int v169; // ebx@168 | |
1841 //void *v170; // eax@168 | |
1842 //size_t v171; // ebx@168 | |
1843 //int v172; // edx@168 | |
1844 //BLVDoor *v173; // ecx@169 | |
1845 //int k; // eax@169 | |
1846 //BLVDoor *v175; // ecx@172 | |
1847 //int v176; // edx@172 | |
1848 //BLVDoor *v177; // ecx@172 | |
1849 //int v178; // edx@172 | |
1850 //BLVDoor *v179; // ecx@172 | |
1851 //int v180; // edx@172 | |
1852 //BLVDoor *v181; // ecx@172 | |
1853 //int v182; // edx@172 | |
1854 //BLVDoor *v183; // ecx@172 | |
1855 //int v184; // edx@172 | |
1856 //BLVDoor *v185; // ecx@172 | |
1857 //int v186; // edx@172 | |
1858 //BLVDoor *v187; // ecx@172 | |
1859 //int v188; // edx@172 | |
1860 //unsigned __int16 *v189; // ebx@172 | |
1861 //char *v190; // edx@173 | |
1862 //BLVDoor *v191; // ecx@174 | |
1863 //BLVDoor *l; // eax@175 | |
1864 //signed int v193; // ebx@176 | |
1865 //int v194; // ecx@176 | |
1866 //BLVFaceExtra *v195; // ecx@176 | |
1867 //BLVFace *v196; // ebx@178 | |
1868 //std::string v197; // [sp-18h] [bp-680h]@66 | |
1869 //void *v198; // [sp-14h] [bp-67Ch]@72 | |
1870 //size_t v199; // [sp-10h] [bp-678h]@72 | |
1871 //size_t v200; // [sp-Ch] [bp-674h]@72 | |
1872 //const char *v201; // [sp-8h] [bp-670h]@4 | |
1873 //int v202; // [sp-4h] [bp-66Ch]@4 | |
1874 char v203[875]; // [sp+Ch] [bp-65Ch]@130 | |
1875 char FileName[260]; // [sp+378h] [bp-2F0h]@1 | |
1876 //char DstBuf; // [sp+47Ch] [bp-1ECh]@4 | |
1877 __int32 Offset; // [sp+480h] [bp-1E8h]@4 | |
1878 __int32 v207; // [sp+48Ch] [bp-1DCh]@4 | |
1879 __int32 v208; // [sp+498h] [bp-1D0h]@4 | |
1880 __int32 v209; // [sp+4A4h] [bp-1C4h]@4 | |
1881 __int32 v210; // [sp+4B0h] [bp-1B8h]@4 | |
1882 __int32 v211; // [sp+4BCh] [bp-1ACh]@15 | |
1883 __int32 v212; // [sp+4C8h] [bp-1A0h]@15 | |
1884 __int32 v213; // [sp+4D4h] [bp-194h]@25 | |
1885 __int32 v214; // [sp+4E0h] [bp-188h]@25 | |
1886 __int32 v215; // [sp+4ECh] [bp-17Ch]@32 | |
1887 __int32 v216; // [sp+4F8h] [bp-170h]@32 | |
1888 __int32 v217; // [sp+504h] [bp-164h]@40 | |
1889 __int32 v218; // [sp+510h] [bp-158h]@40 | |
1890 __int32 v219; // [sp+51Ch] [bp-14Ch]@43 | |
1891 __int32 v220; // [sp+528h] [bp-140h]@43 | |
1892 __int32 v221; // [sp+534h] [bp-134h]@52 | |
1893 __int32 v222; // [sp+540h] [bp-128h]@52 | |
1894 __int32 v223; // [sp+54Ch] [bp-11Ch]@52 | |
1895 __int32 v224; // [sp+558h] [bp-110h]@52 | |
1896 __int32 v225; // [sp+564h] [bp-104h]@52 | |
1897 __int32 v226; // [sp+570h] [bp-F8h]@52 | |
1898 __int32 v227; // [sp+57Ch] [bp-ECh]@52 | |
1899 __int32 v228; // [sp+588h] [bp-E0h]@52 | |
1900 __int32 v229; // [sp+594h] [bp-D4h]@52 | |
1901 __int32 v230; // [sp+5A0h] [bp-C8h]@52 | |
1902 __int32 v231; // [sp+5ACh] [bp-BCh]@52 | |
1903 __int32 v232; // [sp+5B8h] [bp-B0h]@52 | |
1904 __int32 v233; // [sp+5C4h] [bp-A4h]@52 | |
1905 __int32 v234; // [sp+5D0h] [bp-98h]@52 | |
1906 //char pName[40]; // [sp+5FCh] [bp-6Ch]@42 | |
1907 //size_t pSource; // [sp+624h] [bp-44h]@67 | |
1908 //char Dst[12]; // [sp+628h] [bp-40h]@9 | |
1909 //char *v238; // [sp+634h] [bp-34h]@38 | |
1910 ODMHeader header; // [sp+638h] [bp-30h]@61 | |
1911 //void *ptr; // [sp+648h] [bp-20h]@66 | |
1912 //size_t Count; // [sp+64Ch] [bp-1Ch]@109 | |
1913 //int uSourceLen; // [sp+653h] [bp-15h]@66 | |
1914 FILE *File; // [sp+658h] [bp-10h]@56 | |
1915 //BLVSector *v244; // [sp+65Ch] [bp-Ch]@72 | |
1916 //int v245; // [sp+660h] [bp-8h]@72 | |
1917 //BLVFace *Src; // [sp+664h] [bp-4h]@73 | |
1918 signed int Argsa; // [sp+670h] [bp+8h]@4 | |
1919 signed int Argsb; // [sp+670h] [bp+8h]@7 | |
1920 signed int Argsc; // [sp+670h] [bp+8h]@15 | |
1921 signed int Argsd; // [sp+670h] [bp+8h]@18 | |
1922 int Argse; // [sp+670h] [bp+8h]@25 | |
1923 int Argsf; // [sp+670h] [bp+8h]@28 | |
1924 int Argsg; // [sp+670h] [bp+8h]@32 | |
1925 int Argsh; // [sp+670h] [bp+8h]@35 | |
1926 signed int Argsi; // [sp+670h] [bp+8h]@40 | |
1927 signed int Argsj; // [sp+670h] [bp+8h]@45 | |
1928 //int Argsk; // [sp+670h] [bp+8h]@143 | |
1929 //void *Argsl; // [sp+670h] [bp+8h]@155 | |
1930 //signed int Argsm; // [sp+670h] [bp+8h]@161 | |
1931 //signed int Argsn; // [sp+670h] [bp+8h]@175 | |
1932 | |
1933 //v5 = 0; | |
1934 //v6 = this; | |
1935 _6807E0_num_decorations_with_sounds_6807B8 = 0; | |
1936 | |
1937 #pragma region "loading from txt" | |
1938 /*sprintf(FileName, "levels\\%s", pFilename); | |
1939 if ( GetFileAttributesA(FileName) != -1 ) | |
1940 { | |
1941 Release(); | |
1942 if ( Alloc() ) | |
1943 { | |
1944 v7 = fopen(FileName, "rb"); | |
1945 result = 1; | |
1946 if ( !v7 ) | |
1947 return result; | |
1948 v9 = pDest; | |
1949 bLoaded = 1; | |
1950 v202 = (int)v7; | |
1951 v201 = (const char *)1; | |
1952 *(int *)v9 = 1; | |
1953 fread(&DstBuf, 0x180u, (size_t)v201, (FILE *)v202); | |
1954 fseek(v7, Offset, 0); | |
1955 fread(&blv, 0x88u, 1u, v7); | |
1956 fseek(v7, v207, 0); | |
1957 fread(&uNumVertices, 1u, 4u, v7); | |
1958 fseek(v7, v208, 0); | |
1959 fread(pVertices, 6u, uNumVertices, v7); | |
1960 fseek(v7, v209, 0); | |
1961 fread(&uNumFaces, 4u, 1u, v7); | |
1962 fseek(v7, v210, 0); | |
1963 fread(pFaces, 0x60u, uNumFaces, v7); | |
1964 v10 = pAllocator->AllocNamedChunk(ptr_2AC, blv.uFaces_fdata_Size, "L.FData"); | |
1965 v202 = (int)v7; | |
1966 ptr_2AC = (unsigned __int16 *)v10; | |
1967 fread(v10, 1u, blv.uFaces_fdata_Size, (FILE *)v202); | |
1968 v11 = uNumFaces == 0; | |
1969 v12 = (uNumFaces & 0x80000000u) != 0; | |
1970 pDest = 0; | |
1971 Argsa = 0; | |
1972 if ( !(v12 | v11) ) | |
1973 { | |
1974 v13 = 0; | |
1975 do | |
1976 { | |
1977 pFaces[v13].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)ptr_2AC]; | |
1978 v14 = (size_t)&pFaces[v13]; | |
1979 i = v14; | |
1980 v15 = &pDest[2 * *(char *)(v14 + 93) + 2]; | |
1981 v16 = (int)&v15[(unsigned int)ptr_2AC]; | |
1982 pDest = v15; | |
1983 *(int *)(i + 52) = v16; | |
1984 v17 = (size_t)&pFaces[v13]; | |
1985 i = v17; | |
1986 v18 = &pDest[2 * *(char *)(v17 + 93) + 2]; | |
1987 v19 = (int)&v18[(unsigned int)ptr_2AC]; | |
1988 pDest = v18; | |
1989 *(int *)(i + 56) = v19; | |
1990 i = (size_t)&pFaces[v13]; | |
1991 v20 = ptr_2AC; | |
1992 pDest += 2 * *(char *)(i + 93) + 2; | |
1993 *(int *)(i + 60) = (int)(char *)v20 + (int)pDest; | |
1994 i = (size_t)&pFaces[v13]; | |
1995 v21 = ptr_2AC; | |
1996 pDest += 2 * *(char *)(i + 93) + 2; | |
1997 *(int *)(i + 64) = (int)(char *)v21 + (int)pDest; | |
1998 i = (size_t)&pFaces[v13]; | |
1999 ++v13; | |
2000 v22 = ptr_2AC; | |
2001 pDest += 2 * *(char *)(i + 93) + 2; | |
2002 ++Argsa; | |
2003 *(int *)(i + 68) = (int)(char *)v22 + (int)pDest; | |
2004 pDest += 2 * *((char *)&pFaces[v13] - 3) + 2; | |
2005 } | |
2006 while ( Argsa < (signed int)uNumFaces ); | |
2007 } | |
2008 Argsb = 0; | |
2009 if ( (signed int)uNumFaces > 0 ) | |
2010 { | |
2011 pDest = 0; | |
2012 do | |
2013 { | |
2014 fread(Dst, 1u, 0xAu, v7); | |
2015 if ( pDest[(unsigned int)pFaces + 45] & 0x40 ) | |
2016 { | |
2017 v23 = pTextureFrameTable->FindTextureByName(Dst); | |
2018 v24 = pDest; | |
2019 *(short *)&pDest[(unsigned int)pFaces + 74] = v23; | |
2020 v25 = *(short *)&v24[(unsigned int)pFaces + 74]; | |
2021 if ( v25 ) | |
2022 { | |
2023 pTextureFrameTable->LoadAnimationSequenceAndPalettes(v25); | |
2024 } | |
2025 else | |
2026 { | |
2027 v26 = pBitmaps_LOD->LoadTexture(Dst); | |
2028 v27 = pDest; | |
2029 *(short *)&pDest[(unsigned int)pFaces + 74] = v26; | |
2030 v27[(unsigned int)pFaces + 45] &= 0xBFu; | |
2031 } | |
2032 } | |
2033 else | |
2034 { | |
2035 *(short *)&pDest[(unsigned int)pFaces + 74] = pBitmaps_LOD->LoadTexture(Dst); | |
2036 } | |
2037 ++Argsb; | |
2038 pDest += 96; | |
2039 } | |
2040 while ( Argsb < (signed int)uNumFaces ); | |
2041 } | |
2042 fseek(v7, v211, 0); | |
2043 fread(&uNumFaceExtras, 4u, 1u, v7); | |
2044 fseek(v7, v212, 0); | |
2045 fread(pFaceExtras, 0x24u, uNumFaceExtras, v7); | |
2046 Argsc = 0; | |
2047 if ( (signed int)uNumFaceExtras > 0 ) | |
2048 { | |
2049 pDest = 0; | |
2050 do | |
2051 { | |
2052 fread(Dst, 1u, 0xAu, v7); | |
2053 v28 = pBitmaps_LOD->LoadTexture(Dst); | |
2054 v29 = pFaceExtras; | |
2055 v30 = pDest; | |
2056 ++Argsc; | |
2057 pDest += 36; | |
2058 *(unsigned __int16 *)((char *)&v29->uAdditionalBitmapID + (int)v30) = v28; | |
2059 } | |
2060 while ( Argsc < (signed int)uNumFaceExtras ); | |
2061 } | |
2062 Argsd = 0; | |
2063 if ( (signed int)uNumFaces > 0 ) | |
2064 { | |
2065 pDest = 0; | |
2066 do | |
2067 { | |
2068 v31 = (int)&pFaceExtras[*(short *)&pDest[(unsigned int)pFaces + 72]]; | |
2069 if ( *(short *)(v31 + 26) ) | |
2070 { | |
2071 if ( ((BLVFaceExtra *)v31)->HasEventint() ) | |
2072 pDest[(unsigned int)pFaces + 46] |= 0x10u; | |
2073 else | |
2074 pDest[(unsigned int)pFaces + 46] &= 0xEFu; | |
2075 } | |
2076 ++Argsd; | |
2077 pDest += 96; | |
2078 } | |
2079 while ( Argsd < (signed int)uNumFaces ); | |
2080 } | |
2081 fseek(v7, v213, 0); | |
2082 fread(&uNumSectors, 4u, 1u, v7); | |
2083 fseek(v7, v214, 0); | |
2084 fread(pSectors, 0x74u, uNumSectors, v7); | |
2085 v32 = pAllocator->AllocNamedChunk(ptr_0002B0_sector_rdata, blv.uSector_rdata_Size, "L.RData"); | |
2086 v202 = (int)v7; | |
2087 ptr_0002B0_sector_rdata = (unsigned __int16 *)v32; | |
2088 fread(v32, 1u, blv.uSector_rdata_Size, (FILE *)v202); | |
2089 v11 = uNumSectors == 0; | |
2090 v12 = uNumSectors < 0; | |
2091 pDest = 0; | |
2092 Argse = 0; | |
2093 if ( !(v12 | v11) ) | |
2094 { | |
2095 v33 = 0; | |
2096 do | |
2097 { | |
2098 pSectors[v33].pFloors = (unsigned __int16 *)&pDest[(unsigned int)ptr_0002B0_sector_rdata]; | |
2099 i = (size_t)&pSectors[v33]; | |
2100 v34 = ptr_0002B0_sector_rdata; | |
2101 pDest += 2 * *(short *)(i + 4); | |
2102 *(int *)(i + 16) = (int)(char *)v34 + (int)pDest; | |
2103 v35 = (size_t)&pSectors[v33]; | |
2104 i = v35; | |
2105 v36 = &pDest[2 * *(short *)(v35 + 12)]; | |
2106 v37 = (int)&v36[(unsigned int)ptr_0002B0_sector_rdata]; | |
2107 pDest = v36; | |
2108 *(int *)(i + 24) = v37; | |
2109 v38 = (size_t)&pSectors[v33]; | |
2110 i = v38; | |
2111 v39 = &pDest[2 * *(short *)(v38 + 20)]; | |
2112 v40 = (int)&v39[(unsigned int)ptr_0002B0_sector_rdata]; | |
2113 pDest = v39; | |
2114 *(int *)(i + 32) = v40; | |
2115 i = (size_t)&pSectors[v33]; | |
2116 v41 = ptr_0002B0_sector_rdata; | |
2117 pDest += 2 * *(short *)(i + 28); | |
2118 *(int *)(i + 40) = (int)(char *)v41 + (int)pDest; | |
2119 i = (size_t)&pSectors[v33]; | |
2120 v42 = ptr_0002B0_sector_rdata; | |
2121 pDest += 2 * *(short *)(i + 36); | |
2122 *(int *)(i + 48) = (int)(char *)v42 + (int)pDest; | |
2123 i = (size_t)&pSectors[v33]; | |
2124 v43 = ptr_0002B0_sector_rdata; | |
2125 pDest += 2 * *(short *)(i + 44); | |
2126 *(int *)(i + 64) = (int)(char *)v43 + (int)pDest; | |
2127 i = (size_t)&pSectors[v33]; | |
2128 v44 = ptr_0002B0_sector_rdata; | |
2129 pDest += 2 * *(short *)(i + 60); | |
2130 *(int *)(i + 72) = (int)(char *)v44 + (int)pDest; | |
2131 v45 = (size_t)&pSectors[v33]; | |
2132 ++v33; | |
2133 i = v45; | |
2134 v46 = ptr_0002B0_sector_rdata; | |
2135 pDest += 2 * *(short *)(v45 + 68); | |
2136 ++Argse; | |
2137 *(int *)(v45 + 80) = (int)(char *)v46 + (int)pDest; | |
2138 pDest += 2 * *((short *)&pSectors[v33] - 20); | |
2139 } | |
2140 while ( Argse < uNumSectors ); | |
2141 } | |
2142 v47 = pAllocator->AllocNamedChunk( | |
2143 ptr_0002B8_sector_lrdata, | |
2144 blv.uSector_lrdata_Size, | |
2145 "L.RLData"); | |
2146 v202 = (int)v7; | |
2147 ptr_0002B8_sector_lrdata = (unsigned __int16 *)v47; | |
2148 fread(v47, 1u, blv.uSector_lrdata_Size, (FILE *)v202); | |
2149 v11 = uNumSectors == 0; | |
2150 v12 = uNumSectors < 0; | |
2151 pDest = 0; | |
2152 Argsf = 0; | |
2153 if ( !(v12 | v11) ) | |
2154 { | |
2155 v48 = pSectors; | |
2156 v49 = 0; | |
2157 for ( i = 0; ; v49 = i ) | |
2158 { | |
2159 v50 = ptr_0002B8_sector_lrdata; | |
2160 i += 116; | |
2161 ++Argsf; | |
2162 *(BLVLightMM7 **)((char *)&v48->pLights + v49) = (BLVLightMM7 *)((char *)v50 + (int)pDest); | |
2163 v48 = pSectors; | |
2164 pDest += 2 * *(__int16 *)((char *)&v48->uNumLights + v49); | |
2165 if ( Argsf >= uNumSectors ) | |
2166 break; | |
2167 } | |
2168 } | |
2169 fseek(v7, v215, 0); | |
2170 fread(&uNumDoors, 4u, 1u, v7); | |
2171 fseek(v7, v216, 0); | |
2172 fread(pDoors, 0x50u, 0xC8u, v7); | |
2173 v51 = pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData"); | |
2174 v202 = (int)v7; | |
2175 ptr_0002B4_doors_ddata = (unsigned __int16 *)v51; | |
2176 fread(v51, 1u, blv.uDoors_ddata_Size, (FILE *)v202); | |
2177 v11 = uNumDoors == 0; | |
2178 v12 = uNumDoors < 0; | |
2179 pDest = 0; | |
2180 Argsg = 0; | |
2181 if ( !(v12 | v11) ) | |
2182 { | |
2183 v52 = 0; | |
2184 do | |
2185 { | |
2186 pDoors[v52].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)ptr_0002B4_doors_ddata]; | |
2187 i = (size_t)&pDoors[v52]; | |
2188 v53 = ptr_0002B4_doors_ddata; | |
2189 pDest += 2 * *(short *)(i + 68); | |
2190 *(int *)(i + 40) = (int)(char *)v53 + (int)pDest; | |
2191 v54 = (size_t)&pDoors[v52]; | |
2192 i = v54; | |
2193 v55 = &pDest[2 * *(short *)(v54 + 70)]; | |
2194 v56 = (int)&v55[(unsigned int)ptr_0002B4_doors_ddata]; | |
2195 pDest = v55; | |
2196 *(int *)(i + 44) = v56; | |
2197 v57 = (size_t)&pDoors[v52]; | |
2198 i = v57; | |
2199 v58 = &pDest[2 * *(short *)(v57 + 72)]; | |
2200 v59 = (int)&v58[(unsigned int)ptr_0002B4_doors_ddata]; | |
2201 pDest = v58; | |
2202 *(int *)(i + 48) = v59; | |
2203 i = (size_t)&pDoors[v52]; | |
2204 v60 = ptr_0002B4_doors_ddata; | |
2205 pDest += 2 * *(short *)(i + 70); | |
2206 *(int *)(i + 52) = (int)(char *)v60 + (int)pDest; | |
2207 i = (size_t)&pDoors[v52]; | |
2208 v61 = ptr_0002B4_doors_ddata; | |
2209 pDest += 2 * *(short *)(i + 70); | |
2210 *(int *)(i + 56) = (int)(char *)v61 + (int)pDest; | |
2211 i = (size_t)&pDoors[v52]; | |
2212 v62 = ptr_0002B4_doors_ddata; | |
2213 pDest += 2 * *(short *)(i + 74); | |
2214 *(int *)(i + 60) = (int)(char *)v62 + (int)pDest; | |
2215 i = (size_t)&pDoors[v52]; | |
2216 v63 = ptr_0002B4_doors_ddata; | |
2217 pDest += 2 * *(short *)(i + 74); | |
2218 *(int *)(i + 64) = (int)(char *)v63 + (int)pDest; | |
2219 ++Argsg; | |
2220 v64 = pDoors[v52].uNumOffsets; | |
2221 ++v52; | |
2222 pDest += 2 * v64; | |
2223 } | |
2224 while ( Argsg < uNumDoors ); | |
2225 } | |
2226 Argsh = 0; | |
2227 if ( uNumDoors > 0 ) | |
2228 { | |
2229 v65 = pDoors; | |
2230 pDest = 0; | |
2231 do | |
2232 { | |
2233 i = 0; | |
2234 v66 = &pDest[(int)v65]; | |
2235 if ( *(short *)&pDest[(int)v65 + 70] > 0 ) | |
2236 { | |
2237 do | |
2238 { | |
2239 v67 = *((int *)v66 + 10); | |
2240 a3 = 2 * i; | |
2241 v68 = *(short *)(v67 + 2 * i); | |
2242 v69 = pFaces; | |
2243 ++i; | |
2244 v70 = (int)&pFaceExtras[v69[v68].uFaceExtraID]; | |
2245 v71 = *((int *)v66 + 12); | |
2246 v72 = a3; | |
2247 v238 = (char *)v70; | |
2248 *(short *)(a3 + v71) = *(short *)(v70 + 20); | |
2249 *(__int16 *)(*(char **)((char *)&pDoors->pDeltaVs + (unsigned int)pDest) + v72) = *((short *)v238 + 11); | |
2250 v65 = pDoors; | |
2251 v66 = &pDest[(int)v65]; | |
2252 } | |
2253 while ( (signed int)i < *(short *)&pDest[(int)v65 + 70] ); | |
2254 } | |
2255 ++Argsh; | |
2256 pDest += 80; | |
2257 } | |
2258 while ( Argsh < uNumDoors ); | |
2259 } | |
2260 fseek(v7, v217, 0); | |
2261 fread(&uNumLevelDecorations, 4u, 1u, v7); | |
2262 fseek(v7, v218, 0); | |
2263 fread(pLevelDecorations, 0x20u, uNumLevelDecorations, v7); | |
2264 Argsi = 0; | |
2265 if ( (signed int)uNumLevelDecorations > 0 ) | |
2266 { | |
2267 pDest = (char *)pLevelDecorations; | |
2268 do | |
2269 { | |
2270 fread(pName, 1u, 0x20u, v7); | |
2271 v73 = pDecorationList->GetDecorIdByName(pName); | |
2272 v74 = pDest; | |
2273 ++Argsi; | |
2274 pDest += 32; | |
2275 *(short *)v74 = v73; | |
2276 } | |
2277 while ( Argsi < (signed int)uNumLevelDecorations ); | |
2278 } | |
2279 fseek(v7, v219, 0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2280 fread(&uNumSpriteObjects, 4u, 1u, v7); |
0 | 2281 fseek(v7, v220, 0); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2282 fread(pSpriteObjects, 0x70u, uNumSpriteObjects, v7); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2283 if ( (signed int)uNumSpriteObjects > 0 ) |
0 | 2284 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2285 v75 = pSpriteObjects; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2286 pDest = (char *)uNumSpriteObjects; |
0 | 2287 do |
2288 { | |
2289 Argsj = 0; | |
2290 v76 = 48 * v75->stru_24.uItemID; | |
2291 v11 = pObjectList->uNumObjects == 0; | |
2292 v12 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
2293 LOWORD(v76) = *(unsigned __int16 *)((char *)&pItemsTable->pItems[0].uSpriteID + v76); | |
2294 i = v76; | |
2295 v75->uItemType = v76; | |
2296 if ( v12 | v11 ) | |
2297 { | |
2298 LABEL_50: | |
2299 v78 = 0; | |
2300 } | |
2301 else | |
2302 { | |
2303 for ( j = (int)&pObjectList->pObjects->uObjectID; (short)v76 != *(short *)j; j = a3 ) | |
2304 { | |
2305 ++Argsj; | |
2306 a3 = j + 56; | |
2307 if ( Argsj >= (signed int)pObjectList->uNumObjects ) | |
2308 goto LABEL_50; | |
2309 LOWORD(v76) = i; | |
2310 } | |
2311 v78 = Argsj; | |
2312 } | |
2313 v75->uObjectDescID = v78; | |
2314 ++v75; | |
2315 --pDest; | |
2316 } | |
2317 while ( pDest ); | |
2318 } | |
2319 fseek(v7, v221, 0); | |
2320 fread(&uNumActors, 4u, 1u, v7); | |
2321 fseek(v7, v222, 0); | |
2322 fread(pActors, 0x344u, uNumActors, v7); | |
2323 fseek(v7, v228, 0); | |
2324 fread(&uNumChests, 4u, 1u, v7); | |
2325 fseek(v7, v229, 0); | |
2326 fread(pChests, 0x14CCu, uNumChests, v7); | |
2327 fseek(v7, v224, 0); | |
2328 fread(&uNumLights, 4u, 1u, v7); | |
2329 fseek(v7, v225, 0); | |
2330 fread(pLights, 0x10u, uNumLights, v7); | |
2331 fseek(v7, v226, 0); | |
2332 fread(&uNumNodes, 4u, 1u, v7); | |
2333 fseek(v7, v227, 0); | |
2334 fread(pNodes, 8u, uNumNodes, v7); | |
2335 fseek(v7, v230, 0); | |
2336 fread(&uNumSpawnPoints, 4u, 1u, v7); | |
2337 v79 = pAllocator->AllocNamedChunk(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn"); | |
2338 v202 = 0; | |
2339 pSpawnPoints = (SpawnPointMM7 *)v79; | |
2340 fseek(v7, v231, v202); | |
2341 fread(pSpawnPoints, 0x18u, uNumSpawnPoints, v7); | |
2342 fseek(v7, v232, 0); | |
2343 fread(&dlv, 0x28u, 1u, v7); | |
2344 fseek(v7, v233, 0); | |
2345 fread(&stru_5E4C90, 1u, 0xC8u, v7); | |
2346 fseek(v7, v234, 0); | |
2347 fread(&uLastVisitDay, 1u, 0x38u, v7); | |
2348 fseek(v7, v223, 0); | |
2349 v80 = (void **)&pMapOutlines; | |
2350 fread(*v80, 4u, 1u, v7); | |
2351 fread((char *)*v80 + 4, 0xCu, *(int *)*v80, v7); | |
2352 fclose(v7); | |
2353 goto LABEL_179; | |
2354 } | |
2355 return 4; | |
2356 }*/ | |
2357 #pragma endregion | |
2358 | |
2359 if (bLoaded) | |
2360 { | |
2361 Log::Warning(L"BLV is already loaded"); | |
2362 return 3; | |
2363 } | |
2364 | |
2365 if ( !pGames_LOD->DoesContainerExist(pFilename) ) | |
2366 Abortf("Unable to find %s in Games.LOD", pFilename); | |
2367 | |
2368 //v238 = pFilename - 4; | |
2369 //v81 = strlen(pFilename); | |
2370 strcpy(this->pFilename, pFilename); | |
2371 strcpy(&pFilename[strlen(pFilename) - 4], ".blv"); | |
2372 File = pGames_LOD->FindContainer(pFilename, 1); | |
2373 //File = v82; | |
2374 | |
2375 Release(); | |
2376 if ( !Alloc() ) | |
2377 return 4; | |
2378 | |
2379 header.uVersion = 91969; | |
2380 header.pMagic[0] = 'm'; | |
2381 header.pMagic[1] = 'v'; | |
2382 header.pMagic[2] = 'i'; | |
2383 header.pMagic[3] = 'i'; | |
2384 header.uCompressedSize = 0; | |
2385 header.uDecompressedSize = 0; | |
2386 fread(&header, sizeof(ODMHeader), 1u, File); | |
2387 if (header.uVersion != 91969 || | |
2388 header.pMagic[0] != 'm' || | |
2389 header.pMagic[1] != 'v' || | |
2390 header.pMagic[2] != 'i' || | |
2391 header.pMagic[3] != 'i' ) | |
2392 { | |
2393 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:792", 0); | |
2394 } | |
2395 //v83 = header.uCompressedSize; | |
2396 //pSource = header.uDecompressedSize; | |
2397 //v84 = malloc(header.uDecompressedSize); | |
2398 //v85 = v84; | |
2399 //ptr = v84; | |
2400 auto pRawBLV = malloc(header.uDecompressedSize); | |
2401 memset(pRawBLV, 0, header.uDecompressedSize); | |
2402 | |
2403 if (header.uCompressedSize == header.uDecompressedSize) | |
2404 fread(pRawBLV, header.uDecompressedSize, 1, File); | |
2405 else if (header.uCompressedSize < header.uDecompressedSize) | |
2406 { | |
2407 auto pTmpMem = malloc(header.uCompressedSize); | |
2408 { | |
2409 fread(pTmpMem, header.uCompressedSize, 1, File); | |
2410 | |
2411 uint uDecompressedSize = header.uDecompressedSize; | |
2412 zlib::MemUnzip(pRawBLV, &uDecompressedSize, pTmpMem, header.uCompressedSize); | |
2413 | |
2414 if (uDecompressedSize != header.uDecompressedSize) | |
2415 Log::Warning(L"uDecompressedSize != header.uDecompressedSize in BLV"); | |
2416 } | |
2417 free(pTmpMem); | |
2418 } | |
2419 else | |
2420 { | |
2421 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:803", 0); | |
2422 return 0; | |
2423 } | |
2424 | |
2425 bLoaded = true; | |
2426 | |
2427 auto pData = (char *)pRawBLV; | |
2428 | |
2429 pGameLoadingUI_ProgressBar->Progress(); | |
2430 | |
2431 memcpy(&blv, pData, 136); | |
2432 memcpy(&uNumVertices, pData += 136, 4); | |
2433 memcpy(pVertices, pData += 4, uNumVertices * sizeof(Vec3_short_)); | |
2434 | |
2435 pGameLoadingUI_ProgressBar->Progress(); | |
2436 | |
2437 memcpy(&uNumFaces, pData += uNumVertices * sizeof(Vec3_short_), 4); | |
2438 | |
2439 pGameLoadingUI_ProgressBar->Progress(); | |
2440 | |
2441 memcpy(pFaces, pData += 4, uNumFaces * sizeof (BLVFace)); | |
2442 ptr_2AC = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_2AC, blv.uFaces_fdata_Size, "L.FData"); | |
2443 | |
2444 memcpy(ptr_2AC, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size); | |
2445 | |
2446 for (uint i = 0, j = 0; i < uNumFaces; ++i) | |
2447 { | |
2448 auto pFace = pFaces + i; | |
2449 | |
2450 pFace->pVertexIDs = ptr_2AC + j; | |
2451 | |
2452 j += pFace->uNumVertices + 1; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
2453 pFace->pXInterceptDisplacements = (short *)(ptr_2AC + j); |
0 | 2454 |
2455 j += pFace->uNumVertices + 1; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
2456 pFace->pYInterceptDisplacements = (short *)(ptr_2AC + j); |
0 | 2457 |
2458 j += pFace->uNumVertices + 1; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
2459 pFace->pZInterceptDisplacements = (short *)(ptr_2AC + j); |
0 | 2460 |
2461 j += pFace->uNumVertices + 1; | |
2462 pFace->pVertexUIDs = (__int16 *)(ptr_2AC + j); | |
2463 | |
2464 j += pFace->uNumVertices + 1; | |
2465 pFace->pVertexVIDs = (__int16 *)(ptr_2AC + j); | |
2466 | |
2467 j += pFace->uNumVertices + 1; | |
2468 /*v93 = &pFaces[v92]; | |
2469 Src = v93; | |
2470 v94 = (BLVSector *)((char *)v244 + 2 * v93->uNumVertices + 2); | |
2471 v95 = (unsigned __int16 *)((char *)v94 + (unsigned int)ptr_2AC); | |
2472 v244 = v94; | |
2473 Src->pXInterceptDisplacements = v95; | |
2474 v96 = (int)&pFaces[v92]; | |
2475 Src = (BLVFace *)v96; | |
2476 v97 = (BLVSector *)((char *)v244 + 2 * *(char *)(v96 + 93) + 2); | |
2477 v98 = (unsigned __int16 *)((char *)v97 + (unsigned int)ptr_2AC); | |
2478 v244 = v97; | |
2479 Src->pYInterceptDisplacements = v98; | |
2480 Src = &pFaces[v92]; | |
2481 v99 = ptr_2AC; | |
2482 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
2483 Src->pZInterceptDisplacements = (unsigned __int16 *)((char *)v99 + (int)v244); | |
2484 Src = &pFaces[v92]; | |
2485 v100 = ptr_2AC; | |
2486 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
2487 Src->pVertexUIDs = (unsigned __int16 *)((char *)v100 + (int)v244); | |
2488 Src = &pFaces[v92]; | |
2489 ++v92; | |
2490 v101 = ptr_2AC; | |
2491 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
2492 ++v245; | |
2493 Src->pVertexVIDs = (unsigned __int16 *)((char *)v101 + (int)v244); | |
2494 v244 = (BLVSector *)((char *)v244 + 2 * *((char *)&pFaces[v92] - 3) + 2);*/ | |
2495 } | |
2496 | |
2497 pGameLoadingUI_ProgressBar->Progress(); | |
2498 | |
2499 pData += blv.uFaces_fdata_Size; | |
2500 | |
2501 for (uint i = 0; i < uNumFaces; ++i) | |
2502 { | |
2503 auto pFace = pFaces + i; | |
2504 | |
2505 char pTexName[16]; | |
2506 strncpy(pTexName, pData, 10); | |
2507 pData += 10; | |
2508 | |
2509 if (pFace->uAttributes & 0x4000) | |
2510 { | |
2511 pFace->uBitmapID = pTextureFrameTable->FindTextureByName(pTexName); | |
2512 if (pFace->uBitmapID) | |
2513 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pFace->uBitmapID); | |
2514 else | |
2515 { | |
2516 pFace->uBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
2517 pFace->uAttributes &= ~0x4000; | |
2518 } | |
2519 } | |
2520 else | |
2521 pFace->uBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
2522 } | |
2523 | |
2524 pGameLoadingUI_ProgressBar->Progress(); | |
2525 | |
2526 memcpy(&uNumFaceExtras, pData, 4u); | |
2527 memcpy(pFaceExtras, pData += 4, uNumFaceExtras * sizeof(BLVFaceExtra)); | |
2528 pData += uNumFaceExtras * sizeof(BLVFaceExtra); | |
2529 | |
2530 pGameLoadingUI_ProgressBar->Progress(); | |
2531 | |
2532 //v108 = (char *)v107 + 36 * uNumFaceExtras; | |
2533 //v245 = 0; | |
2534 //*(int *)((char *)&uSourceLen + 1) = 0; | |
2535 for (uint i = 0; i < uNumFaceExtras; ++i) | |
2536 { | |
2537 char pTexName[32]; | |
2538 strncpy(pTexName, pData, 10); | |
2539 pData += 10; | |
2540 | |
2541 if (!strcmp(pTexName, "")) | |
2542 pFaceExtras[i].uAdditionalBitmapID = -1; | |
2543 else | |
2544 pFaceExtras[i].uAdditionalBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
2545 } | |
2546 | |
2547 | |
2548 for (uint i = 0; i < uNumFaces; ++i) | |
2549 { | |
2550 auto pFace = pFaces + i; | |
2551 auto pFaceExtra = pFaceExtras + pFace->uFaceExtraID; | |
2552 | |
2553 if (pFaceExtra->uEventID) | |
2554 { | |
2555 if (pFaceExtra->HasEventint()) | |
2556 pFace->uAttributes |= 0x100000; | |
2557 else | |
2558 pFace->uAttributes &= ~0x100000; | |
2559 } | |
2560 } | |
2561 | |
2562 pGameLoadingUI_ProgressBar->Progress(); | |
2563 | |
2564 memcpy(&uNumSectors, pData, 4); | |
2565 memcpy(pSectors, pData + 4, uNumSectors * sizeof(BLVSector)); | |
2566 pData += 4 + uNumSectors * sizeof(BLVSector); | |
2567 | |
2568 pGameLoadingUI_ProgressBar->Progress(); | |
2569 | |
2570 ptr_0002B0_sector_rdata = (unsigned short *)pAllocator->AllocNamedChunk(ptr_0002B0_sector_rdata, blv.uSector_rdata_Size, "L.RData"); | |
2571 memcpy(ptr_0002B0_sector_rdata, pData, blv.uSector_rdata_Size); | |
2572 pData += blv.uSector_rdata_Size; | |
2573 | |
2574 for (uint i = 0, j = 0; i < uNumSectors; ++i) | |
2575 { | |
2576 auto pSector = pSectors + i; | |
2577 | |
2578 pSector->pFloors = ptr_0002B0_sector_rdata + j; | |
2579 j += pSector->uNumFloors; | |
2580 | |
2581 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
|
2582 j += pSector->uNumWalls; |
0 | 2583 |
2584 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
|
2585 j += pSector->uNumCeilings; |
0 | 2586 |
2587 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
|
2588 j += pSector->uNumFluids; |
0 | 2589 |
2590 pSector->pPortals = ptr_0002B0_sector_rdata + j; | |
2591 j += pSector->uNumPortals; | |
2592 | |
2593 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
|
2594 j += pSector->uNumFaces; |
0 | 2595 |
2596 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
|
2597 j += pSector->uNumCogs; |
0 | 2598 |
2599 pSector->pDecorationIDs = ptr_0002B0_sector_rdata + j; | |
2600 j += pSector->uNumDecorations; | |
2601 | |
2602 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
|
2603 j += pSector->uNumMarkers; |
0 | 2604 |
2605 | |
2606 //do | |
2607 //{ | |
2608 /*pSectors[v118].pFloors = (unsigned __int16 *)((char *)Src + (unsigned int)ptr_0002B0_sector_rdata); | |
2609 v244 = &pSectors[v118]; | |
2610 v119 = ptr_0002B0_sector_rdata; | |
2611 Src = (BLVFace *)((char *)Src + 2 * v244->field_4); | |
2612 v244->pWalls = (unsigned __int16 *)((char *)v119 + (int)Src); | |
2613 v120 = (int)&pSectors[v118]; | |
2614 v244 = (BLVSector *)v120; | |
2615 v121 = (BLVFace *)((char *)Src + 2 * *(short *)(v120 + 12)); | |
2616 v122 = (unsigned __int16 *)((char *)v121 + (unsigned int)ptr_0002B0_sector_rdata); | |
2617 Src = v121; | |
2618 v244->pCeilings = v122; | |
2619 v123 = (int)&pSectors[v118]; | |
2620 v244 = (BLVSector *)v123; | |
2621 v124 = (BLVFace *)((char *)Src + 2 * *(short *)(v123 + 20)); | |
2622 v125 = (unsigned __int16 *)((char *)v124 + (unsigned int)ptr_0002B0_sector_rdata); | |
2623 Src = v124; | |
2624 v244->pFluids = v125; | |
2625 v244 = &pSectors[v118]; | |
2626 v126 = ptr_0002B0_sector_rdata; | |
2627 Src = (BLVFace *)((char *)Src + 2 * v244->field_1C); | |
2628 v244->pPortals = (unsigned __int16 *)((char *)v126 + (int)Src); | |
2629 v244 = &pSectors[v118]; | |
2630 v127 = ptr_0002B0_sector_rdata; | |
2631 Src = (BLVFace *)((char *)Src + 2 * v244->uNumPortals); | |
2632 v244->pFaceIDs = (unsigned __int16 *)((char *)v127 + (int)Src); | |
2633 v244 = &pSectors[v118]; | |
2634 v128 = ptr_0002B0_sector_rdata; | |
2635 Src = (BLVFace *)((char *)Src + 2 * v244->field_2C); | |
2636 v244->pCogs = (unsigned __int16 *)((char *)v128 + (int)Src); | |
2637 v244 = &pSectors[v118]; | |
2638 v129 = ptr_0002B0_sector_rdata; | |
2639 Src = (BLVFace *)((char *)Src + 2 * v244->field_3C); | |
2640 v244->pDecorationIDs = (unsigned __int16 *)((char *)v129 + (int)Src); | |
2641 v130 = (int)&pSectors[v118]; | |
2642 ++v118; | |
2643 v244 = (BLVSector *)v130; | |
2644 v131 = ptr_0002B0_sector_rdata; | |
2645 Src = (BLVFace *)((char *)Src + 2 * *(short *)(v130 + 68)); | |
2646 ++v245; | |
2647 *(int *)(v130 + 80) = (int)(char *)v131 + (int)Src; | |
2648 Src = (BLVFace *)((char *)Src + 2 * *((short *)&pSectors[v118] - 20));*/ | |
2649 //} | |
2650 //while ( v245 < uNumSectors ); | |
2651 } | |
2652 | |
2653 ptr_0002B8_sector_lrdata = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_0002B8_sector_lrdata, blv.uSector_lrdata_Size, "L.RLData"); | |
2654 memcpy(ptr_0002B8_sector_lrdata, pData, blv.uSector_lrdata_Size); | |
2655 pData += blv.uSector_lrdata_Size; | |
2656 | |
2657 pGameLoadingUI_ProgressBar->Progress(); | |
2658 | |
2659 for (uint i = 0, j = 0; i < uNumSectors; ++i) | |
2660 { | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
2661 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
|
2662 j += pSectors[i].uNumLights; |
0 | 2663 } |
2664 | |
2665 pGameLoadingUI_ProgressBar->Progress(); | |
2666 | |
2667 memcpy(&uNumDoors, pData, 4); | |
2668 pData += 4; | |
2669 | |
2670 pGameLoadingUI_ProgressBar->Progress(); | |
2671 pGameLoadingUI_ProgressBar->Progress(); | |
2672 | |
2673 memcpy(&uNumLevelDecorations, pData, 4); | |
2674 memcpy(pLevelDecorations, pData + 4, uNumLevelDecorations * sizeof(LevelDecoration)); | |
2675 pData += 4 + uNumLevelDecorations * sizeof(LevelDecoration); | |
2676 | |
2677 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2678 { | |
2679 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pData); | |
2680 | |
2681 pData += 32; | |
2682 } | |
2683 | |
2684 pGameLoadingUI_ProgressBar->Progress(); | |
2685 | |
2686 memcpy(&uNumLights, pData, 4); | |
2687 memcpy(pLights, pData + 4, uNumLights * sizeof(BLVLightMM7)); | |
2688 pData += 4 + uNumLights * sizeof(BLVLightMM7); | |
2689 | |
2690 pGameLoadingUI_ProgressBar->Progress(); | |
2691 pGameLoadingUI_ProgressBar->Progress(); | |
2692 | |
2693 memcpy(&uNumNodes, pData, 4); | |
2694 memcpy(pNodes, pData + 4, uNumNodes * sizeof(BSPNode)); | |
2695 pData += 4 + uNumNodes * sizeof(BSPNode); | |
2696 | |
2697 pGameLoadingUI_ProgressBar->Progress(); | |
2698 pGameLoadingUI_ProgressBar->Progress(); | |
2699 | |
2700 memcpy(&uNumSpawnPoints, pData, 4); | |
2701 pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, uNumSpawnPoints * sizeof(SpawnPointMM7), "Spawn"); | |
2702 memcpy(pSpawnPoints, pData + 4, uNumSpawnPoints * sizeof(SpawnPointMM7)); | |
2703 pData += 4 + uNumSpawnPoints * sizeof(SpawnPointMM7); | |
2704 | |
2705 pGameLoadingUI_ProgressBar->Progress(); | |
2706 pGameLoadingUI_ProgressBar->Progress(); | |
2707 | |
2708 //v201 = (const char *)v148; | |
2709 //v200 = (size_t)pMapOutlines; | |
2710 memcpy(&pMapOutlines->uNumOutlines, pData, 4); | |
2711 memcpy(pMapOutlines->pOutlines, pData + 4, pMapOutlines->uNumOutlines * sizeof(BLVMapOutline)); | |
2712 //v149 = pMapOutlines; | |
2713 //v199 = 12 * *v149; | |
2714 //memcpy(v149 + 1, (const void *)(v148 + 4), v199); | |
2715 free(pRawBLV); | |
2716 pRawBLV = nullptr; | |
2717 | |
2718 void *pRawDLV = nullptr; | |
2719 strcpy(&pFilename[strlen(pFilename) - 4], ".dlv"); | |
2720 File = pNew_LOD->FindContainer(pFilename, 1); | |
2721 fread(&header, 0x10u, 1u, File);//(FILE *)v245); | |
2722 bool _v244 = false; | |
2723 if (header.uVersion != 91969 || | |
2724 header.pMagic[0] != 'm' || | |
2725 header.pMagic[1] != 'v' || | |
2726 header.pMagic[2] != 'i' || | |
2727 header.pMagic[3] != 'i' ) | |
2728 { | |
2729 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1090", 0); | |
2730 _v244 = true; | |
2731 } | |
2732 else | |
2733 { | |
2734 pRawDLV = malloc(header.uDecompressedSize); | |
2735 if (header.uCompressedSize == header.uDecompressedSize) | |
2736 fread(pRawDLV, 1, header.uCompressedSize, File); | |
2737 else if (header.uCompressedSize < header.uDecompressedSize) | |
2738 { | |
2739 auto pTmpMem = malloc(header.uCompressedSize); | |
2740 { | |
2741 fread(pTmpMem, header.uCompressedSize, 1, File); | |
2742 | |
2743 uint uDecompressedSize = header.uDecompressedSize; | |
2744 zlib::MemUnzip(pRawDLV, &uDecompressedSize, pTmpMem, header.uCompressedSize); | |
2745 | |
2746 if (uDecompressedSize != header.uDecompressedSize) | |
2747 Log::Warning(L"uDecompressedSize != header.uDecompressedSize in DLV"); | |
2748 } | |
2749 free(pTmpMem); | |
2750 } | |
2751 else | |
2752 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1108", 0); | |
2753 | |
2754 pData = (char *)pRawDLV; | |
2755 } | |
2756 | |
2757 memcpy(&dlv, pData, 40); | |
2758 pData += 40; | |
2759 | |
2760 //v152 = dlv.uNumFacesInBModels; | |
2761 if (dlv.uNumFacesInBModels) | |
2762 { | |
2763 //v153 = dlv.uNumDecorations; | |
2764 if (dlv.uNumDecorations) | |
2765 { | |
2766 if (dlv.uNumFacesInBModels != uNumFaces || | |
2767 dlv.uNumDecorations != uNumLevelDecorations) | |
2768 _v244 = true; | |
2769 } | |
2770 } | |
2771 | |
2772 if (dword_6BE364_game_settings_1 & 0x2000 ) | |
2773 _i = 29030400; | |
2774 bool _a = false; | |
2775 if ( a3 - dlv.uLastRepawnDay >= _i && strcmpi(pCurrentMapName, "d29.dlv") ) | |
2776 _a = true; | |
2777 | |
2778 //v154 = 875; | |
2779 if (_v244) | |
2780 { | |
2781 memset(v203, 0, 0x36B); | |
2782 goto LABEL_132; | |
2783 } | |
2784 if (_a || !dlv.uLastRepawnDay ) | |
2785 { | |
2786 memcpy(v203, pData, 0x36B); | |
2787 LABEL_132: | |
435 | 2788 free(pRawDLV); |
0 | 2789 dlv.uLastRepawnDay = a3; |
2790 if (_v244) | |
2791 ++dlv.uNumRespawns; | |
2792 //v201 = pFilename; | |
2793 *(int *)pDest = 1; | |
2794 File = pGames_LOD->FindContainer(pFilename, 0); | |
2795 fread(&header, 0x10u, 1u, File); | |
2796 auto v155 = header.uCompressedSize; | |
2797 auto Count = header.uDecompressedSize; | |
2798 auto Src = (BLVFace *)malloc(header.uDecompressedSize); | |
435 | 2799 pRawDLV = Src; |
0 | 2800 if ( v155 <= Count ) |
2801 { | |
2802 if ( v155 == Count ) | |
2803 { | |
2804 fread(Src, 1u, Count, File); | |
2805 } | |
2806 else | |
2807 { | |
2808 auto _uSourceLen = malloc(v155); | |
2809 fread(_uSourceLen, v155, 1u, File); | |
2810 zlib::MemUnzip(Src, &Count, _uSourceLen, v155); | |
2811 free(_uSourceLen); | |
2812 } | |
2813 } | |
2814 else | |
2815 { | |
2816 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0); | |
2817 } | |
2818 pData = ((char *)Src + 40); | |
2819 //v154 = 875; | |
2820 goto LABEL_140; | |
2821 } | |
2822 *(int *)pDest = 0; | |
2823 LABEL_140: | |
2824 //v202 = (int)".blv"; | |
2825 //v156 = strlen(pFilename); | |
2826 strcpy(&pFilename[strlen(pFilename) - 4], ".blv"); | |
2827 memcpy(_visible_outlines, pData, 875); | |
2828 pData += 875; | |
2829 | |
2830 if ( *(int *)pDest ) | |
2831 memcpy(_visible_outlines, v203, 875); | |
2832 | |
2833 for (uint i = 0; i < pMapOutlines->uNumOutlines; ++i) | |
2834 { | |
2835 auto pVertex = pMapOutlines->pOutlines + i; | |
2836 if ((unsigned __int8)(1 << (7 - i % 8)) & _visible_outlines[i / 8]) | |
2837 pVertex->uFlags |= 1; | |
2838 } | |
2839 | |
2840 | |
2841 for (uint i = 0; i < uNumFaces; ++i) | |
2842 { | |
2843 auto pFace = pFaces + i; | |
2844 auto pFaceExtra = pFaceExtras + pFace->uFaceExtraID; | |
2845 | |
2846 memcpy(&pFace->uAttributes, pData, 4); | |
2847 pData += 4; | |
2848 | |
2849 if (pFaceExtra->uEventID) | |
2850 { | |
2851 if (pFaceExtra->HasEventint()) | |
2852 pFace->uAttributes |= 0x100000; | |
2853 else | |
2854 pFace->uAttributes &= ~0x100000; | |
2855 } | |
2856 } | |
2857 | |
2858 pGameLoadingUI_ProgressBar->Progress(); | |
2859 | |
2860 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2861 { | |
2862 memcpy(&pLevelDecorations[i].field_2, pData, 2); | |
2863 pData += 2; | |
2864 } | |
2865 | |
2866 pGameLoadingUI_ProgressBar->Progress(); | |
2867 | |
2868 memcpy(&uNumActors, pData, 4); | |
2869 memcpy(pActors, pData + 4, uNumActors * sizeof(Actor)); | |
2870 pData += 4 + uNumActors * sizeof(Actor); | |
2871 | |
2872 pGameLoadingUI_ProgressBar->Progress(); | |
2873 pGameLoadingUI_ProgressBar->Progress(); | |
2874 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2875 memcpy(&uNumSpriteObjects, pData, 4); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2876 memcpy(pSpriteObjects, pData + 4, uNumSpriteObjects * sizeof(SpriteObject)); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2877 pData += 4 + uNumSpriteObjects * sizeof(SpriteObject); |
0 | 2878 |
2879 pGameLoadingUI_ProgressBar->Progress(); | |
2880 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2881 for (uint i = 0; i < uNumSpriteObjects; ++i) |
0 | 2882 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2883 auto pItem = pSpriteObjects + i; |
0 | 2884 |
2885 if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100)) | |
2886 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2887 pItem->uType = pItemsTable->pItems[pItem->stru_24.uItemID - 1].uSpriteID; |
0 | 2888 |
2889 uint uObjectID = 0; | |
2890 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
|
2891 if (pItem->uType == pObjectList->pObjects[j].uObjectID) |
0 | 2892 { |
2893 pItem->uObjectDescID = j; | |
2894 break; | |
2895 } | |
2896 } | |
2897 } | |
2898 | |
2899 pGameLoadingUI_ProgressBar->Progress(); | |
2900 | |
2901 memcpy(&uNumChests, pData, 4); | |
2902 memcpy(pChests, pData + 4, uNumChests * sizeof(Chest)); | |
2903 pData += 4 + uNumChests * sizeof(Chest); | |
2904 | |
2905 pGameLoadingUI_ProgressBar->Progress(); | |
2906 pGameLoadingUI_ProgressBar->Progress(); | |
2907 | |
2908 memcpy(pDoors, pData, 0x3E80); | |
2909 pData += 0x3E80; | |
2910 | |
2911 //v201 = (const char *)blv.uDoors_ddata_Size; | |
2912 //v200 = (size_t)ptr_0002B4_doors_ddata; | |
2913 //v170 = pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData"); | |
2914 //v171 = blv.uDoors_ddata_Size; | |
2915 ptr_0002B4_doors_ddata = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData"); | |
2916 memcpy(ptr_0002B4_doors_ddata, pData, blv.uDoors_ddata_Size); | |
2917 pData += blv.uDoors_ddata_Size; | |
2918 | |
2919 //Src = (BLVFace *)((char *)Src + v171); | |
2920 //v172 = 0; | |
2921 //v245 = 0; | |
2922 //if (uNumDoors > 0) | |
2923 for (uint i = 0, j = 0; i < uNumDoors; ++i) | |
2924 { | |
2925 auto pDoor = pDoors + i; | |
2926 | |
2927 pDoor->pVertexIDs = ptr_0002B4_doors_ddata + j; | |
2928 j += pDoor->uNumVertices; | |
2929 | |
2930 pDoor->pFaceIDs = ptr_0002B4_doors_ddata + j; | |
2931 j += pDoor->uNumFaces; | |
2932 | |
2933 pDoor->pSectorIDs = ptr_0002B4_doors_ddata + j; | |
2934 j += pDoor->field_48; | |
2935 | |
2936 pDoor->pDeltaUs = (short *)(ptr_0002B4_doors_ddata + j); | |
2937 j += pDoor->uNumFaces; | |
2938 | |
2939 pDoor->pDeltaVs = (short *)(ptr_0002B4_doors_ddata + j); | |
2940 j += pDoor->uNumFaces; | |
2941 | |
2942 pDoor->pXOffsets = ptr_0002B4_doors_ddata + j; | |
2943 j += pDoor->uNumOffsets; | |
2944 | |
2945 pDoor->pYOffsets = ptr_0002B4_doors_ddata + j; | |
2946 j += pDoor->uNumOffsets; | |
2947 | |
2948 pDoor->pZOffsets = ptr_0002B4_doors_ddata + j; | |
2949 j += pDoor->uNumOffsets; | |
2950 /*v173 = pDoors; | |
2951 for ( k = 0; ; v172 = v188 + 2 * *((short *)&v173[k] - 3) ) | |
2952 { | |
2953 v173[k].pVertexIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v172); | |
2954 v175 = &pDoors[k]; | |
2955 v176 = v172 + 2 * v175->uNumVertices; | |
2956 v175->pFaceIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v176); | |
2957 v177 = &pDoors[k]; | |
2958 v178 = v176 + 2 * v177->uNumFaces; | |
2959 v177->pSectorIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v178); | |
2960 v179 = &pDoors[k]; | |
2961 v180 = v178 + 2 * v179->field_48; | |
2962 v179->pDeltaUs = (__int16 *)((char *)ptr_0002B4_doors_ddata + v180); | |
2963 v181 = &pDoors[k]; | |
2964 v182 = v180 + 2 * v181->uNumFaces; | |
2965 v181->pDeltaVs = (__int16 *)((char *)ptr_0002B4_doors_ddata + v182); | |
2966 v183 = &pDoors[k]; | |
2967 v184 = v182 + 2 * v183->uNumFaces; | |
2968 v183->pXOffsets = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v184); | |
2969 v185 = &pDoors[k]; | |
2970 v186 = v184 + 2 * v185->uNumOffsets; | |
2971 v185->pYOffsets = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v186); | |
2972 v187 = &pDoors[k]; | |
2973 ++k; | |
2974 v188 = v186 + 2 * v187->uNumOffsets; | |
2975 v189 = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v188); | |
2976 ++v245; | |
2977 v187->pZOffsets = v189; | |
2978 v173 = pDoors; | |
2979 if ( v245 >= uNumDoors ) | |
2980 break; | |
2981 }*/ | |
2982 } | |
2983 //v190 = 0; | |
2984 //v245 = 0; | |
2985 for (uint i = 0; i < uNumDoors; ++i) | |
2986 { | |
2987 auto pDoor = pDoors + i; | |
2988 | |
2989 for (uint j = 0; j < pDoor->uNumFaces; ++j) | |
2990 { | |
2991 auto pFace = pFaces + pDoor->pFaceIDs[j]; | |
2992 auto pFaceExtra = pFaceExtras + pFace->uFaceExtraID; | |
2993 | |
2994 pDoor->pDeltaUs[j] = pFaceExtra->sTextureDeltaU; | |
2995 pDoor->pDeltaVs[j] = pFaceExtra->sTextureDeltaV; | |
2996 } | |
2997 //v191 = pDoors; | |
2998 //pDest = 0; | |
2999 //do | |
3000 // { | |
3001 /*Argsn = 0; | |
3002 for ( l = (BLVDoor *)&v190[(int)v191]; | |
3003 Argsn < *(short *)&v190[(int)v191 + 70]; | |
3004 l = (BLVDoor *)&v190[(int)v191] ) | |
3005 { | |
3006 v193 = Argsn; | |
3007 v194 = l->pFaceIDs[Argsn++]; | |
3008 v195 = &pFaceExtras[pFaces[v194].uFaceExtraID]; | |
3009 l->pDeltaUs[v193] = v195->sTextureDeltaU; | |
3010 v190 = pDest; | |
3011 *(short *)(v193 * 2 + *(int *)&pDest[(unsigned int)pDoors + 52]) = v195->sTextureDeltaV; | |
3012 v191 = pDoors; | |
3013 } | |
3014 ++v245; | |
3015 v190 += 80; | |
3016 pDest = v190;*/ | |
3017 //} | |
3018 //while ( v245 < uNumDoors ); | |
3019 } | |
3020 | |
3021 | |
3022 pGameLoadingUI_ProgressBar->Progress(); | |
3023 | |
3024 memcpy(&stru_5E4C90, pData, 0xC8); | |
3025 pData += 0xC8; | |
3026 | |
3027 pGameLoadingUI_ProgressBar->Progress(); | |
3028 | |
3029 memcpy(&stru1, pData, 0x38u); | |
3030 pData += 0x38; | |
3031 | |
3032 free(pRawDLV); | |
3033 //v5 = 0; | |
3034 | |
3035 pSoundList->LoadSound(64, 0); | |
3036 pSoundList->LoadSound(103, 0); | |
3037 pSoundList->LoadSound(63, 0); | |
3038 pSoundList->LoadSound(102, 0); | |
3039 pSoundList->LoadSound(50, 0); | |
3040 pSoundList->LoadSound(89, 0); | |
3041 | |
3042 return 0; | |
3043 } | |
3044 | |
3045 | |
3046 //----- (0049AC17) -------------------------------------------------------- | |
3047 int IndoorLocation::GetSector(int sX, int sY, int sZ) | |
3048 { | |
3049 int v4; // esi@1 | |
3050 //unsigned __int8 v5; // zf@1 | |
3051 //unsigned __int8 v6; // sf@1 | |
3052 //unsigned __int8 v7; // of@1 | |
3053 //BLVSector *v8; // eax@3 | |
3054 //int v9; // edi@9 | |
3055 //int v10; // eax@9 | |
3056 //int v11; // edx@9 | |
3057 //int v12; // eax@10 | |
3058 //unsigned __int16 v13; // ax@12 | |
3059 //int v14; // edi@14 | |
3060 //BLVFace *v15; // eax@14 | |
3061 //BLVFace *v16; // edi@14 | |
3062 //PolygonType v17; // al@14 | |
3063 //unsigned __int16 *pVertexIDs; // esi@16 | |
3064 //Vec3_short_ *v19; // eax@16 | |
3065 //int v20; // edx@16 | |
3066 //unsigned __int16 *v21; // esi@17 | |
3067 //int v22; // edi@19 | |
3068 //int v23; // edi@20 | |
3069 //Vec3_short_ *v24; // edx@20 | |
3070 signed int v25; // edx@21 | |
3071 int v26; // ebx@23 | |
3072 //int v27; // edx@26 | |
3073 //signed __int64 v28; // qtt@26 | |
3074 ///Vec3_short_ *v29; // eax@26 | |
3075 //Vec3_short_ *v30; // edx@26 | |
3076 //int v31; // edx@26 | |
791 | 3077 //signed int v32; // edi@27 |
0 | 3078 signed __int64 v33; // qtt@27 |
3079 //Vec3_short_ *v34; // edx@27 | |
791 | 3080 //int v35; // edx@32 |
0 | 3081 int v37; // edi@38 |
717 | 3082 int pSectorID; // ebx@40 |
0 | 3083 int v39; // eax@41 |
717 | 3084 BLVFace *pFace; // esi@42 |
3085 PolygonType pPolygonType; // dl@42 | |
0 | 3086 int v42; // edx@43 |
3087 int v43[50]; // [sp+Ch] [bp-108h]@1 | |
3088 //int v44; // [sp+D4h] [bp-40h]@9 | |
3089 //int v45; // [sp+D8h] [bp-3Ch]@14 | |
3090 //int v46; // [sp+DCh] [bp-38h]@14 | |
3091 //int v47; // [sp+E0h] [bp-34h]@19 | |
3092 //int v48; // [sp+E4h] [bp-30h]@9 | |
3093 //Vec3_short_ *v49; // [sp+E8h] [bp-2Ch]@19 | |
3094 bool v50; // [sp+ECh] [bp-28h]@19 | |
3095 int v51; // [sp+F0h] [bp-24h]@9 | |
3096 //unsigned int v52; // [sp+F4h] [bp-20h]@2 | |
3097 int v53; // [sp+F8h] [bp-1Ch]@10 | |
3098 int v54; // [sp+FCh] [bp-18h]@16 | |
3099 int v55; // [sp+100h] [bp-14h]@1 | |
3100 int v56; // [sp+104h] [bp-10h]@1 | |
3101 int v57; // [sp+108h] [bp-Ch]@16 | |
3102 //Vec3_short_ *v58; // [sp+10Ch] [bp-8h]@20 | |
3103 int v59; // [sp+110h] [bp-4h]@16 | |
3104 | |
3105 v4 = 0; | |
791 | 3106 v43[0] = 0; |
3107 | |
0 | 3108 v55 = 0; |
791 | 3109 |
0 | 3110 if (uNumSectors < 2) |
3111 return 0; | |
3112 | |
3113 for (uint i = 1; i < uNumSectors; ++i) | |
3114 { | |
3115 auto pSector = pSectors + i; | |
3116 | |
791 | 3117 if (pSector->pBounding.x1 > sX || pSector->pBounding.x2 < sX || |
3118 pSector->pBounding.y1 > sY || pSector->pBounding.y2 < sY || | |
3119 pSector->pBounding.z1 - 64 > sZ || pSector->pBounding.z2 + 64 < sZ) | |
3120 continue; | |
3121 | |
618
5cfb5dadf330
Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents:
595
diff
changeset
|
3122 //Log::Warning(L"Sector[%u]", i); |
791 | 3123 v51 = pSector->uNumFloors + pSector->uNumPortals; |
3124 if (!v51) | |
3125 continue; | |
3126 | |
3127 | |
3128 for (uint j = 0; j < v51; ++j) | |
3129 { | |
3130 uint uFaceID; | |
3131 if (j < pSector->uNumFloors) | |
3132 uFaceID = pSector->pFloors[j]; | |
3133 else | |
3134 uFaceID = pSector->pPortals[j - pSector->uNumFloors]; | |
3135 | |
3136 auto pFace = pFaces + uFaceID; | |
3137 if (pFace->uPolygonType != POLYGON_Floor && | |
3138 pFace->uPolygonType != POLYGON_InBetweenFloorAndWall) | |
3139 continue; | |
3140 | |
3141 v54 = 0; | |
3142 v50 = pVertices[pFace->pVertexIDs[0]].y >= sY; | |
3143 | |
793 | 3144 for (uint k = 1; k <= pFace->uNumVertices; k++) |
791 | 3145 { |
3146 v59 = v50; | |
3147 | |
3148 if (v54 >= 2) | |
3149 break; | |
3150 | |
3151 auto v2 = &pVertices[pFace->pVertexIDs[k]]; | |
3152 v50 = v2->y >= sY; | |
3153 | |
793 | 3154 if (v59 == v50) |
791 | 3155 continue; |
3156 | |
3157 auto v1 = &pVertices[pFace->pVertexIDs[k - 1]]; | |
3158 v25 = v2->x >= sX ? 0 : 2; | |
3159 v26 = v25 | (v1->x < sX); | |
3160 | |
3161 if (v26 == 3) | |
3162 continue; | |
3163 | |
3164 if (!v26) | |
3165 ++v54; | |
3166 else | |
3167 { | |
3168 if (v1->x >= v2->x) | |
3169 { | |
3170 /*int _a58; | |
0 | 3171 int _a59; |
3172 | |
3173 v32 = v1->x - v2->x; | |
3174 LODWORD(v33) = v32 << 16; | |
791 | 3175 HIDWORD(v33) = v32 >> 16;*/ |
3176 //fixpoint_div(v1->x - v2->x, v1->y - v2->y); | |
3177 //_a58 = v33 / (v1->y - v2->y); | |
871 | 3178 //_a59 = fixpoint_sub0(_a58, sY - v2->y); |
791 | 3179 auto x_div_y = fixpoint_div(v1->x - v2->x, v1->y - v2->y); |
871 | 3180 auto res = fixpoint_sub0(x_div_y, sY - v2->y); // a / b * c - looks like projection |
793 | 3181 if (res + v2->x > sX) |
791 | 3182 ++v54; |
3183 } | |
3184 else | |
3185 { | |
3186 auto x_div_y = fixpoint_div(v2->x - v1->x, v2->y - v1->y); | |
871 | 3187 auto res = fixpoint_sub0(x_div_y, sY - v1->y); |
791 | 3188 |
3189 if (res + v1->x > sX) | |
3190 ++v54; | |
3191 | |
3192 /*int _a58; | |
0 | 3193 int _a59; |
791 | 3194 auto v32 = v2->x - v1->x; |
0 | 3195 LODWORD(v33) = v32 << 16; |
3196 HIDWORD(v33) = v32 >> 16; | |
3197 _a58 = v33 / (v2->y - v1->y); | |
871 | 3198 _a59 = fixpoint_sub0(_a58, sY - v1->y); |
0 | 3199 |
787 | 3200 if (_a59 + pVertices[k].x > sX) |
791 | 3201 ++v54;*/ |
0 | 3202 } |
717 | 3203 } |
791 | 3204 } |
3205 | |
3206 if (pFace->uNumVertices && v54 == 1) | |
3207 v43[v55++] = uFaceID; | |
3208 } | |
0 | 3209 } |
3210 | |
791 | 3211 v4 = v43[0]; |
0 | 3212 if ( v55 == 1 ) |
3213 return this->pFaces[v4].uSectorID; | |
3214 v37 = 0; | |
3215 if ( !v55 ) | |
3216 return 0; | |
717 | 3217 pSectorID = 0; |
0 | 3218 v53 = 0xFFFFFFu; |
3219 if ( v55 > 0 ) | |
3220 { | |
3221 v39 = sY; | |
3222 while ( 1 ) | |
3223 { | |
717 | 3224 pFace = &this->pFaces[v43[v37]]; |
3225 //pPolygonType = pFace->uPolygonType; | |
3226 if ( pFace->uPolygonType == POLYGON_Floor ) | |
0 | 3227 { |
717 | 3228 v42 = this->pVertices[*pFace->pVertexIDs].z; |
3229 v39 = sZ - v42; | |
3230 //goto LABEL_47; | |
3231 } | |
3232 if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall ) | |
3233 { | |
3234 //v51 = pFace->zCalc1; | |
3235 v57 = (unsigned __int64)(pFace->zCalc1 * (signed __int64)(sX << 16)) >> 16; | |
3236 //v56 = sY << 16; | |
3237 //v51 = pFace->zCalc2; | |
3238 v56 = (unsigned __int64)(pFace->zCalc2 * (signed __int64)(sY << 16)) >> 16; | |
3239 v42 = (v56 + pFace->zCalc3 + v57 + 32768) >> 16; | |
662 | 3240 v39 = sZ - v42; |
0 | 3241 } |
717 | 3242 //LABEL_47: |
0 | 3243 if ( v39 >= 0 ) |
3244 { | |
3245 if ( v39 < v53 ) | |
3246 { | |
717 | 3247 pSectorID = pFace->uSectorID; |
0 | 3248 v53 = v39; |
3249 } | |
3250 } | |
3251 ++v37; | |
3252 if ( v37 >= v55 ) | |
717 | 3253 return pSectorID; |
0 | 3254 } |
3255 } | |
717 | 3256 //return pSectorID; |
0 | 3257 } |
3258 // 49AC17: using guessed type int var_108[50]; | |
3259 | |
3260 | |
3261 //----- (00498A41) -------------------------------------------------------- | |
3262 char BLVFace::_get_normals(Vec3_int_ *a2, Vec3_int_ *a3) | |
3263 { | |
3264 BLVFace *v3; // ebx@1 | |
3265 int v4; // eax@1 | |
3266 signed __int64 v5; // qax@2 | |
3267 double v6; // st7@8 | |
3268 Vec3_float_ a1; // [sp+Ch] [bp-Ch]@8 | |
3269 | |
3270 v3 = this; | |
3271 LOBYTE(v4) = this->uPolygonType; | |
3272 if ( (char)v4 == POLYGON_VerticalWall ) | |
3273 { | |
3274 a2->x = -this->pFacePlane_old.vNormal.y; | |
3275 LODWORD(v5) = this->pFacePlane_old.vNormal.x; | |
3276 LABEL_9: | |
3277 a2->y = v5; | |
3278 v4 = 0; | |
3279 a2->z = 0; | |
3280 a3->y = 0; | |
3281 a3->z = 0xFFFF0000u; | |
3282 LABEL_11: | |
3283 a3->x = v4; | |
3284 goto LABEL_12; | |
3285 } | |
3286 if ( (char)v4 == POLYGON_Floor || (char)v4 == POLYGON_Ceiling ) | |
3287 { | |
3288 LABEL_10: | |
3289 v4 = 0; | |
3290 a2->x = 0x10000u; | |
3291 a2->z = 0; | |
3292 a2->y = 0; | |
3293 a3->y = 0xFFFF0000u; | |
3294 a3->z = 0; | |
3295 goto LABEL_11; | |
3296 } | |
3297 if ( (char)v4 == POLYGON_InBetweenFloorAndWall || (char)v4 == POLYGON_InBetweenCeilingAndWall ) | |
3298 { | |
3299 if ( abs(this->pFacePlane_old.vNormal.z) < 46441 ) | |
3300 { | |
3301 a1.x = (double)-v3->pFacePlane_old.vNormal.y; | |
3302 a1.y = (double)v3->pFacePlane_old.vNormal.x; | |
3303 a1.z = 0.0; | |
3304 a1.Normalize(); | |
3305 v6 = a1.y * 65536.0; | |
3306 a2->x = (signed __int64)(a1.x * 65536.0); | |
3307 v5 = (signed __int64)v6; | |
3308 goto LABEL_9; | |
3309 } | |
3310 goto LABEL_10; | |
3311 } | |
3312 LABEL_12: | |
3313 if ( BYTE2(v3->uAttributes) & 0x80 ) | |
3314 { | |
3315 a2->x = -a2->x; | |
3316 a2->y = -a2->y; | |
3317 a2->z = -a2->z; | |
3318 } | |
3319 if ( BYTE3(v3->uAttributes) & 1 ) | |
3320 { | |
3321 a3->x = -a3->x; | |
3322 a3->y = -a3->y; | |
3323 a3->z = -a3->z; | |
3324 } | |
3325 return v4; | |
3326 } | |
3327 | |
3328 //----- (0044C23B) -------------------------------------------------------- | |
428 | 3329 bool BLVFaceExtra::HasEventint() |
3330 { | |
3331 signed int event_index; // eax@1 | |
3332 _evt_raw* start_evt; | |
3333 _evt_raw* end_evt; | |
3334 | |
3335 event_index = 0; | |
3336 if ( (uLevelEVT_NumEvents - 1) <= 0 ) | |
3337 return false; | |
3338 while ( pLevelEVT_Index[event_index].uEventID != this->uEventID ) | |
0 | 3339 { |
428 | 3340 ++event_index; |
3341 if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) | |
3342 return false; | |
0 | 3343 } |
428 | 3344 end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; |
3345 start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
3346 if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) | |
3347 return false; | |
0 | 3348 else |
428 | 3349 return true; |
0 | 3350 } |
3351 | |
3352 | |
3353 | |
3354 | |
3355 //----- (0046F228) -------------------------------------------------------- | |
3356 void __cdecl BLV_UpdateDoors() | |
3357 { | |
472 | 3358 //int v0; // ebx@1 |
3359 //int v1; // edi@1 | |
3360 //BLVDoor *v2; // esi@3 | |
3361 //unsigned __int16 v3; // ax@3 | |
3362 //unsigned int v4; // ecx@5 | |
3363 //int v5; // eax@8 | |
3364 //int v6; // ecx@8 | |
3365 //int v7; // eax@12 | |
3366 //int v8; // eax@16 | |
3367 //unsigned __int8 v9; // zf@18 | |
3368 //char v10; // sf@18 | |
3369 //unsigned __int8 v11; // of@18 | |
3370 //int v12; // edi@19 | |
3371 //int v13; // ecx@19 | |
3372 //__int16 v14; // ax@19 | |
0 | 3373 BLVFace *v15; // ebx@24 |
472 | 3374 //unsigned __int16 *v16; // ecx@24 |
0 | 3375 Vec3_short_ *v17; // esi@24 |
3376 int v18; // eax@24 | |
3377 int v19; // edx@24 | |
3378 signed int v20; // eax@24 | |
472 | 3379 //Vec3_short_ *v21; // ecx@24 |
3380 //double v22; // st7@24 | |
3381 //double v23; // st6@24 | |
0 | 3382 int v24; // esi@25 |
3383 int v25; // eax@25 | |
472 | 3384 //BLVDoor *v26; // edi@25 |
0 | 3385 signed __int64 v27; // qtt@27 |
3386 BLVFaceExtra *v28; // esi@32 | |
3387 int v29; // ecx@34 | |
3388 int v30; // edx@34 | |
3389 unsigned __int64 v31; // qax@34 | |
3390 int v32; // eax@34 | |
472 | 3391 //unsigned __int16 *v33; // eax@35 |
0 | 3392 Vec3_short_ *v34; // eax@35 |
3393 int v35; // ecx@35 | |
3394 int v36; // edx@35 | |
3395 signed int v37; // eax@35 | |
3396 signed int v38; // edx@35 | |
3397 int v39; // eax@35 | |
3398 int v40; // edx@35 | |
472 | 3399 //unsigned __int8 v41; // cf@35 |
3400 //unsigned __int16 *v42; // edi@36 | |
0 | 3401 Vec3_short_ *v43; // edi@36 |
472 | 3402 //int v44; // ecx@36 |
3403 //int v45; // edi@36 | |
3404 //int v46; // ecx@36 | |
3405 //__int16 *v47; // edx@44 | |
3406 //int v48; // ecx@44 | |
0 | 3407 unsigned int v49; // ecx@46 |
3408 unsigned __int16 v50; // ax@48 | |
3409 unsigned int v51; // eax@51 | |
3410 unsigned __int16 v52; // ax@54 | |
3411 int v53; // ecx@57 | |
472 | 3412 //int v54; // edx@57 |
0 | 3413 unsigned __int64 v55; // qax@57 |
3414 int v56; // ecx@58 | |
3415 int v57; // eax@58 | |
472 | 3416 //int v58; // eax@59 |
3417 //SoundID v59; // [sp-24h] [bp-88h]@12 | |
3418 //signed int v60; // [sp-20h] [bp-84h]@12 | |
3419 //unsigned int v61; // [sp-1Ch] [bp-80h]@12 | |
3420 //signed int v62; // [sp-18h] [bp-7Ch]@12 | |
3421 //signed int v63; // [sp-14h] [bp-78h]@12 | |
3422 //int v64; // [sp-10h] [bp-74h]@12 | |
3423 //unsigned int v65; // [sp-Ch] [bp-70h]@12 | |
3424 //int v66; // [sp-8h] [bp-6Ch]@12 | |
3425 Vec3_int_ v67; | |
3426 //int v67; // [sp+8h] [bp-5Ch]@31 | |
3427 //int v68; // [sp+Ch] [bp-58h]@34 | |
3428 //int v69; // [sp+10h] [bp-54h]@34 | |
3429 Vec3_int_ v70; | |
3430 //int v70; // [sp+14h] [bp-50h]@31 | |
3431 //int v71; // [sp+18h] [bp-4Ch]@34 | |
3432 //int v72; // [sp+1Ch] [bp-48h]@34 | |
0 | 3433 int v73; // [sp+20h] [bp-44h]@24 |
472 | 3434 //__int16 v74; // [sp+24h] [bp-40h]@24 |
0 | 3435 int v75; // [sp+28h] [bp-3Ch]@36 |
3436 int v76; // [sp+2Ch] [bp-38h]@36 | |
3437 int v77; // [sp+30h] [bp-34h]@36 | |
472 | 3438 //int v78; // [sp+34h] [bp-30h]@36 |
3439 //int v79; // [sp+38h] [bp-2Ch]@19 | |
3440 //unsigned int v80; // [sp+3Ch] [bp-28h]@2 | |
3441 //int v81; // [sp+40h] [bp-24h]@1 | |
0 | 3442 int v82; // [sp+44h] [bp-20h]@35 |
3443 int v83; // [sp+48h] [bp-1Ch]@34 | |
3444 int v84; // [sp+4Ch] [bp-18h]@34 | |
3445 int v85; // [sp+50h] [bp-14h]@19 | |
3446 SoundID eDoorSoundID; // [sp+54h] [bp-10h]@1 | |
472 | 3447 //BLVDoor *v87; // [sp+58h] [bp-Ch]@3 |
0 | 3448 int v88; // [sp+5Ch] [bp-8h]@18 |
3449 int v89; // [sp+60h] [bp-4h]@6 | |
3450 | |
472 | 3451 //v0 = 0; |
3452 //v1 = 0; | |
0 | 3453 eDoorSoundID = (SoundID)pDoorSoundIDsByLocationID[dword_6BE13C_uCurrentlyLoadedLocationID]; |
472 | 3454 //v81 = 0; |
3455 //if ( pIndoor->uNumDoors > 0 ) | |
3456 for (uint i = 0; i < pIndoor->uNumDoors; ++i) | |
0 | 3457 { |
472 | 3458 auto door = pIndoor->pDoors + i; |
3459 //v80 = 0; | |
3460 //do | |
3461 //{ | |
3462 //v2 = &pIndoor->pDoors[v80 / 0x50]; | |
3463 //v87 = &pIndoor->pDoors[v80 / 0x50]; | |
3464 //v3 = door->uState; | |
3465 if (door->uState == BLVDoor::Closed || door->uState == BLVDoor::Open) | |
0 | 3466 { |
472 | 3467 door->uAttributes &= 0xFFFFFFFDu; |
0 | 3468 goto LABEL_62; |
3469 } | |
472 | 3470 door->uTimeSinceTriggered += pEventTimer->uTimeElapsed; |
3471 //v4 = door->uTimeSinceTriggered; | |
3472 if (door->uState == BLVDoor::Opening) | |
0 | 3473 { |
472 | 3474 v89 = (signed int)(door->uTimeSinceTriggered * door->uCloseSpeed) / 128; |
3475 if ( v89 >= door->uMoveLength ) | |
0 | 3476 { |
472 | 3477 v89 = door->uMoveLength; |
3478 door->uState = BLVDoor::Open; | |
0 | 3479 LABEL_10: |
472 | 3480 if ( !(door->uAttributes & 6) && door->uNumVertices != 0) |
0 | 3481 { |
472 | 3482 //v66 = 0; |
3483 //v65 = 0; | |
3484 //v64 = 0; | |
862 | 3485 //v7 = PID(OBJECT_BLVDoor,i); |
472 | 3486 //v63 = 0; |
3487 //v62 = -1; | |
862 | 3488 //LOBYTE(v7) = PID(OBJECT_BLVDoor,i); |
472 | 3489 //v61 = 0; |
862 | 3490 //v60 = PID(OBJECT_BLVDoor,i); |
472 | 3491 //v59 = (SoundID)((int)eDoorSoundID + 1); |
3492 //LABEL_17: | |
862 | 3493 pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), PID(OBJECT_BLVDoor,i), 0, -1, 0, 0, 0, 0); |
472 | 3494 //goto LABEL_18; |
0 | 3495 } |
3496 goto LABEL_18; | |
3497 } | |
3498 } | |
3499 else | |
3500 { | |
472 | 3501 auto v5 = (signed int)(door->uTimeSinceTriggered * door->uOpenSpeed) / 128; |
3502 //v6 = door->uMoveLength; | |
3503 if ( v5 >= door->uMoveLength) | |
0 | 3504 { |
472 | 3505 v89 = 0; |
3506 door->uState = BLVDoor::Closed; | |
0 | 3507 goto LABEL_10; |
3508 } | |
472 | 3509 v89 = door->uMoveLength - v5; |
0 | 3510 } |
472 | 3511 if ( !(door->uAttributes & 6) && door->uNumVertices) |
0 | 3512 { |
472 | 3513 //v66 = 0; |
3514 //v65 = 0; | |
3515 //v64 = 0; | |
862 | 3516 //v8 = PID(OBJECT_BLVDoor,i); |
472 | 3517 //v63 = 0; |
3518 //v62 = -1; | |
3519 //LOBYTE(v8) = 8 * v1 | 1; | |
3520 //v61 = 1; | |
862 | 3521 //v60 = PID(OBJECT_BLVDoor,i); |
472 | 3522 //v59 = eDoorSoundID; |
862 | 3523 pAudioPlayer->PlaySound(eDoorSoundID, PID(OBJECT_BLVDoor,i), 1, -1, 0, 0, 0, 0); |
472 | 3524 //goto LABEL_18; |
0 | 3525 } |
3526 LABEL_18: | |
472 | 3527 //v11 = __OFSUB__(v2->uNumVertices, 0); |
3528 //v9 = v2->uNumVertices == 0; | |
3529 //v10 = (signed __int16)(v2->uNumVertices - 0) < 0; | |
3530 //v88 = 0; | |
3531 //if (door->uNumVertices > 0) | |
3532 for (uint j = 0; j < door->uNumVertices; ++j) | |
0 | 3533 { |
472 | 3534 //do |
3535 //{ | |
3536 //v12 = v88; | |
3537 //v13 = door->pVertexIDs[v88]; | |
3538 //v85 = v89; | |
3539 //v79 = door->vDirection.x; | |
3540 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
3541 //v13 *= 6; | |
3542 pIndoor->pVertices[door->pVertexIDs[j]].x = ((unsigned int)(door->vDirection.x * v89) >> 16) + door->pXOffsets[j]; | |
3543 //v85 = v89; | |
3544 //v79 = door->vDirection.y; | |
3545 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
3546 pIndoor->pVertices[door->pVertexIDs[j]].y = ((unsigned int)(door->vDirection.y * v89) >> 16) + door->pYOffsets[j]; | |
3547 //v85 = v89; | |
3548 //v79 = door->vDirection.z; | |
3549 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
3550 //v14 = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; | |
3551 pIndoor->pVertices[door->pVertexIDs[j]].z = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; | |
3552 //++v88; | |
3553 //} | |
3554 //while ( v88 < door->uNumVertices ); | |
3555 //v1 = v81; | |
0 | 3556 } |
472 | 3557 //v11 = __OFSUB__(v2->uNumFaces, 0); |
3558 //v9 = v2->uNumFaces == 0; | |
3559 //v10 = (signed __int16)(v2->uNumFaces - 0) < 0; | |
3560 v88 = 0; | |
3561 if (door->uNumFaces > 0) | |
0 | 3562 { |
3563 while ( 1 ) | |
3564 { | |
472 | 3565 v15 = &pIndoor->pFaces[door->pFaceIDs[v88]]; |
3566 //v16 = v15->pVertexIDs; | |
3567 v17 = &pIndoor->pVertices[v15->pVertexIDs[0]]; | |
0 | 3568 v18 = v15->pFacePlane_old.vNormal.y; |
3569 v73 = *(int *)&v17->x; | |
472 | 3570 //v74 = v17->z; |
0 | 3571 v19 = v15->pFacePlane_old.vNormal.z; |
472 | 3572 v20 = -(v19 * (int)v17->z + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); |
0 | 3573 v15->pFacePlane_old.dist = v20; |
472 | 3574 //v21 = &pIndoor->pVertices[v15->pVertexIDs[0]]; |
3575 //v79 = v21->x; | |
3576 //v22 = (double)v21->x; | |
3577 //v23 = (double)v21->y; | |
3578 //v79 = v21->z; | |
3579 v15->pFacePlane.dist = -((double)v17->z * v15->pFacePlane.vNormal.z | |
3580 + (double)v17->y * v15->pFacePlane.vNormal.y | |
3581 + (double)v17->x * v15->pFacePlane.vNormal.x); | |
0 | 3582 if ( v19 ) |
3583 { | |
3584 v24 = abs(v20 >> 15); | |
3585 v25 = abs(v15->pFacePlane_old.vNormal.z); | |
472 | 3586 //v26 = v87; |
0 | 3587 if ( v24 > v25 ) |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3588 Abortf("Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", |
472 | 3589 door->uDoorID, |
3590 door->pFaceIDs[v88], | |
0 | 3591 v15->pFacePlane_old.dist, |
3592 v15->pFacePlane_old.vNormal.z); | |
472 | 3593 //v79 = v15->pFacePlane_old.vNormal.z; |
3594 //v85 = v15->pFacePlane_old.dist; | |
3595 LODWORD(v27) = v15->pFacePlane_old.dist << 16; | |
3596 HIDWORD(v27) = v15->pFacePlane_old.dist >> 16; | |
3597 //v85 = v27 / v15->pFacePlane_old.vNormal.z; | |
3598 v15->zCalc3 = -v27 / v15->pFacePlane_old.vNormal.z; | |
0 | 3599 } |
472 | 3600 /*else |
0 | 3601 { |
3602 v26 = v87; | |
472 | 3603 }*/ |
0 | 3604 if ( BYTE2(v15->uAttributes) & 4 || pRenderer->pRenderD3D ) |
472 | 3605 v15->_get_normals(&v70, &v67); |
0 | 3606 v28 = &pIndoor->pFaceExtras[v15->uFaceExtraID]; |
3607 if ( !pRenderer->pRenderD3D ) | |
3608 { | |
3609 if ( !(BYTE2(v15->uAttributes) & 4) ) | |
3610 goto LABEL_59; | |
472 | 3611 //v79 = door->vDirection.x; |
3612 v83 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; | |
3613 //v85 = v71; | |
3614 //v79 = door->vDirection.y; | |
3615 v85 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; | |
3616 //v84 = v72; | |
3617 //v79 = door->vDirection.z; | |
3618 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; | |
3619 //v79 = v83 + v85 + v84; | |
0 | 3620 v29 = v89; |
472 | 3621 //v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; |
3622 v28->sTextureDeltaU = -((v83 + v85 + v84) * (signed __int64)v89) >> 16; | |
3623 //v79 = door->vDirection.x; | |
3624 v85 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; | |
3625 //v83 = v68; | |
3626 //v79 = door->vDirection.y; | |
3627 v83 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; | |
3628 //v84 = v69; | |
3629 //v79 = door->vDirection.z; | |
3630 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; | |
3631 //v30 = v83 + v84; | |
3632 //v79 = v85 + v30; | |
3633 v31 = (v85 + v83 + v84) * (signed __int64)v29; | |
3634 //v83 = v31 >> 16; | |
0 | 3635 v32 = v31 >> 16; |
3636 goto LABEL_58; | |
3637 } | |
3638 v28->sTextureDeltaU = 0; | |
3639 v28->sTextureDeltaV = 0; | |
472 | 3640 //v33 = v15->pVertexIDs; |
3641 //v85 = 1; | |
3642 v34 = &pIndoor->pVertices[v15->pVertexIDs[0]]; | |
0 | 3643 v35 = v34->z; |
3644 v36 = v34->y; | |
3645 v82 = v34->x; | |
472 | 3646 //v79 = v36; |
3647 v37 = v70.x * v82 + v70.y * v36 + v70.z * v35; | |
3648 v38 = v67.x * v82 + v67.y * v36 + v67.z * v35; | |
0 | 3649 v39 = v37 >> 16; |
3650 *v15->pVertexUIDs = v39; | |
3651 v40 = v38 >> 16; | |
3652 *v15->pVertexVIDs = v40; | |
472 | 3653 //v41 = v15->uNumVertices < 1u; |
3654 //v9 = v15->uNumVertices == 1; | |
3655 //v83 = v40; | |
0 | 3656 v84 = v39; |
3657 v82 = v40; | |
472 | 3658 //if (v15->uNumVertices > 1) |
3659 for (uint j = 1; j < v15->uNumVertices; ++j) | |
0 | 3660 { |
472 | 3661 //do |
3662 //{ | |
3663 //v42 = v15->pVertexIDs; | |
3664 //v75 = 2 * v85; | |
3665 v43 = &pIndoor->pVertices[v15->pVertexIDs[j]]; | |
3666 //v79 = v43->z; | |
3667 //v44 = v43->y; | |
3668 //v45 = v43->x; | |
3669 //v78 = v43->y; | |
3670 v76 = ((__int64)v70.z * v43->z + (__int64)v70.x * v43->x + (__int64)v70.y * v43->y) >> 16; | |
3671 //v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; | |
3672 v77 = ((__int64)v67.x * v43->x + (__int64)v67.y * v43->y + (__int64)v43->z * v67.z) >> 16; | |
0 | 3673 if ( v76 < v39 ) |
3674 v39 = v76; | |
472 | 3675 if ( v77 < v40 ) |
3676 v40 = v77; | |
0 | 3677 if ( v76 > v84 ) |
3678 v84 = v76; | |
472 | 3679 if ( v77 > v82 ) |
3680 v82 = v77; | |
3681 //v40 = v83; | |
3682 //v47 = v15->pVertexUIDs; | |
3683 //v48 = v75; | |
3684 //++v85; | |
3685 v15->pVertexUIDs[j] = v76; | |
3686 v15->pVertexVIDs[j] = v77; | |
3687 //} | |
3688 //while ( v85 < v15->uNumVertices ); | |
3689 //v26 = v87; | |
0 | 3690 } |
3691 v49 = v15->uAttributes; | |
3692 if ( BYTE1(v49) & 0x10 ) | |
3693 goto LABEL_50; | |
3694 if ( SBYTE1(v49) < 0 ) | |
3695 { | |
3696 v50 = v15->uBitmapID; | |
3697 if ( v50 != -1 ) | |
3698 break; | |
3699 } | |
3700 LABEL_51: | |
3701 v51 = v15->uAttributes; | |
3702 if ( v51 & 8 ) | |
3703 { | |
3704 v28->sTextureDeltaV -= v40; | |
3705 } | |
3706 else | |
3707 { | |
3708 if ( v51 & 0x20000 ) | |
3709 { | |
3710 v52 = v15->uBitmapID; | |
3711 if ( v52 != -1 ) | |
945 | 3712 v28->sTextureDeltaV -= v82 + pBitmaps_LOD->GetTexture(v52)->uTextureHeight; |
0 | 3713 } |
3714 } | |
3715 if ( BYTE2(v15->uAttributes) & 4 ) | |
3716 { | |
472 | 3717 //v75 = door->vDirection.x; |
3718 v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; | |
3719 //v82 = v71; | |
3720 //v75 = door->vDirection.y; | |
3721 v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; | |
3722 //v83 = v72; | |
3723 //v75 = door->vDirection.z; | |
3724 v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; | |
3725 v75 = v84 + v82 + v83; | |
0 | 3726 v53 = v89; |
3727 v82 = (unsigned __int64)(v75 * (signed __int64)v89) >> 16; | |
472 | 3728 v28->sTextureDeltaU = -v82; |
3729 //v75 = door->vDirection.x; | |
3730 v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; | |
3731 //v82 = v68; | |
3732 //v75 = door->vDirection.y; | |
3733 v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; | |
3734 //v83 = v69; | |
3735 //v75 = door->vDirection.z; | |
3736 v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; | |
3737 //v54 = v82 + v83; | |
3738 v75 = v84 + v82 + v83; | |
3739 v55 = v75 * (signed __int64)v53; | |
3740 //v82 = v55 >> 16; | |
0 | 3741 v32 = v55 >> 16; |
3742 LABEL_58: | |
3743 v56 = v88; | |
3744 v57 = -v32; | |
3745 v28->sTextureDeltaV = v57; | |
472 | 3746 v28->sTextureDeltaU += door->pDeltaUs[v56]; |
3747 v28->sTextureDeltaV = v57 + door->pDeltaVs[v56]; | |
0 | 3748 } |
3749 LABEL_59: | |
472 | 3750 //v58 = door->uNumFaces; |
0 | 3751 ++v88; |
472 | 3752 if ( v88 >= door->uNumFaces) |
0 | 3753 { |
472 | 3754 //v1 = v81; |
3755 //v0 = 0; | |
0 | 3756 goto LABEL_62; |
3757 } | |
472 | 3758 //v2 = v87; |
0 | 3759 } |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3760 LOWORD(v39) = v84; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3761 if (v15->uBitmapID != -1) |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3762 LOWORD(v39) += pBitmaps_LOD->pTextures[v15->uBitmapID].uTextureWidth; |
0 | 3763 LABEL_50: |
3764 v28->sTextureDeltaU -= v39; | |
3765 goto LABEL_51; | |
3766 } | |
3767 LABEL_62: | |
472 | 3768 ; |
3769 //v80 += 80; | |
3770 //++v1; | |
3771 //v81 = v1; | |
3772 //} | |
3773 //while ( v1 < pIndoor->uNumDoors ); | |
0 | 3774 } |
3775 } | |
3776 // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID; | |
3777 | |
3778 //----- (0046F90C) -------------------------------------------------------- | |
3779 void __cdecl UpdateActors_BLV() | |
3780 { | |
3781 Actor *v0; // esi@2 | |
3782 unsigned __int16 v1; // ax@2 | |
3783 int v2; // edi@6 | |
3784 int v3; // eax@6 | |
3785 int v4; // eax@8 | |
3786 __int16 v5; // ax@11 | |
3787 signed int v6; // ebx@14 | |
3788 unsigned __int8 v7; // zf@14 | |
3789 unsigned __int8 v8; // sf@14 | |
3790 signed __int16 v9; // ax@17 | |
3791 signed __int64 v10; // qax@18 | |
3792 unsigned __int16 v11; // ax@21 | |
3793 int v12; // eax@29 | |
3794 unsigned __int64 v13; // qax@29 | |
3795 int v14; // eax@30 | |
3796 unsigned __int64 v15; // qax@30 | |
3797 int v16; // ecx@33 | |
3798 BLVFace *v17; // edx@33 | |
3799 int v18; // ecx@33 | |
3800 BLVFace *v19; // eax@34 | |
3801 int v20; // ecx@46 | |
3802 int v21; // eax@46 | |
3803 int v22; // edi@46 | |
3804 int v23; // eax@48 | |
3805 unsigned int v24; // eax@51 | |
3806 int v25; // eax@52 | |
3807 int v26; // ebx@54 | |
3808 int v27; // ST08_4@54 | |
3809 int v28; // edi@54 | |
3810 int v29; // eax@54 | |
3811 int v30; // ecx@62 | |
3812 int v31; // ebx@62 | |
3813 int v32; // eax@62 | |
3814 int v33; // eax@64 | |
3815 unsigned int v34; // ecx@64 | |
3816 int v35; // ecx@64 | |
3817 signed int v36; // edx@85 | |
3818 signed int v37; // ebx@85 | |
3819 BLVFace *v38; // edi@89 | |
3820 int v39; // ecx@90 | |
3821 int v40; // ebx@90 | |
3822 PolygonType v41; // al@94 | |
3823 int v42; // eax@96 | |
3824 __int16 v43; // dx@96 | |
3825 int v44; // ecx@96 | |
3826 int v45; // edi@101 | |
3827 int v46; // edi@101 | |
3828 int v47; // eax@101 | |
3829 unsigned __int64 v48; // qax@101 | |
3830 unsigned __int8 v49; // zf@103 | |
3831 unsigned __int8 v50; // sf@103 | |
3832 unsigned __int8 v51; // of@103 | |
3833 AIDirection v52; // [sp+0h] [bp-60h]@75 | |
3834 AIDirection v53; // [sp+1Ch] [bp-44h]@116 | |
3835 int v54; // [sp+38h] [bp-28h]@53 | |
3836 unsigned int uSectorID; // [sp+3Ch] [bp-24h]@6 | |
3837 int v56; // [sp+40h] [bp-20h]@6 | |
3838 unsigned int _this; // [sp+44h] [bp-1Ch]@51 | |
3839 int v58; // [sp+48h] [bp-18h]@51 | |
3840 int v59; // [sp+4Ch] [bp-14h]@8 | |
3841 unsigned int uFaceID; // [sp+50h] [bp-10h]@6 | |
3842 int v61; // [sp+54h] [bp-Ch]@14 | |
3843 int v62; // [sp+58h] [bp-8h]@6 | |
3844 unsigned int v63; // [sp+5Ch] [bp-4h]@1 | |
3845 | |
3846 v63 = 0; | |
3847 if ( (signed int)uNumActors > 0 ) | |
3848 { | |
3849 while ( 1 ) | |
3850 { | |
3851 v0 = &pActors[v63]; | |
3852 v1 = v0->uAIState; | |
3853 if ( v1 == 11 || v1 == 19 || v1 == 17 || !v0->uMovementSpeed ) | |
3854 goto LABEL_123; | |
3855 uSectorID = v0->uSectorID; | |
783 | 3856 v2 = collide_against_floor(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, &uSectorID, &uFaceID); |
0 | 3857 v0->uSectorID = uSectorID; |
3858 v3 = v0->pMonsterInfo.uFlying; | |
3859 v56 = v2; | |
3860 v62 = v3; | |
3861 if ( !v0->CanAct() ) | |
3862 v62 = 0; | |
3863 v4 = v0->vPosition.z; | |
3864 v59 = 0; | |
3865 if ( v4 > v2 + 1 ) | |
3866 v59 = 1; | |
3867 if ( v2 <= -30000 ) | |
3868 { | |
3869 v5 = pIndoor->GetSector(v0->vPosition.x, v0->vPosition.y, v4); | |
3870 v0->uSectorID = v5; | |
3871 if ( !v5 | |
723 | 3872 || (v56 = BLV_GetFloorLevel(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &uFaceID), v56 == -30000) ) |
0 | 3873 goto LABEL_123; |
3874 } | |
305 | 3875 if ( v0->uCurrentActionAnimation == ANIM_Walking) |
0 | 3876 { |
3877 v6 = v0->uMovementSpeed; | |
3878 v7 = HIDWORD(v0->pActorBuffs[7].uExpireTime) == 0; | |
3879 v8 = SHIDWORD(v0->pActorBuffs[7].uExpireTime) < 0; | |
3880 v61 = v0->uMovementSpeed; | |
3881 if ( !v8 && (!(v8 | v7) || LODWORD(v0->pActorBuffs[7].uExpireTime)) ) | |
3882 { | |
3883 v9 = v0->pActorBuffs[7].uPower; | |
3884 if ( v9 ) | |
3885 LODWORD(v10) = v6 / (unsigned __int16)v9; | |
3886 else | |
3887 v10 = (signed __int64)((double)v61 * 0.5); | |
3888 v6 = v10; | |
3889 v61 = v10; | |
3890 } | |
3891 v11 = v0->uAIState; | |
3892 if ( v11 == 6 || v11 == 7 ) | |
3893 { | |
3894 v6 *= 2; | |
3895 v61 = v6; | |
3896 } | |
3897 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 1 ) | |
3898 v6 = (signed __int64)((double)v61 * flt_6BE3AC_debug_recmod1_x_1_6); | |
3899 if ( v6 > 1000 ) | |
3900 v6 = 1000; | |
323 | 3901 v12 = stru_5C6E00->Cos(v0->uYawAngle); |
0 | 3902 uSectorID = v12; |
3903 v13 = v12 * (signed __int64)v6; | |
3904 v61 = v13 >> 16; | |
3905 v0->vVelocity.x = WORD1(v13); | |
323 | 3906 uSectorID = stru_5C6E00->Sin(v0->uYawAngle); |
0 | 3907 v61 = (unsigned __int64)(uSectorID * (signed __int64)v6) >> 16; |
3908 v7 = v62 == 0; | |
3909 v0->vVelocity.y = (unsigned int)(uSectorID * v6) >> 16; | |
3910 if ( !v7 ) | |
3911 { | |
323 | 3912 v14 = stru_5C6E00->Sin(v0->uPitchAngle); |
0 | 3913 uSectorID = v14; |
3914 v15 = v14 * (signed __int64)v6; | |
3915 v61 = v15 >> 16; | |
3916 v0->vVelocity.z = WORD1(v15); | |
3917 } | |
3918 } | |
3919 else | |
3920 { | |
3921 v61 = v0->vVelocity.x; | |
3922 uSectorID = 55000; | |
3923 v61 = (unsigned __int64)(55000i64 * v61) >> 16; | |
3924 v0->vVelocity.x = v61; | |
3925 v61 = v0->vVelocity.y; | |
3926 v61 = (unsigned __int64)(uSectorID * (signed __int64)v61) >> 16; | |
3927 v7 = v62 == 0; | |
3928 v0->vVelocity.y = v61; | |
3929 if ( !v7 ) | |
3930 { | |
3931 uSectorID = 55000; | |
3932 v61 = v0->vVelocity.z; | |
3933 v61 = (unsigned __int64)(55000i64 * v61) >> 16; | |
3934 v0->vVelocity.z = v61; | |
3935 } | |
3936 } | |
3937 v16 = v0->vPosition.z; | |
3938 v17 = pIndoor->pFaces; | |
3939 v51 = __OFSUB__(v16, v56); | |
3940 v8 = v16 - v56 < 0; | |
3941 v18 = uFaceID; | |
3942 if ( v8 ^ v51 ) | |
3943 { | |
3944 v0->vPosition.z = v56 + 1; | |
3945 v19 = &v17[v18]; | |
3946 if ( v19->uPolygonType == 3 ) | |
3947 { | |
3948 if ( v0->vVelocity.z < 0 ) | |
3949 v0->vVelocity.z = 0; | |
3950 } | |
3951 else | |
3952 { | |
3953 if ( v19->pFacePlane_old.vNormal.z < 45000 ) | |
3954 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
3955 } | |
3956 } | |
3957 else | |
3958 { | |
3959 if ( v59 && !v62 ) | |
3960 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
3961 } | |
3962 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y + v0->vVelocity.z * v0->vVelocity.z >= 400 ) | |
3963 break; | |
3964 v0->vVelocity.z = 0; | |
3965 v0->vVelocity.y = 0; | |
3966 v0->vVelocity.x = 0; | |
3967 if ( BYTE2(v17[v18].uAttributes) & 0x40 ) | |
3968 { | |
3969 if (v0->uAIState == Dead) | |
3970 v0->uAIState = Removed; | |
3971 } | |
3972 LABEL_123: | |
3973 ++v63; | |
3974 if ( (signed int)v63 >= (signed int)uNumActors ) | |
3975 return; | |
3976 } | |
3977 v20 = v0->uActorRadius; | |
3978 v21 = v0->uActorHeight; | |
3979 stru_721530.field_84 = -1; | |
3980 stru_721530.field_70 = 0; | |
3981 uSectorID = 0; | |
3982 stru_721530.field_0 = 1; | |
3983 stru_721530.field_8 = v20; | |
3984 stru_721530.prolly_normal_d = v20; | |
3985 stru_721530.field_C = v21; | |
3986 v22 = 0; | |
3987 while ( 1 ) | |
3988 { | |
3989 stru_721530.field_34.x = v0->vPosition.x; | |
3990 stru_721530.normal.x = stru_721530.field_34.x; | |
3991 stru_721530.field_34.y = v0->vPosition.y; | |
3992 stru_721530.normal.y = stru_721530.field_34.y; | |
3993 v23 = v0->vPosition.z; | |
3994 stru_721530.normal.z = v23 + v20 + 1; | |
3995 stru_721530.field_34.z = v23 - v20 + stru_721530.field_C - 1; | |
3996 if ( stru_721530.field_34.z < stru_721530.normal.z ) | |
3997 stru_721530.field_34.z = v23 + v20 + 1; | |
3998 stru_721530.field_1C = v0->vVelocity.x; | |
3999 stru_721530.field_20 = v0->vVelocity.y; | |
4000 stru_721530.field_24 = v0->vVelocity.z; | |
4001 stru_721530.uSectorID = v0->uSectorID; | |
4002 if ( !stru_721530._47050A(v22) ) | |
4003 { | |
4004 v58 = v22; | |
4005 v24 = 8 * v63; | |
862 | 4006 LOBYTE(v24) = PID(OBJECT_Actor,v63); |
0 | 4007 v61 = v22; |
4008 _this = v24; | |
4009 do | |
4010 { | |
4011 _46E44E_collide_against_faces_and_portals(1u); | |
4012 _46E0B2_collide_against_decorations(); | |
4013 _46EF01_collision_chech_player(0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
4014 _46ED8A_collide_against_sprite_objects(_this); |
0 | 4015 v25 = 0; |
4016 v56 = 0; | |
4017 if ( ai_arrays_size > v22 ) | |
4018 { | |
4019 do | |
4020 { | |
390 | 4021 v54 = ai_near_actors_ids[v25]; |
0 | 4022 if ( v54 != v63 ) |
4023 { | |
4024 v26 = v54; | |
4025 v27 = abs(pActors[v54].vPosition.z - v0->vPosition.z); | |
4026 v28 = abs(pActors[v26].vPosition.y - v0->vPosition.y); | |
4027 v29 = abs(pActors[v26].vPosition.x - v0->vPosition.x); | |
322 | 4028 if ( int_get_vector_length(v29, v28, v27) >= v0->uActorRadius + (signed int)pActors[v26].uActorRadius |
0 | 4029 && _46DF1A_collide_against_actor(v54, 40) ) |
4030 ++v58; | |
4031 v22 = 0; | |
4032 } | |
4033 v25 = v56++ + 1; | |
4034 } | |
4035 while ( v56 < ai_arrays_size ); | |
4036 } | |
4037 if ( _46F04E_collide_against_portals() ) | |
4038 break; | |
4039 ++v61; | |
4040 } | |
4041 while ( v61 < 100 ); | |
4042 v56 = v58 > 1; | |
4043 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
4044 { | |
4045 v30 = stru_721530.normal2.x; | |
4046 v31 = stru_721530.normal2.y; | |
4047 v32 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
4048 } | |
4049 else | |
4050 { | |
4051 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; | |
4052 v30 = v58 + v0->vPosition.x; | |
4053 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; | |
4054 v31 = v58 + v0->vPosition.y; | |
4055 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; | |
4056 v32 = v58 + v0->vPosition.z; | |
4057 } | |
783 | 4058 v33 = collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID); |
0 | 4059 v34 = pIndoor->pFaces[uFaceID].uAttributes; |
4060 v35 = v34 & 0x400000; | |
4061 if (v35 && v0->uAIState == Dead) | |
4062 { | |
4063 v0->uAIState = Removed; | |
4064 goto LABEL_120; | |
4065 } | |
4066 if ( v59 != v22 || v62 != v22 || v35 == v22 ) | |
4067 { | |
4068 if ( v33 == -30000 ) | |
4069 goto LABEL_120; | |
4070 if ( v0->uCurrentActionAnimation != 1 || v33 >= v0->vPosition.z - 100 || v59 != v22 || v62 != v22 ) | |
4071 { | |
4072 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
4073 { | |
4074 v0->vPosition.x = LOWORD(stru_721530.normal2.x); | |
4075 v0->vPosition.y = LOWORD(stru_721530.normal2.y); | |
4076 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | |
4077 v0->uSectorID = LOWORD(stru_721530.uSectorID); | |
4078 goto LABEL_123; | |
4079 } | |
4080 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; | |
4081 v0->vPosition.x += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.x) >> 16; | |
4082 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; | |
4083 v0->vPosition.y += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.y) >> 16; | |
4084 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; | |
4085 v36 = stru_721530.uFaceID; | |
4086 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; | |
4087 v0->uSectorID = LOWORD(stru_721530.uSectorID); | |
4088 stru_721530.field_70 += stru_721530.field_7C; | |
848 | 4089 v37 = PID_ID(v36); |
4090 if ( PID_TYPE(v36) != OBJECT_Actor) | |
0 | 4091 { |
848 | 4092 if ( PID_TYPE(v36) != OBJECT_Player) |
0 | 4093 { |
848 | 4094 if ( PID_TYPE(v36) == OBJECT_Decoration) |
0 | 4095 { |
295 | 4096 _this = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); |
0 | 4097 v45 = stru_5C6E00->Atan2( |
4098 v0->vPosition.x - pLevelDecorations[v37].vPosition.x, | |
4099 v0->vPosition.y - pLevelDecorations[v37].vPosition.y); | |
323 | 4100 v54 = stru_5C6E00->Cos(v45); |
0 | 4101 v56 = (unsigned __int64)(v54 * (signed __int64)(signed int)_this) >> 16; |
4102 v46 = v45 - stru_5C6E00->uIntegerHalfPi; | |
4103 v0->vVelocity.x = v54 * _this >> 16; | |
323 | 4104 v47 = stru_5C6E00->Sin(v45); |
0 | 4105 v54 = v47; |
4106 v48 = v47 * (signed __int64)(signed int)_this; | |
4107 v56 = v48 >> 16; | |
4108 v0->vVelocity.y = WORD1(v48); | |
4109 goto LABEL_119; | |
4110 } | |
848 | 4111 if ( PID_TYPE(v36) == OBJECT_BModel) |
0 | 4112 { |
4113 stru_721530.field_84 = v36 >> 3; | |
4114 v38 = &pIndoor->pFaces[v37]; | |
4115 if ( v38->uPolygonType == 3 ) | |
4116 { | |
4117 v39 = v0->vVelocity.x; | |
4118 v40 = v0->vVelocity.y * v0->vVelocity.y; | |
4119 v0->vVelocity.z = 0; | |
4120 v0->vPosition.z = pIndoor->pVertices[*v38->pVertexIDs].z + 1; | |
4121 if ( v39 * v39 + v40 < 400 ) | |
4122 { | |
4123 v0->vVelocity.y = 0; | |
4124 v0->vVelocity.x = 0; | |
4125 goto LABEL_119; | |
4126 } | |
4127 } | |
4128 else | |
4129 { | |
4130 v61 = abs(v38->pFacePlane_old.vNormal.x * v0->vVelocity.x + v38->pFacePlane_old.vNormal.y | |
4131 * v0->vVelocity.y | |
4132 + v38->pFacePlane_old.vNormal.z | |
4133 * v0->vVelocity.z) >> 16; | |
4134 if ( stru_721530.field_64 >> 3 > v61 ) | |
4135 v61 = stru_721530.field_64 >> 3; | |
4136 v58 = v38->pFacePlane_old.vNormal.x; | |
4137 v58 = (unsigned __int64)(v61 * (signed __int64)v58) >> 16; | |
4138 _this = v38->pFacePlane_old.vNormal.y; | |
4139 _this = (unsigned __int64)(v61 * (signed __int64)(signed int)_this) >> 16; | |
4140 v56 = v38->pFacePlane_old.vNormal.z; | |
4141 v56 = (unsigned __int64)(v61 * (signed __int64)v56) >> 16; | |
4142 v0->vVelocity.x += v58; | |
4143 v0->vVelocity.y += _this; | |
4144 v0->vVelocity.z += v56; | |
4145 v41 = v38->uPolygonType; | |
4146 if ( v41 != 4 && v41 != 3 ) | |
4147 { | |
4148 v42 = v38->pFacePlane_old.vNormal.x; | |
4149 v43 = v0->vPosition.z; | |
4150 v44 = stru_721530.prolly_normal_d | |
4151 - ((v38->pFacePlane_old.dist | |
4152 + v38->pFacePlane_old.vNormal.z * v0->vPosition.z | |
4153 + v38->pFacePlane_old.vNormal.y * v0->vPosition.y | |
4154 + v42 * v0->vPosition.x) >> 16); | |
4155 if ( v44 > 0 ) | |
4156 { | |
4157 v0->vPosition.x += (unsigned int)(v44 * v42) >> 16; | |
4158 v0->vPosition.y += (unsigned int)(v44 * v38->pFacePlane_old.vNormal.y) >> 16; | |
4159 v0->vPosition.z = v43 + ((unsigned int)(v44 * v38->pFacePlane_old.vNormal.z) >> 16); | |
4160 } | |
4161 v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y); | |
4162 } | |
4163 } | |
4164 if ( BYTE3(v38->uAttributes) & 8 ) | |
4165 EventProcessor(pIndoor->pFaceExtras[v38->uFaceExtraID].uEventID, 0, 1); | |
4166 } | |
4167 LABEL_119: | |
4168 v56 = v0->vVelocity.x; | |
4169 v54 = 58500; | |
4170 v56 = (unsigned __int64)(58500i64 * v56) >> 16; | |
4171 v0->vVelocity.x = v56; | |
4172 v56 = v0->vVelocity.y; | |
4173 v56 = (unsigned __int64)(v54 * (signed __int64)v56) >> 16; | |
4174 v54 = 58500; | |
4175 v0->vVelocity.y = v56; | |
4176 v56 = v0->vVelocity.z; | |
4177 v56 = (unsigned __int64)(v54 * (signed __int64)v56) >> 16; | |
4178 v22 = 0; | |
4179 v0->vVelocity.z = v56; | |
4180 goto LABEL_120; | |
4181 } | |
4182 if ( v0->GetActorsRelation(0) ) | |
4183 { | |
4184 v51 = __OFSUB__(HIDWORD(pParty->pPartyBuffs[11].uExpireTime), v22); | |
4185 v49 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == v22; | |
4186 v50 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) - v22 < 0; | |
4187 v0->vVelocity.y = v22; | |
4188 v0->vVelocity.x = v22; | |
4189 if ( !(v50 ^ v51) | |
4190 && (!((unsigned __int8)(v50 ^ v51) | v49) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > v22) ) | |
4191 pParty->pPartyBuffs[11].Reset(); | |
4192 viewparams->bRedrawGameUI = 1; | |
4193 goto LABEL_119; | |
4194 } | |
4195 v36 = stru_721530.uFaceID; | |
4196 LABEL_118: | |
4197 Actor::FaceObject(v63, v36, v22, (AIDirection *)v22); | |
4198 goto LABEL_119; | |
4199 } | |
4200 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 2 || pTurnEngine->field_4 == 3) ) | |
4201 goto LABEL_119; | |
4202 if ( v0->pMonsterInfo.uHostilityType ) | |
4203 { | |
4204 if ( v56 == v22 ) | |
4205 goto LABEL_114; | |
4206 } | |
4207 else | |
4208 { | |
4209 if ( v56 == v22 ) | |
4210 { | |
4211 if ( !pActors[v37].pMonsterInfo.uHostilityType ) | |
4212 goto LABEL_118; | |
4213 LABEL_114: | |
860 | 4214 Actor::Flee(v63, v36, v22, (AIDirection *)v22); |
0 | 4215 goto LABEL_119; |
4216 } | |
4217 } | |
414 | 4218 Actor::AI_StandOrBored(v63, 4, v22, &v53); |
0 | 4219 goto LABEL_119; |
4220 } | |
4221 if ( v0->vPosition.x & 1 ) | |
4222 v0->uYawAngle += 100; | |
4223 else | |
4224 v0->uYawAngle -= 100; | |
4225 } | |
4226 else | |
4227 { | |
4228 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 2 || pTurnEngine->field_4 == 3) ) | |
4229 goto LABEL_123; | |
4230 if ( !v0->pMonsterInfo.uHostilityType || v56 != v22 ) | |
4231 { | |
414 | 4232 Actor::AI_StandOrBored(v63, 4, v22, &v52); |
0 | 4233 goto LABEL_123; |
4234 } | |
4235 } | |
4236 } | |
4237 LABEL_120: | |
4238 ++uSectorID; | |
4239 if ( uSectorID >= 100 ) | |
4240 goto LABEL_123; | |
4241 v20 = stru_721530.prolly_normal_d; | |
4242 } | |
4243 } | |
4244 } | |
4245 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
4246 // 4F75D8: using guessed type int ai_arrays_size; | |
4247 | |
4248 | |
4249 | |
4250 | |
4251 | |
4252 | |
4253 //----- (00460A78) -------------------------------------------------------- | |
4254 void __thiscall PrepareToLoadBLV(unsigned int bLoading) | |
4255 { | |
4256 unsigned int v1; // ebx@1 | |
4257 unsigned int v2; // eax@8 | |
4258 MapInfo *v3; // edi@9 | |
4259 int v4; // eax@11 | |
4260 int v5; // eax@12 | |
4261 int v6; // eax@13 | |
4262 int v7; // esi@27 | |
4263 SpawnPointMM7 *v8; // edx@28 | |
4264 //char v9; // bl@33 | |
4265 //int v10; // eax@34 | |
4266 //char *v11; // ecx@37 | |
4267 //int v12; // edi@44 | |
4268 //unsigned int v13; // edi@48 | |
4269 char *v14; // esi@49 | |
4270 __int16 v15; // ax@50 | |
4271 int v16; // ecx@52 | |
4272 DecorationDesc *v17; // eax@54 | |
4273 int v18; // ecx@55 | |
4274 //int *v19; // edi@58 | |
4275 //unsigned char v20; // dl@58 | |
4276 int v21; // eax@64 | |
4277 char v22; // cl@64 | |
4278 //signed int v23; // ebx@67 | |
4279 //char *v24; // esi@68 | |
4280 //int v25; // eax@70 | |
4281 //char *v26; // esi@78 | |
4282 //int v27; // eax@79 | |
4283 char v28; // zf@81 | |
4284 __int16 v29; // ax@85 | |
4285 signed int v30; // edi@94 | |
4286 int v31; // esi@94 | |
4287 char Args; // [sp+350h] [bp-C4h]@16 | |
4288 int v34[4]; // [sp+3E8h] [bp-2Ch]@96 | |
4289 int v35; // [sp+3F8h] [bp-1Ch]@1 | |
4290 //char b[4]; // [sp+3FCh] [bp-18h]@58 | |
4291 MapInfo *v37; // [sp+400h] [bp-14h]@1 | |
4292 int v38; // [sp+404h] [bp-10h]@1 | |
4293 unsigned int v39; // [sp+408h] [bp-Ch]@8 | |
4294 int pDest; // [sp+40Ch] [bp-8h]@1 | |
4295 //int i; // [sp+410h] [bp-4h]@27 | |
4296 | |
4297 v37 = (MapInfo *)bLoading; | |
4298 v1 = 0; | |
4299 v35 = 0; | |
4300 pGameLoadingUI_ProgressBar->Reset(0x20u); | |
4301 bUnderwater = 0; | |
4302 bNoNPCHiring = 0; | |
4303 v38 = 0; | |
4304 pDest = 1; | |
4305 uCurrentlyLoadedLevelType = LEVEL_Indoor; | |
4306 pGame->uFlags2 &= 0xFFFFFFF7u; | |
4307 if ( Is_out15odm_underwater() ) | |
4308 { | |
4309 bUnderwater = 1; | |
4310 pGame->uFlags2 |= 8u; | |
4311 } | |
4312 if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d23.blv") ) | |
4313 bNoNPCHiring = 1; | |
4314 pPaletteManager->pPalette_tintColor[0] = 0; | |
4315 pPaletteManager->pPalette_tintColor[1] = 0; | |
4316 pPaletteManager->pPalette_tintColor[2] = 0; | |
4317 pPaletteManager->RecalculateAll(); | |
4318 if ( qword_A750D8 ) | |
4319 qword_A750D8 = 0i64; | |
4320 v2 = pMapStats->GetMapInfo(pCurrentMapName); | |
4321 v39 = v2; | |
4322 if ( v2 ) | |
4323 { | |
4324 v3 = &pMapStats->pInfos[v2]; | |
4325 v1 = v3->uRespawnIntervalDays; | |
4326 v38 = GetAlertStatus(); | |
4327 } | |
4328 else | |
4329 { | |
4330 v3 = v37; | |
4331 } | |
4332 dword_6BE13C_uCurrentlyLoadedLocationID = v39; | |
4333 pAllocator->FreeChunk(ptr_6A0D08); | |
4334 ptr_6A0D08 = 0; | |
4335 _6A0D0C_txt_lod_loading = 0; | |
4336 TryLoadLevelFromLOD(); | |
4337 pStationaryLightsStack->uNumLightsActive = 0; | |
4338 v4 = pIndoor->Load( | |
4339 pCurrentMapName, | |
4340 (unsigned int)(signed __int64)((double)pParty->uTimePlayed * 0.234375) / 60 / 60 / 24 + 1, | |
4341 v1, | |
4342 (char *)&pDest) | |
4343 - 1; | |
4344 if ( !v4 ) | |
4345 { | |
4346 sprintf(&Args, "Unable to open %s", pCurrentMapName); | |
4347 Abortf(&Args); | |
4348 } | |
4349 v5 = v4 - 1; | |
4350 if ( !v5 ) | |
4351 { | |
4352 sprintf(&Args, "File %s is not a BLV File", pCurrentMapName); | |
4353 Abortf(&Args); | |
4354 } | |
4355 v6 = v5 - 1; | |
4356 if ( !v6 ) | |
4357 Abortf("Attempt to open new level before clearing old"); | |
4358 if ( v6 == 1 ) | |
4359 Abortf("Out of memory loading indoor level"); | |
4360 if ( !(dword_6BE364_game_settings_1 & 0x2000) ) | |
4361 { | |
4362 InitializeActors(); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
4363 InitializeSpriteObjects(); |
0 | 4364 } |
4365 BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; | |
4366 if ( !v39 ) | |
4367 pDest = 0; | |
4368 if ( pDest == 1 ) | |
4369 { | |
4370 v7 = 0; | |
4371 for (uint i = 0; i < pIndoor->uNumSpawnPoints; ++v7 ) | |
4372 { | |
4373 v8 = &pIndoor->pSpawnPoints[v7]; | |
4374 if ( pIndoor->pSpawnPoints[v7].uKind == 3 ) | |
4375 SpawnEncounter(v3, v8, 0, 0, 0); | |
4376 else | |
4377 v3->SpawnRandomTreasure(v8); | |
4378 ++i; | |
4379 } | |
4380 RespawnGlobalDecorations(); | |
4381 } | |
4382 | |
4383 pSoundList->LoadSound(pDoorSoundIDsByLocationID[v39], 0); | |
4384 pSoundList->LoadSound(pDoorSoundIDsByLocationID[v39] + 1, 0); | |
4385 | |
4386 for (uint i = 0; i < pIndoor->uNumDoors; ++i) | |
4387 { | |
4388 auto pDoor = pIndoor->pDoors + i; | |
4389 | |
4390 if (pDoor->uAttributes & 0x01) | |
4391 { | |
4392 pDoor->uState = BLVDoor::Opening; | |
4393 pDoor->uTimeSinceTriggered = 15360; | |
4394 pDoor->uAttributes = 2; | |
4395 } | |
4396 | |
4397 if (pDoor->uState == BLVDoor::Closed) | |
4398 { | |
4399 pDoor->uState = BLVDoor::Closing; | |
4400 pDoor->uTimeSinceTriggered = 15360; | |
4401 pDoor->uAttributes = 2; | |
4402 } | |
4403 else if (pDoor->uState == BLVDoor::Open) | |
4404 { | |
4405 pDoor->uState = BLVDoor::Opening; | |
4406 pDoor->uTimeSinceTriggered = 15360; | |
4407 pDoor->uAttributes = 2; | |
4408 } | |
4409 } | |
4410 | |
4411 /* | |
4412 i = 0; | |
4413 v9 = 2; | |
4414 if ( pIndoor->uNumDoors > 0 ) | |
4415 { | |
4416 v10 = 0; | |
4417 while ( 1 ) | |
4418 { | |
4419 if ( pIndoor->pDoors[v10].uAttributes & 1 ) | |
4420 { | |
4421 pIndoor->pDoors[v10].uState = 1; | |
4422 pIndoor->pDoors[v10].uTimeSinceTriggered = 15360; | |
4423 pIndoor->pDoors[v10].uAttributes = 2; | |
4424 } | |
4425 v11 = (char *)&pIndoor->pDoors[v10].uState; | |
4426 if ( !*(short *)v11 ) | |
4427 break; | |
4428 if ( *(short *)v11 == 2 ) | |
4429 { | |
4430 *(short *)v11 = 1; | |
4431 goto LABEL_41; | |
4432 } | |
4433 LABEL_42: | |
4434 ++i; | |
4435 ++v10; | |
4436 if ( i >= pIndoor->uNumDoors ) | |
4437 goto LABEL_43; | |
4438 } | |
4439 *(short *)v11 = 3; | |
4440 LABEL_41: | |
4441 pIndoor->pDoors[v10].uTimeSinceTriggered = 15360; | |
4442 pIndoor->pDoors[v10].uAttributes = 2; | |
4443 goto LABEL_42; | |
4444 } | |
4445 LABEL_43: | |
4446 */ | |
4447 | |
4448 for (uint i = 0; i < pIndoor->uNumFaces; ++i) | |
4449 { | |
4450 auto pFace = pIndoor->pFaces + i; | |
4451 if (!pFace->uBitmapID != -1) | |
4452 pBitmaps_LOD->pTextures[pFace->uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[pFace->uBitmapID].palette_id1); | |
4453 } | |
4454 | |
4455 /*i = 0; | |
4456 if ( (signed int)pIndoor->uNumFaces > 0 ) | |
4457 { | |
4458 v12 = 0; | |
4459 do | |
4460 { | |
4461 if ( pIndoor->pFaces[v12].uBitmapID != -1 ) | |
4462 pBitmaps_LOD->pTextures[pIndoor->pFaces[v12].uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[pIndoor->pFaces[v12].uBitmapID].palette_id1); | |
4463 ++i; | |
4464 ++v12; | |
4465 } | |
4466 while ( i < (signed int)pIndoor->uNumFaces ); | |
4467 }*/ | |
4468 | |
4469 | |
4470 pGameLoadingUI_ProgressBar->Progress(); | |
4471 | |
4472 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
4473 { | |
4474 auto pDecortaion = pLevelDecorations + i; | |
4475 | |
4476 pDecorationList->InitializeDecorationSprite(pDecortaion->uDecorationDescID); | |
4477 | |
4478 v15 = pDecorationList->pDecorations[pDecortaion->uDecorationDescID].uSoundID; | |
4479 if (v15 && _6807E0_num_decorations_with_sounds_6807B8 < 9) | |
4480 { | |
4481 pSoundList->LoadSound(v15, 0); | |
4482 v16 = _6807E0_num_decorations_with_sounds_6807B8++; | |
4483 _6807B8_level_decorations_ids[v16] = i; | |
4484 } | |
4485 | |
4486 if ( !(pDecortaion->field_2 & 0x20) ) | |
4487 { | |
4488 v17 = &pDecorationList->pDecorations[pDecortaion->uDecorationDescID]; | |
380 | 4489 if (!v17->DontDraw()) |
0 | 4490 { |
4491 v18 = v17->uLightRadius; | |
4492 if ( v18 ) | |
4493 { | |
4494 unsigned char r = 255, | |
4495 g = 255, | |
4496 b = 255; | |
4497 if (pRenderer->pRenderD3D && pRenderer->bUseColoredLights) | |
4498 { | |
4499 r = v17->uColoredLightRed; | |
4500 g = v17->uColoredLightGreen; | |
4501 b = v17->uColoredLightBlue; | |
4502 } | |
4503 pStationaryLightsStack->AddLight(pDecortaion->vPosition.x, | |
4504 pDecortaion->vPosition.y, | |
4505 pDecortaion->vPosition.z + v17->uDecorationHeight, | |
4506 v18, | |
4507 r, | |
4508 g, | |
4509 b, | |
4510 byte_4E94D0); | |
4511 } | |
4512 } | |
4513 } | |
4514 | |
4515 if (!pDecortaion->field_16_event_id) | |
4516 { | |
4517 if (pDecortaion->IsInteractive()) | |
4518 { | |
4519 if ( v35 < 124 ) | |
4520 { | |
4521 v21 = v35 + 1; | |
4522 pDecortaion->_idx_in_stru123 = v35 + 75; | |
4523 v22 = stru_5E4C90._decor_events[v21 + 74 - 75]; | |
4524 v35 = v21; | |
4525 if ( !v22 ) | |
4526 pDecortaion->field_2 |= 0x20; | |
4527 } | |
4528 } | |
4529 } | |
4530 } | |
4531 | |
4532 pGameLoadingUI_ProgressBar->Progress(); | |
4533 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
4534 for (uint i = 0; i < uNumSpriteObjects; ++i) |
0 | 4535 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
4536 auto p = pSpriteObjects + i; |
0 | 4537 if (p->uObjectDescID) |
4538 { | |
4539 auto uItemID = p->stru_24.uItemID; | |
4540 if (uItemID) | |
4541 { | |
4542 if (uItemID != 220 && pItemsTable->pItems[uItemID].uEquipType == EQUIP_POTION && | |
570 | 4543 !p->stru_24.uEnchantmentType) |
4544 p->stru_24.uEnchantmentType = rand() % 15 + 5; | |
0 | 4545 pItemsTable->SetSpecialBonus(&p->stru_24); |
4546 } | |
4547 } | |
4548 } | |
4549 | |
4550 for (uint i = 0; i < uNumActors; ++i) | |
4551 //if ( (signed int)uNumActors > (signed int)v13 ) | |
4552 { | |
4553 Actor *pActor = pActors + i; | |
4554 //v26 = (char *)&pActors[0].uAttributes; | |
4555 //do | |
4556 //{ | |
4557 //v27 = *(int *)v26; | |
4558 if (pActor->uAttributes & 0x100000) | |
4559 { | |
4560 if ( !v39 ) | |
4561 { | |
4562 pActor->pMonsterInfo.field_3E = 19; | |
4563 pActor->uAttributes |= 0x10000; | |
4564 continue; | |
4565 } | |
4566 v28 = v38 == 0; | |
4567 } | |
4568 else | |
4569 { | |
4570 v28 = v38 == 1; | |
4571 } | |
4572 | |
4573 if ( !v28 ) | |
4574 { | |
4575 pActor->PrepareSprites(0); | |
4576 v29 = pActor->pMonsterInfo.field_3E; | |
4577 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
4578 if ( v29 != 11 && v29 != 19 && (!pActor->sCurrentHP || !pActor->pMonsterInfo.uHP) ) | |
4579 { | |
4580 pActor->pMonsterInfo.field_3E = 5; | |
4581 pActor->UpdateAnimation(); | |
4582 } | |
4583 } | |
4584 else | |
4585 { | |
4586 pActor->pMonsterInfo.field_3E = 19; | |
4587 pActor->uAttributes |= 0x10000; | |
4588 } | |
4589 //} | |
4590 //while ( i < (signed int)uNumActors ); | |
4591 } | |
4592 | |
4593 pGameLoadingUI_ProgressBar->Progress(); | |
4594 | |
4595 Actor this_; | |
4596 this_.pMonsterInfo.uID = 45; | |
4597 this_.PrepareSprites(0); | |
4598 if ( !v37 ) | |
4599 { | |
4600 pParty->sRotationX = 0; | |
4601 pParty->sRotationY = 0; | |
4602 pParty->vPosition.z = 0; | |
4603 pParty->vPosition.y = 0; | |
4604 pParty->vPosition.x = 0; | |
4605 pParty->uFallStartY = 0; | |
4606 pParty->uFallSpeed = 0; | |
4607 TeleportToStartingPoint(uLevel_StartingPointType); | |
4608 } | |
4609 viewparams->_443365(); | |
4610 PlayLevelMusic(); | |
4611 if ( !v37 ) | |
4612 { | |
4613 v30 = 0; | |
4614 v31 = 1; | |
4615 do | |
4616 { | |
4617 if ( pPlayers[v31]->CanAct() ) | |
4618 v34[v30++] = v31; | |
4619 ++v31; | |
4620 } | |
4621 while ( v31 <= 4 ); | |
4622 if ( v30 ) | |
4623 { | |
4624 if ( pDest ) | |
4625 { | |
4626 qword_A750D8 = 256i64; | |
4627 word_A750E0 = 46; | |
4628 word_A750E2 = LOWORD(v34[rand() % v30]); | |
4629 } | |
4630 } | |
4631 } | |
4632 } |