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