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