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