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