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