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