0
|
1 #include "Outdoor.h"
|
|
2 #include "Render.h"
|
|
3 #include "LayingItem.h"
|
|
4 #include "Events.h"
|
|
5 #include "Game.h"
|
|
6 #include "Viewport.h"
|
|
7 #include "Time.h"
|
|
8 #include "Party.h"
|
|
9 #include "Math.h"
|
|
10 #include "Allocator.h"
|
|
11 #include "LOD.h"
|
|
12 #include "DecorationList.h"
|
|
13 #include "ObjectList.h"
|
|
14 #include "Actor.h"
|
|
15 #include "Chest.h"
|
|
16 #include "GUIProgressBar.h"
|
|
17 #include "stru123.h"
|
|
18 #include "AudioPlayer.h"
|
|
19
|
|
20 #include "mm7_data.h"
|
|
21
|
|
22
|
|
23
|
|
24
|
|
25
|
|
26
|
|
27
|
|
28
|
|
29
|
|
30 IndoorLocation *pIndoor;
|
|
31 BLVRenderParams *pBLVRenderParams;
|
|
32
|
|
33 struct DecorationList *pDecorationList;
|
|
34
|
|
35 LevelDecoration pLevelDecorations[3000];
|
|
36 size_t uNumLevelDecorations;
|
|
37 LevelDecoration *_5C3420_pDecoration;
|
|
38
|
3
|
39 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null;
|
0
|
40
|
|
41 stru320 stru_F8AD28; // idb
|
|
42 stru337 stru_F81018;
|
|
43 stru167_wrap array_5118E8;
|
|
44 stru170_stru2 stru_F8A590;
|
|
45 stru170 *pStru170; // idb
|
|
46 stru141 stru_721530;
|
|
47 stru352 stru_F83B80[480];
|
|
48
|
|
49
|
|
50
|
|
51
|
|
52 //----- (0043F39E) --------------------------------------------------------
|
|
53 void __fastcall sub_43F39E(IndoorLocation_drawstru *_this)
|
|
54 {
|
|
55 int *v1; // ecx@1
|
2
|
56 //double v2; // ST30_8@3
|
|
57 //double v3; // ST30_8@6
|
|
58 //double v4; // ST28_8@6
|
0
|
59 int v5; // eax@4
|
|
60 int v6; // eax@7
|
|
61 unsigned int v7; // ebx@8
|
|
62 BLVSector *v8; // esi@8
|
|
63 unsigned __int16 *v9; // edi@8
|
|
64 int i; // [sp+18h] [bp-8h]@7
|
2
|
65 //unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3
|
0
|
66 signed int v12; // [sp+1Ch] [bp-4h]@8
|
|
67
|
|
68 pBLVRenderParams->Set(_this);
|
|
69 uNumMobileLightsApplied = 0;
|
|
70 uNumDecorationsDrawnThisFrame = 0;
|
|
71 _unused000 = 0;
|
|
72 uNumSpritesDrawnThisFrame = 0;
|
|
73 uNumBillboardsToDraw = 0;
|
|
74 if ( !byte_4D864C || !(BYTE1(pGame->uFlags) & 0x10) )
|
|
75 {
|
2
|
76 //v2 = pParty->flt_TorchlightColorB + 6.7553994e15;
|
|
77 //v11 = LOBYTE(v2);
|
0
|
78 if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime <= 0 )
|
|
79 v5 = 800;
|
|
80 else
|
|
81 v5 = 800 * pParty->pPartyBuffs[16].uPower;
|
|
82 LOBYTE(v1) = byte_4E94D0;
|
2
|
83 //v4 = pParty->flt_TorchlightColorR + 6.7553994e15;
|
|
84 //v3 = pParty->flt_TorchlightColorG + 6.7553994e15;
|
0
|
85 pMobileLightsStack->AddLight(
|
|
86 SLOWORD(pBLVRenderParams->vPartyPos.x),
|
|
87 SLOWORD(pBLVRenderParams->vPartyPos.y),
|
|
88 SLOWORD(pBLVRenderParams->vPartyPos.z),
|
|
89 SLOWORD(pBLVRenderParams->uRadius),
|
|
90 v5,
|
3
|
91 floorf(pParty->flt_TorchlightColorR + 0.5f),
|
|
92 floorf(pParty->flt_TorchlightColorG + 0.5f),
|
|
93 floorf(pParty->flt_TorchlightColorB + 0.5f),
|
0
|
94 v1);
|
|
95 }
|
|
96 PrepareWallsRenderList_BLV();
|
|
97 PrepareItemsRenderList_BLV();
|
|
98 PrepareActorRenderList_BLV();
|
|
99 v6 = 0;
|
|
100 for ( i = 0; i < pStru170->field_53730; ++i )
|
|
101 {
|
|
102 v7 = pStru170->pSectorIDs_toDrawDecorationsFrom[v6];
|
|
103 v12 = 0;
|
|
104 v8 = &pIndoor->pSectors[pStru170->pSectorIDs_toDrawDecorationsFrom[v6]];
|
|
105 v9 = v8->pDecorationIDs;
|
|
106 if ( v8->uNumDecorations > 0 )
|
|
107 {
|
|
108 do
|
|
109 PrepareDecorationsRenderList_BLV((signed __int16)v9[v12++], v7);
|
|
110 while ( v12 < v8->uNumDecorations );
|
|
111 }
|
|
112 v6 = i + 1;
|
|
113 }
|
|
114 MessWithBillboards_BLV();
|
|
115 pGame->PushStru165s();
|
|
116 }
|
|
117
|
|
118
|
|
119
|
|
120 //----- (004407D9) --------------------------------------------------------
|
|
121 int BLVRenderParams::Set(IndoorLocation_drawstru *a2)
|
|
122 {
|
|
123 IndoorLocation_drawstru *v2; // ebx@1
|
|
124 BLVRenderParams *v3; // esi@1
|
|
125 int v4; // ST08_4@1
|
|
126 int v5; // ST04_4@1
|
|
127 int v6; // ST00_4@1
|
|
128 int v7; // eax@1
|
|
129 int v8; // ST08_4@2
|
|
130 int v9; // ST04_4@2
|
|
131 int v10; // ST00_4@2
|
|
132 unsigned int v11; // edi@4
|
|
133 unsigned int v12; // ecx@4
|
|
134 int v13; // edx@4
|
|
135 signed int v14; // ecx@4
|
|
136 unsigned int v15; // edx@4
|
|
137 unsigned int v16; // eax@4
|
|
138 double v17; // st7@5
|
|
139 int v18; // eax@5
|
|
140 double v19; // st7@5
|
|
141 int v20; // eax@5
|
|
142 double v21; // st7@5
|
|
143 int v22; // eax@5
|
|
144 unsigned int v23; // edx@5
|
|
145 unsigned int v24; // ecx@5
|
|
146 int v25; // eax@5
|
|
147 int v26; // eax@5
|
|
148 signed int v27; // eax@6
|
|
149 int result; // eax@6
|
|
150 int v29; // [sp+24h] [bp+8h]@5
|
|
151
|
|
152 v2 = a2;
|
|
153 v3 = this;
|
|
154 this->field_0_timer_ = a2->field_0_timer;
|
|
155 this->uFlags = a2->uFlags;
|
|
156 this->vPartyPos.x = a2->vPosition.x;
|
|
157 this->vPartyPos.y = a2->vPosition.y;
|
|
158 this->vPartyPos.z = a2->vPosition.z;
|
|
159 v4 = this->vPartyPos.z;
|
|
160 v5 = this->vPartyPos.y;
|
|
161 this->sPartyRotY = a2->sRotationY;
|
|
162 v6 = this->vPartyPos.x;
|
|
163 this->sPartyRotX = a2->sRotationX;
|
|
164 v7 = pIndoor->GetSector(v6, v5, v4);
|
|
165 v3->uRadius = v7;
|
|
166 if ( !v7 )
|
|
167 {
|
|
168 v8 = v3->vPartyPos.z;
|
|
169 v3->vPartyPos.x = pParty->vPosition.x;
|
|
170 v9 = pParty->vPosition.z;
|
|
171 v10 = v3->vPartyPos.x;
|
|
172 v3->vPartyPos.y = pParty->vPosition.z;
|
|
173 v3->uRadius = pIndoor->GetSector(v10, v9, v8);
|
|
174 }
|
|
175 if ( pRenderer->pRenderD3D )
|
|
176 {
|
|
177 v3->sCosineY = stru_5C6E00->SinCos(v3->sPartyRotY);
|
|
178 v3->sSineY = stru_5C6E00->SinCos(v3->sPartyRotY - stru_5C6E00->uIntegerHalfPi);
|
|
179 v3->sCosineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX);
|
|
180 v3->sSineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX - stru_5C6E00->uIntegerHalfPi);
|
|
181 v3->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125);
|
|
182 v3->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125);
|
|
183 v3->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125);
|
|
184 v3->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125);
|
|
185 v3->field_64 = a2->field_3C;
|
|
186 v11 = v3->uViewportW;
|
|
187 v12 = v3->uViewportX;
|
|
188 v13 = v3->uViewportZ - v12;
|
|
189 v14 = v3->uViewportZ + v12;
|
|
190 v3->field_70 = v13 + 1;
|
|
191 v15 = v3->uViewportY;
|
|
192 v3->uViewportHeight = v11 - v15 + 1;
|
|
193 v16 = v3->uViewportW;
|
|
194 v3->uViewportCenterX = v14 >> 1;
|
|
195 v3->uViewportCenterY = (signed int)(v16 + v15) >> 1;
|
|
196 }
|
|
197 else
|
|
198 {
|
|
199 v3->sCosineY = stru_5C6E00->SinCos(-v3->sPartyRotY);
|
|
200 v3->sSineY = stru_5C6E00->SinCos(-v3->sPartyRotY - stru_5C6E00->uIntegerHalfPi);
|
|
201 v3->sCosineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX);
|
|
202 v3->sSineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX - stru_5C6E00->uIntegerHalfPi);
|
|
203 v17 = cos((double)-v3->sPartyRotY * 0.0030664064);
|
|
204 v18 = v3->sPartyRotY;
|
|
205 v3->fCosineY = v17;
|
|
206 v19 = sin((double)-v18 * 0.0030664064);
|
|
207 v20 = v3->sPartyRotX;
|
|
208 v3->fSineY = v19;
|
|
209 v21 = cos((double)-v20 * 0.0030664064);
|
|
210 v22 = v3->sPartyRotX;
|
|
211 v3->fCosineNegX = v21;
|
|
212 v3->fSineNegX = sin((double)-v22 * 0.0030664064);
|
|
213 v23 = v3->uViewportX;
|
|
214 v3->field_64 = a2->field_3C;
|
|
215 v24 = v3->uViewportZ;
|
|
216 v3->field_70 = v3->uViewportZ - v23 + 1;
|
|
217 v25 = v3->uViewportW - v3->uViewportY + 1;
|
|
218 v3->uViewportHeight = v25;
|
|
219 v29 = v25;
|
|
220 v26 = v3->field_64;
|
|
221 v3->uViewportCenterX = (signed int)(v24 + v23) >> 1;
|
|
222 v3->uViewportCenterY = v3->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);
|
|
223 }
|
|
224 v27 = (unsigned int)(signed __int64)((double)v3->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329)
|
|
225 + 0.5) << 16;
|
|
226 v3->field_40 = v27;
|
|
227 LODWORD(v3->field_44) = 4294967296i64 / v27;
|
|
228 v3->pRenderTarget = v2->pRenderTarget;
|
|
229 v3->uTargetWidth = v2->uTargetWidth;
|
|
230 v3->uTargetHeight = v2->uTargetHeight;
|
|
231 v3->uViewportX = v2->uViewportX;
|
|
232 v3->uViewportY = v2->uViewportY;
|
|
233 v3->uViewportZ = v2->uViewportZ;
|
|
234 v3->uViewportW = v2->uViewportW;
|
|
235 v3->pTargetZBuffer = v2->pTargetZ;
|
|
236 result = 0;
|
|
237 v3->field_8C = 0;
|
|
238 v3->field_84 = 0;
|
|
239 v3->field_80 = 0;
|
|
240 v3->field_88 = 0;
|
|
241 pBLVRenderParams->field_90 = 64;
|
|
242 pBLVRenderParams->field_94 = 6;
|
|
243 return result;
|
|
244 }
|
|
245
|
|
246 //----- (00440B44) --------------------------------------------------------
|
|
247 void IndoorLocation::ExecDraw(char a1)
|
|
248 {
|
|
249 signed int i; // esi@2
|
|
250 int v2; // eax@3
|
|
251 IndoorCameraD3D_Vec4 *v3; // edx@4
|
|
252 signed int j; // esi@8
|
|
253 unsigned int v5; // ecx@9
|
|
254 RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4
|
|
255
|
|
256 if ( a1 )
|
|
257 {
|
|
258 pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y);
|
|
259 for ( i = 0; i < (signed int)pStru170->uNumFaceIDs; ++i )
|
|
260 {
|
|
261 v2 = pStru170->pFaceIDs[2 * i + 1];
|
|
262 if ( pStru170->field_FA8[v2].std__vector_0007A8 == -1 )
|
|
263 {
|
|
264 v6 = 0;
|
|
265 v3 = 0;
|
|
266 }
|
|
267 else
|
|
268 {
|
|
269 v3 = pStru170->field_FA8[v2].std__vector_0007AC;
|
|
270 v6 = pStru170->field_FA8[v2].pVertices;
|
|
271 }
|
|
272 IndoorLocation::ExecDraw_sub0(pStru170->pFaceIDs[2 * i], v3, 4u, v6);
|
|
273 }
|
|
274 }
|
|
275 else
|
|
276 {
|
|
277 for ( j = 0; j < (signed int)pStru170->uNumFaceIDs; ++j )
|
|
278 {
|
|
279 v5 = pStru170->pFaceIDs[2 * j];
|
|
280 pBLVRenderParams->field_7C = &pStru170->field_FA8[pStru170->pFaceIDs[2 * j + 1]].field_C;
|
|
281 IndoorLocation::ExecDraw_sub1(v5);
|
|
282 }
|
|
283 }
|
|
284 }
|
|
285
|
|
286 //----- (00440BED) --------------------------------------------------------
|
|
287 void __fastcall sub_440BED(IndoorLocation_drawstru *_this)
|
|
288 {
|
|
289 unsigned __int16 *v1; // edi@7
|
|
290 char *v2; // esi@8
|
|
291 int v3; // ecx@9
|
|
292 unsigned int v4; // edx@9
|
|
293 char *v5; // eax@10
|
|
294 signed int v6; // [sp+8h] [bp-8h]@7
|
|
295 int v7; // [sp+Ch] [bp-4h]@8
|
|
296
|
|
297 sub_43F39E(_this);
|
|
298 if ( pBLVRenderParams->uRadius )
|
|
299 IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0);
|
|
300 pRenderer->DrawBillboardList_BLV();
|
|
301 if ( !pRenderer->pRenderD3D )
|
|
302 {
|
|
303 if ( pBLVRenderParams->uFlags & 2 )
|
|
304 stru170_sub_4B0967();
|
|
305 if ( pBLVRenderParams->uFlags & 1 )
|
|
306 {
|
|
307 v1 = pBLVRenderParams->pRenderTarget;
|
|
308 v6 = 0;
|
|
309 if ( (signed int)pStru170->std__vector_000FA8 > 0 )
|
|
310 {
|
|
311 v7 = 0;
|
|
312 v2 = (char *)&pStru170->field_FA8[0].field_C.field_4;
|
|
313 do
|
|
314 {
|
|
315 v3 = *((int *)v2 - 1);
|
|
316 v4 = pRenderer->uTargetSurfacePitch * *((int *)v2 - 1);
|
|
317 if ( v3 <= *(int *)v2 )
|
|
318 {
|
|
319 v5 = (char *)&pStru170->field_FA8[0].field_C.array_3D8[v3 + v7];
|
|
320 do
|
|
321 {
|
|
322 v1[v4 + *((short *)v5 - 480)] = 255;
|
|
323 ++v3;
|
|
324 v1[v4 + *(short *)v5] = 255;
|
|
325 v4 += pRenderer->uTargetSurfacePitch;
|
|
326 v5 += 2;
|
|
327 }
|
|
328 while ( v3 <= *(int *)v2 );
|
|
329 }
|
|
330 ++v6;
|
|
331 v7 += 1126;
|
|
332 v2 += 2252;
|
|
333 }
|
|
334 while ( v6 < (signed int)pStru170->std__vector_000FA8 );
|
|
335 }
|
|
336 }
|
|
337 }
|
|
338 }
|
|
339
|
|
340
|
|
341
|
|
342
|
|
343
|
|
344 //----- (00441BD4) --------------------------------------------------------
|
|
345 void IndoorLocation::Draw()
|
|
346 {
|
|
347 int v0; // eax@1
|
|
348 IndoorLocation_drawstru _this; // [sp+0h] [bp-4Ch]@5
|
|
349 int v2; // [sp+44h] [bp-8h]@5
|
|
350 float v3; // [sp+48h] [bp-4h]@5
|
|
351
|
|
352 v0 = 0;
|
|
353 if ( viewparams->field_50_draw_debug_outlines )
|
|
354 v0 = 1;
|
|
355 if ( viewparams->field_54 )
|
|
356 LOBYTE(v0) = v0 | 2;
|
|
357 _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed;
|
|
358 _this.uFlags = v0;
|
|
359 _this.vPosition.x = pParty->vPosition.x
|
|
360 - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY)
|
|
361 * (signed __int64)pParty->field_18) >> 16);
|
|
362 v2 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi);
|
|
363 LODWORD(v3) = (unsigned __int64)(v2 * (signed __int64)pParty->field_18) >> 16;
|
|
364 _this.field_1C_mb_fov = 65;
|
|
365 _this.vPosition.y = pParty->vPosition.z - LODWORD(v3);
|
|
366 _this.sRotationY = pParty->sRotationY;
|
|
367 _this.sRotationX = pParty->sRotationX;
|
|
368 _this.pRenderTarget = pRenderer->pTargetSurface;
|
|
369 _this.uViewportX = pViewport->uScreenX;
|
|
370 _this.uViewportY = pViewport->uScreenY;
|
|
371 _this.uViewportZ = pViewport->uScreenZ;
|
|
372 _this.uViewportW = pViewport->uScreenW;
|
|
373 _this.field_3C = pViewport->field_30;
|
|
374 _this.vPosition.z = pParty->vPosition.y + pParty->sEyelevel;
|
|
375 _this.uTargetWidth = 640;
|
|
376 _this.uTargetHeight = 480;
|
|
377 _this.pTargetZ = pRenderer->pActiveZBuffer;
|
|
378 sub_440BED(&_this);
|
|
379 pParty->uFlags &= 0xFFFFFFFDu;
|
|
380 pGame->DrawParticles();
|
|
381 array_5118E8._440F07();
|
|
382 }
|
|
383
|
|
384 //----- (004C0EF2) --------------------------------------------------------
|
|
385 void BLVFace::FromODM(ODMFace *a2)
|
|
386 {
|
|
387 this->pFacePlane_old.vNormal.x = a2->pFacePlane.vNormal.x;
|
|
388 this->pFacePlane_old.vNormal.y = a2->pFacePlane.vNormal.y;
|
|
389 this->pFacePlane_old.vNormal.z = a2->pFacePlane.vNormal.z;
|
|
390 this->pFacePlane_old.dist = a2->pFacePlane.dist;
|
|
391 this->pFacePlane.vNormal.x = (double)(a2->pFacePlane.vNormal.x & 0xFFFF) * 0.000015259022
|
|
392 + (double)(a2->pFacePlane.vNormal.x >> 16);
|
|
393 this->pFacePlane.vNormal.y = (double)(a2->pFacePlane.vNormal.y & 0xFFFF) * 0.000015259022
|
|
394 + (double)(a2->pFacePlane.vNormal.y >> 16);
|
|
395 this->pFacePlane.vNormal.z = (double)(a2->pFacePlane.vNormal.z & 0xFFFF) * 0.000015259022
|
|
396 + (double)(a2->pFacePlane.vNormal.z >> 16);
|
|
397 this->pFacePlane.dist = (double)(a2->pFacePlane.dist & 0xFFFF) * 0.000015259022 + (double)(a2->pFacePlane.dist >> 16);
|
|
398 this->uAttributes = a2->uFaceAttributes;
|
|
399 this->pBounding.x1 = a2->pBoundingBox.x1;
|
|
400 this->pBounding.y1 = a2->pBoundingBox.y1;
|
|
401 this->pBounding.z1 = a2->pBoundingBox.z1;
|
|
402 this->pBounding.x2 = a2->pBoundingBox.x2;
|
|
403 this->pBounding.y2 = a2->pBoundingBox.y2;
|
|
404 this->pBounding.z2 = a2->pBoundingBox.z2;
|
|
405 this->zCalc1 = a2->zCalc1;
|
|
406 this->zCalc2 = a2->zCalc2;
|
|
407 this->zCalc3 = a2->zCalc3;
|
|
408 this->pXInterceptDisplacements = a2->pXInterceptDisplacements;
|
|
409 this->pYInterceptDisplacements = a2->pYInterceptDisplacements;
|
|
410 this->pZInterceptDisplacements = a2->pZInterceptDisplacements;
|
|
411 this->uPolygonType = (PolygonType)a2->uPolygonType;
|
|
412 this->uNumVertices = a2->uNumVertices;
|
|
413 this->uBitmapID = a2->uTextureID;
|
|
414 this->pVertexIDs = a2->pVertexIDs;
|
|
415 }
|
|
416
|
|
417 //----- (004B0A25) --------------------------------------------------------
|
|
418 void IndoorLocation::ExecDraw_sub0(unsigned int uFaceID, IndoorCameraD3D_Vec4 *pVertices, unsigned int uNumVertices, RenderVertexSoft *a4)
|
|
419 {
|
|
420 unsigned int v4; // esi@1
|
|
421 char *v5; // eax@4
|
|
422 signed int v6; // ecx@4
|
|
423 char *v7; // eax@8
|
|
424 signed int v8; // ecx@8
|
|
425 BLVFace *v9; // esi@13
|
|
426 IndoorCameraD3D *v10; // edi@16
|
|
427 int v11; // ebx@17
|
|
428 Vec3_short_ *v12; // ecx@18
|
|
429 char *v13; // edx@18
|
|
430 int v14; // eax@19
|
|
431 unsigned __int8 v15; // sf@19
|
|
432 unsigned __int8 v16; // of@19
|
|
433 int v17; // ebx@25
|
|
434 double v18; // st7@27
|
|
435 double v19; // st6@27
|
|
436 double v20; // st5@27
|
|
437 char v21; // dl@27
|
|
438 unsigned int v22; // eax@44
|
|
439 unsigned int v23; // eax@35
|
|
440 DWORD v24; // eax@37
|
|
441 int v25; // eax@38
|
|
442 char *v26; // edi@38
|
|
443 IDirect3DTexture2 *v27; // eax@42
|
|
444 Texture *v28; // [sp+Ch] [bp-1Ch]@15
|
|
445 int i; // [sp+10h] [bp-18h]@38
|
|
446 LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16
|
|
447 IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16
|
|
448 IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1
|
|
449 unsigned int uFaceID_; // [sp+20h] [bp-8h]@1
|
|
450 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17
|
|
451 int a4a; // [sp+34h] [bp+Ch]@25
|
|
452 unsigned int a4b; // [sp+34h] [bp+Ch]@38
|
|
453
|
|
454 v4 = uFaceID;
|
|
455 a7 = pVertices;
|
|
456 uFaceID_ = uFaceID;
|
|
457 if ( (uFaceID & 0x80000000u) == 0 && (signed int)uFaceID < (signed int)pIndoor->uNumFaces )
|
|
458 {
|
|
459
|
|
460 static RenderVertexSoft static_vertices_F7C228[64];
|
|
461 static bool __init_flag1 = false;
|
|
462 if (!__init_flag1)
|
|
463 {
|
|
464 __init_flag1 = true;
|
|
465
|
|
466 for (uint i = 0; i < 64; ++i)
|
|
467 static_vertices_F7C228[i].flt_2C = 0.0f;
|
|
468 }
|
|
469
|
|
470 static RenderVertexSoft static_vertices_F7B628[64];
|
|
471 static bool __init_flag2 = false;
|
|
472 if (!__init_flag2)
|
|
473 {
|
|
474 __init_flag2 = true;
|
|
475
|
|
476 for (uint i = 0; i < 64; ++i)
|
|
477 static_vertices_F7B628[i].flt_2C = 0.0f;
|
|
478 }
|
|
479
|
|
480 static stru154 stru_F7B60C; // idb
|
|
481 /*static bool __init_flag3 = false;
|
|
482 if (!__init_flag3)
|
|
483 {
|
|
484 __init_flag3 = true;
|
|
485
|
|
486 stru154::stru154(&stru_F7B60C);
|
|
487 }*/
|
|
488
|
|
489 v9 = &pIndoor->pFaces[v4];
|
|
490 if ( v9->uNumVertices >= 3u )
|
|
491 {
|
|
492 if ( !(BYTE1(v9->uAttributes) & 0x20) )
|
|
493 {
|
|
494 ++pBLVRenderParams->field_80;
|
|
495 LOBYTE(v9->uAttributes) |= 0x80u;
|
|
496 v28 = v9->GetTexture();
|
|
497 if ( v28 )
|
|
498 {
|
|
499 v10 = pGame->pIndoorCameraD3D;
|
|
500 v31 = pGame->pIndoorCameraD3D;
|
|
501 pStru4 = pGame->pLightmapBuilder;
|
|
502 if ( !pGame->pIndoorCameraD3D->IsFaceFacedTowardsCamera(v9) )
|
|
503 {
|
|
504 v11 = 0;
|
|
505 uNumVerticesa = v9->uNumVertices;
|
|
506 if ( (signed int)uNumVerticesa > 0 )
|
|
507 {
|
|
508 v12 = pIndoor->pVertices;
|
|
509 v13 = (char *)&static_vertices_F7C228[0].vWorldPosition.z;
|
|
510 do
|
|
511 {
|
|
512 v14 = v11++;
|
|
513 *((float *)v13 - 2) = (double)v12[v9->pVertexIDs[v14]].x;
|
|
514 *((float *)v13 - 1) = (double)v12[v9->pVertexIDs[v14]].y;
|
|
515 *(float *)v13 = (double)v12[v9->pVertexIDs[v14]].z;
|
|
516 v13 += 48;
|
|
517 v16 = __OFSUB__(v11, uNumVerticesa);
|
|
518 v15 = ((v11 - uNumVerticesa) & 0x80000000u) != 0;
|
|
519 *((float *)v13 - 5) = (double)v9->pVertexUIDs[v14];
|
|
520 *((float *)v13 - 4) = (double)v9->pVertexVIDs[v14];
|
|
521 }
|
|
522 while ( v15 ^ v16 );
|
|
523 v10 = v31;
|
|
524 }
|
|
525 if ( !a7
|
|
526 || (pGame->pStru9Instance->_498377(a4, 4u, a7, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
|
|
527 {
|
|
528 if ( v10->_437285_prolly_colide_vertices_against_frustrum(
|
|
529 static_vertices_F7C228,
|
|
530 &uNumVerticesa,
|
|
531 static_vertices_F7B628,
|
|
532 v10->std__vector_000034_prolly_frustrum,
|
|
533 4,
|
|
534 0,
|
|
535 0) != 1
|
|
536 || uNumVerticesa )
|
|
537 {
|
|
538 a4a = SHIWORD(stru_F8AD28.field_2C);
|
|
539 v17 = (248 - 8 * SHIWORD(stru_F8AD28.field_2C)) | (((248 - 8 * SHIWORD(stru_F8AD28.field_2C)) | ((248 - 8 * SHIWORD(stru_F8AD28.field_2C)) << 8)) << 8);
|
|
540 sub_4B0E07(uFaceID_);
|
|
541 pStru4->ApplyLights_IndoorFace(uFaceID_);
|
|
542 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID_);
|
|
543 v31->_4364C5(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
|
|
544 v31->_436BB7_project_and_stuff(array_507D30, uNumVerticesa, 0);
|
|
545 pStru4->std__vector_000004_size = 0;
|
|
546 if ( stru_F8AD28.field_AC > 0 || pDecalBuilder->uNumDecals > 0 )
|
|
547 {
|
|
548 v18 = v9->pFacePlane.dist;
|
|
549 v19 = v9->pFacePlane.vNormal.z;
|
|
550 v20 = v9->pFacePlane.vNormal.y;
|
|
551 v21 = v9->uPolygonType;
|
|
552 stru_F7B60C.vNormal.x = v9->pFacePlane.vNormal.x;
|
|
553 stru_F7B60C.field_14 = v21;
|
|
554 stru_F7B60C.vNormal.y = v20;
|
|
555 stru_F7B60C.vNormal.z = v19;
|
|
556 stru_F7B60C.field_10 = v18;
|
|
557 }
|
|
558 if ( stru_F8AD28.field_AC > 0 && !(BYTE2(v9->uAttributes) & 0x40) )
|
|
559 pStru4->ApplyLights(
|
|
560 &stru_F8AD28,
|
|
561 &stru_F7B60C,
|
|
562 uNumVerticesa,
|
|
563 array_507D30,
|
|
564 *(float *)&a7,
|
|
565 0);
|
|
566 if ( pDecalBuilder->uNumDecals > 0 )
|
|
567 pDecalBuilder->ApplyDecals(
|
|
568 a4a,
|
|
569 1,
|
|
570 &stru_F7B60C,
|
|
571 uNumVerticesa,
|
|
572 array_507D30,
|
|
573 (int)a7,
|
|
574 0,
|
|
575 v9->uSectorID);
|
|
576 if ( v9->uAttributes & 0x10 && v9->uBitmapID == pRenderer->field_1036AC_bitmapid )
|
|
577 {
|
|
578 v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
|
|
579 goto LABEL_42;
|
|
580 }
|
|
581 if ( v9->uAttributes & 0x10 )
|
|
582 {
|
|
583 v24 = GetTickCount() >> 2;
|
|
584 if ( (signed int)uNumVerticesa > 0 )
|
|
585 {
|
|
586 v25 = v24 - stru_5C6E00->uIntegerHalfPi;
|
|
587 v26 = (char *)&array_507D30[0].v;
|
|
588 a4b = uNumVerticesa;
|
|
589 for ( i = v25; ; v25 = i )
|
|
590 {
|
|
591 *(float *)v26 = (double)(pBitmaps_LOD->pTextures[v9->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8))
|
|
592 + *(float *)v26;
|
|
593 v26 += 48;
|
|
594 --a4b;
|
|
595 if ( !a4b )
|
|
596 break;
|
|
597 }
|
|
598 }
|
|
599 }
|
|
600 else
|
|
601 {
|
|
602 v22 = v9->uAttributes;
|
|
603 if ( BYTE1(v22) & 0x40 )
|
|
604 {
|
|
605 v23 = pTextureFrameTable->GetFrameTexture(
|
|
606 v9->uBitmapID,
|
|
607 pBLVRenderParams->field_0_timer_);
|
|
608 LABEL_42:
|
|
609 v27 = pBitmaps_LOD->pHardwareTextures[v23];
|
|
610 if ( BYTE2(v9->uAttributes) & 0x40 )
|
|
611 sub_479A53(uNumVerticesa, uFaceID_);
|
|
612 else
|
|
613 pRenderer->DrawIndoorPolygon(uNumVerticesa, v9, v27, v28, 8 * uFaceID_ | 6, v17, 0);
|
|
614 return;
|
|
615 }
|
|
616 }
|
|
617 v23 = v9->uBitmapID;
|
|
618 goto LABEL_42;
|
|
619 }
|
|
620 }
|
|
621 }
|
|
622 }
|
|
623 }
|
|
624 }
|
|
625 }
|
|
626 }
|
|
627 // F7CE28: using guessed type char static_init_flag__F7C228_bit1__F7B628_bit2__F7B60C_bit3;
|
|
628
|
|
629
|
|
630
|
|
631 //----- (004AFF79) --------------------------------------------------------
|
|
632 void IndoorLocation::ExecDraw_sub1(unsigned int uFaceID)
|
|
633 {
|
|
634 unsigned int v1; // ebx@1
|
|
635 BLVFace *v2; // esi@3
|
|
636 unsigned int v3; // eax@3
|
|
637 Texture *v4; // eax@8
|
|
638 Texture *v5; // edi@8
|
|
639 int v6; // eax@9
|
|
640 int v7; // eax@9
|
|
641 int v8; // ecx@17
|
|
642 int v9; // ebx@17
|
|
643 int v10; // eax@17
|
|
644 int v11; // esi@17
|
|
645 unsigned int v12; // eax@17
|
|
646 int j; // ecx@19
|
|
647 int v14; // edx@20
|
|
648 int v15; // eax@20
|
|
649 int v16; // edx@20
|
|
650 int i; // ebx@22
|
|
651 int v18; // ecx@23
|
|
652 int v19; // eax@23
|
|
653 int v20; // eax@23
|
|
654 int v21; // eax@24
|
|
655 unsigned __int8 *v22; // ecx@24
|
|
656 int v23; // ebx@24
|
|
657 int v24; // esi@25
|
|
658 int v25; // eax@28
|
|
659 unsigned __int16 *v26; // eax@28
|
|
660 unsigned int v27; // eax@29
|
|
661 int v28; // eax@30
|
|
662 char *v29; // esi@31
|
|
663 int v30; // eax@33
|
|
664 int v31; // eax@33
|
|
665 int v32; // eax@35
|
|
666 int v33; // edx@35
|
|
667 signed int v34; // ebx@35
|
|
668 int v35; // eax@35
|
|
669 int v36; // ebx@35
|
|
670 signed int v37; // ebx@35
|
|
671 signed int v38; // edi@35
|
|
672 unsigned int v39; // edi@36
|
|
673 int v40; // edx@40
|
|
674 int v41; // ecx@40
|
|
675 signed int v42; // edx@40
|
|
676 int v43; // edx@42
|
|
677 int v44; // eax@42
|
|
678 unsigned __int16 *v45; // eax@43
|
|
679 int *v46; // esi@44
|
|
680 unsigned __int16 *v47; // edi@44
|
|
681 unsigned int v48; // edx@44
|
|
682 int v49; // ebx@44
|
|
683 char v50; // cl@44
|
|
684 char v51; // ch@44
|
|
685 unsigned int v52; // ebx@46
|
|
686 int v53; // edx@46
|
|
687 unsigned int v54; // ebx@46
|
|
688 int v55; // edx@46
|
|
689 unsigned int v56; // ebx@47
|
|
690 int v57; // edx@47
|
|
691 int v58; // ebx@47
|
|
692 int v59; // edx@47
|
|
693 unsigned __int16 *v60; // eax@50
|
|
694 int *v61; // esi@51
|
|
695 unsigned __int16 *v62; // edi@51
|
|
696 unsigned int v63; // edx@51
|
|
697 int v64; // ebx@51
|
|
698 char v65; // cl@51
|
|
699 char v66; // ch@51
|
|
700 unsigned int v67; // ebx@53
|
|
701 int v68; // edx@53
|
|
702 unsigned int v69; // ebx@53
|
|
703 int v70; // edx@53
|
|
704 unsigned int v71; // ebx@54
|
|
705 int v72; // edx@54
|
|
706 int v73; // ebx@54
|
|
707 int v74; // edx@54
|
|
708 unsigned __int16 *v75; // eax@58
|
|
709 int *v76; // esi@59
|
|
710 int v77; // edi@59
|
|
711 unsigned int v78; // edx@59
|
|
712 int v79; // ebx@59
|
|
713 char v80; // cl@59
|
|
714 char v81; // ch@59
|
|
715 int v82; // ebx@61
|
|
716 int v83; // edx@61
|
|
717 unsigned int v84; // ebx@62
|
|
718 int v85; // edx@62
|
|
719 unsigned __int16 *v86; // eax@65
|
|
720 int *v87; // esi@66
|
|
721 int v88; // edi@66
|
|
722 unsigned int v89; // edx@66
|
|
723 int v90; // ebx@66
|
|
724 char v91; // cl@66
|
|
725 char v92; // ch@66
|
|
726 int v93; // ebx@68
|
|
727 int v94; // edx@68
|
|
728 unsigned __int16 v95; // bx@69
|
|
729 int v96; // edx@69
|
|
730 unsigned __int8 *v97; // [sp+Ch] [bp-9Ch]@24
|
|
731 unsigned __int8 *v98; // [sp+10h] [bp-98h]@24
|
|
732 unsigned __int8 *v99; // [sp+14h] [bp-94h]@24
|
|
733 unsigned __int8 *v100; // [sp+18h] [bp-90h]@24
|
|
734 int v101; // [sp+1Ch] [bp-8Ch]@40
|
|
735 int v102; // [sp+20h] [bp-88h]@31
|
|
736 BLVFace *v103; // [sp+24h] [bp-84h]@3
|
|
737 unsigned __int16 *v104; // [sp+28h] [bp-80h]@24
|
|
738 int v105; // [sp+2Ch] [bp-7Ch]@30
|
|
739 int v106; // [sp+30h] [bp-78h]@24
|
|
740 int v107; // [sp+34h] [bp-74h]@9
|
|
741 Texture *v108; // [sp+38h] [bp-70h]@8
|
|
742 int v109; // [sp+3Ch] [bp-6Ch]@9
|
|
743 unsigned int v110; // [sp+40h] [bp-68h]@24
|
|
744 unsigned int v111; // [sp+44h] [bp-64h]@1
|
|
745 int *k; // [sp+48h] [bp-60h]@31
|
|
746 int v113; // [sp+4Ch] [bp-5Ch]@35
|
|
747 int v114; // [sp+50h] [bp-58h]@35
|
|
748 int v115; // [sp+54h] [bp-54h]@42
|
|
749 unsigned __int8 *v116; // [sp+58h] [bp-50h]@35
|
|
750 int v117; // [sp+5Ch] [bp-4Ch]@33
|
|
751 int a1; // [sp+60h] [bp-48h]@27
|
|
752 int v119; // [sp+64h] [bp-44h]@17
|
|
753 int v120; // [sp+68h] [bp-40h]@23
|
|
754 unsigned int v121; // [sp+6Ch] [bp-3Ch]@40
|
|
755 unsigned int v122; // [sp+70h] [bp-38h]@35
|
|
756 int v123; // [sp+74h] [bp-34h]@30
|
|
757 int v124; // [sp+78h] [bp-30h]@17
|
|
758 int v125; // [sp+7Ch] [bp-2Ch]@35
|
|
759 unsigned int v126; // [sp+80h] [bp-28h]@9
|
|
760 int v127; // [sp+84h] [bp-24h]@17
|
|
761 int v128; // [sp+88h] [bp-20h]@9
|
|
762 int *pZPixel; // [sp+8Ch] [bp-1Ch]@28
|
|
763 int a2; // [sp+90h] [bp-18h]@16
|
|
764 unsigned int v131; // [sp+94h] [bp-14h]@17
|
|
765 unsigned __int16 *pColorPixel; // [sp+98h] [bp-10h]@28
|
|
766 int v133; // [sp+9Ch] [bp-Ch]@17
|
|
767 int v134; // [sp+A0h] [bp-8h]@17
|
|
768 int v135; // [sp+A4h] [bp-4h]@24
|
|
769
|
|
770 v1 = uFaceID;
|
|
771 v111 = pRenderer->uTargetSurfacePitch;
|
|
772 if ( (uFaceID & 0x80000000u) == 0 )
|
|
773 {
|
|
774 if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces )
|
|
775 {
|
|
776 v2 = &pIndoor->pFaces[uFaceID];
|
|
777 v103 = v2;
|
|
778 v3 = v2->uAttributes;
|
|
779 if ( !(BYTE1(v3) & 0x20) )
|
|
780 {
|
|
781 if ( v3 & 0x400000 )
|
|
782 {
|
|
783 sub_4ADD1D(uFaceID);
|
|
784 return;
|
|
785 }
|
|
786 if ( !(v3 & 0x10) || (sub_4AD504(uFaceID), pRenderer->pRenderD3D) )
|
|
787 {
|
|
788 v4 = v2->GetTexture();
|
|
789 ++pBLVRenderParams->field_80;
|
|
790 v5 = v4;
|
|
791 v108 = v4;
|
|
792 if ( v4 )
|
|
793 {
|
1
|
794 v6 = v4->palette_id2;
|
0
|
795 LOBYTE(v2->uAttributes) |= 0x80u;
|
|
796 v109 = v6;
|
|
797 sub_4AE5F1(v1);
|
|
798 v126 = stru_F8AD28.pDeltaUV[0];
|
|
799 v128 = stru_F8AD28.pDeltaUV[1];
|
|
800 v107 = bUseLoResSprites;
|
|
801 v7 = sub_423B5D(v1);
|
|
802 if ( v7 )
|
|
803 {
|
|
804 if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) )
|
|
805 {
|
|
806 if ( v2->uPolygonType == 1 )
|
|
807 {
|
|
808 for ( i = 0; i < stru_F8AD28.field_AC; stru_F8AD28._blv_lights_ys[v18] = v20 )
|
|
809 {
|
|
810 v18 = i;
|
|
811 v120 = stru_F8AD28._blv_lights_xs[i];
|
|
812 v134 = (unsigned __int64)(v120 * (signed __int64)-stru_F8AD28.plane_4.vNormal.y) >> 16;
|
|
813 v133 = stru_F8AD28.plane_4.vNormal.x;
|
|
814 v120 = stru_F8AD28._blv_lights_ys[i];
|
|
815 v133 = (unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16;
|
|
816 v19 = v128;
|
|
817 stru_F8AD28._blv_lights_xs[i] = v126
|
|
818 + v134
|
|
819 + ((unsigned __int64)(v120
|
|
820 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16);
|
|
821 v20 = v19 - stru_F8AD28._blv_lights_zs[i++];
|
|
822 }
|
|
823 }
|
|
824 else
|
|
825 {
|
|
826 if ( v2->uPolygonType != 3 )
|
|
827 {
|
|
828 if ( v2->uPolygonType == 4 )
|
|
829 {
|
|
830 LABEL_16:
|
|
831 a2 = 0;
|
|
832 if ( stru_F8AD28.field_AC > 0 )
|
|
833 {
|
|
834 do
|
|
835 {
|
|
836 v8 = a2;
|
|
837 v9 = stru_F8AD28._blv_lights_xs[a2];
|
|
838 v131 = stru_F8AD28._blv_lights_ys[a2];
|
|
839 v10 = stru_F8AD28._blv_lights_zs[a2];
|
|
840 v11 = (signed int)(v10 * stru_F8AD28.plane_4.vNormal.z
|
|
841 + stru_F8AD28.plane_4.dist
|
|
842 + v9 * stru_F8AD28.plane_4.vNormal.x
|
|
843 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16;
|
|
844 v119 = v9
|
|
845 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
|
|
846 * (signed __int64)((signed int)(v10 * stru_F8AD28.plane_4.vNormal.z
|
|
847 + stru_F8AD28.plane_4.dist
|
|
848 + v9 * stru_F8AD28.plane_4.vNormal.x
|
|
849 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16)) >> 16);
|
|
850 v131 -= (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)v11) >> 16;
|
|
851 v127 = v10 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)v11) >> 16);
|
|
852 stru_F8AD28._blv_lights_xs[a2] = ((unsigned __int64)(v119
|
|
853 * (signed __int64)stru_F8AD28.vec_14.x) >> 16)
|
|
854 + ((unsigned __int64)((signed int)v131
|
|
855 * (signed __int64)stru_F8AD28.vec_14.y) >> 16);
|
|
856 v124 = (unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_20.x) >> 16;
|
|
857 v134 = (unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16;
|
|
858 v133 = (unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16;
|
|
859 v12 = v126;
|
|
860 stru_F8AD28._blv_lights_ys[v8] = v124
|
|
861 + ((unsigned __int64)((signed int)v131
|
|
862 * (signed __int64)stru_F8AD28.vec_20.y) >> 16)
|
|
863 + ((unsigned __int64)(v127
|
|
864 * (signed __int64)stru_F8AD28.vec_20.z) >> 16);
|
|
865 stru_F8AD28._blv_lights_xs[v8] += v12;
|
|
866 stru_F8AD28._blv_lights_ys[v8] += v128;
|
|
867 ++a2;
|
|
868 }
|
|
869 while ( a2 < stru_F8AD28.field_AC );
|
|
870 v2 = v103;
|
|
871 }
|
|
872 goto LABEL_24;
|
|
873 }
|
|
874 if ( v2->uPolygonType != 5 )
|
|
875 {
|
|
876 if ( v2->uPolygonType != 6 )
|
|
877 goto LABEL_24;
|
|
878 goto LABEL_16;
|
|
879 }
|
|
880 }
|
|
881 for ( j = 0; j < stru_F8AD28.field_AC; *(int *)v15 = v16 )
|
|
882 {
|
|
883 v14 = v128;
|
|
884 stru_F8AD28._blv_lights_xs[j] += v126;
|
|
885 v15 = 4 * j + 16297672;
|
|
886 v16 = v14 - stru_F8AD28._blv_lights_ys[j++];
|
|
887 }
|
|
888 }
|
|
889 LABEL_24:
|
|
890 v135 = 1;
|
|
891 pGame->_44ED0A(v2, &v135, 31);
|
|
892 v104 = sr_sub_47C24C_get_palette(v2, v109, 0, 1);
|
|
893 v134 = stru_F8AD28.field_44;
|
|
894 v106 = stru_F8AD28.field_48;
|
|
895 v21 = stru_F8A590._viewport_space_y;
|
|
896 a2 = stru_F8A590._viewport_space_y;
|
|
897 v110 = v111 * stru_F8A590._viewport_space_y;
|
|
898 v97 = v5->pLevelOfDetail0;
|
|
899 v98 = v5->pLevelOfDetail1;
|
|
900 v99 = v5->pLevelOfDetail2;
|
|
901 v22 = v5->pLevelOfDetail3;
|
|
902 v23 = 640 * stru_F8A590._viewport_space_y;
|
|
903 v119 = 640 * stru_F8A590._viewport_space_y;
|
|
904 v100 = v22;
|
|
905 if ( stru_F8A590._viewport_space_y <= stru_F8A590.field_4 )
|
|
906 {
|
|
907 v24 = 2 * stru_F8A590._viewport_space_y;
|
|
908 v120 = 2 * stru_F8A590._viewport_space_y;
|
|
909 while ( 1 )
|
|
910 {
|
|
911 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v24);
|
|
912 sub_4AE313(a1, v21, &stru_F81018.field_0);
|
|
913 if ( LOBYTE(viewparams->field_20) )
|
|
914 {
|
|
915 v27 = v111 * (v24 - pBLVRenderParams->uViewportY);
|
|
916 pZPixel = &pBLVRenderParams->pTargetZBuffer[2
|
|
917 * (*(__int16 *)((char *)stru_F8A590.array_18 + v24)
|
|
918 + 320 * (v24 - pBLVRenderParams->uViewportY))
|
|
919 - pBLVRenderParams->uViewportX];
|
|
920 pColorPixel = &pBLVRenderParams->pRenderTarget[v27
|
|
921 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v24)
|
|
922 - pBLVRenderParams->uViewportX];
|
|
923 v26 = &pBLVRenderParams->pRenderTarget[v27
|
|
924 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v24)
|
|
925 - pBLVRenderParams->uViewportX];
|
|
926 v23 = v119;
|
|
927 }
|
|
928 else
|
|
929 {
|
|
930 v25 = *(__int16 *)((char *)stru_F8A590.array_18 + v24);
|
|
931 pZPixel = &pBLVRenderParams->pTargetZBuffer[v25 + v23];
|
|
932 pColorPixel = &pBLVRenderParams->pRenderTarget[v25 + v110];
|
|
933 v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v24)];
|
|
934 }
|
|
935 v131 = (unsigned int)v26;
|
|
936 HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0);
|
|
937 LOWORD(v28) = 0;
|
|
938 v105 = stru_F8AD28.field_0 | v28;
|
|
939 v123 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8));
|
|
940 if ( (unsigned int)pColorPixel < v131 )
|
|
941 {
|
|
942 v102 = v107 + v106;
|
|
943 v29 = (char *)&stru_F81018.field_34.field_8;
|
|
944 a1 += v134;
|
|
945 for ( k = &stru_F81018.field_34.field_8; ; v29 = (char *)k )
|
|
946 {
|
|
947 sub_4AE313(a1, a2, (stru337_stru0 *)(v29 - 8));
|
|
948 v30 = *((int *)v29 - 2);
|
|
949 LOWORD(v30) = 0;
|
|
950 v117 = v105;
|
|
951 v31 = stru_F8AD28.field_0 | v30;
|
|
952 if ( v105 <= (unsigned int)v31 )
|
|
953 v117 = v31;
|
|
954 v105 = v31;
|
|
955 v32 = *((int *)v29 - 14);
|
|
956 v122 = *((int *)v29 - 14) >> v107;
|
|
957 v33 = *((int *)v29 - 13);
|
|
958 v125 = *((int *)v29 - 13) >> v107;
|
|
959 v34 = *((int *)v29 - 1) - v32;
|
|
960 v113 = (*(int *)v29 - v33) >> v102;
|
|
961 v35 = *((int *)v29 - 11);
|
|
962 v114 = v34 >> v102;
|
|
963 v116 = (&v97)[4 * v35];
|
|
964 v36 = v35 + 16 - v5->uWidthLn2;
|
|
965 v133 = v35 + 16;
|
|
966 v127 = v35 + v36;
|
|
967 v37 = v5->uWidthMinus1 >> v35;
|
|
968 v38 = v5->uHeightMinus1 >> v35 << (v35 + 16);
|
|
969 v128 = v37;
|
|
970 v126 = v38;
|
|
971 v39 = (unsigned int)(LOBYTE(viewparams->field_20) ? &pColorPixel[2 * v134] : &pColorPixel[v134]);
|
|
972 if ( v39 > v131 )
|
|
973 v39 = v131;
|
|
974 v40 = *((short *)v29 + 1);
|
|
975 v41 = *((short *)v29 - 1);
|
|
976 v121 = v39;
|
|
977 v42 = sub_4AE491(v41, v40);
|
|
978 v101 = v42;
|
|
979 v124 = (signed int)(v39 - (int)pColorPixel) >> 1;
|
|
980 if ( v123 >> 16 == v42 >> 16 || v135 & 2 )
|
|
981 {
|
|
982 v123 = (int)sr_sub_47C24C_get_palette(v103, v109, v123 >> 16, 1);
|
|
983 if ( LOBYTE(viewparams->field_20) )
|
|
984 {
|
|
985 v86 = pColorPixel;
|
|
986 if ( (unsigned int)pColorPixel < v121 )
|
|
987 {
|
|
988 v87 = pZPixel;
|
|
989 v88 = v123;
|
|
990 v89 = v122;
|
|
991 v90 = v125;
|
|
992 v91 = v133;
|
|
993 v92 = v127;
|
|
994 if ( v124 & 2 )
|
|
995 {
|
|
996 *pZPixel = v117;
|
|
997 v87 -= 2;
|
|
998 v86 = pColorPixel + 2;
|
|
999 goto LABEL_69;
|
|
1000 }
|
|
1001 do
|
|
1002 {
|
|
1003 v86 += 4;
|
|
1004 v93 = *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92));
|
|
1005 v94 = v117;
|
|
1006 LOWORD(v93) = *(short *)(v88 + 2 * v93);
|
|
1007 *v87 = v117;
|
|
1008 v87[1] = v94;
|
|
1009 v87[640] = v94;
|
|
1010 v87[641] = v94;
|
|
1011 *(v86 - 4) = v93;
|
|
1012 *(v86 - 3) = v93;
|
|
1013 v86[636] = v93;
|
|
1014 v86[637] = v93;
|
|
1015 v87[2] = v94;
|
|
1016 v87[3] = v94;
|
|
1017 v87[642] = v94;
|
|
1018 v87[643] = v94;
|
|
1019 v122 += v114;
|
|
1020 v125 += v113;
|
|
1021 v89 = v122;
|
|
1022 v90 = v125;
|
|
1023 LABEL_69:
|
|
1024 v87 += 4;
|
|
1025 v95 = *(short *)(v88 + 2 * *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92)));
|
|
1026 v96 = v114;
|
|
1027 *(v86 - 2) = v95;
|
|
1028 *(v86 - 1) = v95;
|
|
1029 v86[638] = v95;
|
|
1030 v86[639] = v95;
|
|
1031 v122 += v96;
|
|
1032 v125 += v113;
|
|
1033 v89 = v122;
|
|
1034 v90 = v125;
|
|
1035 }
|
|
1036 while ( (unsigned int)v86 < v121 );
|
|
1037 pColorPixel = v86;
|
|
1038 pZPixel = v87;
|
|
1039 }
|
|
1040 }
|
|
1041 else
|
|
1042 {
|
|
1043 v75 = pColorPixel;
|
|
1044 if ( (unsigned int)pColorPixel < v121 )
|
|
1045 {
|
|
1046 v76 = pZPixel;
|
|
1047 v77 = v123;
|
|
1048 v78 = v122;
|
|
1049 v79 = v125;
|
|
1050 v80 = v133;
|
|
1051 v81 = v127;
|
|
1052 if ( v124 & 1 )
|
|
1053 {
|
|
1054 *pZPixel = v117;
|
|
1055 --v76;
|
|
1056 v75 = pColorPixel + 1;
|
|
1057 goto LABEL_62;
|
|
1058 }
|
|
1059 do
|
|
1060 {
|
|
1061 v75 += 2;
|
|
1062 v82 = *(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81));
|
|
1063 v83 = v117;
|
|
1064 LOWORD(v82) = *(short *)(v77 + 2 * v82);
|
|
1065 *v76 = v117;
|
|
1066 *(v75 - 2) = v82;
|
|
1067 v76[1] = v83;
|
|
1068 v122 += v114;
|
|
1069 v125 += v113;
|
|
1070 v78 = v122;
|
|
1071 v79 = v125;
|
|
1072 LABEL_62:
|
|
1073 v84 = (unsigned int)(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81));
|
|
1074 v76 += 2;
|
|
1075 v85 = v114;
|
|
1076 *(v75 - 1) = *(short *)(v77 + 2 * *(char *)v84);
|
|
1077 v122 += v85;
|
|
1078 v125 += v113;
|
|
1079 v78 = v122;
|
|
1080 v79 = v125;
|
|
1081 }
|
|
1082 while ( (unsigned int)v75 < v121 );
|
|
1083 pColorPixel = v75;
|
|
1084 pZPixel = v76;
|
|
1085 }
|
|
1086 }
|
|
1087 }
|
|
1088 else
|
|
1089 {
|
|
1090 v43 = (v42 - v123) >> v106;
|
|
1091 v44 = v123 - v43;
|
|
1092 v123 = v43;
|
|
1093 v115 = v44;
|
|
1094 if ( LOBYTE(viewparams->field_20) )
|
|
1095 {
|
|
1096 v60 = pColorPixel;
|
|
1097 if ( (unsigned int)pColorPixel < v121 )
|
|
1098 {
|
|
1099 v61 = pZPixel;
|
|
1100 v62 = v104;
|
|
1101 v63 = v122;
|
|
1102 v64 = v125;
|
|
1103 v65 = v133;
|
|
1104 v66 = v127;
|
|
1105 if ( v124 & 2 )
|
|
1106 {
|
|
1107 *pZPixel = v117;
|
|
1108 v61 += 2;
|
|
1109 v60 = pColorPixel + 2;
|
|
1110 goto LABEL_54;
|
|
1111 }
|
|
1112 do
|
|
1113 {
|
|
1114 v67 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66);
|
|
1115 v68 = v123 + v115;
|
|
1116 v60 += 4;
|
|
1117 v115 = v68;
|
|
1118 v69 = ((v68 & 0xFFFF0000u) >> 8) + v116[v67];
|
|
1119 v70 = v117;
|
|
1120 LOWORD(v69) = v62[v69];
|
|
1121 *v61 = v117;
|
|
1122 v61[1] = v70;
|
|
1123 v61[640] = v70;
|
|
1124 v61[641] = v70;
|
|
1125 *(v60 - 4) = v69;
|
|
1126 *(v60 - 3) = v69;
|
|
1127 v60[636] = v69;
|
|
1128 v60[637] = v69;
|
|
1129 v61[2] = v70;
|
|
1130 v61[3] = v70;
|
|
1131 v61[642] = v70;
|
|
1132 v61[643] = v70;
|
|
1133 v122 += v114;
|
|
1134 v125 += v113;
|
|
1135 v63 = v122;
|
|
1136 v64 = v125;
|
|
1137 v61 += 4;
|
|
1138 LABEL_54:
|
|
1139 v71 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66);
|
|
1140 v72 = v123 + v115;
|
|
1141 v73 = v116[v71];
|
|
1142 v115 = v72;
|
|
1143 LOWORD(v73) = v62[((v72 & 0xFFFF0000u) >> 8) + v73];
|
|
1144 v74 = v114;
|
|
1145 *(v60 - 2) = v73;
|
|
1146 *(v60 - 1) = v73;
|
|
1147 v60[638] = v73;
|
|
1148 v60[639] = v73;
|
|
1149 v122 += v74;
|
|
1150 v125 += v113;
|
|
1151 v63 = v122;
|
|
1152 v64 = v125;
|
|
1153 }
|
|
1154 while ( (unsigned int)v60 < v121 );
|
|
1155 pColorPixel = v60;
|
|
1156 pZPixel = v61;
|
|
1157 }
|
|
1158 }
|
|
1159 else
|
|
1160 {
|
|
1161 v45 = pColorPixel;
|
|
1162 if ( (unsigned int)pColorPixel < v121 )
|
|
1163 {
|
|
1164 v46 = pZPixel;
|
|
1165 v47 = v104;
|
|
1166 v48 = v122;
|
|
1167 v49 = v125;
|
|
1168 v50 = v133;
|
|
1169 v51 = v127;
|
|
1170 if ( v124 & 1 )
|
|
1171 {
|
|
1172 *pZPixel = v117;
|
|
1173 ++v46;
|
|
1174 v45 = pColorPixel + 1;
|
|
1175 goto LABEL_47;
|
|
1176 }
|
|
1177 do
|
|
1178 {
|
|
1179 v52 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51);
|
|
1180 v53 = v123 + v115;
|
|
1181 v45 += 2;
|
|
1182 v115 = v53;
|
|
1183 v54 = ((v53 & 0xFFFF0000u) >> 8) + v116[v52];
|
|
1184 v55 = v117;
|
|
1185 LOWORD(v54) = v47[v54];
|
|
1186 *v46 = v117;
|
|
1187 *(v45 - 2) = v54;
|
|
1188 v46[1] = v55;
|
|
1189 v122 += v114;
|
|
1190 v125 += v113;
|
|
1191 v48 = v122;
|
|
1192 v49 = v125;
|
|
1193 v46 += 2;
|
|
1194 LABEL_47:
|
|
1195 v56 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51);
|
|
1196 v57 = v123 + v115;
|
|
1197 v58 = v116[v56];
|
|
1198 v115 = v57;
|
|
1199 LOWORD(v58) = v47[((v57 & 0xFFFF0000u) >> 8) + v58];
|
|
1200 v59 = v114;
|
|
1201 *(v45 - 1) = v58;
|
|
1202 v122 += v59;
|
|
1203 v125 += v113;
|
|
1204 v48 = v122;
|
|
1205 v49 = v125;
|
|
1206 }
|
|
1207 while ( (unsigned int)v45 < v121 );
|
|
1208 pColorPixel = v45;
|
|
1209 pZPixel = v46;
|
|
1210 }
|
|
1211 }
|
|
1212 }
|
|
1213 k += 13;
|
|
1214 v5 = v108;
|
|
1215 v123 = v101;
|
|
1216 a1 += v134;
|
|
1217 if ( (unsigned int)pColorPixel >= v131 )
|
|
1218 break;
|
|
1219 }
|
|
1220 v23 = v119;
|
|
1221 v24 = v120;
|
|
1222 }
|
|
1223 ++a2;
|
|
1224 v110 += v111;
|
|
1225 v23 += 640;
|
|
1226 v24 += 2;
|
|
1227 v120 = v24;
|
|
1228 v119 = v23;
|
|
1229 if ( a2 > stru_F8A590.field_4 )
|
|
1230 break;
|
|
1231 v21 = a2;
|
|
1232 }
|
|
1233 }
|
|
1234 return;
|
|
1235 }
|
|
1236 }
|
|
1237 }
|
|
1238 }
|
|
1239 }
|
|
1240 }
|
|
1241 }
|
|
1242 }
|
|
1243 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int);
|
|
1244
|
|
1245
|
|
1246
|
|
1247
|
|
1248 //----- (004B0E07) --------------------------------------------------------
|
|
1249 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID)
|
|
1250 {
|
|
1251 BLVFace *v1; // edi@1
|
|
1252 BLVFaceExtra *v2; // ecx@1
|
|
1253 Texture *v3; // esi@1
|
|
1254 unsigned int v4; // eax@1
|
|
1255 unsigned int v5; // ecx@1
|
|
1256 unsigned int result; // eax@1
|
|
1257 unsigned int v7; // ecx@5
|
|
1258
|
|
1259 v1 = &pIndoor->pFaces[uFaceID];
|
|
1260 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID];
|
|
1261 v3 = (Texture *)(v1->uBitmapID != -1 ? (int)&pBitmaps_LOD->pTextures[v1->uBitmapID] : 0);
|
|
1262 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU;
|
|
1263 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV;
|
|
1264 v4 = GetTickCount();
|
|
1265 v5 = v1->uAttributes;
|
|
1266 result = v4 >> 3;
|
|
1267 if ( v5 & 4 )
|
|
1268 {
|
|
1269 stru_F8AD28.pDeltaUV[1] -= result & v3->uHeightMinus1;
|
|
1270 }
|
|
1271 else
|
|
1272 {
|
|
1273 if ( v5 & 0x20 )
|
|
1274 stru_F8AD28.pDeltaUV[1] += result & v3->uHeightMinus1;
|
|
1275 }
|
|
1276 v7 = v1->uAttributes;
|
|
1277 if ( BYTE1(v7) & 8 )
|
|
1278 {
|
|
1279 stru_F8AD28.pDeltaUV[0] -= result & v3->uWidthMinus1;
|
|
1280 }
|
|
1281 else
|
|
1282 {
|
|
1283 if ( v7 & 0x40 )
|
|
1284 stru_F8AD28.pDeltaUV[0] += result & v3->uWidthMinus1;
|
|
1285 }
|
|
1286 return result;
|
|
1287 }
|
|
1288
|
|
1289
|
|
1290
|
|
1291 //----- (004B0EA8) --------------------------------------------------------
|
|
1292 void stru170::_4B0EA8(signed int a2, unsigned int uFaceID)
|
|
1293 {
|
|
1294 unsigned int v3; // edx@1
|
|
1295 stru170 *v4; // ebx@1
|
|
1296 BLVFace *v5; // eax@1
|
|
1297 int v6; // ecx@2
|
|
1298 unsigned __int16 v7; // ax@11
|
|
1299 Vec3_short_ *v8; // esi@15
|
|
1300 int v9; // edx@15
|
|
1301 signed int v10; // eax@18
|
|
1302 signed int v11; // edi@19
|
|
1303 signed int v12; // ecx@19
|
|
1304 signed int v13; // esi@19
|
|
1305 signed int v14; // edx@20
|
|
1306 int v15; // edx@24
|
|
1307 int v16; // esi@29
|
|
1308 BLVFace *v17; // edi@34
|
|
1309 unsigned __int16 v18; // ax@34
|
|
1310 char *v19; // eax@38
|
|
1311 signed int v20; // ecx@38
|
|
1312 char *v21; // eax@42
|
|
1313 signed int v22; // ecx@42
|
|
1314 signed int v23; // edx@45
|
|
1315 char *v24; // ecx@46
|
|
1316 int v25; // eax@47
|
|
1317 Vec3_short_ *v26; // eax@47
|
|
1318 double v27; // st7@47
|
|
1319 signed int v28; // ST28_4@47
|
|
1320 char v29; // al@48
|
|
1321 signed int v30; // eax@51
|
|
1322 int v31; // eax@52
|
|
1323 unsigned int v32; // eax@55
|
|
1324 __int16 v33; // cx@56
|
|
1325 signed int v34; // [sp+Ch] [bp-14h]@18
|
|
1326 int a0; // [sp+14h] [bp-Ch]@2
|
|
1327 IndoorCameraD3D *a0a; // [sp+14h] [bp-Ch]@36
|
|
1328 signed int v37; // [sp+18h] [bp-8h]@19
|
|
1329 stru10 *v38; // [sp+18h] [bp-8h]@36
|
|
1330 BLVFace *v39; // [sp+1Ch] [bp-4h]@1
|
|
1331
|
|
1332 v3 = uFaceID;
|
|
1333 v4 = this;
|
|
1334 v5 = &pIndoor->pFaces[uFaceID];
|
|
1335 this->field_FA8[this->std__vector_000FA8].std__vector_0007A8 = -1;
|
|
1336 v39 = v5;
|
|
1337 if ( v5->uAttributes & 1 )
|
|
1338 {
|
|
1339 v6 = (int)((char *)this + 2252 * a2);
|
|
1340 a0 = v6;
|
|
1341 if ( v3 == *(short *)(v6 + 5964) ) // stru170_stru0[a2]::uFaceID
|
|
1342 return;
|
|
1343 if ( !a2
|
|
1344 && pBLVRenderParams->vPartyPos.x >= v5->pBounding.x1 - 16
|
|
1345 && pBLVRenderParams->vPartyPos.x <= v5->pBounding.x2 + 16
|
|
1346 && pBLVRenderParams->vPartyPos.y >= v5->pBounding.y1 - 16
|
|
1347 && pBLVRenderParams->vPartyPos.y <= v5->pBounding.y2 + 16
|
|
1348 && pBLVRenderParams->vPartyPos.z >= v5->pBounding.z1 - 16
|
|
1349 && pBLVRenderParams->vPartyPos.z <= v5->pBounding.z2 + 16 )
|
|
1350 {
|
|
1351 if ( abs(v5->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v5->pFacePlane_old.vNormal.x
|
|
1352 + pBLVRenderParams->vPartyPos.y * v5->pFacePlane_old.vNormal.y
|
|
1353 + pBLVRenderParams->vPartyPos.z * v5->pFacePlane_old.vNormal.z) <= 589824 )
|
|
1354 {
|
|
1355 v7 = v39->uSectorID;
|
|
1356 if ( v4->field_FA8[0].uSectorID == v7 )
|
|
1357 v7 = v39->uBackSectorID;
|
|
1358 v4->field_FA8[v4->std__vector_000FA8].uSectorID = v7;
|
|
1359 v4->field_FA8[v4->std__vector_000FA8].uFaceID = uFaceID;
|
|
1360 v4->field_FA8[v4->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
|
|
1361 v4->field_FA8[v4->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
|
|
1362 v4->field_FA8[v4->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
|
|
1363 v4->field_FA8[v4->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
|
|
1364 v4->field_FA8[v4->std__vector_000FA8++].field_C._43F9E1(
|
|
1365 SLOWORD(pBLVRenderParams->uViewportX),
|
|
1366 pBLVRenderParams->uViewportY,
|
|
1367 SLOWORD(pBLVRenderParams->uViewportZ),
|
|
1368 pBLVRenderParams->uViewportW);
|
|
1369 sub_440639(v4->std__vector_000FA8 - 1);
|
|
1370 return;
|
|
1371 }
|
|
1372 v5 = v39;
|
|
1373 v6 = a0;
|
|
1374 }
|
|
1375 v8 = &pIndoor->pVertices[*v5->pVertexIDs];
|
|
1376 v9 = v5->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x)
|
|
1377 + v5->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y)
|
|
1378 + v5->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z);
|
|
1379 if ( *(short *)(v6 + 4008) != v5->uSectorID )// stru170_stru0[a2]::uSectorID
|
|
1380 v9 = -v9;
|
|
1381 if ( v9 < 0 )
|
|
1382 {
|
|
1383 v10 = sub_423B5D(uFaceID);
|
|
1384 v34 = v10;
|
|
1385 if ( v10 )
|
|
1386 {
|
|
1387 v11 = dword_50BAC8[0];
|
|
1388 v12 = dword_50B9D8_ys[0];
|
|
1389 a2 = dword_50BAC8[0];
|
|
1390 v13 = 1;
|
|
1391 v37 = dword_50B9D8_ys[0];
|
|
1392 if ( v10 > 1 )
|
|
1393 {
|
|
1394 do
|
|
1395 {
|
|
1396 v14 = dword_50BAC8[v13];
|
|
1397 if ( v14 < a2 )
|
|
1398 a2 = dword_50BAC8[v13];
|
|
1399 if ( v14 > v11 )
|
|
1400 v11 = v14;
|
|
1401 v15 = dword_50B9D8_ys[v13];
|
|
1402 if ( v15 < v37 )
|
|
1403 v37 = dword_50B9D8_ys[v13];
|
|
1404 if ( v15 > v12 )
|
|
1405 v12 = dword_50B9D8_ys[v13];
|
|
1406 v10 = v34;
|
|
1407 ++v13;
|
|
1408 }
|
|
1409 while ( v13 < v34 );
|
|
1410 }
|
|
1411 v16 = a0;
|
|
1412 if ( v11 >= *(short *)(a0 + 4010) // stru170_stru0[a2]::uViewportX
|
|
1413 && a2 <= *(short *)(a0 + 4014) // stru170_stru0[a2]::uViewportZ
|
|
1414 && v12 >= *(short *)(a0 + 4012) // stru170_stru0[a2]::uViewportY
|
|
1415 && v37 <= *(short *)(a0 + 4016) // stru170_stru0[a2]::uViewportW
|
|
1416 && sub_424829(v10, &v4->field_FA8[v4->std__vector_000FA8].field_C, (stru170_stru2 *)(a0 + 4020), uFaceID) )
|
|
1417 {
|
|
1418 v17 = v39;
|
|
1419 v18 = v39->uSectorID;
|
|
1420 if ( *(short *)(a0 + 4008) == v18 )
|
|
1421 v18 = v39->uBackSectorID;
|
|
1422 v4->field_FA8[v4->std__vector_000FA8].uSectorID = v18;
|
|
1423 v4->field_FA8[v4->std__vector_000FA8].uFaceID = uFaceID;
|
|
1424 v4->field_FA8[v4->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
|
|
1425 v4->field_FA8[v4->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
|
|
1426 v4->field_FA8[v4->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
|
|
1427 v4->field_FA8[v4->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
|
|
1428 v38 = pGame->pStru10Instance;
|
|
1429 a0a = pGame->pIndoorCameraD3D;
|
|
1430 if ( *(int *)(v16 + 5968) == -1 ) // [a2]::std__vector_0007A8
|
|
1431 {
|
|
1432 v29 = pGame->pStru10Instance->_49C681(
|
|
1433 v39,
|
|
1434 v4->field_FA8[v4->std__vector_000FA8].std__vector_0007AC,
|
|
1435 v4->field_FA8[v4->std__vector_000FA8].pVertices);
|
|
1436 }
|
|
1437 else
|
|
1438 {
|
|
1439
|
|
1440 static RenderVertexSoft static_sub_4B0EA8_stru_F7AA08[64];
|
|
1441 static bool __init_flag1 = false;
|
|
1442 if (!__init_flag1)
|
|
1443 {
|
|
1444 __init_flag1 = true;
|
|
1445
|
|
1446 for (uint i = 0; i < 64; ++i)
|
|
1447 static_sub_4B0EA8_stru_F7AA08[i].flt_2C = 0.0f;
|
|
1448 }
|
|
1449
|
|
1450 static RenderVertexSoft static_sub_4B0EA8_stru_F79E08[64];
|
|
1451 static bool __init_flag2 = false;
|
|
1452 if (!__init_flag2)
|
|
1453 {
|
|
1454 __init_flag2 = true;
|
|
1455
|
|
1456 for (uint i = 0; i < 64; ++i)
|
|
1457 static_sub_4B0EA8_stru_F79E08[i].flt_2C = 0.0f;
|
|
1458 }
|
|
1459
|
|
1460 v23 = 0;
|
|
1461 a2 = v39->uNumVertices;
|
|
1462 if ( a2 > 0 )
|
|
1463 {
|
|
1464 v24 = (char *)&static_sub_4B0EA8_stru_F7AA08[0].vWorldPosition.z;
|
|
1465 do
|
|
1466 {
|
|
1467 v25 = v17->pVertexIDs[v23++];
|
|
1468 v26 = &pIndoor->pVertices[v25];
|
|
1469 v27 = (double)v26->z;
|
|
1470 v28 = v26->y;
|
|
1471 v17 = v39;
|
|
1472 *((float *)v24 - 2) = (double)v26->x;
|
|
1473 *((float *)v24 - 1) = (double)v28;
|
|
1474 *(float *)v24 = v27;
|
|
1475 v24 += 48;
|
|
1476 }
|
|
1477 while ( v23 < a2 );
|
|
1478 }
|
|
1479 a0a->_437285_prolly_colide_vertices_against_frustrum(
|
|
1480 static_sub_4B0EA8_stru_F7AA08,
|
|
1481 (unsigned int *)&a2,
|
|
1482 static_sub_4B0EA8_stru_F79E08,
|
|
1483 (IndoorCameraD3D_Vec4 *)(v16 + 5972),
|
|
1484 4,
|
|
1485 0,
|
|
1486 0);
|
|
1487 v29 = v38->_49C5DA(
|
|
1488 v17,
|
|
1489 static_sub_4B0EA8_stru_F79E08,
|
|
1490 &a2,
|
|
1491 v4->field_FA8[v4->std__vector_000FA8].std__vector_0007AC,
|
|
1492 v4->field_FA8[v4->std__vector_000FA8].pVertices);
|
|
1493 }
|
|
1494 if ( v29 )
|
|
1495 {
|
|
1496 v4->field_FA8[v4->std__vector_000FA8].std__vector_0007A8 = uFaceID;
|
|
1497 v30 = v4->std__vector_000FA8;
|
|
1498 if ( v30 < 150 )
|
|
1499 {
|
|
1500 v31 = v30 + 1;
|
|
1501 v4->std__vector_000FA8 = v31;
|
|
1502 sub_440639(v31 - 1);
|
|
1503 }
|
|
1504 }
|
|
1505 if ( pBLVRenderParams->uFlags & 1 )
|
|
1506 a0a->PrepareAndDrawDebugOutline(v17, 0x1E1EFFu);
|
|
1507 }
|
|
1508 }
|
|
1509 }
|
|
1510 }
|
|
1511 else
|
|
1512 {
|
|
1513 v32 = this->uNumFaceIDs;
|
|
1514 if ( (signed int)this->uNumFaceIDs < 1000 )
|
|
1515 {
|
|
1516 v33 = a2;
|
|
1517 v4->pFaceIDs[2 * v32] = v3;
|
|
1518 v4->pFaceIDs[2 * v4->uNumFaceIDs++ + 1] = v33;
|
|
1519 }
|
|
1520 }
|
|
1521 }
|
|
1522 // F7B608: using guessed type char static_sub_4B0EA8_byte_F7B608_init_flags;
|
|
1523
|
|
1524
|
|
1525 //----- (004AFB86) --------------------------------------------------------
|
|
1526 void stru170::_4AFB86(int a2, unsigned int uFaceID)
|
|
1527 {
|
|
1528 stru170 *v3; // ebx@1
|
|
1529 BLVFace *v4; // eax@1
|
|
1530 char *v5; // ecx@2
|
|
1531 unsigned __int16 v6; // ax@11
|
|
1532 int v7; // ecx@13
|
|
1533 Vec3_short_ *v8; // esi@16
|
|
1534 int v9; // edx@16
|
|
1535 signed int v10; // eax@19
|
|
1536 signed int v11; // edi@20
|
|
1537 signed int v12; // ecx@20
|
|
1538 signed int v13; // esi@20
|
|
1539 int v14; // edx@21
|
|
1540 int v15; // edx@25
|
|
1541 unsigned __int16 v16; // ax@35
|
|
1542 signed int v17; // eax@37
|
|
1543 int v18; // eax@38
|
|
1544 signed int v19; // [sp+Ch] [bp-14h]@19
|
|
1545 char *v20; // [sp+14h] [bp-Ch]@2
|
|
1546 BLVFace *v21; // [sp+18h] [bp-8h]@1
|
|
1547 signed int v22; // [sp+1Ch] [bp-4h]@20
|
|
1548 signed int v23; // [sp+28h] [bp+8h]@20
|
|
1549
|
|
1550 v3 = this;
|
|
1551 v4 = &pIndoor->pFaces[uFaceID];
|
|
1552 v21 = v4;
|
|
1553 if ( v4->uAttributes & 1 )
|
|
1554 {
|
|
1555 v5 = (char *)this + 2252 * a2;
|
|
1556 v20 = v5;
|
|
1557 if ( uFaceID == *((short *)v5 + 2982) )
|
|
1558 return;
|
|
1559 if ( !a2
|
|
1560 && pBLVRenderParams->vPartyPos.x >= v4->pBounding.x1 - 16
|
|
1561 && pBLVRenderParams->vPartyPos.x <= v4->pBounding.x2 + 16
|
|
1562 && pBLVRenderParams->vPartyPos.y >= v4->pBounding.y1 - 16
|
|
1563 && pBLVRenderParams->vPartyPos.y <= v4->pBounding.y2 + 16
|
|
1564 && pBLVRenderParams->vPartyPos.z >= v4->pBounding.z1 - 16
|
|
1565 && pBLVRenderParams->vPartyPos.z <= v4->pBounding.z2 + 16 )
|
|
1566 {
|
|
1567 if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x
|
|
1568 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y
|
|
1569 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
|
|
1570 {
|
|
1571 v6 = v21->uSectorID;
|
|
1572 if ( v3->field_FA8[0].uSectorID == v6 )
|
|
1573 v6 = v21->uBackSectorID;
|
|
1574 v3->field_FA8[v3->std__vector_000FA8].uSectorID = v6;
|
|
1575 v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID;
|
|
1576 v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
|
|
1577 v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
|
|
1578 v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
|
|
1579 v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
|
|
1580 v3->field_FA8[v3->std__vector_000FA8++].field_C._43F9E1(
|
|
1581 SLOWORD(pBLVRenderParams->uViewportX),
|
|
1582 pBLVRenderParams->uViewportY,
|
|
1583 SLOWORD(pBLVRenderParams->uViewportZ),
|
|
1584 pBLVRenderParams->uViewportW);
|
|
1585 v7 = v3->std__vector_000FA8 - 1;
|
|
1586 goto LABEL_14;
|
|
1587 }
|
|
1588 v4 = v21;
|
|
1589 v5 = v20;
|
|
1590 }
|
|
1591 v8 = &pIndoor->pVertices[*v4->pVertexIDs];
|
|
1592 v9 = v4->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x)
|
|
1593 + v4->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y)
|
|
1594 + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z);
|
|
1595 if ( *((short *)v5 + 2004) != v4->uSectorID )
|
|
1596 v9 = -v9;
|
|
1597 if ( v9 < 0 )
|
|
1598 {
|
|
1599 v10 = sub_423B5D(uFaceID);
|
|
1600 v19 = v10;
|
|
1601 if ( v10 )
|
|
1602 {
|
|
1603 v11 = dword_50BAC8[0];
|
|
1604 v12 = dword_50B9D8_ys[0];
|
|
1605 v23 = dword_50BAC8[0];
|
|
1606 v13 = 1;
|
|
1607 v22 = dword_50B9D8_ys[0];
|
|
1608 if ( v10 > 1 )
|
|
1609 {
|
|
1610 do
|
|
1611 {
|
|
1612 v14 = dword_50BAC8[v13];
|
|
1613 if ( v14 < v23 )
|
|
1614 v23 = dword_50BAC8[v13];
|
|
1615 if ( v14 > v11 )
|
|
1616 v11 = dword_50BAC8[v13];
|
|
1617 v15 = dword_50B9D8_ys[v13];
|
|
1618 if ( v15 < v22 )
|
|
1619 v22 = dword_50B9D8_ys[v13];
|
|
1620 if ( v15 > v12 )
|
|
1621 v12 = dword_50B9D8_ys[v13];
|
|
1622 v10 = v19;
|
|
1623 ++v13;
|
|
1624 }
|
|
1625 while ( v13 < v19 );
|
|
1626 }
|
|
1627 if ( v11 >= *((short *)v20 + 2005)
|
|
1628 && v23 <= *((short *)v20 + 2007)
|
|
1629 && v12 >= *((short *)v20 + 2006)
|
|
1630 && v22 <= *((short *)v20 + 2008)
|
|
1631 && sub_424829(v10, &v3->field_FA8[v3->std__vector_000FA8].field_C, (stru170_stru2 *)(v20 + 4020), uFaceID) )
|
|
1632 {
|
|
1633 v16 = v21->uSectorID;
|
|
1634 if ( *((short *)v20 + 2004) == v16 )
|
|
1635 v16 = v21->uBackSectorID;
|
|
1636 v3->field_FA8[v3->std__vector_000FA8].uSectorID = v16;
|
|
1637 v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID;
|
|
1638 v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
|
|
1639 v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
|
|
1640 v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
|
|
1641 v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
|
|
1642 v17 = v3->std__vector_000FA8;
|
|
1643 if ( v17 < 150 )
|
|
1644 {
|
|
1645 v18 = v17 + 1;
|
|
1646 v3->std__vector_000FA8 = v18;
|
|
1647 v7 = v18 - 1;
|
|
1648 LABEL_14:
|
|
1649 sub_440639(v7);
|
|
1650 return;
|
|
1651 }
|
|
1652 }
|
|
1653 }
|
|
1654 }
|
|
1655 }
|
|
1656 else
|
|
1657 {
|
|
1658 if ( (signed int)this->uNumFaceIDs < 1000 )
|
|
1659 {
|
|
1660 this->pFaceIDs[2 * this->uNumFaceIDs] = uFaceID;
|
|
1661 this->pFaceIDs[2 * this->uNumFaceIDs++ + 1] = a2;
|
|
1662 }
|
|
1663 }
|
|
1664 }
|
|
1665
|
|
1666 //----- (004B0967) --------------------------------------------------------
|
|
1667 void __cdecl stru170_sub_4B0967()
|
|
1668 {
|
|
1669 signed int i; // edi@1
|
|
1670 int v1; // esi@2
|
|
1671 unsigned int v2; // ecx@4
|
|
1672 int v3; // eax@4
|
|
1673 int v4; // eax@6
|
|
1674 unsigned __int16 *v5; // edx@6
|
|
1675 int v6; // ecx@7
|
|
1676 int v7; // esi@8
|
|
1677
|
|
1678 for ( i = 0; i < (signed int)pStru170->uNumFaceIDs; ++i )
|
|
1679 {
|
|
1680 v1 = pStru170->pFaceIDs[2 * i];
|
|
1681 if ( v1 >= 0 )
|
|
1682 {
|
|
1683 if ( v1 < (signed int)pIndoor->uNumFaces )
|
|
1684 {
|
|
1685 v2 = pStru170->pFaceIDs[2 * i];
|
|
1686 pBLVRenderParams->field_7C = &pStru170->field_FA8[pStru170->pFaceIDs[2 * i + 1]].field_C;
|
|
1687 v3 = sub_423B5D(v2);
|
|
1688 if ( v3 )
|
|
1689 {
|
|
1690 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) )
|
|
1691 {
|
|
1692 v4 = stru_F8A590._viewport_space_y;
|
|
1693 v5 = pBLVRenderParams->pRenderTarget;
|
|
1694 if ( stru_F8A590._viewport_space_y <= stru_F8A590.field_4 )
|
|
1695 {
|
|
1696 v6 = 640 * stru_F8A590._viewport_space_y;
|
|
1697 do
|
|
1698 {
|
|
1699 v5[v6 + stru_F8A590.array_18[v4]] = -1;
|
|
1700 v7 = v6 + stru_F8A590.array_3D8[v4];
|
|
1701 v6 += 640;
|
|
1702 v5[v7] = -1;
|
|
1703 ++v4;
|
|
1704 }
|
|
1705 while ( v4 <= stru_F8A590.field_4 );
|
|
1706 }
|
|
1707 }
|
|
1708 }
|
|
1709 }
|
|
1710 }
|
|
1711 }
|
|
1712 }
|
|
1713
|
|
1714
|
|
1715 //----- (004AE5BA) --------------------------------------------------------
|
|
1716 Texture *BLVFace::GetTexture()
|
|
1717 {
|
|
1718 unsigned int v1; // ecx@2
|
|
1719
|
|
1720 if ( uAttributes & 0x4000 )
|
|
1721 v1 = pTextureFrameTable->GetFrameTexture(this->uBitmapID, pBLVRenderParams->field_0_timer_);
|
|
1722 else
|
|
1723 v1 = uBitmapID;
|
|
1724 return (Texture *)(v1 != -1 ? (int)&pBitmaps_LOD->pTextures[v1] : 0);
|
|
1725 }
|
|
1726
|
|
1727
|
|
1728 //----- (00498B15) --------------------------------------------------------
|
|
1729 void IndoorLocation::Release()
|
|
1730 {
|
|
1731 IndoorLocation *v1; // esi@1
|
|
1732 char *v2; // ebp@1
|
|
1733 void *v3; // ST00_4@1
|
|
1734
|
|
1735 v1 = this;
|
|
1736 v2 = (char *)&this->ptr_0002B4_doors_ddata;
|
|
1737 pAllocator->FreeChunk(this->ptr_0002B4_doors_ddata);
|
|
1738 *(int *)v2 = 0;
|
|
1739 pAllocator->FreeChunk(v1->ptr_0002B0_sector_rdata);
|
|
1740 v1->ptr_0002B0_sector_rdata = 0;
|
|
1741 pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata);
|
|
1742 v1->ptr_0002B8_sector_lrdata = 0;
|
|
1743 pAllocator->FreeChunk(v1->ptr_2AC);
|
|
1744 v1->ptr_2AC = 0;
|
|
1745 pAllocator->FreeChunk(v1->pSpawnPoints);
|
|
1746 v3 = v1->pVertices;
|
|
1747 v1->pSpawnPoints = 0;
|
|
1748 v1->uNumSectors = 0;
|
|
1749 v1->uNumFaces = 0;
|
|
1750 v1->uNumVertices = 0;
|
|
1751 v1->uNumNodes = 0;
|
|
1752 v1->uNumDoors = 0;
|
|
1753 v1->uNumLights = 0;
|
|
1754 pAllocator->FreeChunk(v3);
|
|
1755 pAllocator->FreeChunk(v1->pFaces);
|
|
1756 pAllocator->FreeChunk(v1->pFaceExtras);
|
|
1757 pAllocator->FreeChunk(v1->pSectors);
|
|
1758 pAllocator->FreeChunk(v1->pLights);
|
|
1759 pAllocator->FreeChunk(v1->pDoors);
|
|
1760 pAllocator->FreeChunk(v1->pNodes);
|
|
1761 pAllocator->FreeChunk(v1->pMapVertices);
|
|
1762 v1->pVertices = 0;
|
|
1763 v1->pFaces = 0;
|
|
1764 v1->pFaceExtras = 0;
|
|
1765 v1->pSectors = 0;
|
|
1766 v1->pLights = 0;
|
|
1767 v1->pDoors = 0;
|
|
1768 v1->pNodes = 0;
|
|
1769 v1->pMapVertices = 0;
|
|
1770 v1->bLoaded = 0;
|
|
1771 }
|
|
1772
|
|
1773 //----- (00498C45) --------------------------------------------------------
|
|
1774 int IndoorLocation::Alloc()
|
|
1775 {
|
|
1776 IndoorLocation *v1; // esi@1
|
|
1777 void *v2; // eax@1
|
|
1778 const void *v3; // ST3C_4@1
|
|
1779 void *v4; // eax@1
|
|
1780 const void *v5; // ST3C_4@1
|
|
1781 void *v6; // eax@1
|
|
1782 const void *v7; // ST3C_4@1
|
|
1783 void *v8; // eax@1
|
|
1784 const void *v9; // ST3C_4@1
|
|
1785 void *v10; // eax@1
|
|
1786 const void *v11; // ST3C_4@1
|
|
1787 void *v12; // eax@1
|
|
1788 const void *v13; // ST3C_4@1
|
|
1789 void *v14; // eax@1
|
|
1790 const void *v15; // ST3C_4@1
|
|
1791 void *v16; // eax@1
|
|
1792 void *v17; // ecx@1
|
|
1793 signed int result; // eax@9
|
|
1794
|
|
1795 v1 = this;
|
|
1796 v2 = pAllocator->AllocNamedChunk(this->pVertices, 0x15F90u, "L.V");
|
|
1797 v3 = v1->pFaces;
|
|
1798 v1->pVertices = (Vec3_short_ *)v2;
|
|
1799 v4 = pAllocator->AllocNamedChunk(v3, 0xEA600u, "L.F");
|
|
1800 v5 = v1->pFaceExtras;
|
|
1801 v1->pFaces = (BLVFace *)v4;
|
|
1802 v6 = pAllocator->AllocNamedChunk(v5, 0x2BF20u, "L.FX");
|
|
1803 v7 = v1->pSectors;
|
|
1804 v1->pFaceExtras = (BLVFaceExtra *)v6;
|
|
1805 v8 = pAllocator->AllocNamedChunk(v7, 0xE800u, "L.R");
|
|
1806 v9 = v1->pLights;
|
|
1807 v1->pSectors = (BLVSector *)v8;
|
|
1808 v10 = pAllocator->AllocNamedChunk(v9, 0x1900u, "L.L");
|
|
1809 v11 = v1->pDoors;
|
|
1810 v1->pLights = (BLVLightMM7 *)v10;
|
|
1811 v12 = pAllocator->AllocNamedChunk(v11, 0x3E80u, "L.D");
|
|
1812 v13 = v1->pNodes;
|
|
1813 v1->pDoors = (BLVDoor *)v12;
|
|
1814 v14 = pAllocator->AllocNamedChunk(v13, 0x9C40u, "L.BSP");
|
|
1815 v15 = v1->pMapVertices;
|
|
1816 v1->pNodes = (BSPNode *)v14;
|
|
1817 v16 = pAllocator->AllocNamedChunk(v15, 0x14824u, "L.Map");
|
|
1818 v17 = v1->pVertices;
|
|
1819 v1->pMapVertices = (unsigned int *)v16;
|
|
1820 if ( v17 && v1->pFaces && v1->pFaceExtras && v1->pSectors && v1->pLights && v1->pDoors && v1->pNodes && v16 )
|
|
1821 {
|
|
1822 memset(v17, 90000, 0);
|
|
1823 memset(v1->pFaces, 960000, 0);
|
|
1824 memset(v1->pFaceExtras, 180000, 0);
|
|
1825 memset(v1->pSectors, 59392, 0);
|
|
1826 memset(v1->pLights, 6400, 0);
|
|
1827 memset(v1->pDoors, 16000, 0);
|
|
1828 memset(v1->pNodes, 40000, 0);
|
|
1829 memset(v1->pMapVertices, 84004, 0);
|
|
1830 result = 1;
|
|
1831 }
|
|
1832 else
|
|
1833 {
|
|
1834 result = 0;
|
|
1835 }
|
|
1836 return result;
|
|
1837 }
|
|
1838
|
|
1839
|
|
1840
|
|
1841 //----- (00444810) --------------------------------------------------------
|
|
1842 unsigned int IndoorLocation::GetLocationIndex(const char *Str1)
|
|
1843 {
|
|
1844 const char *v1; // edi@1
|
|
1845 signed int v2; // esi@1
|
|
1846
|
|
1847 v1 = Str1;
|
|
1848 v2 = 0;
|
|
1849 while ( _strcmpi(v1, _4E6BDC_loc_names[v2]) )
|
|
1850 {
|
|
1851 ++v2;
|
|
1852 if ( v2 >= 11 )
|
|
1853 return 0;
|
|
1854 }
|
|
1855 return v2 + 1;
|
|
1856 }
|
|
1857
|
|
1858
|
|
1859
|
|
1860 //----- (004488F7) --------------------------------------------------------
|
|
1861 void IndoorLocation::ToggleLight(unsigned int uLightID, unsigned int bToggle)
|
|
1862 {
|
|
1863 char *v2; // eax@4
|
|
1864
|
|
1865 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (signed int)uLightID <= pIndoor->uNumLights - 1 && (uLightID & 0x80000000u) == 0 )
|
|
1866 {
|
|
1867 v2 = (char *)&pIndoor->pLights[uLightID].uAtributes;
|
|
1868 if ( bToggle )
|
|
1869 *v2 &= 0xF7u;
|
|
1870 else
|
|
1871 *v2 |= 8u;
|
|
1872 pParty->uFlags |= 2u;
|
|
1873 }
|
|
1874 }
|
|
1875
|
|
1876
|
|
1877 //----- (00498E0A) --------------------------------------------------------
|
|
1878 bool IndoorLocation::Load(char *pFilename, int a3, size_t i, char *pDest)
|
|
1879 {
|
|
1880 unsigned int v5; // ebx@1
|
|
1881 IndoorLocation *v6; // esi@1
|
|
1882 FILE *v7; // edi@3
|
|
1883 bool result; // eax@3
|
|
1884 char *v9; // ecx@4
|
|
1885 void *v10; // eax@4
|
|
1886 unsigned __int8 v11; // zf@4
|
|
1887 unsigned __int8 v12; // sf@4
|
|
1888 int v13; // eax@5
|
|
1889 size_t v14; // ecx@6
|
|
1890 char *v15; // ecx@6
|
|
1891 int v16; // edx@6
|
|
1892 size_t v17; // ecx@6
|
|
1893 char *v18; // ecx@6
|
|
1894 int v19; // edx@6
|
|
1895 unsigned __int16 *v20; // edx@6
|
|
1896 unsigned __int16 *v21; // edx@6
|
|
1897 unsigned __int16 *v22; // edx@6
|
|
1898 __int16 v23; // ax@10
|
|
1899 char *v24; // ecx@10
|
|
1900 __int16 v25; // cx@10
|
|
1901 __int16 v26; // ax@11
|
|
1902 char *v27; // ecx@11
|
|
1903 unsigned __int16 v28; // ax@17
|
|
1904 BLVFaceExtra *v29; // ecx@17
|
|
1905 char *v30; // edx@17
|
|
1906 int v31; // ecx@20
|
|
1907 void *v32; // eax@25
|
|
1908 int v33; // eax@26
|
|
1909 unsigned __int16 *v34; // edx@27
|
|
1910 size_t v35; // ecx@27
|
|
1911 char *v36; // ecx@27
|
|
1912 int v37; // edx@27
|
|
1913 size_t v38; // ecx@27
|
|
1914 char *v39; // ecx@27
|
|
1915 int v40; // edx@27
|
|
1916 unsigned __int16 *v41; // edx@27
|
|
1917 unsigned __int16 *v42; // edx@27
|
|
1918 unsigned __int16 *v43; // edx@27
|
|
1919 unsigned __int16 *v44; // edx@27
|
|
1920 size_t v45; // ecx@27
|
|
1921 unsigned __int16 *v46; // edx@27
|
|
1922 void *v47; // eax@28
|
|
1923 BLVSector *v48; // eax@29
|
|
1924 size_t v49; // ecx@29
|
|
1925 unsigned __int16 *v50; // edx@31
|
|
1926 void *v51; // eax@32
|
|
1927 int v52; // eax@33
|
|
1928 unsigned __int16 *v53; // edx@34
|
|
1929 size_t v54; // ecx@34
|
|
1930 char *v55; // ecx@34
|
|
1931 int v56; // edx@34
|
|
1932 size_t v57; // ecx@34
|
|
1933 char *v58; // ecx@34
|
|
1934 int v59; // edx@34
|
|
1935 unsigned __int16 *v60; // edx@34
|
|
1936 unsigned __int16 *v61; // edx@34
|
|
1937 unsigned __int16 *v62; // edx@34
|
|
1938 unsigned __int16 *v63; // edx@34
|
|
1939 int v64; // ecx@34
|
|
1940 BLVDoor *v65; // ecx@36
|
|
1941 char *v66; // eax@37
|
|
1942 int v67; // edx@38
|
|
1943 int v68; // ecx@38
|
|
1944 BLVFace *v69; // edx@38
|
|
1945 int v70; // ecx@38
|
|
1946 int v71; // edx@38
|
|
1947 int v72; // eax@38
|
|
1948 unsigned __int16 v73; // ax@42
|
|
1949 char *v74; // ecx@42
|
|
1950 LayingItem *v75; // ecx@44
|
|
1951 size_t v76; // eax@45
|
|
1952 int j; // edx@46
|
|
1953 unsigned __int16 v78; // ax@50
|
|
1954 void *v79; // eax@52
|
|
1955 void **v80; // esi@52
|
|
1956 size_t v81; // eax@56
|
|
1957 FILE *v82; // eax@56
|
|
1958 unsigned int v83; // edi@67
|
|
1959 void *v84; // eax@67
|
|
1960 void *v85; // ebx@67
|
|
1961 const void *v86; // ebx@72
|
|
1962 const void *v87; // ebx@72
|
|
1963 const void *v88; // ebx@72
|
|
1964 void *v89; // eax@72
|
|
1965 size_t v90; // ecx@72
|
|
1966 const void *v91; // ebx@72
|
|
1967 int v92; // eax@72
|
|
1968 BLVFace *v93; // ecx@73
|
|
1969 BLVSector *v94; // ecx@73
|
|
1970 unsigned __int16 *v95; // edx@73
|
|
1971 int v96; // ecx@73
|
|
1972 BLVSector *v97; // ecx@73
|
|
1973 unsigned __int16 *v98; // edx@73
|
|
1974 unsigned __int16 *v99; // edx@73
|
|
1975 unsigned __int16 *v100; // edx@73
|
|
1976 unsigned __int16 *v101; // edx@73
|
|
1977 __int16 v102; // ax@77
|
|
1978 BLVSector *v103; // ecx@77
|
|
1979 __int16 v104; // ax@77
|
|
1980 __int16 v105; // ax@78
|
|
1981 BLVSector *v106; // ecx@78
|
|
1982 const void *v107; // ebx@82
|
|
1983 const void *v108; // ebx@82
|
|
1984 unsigned __int16 v109; // ax@86
|
|
1985 BLVFaceExtra *v110; // ecx@86
|
|
1986 int v111; // edx@86
|
|
1987 BLVFaceExtra *v112; // ecx@89
|
|
1988 const void *v113; // ebx@94
|
|
1989 const void *v114; // ebx@94
|
|
1990 void *v115; // eax@94
|
|
1991 size_t v116; // ecx@94
|
|
1992 const void *v117; // ebx@94
|
|
1993 int v118; // eax@94
|
|
1994 unsigned __int16 *v119; // edx@95
|
|
1995 int v120; // ecx@95
|
|
1996 BLVFace *v121; // ecx@95
|
|
1997 unsigned __int16 *v122; // edx@95
|
|
1998 int v123; // ecx@95
|
|
1999 BLVFace *v124; // ecx@95
|
|
2000 unsigned __int16 *v125; // edx@95
|
|
2001 unsigned __int16 *v126; // edx@95
|
|
2002 unsigned __int16 *v127; // edx@95
|
|
2003 unsigned __int16 *v128; // edx@95
|
|
2004 unsigned __int16 *v129; // edx@95
|
|
2005 int v130; // ecx@95
|
|
2006 unsigned __int16 *v131; // edx@95
|
|
2007 void *v132; // eax@96
|
|
2008 size_t v133; // ecx@96
|
|
2009 const void *v134; // ebx@96
|
|
2010 BLVSector *v135; // eax@97
|
|
2011 FILE *v136; // ecx@97
|
|
2012 unsigned __int16 *v137; // edx@99
|
|
2013 const void *v138; // ebx@100
|
|
2014 const void *v139; // ebx@100
|
|
2015 unsigned __int16 v140; // ax@102
|
|
2016 FILE *v141; // ecx@102
|
|
2017 const void *v142; // ebx@103
|
|
2018 const void *v143; // ebx@103
|
|
2019 const void *v144; // ebx@103
|
|
2020 unsigned int v145; // eax@103
|
|
2021 void *v146; // eax@103
|
|
2022 unsigned int v147; // ecx@103
|
|
2023 int v148; // ebx@103
|
|
2024 unsigned int *v149; // ecx@103
|
|
2025 size_t v150; // eax@103
|
|
2026 unsigned int v151; // ebx@109
|
|
2027 unsigned int v152; // ecx@116
|
|
2028 unsigned int v153; // eax@117
|
|
2029 size_t v154; // ebx@126
|
|
2030 unsigned int v155; // ebx@134
|
|
2031 size_t v156; // eax@140
|
|
2032 signed int v157; // ebx@142
|
|
2033 int v158; // ebx@148
|
|
2034 BLVFace *v159; // eax@149
|
|
2035 BLVFaceExtra *v160; // ecx@149
|
|
2036 BLVFaceExtra *v161; // ecx@149
|
|
2037 signed int v162; // ebx@154
|
|
2038 unsigned int v163; // ebx@157
|
|
2039 unsigned int v164; // ebx@157
|
|
2040 unsigned int v165; // edx@158
|
|
2041 char *v166; // ecx@158
|
|
2042 unsigned __int16 v167; // ax@161
|
|
2043 __int16 v168; // ax@165
|
|
2044 unsigned int v169; // ebx@168
|
|
2045 void *v170; // eax@168
|
|
2046 size_t v171; // ebx@168
|
|
2047 int v172; // edx@168
|
|
2048 BLVDoor *v173; // ecx@169
|
|
2049 int k; // eax@169
|
|
2050 BLVDoor *v175; // ecx@172
|
|
2051 int v176; // edx@172
|
|
2052 BLVDoor *v177; // ecx@172
|
|
2053 int v178; // edx@172
|
|
2054 BLVDoor *v179; // ecx@172
|
|
2055 int v180; // edx@172
|
|
2056 BLVDoor *v181; // ecx@172
|
|
2057 int v182; // edx@172
|
|
2058 BLVDoor *v183; // ecx@172
|
|
2059 int v184; // edx@172
|
|
2060 BLVDoor *v185; // ecx@172
|
|
2061 int v186; // edx@172
|
|
2062 BLVDoor *v187; // ecx@172
|
|
2063 int v188; // edx@172
|
|
2064 unsigned __int16 *v189; // ebx@172
|
|
2065 char *v190; // edx@173
|
|
2066 BLVDoor *v191; // ecx@174
|
|
2067 BLVDoor *l; // eax@175
|
|
2068 signed int v193; // ebx@176
|
|
2069 int v194; // ecx@176
|
|
2070 BLVFaceExtra *v195; // ecx@176
|
|
2071 BLVFace *v196; // ebx@178
|
|
2072 std::string v197; // [sp-18h] [bp-680h]@66
|
|
2073 void *v198; // [sp-14h] [bp-67Ch]@72
|
|
2074 size_t v199; // [sp-10h] [bp-678h]@72
|
|
2075 size_t v200; // [sp-Ch] [bp-674h]@72
|
|
2076 const char *v201; // [sp-8h] [bp-670h]@4
|
|
2077 int v202; // [sp-4h] [bp-66Ch]@4
|
|
2078 char v203[875]; // [sp+Ch] [bp-65Ch]@130
|
|
2079 char FileName[260]; // [sp+378h] [bp-2F0h]@1
|
|
2080 char DstBuf; // [sp+47Ch] [bp-1ECh]@4
|
|
2081 __int32 Offset; // [sp+480h] [bp-1E8h]@4
|
|
2082 __int32 v207; // [sp+48Ch] [bp-1DCh]@4
|
|
2083 __int32 v208; // [sp+498h] [bp-1D0h]@4
|
|
2084 __int32 v209; // [sp+4A4h] [bp-1C4h]@4
|
|
2085 __int32 v210; // [sp+4B0h] [bp-1B8h]@4
|
|
2086 __int32 v211; // [sp+4BCh] [bp-1ACh]@15
|
|
2087 __int32 v212; // [sp+4C8h] [bp-1A0h]@15
|
|
2088 __int32 v213; // [sp+4D4h] [bp-194h]@25
|
|
2089 __int32 v214; // [sp+4E0h] [bp-188h]@25
|
|
2090 __int32 v215; // [sp+4ECh] [bp-17Ch]@32
|
|
2091 __int32 v216; // [sp+4F8h] [bp-170h]@32
|
|
2092 __int32 v217; // [sp+504h] [bp-164h]@40
|
|
2093 __int32 v218; // [sp+510h] [bp-158h]@40
|
|
2094 __int32 v219; // [sp+51Ch] [bp-14Ch]@43
|
|
2095 __int32 v220; // [sp+528h] [bp-140h]@43
|
|
2096 __int32 v221; // [sp+534h] [bp-134h]@52
|
|
2097 __int32 v222; // [sp+540h] [bp-128h]@52
|
|
2098 __int32 v223; // [sp+54Ch] [bp-11Ch]@52
|
|
2099 __int32 v224; // [sp+558h] [bp-110h]@52
|
|
2100 __int32 v225; // [sp+564h] [bp-104h]@52
|
|
2101 __int32 v226; // [sp+570h] [bp-F8h]@52
|
|
2102 __int32 v227; // [sp+57Ch] [bp-ECh]@52
|
|
2103 __int32 v228; // [sp+588h] [bp-E0h]@52
|
|
2104 __int32 v229; // [sp+594h] [bp-D4h]@52
|
|
2105 __int32 v230; // [sp+5A0h] [bp-C8h]@52
|
|
2106 __int32 v231; // [sp+5ACh] [bp-BCh]@52
|
|
2107 __int32 v232; // [sp+5B8h] [bp-B0h]@52
|
|
2108 __int32 v233; // [sp+5C4h] [bp-A4h]@52
|
|
2109 __int32 v234; // [sp+5D0h] [bp-98h]@52
|
|
2110 char pName[40]; // [sp+5FCh] [bp-6Ch]@42
|
|
2111 size_t pSource; // [sp+624h] [bp-44h]@67
|
|
2112 char Dst[12]; // [sp+628h] [bp-40h]@9
|
|
2113 char *v238; // [sp+634h] [bp-34h]@38
|
|
2114 ODMHeader header; // [sp+638h] [bp-30h]@61
|
|
2115 void *ptr; // [sp+648h] [bp-20h]@66
|
|
2116 size_t Count; // [sp+64Ch] [bp-1Ch]@109
|
|
2117 int uSourceLen; // [sp+653h] [bp-15h]@66
|
|
2118 FILE *File; // [sp+658h] [bp-10h]@56
|
|
2119 BLVSector *v244; // [sp+65Ch] [bp-Ch]@72
|
|
2120 int v245; // [sp+660h] [bp-8h]@72
|
|
2121 BLVFace *Src; // [sp+664h] [bp-4h]@73
|
|
2122 signed int Argsa; // [sp+670h] [bp+8h]@4
|
|
2123 signed int Argsb; // [sp+670h] [bp+8h]@7
|
|
2124 signed int Argsc; // [sp+670h] [bp+8h]@15
|
|
2125 signed int Argsd; // [sp+670h] [bp+8h]@18
|
|
2126 int Argse; // [sp+670h] [bp+8h]@25
|
|
2127 int Argsf; // [sp+670h] [bp+8h]@28
|
|
2128 int Argsg; // [sp+670h] [bp+8h]@32
|
|
2129 int Argsh; // [sp+670h] [bp+8h]@35
|
|
2130 signed int Argsi; // [sp+670h] [bp+8h]@40
|
|
2131 signed int Argsj; // [sp+670h] [bp+8h]@45
|
|
2132 int Argsk; // [sp+670h] [bp+8h]@143
|
|
2133 void *Argsl; // [sp+670h] [bp+8h]@155
|
|
2134 signed int Argsm; // [sp+670h] [bp+8h]@161
|
|
2135 signed int Argsn; // [sp+670h] [bp+8h]@175
|
|
2136
|
|
2137 v5 = 0;
|
|
2138 v6 = this;
|
|
2139 _6807E0_num_decorations_6807B8 = 0;
|
|
2140 sprintfex(FileName, "levels\\%s", pFilename);
|
|
2141 if ( GetFileAttributesA(FileName) != -1 )
|
|
2142 {
|
|
2143 v6->Release();
|
|
2144 if ( v6->Alloc() )
|
|
2145 {
|
|
2146 v7 = fopen(FileName, "rb");
|
|
2147 result = 1;
|
|
2148 if ( !v7 )
|
|
2149 return result;
|
|
2150 v9 = pDest;
|
|
2151 v6->bLoaded = 1;
|
|
2152 v202 = (int)v7;
|
|
2153 v201 = (const char *)1;
|
|
2154 *(int *)v9 = 1;
|
|
2155 fread(&DstBuf, 0x180u, (size_t)v201, (FILE *)v202);
|
|
2156 fseek(v7, Offset, 0);
|
|
2157 fread(&v6->blv, 0x88u, 1u, v7);
|
|
2158 fseek(v7, v207, 0);
|
|
2159 fread(&v6->uNumVertices, 1u, 4u, v7);
|
|
2160 fseek(v7, v208, 0);
|
|
2161 fread(v6->pVertices, 6u, v6->uNumVertices, v7);
|
|
2162 fseek(v7, v209, 0);
|
|
2163 fread(&v6->uNumFaces, 4u, 1u, v7);
|
|
2164 fseek(v7, v210, 0);
|
|
2165 fread(v6->pFaces, 0x60u, v6->uNumFaces, v7);
|
|
2166 v10 = pAllocator->AllocNamedChunk(v6->ptr_2AC, v6->blv.uFaces_fdata_Size, "L.FData");
|
|
2167 v202 = (int)v7;
|
|
2168 v6->ptr_2AC = (unsigned __int16 *)v10;
|
|
2169 fread(v10, 1u, v6->blv.uFaces_fdata_Size, (FILE *)v202);
|
|
2170 v11 = v6->uNumFaces == 0;
|
|
2171 v12 = (v6->uNumFaces & 0x80000000u) != 0;
|
|
2172 pDest = 0;
|
|
2173 Argsa = 0;
|
|
2174 if ( !(v12 | v11) )
|
|
2175 {
|
|
2176 v13 = 0;
|
|
2177 do
|
|
2178 {
|
|
2179 v6->pFaces[v13].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)v6->ptr_2AC];
|
|
2180 v14 = (size_t)&v6->pFaces[v13];
|
|
2181 i = v14;
|
|
2182 v15 = &pDest[2 * *(char *)(v14 + 93) + 2];
|
|
2183 v16 = (int)&v15[(unsigned int)v6->ptr_2AC];
|
|
2184 pDest = v15;
|
|
2185 *(int *)(i + 52) = v16;
|
|
2186 v17 = (size_t)&v6->pFaces[v13];
|
|
2187 i = v17;
|
|
2188 v18 = &pDest[2 * *(char *)(v17 + 93) + 2];
|
|
2189 v19 = (int)&v18[(unsigned int)v6->ptr_2AC];
|
|
2190 pDest = v18;
|
|
2191 *(int *)(i + 56) = v19;
|
|
2192 i = (size_t)&v6->pFaces[v13];
|
|
2193 v20 = v6->ptr_2AC;
|
|
2194 pDest += 2 * *(char *)(i + 93) + 2;
|
|
2195 *(int *)(i + 60) = (int)(char *)v20 + (int)pDest;
|
|
2196 i = (size_t)&v6->pFaces[v13];
|
|
2197 v21 = v6->ptr_2AC;
|
|
2198 pDest += 2 * *(char *)(i + 93) + 2;
|
|
2199 *(int *)(i + 64) = (int)(char *)v21 + (int)pDest;
|
|
2200 i = (size_t)&v6->pFaces[v13];
|
|
2201 ++v13;
|
|
2202 v22 = v6->ptr_2AC;
|
|
2203 pDest += 2 * *(char *)(i + 93) + 2;
|
|
2204 ++Argsa;
|
|
2205 *(int *)(i + 68) = (int)(char *)v22 + (int)pDest;
|
|
2206 pDest += 2 * *((char *)&v6->pFaces[v13] - 3) + 2;
|
|
2207 }
|
|
2208 while ( Argsa < (signed int)v6->uNumFaces );
|
|
2209 }
|
|
2210 Argsb = 0;
|
|
2211 if ( (signed int)v6->uNumFaces > 0 )
|
|
2212 {
|
|
2213 pDest = 0;
|
|
2214 do
|
|
2215 {
|
|
2216 fread(Dst, 1u, 0xAu, v7);
|
|
2217 if ( pDest[(unsigned int)v6->pFaces + 45] & 0x40 )
|
|
2218 {
|
|
2219 v23 = pTextureFrameTable->FindTextureByName(Dst);
|
|
2220 v24 = pDest;
|
|
2221 *(short *)&pDest[(unsigned int)v6->pFaces + 74] = v23;
|
|
2222 v25 = *(short *)&v24[(unsigned int)v6->pFaces + 74];
|
|
2223 if ( v25 )
|
|
2224 {
|
|
2225 pTextureFrameTable->LoadAnimationSequenceAndPalettes(v25);
|
|
2226 }
|
|
2227 else
|
|
2228 {
|
|
2229 v26 = pBitmaps_LOD->LoadTexture(Dst);
|
|
2230 v27 = pDest;
|
|
2231 *(short *)&pDest[(unsigned int)v6->pFaces + 74] = v26;
|
|
2232 v27[(unsigned int)v6->pFaces + 45] &= 0xBFu;
|
|
2233 }
|
|
2234 }
|
|
2235 else
|
|
2236 {
|
|
2237 *(short *)&pDest[(unsigned int)v6->pFaces + 74] = pBitmaps_LOD->LoadTexture(Dst);
|
|
2238 }
|
|
2239 ++Argsb;
|
|
2240 pDest += 96;
|
|
2241 }
|
|
2242 while ( Argsb < (signed int)v6->uNumFaces );
|
|
2243 }
|
|
2244 fseek(v7, v211, 0);
|
|
2245 fread(&v6->uNumFaceExtras, 4u, 1u, v7);
|
|
2246 fseek(v7, v212, 0);
|
|
2247 fread(v6->pFaceExtras, 0x24u, v6->uNumFaceExtras, v7);
|
|
2248 Argsc = 0;
|
|
2249 if ( (signed int)v6->uNumFaceExtras > 0 )
|
|
2250 {
|
|
2251 pDest = 0;
|
|
2252 do
|
|
2253 {
|
|
2254 fread(Dst, 1u, 0xAu, v7);
|
|
2255 v28 = pBitmaps_LOD->LoadTexture(Dst);
|
|
2256 v29 = v6->pFaceExtras;
|
|
2257 v30 = pDest;
|
|
2258 ++Argsc;
|
|
2259 pDest += 36;
|
|
2260 *(unsigned __int16 *)((char *)&v29->uAdditionalBitmapID + (int)v30) = v28;
|
|
2261 }
|
|
2262 while ( Argsc < (signed int)v6->uNumFaceExtras );
|
|
2263 }
|
|
2264 Argsd = 0;
|
|
2265 if ( (signed int)v6->uNumFaces > 0 )
|
|
2266 {
|
|
2267 pDest = 0;
|
|
2268 do
|
|
2269 {
|
|
2270 v31 = (int)&v6->pFaceExtras[*(short *)&pDest[(unsigned int)v6->pFaces + 72]];
|
|
2271 if ( *(short *)(v31 + 26) )
|
|
2272 {
|
|
2273 if ( ((BLVFaceExtra *)v31)->HasEventint() )
|
|
2274 pDest[(unsigned int)v6->pFaces + 46] |= 0x10u;
|
|
2275 else
|
|
2276 pDest[(unsigned int)v6->pFaces + 46] &= 0xEFu;
|
|
2277 }
|
|
2278 ++Argsd;
|
|
2279 pDest += 96;
|
|
2280 }
|
|
2281 while ( Argsd < (signed int)v6->uNumFaces );
|
|
2282 }
|
|
2283 fseek(v7, v213, 0);
|
|
2284 fread(&v6->uNumSectors, 4u, 1u, v7);
|
|
2285 fseek(v7, v214, 0);
|
|
2286 fread(v6->pSectors, 0x74u, v6->uNumSectors, v7);
|
|
2287 v32 = pAllocator->AllocNamedChunk(v6->ptr_0002B0_sector_rdata, v6->blv.uSector_rdata_Size, "L.RData");
|
|
2288 v202 = (int)v7;
|
|
2289 v6->ptr_0002B0_sector_rdata = (unsigned __int16 *)v32;
|
|
2290 fread(v32, 1u, v6->blv.uSector_rdata_Size, (FILE *)v202);
|
|
2291 v11 = v6->uNumSectors == 0;
|
|
2292 v12 = v6->uNumSectors < 0;
|
|
2293 pDest = 0;
|
|
2294 Argse = 0;
|
|
2295 if ( !(v12 | v11) )
|
|
2296 {
|
|
2297 v33 = 0;
|
|
2298 do
|
|
2299 {
|
|
2300 v6->pSectors[v33].pFloors = (unsigned __int16 *)&pDest[(unsigned int)v6->ptr_0002B0_sector_rdata];
|
|
2301 i = (size_t)&v6->pSectors[v33];
|
|
2302 v34 = v6->ptr_0002B0_sector_rdata;
|
|
2303 pDest += 2 * *(short *)(i + 4);
|
|
2304 *(int *)(i + 16) = (int)(char *)v34 + (int)pDest;
|
|
2305 v35 = (size_t)&v6->pSectors[v33];
|
|
2306 i = v35;
|
|
2307 v36 = &pDest[2 * *(short *)(v35 + 12)];
|
|
2308 v37 = (int)&v36[(unsigned int)v6->ptr_0002B0_sector_rdata];
|
|
2309 pDest = v36;
|
|
2310 *(int *)(i + 24) = v37;
|
|
2311 v38 = (size_t)&v6->pSectors[v33];
|
|
2312 i = v38;
|
|
2313 v39 = &pDest[2 * *(short *)(v38 + 20)];
|
|
2314 v40 = (int)&v39[(unsigned int)v6->ptr_0002B0_sector_rdata];
|
|
2315 pDest = v39;
|
|
2316 *(int *)(i + 32) = v40;
|
|
2317 i = (size_t)&v6->pSectors[v33];
|
|
2318 v41 = v6->ptr_0002B0_sector_rdata;
|
|
2319 pDest += 2 * *(short *)(i + 28);
|
|
2320 *(int *)(i + 40) = (int)(char *)v41 + (int)pDest;
|
|
2321 i = (size_t)&v6->pSectors[v33];
|
|
2322 v42 = v6->ptr_0002B0_sector_rdata;
|
|
2323 pDest += 2 * *(short *)(i + 36);
|
|
2324 *(int *)(i + 48) = (int)(char *)v42 + (int)pDest;
|
|
2325 i = (size_t)&v6->pSectors[v33];
|
|
2326 v43 = v6->ptr_0002B0_sector_rdata;
|
|
2327 pDest += 2 * *(short *)(i + 44);
|
|
2328 *(int *)(i + 64) = (int)(char *)v43 + (int)pDest;
|
|
2329 i = (size_t)&v6->pSectors[v33];
|
|
2330 v44 = v6->ptr_0002B0_sector_rdata;
|
|
2331 pDest += 2 * *(short *)(i + 60);
|
|
2332 *(int *)(i + 72) = (int)(char *)v44 + (int)pDest;
|
|
2333 v45 = (size_t)&v6->pSectors[v33];
|
|
2334 ++v33;
|
|
2335 i = v45;
|
|
2336 v46 = v6->ptr_0002B0_sector_rdata;
|
|
2337 pDest += 2 * *(short *)(v45 + 68);
|
|
2338 ++Argse;
|
|
2339 *(int *)(v45 + 80) = (int)(char *)v46 + (int)pDest;
|
|
2340 pDest += 2 * *((short *)&v6->pSectors[v33] - 20);
|
|
2341 }
|
|
2342 while ( Argse < v6->uNumSectors );
|
|
2343 }
|
|
2344 v47 = pAllocator->AllocNamedChunk(
|
|
2345 v6->ptr_0002B8_sector_lrdata,
|
|
2346 v6->blv.uSector_lrdata_Size,
|
|
2347 "L.RLData");
|
|
2348 v202 = (int)v7;
|
|
2349 v6->ptr_0002B8_sector_lrdata = (unsigned __int16 *)v47;
|
|
2350 fread(v47, 1u, v6->blv.uSector_lrdata_Size, (FILE *)v202);
|
|
2351 v11 = v6->uNumSectors == 0;
|
|
2352 v12 = v6->uNumSectors < 0;
|
|
2353 pDest = 0;
|
|
2354 Argsf = 0;
|
|
2355 if ( !(v12 | v11) )
|
|
2356 {
|
|
2357 v48 = v6->pSectors;
|
|
2358 v49 = 0;
|
|
2359 for ( i = 0; ; v49 = i )
|
|
2360 {
|
|
2361 v50 = v6->ptr_0002B8_sector_lrdata;
|
|
2362 i += 116;
|
|
2363 ++Argsf;
|
|
2364 *(BLVLightMM7 **)((char *)&v48->pLights + v49) = (BLVLightMM7 *)((char *)v50 + (int)pDest);
|
|
2365 v48 = v6->pSectors;
|
|
2366 pDest += 2 * *(__int16 *)((char *)&v48->uNumLights + v49);
|
|
2367 if ( Argsf >= v6->uNumSectors )
|
|
2368 break;
|
|
2369 }
|
|
2370 }
|
|
2371 fseek(v7, v215, 0);
|
|
2372 fread(&v6->uNumDoors, 4u, 1u, v7);
|
|
2373 fseek(v7, v216, 0);
|
|
2374 fread(v6->pDoors, 0x50u, 0xC8u, v7);
|
|
2375 v51 = pAllocator->AllocNamedChunk(v6->ptr_0002B4_doors_ddata, v6->blv.uDoors_ddata_Size, "L.DData");
|
|
2376 v202 = (int)v7;
|
|
2377 v6->ptr_0002B4_doors_ddata = (unsigned __int16 *)v51;
|
|
2378 fread(v51, 1u, v6->blv.uDoors_ddata_Size, (FILE *)v202);
|
|
2379 v11 = v6->uNumDoors == 0;
|
|
2380 v12 = v6->uNumDoors < 0;
|
|
2381 pDest = 0;
|
|
2382 Argsg = 0;
|
|
2383 if ( !(v12 | v11) )
|
|
2384 {
|
|
2385 v52 = 0;
|
|
2386 do
|
|
2387 {
|
|
2388 v6->pDoors[v52].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)v6->ptr_0002B4_doors_ddata];
|
|
2389 i = (size_t)&v6->pDoors[v52];
|
|
2390 v53 = v6->ptr_0002B4_doors_ddata;
|
|
2391 pDest += 2 * *(short *)(i + 68);
|
|
2392 *(int *)(i + 40) = (int)(char *)v53 + (int)pDest;
|
|
2393 v54 = (size_t)&v6->pDoors[v52];
|
|
2394 i = v54;
|
|
2395 v55 = &pDest[2 * *(short *)(v54 + 70)];
|
|
2396 v56 = (int)&v55[(unsigned int)v6->ptr_0002B4_doors_ddata];
|
|
2397 pDest = v55;
|
|
2398 *(int *)(i + 44) = v56;
|
|
2399 v57 = (size_t)&v6->pDoors[v52];
|
|
2400 i = v57;
|
|
2401 v58 = &pDest[2 * *(short *)(v57 + 72)];
|
|
2402 v59 = (int)&v58[(unsigned int)v6->ptr_0002B4_doors_ddata];
|
|
2403 pDest = v58;
|
|
2404 *(int *)(i + 48) = v59;
|
|
2405 i = (size_t)&v6->pDoors[v52];
|
|
2406 v60 = v6->ptr_0002B4_doors_ddata;
|
|
2407 pDest += 2 * *(short *)(i + 70);
|
|
2408 *(int *)(i + 52) = (int)(char *)v60 + (int)pDest;
|
|
2409 i = (size_t)&v6->pDoors[v52];
|
|
2410 v61 = v6->ptr_0002B4_doors_ddata;
|
|
2411 pDest += 2 * *(short *)(i + 70);
|
|
2412 *(int *)(i + 56) = (int)(char *)v61 + (int)pDest;
|
|
2413 i = (size_t)&v6->pDoors[v52];
|
|
2414 v62 = v6->ptr_0002B4_doors_ddata;
|
|
2415 pDest += 2 * *(short *)(i + 74);
|
|
2416 *(int *)(i + 60) = (int)(char *)v62 + (int)pDest;
|
|
2417 i = (size_t)&v6->pDoors[v52];
|
|
2418 v63 = v6->ptr_0002B4_doors_ddata;
|
|
2419 pDest += 2 * *(short *)(i + 74);
|
|
2420 *(int *)(i + 64) = (int)(char *)v63 + (int)pDest;
|
|
2421 ++Argsg;
|
|
2422 v64 = v6->pDoors[v52].uNumOffsets;
|
|
2423 ++v52;
|
|
2424 pDest += 2 * v64;
|
|
2425 }
|
|
2426 while ( Argsg < v6->uNumDoors );
|
|
2427 }
|
|
2428 Argsh = 0;
|
|
2429 if ( v6->uNumDoors > 0 )
|
|
2430 {
|
|
2431 v65 = v6->pDoors;
|
|
2432 pDest = 0;
|
|
2433 do
|
|
2434 {
|
|
2435 i = 0;
|
|
2436 v66 = &pDest[(int)v65];
|
|
2437 if ( *(short *)&pDest[(int)v65 + 70] > 0 )
|
|
2438 {
|
|
2439 do
|
|
2440 {
|
|
2441 v67 = *((int *)v66 + 10);
|
|
2442 a3 = 2 * i;
|
|
2443 v68 = *(short *)(v67 + 2 * i);
|
|
2444 v69 = v6->pFaces;
|
|
2445 ++i;
|
|
2446 v70 = (int)&v6->pFaceExtras[v69[v68].uFaceExtraID];
|
|
2447 v71 = *((int *)v66 + 12);
|
|
2448 v72 = a3;
|
|
2449 v238 = (char *)v70;
|
|
2450 *(short *)(a3 + v71) = *(short *)(v70 + 20);
|
|
2451 *(__int16 *)(*(char **)((char *)&v6->pDoors->pDeltaVs + (unsigned int)pDest) + v72) = *((short *)v238 + 11);
|
|
2452 v65 = v6->pDoors;
|
|
2453 v66 = &pDest[(int)v65];
|
|
2454 }
|
|
2455 while ( (signed int)i < *(short *)&pDest[(int)v65 + 70] );
|
|
2456 }
|
|
2457 ++Argsh;
|
|
2458 pDest += 80;
|
|
2459 }
|
|
2460 while ( Argsh < v6->uNumDoors );
|
|
2461 }
|
|
2462 fseek(v7, v217, 0);
|
|
2463 fread(&uNumLevelDecorations, 4u, 1u, v7);
|
|
2464 fseek(v7, v218, 0);
|
|
2465 fread(pLevelDecorations, 0x20u, uNumLevelDecorations, v7);
|
|
2466 Argsi = 0;
|
|
2467 if ( (signed int)uNumLevelDecorations > 0 )
|
|
2468 {
|
|
2469 pDest = (char *)pLevelDecorations;
|
|
2470 do
|
|
2471 {
|
|
2472 fread(pName, 1u, 0x20u, v7);
|
|
2473 v73 = pDecorationList->GetDecorIdByName(pName);
|
|
2474 v74 = pDest;
|
|
2475 ++Argsi;
|
|
2476 pDest += 32;
|
|
2477 *(short *)v74 = v73;
|
|
2478 }
|
|
2479 while ( Argsi < (signed int)uNumLevelDecorations );
|
|
2480 }
|
|
2481 fseek(v7, v219, 0);
|
|
2482 fread(&uNumLayingItems, 4u, 1u, v7);
|
|
2483 fseek(v7, v220, 0);
|
|
2484 fread(pLayingItems, 0x70u, uNumLayingItems, v7);
|
|
2485 if ( (signed int)uNumLayingItems > 0 )
|
|
2486 {
|
|
2487 v75 = pLayingItems;
|
|
2488 pDest = (char *)uNumLayingItems;
|
|
2489 do
|
|
2490 {
|
|
2491 Argsj = 0;
|
|
2492 v76 = 48 * v75->stru_24.uItemID;
|
|
2493 v11 = pObjectList->uNumObjects == 0;
|
|
2494 v12 = (pObjectList->uNumObjects & 0x80000000u) != 0;
|
|
2495 LOWORD(v76) = *(unsigned __int16 *)((char *)&pItemsTable->pItems[0].uSpriteID + v76);
|
|
2496 i = v76;
|
|
2497 v75->uItemType = v76;
|
|
2498 if ( v12 | v11 )
|
|
2499 {
|
|
2500 LABEL_50:
|
|
2501 v78 = 0;
|
|
2502 }
|
|
2503 else
|
|
2504 {
|
|
2505 for ( j = (int)&pObjectList->pObjects->uObjectID; (short)v76 != *(short *)j; j = a3 )
|
|
2506 {
|
|
2507 ++Argsj;
|
|
2508 a3 = j + 56;
|
|
2509 if ( Argsj >= (signed int)pObjectList->uNumObjects )
|
|
2510 goto LABEL_50;
|
|
2511 LOWORD(v76) = i;
|
|
2512 }
|
|
2513 v78 = Argsj;
|
|
2514 }
|
|
2515 v75->uObjectDescID = v78;
|
|
2516 ++v75;
|
|
2517 --pDest;
|
|
2518 }
|
|
2519 while ( pDest );
|
|
2520 }
|
|
2521 fseek(v7, v221, 0);
|
|
2522 fread(&uNumActors, 4u, 1u, v7);
|
|
2523 fseek(v7, v222, 0);
|
|
2524 fread(pActors, 0x344u, uNumActors, v7);
|
|
2525 fseek(v7, v228, 0);
|
|
2526 fread(&uNumChests, 4u, 1u, v7);
|
|
2527 fseek(v7, v229, 0);
|
|
2528 fread(pChests, 0x14CCu, uNumChests, v7);
|
|
2529 fseek(v7, v224, 0);
|
|
2530 fread(&v6->uNumLights, 4u, 1u, v7);
|
|
2531 fseek(v7, v225, 0);
|
|
2532 fread(v6->pLights, 0x10u, v6->uNumLights, v7);
|
|
2533 fseek(v7, v226, 0);
|
|
2534 fread(&v6->uNumNodes, 4u, 1u, v7);
|
|
2535 fseek(v7, v227, 0);
|
|
2536 fread(v6->pNodes, 8u, v6->uNumNodes, v7);
|
|
2537 fseek(v7, v230, 0);
|
|
2538 fread(&v6->uNumSpawnPoints, 4u, 1u, v7);
|
|
2539 v79 = pAllocator->AllocNamedChunk(v6->pSpawnPoints, 24 * v6->uNumSpawnPoints, "Spawn");
|
|
2540 v202 = 0;
|
|
2541 v6->pSpawnPoints = (SpawnPointMM7 *)v79;
|
|
2542 fseek(v7, v231, v202);
|
|
2543 fread(v6->pSpawnPoints, 0x18u, v6->uNumSpawnPoints, v7);
|
|
2544 fseek(v7, v232, 0);
|
|
2545 fread(&v6->dlv, 0x28u, 1u, v7);
|
|
2546 fseek(v7, v233, 0);
|
|
2547 fread(&stru_5E4C90, 1u, 0xC8u, v7);
|
|
2548 fseek(v7, v234, 0);
|
|
2549 fread(&v6->uLastVisitDay, 1u, 0x38u, v7);
|
|
2550 fseek(v7, v223, 0);
|
|
2551 v80 = (void **)&v6->pMapVertices;
|
|
2552 fread(*v80, 4u, 1u, v7);
|
|
2553 fread((char *)*v80 + 4, 0xCu, *(int *)*v80, v7);
|
|
2554 fclose(v7);
|
|
2555 goto LABEL_179;
|
|
2556 }
|
|
2557 return 4;
|
|
2558 }
|
|
2559 if ( !pGames_LOD->DoesContainerExist(pFilename) )
|
|
2560 Abortf("Unable to find %s in Games.LOD", pFilename);
|
|
2561 v238 = pFilename - 4;
|
|
2562 v81 = strlen(pFilename);
|
|
2563 strcpy(&v238[v81], ".blv");
|
|
2564 v82 = pGames_LOD->FindContainer(pFilename, 1);
|
|
2565 v11 = v6->bLoaded == 0;
|
|
2566 File = v82;
|
|
2567 if ( !v11 )
|
|
2568 return 3;
|
|
2569
|
|
2570 Release();
|
|
2571 if ( !Alloc() )
|
|
2572 return 4;
|
|
2573
|
|
2574 header.pMagic[0] = 'm';
|
|
2575 header.uVersion = 91969;
|
|
2576 header.pMagic[1] = 'v';
|
|
2577 header.pMagic[2] = 'i';
|
|
2578 header.pMagic[3] = 'i';
|
|
2579 header.uCompressedSize = 0;
|
|
2580 header.uDecompressedSize = 0;
|
|
2581 fread(&header, 0x10u, 1u, File);
|
|
2582 if ( header.uVersion != 91969
|
|
2583 || header.pMagic[0] != 'm'
|
|
2584 || header.pMagic[1] != 'v'
|
|
2585 || header.pMagic[2] != 'i'
|
|
2586 || header.pMagic[3] != 'i' )
|
|
2587 {
|
|
2588 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:792", 0);
|
|
2589 }
|
|
2590 v83 = header.uCompressedSize;
|
|
2591 pSource = header.uDecompressedSize;
|
|
2592 v84 = malloc(header.uDecompressedSize);
|
|
2593 v85 = v84;
|
|
2594 ptr = v84;
|
|
2595 if ( v83 <= pSource )
|
|
2596 {
|
|
2597 if ( v83 == pSource )
|
|
2598 {
|
|
2599 fread(v84, pSource, 1u, File);
|
|
2600 }
|
|
2601 else
|
|
2602 {
|
|
2603 *(int *)((char *)&uSourceLen + 1) = (int)malloc(v83);
|
|
2604 fread(*(void **)((char *)&uSourceLen + 1), v83, 1u, File);
|
|
2605 zlib::MemUnzip(v85, &pSource, *(const void **)((char *)&uSourceLen + 1), v83);
|
|
2606 free(*(void **)((char *)&uSourceLen + 1));
|
|
2607 }
|
|
2608 }
|
|
2609 else
|
|
2610 {
|
|
2611 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:803", 0);
|
|
2612 }
|
|
2613 strcpy(v6->pFilename, pFilename);
|
|
2614 v200 = 136;
|
|
2615 v199 = (size_t)v85;
|
|
2616 v198 = &v6->blv;
|
|
2617 v6->bLoaded = 1;
|
|
2618 memcpy(v198, (const void *)v199, v200);
|
|
2619 v86 = (char *)v85 + 136;
|
|
2620 pGameLoadingUI_ProgressBar->Progress();
|
|
2621 memcpy(&v6->uNumVertices, v86, 4u);
|
|
2622 v86 = (char *)v86 + 4;
|
|
2623 pGameLoadingUI_ProgressBar->Progress();
|
|
2624 v202 = 6 * v6->uNumVertices;
|
|
2625 v201 = (const char *)v86;
|
|
2626 v200 = (size_t)v6->pVertices;
|
|
2627 v245 = v202;
|
|
2628 memcpy((void *)v200, v86, v202);
|
|
2629 v87 = (char *)v86 + v245;
|
|
2630 pGameLoadingUI_ProgressBar->Progress();
|
|
2631 memcpy(&v6->uNumFaces, v87, 4u);
|
|
2632 v87 = (char *)v87 + 4;
|
|
2633 pGameLoadingUI_ProgressBar->Progress();
|
|
2634 v202 = 96 * v6->uNumFaces;
|
|
2635 v201 = (const char *)v87;
|
|
2636 v200 = (size_t)v6->pFaces;
|
|
2637 v245 = v202;
|
|
2638 memcpy((void *)v200, v87, v202);
|
|
2639 v88 = (char *)v87 + v245;
|
|
2640 v202 = (int)"L.FData";
|
|
2641 v201 = (const char *)v6->blv.uFaces_fdata_Size;
|
|
2642 v200 = (size_t)v6->ptr_2AC;
|
|
2643 v89 = pAllocator->AllocNamedChunk((const void *)v200, (unsigned int)v201, "L.FData");
|
|
2644 v90 = v6->blv.uFaces_fdata_Size;
|
|
2645 v6->ptr_2AC = (unsigned __int16 *)v89;
|
|
2646 v245 = v90;
|
|
2647 memcpy(v89, v88, v90);
|
|
2648 v91 = (char *)v88 + v245;
|
|
2649 v92 = 0;
|
|
2650 v11 = v6->uNumFaces == 0;
|
|
2651 v12 = (v6->uNumFaces & 0x80000000u) != 0;
|
|
2652 v244 = 0;
|
|
2653 v245 = 0;
|
|
2654 if ( !(v12 | v11) )
|
|
2655 {
|
|
2656 do
|
|
2657 {
|
|
2658 v6->pFaces[v92].pVertexIDs = (unsigned __int16 *)((char *)v244 + (unsigned int)v6->ptr_2AC);
|
|
2659 v93 = &v6->pFaces[v92];
|
|
2660 Src = v93;
|
|
2661 v94 = (BLVSector *)((char *)v244 + 2 * v93->uNumVertices + 2);
|
|
2662 v95 = (unsigned __int16 *)((char *)v94 + (unsigned int)v6->ptr_2AC);
|
|
2663 v244 = v94;
|
|
2664 Src->pXInterceptDisplacements = v95;
|
|
2665 v96 = (int)&v6->pFaces[v92];
|
|
2666 Src = (BLVFace *)v96;
|
|
2667 v97 = (BLVSector *)((char *)v244 + 2 * *(char *)(v96 + 93) + 2);
|
|
2668 v98 = (unsigned __int16 *)((char *)v97 + (unsigned int)v6->ptr_2AC);
|
|
2669 v244 = v97;
|
|
2670 Src->pYInterceptDisplacements = v98;
|
|
2671 Src = &v6->pFaces[v92];
|
|
2672 v99 = v6->ptr_2AC;
|
|
2673 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2);
|
|
2674 Src->pZInterceptDisplacements = (unsigned __int16 *)((char *)v99 + (int)v244);
|
|
2675 Src = &v6->pFaces[v92];
|
|
2676 v100 = v6->ptr_2AC;
|
|
2677 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2);
|
|
2678 Src->pVertexUIDs = (unsigned __int16 *)((char *)v100 + (int)v244);
|
|
2679 Src = &v6->pFaces[v92];
|
|
2680 ++v92;
|
|
2681 v101 = v6->ptr_2AC;
|
|
2682 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2);
|
|
2683 ++v245;
|
|
2684 Src->pVertexVIDs = (unsigned __int16 *)((char *)v101 + (int)v244);
|
|
2685 v244 = (BLVSector *)((char *)v244 + 2 * *((char *)&v6->pFaces[v92] - 3) + 2);
|
|
2686 }
|
|
2687 while ( v245 < (signed int)v6->uNumFaces );
|
|
2688 }
|
|
2689 v11 = v6->uNumFaces == 0;
|
|
2690 v12 = (v6->uNumFaces & 0x80000000u) != 0;
|
|
2691 v245 = 0;
|
|
2692 if ( !(v12 | v11) )
|
|
2693 {
|
|
2694 v244 = 0;
|
|
2695 do
|
|
2696 {
|
|
2697 memcpy(Dst, v91, 0xAu);
|
|
2698 v91 = (char *)v91 + 10;
|
|
2699 if ( *((char *)&v244->field_2C + (unsigned int)v6->pFaces + 1) & 0x40 )
|
|
2700 {
|
|
2701 v102 = pTextureFrameTable->FindTextureByName(Dst);
|
|
2702 v103 = v244;
|
|
2703 *(short *)((char *)&v244->pDecorationIDs + (unsigned int)v6->pFaces + 2) = v102;
|
|
2704 v104 = *(short *)((char *)&v103->pDecorationIDs + (unsigned int)v6->pFaces + 2);
|
|
2705 if ( v104 )
|
|
2706 {
|
|
2707 pTextureFrameTable->LoadAnimationSequenceAndPalettes(v104);
|
|
2708 }
|
|
2709 else
|
|
2710 {
|
|
2711 v105 = pBitmaps_LOD->LoadTexture(Dst);
|
|
2712 v106 = v244;
|
|
2713 *(short *)((char *)&v244->pDecorationIDs + (unsigned int)v6->pFaces + 2) = v105;
|
|
2714 *((char *)&v106->field_2C + (unsigned int)v6->pFaces + 1) &= 0xBFu;
|
|
2715 }
|
|
2716 }
|
|
2717 else
|
|
2718 {
|
|
2719 *(short *)((char *)&v244->pDecorationIDs + (unsigned int)v6->pFaces + 2) = pBitmaps_LOD->LoadTexture(Dst);
|
|
2720 }
|
|
2721 ++v245;
|
|
2722 v244 = (BLVSector *)((char *)v244 + 96);
|
|
2723 }
|
|
2724 while ( v245 < (signed int)v6->uNumFaces );
|
|
2725 }
|
|
2726 pGameLoadingUI_ProgressBar->Progress();
|
|
2727 memcpy(&v6->uNumFaceExtras, v91, 4u);
|
|
2728 v107 = (char *)v91 + 4;
|
|
2729 pGameLoadingUI_ProgressBar->Progress();
|
|
2730 v202 = 36 * v6->uNumFaceExtras;
|
|
2731 v201 = (const char *)v107;
|
|
2732 v200 = (size_t)v6->pFaceExtras;
|
|
2733 v245 = v202;
|
|
2734 memcpy((void *)v200, v107, v202);
|
|
2735 v108 = (char *)v107 + v245;
|
|
2736 v245 = 0;
|
|
2737 if ( (signed int)v6->uNumFaceExtras > 0 )
|
|
2738 {
|
|
2739 *(int *)((char *)&uSourceLen + 1) = 0;
|
|
2740 do
|
|
2741 {
|
|
2742 memcpy(Dst, v108, 0xAu);
|
|
2743 v108 = (char *)v108 + 10;
|
|
2744 if ( !_strcmpi(Dst, nullstring) )
|
|
2745 *(unsigned __int16 *)((char *)&v6->pFaceExtras->uAdditionalBitmapID + *(int *)((char *)&uSourceLen + 1)) = -1;
|
|
2746 v109 = pBitmaps_LOD->LoadTexture(Dst);
|
|
2747 v110 = v6->pFaceExtras;
|
|
2748 v111 = *(int *)((char *)&uSourceLen + 1);
|
|
2749 ++v245;
|
|
2750 *(int *)((char *)&uSourceLen + 1) += 36;
|
|
2751 *(unsigned __int16 *)((char *)&v110->uAdditionalBitmapID + v111) = v109;
|
|
2752 }
|
|
2753 while ( v245 < (signed int)v6->uNumFaceExtras );
|
|
2754 }
|
|
2755 v11 = v6->uNumFaces == 0;
|
|
2756 v12 = (v6->uNumFaces & 0x80000000u) != 0;
|
|
2757 v245 = 0;
|
|
2758 if ( !(v12 | v11) )
|
|
2759 {
|
|
2760 v244 = 0;
|
|
2761 do
|
|
2762 {
|
|
2763 v112 = &v6->pFaceExtras[*(short *)((char *)&v244->pDecorationIDs + (unsigned int)v6->pFaces)];
|
|
2764 if ( v112->uEventID )
|
|
2765 {
|
|
2766 if ( v112->HasEventint() )
|
|
2767 *((char *)&v244->uNumNonBSPFaces + (unsigned int)v6->pFaces) |= 0x10u;
|
|
2768 else
|
|
2769 *((char *)&v244->uNumNonBSPFaces + (unsigned int)v6->pFaces) &= 0xEFu;
|
|
2770 }
|
|
2771 ++v245;
|
|
2772 v244 = (BLVSector *)((char *)v244 + 96);
|
|
2773 }
|
|
2774 while ( v245 < (signed int)v6->uNumFaces );
|
|
2775 }
|
|
2776 pGameLoadingUI_ProgressBar->Progress();
|
|
2777 memcpy(&v6->uNumSectors, v108, 4u);
|
|
2778 v113 = (char *)v108 + 4;
|
|
2779 pGameLoadingUI_ProgressBar->Progress();
|
|
2780 v202 = 116 * v6->uNumSectors;
|
|
2781 v201 = (const char *)v113;
|
|
2782 v200 = (size_t)v6->pSectors;
|
|
2783 v245 = v202;
|
|
2784 memcpy((void *)v200, v113, v202);
|
|
2785 v114 = (char *)v113 + v245;
|
|
2786 v202 = (int)"L.RData";
|
|
2787 v201 = (const char *)v6->blv.uSector_rdata_Size;
|
|
2788 v200 = (size_t)v6->ptr_0002B0_sector_rdata;
|
|
2789 v115 = pAllocator->AllocNamedChunk((const void *)v200, (unsigned int)v201, "L.RData");
|
|
2790 v116 = v6->blv.uSector_rdata_Size;
|
|
2791 v6->ptr_0002B0_sector_rdata = (unsigned __int16 *)v115;
|
|
2792 v245 = v116;
|
|
2793 memcpy(v115, v114, v116);
|
|
2794 v117 = (char *)v114 + v245;
|
|
2795 v118 = 0;
|
|
2796 v11 = v6->uNumSectors == 0;
|
|
2797 v12 = v6->uNumSectors < 0;
|
|
2798 Src = 0;
|
|
2799 v245 = 0;
|
|
2800 if ( !(v12 | v11) )
|
|
2801 {
|
|
2802 do
|
|
2803 {
|
|
2804 v6->pSectors[v118].pFloors = (unsigned __int16 *)((char *)Src + (unsigned int)v6->ptr_0002B0_sector_rdata);
|
|
2805 v244 = &v6->pSectors[v118];
|
|
2806 v119 = v6->ptr_0002B0_sector_rdata;
|
|
2807 Src = (BLVFace *)((char *)Src + 2 * v244->field_4);
|
|
2808 v244->pWalls = (unsigned __int16 *)((char *)v119 + (int)Src);
|
|
2809 v120 = (int)&v6->pSectors[v118];
|
|
2810 v244 = (BLVSector *)v120;
|
|
2811 v121 = (BLVFace *)((char *)Src + 2 * *(short *)(v120 + 12));
|
|
2812 v122 = (unsigned __int16 *)((char *)v121 + (unsigned int)v6->ptr_0002B0_sector_rdata);
|
|
2813 Src = v121;
|
|
2814 v244->pCeilings = v122;
|
|
2815 v123 = (int)&v6->pSectors[v118];
|
|
2816 v244 = (BLVSector *)v123;
|
|
2817 v124 = (BLVFace *)((char *)Src + 2 * *(short *)(v123 + 20));
|
|
2818 v125 = (unsigned __int16 *)((char *)v124 + (unsigned int)v6->ptr_0002B0_sector_rdata);
|
|
2819 Src = v124;
|
|
2820 v244->pFluids = v125;
|
|
2821 v244 = &v6->pSectors[v118];
|
|
2822 v126 = v6->ptr_0002B0_sector_rdata;
|
|
2823 Src = (BLVFace *)((char *)Src + 2 * v244->field_1C);
|
|
2824 v244->pPortals = (unsigned __int16 *)((char *)v126 + (int)Src);
|
|
2825 v244 = &v6->pSectors[v118];
|
|
2826 v127 = v6->ptr_0002B0_sector_rdata;
|
|
2827 Src = (BLVFace *)((char *)Src + 2 * v244->uNumPortals);
|
|
2828 v244->pFaceIDs = (unsigned __int16 *)((char *)v127 + (int)Src);
|
|
2829 v244 = &v6->pSectors[v118];
|
|
2830 v128 = v6->ptr_0002B0_sector_rdata;
|
|
2831 Src = (BLVFace *)((char *)Src + 2 * v244->field_2C);
|
|
2832 v244->pCogs = (unsigned __int16 *)((char *)v128 + (int)Src);
|
|
2833 v244 = &v6->pSectors[v118];
|
|
2834 v129 = v6->ptr_0002B0_sector_rdata;
|
|
2835 Src = (BLVFace *)((char *)Src + 2 * v244->field_3C);
|
|
2836 v244->pDecorationIDs = (unsigned __int16 *)((char *)v129 + (int)Src);
|
|
2837 v130 = (int)&v6->pSectors[v118];
|
|
2838 ++v118;
|
|
2839 v244 = (BLVSector *)v130;
|
|
2840 v131 = v6->ptr_0002B0_sector_rdata;
|
|
2841 Src = (BLVFace *)((char *)Src + 2 * *(short *)(v130 + 68));
|
|
2842 ++v245;
|
|
2843 *(int *)(v130 + 80) = (int)(char *)v131 + (int)Src;
|
|
2844 Src = (BLVFace *)((char *)Src + 2 * *((short *)&v6->pSectors[v118] - 20));
|
|
2845 }
|
|
2846 while ( v245 < v6->uNumSectors );
|
|
2847 }
|
|
2848 v202 = (int)"L.RLData";
|
|
2849 v201 = (const char *)v6->blv.uSector_lrdata_Size;
|
|
2850 v200 = (size_t)v6->ptr_0002B8_sector_lrdata;
|
|
2851 v132 = pAllocator->AllocNamedChunk((const void *)v200, (unsigned int)v201, "L.RLData");
|
|
2852 v133 = v6->blv.uSector_lrdata_Size;
|
|
2853 v6->ptr_0002B8_sector_lrdata = (unsigned __int16 *)v132;
|
|
2854 v245 = v133;
|
|
2855 memcpy(v132, v117, v133);
|
|
2856 v134 = (char *)v117 + v245;
|
|
2857 pGameLoadingUI_ProgressBar->Progress();
|
|
2858 v11 = v6->uNumSectors == 0;
|
|
2859 v12 = v6->uNumSectors < 0;
|
|
2860 Src = 0;
|
|
2861 v245 = 0;
|
|
2862 if ( !(v12 | v11) )
|
|
2863 {
|
|
2864 v135 = v6->pSectors;
|
|
2865 v136 = 0;
|
|
2866 for ( File = 0; ; v136 = File )
|
|
2867 {
|
|
2868 v137 = v6->ptr_0002B8_sector_lrdata;
|
|
2869 File = (FILE *)((char *)File + 116);
|
|
2870 ++v245;
|
|
2871 *(int *)((char *)&v136[2]._bufsiz + (int)v135) = (int)((char *)v137 + (int)Src);
|
|
2872 v135 = v6->pSectors;
|
|
2873 Src = (BLVFace *)((char *)Src + 2 * *(short *)((char *)&v136[2]._charbuf + (int)v135));
|
|
2874 if ( v245 >= v6->uNumSectors )
|
|
2875 break;
|
|
2876 }
|
|
2877 }
|
|
2878 pGameLoadingUI_ProgressBar->Progress();
|
|
2879 memcpy(&v6->uNumDoors, v134, 4u);
|
|
2880 v138 = (char *)v134 + 4;
|
|
2881 pGameLoadingUI_ProgressBar->Progress();
|
|
2882 memcpy(&uNumLevelDecorations, v138, 4u);
|
|
2883 v138 = (char *)v138 + 4;
|
|
2884 pGameLoadingUI_ProgressBar->Progress();
|
|
2885 v245 = 32 * uNumLevelDecorations;
|
|
2886 memcpy(pLevelDecorations, v138, 32 * uNumLevelDecorations);
|
|
2887 v139 = (char *)v138 + v245;
|
|
2888 v245 = 0;
|
|
2889 if ( (signed int)uNumLevelDecorations > 0 )
|
|
2890 {
|
|
2891 File = (FILE *)pLevelDecorations;
|
|
2892 do
|
|
2893 {
|
|
2894 memcpy(pName, v139, 0x20u);
|
|
2895 v139 = (char *)v139 + 32;
|
|
2896 v140 = pDecorationList->GetDecorIdByName(pName);
|
|
2897 v141 = File;
|
|
2898 ++v245;
|
|
2899 ++File;
|
|
2900 LOWORD(v141->_ptr) = v140;
|
|
2901 }
|
|
2902 while ( v245 < (signed int)uNumLevelDecorations );
|
|
2903 }
|
|
2904 pGameLoadingUI_ProgressBar->Progress();
|
|
2905 memcpy(&v6->uNumLights, v139, 4u);
|
|
2906 v142 = (char *)v139 + 4;
|
|
2907 pGameLoadingUI_ProgressBar->Progress();
|
|
2908 v202 = 16 * v6->uNumLights;
|
|
2909 v201 = (const char *)v142;
|
|
2910 v200 = (size_t)v6->pLights;
|
|
2911 v245 = v202;
|
|
2912 memcpy((void *)v200, v142, v202);
|
|
2913 v143 = (char *)v142 + v245;
|
|
2914 pGameLoadingUI_ProgressBar->Progress();
|
|
2915 memcpy(&v6->uNumNodes, v143, 4u);
|
|
2916 v143 = (char *)v143 + 4;
|
|
2917 pGameLoadingUI_ProgressBar->Progress();
|
|
2918 v202 = 8 * v6->uNumNodes;
|
|
2919 v201 = (const char *)v143;
|
|
2920 v200 = (size_t)v6->pNodes;
|
|
2921 v245 = v202;
|
|
2922 memcpy((void *)v200, v143, v202);
|
|
2923 v144 = (char *)v143 + v245;
|
|
2924 pGameLoadingUI_ProgressBar->Progress();
|
|
2925 memcpy(&v6->uNumSpawnPoints, v144, 4u);
|
|
2926 v144 = (char *)v144 + 4;
|
|
2927 pGameLoadingUI_ProgressBar->Progress();
|
|
2928 v145 = v6->uNumSpawnPoints;
|
|
2929 v202 = (int)"Spawn";
|
|
2930 v201 = (const char *)(24 * v145);
|
|
2931 v200 = (size_t)v6->pSpawnPoints;
|
|
2932 v146 = pAllocator->AllocNamedChunk((const void *)v200, 24 * v145, "Spawn");
|
|
2933 v147 = v6->uNumSpawnPoints;
|
|
2934 v6->pSpawnPoints = (SpawnPointMM7 *)v146;
|
|
2935 v245 = 24 * v147;
|
|
2936 memcpy(v146, v144, 24 * v147);
|
|
2937 v148 = (int)((char *)v144 + v245);
|
|
2938 pGameLoadingUI_ProgressBar->Progress();
|
|
2939 v202 = 4;
|
|
2940 v201 = (const char *)v148;
|
|
2941 v200 = (size_t)v6->pMapVertices;
|
|
2942 memcpy((void *)v200, (const void *)v148, 4u);
|
|
2943 v149 = v6->pMapVertices;
|
|
2944 v199 = 12 * *v149;
|
|
2945 memcpy(v149 + 1, (const void *)(v148 + 4), v199);
|
|
2946 free(ptr);
|
|
2947 v202 = (int)".dlv";
|
|
2948 v150 = strlen(pFilename);
|
|
2949 strcpy(&v238[v150], (const char *)v202);
|
|
2950 v245 = (int)pNew_LOD->FindContainer(pFilename, 1);
|
|
2951 fread(&header, 0x10u, 1u, (FILE *)v245);
|
|
2952 v244 = 0;
|
|
2953 if ( header.uVersion != 91969
|
|
2954 || header.pMagic[0] != 'm'
|
|
2955 || header.pMagic[1] != 'v'
|
|
2956 || header.pMagic[2] != 'i'
|
|
2957 || header.pMagic[3] != 'i' )
|
|
2958 {
|
|
2959 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1090", 0);
|
|
2960 v244 = (BLVSector *)1;
|
|
2961 }
|
|
2962 v151 = header.uCompressedSize;
|
|
2963 Count = header.uDecompressedSize;
|
|
2964 Src = 0;
|
|
2965 File = 0;
|
|
2966 if ( !v244 )
|
|
2967 {
|
|
2968 Src = (BLVFace *)malloc(header.uDecompressedSize);
|
|
2969 File = (FILE *)Src;
|
|
2970 if ( v151 <= Count )
|
|
2971 {
|
|
2972 if ( v151 == Count )
|
|
2973 {
|
|
2974 fread(Src, 1u, Count, (FILE *)v245);
|
|
2975 }
|
|
2976 else
|
|
2977 {
|
|
2978 *(int *)((char *)&uSourceLen + 1) = (int)malloc(v151);
|
|
2979 fread(*(void **)((char *)&uSourceLen + 1), v151, 1u, (FILE *)v245);
|
|
2980 zlib::MemUnzip(Src, &Count, *(const void **)((char *)&uSourceLen + 1), v151);
|
|
2981 free(*(void **)((char *)&uSourceLen + 1));
|
|
2982 }
|
|
2983 }
|
|
2984 else
|
|
2985 {
|
|
2986 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1108", 0);
|
|
2987 }
|
|
2988 memcpy(&v6->dlv, Src, 0x28u);
|
|
2989 Src = (BLVFace *)((char *)Src + 40);
|
|
2990 }
|
|
2991 v152 = v6->dlv.uNumFacesInBModels;
|
|
2992 if ( v152 )
|
|
2993 {
|
|
2994 v153 = v6->dlv.uNumDecorations;
|
|
2995 if ( v153 )
|
|
2996 {
|
|
2997 if ( v152 != pIndoor->uNumFaces || v153 != uNumLevelDecorations )
|
|
2998 v244 = (BLVSector *)1;
|
|
2999 }
|
|
3000 }
|
|
3001 if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 )
|
|
3002 i = 29030400;
|
|
3003 *(int *)((char *)&uSourceLen + 1) = 0;
|
|
3004 if ( a3 - v6->dlv.uLastRepawnDay >= i && _strcmpi(pCurrentMapName, "d29.dlv") )
|
|
3005 *(int *)((char *)&uSourceLen + 1) = 1;
|
|
3006 v154 = 875;
|
|
3007 if ( v244 )
|
|
3008 {
|
|
3009 memset(v203, 0, 0x36Bu);
|
|
3010 goto LABEL_132;
|
|
3011 }
|
|
3012 if ( *(int *)((char *)&uSourceLen + 1) || !v6->dlv.uLastRepawnDay )
|
|
3013 {
|
|
3014 memcpy(v203, Src, 0x36Bu);
|
|
3015 LABEL_132:
|
|
3016 free(File);
|
|
3017 v11 = v244 == (BLVSector *)1;
|
|
3018 v6->dlv.uLastRepawnDay = a3;
|
|
3019 if ( v11 )
|
|
3020 ++v6->dlv.uNumRespawns;
|
|
3021 v202 = 0;
|
|
3022 v201 = pFilename;
|
|
3023 *(int *)pDest = 1;
|
|
3024 v245 = (int)pGames_LOD->FindContainer(v201, v202);
|
|
3025 fread(&header, 0x10u, 1u, (FILE *)v245);
|
|
3026 v155 = header.uCompressedSize;
|
|
3027 Count = header.uDecompressedSize;
|
|
3028 Src = (BLVFace *)malloc(header.uDecompressedSize);
|
|
3029 File = (FILE *)Src;
|
|
3030 if ( v155 <= Count )
|
|
3031 {
|
|
3032 if ( v155 == Count )
|
|
3033 {
|
|
3034 fread(Src, 1u, Count, (FILE *)v245);
|
|
3035 }
|
|
3036 else
|
|
3037 {
|
|
3038 *(int *)((char *)&uSourceLen + 1) = (int)malloc(v155);
|
|
3039 fread(*(void **)((char *)&uSourceLen + 1), v155, 1u, (FILE *)v245);
|
|
3040 zlib::MemUnzip(Src, &Count, *(const void **)((char *)&uSourceLen + 1), v155);
|
|
3041 free(*(void **)((char *)&uSourceLen + 1));
|
|
3042 }
|
|
3043 }
|
|
3044 else
|
|
3045 {
|
|
3046 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0);
|
|
3047 }
|
|
3048 Src = (BLVFace *)((char *)Src + 40);
|
|
3049 v154 = 875;
|
|
3050 goto LABEL_140;
|
|
3051 }
|
|
3052 *(int *)pDest = 0;
|
|
3053 LABEL_140:
|
|
3054 v202 = (int)".blv";
|
|
3055 v156 = strlen(pFilename);
|
|
3056 strcpy(&v238[v156], (const char *)v202);
|
|
3057 memcpy(v6->_visible_outlines, Src, v154);
|
|
3058 Src = (BLVFace *)((char *)Src + v154);
|
|
3059 if ( *(int *)pDest )
|
|
3060 memcpy(v6->_visible_outlines, v203, v154);
|
|
3061 v157 = 0;
|
|
3062 if ( (signed int)*pIndoor->pMapVertices > 0 )
|
|
3063 {
|
|
3064 Argsk = 0;
|
|
3065 do
|
|
3066 {
|
|
3067 if ( (unsigned __int8)(1 << (7 - v157 % 8)) & v6->_visible_outlines[v157 / 8] )
|
|
3068 BYTE2(v6->pMapVertices[Argsk + 3]) |= 1u;
|
|
3069 Argsk += 3;
|
|
3070 ++v157;
|
|
3071 }
|
|
3072 while ( v157 < (signed int)*pIndoor->pMapVertices );
|
|
3073 }
|
|
3074 v245 = 0;
|
|
3075 if ( (signed int)v6->uNumFaces > 0 )
|
|
3076 {
|
|
3077 v158 = 0;
|
|
3078 do
|
|
3079 {
|
|
3080 v200 = (size_t)&v6->pFaces[v158].uAttributes;
|
|
3081 memcpy((void *)v200, Src, 4u);
|
|
3082 v159 = v6->pFaces;
|
|
3083 v160 = v6->pFaceExtras;
|
|
3084 Src = (BLVFace *)((char *)Src + 4);
|
|
3085 v161 = &v160[v159[v158].uFaceExtraID];
|
|
3086 if ( v161->uEventID )
|
|
3087 {
|
|
3088 if ( v161->HasEventint() )
|
|
3089 BYTE2(v6->pFaces[v158].uAttributes) |= 0x10u;
|
|
3090 else
|
|
3091 BYTE2(v6->pFaces[v158].uAttributes) &= 0xEFu;
|
|
3092 }
|
|
3093 ++v245;
|
|
3094 ++v158;
|
|
3095 }
|
|
3096 while ( v245 < (signed int)v6->uNumFaces );
|
|
3097 }
|
|
3098 pGameLoadingUI_ProgressBar->Progress();
|
|
3099 v162 = 0;
|
|
3100 if ( (signed int)uNumLevelDecorations > 0 )
|
|
3101 {
|
|
3102 Argsl = &pLevelDecorations[0].field_2;
|
|
3103 do
|
|
3104 {
|
|
3105 memcpy(Argsl, Src, 2u);
|
|
3106 Src = (BLVFace *)((char *)Src + 2);
|
|
3107 Argsl = (char *)Argsl + 32;
|
|
3108 ++v162;
|
|
3109 }
|
|
3110 while ( v162 < (signed int)uNumLevelDecorations );
|
|
3111 }
|
|
3112 pGameLoadingUI_ProgressBar->Progress();
|
|
3113 memcpy(&uNumActors, Src, 4u);
|
|
3114 Src = (BLVFace *)((char *)Src + 4);
|
|
3115 pGameLoadingUI_ProgressBar->Progress();
|
|
3116 v163 = 836 * uNumActors;
|
|
3117 memcpy(pActors, Src, 836 * uNumActors);
|
|
3118 Src = (BLVFace *)((char *)Src + v163);
|
|
3119 pGameLoadingUI_ProgressBar->Progress();
|
|
3120 memcpy(&uNumLayingItems, Src, 4u);
|
|
3121 Src = (BLVFace *)((char *)Src + 4);
|
|
3122 pGameLoadingUI_ProgressBar->Progress();
|
|
3123 v164 = 112 * uNumLayingItems;
|
|
3124 memcpy(pLayingItems, Src, 112 * uNumLayingItems);
|
|
3125 Src = (BLVFace *)((char *)Src + v164);
|
|
3126 if ( (signed int)uNumLayingItems > 0 )
|
|
3127 {
|
|
3128 v165 = pObjectList->uNumObjects;
|
|
3129 v166 = (char *)&pLayingItems[0].stru_24;
|
|
3130 i = uNumLayingItems;
|
|
3131 do
|
|
3132 {
|
|
3133 if ( *(int *)v166 && !(*(v166 - 9) & 1) )
|
|
3134 {
|
|
3135 Argsm = 0;
|
|
3136 v167 = pItemsTable->pItems[*(int *)v166].uSpriteID;
|
|
3137 *((short *)v166 - 18) = v167;
|
|
3138 if ( (signed int)v165 <= 0 )
|
|
3139 {
|
|
3140 LABEL_165:
|
|
3141 v168 = 0;
|
|
3142 }
|
|
3143 else
|
|
3144 {
|
|
3145 pDest = (char *)&pObjectList->pObjects->uObjectID;
|
|
3146 while ( v167 != *(short *)pDest )
|
|
3147 {
|
|
3148 ++Argsm;
|
|
3149 pDest += 56;
|
|
3150 if ( Argsm >= (signed int)v165 )
|
|
3151 goto LABEL_165;
|
|
3152 }
|
|
3153 v168 = Argsm;
|
|
3154 }
|
|
3155 *((short *)v166 - 17) = v168;
|
|
3156 }
|
|
3157 v166 += 112;
|
|
3158 --i;
|
|
3159 }
|
|
3160 while ( i );
|
|
3161 }
|
|
3162 pGameLoadingUI_ProgressBar->Progress();
|
|
3163 memcpy(&uNumChests, Src, 4u);
|
|
3164 Src = (BLVFace *)((char *)Src + 4);
|
|
3165 pGameLoadingUI_ProgressBar->Progress();
|
|
3166 v169 = 5324 * uNumChests;
|
|
3167 memcpy(pChests, Src, 5324 * uNumChests);
|
|
3168 Src = (BLVFace *)((char *)Src + v169);
|
|
3169 pGameLoadingUI_ProgressBar->Progress();
|
|
3170 v202 = 16000;
|
|
3171 v201 = (const char *)Src;
|
|
3172 v200 = (size_t)v6->pDoors;
|
|
3173 memcpy((void *)v200, Src, 0x3E80u);
|
|
3174 Src = (BLVFace *)((char *)Src + 16000);
|
|
3175 v202 = (int)"L.DData";
|
|
3176 v201 = (const char *)v6->blv.uDoors_ddata_Size;
|
|
3177 v200 = (size_t)v6->ptr_0002B4_doors_ddata;
|
|
3178 v170 = pAllocator->AllocNamedChunk((const void *)v200, (unsigned int)v201, "L.DData");
|
|
3179 v171 = v6->blv.uDoors_ddata_Size;
|
|
3180 v6->ptr_0002B4_doors_ddata = (unsigned __int16 *)v170;
|
|
3181 memcpy(v170, Src, v171);
|
|
3182 Src = (BLVFace *)((char *)Src + v171);
|
|
3183 v172 = 0;
|
|
3184 v11 = v6->uNumDoors == 0;
|
|
3185 v12 = v6->uNumDoors < 0;
|
|
3186 v245 = 0;
|
|
3187 if ( !(v12 | v11) )
|
|
3188 {
|
|
3189 v173 = v6->pDoors;
|
|
3190 for ( k = 0; ; v172 = v188 + 2 * *((short *)&v173[k] - 3) )
|
|
3191 {
|
|
3192 v173[k].pVertexIDs = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v172);
|
|
3193 v175 = &v6->pDoors[k];
|
|
3194 v176 = v172 + 2 * v175->uNumVertices;
|
|
3195 v175->pFaceIDs = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v176);
|
|
3196 v177 = &v6->pDoors[k];
|
|
3197 v178 = v176 + 2 * v177->uNumFaces;
|
|
3198 v177->pSectorIDs = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v178);
|
|
3199 v179 = &v6->pDoors[k];
|
|
3200 v180 = v178 + 2 * v179->field_48;
|
|
3201 v179->pDeltaUs = (__int16 *)((char *)v6->ptr_0002B4_doors_ddata + v180);
|
|
3202 v181 = &v6->pDoors[k];
|
|
3203 v182 = v180 + 2 * v181->uNumFaces;
|
|
3204 v181->pDeltaVs = (__int16 *)((char *)v6->ptr_0002B4_doors_ddata + v182);
|
|
3205 v183 = &v6->pDoors[k];
|
|
3206 v184 = v182 + 2 * v183->uNumFaces;
|
|
3207 v183->pXOffsets = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v184);
|
|
3208 v185 = &v6->pDoors[k];
|
|
3209 v186 = v184 + 2 * v185->uNumOffsets;
|
|
3210 v185->pYOffsets = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v186);
|
|
3211 v187 = &v6->pDoors[k];
|
|
3212 ++k;
|
|
3213 v188 = v186 + 2 * v187->uNumOffsets;
|
|
3214 v189 = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v188);
|
|
3215 ++v245;
|
|
3216 v187->pZOffsets = v189;
|
|
3217 v173 = v6->pDoors;
|
|
3218 if ( v245 >= v6->uNumDoors )
|
|
3219 break;
|
|
3220 }
|
|
3221 }
|
|
3222 v190 = 0;
|
|
3223 v11 = v6->uNumDoors == 0;
|
|
3224 v12 = v6->uNumDoors < 0;
|
|
3225 v245 = 0;
|
|
3226 if ( !(v12 | v11) )
|
|
3227 {
|
|
3228 v191 = v6->pDoors;
|
|
3229 pDest = 0;
|
|
3230 do
|
|
3231 {
|
|
3232 Argsn = 0;
|
|
3233 for ( l = (BLVDoor *)&v190[(int)v191];
|
|
3234 Argsn < *(short *)&v190[(int)v191 + 70];
|
|
3235 l = (BLVDoor *)&v190[(int)v191] )
|
|
3236 {
|
|
3237 v193 = Argsn;
|
|
3238 v194 = l->pFaceIDs[Argsn++];
|
|
3239 v195 = &v6->pFaceExtras[v6->pFaces[v194].uFaceExtraID];
|
|
3240 l->pDeltaUs[v193] = v195->sTextureDeltaU;
|
|
3241 v190 = pDest;
|
|
3242 *(short *)(v193 * 2 + *(int *)&pDest[(unsigned int)v6->pDoors + 52]) = v195->sTextureDeltaV;
|
|
3243 v191 = v6->pDoors;
|
|
3244 }
|
|
3245 ++v245;
|
|
3246 v190 += 80;
|
|
3247 pDest = v190;
|
|
3248 }
|
|
3249 while ( v245 < v6->uNumDoors );
|
|
3250 }
|
|
3251 pGameLoadingUI_ProgressBar->Progress();
|
|
3252 v196 = Src;
|
|
3253 memcpy(&stru_5E4C90, Src, 0xC8u);
|
|
3254 pGameLoadingUI_ProgressBar->Progress();
|
|
3255 memcpy(&v6->uLastVisitDay, &v196[2].pFacePlane.vNormal.z, 0x38u);
|
|
3256 free(File);
|
|
3257 v5 = 0;
|
|
3258 LABEL_179:
|
|
3259 pSoundList->_4A9A67(64, v5);
|
|
3260 pSoundList->_4A9A67(103, v5);
|
|
3261 pSoundList->_4A9A67(63, v5);
|
|
3262 pSoundList->_4A9A67(102, v5);
|
|
3263 pSoundList->_4A9A67(50, v5);
|
|
3264 pSoundList->_4A9A67(89, v5);
|
|
3265 return 0;
|
|
3266 }
|
3
|
3267
|
0
|
3268
|
|
3269 //----- (0049AC17) --------------------------------------------------------
|
|
3270 int IndoorLocation::GetSector(int sX, int sY, int sZ)
|
|
3271 {
|
|
3272 int v4; // esi@1
|
|
3273 unsigned __int8 v5; // zf@1
|
|
3274 unsigned __int8 v6; // sf@1
|
|
3275 unsigned __int8 v7; // of@1
|
|
3276 BLVSector *v8; // eax@3
|
|
3277 int v9; // edi@9
|
|
3278 int v10; // eax@9
|
|
3279 int v11; // edx@9
|
|
3280 int v12; // eax@10
|
|
3281 unsigned __int16 v13; // ax@12
|
|
3282 int v14; // edi@14
|
|
3283 BLVFace *v15; // eax@14
|
|
3284 BLVFace *v16; // edi@14
|
|
3285 PolygonType v17; // al@14
|
|
3286 unsigned __int16 *pVertexIDs; // esi@16
|
|
3287 Vec3_short_ *v19; // eax@16
|
|
3288 int v20; // edx@16
|
|
3289 unsigned __int16 *v21; // esi@17
|
|
3290 int v22; // edi@19
|
|
3291 int v23; // edi@20
|
|
3292 Vec3_short_ *v24; // edx@20
|
|
3293 signed int v25; // edx@21
|
|
3294 int v26; // ebx@23
|
|
3295 int v27; // edx@26
|
|
3296 signed __int64 v28; // qtt@26
|
|
3297 Vec3_short_ *v29; // eax@26
|
|
3298 Vec3_short_ *v30; // edx@26
|
|
3299 int v31; // edx@26
|
|
3300 signed int v32; // edi@27
|
|
3301 signed __int64 v33; // qtt@27
|
|
3302 Vec3_short_ *v34; // edx@27
|
|
3303 int v35; // edx@32
|
|
3304 int v37; // edi@38
|
|
3305 int v38; // ebx@40
|
|
3306 int v39; // eax@41
|
|
3307 BLVFace *v40; // esi@42
|
|
3308 PolygonType v41; // dl@42
|
|
3309 int v42; // edx@43
|
|
3310 int v43[50]; // [sp+Ch] [bp-108h]@1
|
|
3311 int v44; // [sp+D4h] [bp-40h]@9
|
|
3312 int v45; // [sp+D8h] [bp-3Ch]@14
|
|
3313 int v46; // [sp+DCh] [bp-38h]@14
|
|
3314 int v47; // [sp+E0h] [bp-34h]@19
|
|
3315 int v48; // [sp+E4h] [bp-30h]@9
|
|
3316 Vec3_short_ *v49; // [sp+E8h] [bp-2Ch]@19
|
|
3317 bool v50; // [sp+ECh] [bp-28h]@19
|
|
3318 int v51; // [sp+F0h] [bp-24h]@9
|
|
3319 unsigned int v52; // [sp+F4h] [bp-20h]@2
|
|
3320 int v53; // [sp+F8h] [bp-1Ch]@10
|
|
3321 int v54; // [sp+FCh] [bp-18h]@16
|
|
3322 int v55; // [sp+100h] [bp-14h]@1
|
|
3323 int v56; // [sp+104h] [bp-10h]@1
|
|
3324 int v57; // [sp+108h] [bp-Ch]@16
|
|
3325 Vec3_short_ *v58; // [sp+10Ch] [bp-8h]@20
|
|
3326 int v59; // [sp+110h] [bp-4h]@16
|
|
3327
|
|
3328 v4 = 0;
|
|
3329 v7 = __OFSUB__(this->uNumSectors, 1);
|
|
3330 v5 = this->uNumSectors == 1;
|
|
3331 v6 = this->uNumSectors - 1 < 0;
|
|
3332 v55 = 0;
|
|
3333 v43[0] = 0;
|
|
3334 v56 = 1;
|
|
3335 if ( (unsigned __int8)(v6 ^ v7) | v5 )
|
|
3336 return 0;
|
|
3337 v52 = 116;
|
|
3338 do
|
|
3339 {
|
|
3340 v8 = &this->pSectors[v52 / 0x74];
|
|
3341 if ( v8->pBounding.x1 <= sX )
|
|
3342 {
|
|
3343 if ( v8->pBounding.x2 >= sX )
|
|
3344 {
|
|
3345 if ( v8->pBounding.y1 <= sY )
|
|
3346 {
|
|
3347 if ( v8->pBounding.y2 >= sY )
|
|
3348 {
|
|
3349 if ( v8->pBounding.z1 - 64 <= sZ )
|
|
3350 {
|
|
3351 if ( v8->pBounding.z2 + 64 >= sZ )
|
|
3352 {
|
|
3353 v9 = v8->field_4;
|
|
3354 v10 = v9 + v8->uNumPortals;
|
|
3355 v11 = 0;
|
|
3356 v44 = v9;
|
|
3357 v51 = v10;
|
|
3358 v48 = 0;
|
|
3359 if ( v10 > 0 )
|
|
3360 {
|
|
3361 v12 = -2 * v9;
|
|
3362 v53 = -2 * v9;
|
|
3363 do
|
|
3364 {
|
|
3365 if ( v11 < v44 )
|
|
3366 v13 = this->pSectors[v52 / 0x74].pFloors[v11];
|
|
3367 else
|
|
3368 v13 = *(unsigned __int16 *)((char *)this->pSectors[v52 / 0x74].pPortals + v12);
|
|
3369 v14 = (signed __int16)v13;
|
|
3370 v15 = this->pFaces;
|
|
3371 v46 = v14;
|
|
3372 v14 *= 96;
|
|
3373 v45 = v14;
|
|
3374 v16 = (BLVFace *)((char *)v15 + v14);
|
|
3375 v17 = v16->uPolygonType;
|
|
3376 if ( v17 == 3 || v17 == 4 )
|
|
3377 {
|
|
3378 pVertexIDs = v16->pVertexIDs;
|
|
3379 v19 = this->pVertices;
|
|
3380 v20 = v19[*pVertexIDs].y;
|
|
3381 v54 = 0;
|
|
3382 v57 = 0;
|
|
3383 v5 = v16->uNumVertices == 0;
|
|
3384 v59 = v20 >= sY;
|
|
3385 if ( !v5 )
|
|
3386 {
|
|
3387 v21 = pVertexIDs + 1;
|
|
3388 do
|
|
3389 {
|
|
3390 if ( v54 >= 2 )
|
|
3391 break;
|
|
3392 v49 = &v19[*v21];
|
|
3393 v22 = v49->y;
|
|
3394 v47 = v49->y;
|
|
3395 v50 = v22 >= sY;
|
|
3396 if ( v59 ^ v50 )
|
|
3397 {
|
|
3398 v58 = &v19[*(v21 - 1)];
|
|
3399 v23 = v58->x;
|
|
3400 HIWORD(v24) = HIWORD(v49);
|
|
3401 LOWORD(v24) = v49->x;
|
|
3402 v49 = v24;
|
|
3403 v59 = (signed __int16)v24;
|
|
3404 v25 = (signed __int16)v24 >= sX ? 0 : 2;
|
|
3405 v26 = v25 | v23 < sX;
|
|
3406 if ( v26 != 3 )
|
|
3407 {
|
|
3408 if ( !v26
|
|
3409 || (v58->x >= (signed __int16)v49 ? (v32 = v23 - v59,
|
|
3410 v58 = (Vec3_short_ *)(v58->y - v47),
|
|
3411 LODWORD(v33) = v32 << 16,
|
|
3412 HIDWORD(v33) = v32 >> 16,
|
|
3413 v59 = v33 / (signed int)v58,
|
|
3414 v34 = this->pVertices,
|
|
3415 v58 = (Vec3_short_ *)(v33 / (signed int)v58),
|
|
3416 v59 = sY - v34[*v21].y,
|
|
3417 v59 = (unsigned __int64)((signed int)v58
|
|
3418 * (signed __int64)v59) >> 16,
|
|
3419 v31 = *v21) : (v27 = v58->y,
|
|
3420 v59 -= v23,
|
|
3421 v58 = (Vec3_short_ *)(v47 - v27),
|
|
3422 LODWORD(v28) = v59 << 16,
|
|
3423 HIDWORD(v28) = v59 >> 16,
|
|
3424 v59 = v28 / (v47 - v27),
|
|
3425 v29 = (Vec3_short_ *)(v28 / (v47 - v27)),
|
|
3426 v30 = this->pVertices,
|
|
3427 v58 = v29,
|
|
3428 v59 = sY - v30[*(v21 - 1)].y,
|
|
3429 v59 = (unsigned __int64)((signed int)v29 * (signed __int64)v59) >> 16,
|
|
3430 v31 = *(v21 - 1)),
|
|
3431 v19 = this->pVertices,
|
|
3432 v59 + v19[v31].x > sX) )
|
|
3433 ++v54;
|
|
3434 }
|
|
3435 }
|
|
3436 ++v57;
|
|
3437 v59 = v50;
|
|
3438 ++v21;
|
|
3439 }
|
|
3440 while ( v57 < *(&this->pFaces->uNumVertices + v45) );
|
|
3441 if ( v54 == 1 )
|
|
3442 {
|
|
3443 v35 = v55++;
|
|
3444 v43[v35] = v46;
|
|
3445 }
|
|
3446 }
|
|
3447 }
|
|
3448 v11 = v48 + 1;
|
|
3449 v12 = v53 + 2;
|
|
3450 v7 = __OFSUB__(v48 + 1, v51);
|
|
3451 v6 = v48++ + 1 - v51 < 0;
|
|
3452 v53 += 2;
|
|
3453 }
|
|
3454 while ( v6 ^ v7 );
|
|
3455 v4 = v43[0];
|
|
3456 }
|
|
3457 }
|
|
3458 }
|
|
3459 }
|
|
3460 }
|
|
3461 }
|
|
3462 }
|
|
3463 ++v56;
|
|
3464 v52 += 116;
|
|
3465 }
|
|
3466 while ( v56 < this->uNumSectors );
|
|
3467 if ( v55 == 1 )
|
|
3468 return this->pFaces[v4].uSectorID;
|
|
3469 v37 = 0;
|
|
3470 if ( !v55 )
|
|
3471 return 0;
|
|
3472 v38 = 0;
|
|
3473 v53 = 0xFFFFFFu;
|
|
3474 if ( v55 > 0 )
|
|
3475 {
|
|
3476 v39 = sY;
|
|
3477 while ( 1 )
|
|
3478 {
|
|
3479 v40 = &this->pFaces[v43[v37]];
|
|
3480 v41 = v40->uPolygonType;
|
|
3481 if ( v41 == 3 )
|
|
3482 break;
|
|
3483 if ( v41 == 4 )
|
|
3484 {
|
|
3485 v51 = v40->zCalc1;
|
|
3486 v57 = (unsigned __int64)(v51 * (signed __int64)(sX << 16)) >> 16;
|
|
3487 v56 = sY << 16;
|
|
3488 v51 = v40->zCalc2;
|
|
3489 v56 = (unsigned __int64)(v51 * (signed __int64)(sY << 16)) >> 16;
|
|
3490 v42 = (v56 + v40->zCalc3 + v57 + 32768) >> 16;
|
|
3491 goto LABEL_46;
|
|
3492 }
|
|
3493 LABEL_47:
|
|
3494 if ( v39 >= 0 )
|
|
3495 {
|
|
3496 if ( v39 < v53 )
|
|
3497 {
|
|
3498 v38 = v40->uSectorID;
|
|
3499 v53 = v39;
|
|
3500 }
|
|
3501 }
|
|
3502 ++v37;
|
|
3503 if ( v37 >= v55 )
|
|
3504 return v38;
|
|
3505 }
|
|
3506 v42 = this->pVertices[*v40->pVertexIDs].z;
|
|
3507 LABEL_46:
|
|
3508 v39 = sZ - v42;
|
|
3509 goto LABEL_47;
|
|
3510 }
|
|
3511 return v38;
|
|
3512 }
|
|
3513 // 49AC17: using guessed type int var_108[50];
|
|
3514
|
|
3515
|
|
3516 //----- (00498A41) --------------------------------------------------------
|
|
3517 char BLVFace::_get_normals(Vec3_int_ *a2, Vec3_int_ *a3)
|
|
3518 {
|
|
3519 BLVFace *v3; // ebx@1
|
|
3520 int v4; // eax@1
|
|
3521 signed __int64 v5; // qax@2
|
|
3522 double v6; // st7@8
|
|
3523 Vec3_float_ a1; // [sp+Ch] [bp-Ch]@8
|
|
3524
|
|
3525 v3 = this;
|
|
3526 LOBYTE(v4) = this->uPolygonType;
|
|
3527 if ( (char)v4 == POLYGON_VerticalWall )
|
|
3528 {
|
|
3529 a2->x = -this->pFacePlane_old.vNormal.y;
|
|
3530 LODWORD(v5) = this->pFacePlane_old.vNormal.x;
|
|
3531 LABEL_9:
|
|
3532 a2->y = v5;
|
|
3533 v4 = 0;
|
|
3534 a2->z = 0;
|
|
3535 a3->y = 0;
|
|
3536 a3->z = 0xFFFF0000u;
|
|
3537 LABEL_11:
|
|
3538 a3->x = v4;
|
|
3539 goto LABEL_12;
|
|
3540 }
|
|
3541 if ( (char)v4 == POLYGON_Floor || (char)v4 == POLYGON_Ceiling )
|
|
3542 {
|
|
3543 LABEL_10:
|
|
3544 v4 = 0;
|
|
3545 a2->x = 0x10000u;
|
|
3546 a2->z = 0;
|
|
3547 a2->y = 0;
|
|
3548 a3->y = 0xFFFF0000u;
|
|
3549 a3->z = 0;
|
|
3550 goto LABEL_11;
|
|
3551 }
|
|
3552 if ( (char)v4 == POLYGON_InBetweenFloorAndWall || (char)v4 == POLYGON_InBetweenCeilingAndWall )
|
|
3553 {
|
|
3554 if ( abs(this->pFacePlane_old.vNormal.z) < 46441 )
|
|
3555 {
|
|
3556 a1.x = (double)-v3->pFacePlane_old.vNormal.y;
|
|
3557 a1.y = (double)v3->pFacePlane_old.vNormal.x;
|
|
3558 a1.z = 0.0;
|
|
3559 a1.Normalize();
|
|
3560 v6 = a1.y * 65536.0;
|
|
3561 a2->x = (signed __int64)(a1.x * 65536.0);
|
|
3562 v5 = (signed __int64)v6;
|
|
3563 goto LABEL_9;
|
|
3564 }
|
|
3565 goto LABEL_10;
|
|
3566 }
|
|
3567 LABEL_12:
|
|
3568 if ( BYTE2(v3->uAttributes) & 0x80 )
|
|
3569 {
|
|
3570 a2->x = -a2->x;
|
|
3571 a2->y = -a2->y;
|
|
3572 a2->z = -a2->z;
|
|
3573 }
|
|
3574 if ( BYTE3(v3->uAttributes) & 1 )
|
|
3575 {
|
|
3576 a3->x = -a3->x;
|
|
3577 a3->y = -a3->y;
|
|
3578 a3->z = -a3->z;
|
|
3579 }
|
|
3580 return v4;
|
|
3581 }
|
|
3582
|
|
3583 //----- (0044C23B) --------------------------------------------------------
|
|
3584 int BLVFaceExtra::HasEventint()
|
|
3585 {
|
|
3586 signed int v1; // eax@1
|
|
3587 Event *v2; // esi@2
|
|
3588 signed int result; // eax@5
|
|
3589 signed int v4; // eax@6
|
|
3590
|
|
3591 v1 = 0;
|
|
3592 if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 )
|
|
3593 goto LABEL_5;
|
|
3594 v2 = pLevelEVT_Events;
|
|
3595 while ( v2->uEventID != this->uEventID )
|
|
3596 {
|
|
3597 ++v1;
|
|
3598 ++v2;
|
|
3599 if ( v1 >= (signed int)(uLevelEVT_NumEvents - 1) )
|
|
3600 goto LABEL_5;
|
|
3601 }
|
|
3602 v4 = v1;
|
|
3603 if ( pLevelEVT[pLevelEVT_Events[v4 + 1].uEventOffsetInEVT + 4] != 1
|
|
3604 || pLevelEVT[pLevelEVT_Events[v4].uEventOffsetInEVT + 4] != 4 )
|
|
3605 LABEL_5:
|
|
3606 result = 0;
|
|
3607 else
|
|
3608 result = 1;
|
|
3609 return result;
|
|
3610 }
|