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