Mercurial > mm7
annotate Indoor.cpp @ 1308:ad903bb5b702
Слияние
author | Ritor1 |
---|---|
date | Mon, 24 Jun 2013 18:59:39 +0600 |
parents | 13b7be8b06a0 18665b8f66b2 |
children | 995d2f8ad71b |
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" |
1262 | 36 #include "Lights.h" |
0 | 37 |
38 #include "mm7_data.h" | |
831 | 39 #include "MM7.h" |
1295 | 40 #include "Sprites.h" |
41 #include "Game.h" | |
42 #include "stru6.h" | |
43 #include "ParticleEngine.h" | |
44 #include "Outdoor_stuff.h" | |
1297 | 45 #include "texts.h" |
46 #include "GUIWindow.h" | |
0 | 47 |
48 | |
49 | |
50 | |
51 | |
52 IndoorLocation *pIndoor = new IndoorLocation; | |
53 BLVRenderParams *pBLVRenderParams = new BLVRenderParams; | |
54 | |
55 struct DecorationList *pDecorationList; | |
56 | |
1202 | 57 std::array<LevelDecoration, 3000> pLevelDecorations; |
0 | 58 size_t uNumLevelDecorations; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
59 LevelDecoration* activeLevelDecoration; |
0 | 60 |
61 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null; | |
62 | |
63 stru320 stru_F8AD28; // idb | |
64 stru337 stru_F81018; | |
65 stru167_wrap array_5118E8; | |
66 BspRenderer_stru2 stru_F8A590; | |
67 BspRenderer *pBspRenderer = new BspRenderer; // idb | |
68 stru141 stru_721530; | |
1202 | 69 std::array<stru352, 480> stru_F83B80; |
0 | 70 |
71 | |
72 | |
73 unsigned __int16 pDoorSoundIDsByLocationID[78] = | |
74 { | |
75 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, | |
76 300, 300, 300, 404, 302, 306, 308, 304, 308, 302, 400, 302, 300, | |
77 308, 308, 306, 308, 308, 304, 300, 404, 406, 300, 400, 406, 404, | |
78 306, 302, 408, 304, 300, 300, 300, 300, 300, 300, 300, 300, 300, | |
79 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 404, 304, | |
80 400, 300, 300, 404, 304, 400, 300, 300, 404, 304, 400, 300, 300 | |
81 }; | |
82 | |
83 | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
84 std::array<const char *, 11> _4E6BDC_loc_names= |
1006 | 85 { |
86 "mdt12.blv", | |
87 "d18.blv", | |
88 "mdt14.blv", | |
89 "d37.blv", | |
90 "mdk01.blv", | |
91 "mdt01.blv", | |
92 "mdr01.blv", | |
93 "mdt10.blv", | |
94 "mdt09.blv", | |
95 "mdt15.blv", | |
96 "mdt11.blv" | |
97 }; | |
98 | |
0 | 99 |
100 //----- (0043F39E) -------------------------------------------------------- | |
101 void __fastcall PrepareDrawLists_BLV(IndoorLocation_drawstru *_this) | |
102 { | |
103 //int *v1; // ecx@1 | |
104 //double v2; // ST30_8@3 | |
105 //double v3; // ST30_8@6 | |
106 //double v4; // ST28_8@6 | |
107 int v5; // eax@4 | |
707 | 108 //int v6; // eax@7 |
0 | 109 unsigned int v7; // ebx@8 |
110 BLVSector *v8; // esi@8 | |
707 | 111 //unsigned __int16 *v9; // edi@8 |
112 //int i; // [sp+18h] [bp-8h]@7 | |
0 | 113 //unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3 |
707 | 114 //signed int v12; // [sp+1Ch] [bp-4h]@8 |
0 | 115 |
116 pBLVRenderParams->Reset(_this); | |
117 pMobileLightsStack->uNumLightsActive = 0; | |
118 //uNumMobileLightsApplied = 0; | |
119 uNumDecorationsDrawnThisFrame = 0; | |
120 _unused000 = 0; | |
121 uNumSpritesDrawnThisFrame = 0; | |
122 uNumBillboardsToDraw = 0; | |
707 | 123 |
124 if ( !byte_4D864C || !(pGame->uFlags & 0x1000) ) // lightspot around party | |
0 | 125 { |
126 //v2 = pParty->flt_TorchlightColorB + 6.7553994e15; | |
127 //v11 = LOBYTE(v2); | |
128 v5 = 800; | |
129 if (pParty->TorchlightActive()) | |
707 | 130 v5 *= pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; |
0 | 131 //LOBYTE(v1) = byte_4E94D0; |
132 //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; | |
133 //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; | |
707 | 134 pMobileLightsStack->AddLight(pBLVRenderParams->vPartyPos.x, |
135 pBLVRenderParams->vPartyPos.y, | |
136 pBLVRenderParams->vPartyPos.z, | |
137 pBLVRenderParams->uPartySectorID, | |
138 v5, | |
139 floorf(pParty->flt_TorchlightColorR + 0.5f), | |
140 floorf(pParty->flt_TorchlightColorG + 0.5f), | |
141 floorf(pParty->flt_TorchlightColorB + 0.5f), | |
142 byte_4E94D0); | |
0 | 143 } |
144 PrepareBspRenderList_BLV(); | |
145 PrepareItemsRenderList_BLV(); | |
146 PrepareActorRenderList_BLV(); | |
707 | 147 |
148 //v6 = 0; | |
149 for (uint i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i) | |
0 | 150 { |
707 | 151 v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]; |
152 //v12 = 0; | |
153 v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]]; | |
154 //v9 = v8->pDecorationIDs; | |
155 | |
156 for (uint j = 0; j < v8->uNumDecorations; ++j) | |
157 //if ( v8->uNumDecorations > 0 ) | |
0 | 158 { |
707 | 159 // do |
160 PrepareDecorationsRenderList_BLV(v8->pDecorationIDs[j], v7); | |
161 // while ( v12 < v8->uNumDecorations ); | |
0 | 162 } |
707 | 163 //v6 = i + 1; |
0 | 164 } |
657 | 165 FindBillboardsLightLevels_BLV(); |
0 | 166 pGame->PrepareBloodsplats(); |
167 } | |
168 | |
169 | |
170 | |
171 //----- (004407D9) -------------------------------------------------------- | |
172 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2) | |
173 { | |
174 IndoorLocation_drawstru *v2; // ebx@1 | |
175 int v4; // ST08_4@1 | |
176 int v5; // ST04_4@1 | |
177 int v6; // ST00_4@1 | |
178 int v7; // eax@1 | |
179 int v8; // ST08_4@2 | |
180 int v9; // ST04_4@2 | |
181 int v10; // ST00_4@2 | |
182 unsigned int v11; // edi@4 | |
183 unsigned int v12; // ecx@4 | |
184 int v13; // edx@4 | |
185 signed int v14; // ecx@4 | |
186 unsigned int v15; // edx@4 | |
187 unsigned int v16; // eax@4 | |
188 double v17; // st7@5 | |
189 int v18; // eax@5 | |
190 double v19; // st7@5 | |
191 int v20; // eax@5 | |
192 double v21; // st7@5 | |
193 int v22; // eax@5 | |
194 unsigned int v23; // edx@5 | |
195 unsigned int v24; // ecx@5 | |
196 int v25; // eax@5 | |
197 int v26; // eax@5 | |
198 signed int v27; // eax@6 | |
199 int result; // eax@6 | |
200 int v29; // [sp+24h] [bp+8h]@5 | |
201 | |
202 v2 = a2; | |
203 this->field_0_timer_ = a2->field_0_timer; | |
204 this->uFlags = a2->uFlags; | |
205 this->vPartyPos.x = a2->vPosition.x; | |
206 this->vPartyPos.y = a2->vPosition.y; | |
207 this->vPartyPos.z = a2->vPosition.z; | |
208 v4 = this->vPartyPos.z; | |
209 v5 = this->vPartyPos.y; | |
210 this->sPartyRotY = a2->sRotationY; | |
211 v6 = this->vPartyPos.x; | |
212 this->sPartyRotX = a2->sRotationX; | |
213 v7 = pIndoor->GetSector(v6, v5, v4); | |
1006 | 214 this->uPartySectorID = v7; |
0 | 215 if ( !v7 ) |
216 { | |
1006 | 217 v8 = this->vPartyPos.z; |
218 this->vPartyPos.x = pParty->vPosition.x; | |
0 | 219 v9 = pParty->vPosition.y; |
1006 | 220 v10 = this->vPartyPos.x; |
221 this->vPartyPos.y = pParty->vPosition.y; | |
222 this->uPartySectorID = pIndoor->GetSector(v10, v9, v8); | |
0 | 223 } |
224 if ( pRenderer->pRenderD3D ) | |
225 { | |
1006 | 226 this->sCosineY = stru_5C6E00->Cos(this->sPartyRotY); |
227 this->sSineY = stru_5C6E00->Sin(this->sPartyRotY); | |
228 this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX); | |
229 this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX); | |
230 this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125); | |
231 this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125); | |
232 this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125); | |
233 this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125); | |
234 this->field_64 = a2->field_3C; | |
235 v11 = this->uViewportW; | |
236 v12 = this->uViewportX; | |
237 v13 = this->uViewportZ - v12; | |
238 v14 = this->uViewportZ + v12; | |
239 this->field_70 = v13 + 1; | |
240 v15 = this->uViewportY; | |
241 this->uViewportHeight = v11 - v15 + 1; | |
242 v16 = this->uViewportW; | |
243 this->uViewportCenterX = v14 >> 1; | |
244 this->uViewportCenterY = (signed int)(v16 + v15) >> 1; | |
0 | 245 } |
246 else | |
247 { | |
1006 | 248 this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY); |
249 this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY); | |
250 this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX); | |
251 this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX); | |
252 v17 = cos((double)-this->sPartyRotY * 0.0030664064); | |
253 v18 = this->sPartyRotY; | |
254 this->fCosineY = v17; | |
0 | 255 v19 = sin((double)-v18 * 0.0030664064); |
1006 | 256 v20 = this->sPartyRotX; |
257 this->fSineY = v19; | |
0 | 258 v21 = cos((double)-v20 * 0.0030664064); |
1006 | 259 v22 = this->sPartyRotX; |
260 this->fCosineNegX = v21; | |
261 this->fSineNegX = sin((double)-v22 * 0.0030664064); | |
262 v23 = this->uViewportX; | |
263 this->field_64 = a2->field_3C; | |
264 v24 = this->uViewportZ; | |
265 this->field_70 = this->uViewportZ - v23 + 1; | |
266 v25 = this->uViewportW - this->uViewportY + 1; | |
267 this->uViewportHeight = v25; | |
0 | 268 v29 = v25; |
1006 | 269 v26 = this->field_64; |
270 this->uViewportCenterX = (signed int)(v24 + v23) >> 1; | |
271 this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16); | |
0 | 272 } |
1006 | 273 v27 = (unsigned int)(signed __int64)((double)this->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329) |
0 | 274 + 0.5) << 16; |
1006 | 275 this->field_40 = v27; |
276 this->field_44 = 0x100000000i64 / v27; | |
277 this->pRenderTarget = v2->pRenderTarget; | |
278 this->uTargetWidth = v2->uTargetWidth; | |
279 this->uTargetHeight = v2->uTargetHeight; | |
280 this->uViewportX = v2->uViewportX; | |
281 this->uViewportY = v2->uViewportY; | |
282 this->uViewportZ = v2->uViewportZ; | |
283 this->uViewportW = v2->uViewportW; | |
284 this->pTargetZBuffer = v2->pTargetZ; | |
0 | 285 result = 0; |
1006 | 286 this->field_8C = 0; |
287 this->field_84 = 0; | |
288 this->uNumFacesRenderedThisFrame = 0; | |
289 this->field_88 = 0; | |
0 | 290 pBLVRenderParams->field_90 = 64; |
291 pBLVRenderParams->field_94 = 6; | |
292 return result; | |
293 } | |
294 | |
295 //----- (00440B44) -------------------------------------------------------- | |
296 void IndoorLocation::ExecDraw(bool bD3D) | |
297 { | |
298 int v2; // eax@3 | |
795 | 299 //IndoorCameraD3D_Vec4 *v3; // edx@4 |
300 //unsigned int v5; // ecx@9 | |
301 //RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4 | |
0 | 302 |
303 if (bD3D) | |
304 { | |
305 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
|
306 for (uint i = 0; i < pBspRenderer->num_faces; ++i) |
0 | 307 { |
1187 | 308 //v2 = pBspRenderer->faces[i].uNodeID; |
309 if (pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].viewing_portal_id == -1) | |
795 | 310 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, nullptr, 4, nullptr); |
1187 | 311 else |
312 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 | 313 } |
314 } | |
795 | 315 else for (uint j = 0; j < pBspRenderer->num_faces; ++j ) |
0 | 316 { |
795 | 317 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].field_C; |
318 IndoorLocation::ExecDraw_sw(pBspRenderer->faces[j].uFaceID); | |
0 | 319 } |
320 } | |
321 | |
322 //----- (00440BED) -------------------------------------------------------- | |
323 void __fastcall sub_440BED(IndoorLocation_drawstru *_this) | |
324 { | |
325 unsigned __int16 *v1; // edi@7 | |
1074 | 326 BspRenderer_stru0 *v2; // esi@8 |
0 | 327 int v3; // ecx@9 |
328 unsigned int v4; // edx@9 | |
1074 | 329 short *v5; // eax@10 |
0 | 330 signed int v6; // [sp+8h] [bp-8h]@7 |
331 int v7; // [sp+Ch] [bp-4h]@8 | |
1074 | 332 short *v8; |
0 | 333 |
334 PrepareDrawLists_BLV(_this); | |
335 if (pBLVRenderParams->uPartySectorID) | |
336 IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0); | |
337 pRenderer->DrawBillboardList_BLV(); | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
338 |
0 | 339 if ( !pRenderer->pRenderD3D ) |
340 { | |
486 | 341 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_D3D_OUTLINES) |
342 pBspRenderer->DrawFaceOutlines(); | |
343 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES) | |
0 | 344 { |
345 v1 = pBLVRenderParams->pRenderTarget; | |
1074 | 346 v7 = 0; |
347 for(int i=0; i < pBspRenderer->num_nodes; i++) | |
348 { | |
349 BspRenderer_stru0 *pNode = &pBspRenderer->nodes[i]; | |
350 v4 = pRenderer->uTargetSurfacePitch * pNode->field_C._viewport_space_y; | |
351 if ( pNode->field_C._viewport_space_y <= pNode->field_C._viewport_space_w ) | |
352 { | |
353 //v5 = (char *)&pBspRenderer->nodes[0].field_C.array_3D8[pNode->field_C._viewport_space_y + v7]; | |
1281 | 354 v5 = &pNode->field_C.viewport_right_side[pNode->field_C._viewport_space_y]; |
355 v8 = &pNode->field_C.viewport_left_side[pNode->field_C._viewport_space_y]; | |
1074 | 356 do |
357 { | |
358 v1[v4 + *v8] = 255; | |
359 ++pNode->field_C._viewport_space_y; | |
360 v1[v4 + *v5] = 255; | |
361 v4 += pRenderer->uTargetSurfacePitch; | |
362 ++v5; | |
363 ++v8; | |
364 } | |
365 while ( pNode->field_C._viewport_space_y <= pNode->field_C._viewport_space_w ); | |
366 } | |
367 } | |
0 | 368 } |
369 } | |
370 } | |
371 | |
372 | |
373 | |
374 | |
375 | |
376 //----- (00441BD4) -------------------------------------------------------- | |
377 void IndoorLocation::Draw() | |
378 { | |
186 | 379 //int v0; // eax@1 |
0 | 380 IndoorLocation_drawstru _this; // [sp+0h] [bp-4Ch]@5 |
381 int v2; // [sp+44h] [bp-8h]@5 | |
382 int v3; // [sp+48h] [bp-4h]@5 | |
383 | |
186 | 384 _this.uFlags = 0; |
385 if (viewparams->draw_sw_outlines) | |
386 _this.uFlags |= INDOOR_CAMERA_DRAW_SW_OUTLINES; | |
387 if (viewparams->draw_d3d_outlines) | |
388 _this.uFlags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; | |
389 | |
791 | 390 _this.uFlags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; |
391 _this.uFlags |= INDOOR_CAMERA_DRAW_SW_OUTLINES; | |
392 //INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES | |
393 | |
0 | 394 _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; |
395 _this.field_1C_mb_fov = 65; | |
871 | 396 _this.vPosition.x = pParty->vPosition.x - fixpoint_sub0(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity); |
397 _this.vPosition.y = pParty->vPosition.y - fixpoint_sub0(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity); | |
581 | 398 _this.vPosition.z = pParty->vPosition.z + pParty->sEyelevel; |
399 _this.sRotationX = pParty->sRotationX; | |
0 | 400 _this.sRotationY = pParty->sRotationY; |
401 _this.pRenderTarget = pRenderer->pTargetSurface; | |
692 | 402 _this.uViewportX = pViewport->uScreen_TL_X; |
403 _this.uViewportY = pViewport->uScreen_TL_Y; | |
404 _this.uViewportZ = pViewport->uScreen_BR_X; | |
405 _this.uViewportW = pViewport->uScreen_BR_Y; | |
0 | 406 _this.field_3C = pViewport->field_30; |
581 | 407 |
0 | 408 _this.uTargetWidth = 640; |
409 _this.uTargetHeight = 480; | |
410 _this.pTargetZ = pRenderer->pActiveZBuffer; | |
411 sub_440BED(&_this); | |
569 | 412 pParty->uFlags &= ~2; |
0 | 413 pGame->DrawParticles(); |
414 array_5118E8._440F07(); | |
415 } | |
416 | |
417 //----- (004C0EF2) -------------------------------------------------------- | |
1025 | 418 void BLVFace::FromODM(ODMFace *face) |
0 | 419 { |
1025 | 420 this->pFacePlane_old.vNormal.x = face->pFacePlane.vNormal.x; |
421 this->pFacePlane_old.vNormal.y = face->pFacePlane.vNormal.y; | |
422 this->pFacePlane_old.vNormal.z = face->pFacePlane.vNormal.z; | |
423 this->pFacePlane_old.dist = face->pFacePlane.dist; | |
424 this->pFacePlane.vNormal.x = (double)(face->pFacePlane.vNormal.x & 0xFFFF) * 0.000015259022 | |
425 + (double)(face->pFacePlane.vNormal.x >> 16); | |
426 this->pFacePlane.vNormal.y = (double)(face->pFacePlane.vNormal.y & 0xFFFF) * 0.000015259022 | |
427 + (double)(face->pFacePlane.vNormal.y >> 16); | |
428 this->pFacePlane.vNormal.z = (double)(face->pFacePlane.vNormal.z & 0xFFFF) * 0.000015259022 | |
429 + (double)(face->pFacePlane.vNormal.z >> 16); | |
430 this->pFacePlane.dist = (double)(face->pFacePlane.dist & 0xFFFF) * 0.000015259022 + (double)(face->pFacePlane.dist >> 16); | |
431 this->uAttributes = face->uAttributes; | |
432 this->pBounding.x1 = face->pBoundingBox.x1; | |
433 this->pBounding.y1 = face->pBoundingBox.y1; | |
434 this->pBounding.z1 = face->pBoundingBox.z1; | |
435 this->pBounding.x2 = face->pBoundingBox.x2; | |
436 this->pBounding.y2 = face->pBoundingBox.y2; | |
437 this->pBounding.z2 = face->pBoundingBox.z2; | |
438 this->zCalc1 = face->zCalc1; | |
439 this->zCalc2 = face->zCalc2; | |
440 this->zCalc3 = face->zCalc3; | |
441 this->pXInterceptDisplacements = face->pXInterceptDisplacements; | |
442 this->pYInterceptDisplacements = face->pYInterceptDisplacements; | |
443 this->pZInterceptDisplacements = face->pZInterceptDisplacements; | |
444 this->uPolygonType = (PolygonType)face->uPolygonType; | |
445 this->uNumVertices = face->uNumVertices; | |
446 this->uBitmapID = face->uTextureID; | |
447 this->pVertexIDs = face->pVertexIDs; | |
0 | 448 } |
449 | |
450 //----- (004B0A25) -------------------------------------------------------- | |
794 | 451 void IndoorLocation::ExecDraw_d3d(unsigned int uFaceID, IndoorCameraD3D_Vec4 *pVertices, unsigned int uNumVertices, RenderVertexSoft *pPortalBounding) |
0 | 452 { |
453 //unsigned int v4; // esi@1 | |
454 char *v5; // eax@4 | |
455 signed int v6; // ecx@4 | |
456 char *v7; // eax@8 | |
457 signed int v8; // ecx@8 | |
458 //BLVFace *v9; // esi@13 | |
459 //IndoorCameraD3D *v10; // edi@16 | |
460 //int v11; // ebx@17 | |
461 //Vec3_short_ *v12; // ecx@18 | |
462 //char *v13; // edx@18 | |
463 //int v14; // eax@19 | |
464 //unsigned __int8 v15; // sf@19 | |
465 //unsigned __int8 v16; // of@19 | |
466 int v17; // ebx@25 | |
467 //double v18; // st7@27 | |
468 //double v19; // st6@27 | |
469 //double v20; // st5@27 | |
470 //char v21; // dl@27 | |
471 //unsigned int v22; // eax@44 | |
472 unsigned int v23; // eax@35 | |
473 //DWORD v24; // eax@37 | |
474 //int v25; // eax@38 | |
475 //char *v26; // edi@38 | |
476 IDirect3DTexture2 *v27; // eax@42 | |
477 Texture *v28; // [sp+Ch] [bp-1Ch]@15 | |
478 //int i; // [sp+10h] [bp-18h]@38 | |
479 //LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16 | |
480 //IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16 | |
481 //IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1 | |
482 //unsigned int uFaceID_; // [sp+20h] [bp-8h]@1 | |
483 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17 | |
484 int a4a; // [sp+34h] [bp+Ch]@25 | |
485 //unsigned int a4b; // [sp+34h] [bp+Ch]@38 | |
486 | |
487 //v4 = uFaceID; | |
488 //a7 = pVertices; | |
489 //uFaceID_ = uFaceID; | |
490 if (uFaceID >= pIndoor->uNumFaces) | |
491 return; | |
492 | |
493 static RenderVertexSoft static_vertices_F7C228[64]; | |
494 static RenderVertexSoft static_vertices_F7B628[64]; | |
495 static stru154 stru_F7B60C; // idb | |
496 | |
497 //v9 = &pIndoor->pFaces[uFaceID]; | |
498 auto pFace = &pIndoor->pFaces[uFaceID]; | |
499 if (pFace->uNumVertices < 3) | |
500 return; | |
501 | |
502 | |
503 if (pFace->Invisible()) | |
504 return; | |
505 | |
506 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
507 pFace->uAttributes |= 0x80u; | |
508 | |
509 if (!pFace->GetTexture()) | |
510 return; | |
511 | |
512 v28 = pFace->GetTexture(); | |
513 | |
514 if (!pGame->pIndoorCameraD3D->IsCulled(pFace)) | |
515 { | |
516 uNumVerticesa = pFace->uNumVertices; | |
517 for (uint i = 0; i < pFace->uNumVertices; ++i) | |
518 { | |
519 static_vertices_F7C228[i].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[i]].x; | |
520 static_vertices_F7C228[i].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[i]].y; | |
521 static_vertices_F7C228[i].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[i]].z; | |
522 static_vertices_F7C228[i].u = (signed short)pFace->pVertexUIDs[i]; | |
523 static_vertices_F7C228[i].v = (signed short)pFace->pVertexVIDs[i]; | |
524 } | |
525 | |
526 if (!pVertices || | |
1187 | 527 (pGame->pStru9Instance->_498377(pPortalBounding, 4, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) ) |
0 | 528 { |
795 | 529 if (pGame->pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa, |
581 | 530 static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa ) |
0 | 531 { |
532 a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel); | |
1006 | 533 v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) |
534 | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8); | |
0 | 535 sub_4B0E07(uFaceID); |
536 pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID); | |
537 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID); | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
538 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
|
539 pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0); |
0 | 540 pGame->pLightmapBuilder->std__vector_000004_size = 0; |
541 if (stru_F8AD28.uNumLightsApplied > 0 || | |
542 pDecalBuilder->uNumDecals > 0) | |
543 { | |
544 stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x; | |
545 stru_F7B60C.polygonType = pFace->uPolygonType; | |
546 stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y; | |
547 stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z; | |
548 stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist; | |
549 } | |
550 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
551 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
|
552 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0); |
0 | 553 |
554 if (pDecalBuilder->uNumDecals > 0) | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
555 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID); |
0 | 556 |
791 | 557 if (pFace->Fluid()) |
0 | 558 { |
831 | 559 if (pFace->uBitmapID == pRenderer->hd_water_tile_id) |
560 { | |
561 v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; | |
562 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | |
563 } | |
805 | 564 else |
831 | 565 { |
566 //auto v24 = GetTickCount() / 4; | |
567 //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi; | |
568 uint eightSeconds = GetTickCount() % 8000; | |
569 float angle = (eightSeconds / 8000.0f) * 2 * 3.1415f; | |
570 | |
571 //animte lava back and forth | |
572 for (uint i = 0; i < uNumVerticesa; ++i) | |
573 //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8)); | |
574 array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle); | |
575 v23 = pFace->uBitmapID; | |
576 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | |
577 } | |
0 | 578 } |
595 | 579 else if (pFace->uAttributes & 0x4000) |
0 | 580 { |
581 | 581 v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_); |
582 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | |
0 | 583 } |
831 | 584 else |
585 { | |
586 v17 = 0xFFD0D0D0; | |
587 v23 = pFace->uBitmapID; | |
588 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | |
589 } | |
590 | |
805 | 591 if (pFace->uAttributes & FACE_DO_NOT_LIGHT) |
592 _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); | |
593 else | |
831 | 594 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0); |
595 return; | |
0 | 596 } |
597 } | |
598 } | |
599 } | |
600 | |
601 //----- (004AFF79) -------------------------------------------------------- | |
602 void IndoorLocation::ExecDraw_sw(unsigned int uFaceID) | |
603 { | |
604 unsigned int v1; // ebx@1 | |
605 BLVFace *v2; // esi@3 | |
606 unsigned int v3; // eax@3 | |
607 Texture *v4; // eax@8 | |
608 Texture *v5; // edi@8 | |
609 int v6; // eax@9 | |
610 int v7; // eax@9 | |
611 int v8; // ecx@17 | |
612 int v9; // ebx@17 | |
613 int v10; // eax@17 | |
614 int v11; // esi@17 | |
615 unsigned int v12; // eax@17 | |
616 int j; // ecx@19 | |
617 int v14; // edx@20 | |
618 int v15; // eax@20 | |
619 int v16; // edx@20 | |
620 int i; // ebx@22 | |
621 int v18; // ecx@23 | |
622 int v19; // eax@23 | |
623 int v20; // eax@23 | |
624 int v21; // eax@24 | |
625 unsigned __int8 *v22; // ecx@24 | |
626 int v23; // ebx@24 | |
627 int v24; // esi@25 | |
628 int v25; // eax@28 | |
629 unsigned __int16 *v26; // eax@28 | |
630 unsigned int v27; // eax@29 | |
631 int v28; // eax@30 | |
632 char *v29; // esi@31 | |
633 int v30; // eax@33 | |
634 int v31; // eax@33 | |
635 int v32; // eax@35 | |
636 int v33; // edx@35 | |
637 signed int v34; // ebx@35 | |
638 int v35; // eax@35 | |
639 int v36; // ebx@35 | |
640 signed int v37; // ebx@35 | |
641 signed int v38; // edi@35 | |
642 unsigned int v39; // edi@36 | |
643 int v40; // edx@40 | |
644 int v41; // ecx@40 | |
645 signed int v42; // edx@40 | |
646 int v43; // edx@42 | |
647 int v44; // eax@42 | |
648 unsigned __int16 *v45; // eax@43 | |
649 int *v46; // esi@44 | |
650 unsigned __int16 *v47; // edi@44 | |
651 unsigned int v48; // edx@44 | |
652 int v49; // ebx@44 | |
653 char v50; // cl@44 | |
654 char v51; // ch@44 | |
655 unsigned int v52; // ebx@46 | |
656 int v53; // edx@46 | |
657 unsigned int v54; // ebx@46 | |
658 int v55; // edx@46 | |
659 unsigned int v56; // ebx@47 | |
660 int v57; // edx@47 | |
661 int v58; // ebx@47 | |
662 int v59; // edx@47 | |
663 unsigned __int16 *v60; // eax@50 | |
664 int *v61; // esi@51 | |
665 unsigned __int16 *v62; // edi@51 | |
666 unsigned int v63; // edx@51 | |
667 int v64; // ebx@51 | |
668 char v65; // cl@51 | |
669 char v66; // ch@51 | |
670 unsigned int v67; // ebx@53 | |
671 int v68; // edx@53 | |
672 unsigned int v69; // ebx@53 | |
673 int v70; // edx@53 | |
674 unsigned int v71; // ebx@54 | |
675 int v72; // edx@54 | |
676 int v73; // ebx@54 | |
677 int v74; // edx@54 | |
678 unsigned __int16 *v75; // eax@58 | |
679 int *v76; // esi@59 | |
680 int v77; // edi@59 | |
681 unsigned int v78; // edx@59 | |
682 int v79; // ebx@59 | |
683 char v80; // cl@59 | |
684 char v81; // ch@59 | |
685 int v82; // ebx@61 | |
686 int v83; // edx@61 | |
687 unsigned int v84; // ebx@62 | |
688 int v85; // edx@62 | |
689 unsigned __int16 *v86; // eax@65 | |
690 int *v87; // esi@66 | |
691 int v88; // edi@66 | |
692 unsigned int v89; // edx@66 | |
693 int v90; // ebx@66 | |
694 char v91; // cl@66 | |
695 char v92; // ch@66 | |
696 int v93; // ebx@68 | |
697 int v94; // edx@68 | |
698 unsigned __int16 v95; // bx@69 | |
699 int v96; // edx@69 | |
700 unsigned __int8 *v97; // [sp+Ch] [bp-9Ch]@24 | |
701 unsigned __int8 *v98; // [sp+10h] [bp-98h]@24 | |
702 unsigned __int8 *v99; // [sp+14h] [bp-94h]@24 | |
703 unsigned __int8 *v100; // [sp+18h] [bp-90h]@24 | |
704 int v101; // [sp+1Ch] [bp-8Ch]@40 | |
705 int v102; // [sp+20h] [bp-88h]@31 | |
706 BLVFace *v103; // [sp+24h] [bp-84h]@3 | |
707 unsigned __int16 *v104; // [sp+28h] [bp-80h]@24 | |
708 int v105; // [sp+2Ch] [bp-7Ch]@30 | |
709 int v106; // [sp+30h] [bp-78h]@24 | |
710 int v107; // [sp+34h] [bp-74h]@9 | |
711 Texture *v108; // [sp+38h] [bp-70h]@8 | |
712 int v109; // [sp+3Ch] [bp-6Ch]@9 | |
713 unsigned int v110; // [sp+40h] [bp-68h]@24 | |
714 unsigned int v111; // [sp+44h] [bp-64h]@1 | |
715 int *k; // [sp+48h] [bp-60h]@31 | |
716 int v113; // [sp+4Ch] [bp-5Ch]@35 | |
717 int v114; // [sp+50h] [bp-58h]@35 | |
718 int v115; // [sp+54h] [bp-54h]@42 | |
719 unsigned __int8 *v116; // [sp+58h] [bp-50h]@35 | |
720 int v117; // [sp+5Ch] [bp-4Ch]@33 | |
721 int a1; // [sp+60h] [bp-48h]@27 | |
722 int v119; // [sp+64h] [bp-44h]@17 | |
723 int v120; // [sp+68h] [bp-40h]@23 | |
724 unsigned int v121; // [sp+6Ch] [bp-3Ch]@40 | |
725 unsigned int v122; // [sp+70h] [bp-38h]@35 | |
726 int v123; // [sp+74h] [bp-34h]@30 | |
727 int v124; // [sp+78h] [bp-30h]@17 | |
728 int v125; // [sp+7Ch] [bp-2Ch]@35 | |
729 unsigned int v126; // [sp+80h] [bp-28h]@9 | |
730 int v127; // [sp+84h] [bp-24h]@17 | |
731 int v128; // [sp+88h] [bp-20h]@9 | |
732 int *pZPixel; // [sp+8Ch] [bp-1Ch]@28 | |
733 int a2; // [sp+90h] [bp-18h]@16 | |
734 unsigned int v131; // [sp+94h] [bp-14h]@17 | |
735 unsigned __int16 *pColorPixel; // [sp+98h] [bp-10h]@28 | |
736 int v133; // [sp+9Ch] [bp-Ch]@17 | |
737 int v134; // [sp+A0h] [bp-8h]@17 | |
738 int v135; // [sp+A4h] [bp-4h]@24 | |
739 | |
740 v1 = uFaceID; | |
741 v111 = pRenderer->uTargetSurfacePitch; | |
742 if ( (uFaceID & 0x80000000u) == 0 ) | |
743 { | |
744 if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) | |
745 { | |
746 v2 = &pIndoor->pFaces[uFaceID]; | |
747 v103 = v2; | |
748 v3 = v2->uAttributes; | |
749 if ( !(BYTE1(v3) & 0x20) ) | |
750 { | |
751 if ( v3 & 0x400000 ) | |
752 { | |
753 sub_4ADD1D(uFaceID); | |
754 return; | |
755 } | |
756 if ( !(v3 & 0x10) || (sub_4AD504(uFaceID), pRenderer->pRenderD3D) ) | |
757 { | |
758 v4 = v2->GetTexture(); | |
759 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
760 v5 = v4; | |
761 v108 = v4; | |
762 if ( v4 ) | |
763 { | |
764 v6 = v4->palette_id2; | |
765 LOBYTE(v2->uAttributes) |= 0x80u; | |
766 v109 = v6; | |
767 sub_4AE5F1(v1); | |
768 v126 = stru_F8AD28.pDeltaUV[0]; | |
769 v128 = stru_F8AD28.pDeltaUV[1]; | |
770 v107 = bUseLoResSprites; | |
771 v7 = sub_423B5D(v1); | |
772 if ( v7 ) | |
773 { | |
774 if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | |
775 { | |
776 if ( v2->uPolygonType == 1 ) | |
777 { | |
778 for ( i = 0; i < stru_F8AD28.uNumLightsApplied; stru_F8AD28._blv_lights_ys[v18] = v20 ) | |
779 { | |
780 v18 = i; | |
781 v120 = stru_F8AD28._blv_lights_xs[i]; | |
782 v134 = (unsigned __int64)(v120 * (signed __int64)-stru_F8AD28.plane_4.vNormal.y) >> 16; | |
783 v133 = stru_F8AD28.plane_4.vNormal.x; | |
784 v120 = stru_F8AD28._blv_lights_ys[i]; | |
785 v133 = (unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16; | |
786 v19 = v128; | |
787 stru_F8AD28._blv_lights_xs[i] = v126 | |
788 + v134 | |
789 + ((unsigned __int64)(v120 | |
790 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16); | |
791 v20 = v19 - stru_F8AD28._blv_lights_zs[i++]; | |
792 } | |
793 } | |
794 else | |
795 { | |
796 if ( v2->uPolygonType != 3 ) | |
797 { | |
798 if ( v2->uPolygonType == 4 ) | |
799 { | |
800 LABEL_16: | |
801 a2 = 0; | |
802 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
803 { | |
804 do | |
805 { | |
806 v8 = a2; | |
807 v9 = stru_F8AD28._blv_lights_xs[a2]; | |
808 v131 = stru_F8AD28._blv_lights_ys[a2]; | |
809 v10 = stru_F8AD28._blv_lights_zs[a2]; | |
810 v11 = (signed int)(v10 * stru_F8AD28.plane_4.vNormal.z | |
811 + stru_F8AD28.plane_4.dist | |
812 + v9 * stru_F8AD28.plane_4.vNormal.x | |
813 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16; | |
814 v119 = v9 | |
815 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
816 * (signed __int64)((signed int)(v10 * stru_F8AD28.plane_4.vNormal.z | |
817 + stru_F8AD28.plane_4.dist | |
818 + v9 * stru_F8AD28.plane_4.vNormal.x | |
819 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16)) >> 16); | |
820 v131 -= (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)v11) >> 16; | |
821 v127 = v10 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)v11) >> 16); | |
822 stru_F8AD28._blv_lights_xs[a2] = ((unsigned __int64)(v119 | |
823 * (signed __int64)stru_F8AD28.vec_14.x) >> 16) | |
824 + ((unsigned __int64)((signed int)v131 | |
825 * (signed __int64)stru_F8AD28.vec_14.y) >> 16); | |
826 v124 = (unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_20.x) >> 16; | |
827 v134 = (unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16; | |
828 v133 = (unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16; | |
829 v12 = v126; | |
830 stru_F8AD28._blv_lights_ys[v8] = v124 | |
831 + ((unsigned __int64)((signed int)v131 | |
832 * (signed __int64)stru_F8AD28.vec_20.y) >> 16) | |
833 + ((unsigned __int64)(v127 | |
834 * (signed __int64)stru_F8AD28.vec_20.z) >> 16); | |
835 stru_F8AD28._blv_lights_xs[v8] += v12; | |
836 stru_F8AD28._blv_lights_ys[v8] += v128; | |
837 ++a2; | |
838 } | |
839 while ( a2 < stru_F8AD28.uNumLightsApplied ); | |
840 v2 = v103; | |
841 } | |
842 goto LABEL_24; | |
843 } | |
844 if ( v2->uPolygonType != 5 ) | |
845 { | |
846 if ( v2->uPolygonType != 6 ) | |
847 goto LABEL_24; | |
848 goto LABEL_16; | |
849 } | |
850 } | |
851 for ( j = 0; j < stru_F8AD28.uNumLightsApplied; *(int *)v15 = v16 ) | |
852 { | |
853 v14 = v128; | |
854 stru_F8AD28._blv_lights_xs[j] += v126; | |
855 v15 = 4 * j + 16297672; | |
856 v16 = v14 - stru_F8AD28._blv_lights_ys[j++]; | |
857 } | |
858 } | |
859 LABEL_24: | |
860 v135 = 1; | |
861 pGame->_44ED0A(v2, &v135, 31); | |
862 v104 = sr_sub_47C24C_get_palette(v2, v109, 0, 1); | |
863 v134 = stru_F8AD28.field_44; | |
864 v106 = stru_F8AD28.field_48; | |
865 v21 = stru_F8A590._viewport_space_y; | |
866 a2 = stru_F8A590._viewport_space_y; | |
867 v110 = v111 * stru_F8A590._viewport_space_y; | |
710 | 868 v97 = v5->pLevelOfDetail0_prolly_alpha_mask; |
0 | 869 v98 = v5->pLevelOfDetail1; |
870 v99 = v5->pLevelOfDetail2; | |
871 v22 = v5->pLevelOfDetail3; | |
872 v23 = 640 * stru_F8A590._viewport_space_y; | |
873 v119 = 640 * stru_F8A590._viewport_space_y; | |
874 v100 = v22; | |
875 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
876 { | |
877 v24 = 2 * stru_F8A590._viewport_space_y; | |
878 v120 = 2 * stru_F8A590._viewport_space_y; | |
879 while ( 1 ) | |
880 { | |
1281 | 881 a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); |
0 | 882 sub_4AE313(a1, v21, &stru_F81018.field_0); |
883 if ( LOBYTE(viewparams->field_20) ) | |
884 { | |
885 v27 = v111 * (v24 - pBLVRenderParams->uViewportY); | |
886 pZPixel = &pBLVRenderParams->pTargetZBuffer[2 | |
1281 | 887 * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) |
0 | 888 + 320 * (v24 - pBLVRenderParams->uViewportY)) |
889 - pBLVRenderParams->uViewportX]; | |
890 pColorPixel = &pBLVRenderParams->pRenderTarget[v27 | |
1281 | 891 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) |
0 | 892 - pBLVRenderParams->uViewportX]; |
893 v26 = &pBLVRenderParams->pRenderTarget[v27 | |
1281 | 894 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24) |
0 | 895 - pBLVRenderParams->uViewportX]; |
896 v23 = v119; | |
897 } | |
898 else | |
899 { | |
1281 | 900 v25 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); |
0 | 901 pZPixel = &pBLVRenderParams->pTargetZBuffer[v25 + v23]; |
902 pColorPixel = &pBLVRenderParams->pRenderTarget[v25 + v110]; | |
1281 | 903 v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24)]; |
0 | 904 } |
905 v131 = (unsigned int)v26; | |
906 HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0); | |
907 LOWORD(v28) = 0; | |
908 v105 = stru_F8AD28.field_0 | v28; | |
909 v123 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
910 if ( (unsigned int)pColorPixel < v131 ) | |
911 { | |
912 v102 = v107 + v106; | |
913 v29 = (char *)&stru_F81018.field_34.field_8; | |
914 a1 += v134; | |
915 for ( k = &stru_F81018.field_34.field_8; ; v29 = (char *)k ) | |
916 { | |
917 sub_4AE313(a1, a2, (stru337_stru0 *)(v29 - 8)); | |
918 v30 = *((int *)v29 - 2); | |
919 LOWORD(v30) = 0; | |
920 v117 = v105; | |
921 v31 = stru_F8AD28.field_0 | v30; | |
922 if ( v105 <= (unsigned int)v31 ) | |
923 v117 = v31; | |
924 v105 = v31; | |
925 v32 = *((int *)v29 - 14); | |
926 v122 = *((int *)v29 - 14) >> v107; | |
927 v33 = *((int *)v29 - 13); | |
928 v125 = *((int *)v29 - 13) >> v107; | |
929 v34 = *((int *)v29 - 1) - v32; | |
930 v113 = (*(int *)v29 - v33) >> v102; | |
931 v35 = *((int *)v29 - 11); | |
932 v114 = v34 >> v102; | |
933 v116 = (&v97)[4 * v35]; | |
934 v36 = v35 + 16 - v5->uWidthLn2; | |
935 v133 = v35 + 16; | |
936 v127 = v35 + v36; | |
937 v37 = v5->uWidthMinus1 >> v35; | |
938 v38 = v5->uHeightMinus1 >> v35 << (v35 + 16); | |
939 v128 = v37; | |
940 v126 = v38; | |
941 v39 = (unsigned int)(LOBYTE(viewparams->field_20) ? &pColorPixel[2 * v134] : &pColorPixel[v134]); | |
942 if ( v39 > v131 ) | |
943 v39 = v131; | |
944 v40 = *((short *)v29 + 1); | |
945 v41 = *((short *)v29 - 1); | |
946 v121 = v39; | |
947 v42 = sub_4AE491(v41, v40); | |
948 v101 = v42; | |
949 v124 = (signed int)(v39 - (int)pColorPixel) >> 1; | |
950 if ( v123 >> 16 == v42 >> 16 || v135 & 2 ) | |
951 { | |
952 v123 = (int)sr_sub_47C24C_get_palette(v103, v109, v123 >> 16, 1); | |
953 if ( LOBYTE(viewparams->field_20) ) | |
954 { | |
955 v86 = pColorPixel; | |
956 if ( (unsigned int)pColorPixel < v121 ) | |
957 { | |
958 v87 = pZPixel; | |
959 v88 = v123; | |
960 v89 = v122; | |
961 v90 = v125; | |
962 v91 = v133; | |
963 v92 = v127; | |
964 if ( v124 & 2 ) | |
965 { | |
966 *pZPixel = v117; | |
967 v87 -= 2; | |
968 v86 = pColorPixel + 2; | |
969 goto LABEL_69; | |
970 } | |
971 do | |
972 { | |
973 v86 += 4; | |
974 v93 = *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92)); | |
975 v94 = v117; | |
976 LOWORD(v93) = *(short *)(v88 + 2 * v93); | |
977 *v87 = v117; | |
978 v87[1] = v94; | |
979 v87[640] = v94; | |
980 v87[641] = v94; | |
981 *(v86 - 4) = v93; | |
982 *(v86 - 3) = v93; | |
983 v86[636] = v93; | |
984 v86[637] = v93; | |
985 v87[2] = v94; | |
986 v87[3] = v94; | |
987 v87[642] = v94; | |
988 v87[643] = v94; | |
989 v122 += v114; | |
990 v125 += v113; | |
991 v89 = v122; | |
992 v90 = v125; | |
993 LABEL_69: | |
994 v87 += 4; | |
995 v95 = *(short *)(v88 + 2 * *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92))); | |
996 v96 = v114; | |
997 *(v86 - 2) = v95; | |
998 *(v86 - 1) = v95; | |
999 v86[638] = v95; | |
1000 v86[639] = v95; | |
1001 v122 += v96; | |
1002 v125 += v113; | |
1003 v89 = v122; | |
1004 v90 = v125; | |
1005 } | |
1006 while ( (unsigned int)v86 < v121 ); | |
1007 pColorPixel = v86; | |
1008 pZPixel = v87; | |
1009 } | |
1010 } | |
1011 else | |
1012 { | |
1013 v75 = pColorPixel; | |
1014 if ( (unsigned int)pColorPixel < v121 ) | |
1015 { | |
1016 v76 = pZPixel; | |
1017 v77 = v123; | |
1018 v78 = v122; | |
1019 v79 = v125; | |
1020 v80 = v133; | |
1021 v81 = v127; | |
1022 if ( v124 & 1 ) | |
1023 { | |
1024 *pZPixel = v117; | |
1025 --v76; | |
1026 v75 = pColorPixel + 1; | |
1027 goto LABEL_62; | |
1028 } | |
1029 do | |
1030 { | |
1031 v75 += 2; | |
1032 v82 = *(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); | |
1033 v83 = v117; | |
1034 LOWORD(v82) = *(short *)(v77 + 2 * v82); | |
1035 *v76 = v117; | |
1036 *(v75 - 2) = v82; | |
1037 v76[1] = v83; | |
1038 v122 += v114; | |
1039 v125 += v113; | |
1040 v78 = v122; | |
1041 v79 = v125; | |
1042 LABEL_62: | |
1043 v84 = (unsigned int)(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); | |
1044 v76 += 2; | |
1045 v85 = v114; | |
1046 *(v75 - 1) = *(short *)(v77 + 2 * *(char *)v84); | |
1047 v122 += v85; | |
1048 v125 += v113; | |
1049 v78 = v122; | |
1050 v79 = v125; | |
1051 } | |
1052 while ( (unsigned int)v75 < v121 ); | |
1053 pColorPixel = v75; | |
1054 pZPixel = v76; | |
1055 } | |
1056 } | |
1057 } | |
1058 else | |
1059 { | |
1060 v43 = (v42 - v123) >> v106; | |
1061 v44 = v123 - v43; | |
1062 v123 = v43; | |
1063 v115 = v44; | |
1064 if ( LOBYTE(viewparams->field_20) ) | |
1065 { | |
1066 v60 = pColorPixel; | |
1067 if ( (unsigned int)pColorPixel < v121 ) | |
1068 { | |
1069 v61 = pZPixel; | |
1070 v62 = v104; | |
1071 v63 = v122; | |
1072 v64 = v125; | |
1073 v65 = v133; | |
1074 v66 = v127; | |
1075 if ( v124 & 2 ) | |
1076 { | |
1077 *pZPixel = v117; | |
1078 v61 += 2; | |
1079 v60 = pColorPixel + 2; | |
1080 goto LABEL_54; | |
1081 } | |
1082 do | |
1083 { | |
1084 v67 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); | |
1085 v68 = v123 + v115; | |
1086 v60 += 4; | |
1087 v115 = v68; | |
1088 v69 = ((v68 & 0xFFFF0000u) >> 8) + v116[v67]; | |
1089 v70 = v117; | |
1090 LOWORD(v69) = v62[v69]; | |
1091 *v61 = v117; | |
1092 v61[1] = v70; | |
1093 v61[640] = v70; | |
1094 v61[641] = v70; | |
1095 *(v60 - 4) = v69; | |
1096 *(v60 - 3) = v69; | |
1097 v60[636] = v69; | |
1098 v60[637] = v69; | |
1099 v61[2] = v70; | |
1100 v61[3] = v70; | |
1101 v61[642] = v70; | |
1102 v61[643] = v70; | |
1103 v122 += v114; | |
1104 v125 += v113; | |
1105 v63 = v122; | |
1106 v64 = v125; | |
1107 v61 += 4; | |
1108 LABEL_54: | |
1109 v71 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); | |
1110 v72 = v123 + v115; | |
1111 v73 = v116[v71]; | |
1112 v115 = v72; | |
1113 LOWORD(v73) = v62[((v72 & 0xFFFF0000u) >> 8) + v73]; | |
1114 v74 = v114; | |
1115 *(v60 - 2) = v73; | |
1116 *(v60 - 1) = v73; | |
1117 v60[638] = v73; | |
1118 v60[639] = v73; | |
1119 v122 += v74; | |
1120 v125 += v113; | |
1121 v63 = v122; | |
1122 v64 = v125; | |
1123 } | |
1124 while ( (unsigned int)v60 < v121 ); | |
1125 pColorPixel = v60; | |
1126 pZPixel = v61; | |
1127 } | |
1128 } | |
1129 else | |
1130 { | |
1131 v45 = pColorPixel; | |
1132 if ( (unsigned int)pColorPixel < v121 ) | |
1133 { | |
1134 v46 = pZPixel; | |
1135 v47 = v104; | |
1136 v48 = v122; | |
1137 v49 = v125; | |
1138 v50 = v133; | |
1139 v51 = v127; | |
1140 if ( v124 & 1 ) | |
1141 { | |
1142 *pZPixel = v117; | |
1143 ++v46; | |
1144 v45 = pColorPixel + 1; | |
1145 goto LABEL_47; | |
1146 } | |
1147 do | |
1148 { | |
1149 v52 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); | |
1150 v53 = v123 + v115; | |
1151 v45 += 2; | |
1152 v115 = v53; | |
1153 v54 = ((v53 & 0xFFFF0000u) >> 8) + v116[v52]; | |
1154 v55 = v117; | |
1155 LOWORD(v54) = v47[v54]; | |
1156 *v46 = v117; | |
1157 *(v45 - 2) = v54; | |
1158 v46[1] = v55; | |
1159 v122 += v114; | |
1160 v125 += v113; | |
1161 v48 = v122; | |
1162 v49 = v125; | |
1163 v46 += 2; | |
1164 LABEL_47: | |
1165 v56 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); | |
1166 v57 = v123 + v115; | |
1167 v58 = v116[v56]; | |
1168 v115 = v57; | |
1169 LOWORD(v58) = v47[((v57 & 0xFFFF0000u) >> 8) + v58]; | |
1170 v59 = v114; | |
1171 *(v45 - 1) = v58; | |
1172 v122 += v59; | |
1173 v125 += v113; | |
1174 v48 = v122; | |
1175 v49 = v125; | |
1176 } | |
1177 while ( (unsigned int)v45 < v121 ); | |
1178 pColorPixel = v45; | |
1179 pZPixel = v46; | |
1180 } | |
1181 } | |
1182 } | |
1183 k += 13; | |
1184 v5 = v108; | |
1185 v123 = v101; | |
1186 a1 += v134; | |
1187 if ( (unsigned int)pColorPixel >= v131 ) | |
1188 break; | |
1189 } | |
1190 v23 = v119; | |
1191 v24 = v120; | |
1192 } | |
1193 ++a2; | |
1194 v110 += v111; | |
1195 v23 += 640; | |
1196 v24 += 2; | |
1197 v120 = v24; | |
1198 v119 = v23; | |
1199 if ( a2 > stru_F8A590._viewport_space_w ) | |
1200 break; | |
1201 v21 = a2; | |
1202 } | |
1203 } | |
1204 return; | |
1205 } | |
1206 } | |
1207 } | |
1208 } | |
1209 } | |
1210 } | |
1211 } | |
1212 } | |
1213 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
1214 | |
1215 | |
1216 | |
1217 //----- (004B0E07) -------------------------------------------------------- | |
1218 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) | |
1219 { | |
1220 BLVFace *v1; // edi@1 | |
1221 BLVFaceExtra *v2; // ecx@1 | |
1222 Texture *v3; // esi@1 | |
1223 unsigned int v4; // eax@1 | |
1224 unsigned int v5; // ecx@1 | |
1225 unsigned int result; // eax@1 | |
1226 unsigned int v7; // ecx@5 | |
1227 | |
1228 v1 = &pIndoor->pFaces[uFaceID]; | |
1229 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
945 | 1230 v3 = pBitmaps_LOD->GetTexture(v1->uBitmapID); |
0 | 1231 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; |
1232 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
1233 v4 = GetTickCount(); | |
1234 v5 = v1->uAttributes; | |
1235 result = v4 >> 3; | |
1236 if ( v5 & 4 ) | |
1237 { | |
1238 stru_F8AD28.pDeltaUV[1] -= result & v3->uHeightMinus1; | |
1239 } | |
1240 else | |
1241 { | |
1242 if ( v5 & 0x20 ) | |
1243 stru_F8AD28.pDeltaUV[1] += result & v3->uHeightMinus1; | |
1244 } | |
1245 v7 = v1->uAttributes; | |
1246 if ( BYTE1(v7) & 8 ) | |
1247 { | |
1248 stru_F8AD28.pDeltaUV[0] -= result & v3->uWidthMinus1; | |
1249 } | |
1250 else | |
1251 { | |
1252 if ( v7 & 0x40 ) | |
1253 stru_F8AD28.pDeltaUV[0] += result & v3->uWidthMinus1; | |
1254 } | |
1255 return result; | |
1256 } | |
1257 | |
1258 //----- (004B0EA8) -------------------------------------------------------- | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1259 void BspRenderer::AddFaceToRenderList_d3d(unsigned int node_id, unsigned int uFaceID) |
0 | 1260 { |
1261 //unsigned int v3; // edx@1 | |
1262 //stru170 *v4; // ebx@1 | |
1263 //BLVFace *v5; // eax@1 | |
1264 //int v6; // ecx@2 | |
1265 unsigned __int16 v7; // ax@11 | |
1266 Vec3_short_ *v8; // esi@15 | |
1267 int v9; // edx@15 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1268 //signed int v10; // eax@18 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1269 //signed int v11; // edi@19 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1270 //signed int v12; // ecx@19 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1271 //signed int v13; // esi@19 |
0 | 1272 signed int v14; // edx@20 |
1273 int v15; // edx@24 | |
1274 //int v16; // esi@29 | |
1275 //BLVFace *v17; // edi@34 | |
1276 unsigned __int16 v18; // ax@34 | |
1277 char *v19; // eax@38 | |
1278 signed int v20; // ecx@38 | |
1279 char *v21; // eax@42 | |
1280 signed int v22; // ecx@42 | |
1281 //signed int v23; // edx@45 | |
1282 //char *v24; // ecx@46 | |
1283 //int v25; // eax@47 | |
1284 //Vec3_short_ *v26; // eax@47 | |
1285 //double v27; // st7@47 | |
1286 //signed int v28; // ST28_4@47 | |
1287 char v29; // al@48 | |
795 | 1288 //signed int v30; // eax@51 |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1289 //int v31; // eax@52 |
0 | 1290 //unsigned int v32; // eax@55 |
1291 //__int16 v33; // cx@56 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1292 //signed int v34; // [sp+Ch] [bp-14h]@18 |
0 | 1293 //int a0; // [sp+14h] [bp-Ch]@2 |
1294 //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
|
1295 //signed int v37; // [sp+18h] [bp-8h]@19 |
0 | 1296 //stru10 *v38; // [sp+18h] [bp-8h]@36 |
1297 //BLVFace *v39; // [sp+1Ch] [bp-4h]@1 | |
1298 | |
1299 //v3 = uFaceID; | |
1300 //v4 = this; | |
1301 //v5 = &pIndoor->pFaces[uFaceID]; | |
795 | 1302 nodes[num_nodes].viewing_portal_id = -1; |
0 | 1303 //v39 = &pIndoor->pFaces[uFaceID]; |
1304 | |
1305 auto pFace = &pIndoor->pFaces[uFaceID]; | |
830 | 1306 auto p = &nodes[node_id]; |
1301 | 1307 for (int i = 0; i < pIndoor->uNumFaces; ++i) |
1308 { | |
1309 if (pIndoor->pFaces[i].Portal()) | |
1310 { | |
1311 if ( pIndoor->pFaces[i].uSectorID == nodes[0].uSectorID ) | |
1312 { | |
1313 Log::Warning(L"portal id = %u", i); | |
1314 //pIndoor->pFaces[i].uBitmapID = 9; | |
1315 } | |
1316 } | |
1317 } | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1318 if (!pFace->Portal()) |
0 | 1319 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1320 if (num_faces < 1000) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1321 { |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1322 faces[num_faces].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1323 faces[num_faces++].uNodeID = node_id; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1324 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1325 return; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1326 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1327 |
0 | 1328 if (p->uFaceID == uFaceID) |
1329 return; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1330 if (!node_id && |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1331 pBLVRenderParams->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane |
0 | 1332 pBLVRenderParams->vPartyPos.x <= pFace->pBounding.x2 + 16 && |
1333 pBLVRenderParams->vPartyPos.y >= pFace->pBounding.y1 - 16 && | |
1334 pBLVRenderParams->vPartyPos.y <= pFace->pBounding.y2 + 16 && | |
1335 pBLVRenderParams->vPartyPos.z >= pFace->pBounding.z1 - 16 && | |
1336 pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 ) | |
1337 { | |
1338 if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x | |
830 | 1339 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y |
1340 + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane | |
0 | 1341 { |
1342 v7 = pFace->uSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1343 if ( nodes[0].uSectorID == v7 ) // draw back sector |
0 | 1344 v7 = pFace->uBackSectorID; |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1345 nodes[num_nodes].uSectorID = v7; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1346 nodes[num_nodes].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1347 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1348 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1349 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1350 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; |
1295 | 1351 nodes[num_nodes].field_C.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, |
1234 | 1352 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); |
830 | 1353 AddBspNodeToRenderList(++num_nodes - 1); |
0 | 1354 return; |
1355 } | |
1356 //v5 = v39; | |
1357 //v6 = a0; | |
1358 } | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1359 |
0 | 1360 v8 = &pIndoor->pVertices[pFace->pVertexIDs[0]]; |
1361 v9 = pFace->pFacePlane_old.vNormal.x * (v8->x - pBLVRenderParams->vPartyPos.x) | |
1362 + pFace->pFacePlane_old.vNormal.y * (v8->y - pBLVRenderParams->vPartyPos.y) | |
1363 + pFace->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); | |
1364 if (p->uSectorID != pFace->uSectorID) | |
1365 v9 = -v9; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1366 if (v9 >= 0) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1367 return; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1368 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1369 auto num_vertices = sub_423B5D(uFaceID); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1370 if (num_vertices < 2) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1371 return; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1372 |
1078 | 1373 auto face_min_screenspace_x = stru_50B700._screen_space_x[0], |
1374 face_max_screenspace_x = stru_50B700._screen_space_x[0]; | |
1375 auto face_min_screenspace_y = stru_50B700._screen_space_y[0], | |
1376 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
|
1377 for (uint i = 1; i < num_vertices; ++i) |
0 | 1378 { |
1078 | 1379 if (face_min_screenspace_x > stru_50B700._screen_space_x[i]) |
1380 face_min_screenspace_x = stru_50B700._screen_space_x[i]; | |
1381 if (face_max_screenspace_x < stru_50B700._screen_space_x[i]) | |
1382 face_max_screenspace_x = stru_50B700._screen_space_x[i]; | |
1383 | |
1384 if (face_min_screenspace_y > stru_50B700._screen_space_y[i]) | |
1385 face_min_screenspace_y = stru_50B700._screen_space_y[i]; | |
1386 if (face_max_screenspace_y < stru_50B700._screen_space_y[i]) | |
1387 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
|
1388 } |
1132 | 1389 //_screen_space_x = 719, 568, 493 |
1390 //savegame: qw , 0Bh and 0x1D4h | |
1391 //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
|
1392 if (face_max_screenspace_x >= p->uViewportX && |
1230 | 1393 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
|
1394 face_max_screenspace_y >= p->uViewportY && |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1395 face_min_screenspace_y <= p->uViewportW && |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1396 sub_424829(num_vertices, &nodes[num_nodes].field_C, &p->field_C, uFaceID)) |
0 | 1397 { |
1398 //v17 = v39; | |
1399 v18 = pFace->uSectorID; | |
1400 if (p->uSectorID == v18 ) | |
1401 v18 = pFace->uBackSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1402 nodes[num_nodes].uSectorID = v18; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1403 nodes[num_nodes].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1404 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1405 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1406 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1407 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; |
0 | 1408 //v38 = pGame->pStru10Instance; |
1409 //a0a = pGame->pIndoorCameraD3D; | |
795 | 1410 v29 = false; |
1411 if (p->viewing_portal_id == -1) | |
0 | 1412 { |
795 | 1413 v29 = pGame->pStru10Instance->CalcPortalShape(pFace, nodes[num_nodes].std__vector_0007AC, nodes[num_nodes].pPortalBounding); |
0 | 1414 } |
1415 else | |
1416 { | |
618
5cfb5dadf330
Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents:
595
diff
changeset
|
1417 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
|
1418 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F79E08[64]; |
0 | 1419 |
1420 for (uint k = 0; k < pFace->uNumVertices; ++k) | |
1421 { | |
795 | 1422 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[k]].x; |
1423 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[k]].y; | |
1424 static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[k]].z; | |
0 | 1425 } |
795 | 1426 |
1427 | |
1428 unsigned int a2 = pFace->uNumVertices; | |
1429 pGame->pIndoorCameraD3D->CalcPortalShape(static_subAddFaceToRenderList_d3d_stru_F7AA08, | |
1430 &a2, | |
1431 static_subAddFaceToRenderList_d3d_stru_F79E08, | |
1432 p->std__vector_0007AC, 4, 0, 0); | |
1433 | |
1434 v29 = pGame->pStru10Instance->_49C5DA(pFace, static_subAddFaceToRenderList_d3d_stru_F79E08, &a2, | |
1435 nodes[num_nodes].std__vector_0007AC, | |
1436 nodes[num_nodes].pPortalBounding); | |
0 | 1437 } |
1132 | 1438 if ( 1 ) |
0 | 1439 { |
795 | 1440 assert(num_nodes < 150); |
1441 | |
1442 nodes[num_nodes].viewing_portal_id = uFaceID; | |
1443 AddBspNodeToRenderList(++num_nodes - 1); | |
0 | 1444 } |
486 | 1445 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES) |
0 | 1446 pGame->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF); |
791 | 1447 //pGame->pIndoorCameraD3D->DebugDrawPortal(pFace); |
0 | 1448 } |
1449 } | |
1450 | |
1451 | |
1452 //----- (004AFB86) -------------------------------------------------------- | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1453 void BspRenderer::AddFaceToRenderList_sw(unsigned int node_id, unsigned int uFaceID) |
0 | 1454 { |
1455 BspRenderer *v3; // ebx@1 | |
1456 BLVFace *v4; // eax@1 | |
1457 char *v5; // ecx@2 | |
1458 unsigned __int16 v6; // ax@11 | |
1459 int v7; // ecx@13 | |
1460 Vec3_short_ *v8; // esi@16 | |
1461 int v9; // edx@16 | |
1462 signed int v10; // eax@19 | |
1463 signed int v11; // edi@20 | |
1464 signed int v12; // ecx@20 | |
1465 signed int v13; // esi@20 | |
1466 int v14; // edx@21 | |
1467 int v15; // edx@25 | |
1468 unsigned __int16 v16; // ax@35 | |
1469 signed int v17; // eax@37 | |
1470 int v18; // eax@38 | |
1471 signed int v19; // [sp+Ch] [bp-14h]@19 | |
1472 char *v20; // [sp+14h] [bp-Ch]@2 | |
1473 BLVFace *v21; // [sp+18h] [bp-8h]@1 | |
1474 signed int v22; // [sp+1Ch] [bp-4h]@20 | |
1475 signed int v23; // [sp+28h] [bp+8h]@20 | |
1476 | |
1477 v3 = this; | |
1478 v4 = &pIndoor->pFaces[uFaceID]; | |
1479 v21 = v4; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1480 if (v4->Portal()) |
0 | 1481 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1482 v5 = (char *)this + 2252 * node_id; |
0 | 1483 v20 = v5; |
1484 if ( uFaceID == *((short *)v5 + 2982) ) | |
1485 return; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1486 if (!node_id |
0 | 1487 && pBLVRenderParams->vPartyPos.x >= v4->pBounding.x1 - 16 |
1488 && pBLVRenderParams->vPartyPos.x <= v4->pBounding.x2 + 16 | |
1489 && pBLVRenderParams->vPartyPos.y >= v4->pBounding.y1 - 16 | |
1490 && pBLVRenderParams->vPartyPos.y <= v4->pBounding.y2 + 16 | |
1491 && pBLVRenderParams->vPartyPos.z >= v4->pBounding.z1 - 16 | |
1492 && pBLVRenderParams->vPartyPos.z <= v4->pBounding.z2 + 16 ) | |
1493 { | |
1494 if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x | |
1495 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y | |
1496 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) | |
1497 { | |
1498 v6 = v21->uSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1499 if ( v3->nodes[0].uSectorID == v6 ) |
0 | 1500 v6 = v21->uBackSectorID; |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1501 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
|
1502 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
|
1503 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
|
1504 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
|
1505 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
|
1506 v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW); |
1295 | 1507 v3->nodes[v3->num_nodes++].field_C.GetViewportData( |
0 | 1508 SLOWORD(pBLVRenderParams->uViewportX), |
1509 pBLVRenderParams->uViewportY, | |
1510 SLOWORD(pBLVRenderParams->uViewportZ), | |
1511 pBLVRenderParams->uViewportW); | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1512 v7 = v3->num_nodes - 1; |
0 | 1513 goto LABEL_14; |
1514 } | |
1515 v4 = v21; | |
1516 v5 = v20; | |
1517 } | |
1518 v8 = &pIndoor->pVertices[*v4->pVertexIDs]; | |
1519 v9 = v4->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x) | |
1520 + v4->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y) | |
1521 + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); | |
1522 if ( *((short *)v5 + 2004) != v4->uSectorID ) | |
1523 v9 = -v9; | |
1524 if ( v9 < 0 ) | |
1525 { | |
1526 v10 = sub_423B5D(uFaceID); | |
1527 v19 = v10; | |
1528 if ( v10 ) | |
1529 { | |
1078 | 1530 v11 = stru_50B700._screen_space_x[0]; |
1531 v12 = stru_50B700._screen_space_y[0]; | |
1532 v23 = stru_50B700._screen_space_x[0]; | |
0 | 1533 v13 = 1; |
1078 | 1534 v22 = stru_50B700._screen_space_y[0]; |
0 | 1535 if ( v10 > 1 ) |
1536 { | |
1537 do | |
1538 { | |
1078 | 1539 v14 = stru_50B700._screen_space_x[v13]; |
0 | 1540 if ( v14 < v23 ) |
1078 | 1541 v23 = stru_50B700._screen_space_x[v13]; |
0 | 1542 if ( v14 > v11 ) |
1078 | 1543 v11 = stru_50B700._screen_space_x[v13]; |
1544 v15 = stru_50B700._screen_space_y[v13]; | |
0 | 1545 if ( v15 < v22 ) |
1078 | 1546 v22 = stru_50B700._screen_space_y[v13]; |
0 | 1547 if ( v15 > v12 ) |
1078 | 1548 v12 = stru_50B700._screen_space_y[v13]; |
0 | 1549 v10 = v19; |
1550 ++v13; | |
1551 } | |
1552 while ( v13 < v19 ); | |
1553 } | |
1554 if ( v11 >= *((short *)v20 + 2005) | |
1555 && v23 <= *((short *)v20 + 2007) | |
1556 && v12 >= *((short *)v20 + 2006) | |
1557 && v22 <= *((short *)v20 + 2008) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1558 && sub_424829(v10, &v3->nodes[v3->num_nodes].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) ) |
0 | 1559 { |
1560 v16 = v21->uSectorID; | |
1561 if ( *((short *)v20 + 2004) == v16 ) | |
1562 v16 = v21->uBackSectorID; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1563 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
|
1564 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
|
1565 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
|
1566 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
|
1567 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
|
1568 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
|
1569 v17 = v3->num_nodes; |
0 | 1570 if ( v17 < 150 ) |
1571 { | |
1572 v18 = v17 + 1; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1573 v3->num_nodes = v18; |
0 | 1574 v7 = v18 - 1; |
1575 LABEL_14: | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1576 AddBspNodeToRenderList(v7); |
0 | 1577 return; |
1578 } | |
1579 } | |
1580 } | |
1581 } | |
1582 } | |
1583 else | |
1584 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1585 if (num_faces < 1000) |
0 | 1586 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1587 faces[num_faces].uFaceID = uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1588 faces[num_faces++].uNodeID = node_id; |
0 | 1589 } |
1590 } | |
1591 } | |
1592 | |
1593 //----- (004B0967) -------------------------------------------------------- | |
486 | 1594 void BspRenderer::DrawFaceOutlines() |
0 | 1595 { |
1596 signed int i; // edi@1 | |
1597 int v1; // esi@2 | |
1598 unsigned int v2; // ecx@4 | |
1599 int v3; // eax@4 | |
1600 int v4; // eax@6 | |
1601 unsigned __int16 *v5; // edx@6 | |
1602 int v6; // ecx@7 | |
1603 int v7; // esi@8 | |
1604 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1605 for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i ) |
0 | 1606 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1607 v1 = pBspRenderer->faces[i].uFaceID; |
0 | 1608 if ( v1 >= 0 ) |
1609 { | |
1610 if ( v1 < (signed int)pIndoor->uNumFaces ) | |
1611 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1612 v2 = pBspRenderer->faces[i].uFaceID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
1613 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].field_C; |
0 | 1614 v3 = sub_423B5D(v2); |
1615 if ( v3 ) | |
1616 { | |
1617 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | |
1618 { | |
1619 v4 = stru_F8A590._viewport_space_y; | |
1620 v5 = pBLVRenderParams->pRenderTarget; | |
1621 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
1622 { | |
1623 v6 = 640 * stru_F8A590._viewport_space_y; | |
1624 do | |
1625 { | |
1281 | 1626 v5[v6 + stru_F8A590.viewport_left_side[v4]] = -1; |
1627 v7 = v6 + stru_F8A590.viewport_right_side[v4]; | |
0 | 1628 v6 += 640; |
1629 v5[v7] = -1; | |
1630 ++v4; | |
1631 } | |
1632 while ( v4 <= stru_F8A590._viewport_space_w ); | |
1633 } | |
1634 } | |
1635 } | |
1636 } | |
1637 } | |
1638 } | |
1639 } | |
1640 | |
1641 | |
1642 //----- (004AE5BA) -------------------------------------------------------- | |
1643 Texture *BLVFace::GetTexture() | |
1644 { | |
1645 unsigned int v1; // ecx@2 | |
1646 | |
1647 if ( uAttributes & 0x4000 ) | |
1648 v1 = pTextureFrameTable->GetFrameTexture(this->uBitmapID, pBLVRenderParams->field_0_timer_); | |
1649 else | |
1650 v1 = uBitmapID; | |
945 | 1651 return pBitmaps_LOD->GetTexture(v1); |
0 | 1652 } |
1653 | |
1654 | |
1655 //----- (00498B15) -------------------------------------------------------- | |
1656 void IndoorLocation::Release() | |
1657 { | |
1658 IndoorLocation *v1; // esi@1 | |
1659 char *v2; // ebp@1 | |
1660 void *v3; // ST00_4@1 | |
1661 | |
1662 v1 = this; | |
1663 v2 = (char *)&this->ptr_0002B4_doors_ddata; | |
1664 pAllocator->FreeChunk(this->ptr_0002B4_doors_ddata); | |
1665 *(int *)v2 = 0; | |
1666 pAllocator->FreeChunk(v1->ptr_0002B0_sector_rdata); | |
1667 v1->ptr_0002B0_sector_rdata = 0; | |
1668 pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata); | |
1669 v1->ptr_0002B8_sector_lrdata = 0; | |
1006 | 1670 pAllocator->FreeChunk(v1->pLFaces); |
1671 v1->pLFaces = 0; | |
0 | 1672 pAllocator->FreeChunk(v1->pSpawnPoints); |
1673 v3 = v1->pVertices; | |
1674 v1->pSpawnPoints = 0; | |
1675 v1->uNumSectors = 0; | |
1676 v1->uNumFaces = 0; | |
1677 v1->uNumVertices = 0; | |
1678 v1->uNumNodes = 0; | |
1679 v1->uNumDoors = 0; | |
1680 v1->uNumLights = 0; | |
1681 pAllocator->FreeChunk(v3); | |
1682 pAllocator->FreeChunk(v1->pFaces); | |
1683 pAllocator->FreeChunk(v1->pFaceExtras); | |
1684 pAllocator->FreeChunk(v1->pSectors); | |
1685 pAllocator->FreeChunk(v1->pLights); | |
1686 pAllocator->FreeChunk(v1->pDoors); | |
1687 pAllocator->FreeChunk(v1->pNodes); | |
1688 pAllocator->FreeChunk(v1->pMapOutlines); | |
1689 v1->pVertices = 0; | |
1690 v1->pFaces = 0; | |
1691 v1->pFaceExtras = 0; | |
1692 v1->pSectors = 0; | |
1693 v1->pLights = 0; | |
1694 v1->pDoors = 0; | |
1695 v1->pNodes = 0; | |
1696 v1->pMapOutlines = 0; | |
1697 v1->bLoaded = 0; | |
1698 } | |
1699 | |
1700 //----- (00498C45) -------------------------------------------------------- | |
711 | 1701 bool IndoorLocation::Alloc() |
1702 { | |
1703 pVertices = (Vec3_short_ *) pAllocator->AllocNamedChunk(pVertices, 15000*sizeof(Vec3_short_), "L.V");//0x15F90u | |
1704 pFaces = (BLVFace *) pAllocator->AllocNamedChunk(pFaces, 10000*sizeof(BLVFace), "L.F");//0xEA600u | |
1705 pFaceExtras = (BLVFaceExtra *) pAllocator->AllocNamedChunk(pFaceExtras,5000*sizeof(BLVFaceExtra), "L.FX"); //0x2BF20u | |
1706 pSectors = (BLVSector *) pAllocator->AllocNamedChunk(pSectors, 512*sizeof(BLVSector), "L.R");//0xE800u | |
1707 pLights = (BLVLightMM7 *) pAllocator->AllocNamedChunk(pLights, 400*sizeof(BLVLightMM7), "L.L");//0x1900u | |
1708 pDoors = (BLVDoor *) pAllocator->AllocNamedChunk(pDoors, 200*sizeof(BLVDoor), "L.D");//0x3E80u | |
1709 pNodes = (BSPNode *) pAllocator->AllocNamedChunk(pNodes, 5000*sizeof(BSPNode), "L.BSP");//0x9C40u | |
1710 pMapOutlines =(BLVMapOutlines *)pAllocator->AllocNamedChunk(pMapOutlines, sizeof(BLVMapOutlines), "L.Map");//0x14824u | |
1711 if (pVertices && pFaces && pFaceExtras && pSectors && pLights && pDoors && pNodes && pMapOutlines ) | |
0 | 1712 { |
711 | 1713 memset(pVertices, 0, 15000*sizeof(Vec3_short_)); |
1714 memset(pFaces, 0, 10000*sizeof(BLVFace)); | |
1715 memset(pFaceExtras,0, 5000*sizeof(BLVFaceExtra)); | |
1716 memset(pSectors, 0, 512*sizeof(BLVSector)); | |
1717 memset(pLights, 0, 400*sizeof(BLVLightMM7)); | |
1718 memset(pDoors, 0, 200*sizeof(BLVDoor)); | |
1719 memset(pNodes, 0, 5000*sizeof(BSPNode)); | |
1720 memset(pMapOutlines,0, sizeof(BLVMapOutlines)); | |
1721 return true; | |
0 | 1722 } |
1723 else | |
1724 { | |
711 | 1725 return false; |
0 | 1726 } |
1727 } | |
1728 | |
1729 | |
1730 | |
1731 //----- (00444810) -------------------------------------------------------- | |
1732 unsigned int IndoorLocation::GetLocationIndex(const char *Str1) | |
1733 { | |
1734 const char *v1; // edi@1 | |
1735 signed int v2; // esi@1 | |
1736 | |
434 | 1737 for (uint i = 0; i < 11; ++i) |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1132
diff
changeset
|
1738 if (!_stricmp(Str1, _4E6BDC_loc_names[i])) |
434 | 1739 return i + 1; |
1740 return 0; | |
0 | 1741 } |
1742 | |
1743 | |
1744 | |
1745 //----- (004488F7) -------------------------------------------------------- | |
711 | 1746 void IndoorLocation::ToggleLight(signed int sLightID, unsigned int bToggle) |
0 | 1747 { |
711 | 1748 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (sLightID <= pIndoor->uNumLights - 1) && (sLightID >= 0) ) |
0 | 1749 { |
1750 if ( bToggle ) | |
1063 | 1751 pIndoor->pLights[sLightID].uAtributes &= 0xFFFFFFF7u; |
0 | 1752 else |
1063 | 1753 pIndoor->pLights[sLightID].uAtributes |= 8u; |
0 | 1754 pParty->uFlags |= 2u; |
1755 } | |
1756 } | |
1757 | |
1758 | |
1759 //----- (00498E0A) -------------------------------------------------------- | |
1760 bool IndoorLocation::Load(char *pFilename, int a3, size_t _i, char *pDest) | |
1761 { | |
1762 /*unsigned int v5; // ebx@1 | |
1763 //IndoorLocation *v6; // esi@1 | |
1764 FILE *v7; // edi@3 | |
1765 bool result; // eax@3 | |
1766 char *v9; // ecx@4 | |
1767 void *v10; // eax@4 | |
1768 //unsigned __int8 v11; // zf@4 | |
1769 //unsigned __int8 v12; // sf@4 | |
1770 int v13; // eax@5 | |
1771 size_t v14; // ecx@6 | |
1772 char *v15; // ecx@6 | |
1773 int v16; // edx@6 | |
1774 size_t v17; // ecx@6 | |
1775 char *v18; // ecx@6 | |
1776 int v19; // edx@6 | |
1777 unsigned __int16 *v20; // edx@6 | |
1778 unsigned __int16 *v21; // edx@6 | |
1779 unsigned __int16 *v22; // edx@6 | |
1780 __int16 v23; // ax@10 | |
1781 char *v24; // ecx@10 | |
1782 __int16 v25; // cx@10 | |
1783 __int16 v26; // ax@11 | |
1784 char *v27; // ecx@11 | |
1785 unsigned __int16 v28; // ax@17 | |
1786 BLVFaceExtra *v29; // ecx@17 | |
1787 char *v30; // edx@17 | |
1788 int v31; // ecx@20 | |
1789 void *v32; // eax@25 | |
1790 int v33; // eax@26 | |
1791 unsigned __int16 *v34; // edx@27 | |
1792 size_t v35; // ecx@27 | |
1793 char *v36; // ecx@27 | |
1794 int v37; // edx@27 | |
1795 size_t v38; // ecx@27 | |
1796 char *v39; // ecx@27 | |
1797 int v40; // edx@27 | |
1798 unsigned __int16 *v41; // edx@27 | |
1799 unsigned __int16 *v42; // edx@27 | |
1800 unsigned __int16 *v43; // edx@27 | |
1801 unsigned __int16 *v44; // edx@27 | |
1802 size_t v45; // ecx@27 | |
1803 unsigned __int16 *v46; // edx@27 | |
1804 void *v47; // eax@28 | |
1805 BLVSector *v48; // eax@29 | |
1806 size_t v49; // ecx@29 | |
1807 unsigned __int16 *v50; // edx@31 | |
1808 void *v51; // eax@32 | |
1809 int v52; // eax@33 | |
1810 unsigned __int16 *v53; // edx@34 | |
1811 size_t v54; // ecx@34 | |
1812 char *v55; // ecx@34 | |
1813 int v56; // edx@34 | |
1814 size_t v57; // ecx@34 | |
1815 char *v58; // ecx@34 | |
1816 int v59; // edx@34 | |
1817 unsigned __int16 *v60; // edx@34 | |
1818 unsigned __int16 *v61; // edx@34 | |
1819 unsigned __int16 *v62; // edx@34 | |
1820 unsigned __int16 *v63; // edx@34 | |
1821 int v64; // ecx@34 | |
1822 BLVDoor *v65; // ecx@36 | |
1823 char *v66; // eax@37 | |
1824 int v67; // edx@38 | |
1825 int v68; // ecx@38 | |
1826 BLVFace *v69; // edx@38 | |
1827 int v70; // ecx@38 | |
1828 int v71; // edx@38 | |
1829 int v72; // eax@38 | |
1830 unsigned __int16 v73; // ax@42 | |
1831 char *v74; // ecx@42 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
1832 SpriteObject *v75; // ecx@44 |
0 | 1833 size_t v76; // eax@45 |
1834 int j; // edx@46 | |
1835 unsigned __int16 v78; // ax@50 | |
1836 void *v79; // eax@52 | |
1837 void **v80; // esi@52 | |
1838 unsigned int v145; // eax@103 | |
1839 void *v146; // eax@103 | |
1840 unsigned int v147; // ecx@103 | |
1841 int v148; // ebx@103 | |
1842 unsigned int *v149; // ecx@103*/ | |
1843 //size_t v150; // eax@103 | |
1844 //unsigned int v151; // ebx@109 | |
1845 //unsigned int v152; // ecx@116 | |
1846 //unsigned int v153; // eax@117 | |
1847 //size_t v154; // ebx@126 | |
1848 //unsigned int v155; // ebx@134 | |
1849 //size_t v156; // eax@140 | |
1850 //signed int v157; // ebx@142 | |
1851 //int v158; // ebx@148 | |
1852 //BLVFace *v159; // eax@149 | |
1853 // BLVFaceExtra *v160; // ecx@149 | |
1854 //BLVFaceExtra *v161; // ecx@149 | |
1855 //signed int v162; // ebx@154 | |
1856 //unsigned int v163; // ebx@157 | |
1857 //unsigned int v164; // ebx@157 | |
1858 //unsigned int v165; // edx@158 | |
1859 //char *v166; // ecx@158 | |
1860 //unsigned __int16 v167; // ax@161 | |
1861 //__int16 v168; // ax@165 | |
1862 //unsigned int v169; // ebx@168 | |
1863 //void *v170; // eax@168 | |
1864 //size_t v171; // ebx@168 | |
1865 //int v172; // edx@168 | |
1866 //BLVDoor *v173; // ecx@169 | |
1867 //int k; // eax@169 | |
1868 //BLVDoor *v175; // ecx@172 | |
1869 //int v176; // edx@172 | |
1870 //BLVDoor *v177; // ecx@172 | |
1871 //int v178; // edx@172 | |
1872 //BLVDoor *v179; // ecx@172 | |
1873 //int v180; // edx@172 | |
1874 //BLVDoor *v181; // ecx@172 | |
1875 //int v182; // edx@172 | |
1876 //BLVDoor *v183; // ecx@172 | |
1877 //int v184; // edx@172 | |
1878 //BLVDoor *v185; // ecx@172 | |
1879 //int v186; // edx@172 | |
1880 //BLVDoor *v187; // ecx@172 | |
1881 //int v188; // edx@172 | |
1882 //unsigned __int16 *v189; // ebx@172 | |
1883 //char *v190; // edx@173 | |
1884 //BLVDoor *v191; // ecx@174 | |
1885 //BLVDoor *l; // eax@175 | |
1886 //signed int v193; // ebx@176 | |
1887 //int v194; // ecx@176 | |
1888 //BLVFaceExtra *v195; // ecx@176 | |
1889 //BLVFace *v196; // ebx@178 | |
1890 //std::string v197; // [sp-18h] [bp-680h]@66 | |
1891 //void *v198; // [sp-14h] [bp-67Ch]@72 | |
1892 //size_t v199; // [sp-10h] [bp-678h]@72 | |
1893 //size_t v200; // [sp-Ch] [bp-674h]@72 | |
1894 //const char *v201; // [sp-8h] [bp-670h]@4 | |
1895 //int v202; // [sp-4h] [bp-66Ch]@4 | |
1896 char v203[875]; // [sp+Ch] [bp-65Ch]@130 | |
1897 char FileName[260]; // [sp+378h] [bp-2F0h]@1 | |
1898 //char DstBuf; // [sp+47Ch] [bp-1ECh]@4 | |
1899 __int32 Offset; // [sp+480h] [bp-1E8h]@4 | |
1900 __int32 v207; // [sp+48Ch] [bp-1DCh]@4 | |
1901 __int32 v208; // [sp+498h] [bp-1D0h]@4 | |
1902 __int32 v209; // [sp+4A4h] [bp-1C4h]@4 | |
1903 __int32 v210; // [sp+4B0h] [bp-1B8h]@4 | |
1904 __int32 v211; // [sp+4BCh] [bp-1ACh]@15 | |
1905 __int32 v212; // [sp+4C8h] [bp-1A0h]@15 | |
1906 __int32 v213; // [sp+4D4h] [bp-194h]@25 | |
1907 __int32 v214; // [sp+4E0h] [bp-188h]@25 | |
1908 __int32 v215; // [sp+4ECh] [bp-17Ch]@32 | |
1909 __int32 v216; // [sp+4F8h] [bp-170h]@32 | |
1910 __int32 v217; // [sp+504h] [bp-164h]@40 | |
1911 __int32 v218; // [sp+510h] [bp-158h]@40 | |
1912 __int32 v219; // [sp+51Ch] [bp-14Ch]@43 | |
1913 __int32 v220; // [sp+528h] [bp-140h]@43 | |
1914 __int32 v221; // [sp+534h] [bp-134h]@52 | |
1915 __int32 v222; // [sp+540h] [bp-128h]@52 | |
1916 __int32 v223; // [sp+54Ch] [bp-11Ch]@52 | |
1917 __int32 v224; // [sp+558h] [bp-110h]@52 | |
1918 __int32 v225; // [sp+564h] [bp-104h]@52 | |
1919 __int32 v226; // [sp+570h] [bp-F8h]@52 | |
1920 __int32 v227; // [sp+57Ch] [bp-ECh]@52 | |
1921 __int32 v228; // [sp+588h] [bp-E0h]@52 | |
1922 __int32 v229; // [sp+594h] [bp-D4h]@52 | |
1923 __int32 v230; // [sp+5A0h] [bp-C8h]@52 | |
1924 __int32 v231; // [sp+5ACh] [bp-BCh]@52 | |
1925 __int32 v232; // [sp+5B8h] [bp-B0h]@52 | |
1926 __int32 v233; // [sp+5C4h] [bp-A4h]@52 | |
1927 __int32 v234; // [sp+5D0h] [bp-98h]@52 | |
1928 //char pName[40]; // [sp+5FCh] [bp-6Ch]@42 | |
1929 //size_t pSource; // [sp+624h] [bp-44h]@67 | |
1930 //char Dst[12]; // [sp+628h] [bp-40h]@9 | |
1931 //char *v238; // [sp+634h] [bp-34h]@38 | |
1932 ODMHeader header; // [sp+638h] [bp-30h]@61 | |
1933 //void *ptr; // [sp+648h] [bp-20h]@66 | |
1934 //size_t Count; // [sp+64Ch] [bp-1Ch]@109 | |
1935 //int uSourceLen; // [sp+653h] [bp-15h]@66 | |
1936 FILE *File; // [sp+658h] [bp-10h]@56 | |
1937 //BLVSector *v244; // [sp+65Ch] [bp-Ch]@72 | |
1938 //int v245; // [sp+660h] [bp-8h]@72 | |
1939 //BLVFace *Src; // [sp+664h] [bp-4h]@73 | |
1940 signed int Argsa; // [sp+670h] [bp+8h]@4 | |
1941 signed int Argsb; // [sp+670h] [bp+8h]@7 | |
1942 signed int Argsc; // [sp+670h] [bp+8h]@15 | |
1943 signed int Argsd; // [sp+670h] [bp+8h]@18 | |
1944 int Argse; // [sp+670h] [bp+8h]@25 | |
1945 int Argsf; // [sp+670h] [bp+8h]@28 | |
1946 int Argsg; // [sp+670h] [bp+8h]@32 | |
1947 int Argsh; // [sp+670h] [bp+8h]@35 | |
1948 signed int Argsi; // [sp+670h] [bp+8h]@40 | |
1949 signed int Argsj; // [sp+670h] [bp+8h]@45 | |
1950 //int Argsk; // [sp+670h] [bp+8h]@143 | |
1951 //void *Argsl; // [sp+670h] [bp+8h]@155 | |
1952 //signed int Argsm; // [sp+670h] [bp+8h]@161 | |
1953 //signed int Argsn; // [sp+670h] [bp+8h]@175 | |
1954 | |
1955 //v5 = 0; | |
1956 //v6 = this; | |
1957 _6807E0_num_decorations_with_sounds_6807B8 = 0; | |
1958 | |
1959 #pragma region "loading from txt" | |
1960 /*sprintf(FileName, "levels\\%s", pFilename); | |
1961 if ( GetFileAttributesA(FileName) != -1 ) | |
1962 { | |
1963 Release(); | |
1964 if ( Alloc() ) | |
1965 { | |
1966 v7 = fopen(FileName, "rb"); | |
1967 result = 1; | |
1968 if ( !v7 ) | |
1969 return result; | |
1970 v9 = pDest; | |
1971 bLoaded = 1; | |
1972 v202 = (int)v7; | |
1973 v201 = (const char *)1; | |
1974 *(int *)v9 = 1; | |
1975 fread(&DstBuf, 0x180u, (size_t)v201, (FILE *)v202); | |
1976 fseek(v7, Offset, 0); | |
1977 fread(&blv, 0x88u, 1u, v7); | |
1978 fseek(v7, v207, 0); | |
1979 fread(&uNumVertices, 1u, 4u, v7); | |
1980 fseek(v7, v208, 0); | |
1981 fread(pVertices, 6u, uNumVertices, v7); | |
1982 fseek(v7, v209, 0); | |
1983 fread(&uNumFaces, 4u, 1u, v7); | |
1984 fseek(v7, v210, 0); | |
1985 fread(pFaces, 0x60u, uNumFaces, v7); | |
1986 v10 = pAllocator->AllocNamedChunk(ptr_2AC, blv.uFaces_fdata_Size, "L.FData"); | |
1987 v202 = (int)v7; | |
1988 ptr_2AC = (unsigned __int16 *)v10; | |
1989 fread(v10, 1u, blv.uFaces_fdata_Size, (FILE *)v202); | |
1990 v11 = uNumFaces == 0; | |
1991 v12 = (uNumFaces & 0x80000000u) != 0; | |
1992 pDest = 0; | |
1993 Argsa = 0; | |
1994 if ( !(v12 | v11) ) | |
1995 { | |
1996 v13 = 0; | |
1997 do | |
1998 { | |
1999 pFaces[v13].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)ptr_2AC]; | |
2000 v14 = (size_t)&pFaces[v13]; | |
2001 i = v14; | |
2002 v15 = &pDest[2 * *(char *)(v14 + 93) + 2]; | |
2003 v16 = (int)&v15[(unsigned int)ptr_2AC]; | |
2004 pDest = v15; | |
2005 *(int *)(i + 52) = v16; | |
2006 v17 = (size_t)&pFaces[v13]; | |
2007 i = v17; | |
2008 v18 = &pDest[2 * *(char *)(v17 + 93) + 2]; | |
2009 v19 = (int)&v18[(unsigned int)ptr_2AC]; | |
2010 pDest = v18; | |
2011 *(int *)(i + 56) = v19; | |
2012 i = (size_t)&pFaces[v13]; | |
2013 v20 = ptr_2AC; | |
2014 pDest += 2 * *(char *)(i + 93) + 2; | |
2015 *(int *)(i + 60) = (int)(char *)v20 + (int)pDest; | |
2016 i = (size_t)&pFaces[v13]; | |
2017 v21 = ptr_2AC; | |
2018 pDest += 2 * *(char *)(i + 93) + 2; | |
2019 *(int *)(i + 64) = (int)(char *)v21 + (int)pDest; | |
2020 i = (size_t)&pFaces[v13]; | |
2021 ++v13; | |
2022 v22 = ptr_2AC; | |
2023 pDest += 2 * *(char *)(i + 93) + 2; | |
2024 ++Argsa; | |
2025 *(int *)(i + 68) = (int)(char *)v22 + (int)pDest; | |
2026 pDest += 2 * *((char *)&pFaces[v13] - 3) + 2; | |
2027 } | |
2028 while ( Argsa < (signed int)uNumFaces ); | |
2029 } | |
2030 Argsb = 0; | |
2031 if ( (signed int)uNumFaces > 0 ) | |
2032 { | |
2033 pDest = 0; | |
2034 do | |
2035 { | |
2036 fread(Dst, 1u, 0xAu, v7); | |
2037 if ( pDest[(unsigned int)pFaces + 45] & 0x40 ) | |
2038 { | |
2039 v23 = pTextureFrameTable->FindTextureByName(Dst); | |
2040 v24 = pDest; | |
2041 *(short *)&pDest[(unsigned int)pFaces + 74] = v23; | |
2042 v25 = *(short *)&v24[(unsigned int)pFaces + 74]; | |
2043 if ( v25 ) | |
2044 { | |
2045 pTextureFrameTable->LoadAnimationSequenceAndPalettes(v25); | |
2046 } | |
2047 else | |
2048 { | |
2049 v26 = pBitmaps_LOD->LoadTexture(Dst); | |
2050 v27 = pDest; | |
2051 *(short *)&pDest[(unsigned int)pFaces + 74] = v26; | |
2052 v27[(unsigned int)pFaces + 45] &= 0xBFu; | |
2053 } | |
2054 } | |
2055 else | |
2056 { | |
2057 *(short *)&pDest[(unsigned int)pFaces + 74] = pBitmaps_LOD->LoadTexture(Dst); | |
2058 } | |
2059 ++Argsb; | |
2060 pDest += 96; | |
2061 } | |
2062 while ( Argsb < (signed int)uNumFaces ); | |
2063 } | |
2064 fseek(v7, v211, 0); | |
2065 fread(&uNumFaceExtras, 4u, 1u, v7); | |
2066 fseek(v7, v212, 0); | |
2067 fread(pFaceExtras, 0x24u, uNumFaceExtras, v7); | |
2068 Argsc = 0; | |
2069 if ( (signed int)uNumFaceExtras > 0 ) | |
2070 { | |
2071 pDest = 0; | |
2072 do | |
2073 { | |
2074 fread(Dst, 1u, 0xAu, v7); | |
2075 v28 = pBitmaps_LOD->LoadTexture(Dst); | |
2076 v29 = pFaceExtras; | |
2077 v30 = pDest; | |
2078 ++Argsc; | |
2079 pDest += 36; | |
2080 *(unsigned __int16 *)((char *)&v29->uAdditionalBitmapID + (int)v30) = v28; | |
2081 } | |
2082 while ( Argsc < (signed int)uNumFaceExtras ); | |
2083 } | |
2084 Argsd = 0; | |
2085 if ( (signed int)uNumFaces > 0 ) | |
2086 { | |
2087 pDest = 0; | |
2088 do | |
2089 { | |
2090 v31 = (int)&pFaceExtras[*(short *)&pDest[(unsigned int)pFaces + 72]]; | |
2091 if ( *(short *)(v31 + 26) ) | |
2092 { | |
2093 if ( ((BLVFaceExtra *)v31)->HasEventint() ) | |
2094 pDest[(unsigned int)pFaces + 46] |= 0x10u; | |
2095 else | |
2096 pDest[(unsigned int)pFaces + 46] &= 0xEFu; | |
2097 } | |
2098 ++Argsd; | |
2099 pDest += 96; | |
2100 } | |
2101 while ( Argsd < (signed int)uNumFaces ); | |
2102 } | |
2103 fseek(v7, v213, 0); | |
2104 fread(&uNumSectors, 4u, 1u, v7); | |
2105 fseek(v7, v214, 0); | |
2106 fread(pSectors, 0x74u, uNumSectors, v7); | |
2107 v32 = pAllocator->AllocNamedChunk(ptr_0002B0_sector_rdata, blv.uSector_rdata_Size, "L.RData"); | |
2108 v202 = (int)v7; | |
2109 ptr_0002B0_sector_rdata = (unsigned __int16 *)v32; | |
2110 fread(v32, 1u, blv.uSector_rdata_Size, (FILE *)v202); | |
2111 v11 = uNumSectors == 0; | |
2112 v12 = uNumSectors < 0; | |
2113 pDest = 0; | |
2114 Argse = 0; | |
2115 if ( !(v12 | v11) ) | |
2116 { | |
2117 v33 = 0; | |
2118 do | |
2119 { | |
2120 pSectors[v33].pFloors = (unsigned __int16 *)&pDest[(unsigned int)ptr_0002B0_sector_rdata]; | |
2121 i = (size_t)&pSectors[v33]; | |
2122 v34 = ptr_0002B0_sector_rdata; | |
2123 pDest += 2 * *(short *)(i + 4); | |
2124 *(int *)(i + 16) = (int)(char *)v34 + (int)pDest; | |
2125 v35 = (size_t)&pSectors[v33]; | |
2126 i = v35; | |
2127 v36 = &pDest[2 * *(short *)(v35 + 12)]; | |
2128 v37 = (int)&v36[(unsigned int)ptr_0002B0_sector_rdata]; | |
2129 pDest = v36; | |
2130 *(int *)(i + 24) = v37; | |
2131 v38 = (size_t)&pSectors[v33]; | |
2132 i = v38; | |
2133 v39 = &pDest[2 * *(short *)(v38 + 20)]; | |
2134 v40 = (int)&v39[(unsigned int)ptr_0002B0_sector_rdata]; | |
2135 pDest = v39; | |
2136 *(int *)(i + 32) = v40; | |
2137 i = (size_t)&pSectors[v33]; | |
2138 v41 = ptr_0002B0_sector_rdata; | |
2139 pDest += 2 * *(short *)(i + 28); | |
2140 *(int *)(i + 40) = (int)(char *)v41 + (int)pDest; | |
2141 i = (size_t)&pSectors[v33]; | |
2142 v42 = ptr_0002B0_sector_rdata; | |
2143 pDest += 2 * *(short *)(i + 36); | |
2144 *(int *)(i + 48) = (int)(char *)v42 + (int)pDest; | |
2145 i = (size_t)&pSectors[v33]; | |
2146 v43 = ptr_0002B0_sector_rdata; | |
2147 pDest += 2 * *(short *)(i + 44); | |
2148 *(int *)(i + 64) = (int)(char *)v43 + (int)pDest; | |
2149 i = (size_t)&pSectors[v33]; | |
2150 v44 = ptr_0002B0_sector_rdata; | |
2151 pDest += 2 * *(short *)(i + 60); | |
2152 *(int *)(i + 72) = (int)(char *)v44 + (int)pDest; | |
2153 v45 = (size_t)&pSectors[v33]; | |
2154 ++v33; | |
2155 i = v45; | |
2156 v46 = ptr_0002B0_sector_rdata; | |
2157 pDest += 2 * *(short *)(v45 + 68); | |
2158 ++Argse; | |
2159 *(int *)(v45 + 80) = (int)(char *)v46 + (int)pDest; | |
2160 pDest += 2 * *((short *)&pSectors[v33] - 20); | |
2161 } | |
2162 while ( Argse < uNumSectors ); | |
2163 } | |
2164 v47 = pAllocator->AllocNamedChunk( | |
2165 ptr_0002B8_sector_lrdata, | |
2166 blv.uSector_lrdata_Size, | |
2167 "L.RLData"); | |
2168 v202 = (int)v7; | |
2169 ptr_0002B8_sector_lrdata = (unsigned __int16 *)v47; | |
2170 fread(v47, 1u, blv.uSector_lrdata_Size, (FILE *)v202); | |
2171 v11 = uNumSectors == 0; | |
2172 v12 = uNumSectors < 0; | |
2173 pDest = 0; | |
2174 Argsf = 0; | |
2175 if ( !(v12 | v11) ) | |
2176 { | |
2177 v48 = pSectors; | |
2178 v49 = 0; | |
2179 for ( i = 0; ; v49 = i ) | |
2180 { | |
2181 v50 = ptr_0002B8_sector_lrdata; | |
2182 i += 116; | |
2183 ++Argsf; | |
2184 *(BLVLightMM7 **)((char *)&v48->pLights + v49) = (BLVLightMM7 *)((char *)v50 + (int)pDest); | |
2185 v48 = pSectors; | |
2186 pDest += 2 * *(__int16 *)((char *)&v48->uNumLights + v49); | |
2187 if ( Argsf >= uNumSectors ) | |
2188 break; | |
2189 } | |
2190 } | |
2191 fseek(v7, v215, 0); | |
2192 fread(&uNumDoors, 4u, 1u, v7); | |
2193 fseek(v7, v216, 0); | |
2194 fread(pDoors, 0x50u, 0xC8u, v7); | |
2195 v51 = pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData"); | |
2196 v202 = (int)v7; | |
2197 ptr_0002B4_doors_ddata = (unsigned __int16 *)v51; | |
2198 fread(v51, 1u, blv.uDoors_ddata_Size, (FILE *)v202); | |
2199 v11 = uNumDoors == 0; | |
2200 v12 = uNumDoors < 0; | |
2201 pDest = 0; | |
2202 Argsg = 0; | |
2203 if ( !(v12 | v11) ) | |
2204 { | |
2205 v52 = 0; | |
2206 do | |
2207 { | |
2208 pDoors[v52].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)ptr_0002B4_doors_ddata]; | |
2209 i = (size_t)&pDoors[v52]; | |
2210 v53 = ptr_0002B4_doors_ddata; | |
2211 pDest += 2 * *(short *)(i + 68); | |
2212 *(int *)(i + 40) = (int)(char *)v53 + (int)pDest; | |
2213 v54 = (size_t)&pDoors[v52]; | |
2214 i = v54; | |
2215 v55 = &pDest[2 * *(short *)(v54 + 70)]; | |
2216 v56 = (int)&v55[(unsigned int)ptr_0002B4_doors_ddata]; | |
2217 pDest = v55; | |
2218 *(int *)(i + 44) = v56; | |
2219 v57 = (size_t)&pDoors[v52]; | |
2220 i = v57; | |
2221 v58 = &pDest[2 * *(short *)(v57 + 72)]; | |
2222 v59 = (int)&v58[(unsigned int)ptr_0002B4_doors_ddata]; | |
2223 pDest = v58; | |
2224 *(int *)(i + 48) = v59; | |
2225 i = (size_t)&pDoors[v52]; | |
2226 v60 = ptr_0002B4_doors_ddata; | |
2227 pDest += 2 * *(short *)(i + 70); | |
2228 *(int *)(i + 52) = (int)(char *)v60 + (int)pDest; | |
2229 i = (size_t)&pDoors[v52]; | |
2230 v61 = ptr_0002B4_doors_ddata; | |
2231 pDest += 2 * *(short *)(i + 70); | |
2232 *(int *)(i + 56) = (int)(char *)v61 + (int)pDest; | |
2233 i = (size_t)&pDoors[v52]; | |
2234 v62 = ptr_0002B4_doors_ddata; | |
2235 pDest += 2 * *(short *)(i + 74); | |
2236 *(int *)(i + 60) = (int)(char *)v62 + (int)pDest; | |
2237 i = (size_t)&pDoors[v52]; | |
2238 v63 = ptr_0002B4_doors_ddata; | |
2239 pDest += 2 * *(short *)(i + 74); | |
2240 *(int *)(i + 64) = (int)(char *)v63 + (int)pDest; | |
2241 ++Argsg; | |
2242 v64 = pDoors[v52].uNumOffsets; | |
2243 ++v52; | |
2244 pDest += 2 * v64; | |
2245 } | |
2246 while ( Argsg < uNumDoors ); | |
2247 } | |
2248 Argsh = 0; | |
2249 if ( uNumDoors > 0 ) | |
2250 { | |
2251 v65 = pDoors; | |
2252 pDest = 0; | |
2253 do | |
2254 { | |
2255 i = 0; | |
2256 v66 = &pDest[(int)v65]; | |
2257 if ( *(short *)&pDest[(int)v65 + 70] > 0 ) | |
2258 { | |
2259 do | |
2260 { | |
2261 v67 = *((int *)v66 + 10); | |
2262 a3 = 2 * i; | |
2263 v68 = *(short *)(v67 + 2 * i); | |
2264 v69 = pFaces; | |
2265 ++i; | |
2266 v70 = (int)&pFaceExtras[v69[v68].uFaceExtraID]; | |
2267 v71 = *((int *)v66 + 12); | |
2268 v72 = a3; | |
2269 v238 = (char *)v70; | |
2270 *(short *)(a3 + v71) = *(short *)(v70 + 20); | |
2271 *(__int16 *)(*(char **)((char *)&pDoors->pDeltaVs + (unsigned int)pDest) + v72) = *((short *)v238 + 11); | |
2272 v65 = pDoors; | |
2273 v66 = &pDest[(int)v65]; | |
2274 } | |
2275 while ( (signed int)i < *(short *)&pDest[(int)v65 + 70] ); | |
2276 } | |
2277 ++Argsh; | |
2278 pDest += 80; | |
2279 } | |
2280 while ( Argsh < uNumDoors ); | |
2281 } | |
2282 fseek(v7, v217, 0); | |
2283 fread(&uNumLevelDecorations, 4u, 1u, v7); | |
2284 fseek(v7, v218, 0); | |
2285 fread(pLevelDecorations, 0x20u, uNumLevelDecorations, v7); | |
2286 Argsi = 0; | |
2287 if ( (signed int)uNumLevelDecorations > 0 ) | |
2288 { | |
2289 pDest = (char *)pLevelDecorations; | |
2290 do | |
2291 { | |
2292 fread(pName, 1u, 0x20u, v7); | |
2293 v73 = pDecorationList->GetDecorIdByName(pName); | |
2294 v74 = pDest; | |
2295 ++Argsi; | |
2296 pDest += 32; | |
2297 *(short *)v74 = v73; | |
2298 } | |
2299 while ( Argsi < (signed int)uNumLevelDecorations ); | |
2300 } | |
2301 fseek(v7, v219, 0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2302 fread(&uNumSpriteObjects, 4u, 1u, v7); |
0 | 2303 fseek(v7, v220, 0); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2304 fread(pSpriteObjects, 0x70u, uNumSpriteObjects, v7); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2305 if ( (signed int)uNumSpriteObjects > 0 ) |
0 | 2306 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2307 v75 = pSpriteObjects; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2308 pDest = (char *)uNumSpriteObjects; |
0 | 2309 do |
2310 { | |
2311 Argsj = 0; | |
2312 v76 = 48 * v75->stru_24.uItemID; | |
2313 v11 = pObjectList->uNumObjects == 0; | |
2314 v12 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
2315 LOWORD(v76) = *(unsigned __int16 *)((char *)&pItemsTable->pItems[0].uSpriteID + v76); | |
2316 i = v76; | |
2317 v75->uItemType = v76; | |
2318 if ( v12 | v11 ) | |
2319 { | |
2320 LABEL_50: | |
2321 v78 = 0; | |
2322 } | |
2323 else | |
2324 { | |
2325 for ( j = (int)&pObjectList->pObjects->uObjectID; (short)v76 != *(short *)j; j = a3 ) | |
2326 { | |
2327 ++Argsj; | |
2328 a3 = j + 56; | |
2329 if ( Argsj >= (signed int)pObjectList->uNumObjects ) | |
2330 goto LABEL_50; | |
2331 LOWORD(v76) = i; | |
2332 } | |
2333 v78 = Argsj; | |
2334 } | |
2335 v75->uObjectDescID = v78; | |
2336 ++v75; | |
2337 --pDest; | |
2338 } | |
2339 while ( pDest ); | |
2340 } | |
2341 fseek(v7, v221, 0); | |
2342 fread(&uNumActors, 4u, 1u, v7); | |
2343 fseek(v7, v222, 0); | |
2344 fread(pActors, 0x344u, uNumActors, v7); | |
2345 fseek(v7, v228, 0); | |
2346 fread(&uNumChests, 4u, 1u, v7); | |
2347 fseek(v7, v229, 0); | |
2348 fread(pChests, 0x14CCu, uNumChests, v7); | |
2349 fseek(v7, v224, 0); | |
2350 fread(&uNumLights, 4u, 1u, v7); | |
2351 fseek(v7, v225, 0); | |
2352 fread(pLights, 0x10u, uNumLights, v7); | |
2353 fseek(v7, v226, 0); | |
2354 fread(&uNumNodes, 4u, 1u, v7); | |
2355 fseek(v7, v227, 0); | |
2356 fread(pNodes, 8u, uNumNodes, v7); | |
2357 fseek(v7, v230, 0); | |
2358 fread(&uNumSpawnPoints, 4u, 1u, v7); | |
2359 v79 = pAllocator->AllocNamedChunk(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn"); | |
2360 v202 = 0; | |
2361 pSpawnPoints = (SpawnPointMM7 *)v79; | |
2362 fseek(v7, v231, v202); | |
2363 fread(pSpawnPoints, 0x18u, uNumSpawnPoints, v7); | |
2364 fseek(v7, v232, 0); | |
2365 fread(&dlv, 0x28u, 1u, v7); | |
2366 fseek(v7, v233, 0); | |
2367 fread(&stru_5E4C90, 1u, 0xC8u, v7); | |
2368 fseek(v7, v234, 0); | |
2369 fread(&uLastVisitDay, 1u, 0x38u, v7); | |
2370 fseek(v7, v223, 0); | |
2371 v80 = (void **)&pMapOutlines; | |
2372 fread(*v80, 4u, 1u, v7); | |
2373 fread((char *)*v80 + 4, 0xCu, *(int *)*v80, v7); | |
2374 fclose(v7); | |
2375 goto LABEL_179; | |
2376 } | |
2377 return 4; | |
2378 }*/ | |
2379 #pragma endregion | |
2380 | |
2381 if (bLoaded) | |
2382 { | |
2383 Log::Warning(L"BLV is already loaded"); | |
2384 return 3; | |
2385 } | |
2386 | |
2387 if ( !pGames_LOD->DoesContainerExist(pFilename) ) | |
2388 Abortf("Unable to find %s in Games.LOD", pFilename); | |
2389 | |
2390 //v238 = pFilename - 4; | |
2391 //v81 = strlen(pFilename); | |
2392 strcpy(this->pFilename, pFilename); | |
2393 strcpy(&pFilename[strlen(pFilename) - 4], ".blv"); | |
2394 File = pGames_LOD->FindContainer(pFilename, 1); | |
2395 //File = v82; | |
2396 | |
2397 Release(); | |
2398 if ( !Alloc() ) | |
2399 return 4; | |
2400 | |
2401 header.uVersion = 91969; | |
2402 header.pMagic[0] = 'm'; | |
2403 header.pMagic[1] = 'v'; | |
2404 header.pMagic[2] = 'i'; | |
2405 header.pMagic[3] = 'i'; | |
2406 header.uCompressedSize = 0; | |
2407 header.uDecompressedSize = 0; | |
2408 fread(&header, sizeof(ODMHeader), 1u, File); | |
2409 if (header.uVersion != 91969 || | |
2410 header.pMagic[0] != 'm' || | |
2411 header.pMagic[1] != 'v' || | |
2412 header.pMagic[2] != 'i' || | |
2413 header.pMagic[3] != 'i' ) | |
2414 { | |
2415 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:792", 0); | |
2416 } | |
2417 //v83 = header.uCompressedSize; | |
2418 //pSource = header.uDecompressedSize; | |
2419 //v84 = malloc(header.uDecompressedSize); | |
2420 //v85 = v84; | |
2421 //ptr = v84; | |
2422 auto pRawBLV = malloc(header.uDecompressedSize); | |
2423 memset(pRawBLV, 0, header.uDecompressedSize); | |
2424 | |
2425 if (header.uCompressedSize == header.uDecompressedSize) | |
2426 fread(pRawBLV, header.uDecompressedSize, 1, File); | |
2427 else if (header.uCompressedSize < header.uDecompressedSize) | |
2428 { | |
2429 auto pTmpMem = malloc(header.uCompressedSize); | |
2430 { | |
2431 fread(pTmpMem, header.uCompressedSize, 1, File); | |
2432 | |
2433 uint uDecompressedSize = header.uDecompressedSize; | |
2434 zlib::MemUnzip(pRawBLV, &uDecompressedSize, pTmpMem, header.uCompressedSize); | |
2435 | |
2436 if (uDecompressedSize != header.uDecompressedSize) | |
2437 Log::Warning(L"uDecompressedSize != header.uDecompressedSize in BLV"); | |
2438 } | |
2439 free(pTmpMem); | |
2440 } | |
2441 else | |
2442 { | |
2443 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:803", 0); | |
2444 return 0; | |
2445 } | |
2446 | |
2447 bLoaded = true; | |
2448 | |
2449 auto pData = (char *)pRawBLV; | |
2450 | |
2451 pGameLoadingUI_ProgressBar->Progress(); | |
2452 | |
2453 memcpy(&blv, pData, 136); | |
2454 memcpy(&uNumVertices, pData += 136, 4); | |
2455 memcpy(pVertices, pData += 4, uNumVertices * sizeof(Vec3_short_)); | |
2456 | |
2457 pGameLoadingUI_ProgressBar->Progress(); | |
2458 | |
2459 memcpy(&uNumFaces, pData += uNumVertices * sizeof(Vec3_short_), 4); | |
2460 | |
2461 pGameLoadingUI_ProgressBar->Progress(); | |
2462 | |
2463 memcpy(pFaces, pData += 4, uNumFaces * sizeof (BLVFace)); | |
1006 | 2464 pLFaces = (unsigned __int16 *)pAllocator->AllocNamedChunk(pLFaces, blv.uFaces_fdata_Size, "L.FData"); |
2465 | |
2466 memcpy(pLFaces, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size); | |
0 | 2467 |
2468 for (uint i = 0, j = 0; i < uNumFaces; ++i) | |
2469 { | |
2470 auto pFace = pFaces + i; | |
2471 | |
1006 | 2472 pFace->pVertexIDs = pLFaces + j; |
0 | 2473 |
2474 j += pFace->uNumVertices + 1; | |
1006 | 2475 pFace->pXInterceptDisplacements = (short *)(pLFaces + j); |
0 | 2476 |
2477 j += pFace->uNumVertices + 1; | |
1006 | 2478 pFace->pYInterceptDisplacements = (short *)(pLFaces + j); |
0 | 2479 |
2480 j += pFace->uNumVertices + 1; | |
1006 | 2481 pFace->pZInterceptDisplacements = (short *)(pLFaces + j); |
0 | 2482 |
2483 j += pFace->uNumVertices + 1; | |
1006 | 2484 pFace->pVertexUIDs = (__int16 *)(pLFaces + j); |
0 | 2485 |
2486 j += pFace->uNumVertices + 1; | |
1006 | 2487 pFace->pVertexVIDs = (__int16 *)(pLFaces + j); |
0 | 2488 |
2489 j += pFace->uNumVertices + 1; | |
2490 /*v93 = &pFaces[v92]; | |
2491 Src = v93; | |
2492 v94 = (BLVSector *)((char *)v244 + 2 * v93->uNumVertices + 2); | |
2493 v95 = (unsigned __int16 *)((char *)v94 + (unsigned int)ptr_2AC); | |
2494 v244 = v94; | |
2495 Src->pXInterceptDisplacements = v95; | |
2496 v96 = (int)&pFaces[v92]; | |
2497 Src = (BLVFace *)v96; | |
2498 v97 = (BLVSector *)((char *)v244 + 2 * *(char *)(v96 + 93) + 2); | |
2499 v98 = (unsigned __int16 *)((char *)v97 + (unsigned int)ptr_2AC); | |
2500 v244 = v97; | |
2501 Src->pYInterceptDisplacements = v98; | |
2502 Src = &pFaces[v92]; | |
2503 v99 = ptr_2AC; | |
2504 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
2505 Src->pZInterceptDisplacements = (unsigned __int16 *)((char *)v99 + (int)v244); | |
2506 Src = &pFaces[v92]; | |
2507 v100 = ptr_2AC; | |
2508 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
2509 Src->pVertexUIDs = (unsigned __int16 *)((char *)v100 + (int)v244); | |
2510 Src = &pFaces[v92]; | |
2511 ++v92; | |
2512 v101 = ptr_2AC; | |
2513 v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); | |
2514 ++v245; | |
2515 Src->pVertexVIDs = (unsigned __int16 *)((char *)v101 + (int)v244); | |
2516 v244 = (BLVSector *)((char *)v244 + 2 * *((char *)&pFaces[v92] - 3) + 2);*/ | |
2517 } | |
2518 | |
2519 pGameLoadingUI_ProgressBar->Progress(); | |
2520 | |
2521 pData += blv.uFaces_fdata_Size; | |
2522 | |
2523 for (uint i = 0; i < uNumFaces; ++i) | |
2524 { | |
2525 auto pFace = pFaces + i; | |
2526 | |
2527 char pTexName[16]; | |
2528 strncpy(pTexName, pData, 10); | |
2529 pData += 10; | |
2530 | |
2531 if (pFace->uAttributes & 0x4000) | |
2532 { | |
2533 pFace->uBitmapID = pTextureFrameTable->FindTextureByName(pTexName); | |
2534 if (pFace->uBitmapID) | |
2535 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pFace->uBitmapID); | |
2536 else | |
2537 { | |
2538 pFace->uBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
2539 pFace->uAttributes &= ~0x4000; | |
2540 } | |
2541 } | |
2542 else | |
2543 pFace->uBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
2544 } | |
2545 | |
2546 pGameLoadingUI_ProgressBar->Progress(); | |
2547 | |
2548 memcpy(&uNumFaceExtras, pData, 4u); | |
2549 memcpy(pFaceExtras, pData += 4, uNumFaceExtras * sizeof(BLVFaceExtra)); | |
2550 pData += uNumFaceExtras * sizeof(BLVFaceExtra); | |
2551 | |
2552 pGameLoadingUI_ProgressBar->Progress(); | |
2553 | |
2554 //v108 = (char *)v107 + 36 * uNumFaceExtras; | |
2555 //v245 = 0; | |
2556 //*(int *)((char *)&uSourceLen + 1) = 0; | |
2557 for (uint i = 0; i < uNumFaceExtras; ++i) | |
2558 { | |
2559 char pTexName[32]; | |
2560 strncpy(pTexName, pData, 10); | |
2561 pData += 10; | |
2562 | |
2563 if (!strcmp(pTexName, "")) | |
2564 pFaceExtras[i].uAdditionalBitmapID = -1; | |
2565 else | |
2566 pFaceExtras[i].uAdditionalBitmapID = pBitmaps_LOD->LoadTexture(pTexName); | |
2567 } | |
2568 | |
2569 | |
2570 for (uint i = 0; i < uNumFaces; ++i) | |
2571 { | |
2572 auto pFace = pFaces + i; | |
2573 auto pFaceExtra = pFaceExtras + pFace->uFaceExtraID; | |
2574 | |
2575 if (pFaceExtra->uEventID) | |
2576 { | |
2577 if (pFaceExtra->HasEventint()) | |
2578 pFace->uAttributes |= 0x100000; | |
2579 else | |
2580 pFace->uAttributes &= ~0x100000; | |
2581 } | |
2582 } | |
2583 | |
2584 pGameLoadingUI_ProgressBar->Progress(); | |
2585 | |
2586 memcpy(&uNumSectors, pData, 4); | |
2587 memcpy(pSectors, pData + 4, uNumSectors * sizeof(BLVSector)); | |
2588 pData += 4 + uNumSectors * sizeof(BLVSector); | |
2589 | |
2590 pGameLoadingUI_ProgressBar->Progress(); | |
2591 | |
2592 ptr_0002B0_sector_rdata = (unsigned short *)pAllocator->AllocNamedChunk(ptr_0002B0_sector_rdata, blv.uSector_rdata_Size, "L.RData"); | |
2593 memcpy(ptr_0002B0_sector_rdata, pData, blv.uSector_rdata_Size); | |
2594 pData += blv.uSector_rdata_Size; | |
2595 | |
2596 for (uint i = 0, j = 0; i < uNumSectors; ++i) | |
2597 { | |
2598 auto pSector = pSectors + i; | |
2599 | |
2600 pSector->pFloors = ptr_0002B0_sector_rdata + j; | |
2601 j += pSector->uNumFloors; | |
2602 | |
2603 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
|
2604 j += pSector->uNumWalls; |
0 | 2605 |
2606 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
|
2607 j += pSector->uNumCeilings; |
0 | 2608 |
2609 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
|
2610 j += pSector->uNumFluids; |
0 | 2611 |
2612 pSector->pPortals = ptr_0002B0_sector_rdata + j; | |
2613 j += pSector->uNumPortals; | |
2614 | |
2615 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
|
2616 j += pSector->uNumFaces; |
0 | 2617 |
2618 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
|
2619 j += pSector->uNumCogs; |
0 | 2620 |
2621 pSector->pDecorationIDs = ptr_0002B0_sector_rdata + j; | |
2622 j += pSector->uNumDecorations; | |
2623 | |
2624 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
|
2625 j += pSector->uNumMarkers; |
0 | 2626 |
2627 | |
2628 //do | |
2629 //{ | |
2630 /*pSectors[v118].pFloors = (unsigned __int16 *)((char *)Src + (unsigned int)ptr_0002B0_sector_rdata); | |
2631 v244 = &pSectors[v118]; | |
2632 v119 = ptr_0002B0_sector_rdata; | |
2633 Src = (BLVFace *)((char *)Src + 2 * v244->field_4); | |
2634 v244->pWalls = (unsigned __int16 *)((char *)v119 + (int)Src); | |
2635 v120 = (int)&pSectors[v118]; | |
2636 v244 = (BLVSector *)v120; | |
2637 v121 = (BLVFace *)((char *)Src + 2 * *(short *)(v120 + 12)); | |
2638 v122 = (unsigned __int16 *)((char *)v121 + (unsigned int)ptr_0002B0_sector_rdata); | |
2639 Src = v121; | |
2640 v244->pCeilings = v122; | |
2641 v123 = (int)&pSectors[v118]; | |
2642 v244 = (BLVSector *)v123; | |
2643 v124 = (BLVFace *)((char *)Src + 2 * *(short *)(v123 + 20)); | |
2644 v125 = (unsigned __int16 *)((char *)v124 + (unsigned int)ptr_0002B0_sector_rdata); | |
2645 Src = v124; | |
2646 v244->pFluids = v125; | |
2647 v244 = &pSectors[v118]; | |
2648 v126 = ptr_0002B0_sector_rdata; | |
2649 Src = (BLVFace *)((char *)Src + 2 * v244->field_1C); | |
2650 v244->pPortals = (unsigned __int16 *)((char *)v126 + (int)Src); | |
2651 v244 = &pSectors[v118]; | |
2652 v127 = ptr_0002B0_sector_rdata; | |
2653 Src = (BLVFace *)((char *)Src + 2 * v244->uNumPortals); | |
2654 v244->pFaceIDs = (unsigned __int16 *)((char *)v127 + (int)Src); | |
2655 v244 = &pSectors[v118]; | |
2656 v128 = ptr_0002B0_sector_rdata; | |
2657 Src = (BLVFace *)((char *)Src + 2 * v244->field_2C); | |
2658 v244->pCogs = (unsigned __int16 *)((char *)v128 + (int)Src); | |
2659 v244 = &pSectors[v118]; | |
2660 v129 = ptr_0002B0_sector_rdata; | |
2661 Src = (BLVFace *)((char *)Src + 2 * v244->field_3C); | |
2662 v244->pDecorationIDs = (unsigned __int16 *)((char *)v129 + (int)Src); | |
2663 v130 = (int)&pSectors[v118]; | |
2664 ++v118; | |
2665 v244 = (BLVSector *)v130; | |
2666 v131 = ptr_0002B0_sector_rdata; | |
2667 Src = (BLVFace *)((char *)Src + 2 * *(short *)(v130 + 68)); | |
2668 ++v245; | |
2669 *(int *)(v130 + 80) = (int)(char *)v131 + (int)Src; | |
2670 Src = (BLVFace *)((char *)Src + 2 * *((short *)&pSectors[v118] - 20));*/ | |
2671 //} | |
2672 //while ( v245 < uNumSectors ); | |
2673 } | |
2674 | |
2675 ptr_0002B8_sector_lrdata = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_0002B8_sector_lrdata, blv.uSector_lrdata_Size, "L.RLData"); | |
2676 memcpy(ptr_0002B8_sector_lrdata, pData, blv.uSector_lrdata_Size); | |
2677 pData += blv.uSector_lrdata_Size; | |
2678 | |
2679 pGameLoadingUI_ProgressBar->Progress(); | |
2680 | |
2681 for (uint i = 0, j = 0; i < uNumSectors; ++i) | |
2682 { | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
2683 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
|
2684 j += pSectors[i].uNumLights; |
0 | 2685 } |
2686 | |
2687 pGameLoadingUI_ProgressBar->Progress(); | |
2688 | |
2689 memcpy(&uNumDoors, pData, 4); | |
2690 pData += 4; | |
2691 | |
2692 pGameLoadingUI_ProgressBar->Progress(); | |
2693 pGameLoadingUI_ProgressBar->Progress(); | |
2694 | |
2695 memcpy(&uNumLevelDecorations, pData, 4); | |
1202 | 2696 memcpy(pLevelDecorations.data(), pData + 4, uNumLevelDecorations * sizeof(LevelDecoration)); |
0 | 2697 pData += 4 + uNumLevelDecorations * sizeof(LevelDecoration); |
2698 | |
2699 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2700 { | |
2701 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pData); | |
2702 | |
2703 pData += 32; | |
2704 } | |
2705 | |
2706 pGameLoadingUI_ProgressBar->Progress(); | |
2707 | |
2708 memcpy(&uNumLights, pData, 4); | |
2709 memcpy(pLights, pData + 4, uNumLights * sizeof(BLVLightMM7)); | |
2710 pData += 4 + uNumLights * sizeof(BLVLightMM7); | |
2711 | |
2712 pGameLoadingUI_ProgressBar->Progress(); | |
2713 pGameLoadingUI_ProgressBar->Progress(); | |
2714 | |
2715 memcpy(&uNumNodes, pData, 4); | |
2716 memcpy(pNodes, pData + 4, uNumNodes * sizeof(BSPNode)); | |
2717 pData += 4 + uNumNodes * sizeof(BSPNode); | |
2718 | |
2719 pGameLoadingUI_ProgressBar->Progress(); | |
2720 pGameLoadingUI_ProgressBar->Progress(); | |
2721 | |
2722 memcpy(&uNumSpawnPoints, pData, 4); | |
2723 pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, uNumSpawnPoints * sizeof(SpawnPointMM7), "Spawn"); | |
2724 memcpy(pSpawnPoints, pData + 4, uNumSpawnPoints * sizeof(SpawnPointMM7)); | |
2725 pData += 4 + uNumSpawnPoints * sizeof(SpawnPointMM7); | |
2726 | |
2727 pGameLoadingUI_ProgressBar->Progress(); | |
2728 pGameLoadingUI_ProgressBar->Progress(); | |
2729 | |
2730 //v201 = (const char *)v148; | |
2731 //v200 = (size_t)pMapOutlines; | |
2732 memcpy(&pMapOutlines->uNumOutlines, pData, 4); | |
2733 memcpy(pMapOutlines->pOutlines, pData + 4, pMapOutlines->uNumOutlines * sizeof(BLVMapOutline)); | |
2734 //v149 = pMapOutlines; | |
2735 //v199 = 12 * *v149; | |
2736 //memcpy(v149 + 1, (const void *)(v148 + 4), v199); | |
2737 free(pRawBLV); | |
2738 pRawBLV = nullptr; | |
2739 | |
2740 void *pRawDLV = nullptr; | |
2741 strcpy(&pFilename[strlen(pFilename) - 4], ".dlv"); | |
2742 File = pNew_LOD->FindContainer(pFilename, 1); | |
2743 fread(&header, 0x10u, 1u, File);//(FILE *)v245); | |
2744 bool _v244 = false; | |
2745 if (header.uVersion != 91969 || | |
2746 header.pMagic[0] != 'm' || | |
2747 header.pMagic[1] != 'v' || | |
2748 header.pMagic[2] != 'i' || | |
2749 header.pMagic[3] != 'i' ) | |
2750 { | |
2751 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1090", 0); | |
2752 _v244 = true; | |
2753 } | |
2754 else | |
2755 { | |
2756 pRawDLV = malloc(header.uDecompressedSize); | |
2757 if (header.uCompressedSize == header.uDecompressedSize) | |
2758 fread(pRawDLV, 1, header.uCompressedSize, File); | |
2759 else if (header.uCompressedSize < header.uDecompressedSize) | |
2760 { | |
2761 auto pTmpMem = malloc(header.uCompressedSize); | |
2762 { | |
2763 fread(pTmpMem, header.uCompressedSize, 1, File); | |
2764 | |
2765 uint uDecompressedSize = header.uDecompressedSize; | |
2766 zlib::MemUnzip(pRawDLV, &uDecompressedSize, pTmpMem, header.uCompressedSize); | |
2767 | |
2768 if (uDecompressedSize != header.uDecompressedSize) | |
2769 Log::Warning(L"uDecompressedSize != header.uDecompressedSize in DLV"); | |
2770 } | |
2771 free(pTmpMem); | |
2772 } | |
2773 else | |
2774 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1108", 0); | |
2775 | |
2776 pData = (char *)pRawDLV; | |
2777 } | |
2778 | |
2779 memcpy(&dlv, pData, 40); | |
2780 pData += 40; | |
2781 | |
2782 //v152 = dlv.uNumFacesInBModels; | |
2783 if (dlv.uNumFacesInBModels) | |
2784 { | |
2785 //v153 = dlv.uNumDecorations; | |
2786 if (dlv.uNumDecorations) | |
2787 { | |
2788 if (dlv.uNumFacesInBModels != uNumFaces || | |
2789 dlv.uNumDecorations != uNumLevelDecorations) | |
2790 _v244 = true; | |
2791 } | |
2792 } | |
2793 | |
2794 if (dword_6BE364_game_settings_1 & 0x2000 ) | |
2795 _i = 29030400; | |
2796 bool _a = false; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2797 if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName.data(), "d29.dlv") ) |
0 | 2798 _a = true; |
2799 | |
2800 //v154 = 875; | |
2801 if (_v244) | |
2802 { | |
2803 memset(v203, 0, 0x36B); | |
2804 goto LABEL_132; | |
2805 } | |
2806 if (_a || !dlv.uLastRepawnDay ) | |
2807 { | |
2808 memcpy(v203, pData, 0x36B); | |
2809 LABEL_132: | |
435 | 2810 free(pRawDLV); |
0 | 2811 dlv.uLastRepawnDay = a3; |
2812 if (_v244) | |
2813 ++dlv.uNumRespawns; | |
2814 //v201 = pFilename; | |
2815 *(int *)pDest = 1; | |
2816 File = pGames_LOD->FindContainer(pFilename, 0); | |
2817 fread(&header, 0x10u, 1u, File); | |
2818 auto v155 = header.uCompressedSize; | |
2819 auto Count = header.uDecompressedSize; | |
2820 auto Src = (BLVFace *)malloc(header.uDecompressedSize); | |
435 | 2821 pRawDLV = Src; |
0 | 2822 if ( v155 <= Count ) |
2823 { | |
2824 if ( v155 == Count ) | |
2825 { | |
2826 fread(Src, 1u, Count, File); | |
2827 } | |
2828 else | |
2829 { | |
2830 auto _uSourceLen = malloc(v155); | |
2831 fread(_uSourceLen, v155, 1u, File); | |
2832 zlib::MemUnzip(Src, &Count, _uSourceLen, v155); | |
2833 free(_uSourceLen); | |
2834 } | |
2835 } | |
2836 else | |
2837 { | |
2838 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0); | |
2839 } | |
2840 pData = ((char *)Src + 40); | |
2841 //v154 = 875; | |
2842 goto LABEL_140; | |
2843 } | |
2844 *(int *)pDest = 0; | |
2845 LABEL_140: | |
2846 //v202 = (int)".blv"; | |
2847 //v156 = strlen(pFilename); | |
2848 strcpy(&pFilename[strlen(pFilename) - 4], ".blv"); | |
2849 memcpy(_visible_outlines, pData, 875); | |
2850 pData += 875; | |
2851 | |
2852 if ( *(int *)pDest ) | |
2853 memcpy(_visible_outlines, v203, 875); | |
2854 | |
2855 for (uint i = 0; i < pMapOutlines->uNumOutlines; ++i) | |
2856 { | |
2857 auto pVertex = pMapOutlines->pOutlines + i; | |
2858 if ((unsigned __int8)(1 << (7 - i % 8)) & _visible_outlines[i / 8]) | |
2859 pVertex->uFlags |= 1; | |
2860 } | |
2861 | |
2862 | |
2863 for (uint i = 0; i < uNumFaces; ++i) | |
2864 { | |
2865 auto pFace = pFaces + i; | |
2866 auto pFaceExtra = pFaceExtras + pFace->uFaceExtraID; | |
2867 | |
2868 memcpy(&pFace->uAttributes, pData, 4); | |
2869 pData += 4; | |
2870 | |
2871 if (pFaceExtra->uEventID) | |
2872 { | |
2873 if (pFaceExtra->HasEventint()) | |
2874 pFace->uAttributes |= 0x100000; | |
2875 else | |
2876 pFace->uAttributes &= ~0x100000; | |
2877 } | |
2878 } | |
2879 | |
2880 pGameLoadingUI_ProgressBar->Progress(); | |
2881 | |
2882 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2883 { | |
2884 memcpy(&pLevelDecorations[i].field_2, pData, 2); | |
2885 pData += 2; | |
2886 } | |
2887 | |
2888 pGameLoadingUI_ProgressBar->Progress(); | |
2889 | |
2890 memcpy(&uNumActors, pData, 4); | |
1202 | 2891 memcpy(pActors.data(), pData + 4, uNumActors * sizeof(Actor)); |
0 | 2892 pData += 4 + uNumActors * sizeof(Actor); |
2893 | |
2894 pGameLoadingUI_ProgressBar->Progress(); | |
2895 pGameLoadingUI_ProgressBar->Progress(); | |
2896 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2897 memcpy(&uNumSpriteObjects, pData, 4); |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2898 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
|
2899 pData += 4 + uNumSpriteObjects * sizeof(SpriteObject); |
0 | 2900 |
2901 pGameLoadingUI_ProgressBar->Progress(); | |
2902 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2903 for (uint i = 0; i < uNumSpriteObjects; ++i) |
0 | 2904 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2905 auto pItem = &pSpriteObjects[i]; |
0 | 2906 |
2907 if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100)) | |
2908 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
2909 pItem->uType = pItemsTable->pItems[pItem->stru_24.uItemID - 1].uSpriteID; |
0 | 2910 |
2911 uint uObjectID = 0; | |
2912 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
|
2913 if (pItem->uType == pObjectList->pObjects[j].uObjectID) |
0 | 2914 { |
2915 pItem->uObjectDescID = j; | |
2916 break; | |
2917 } | |
2918 } | |
2919 } | |
2920 | |
2921 pGameLoadingUI_ProgressBar->Progress(); | |
2922 | |
2923 memcpy(&uNumChests, pData, 4); | |
1202 | 2924 memcpy(pChests.data(), pData + 4, uNumChests * sizeof(Chest)); |
0 | 2925 pData += 4 + uNumChests * sizeof(Chest); |
2926 | |
2927 pGameLoadingUI_ProgressBar->Progress(); | |
2928 pGameLoadingUI_ProgressBar->Progress(); | |
2929 | |
2930 memcpy(pDoors, pData, 0x3E80); | |
2931 pData += 0x3E80; | |
2932 | |
2933 //v201 = (const char *)blv.uDoors_ddata_Size; | |
2934 //v200 = (size_t)ptr_0002B4_doors_ddata; | |
2935 //v170 = pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData"); | |
2936 //v171 = blv.uDoors_ddata_Size; | |
2937 ptr_0002B4_doors_ddata = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData"); | |
2938 memcpy(ptr_0002B4_doors_ddata, pData, blv.uDoors_ddata_Size); | |
2939 pData += blv.uDoors_ddata_Size; | |
2940 | |
2941 //Src = (BLVFace *)((char *)Src + v171); | |
2942 //v172 = 0; | |
2943 //v245 = 0; | |
2944 //if (uNumDoors > 0) | |
2945 for (uint i = 0, j = 0; i < uNumDoors; ++i) | |
2946 { | |
2947 auto pDoor = pDoors + i; | |
2948 | |
2949 pDoor->pVertexIDs = ptr_0002B4_doors_ddata + j; | |
2950 j += pDoor->uNumVertices; | |
2951 | |
2952 pDoor->pFaceIDs = ptr_0002B4_doors_ddata + j; | |
2953 j += pDoor->uNumFaces; | |
2954 | |
2955 pDoor->pSectorIDs = ptr_0002B4_doors_ddata + j; | |
2956 j += pDoor->field_48; | |
2957 | |
2958 pDoor->pDeltaUs = (short *)(ptr_0002B4_doors_ddata + j); | |
2959 j += pDoor->uNumFaces; | |
2960 | |
2961 pDoor->pDeltaVs = (short *)(ptr_0002B4_doors_ddata + j); | |
2962 j += pDoor->uNumFaces; | |
2963 | |
2964 pDoor->pXOffsets = ptr_0002B4_doors_ddata + j; | |
2965 j += pDoor->uNumOffsets; | |
2966 | |
2967 pDoor->pYOffsets = ptr_0002B4_doors_ddata + j; | |
2968 j += pDoor->uNumOffsets; | |
2969 | |
2970 pDoor->pZOffsets = ptr_0002B4_doors_ddata + j; | |
2971 j += pDoor->uNumOffsets; | |
2972 /*v173 = pDoors; | |
2973 for ( k = 0; ; v172 = v188 + 2 * *((short *)&v173[k] - 3) ) | |
2974 { | |
2975 v173[k].pVertexIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v172); | |
2976 v175 = &pDoors[k]; | |
2977 v176 = v172 + 2 * v175->uNumVertices; | |
2978 v175->pFaceIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v176); | |
2979 v177 = &pDoors[k]; | |
2980 v178 = v176 + 2 * v177->uNumFaces; | |
2981 v177->pSectorIDs = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v178); | |
2982 v179 = &pDoors[k]; | |
2983 v180 = v178 + 2 * v179->field_48; | |
2984 v179->pDeltaUs = (__int16 *)((char *)ptr_0002B4_doors_ddata + v180); | |
2985 v181 = &pDoors[k]; | |
2986 v182 = v180 + 2 * v181->uNumFaces; | |
2987 v181->pDeltaVs = (__int16 *)((char *)ptr_0002B4_doors_ddata + v182); | |
2988 v183 = &pDoors[k]; | |
2989 v184 = v182 + 2 * v183->uNumFaces; | |
2990 v183->pXOffsets = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v184); | |
2991 v185 = &pDoors[k]; | |
2992 v186 = v184 + 2 * v185->uNumOffsets; | |
2993 v185->pYOffsets = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v186); | |
2994 v187 = &pDoors[k]; | |
2995 ++k; | |
2996 v188 = v186 + 2 * v187->uNumOffsets; | |
2997 v189 = (unsigned __int16 *)((char *)ptr_0002B4_doors_ddata + v188); | |
2998 ++v245; | |
2999 v187->pZOffsets = v189; | |
3000 v173 = pDoors; | |
3001 if ( v245 >= uNumDoors ) | |
3002 break; | |
3003 }*/ | |
3004 } | |
3005 //v190 = 0; | |
3006 //v245 = 0; | |
3007 for (uint i = 0; i < uNumDoors; ++i) | |
3008 { | |
3009 auto pDoor = pDoors + i; | |
3010 | |
3011 for (uint j = 0; j < pDoor->uNumFaces; ++j) | |
3012 { | |
3013 auto pFace = pFaces + pDoor->pFaceIDs[j]; | |
3014 auto pFaceExtra = pFaceExtras + pFace->uFaceExtraID; | |
3015 | |
3016 pDoor->pDeltaUs[j] = pFaceExtra->sTextureDeltaU; | |
3017 pDoor->pDeltaVs[j] = pFaceExtra->sTextureDeltaV; | |
3018 } | |
3019 //v191 = pDoors; | |
3020 //pDest = 0; | |
3021 //do | |
3022 // { | |
3023 /*Argsn = 0; | |
3024 for ( l = (BLVDoor *)&v190[(int)v191]; | |
3025 Argsn < *(short *)&v190[(int)v191 + 70]; | |
3026 l = (BLVDoor *)&v190[(int)v191] ) | |
3027 { | |
3028 v193 = Argsn; | |
3029 v194 = l->pFaceIDs[Argsn++]; | |
3030 v195 = &pFaceExtras[pFaces[v194].uFaceExtraID]; | |
3031 l->pDeltaUs[v193] = v195->sTextureDeltaU; | |
3032 v190 = pDest; | |
3033 *(short *)(v193 * 2 + *(int *)&pDest[(unsigned int)pDoors + 52]) = v195->sTextureDeltaV; | |
3034 v191 = pDoors; | |
3035 } | |
3036 ++v245; | |
3037 v190 += 80; | |
3038 pDest = v190;*/ | |
3039 //} | |
3040 //while ( v245 < uNumDoors ); | |
3041 } | |
3042 | |
3043 | |
3044 pGameLoadingUI_ProgressBar->Progress(); | |
3045 | |
3046 memcpy(&stru_5E4C90, pData, 0xC8); | |
3047 pData += 0xC8; | |
3048 | |
3049 pGameLoadingUI_ProgressBar->Progress(); | |
3050 | |
3051 memcpy(&stru1, pData, 0x38u); | |
3052 pData += 0x38; | |
3053 | |
3054 free(pRawDLV); | |
3055 //v5 = 0; | |
3056 | |
3057 pSoundList->LoadSound(64, 0); | |
3058 pSoundList->LoadSound(103, 0); | |
3059 pSoundList->LoadSound(63, 0); | |
3060 pSoundList->LoadSound(102, 0); | |
3061 pSoundList->LoadSound(50, 0); | |
3062 pSoundList->LoadSound(89, 0); | |
3063 | |
3064 return 0; | |
3065 } | |
3066 | |
3067 | |
3068 //----- (0049AC17) -------------------------------------------------------- | |
3069 int IndoorLocation::GetSector(int sX, int sY, int sZ) | |
3070 { | |
3071 int v4; // esi@1 | |
3072 //unsigned __int8 v5; // zf@1 | |
3073 //unsigned __int8 v6; // sf@1 | |
3074 //unsigned __int8 v7; // of@1 | |
3075 //BLVSector *v8; // eax@3 | |
3076 //int v9; // edi@9 | |
3077 //int v10; // eax@9 | |
3078 //int v11; // edx@9 | |
3079 //int v12; // eax@10 | |
3080 //unsigned __int16 v13; // ax@12 | |
3081 //int v14; // edi@14 | |
3082 //BLVFace *v15; // eax@14 | |
3083 //BLVFace *v16; // edi@14 | |
3084 //PolygonType v17; // al@14 | |
3085 //unsigned __int16 *pVertexIDs; // esi@16 | |
3086 //Vec3_short_ *v19; // eax@16 | |
3087 //int v20; // edx@16 | |
3088 //unsigned __int16 *v21; // esi@17 | |
3089 //int v22; // edi@19 | |
3090 //int v23; // edi@20 | |
3091 //Vec3_short_ *v24; // edx@20 | |
3092 signed int v25; // edx@21 | |
3093 int v26; // ebx@23 | |
3094 //int v27; // edx@26 | |
3095 //signed __int64 v28; // qtt@26 | |
3096 ///Vec3_short_ *v29; // eax@26 | |
3097 //Vec3_short_ *v30; // edx@26 | |
3098 //int v31; // edx@26 | |
791 | 3099 //signed int v32; // edi@27 |
0 | 3100 signed __int64 v33; // qtt@27 |
3101 //Vec3_short_ *v34; // edx@27 | |
791 | 3102 //int v35; // edx@32 |
0 | 3103 int v37; // edi@38 |
717 | 3104 int pSectorID; // ebx@40 |
0 | 3105 int v39; // eax@41 |
717 | 3106 BLVFace *pFace; // esi@42 |
3107 PolygonType pPolygonType; // dl@42 | |
0 | 3108 int v42; // edx@43 |
3109 int v43[50]; // [sp+Ch] [bp-108h]@1 | |
3110 //int v44; // [sp+D4h] [bp-40h]@9 | |
3111 //int v45; // [sp+D8h] [bp-3Ch]@14 | |
3112 //int v46; // [sp+DCh] [bp-38h]@14 | |
3113 //int v47; // [sp+E0h] [bp-34h]@19 | |
3114 //int v48; // [sp+E4h] [bp-30h]@9 | |
3115 //Vec3_short_ *v49; // [sp+E8h] [bp-2Ch]@19 | |
3116 bool v50; // [sp+ECh] [bp-28h]@19 | |
3117 int v51; // [sp+F0h] [bp-24h]@9 | |
3118 //unsigned int v52; // [sp+F4h] [bp-20h]@2 | |
3119 int v53; // [sp+F8h] [bp-1Ch]@10 | |
3120 int v54; // [sp+FCh] [bp-18h]@16 | |
3121 int v55; // [sp+100h] [bp-14h]@1 | |
3122 int v56; // [sp+104h] [bp-10h]@1 | |
3123 int v57; // [sp+108h] [bp-Ch]@16 | |
3124 //Vec3_short_ *v58; // [sp+10Ch] [bp-8h]@20 | |
3125 int v59; // [sp+110h] [bp-4h]@16 | |
3126 | |
3127 v4 = 0; | |
791 | 3128 v43[0] = 0; |
3129 | |
0 | 3130 v55 = 0; |
791 | 3131 |
0 | 3132 if (uNumSectors < 2) |
3133 return 0; | |
3134 | |
3135 for (uint i = 1; i < uNumSectors; ++i) | |
3136 { | |
3137 auto pSector = pSectors + i; | |
3138 | |
791 | 3139 if (pSector->pBounding.x1 > sX || pSector->pBounding.x2 < sX || |
3140 pSector->pBounding.y1 > sY || pSector->pBounding.y2 < sY || | |
3141 pSector->pBounding.z1 - 64 > sZ || pSector->pBounding.z2 + 64 < sZ) | |
3142 continue; | |
3143 | |
618
5cfb5dadf330
Margareth righ-click (addded constructor to NPCProfession) and cleaned BLV debug logs
Nomad
parents:
595
diff
changeset
|
3144 //Log::Warning(L"Sector[%u]", i); |
791 | 3145 v51 = pSector->uNumFloors + pSector->uNumPortals; |
3146 if (!v51) | |
3147 continue; | |
3148 | |
3149 | |
3150 for (uint j = 0; j < v51; ++j) | |
3151 { | |
3152 uint uFaceID; | |
3153 if (j < pSector->uNumFloors) | |
3154 uFaceID = pSector->pFloors[j]; | |
3155 else | |
3156 uFaceID = pSector->pPortals[j - pSector->uNumFloors]; | |
3157 | |
3158 auto pFace = pFaces + uFaceID; | |
3159 if (pFace->uPolygonType != POLYGON_Floor && | |
3160 pFace->uPolygonType != POLYGON_InBetweenFloorAndWall) | |
3161 continue; | |
3162 | |
3163 v54 = 0; | |
3164 v50 = pVertices[pFace->pVertexIDs[0]].y >= sY; | |
3165 | |
793 | 3166 for (uint k = 1; k <= pFace->uNumVertices; k++) |
791 | 3167 { |
3168 v59 = v50; | |
3169 | |
3170 if (v54 >= 2) | |
3171 break; | |
3172 | |
3173 auto v2 = &pVertices[pFace->pVertexIDs[k]]; | |
3174 v50 = v2->y >= sY; | |
3175 | |
793 | 3176 if (v59 == v50) |
791 | 3177 continue; |
3178 | |
3179 auto v1 = &pVertices[pFace->pVertexIDs[k - 1]]; | |
3180 v25 = v2->x >= sX ? 0 : 2; | |
3181 v26 = v25 | (v1->x < sX); | |
3182 | |
3183 if (v26 == 3) | |
3184 continue; | |
3185 | |
3186 if (!v26) | |
3187 ++v54; | |
3188 else | |
3189 { | |
3190 if (v1->x >= v2->x) | |
3191 { | |
3192 /*int _a58; | |
0 | 3193 int _a59; |
3194 | |
3195 v32 = v1->x - v2->x; | |
3196 LODWORD(v33) = v32 << 16; | |
791 | 3197 HIDWORD(v33) = v32 >> 16;*/ |
3198 //fixpoint_div(v1->x - v2->x, v1->y - v2->y); | |
3199 //_a58 = v33 / (v1->y - v2->y); | |
871 | 3200 //_a59 = fixpoint_sub0(_a58, sY - v2->y); |
791 | 3201 auto x_div_y = fixpoint_div(v1->x - v2->x, v1->y - v2->y); |
871 | 3202 auto res = fixpoint_sub0(x_div_y, sY - v2->y); // a / b * c - looks like projection |
793 | 3203 if (res + v2->x > sX) |
791 | 3204 ++v54; |
3205 } | |
3206 else | |
3207 { | |
3208 auto x_div_y = fixpoint_div(v2->x - v1->x, v2->y - v1->y); | |
871 | 3209 auto res = fixpoint_sub0(x_div_y, sY - v1->y); |
791 | 3210 |
3211 if (res + v1->x > sX) | |
3212 ++v54; | |
3213 | |
3214 /*int _a58; | |
0 | 3215 int _a59; |
791 | 3216 auto v32 = v2->x - v1->x; |
0 | 3217 LODWORD(v33) = v32 << 16; |
3218 HIDWORD(v33) = v32 >> 16; | |
3219 _a58 = v33 / (v2->y - v1->y); | |
871 | 3220 _a59 = fixpoint_sub0(_a58, sY - v1->y); |
0 | 3221 |
787 | 3222 if (_a59 + pVertices[k].x > sX) |
791 | 3223 ++v54;*/ |
0 | 3224 } |
717 | 3225 } |
791 | 3226 } |
3227 | |
3228 if (pFace->uNumVertices && v54 == 1) | |
3229 v43[v55++] = uFaceID; | |
3230 } | |
0 | 3231 } |
3232 | |
791 | 3233 v4 = v43[0]; |
0 | 3234 if ( v55 == 1 ) |
3235 return this->pFaces[v4].uSectorID; | |
3236 v37 = 0; | |
3237 if ( !v55 ) | |
3238 return 0; | |
717 | 3239 pSectorID = 0; |
0 | 3240 v53 = 0xFFFFFFu; |
3241 if ( v55 > 0 ) | |
3242 { | |
3243 v39 = sY; | |
3244 while ( 1 ) | |
3245 { | |
717 | 3246 pFace = &this->pFaces[v43[v37]]; |
3247 //pPolygonType = pFace->uPolygonType; | |
3248 if ( pFace->uPolygonType == POLYGON_Floor ) | |
0 | 3249 { |
717 | 3250 v42 = this->pVertices[*pFace->pVertexIDs].z; |
3251 v39 = sZ - v42; | |
3252 //goto LABEL_47; | |
3253 } | |
3254 if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall ) | |
3255 { | |
3256 //v51 = pFace->zCalc1; | |
3257 v57 = (unsigned __int64)(pFace->zCalc1 * (signed __int64)(sX << 16)) >> 16; | |
3258 //v56 = sY << 16; | |
3259 //v51 = pFace->zCalc2; | |
3260 v56 = (unsigned __int64)(pFace->zCalc2 * (signed __int64)(sY << 16)) >> 16; | |
3261 v42 = (v56 + pFace->zCalc3 + v57 + 32768) >> 16; | |
662 | 3262 v39 = sZ - v42; |
0 | 3263 } |
717 | 3264 //LABEL_47: |
0 | 3265 if ( v39 >= 0 ) |
3266 { | |
3267 if ( v39 < v53 ) | |
3268 { | |
717 | 3269 pSectorID = pFace->uSectorID; |
0 | 3270 v53 = v39; |
3271 } | |
3272 } | |
3273 ++v37; | |
3274 if ( v37 >= v55 ) | |
717 | 3275 return pSectorID; |
0 | 3276 } |
3277 } | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1104
diff
changeset
|
3278 return pSectorID; |
0 | 3279 } |
3280 // 49AC17: using guessed type int var_108[50]; | |
3281 | |
3282 | |
3283 //----- (00498A41) -------------------------------------------------------- | |
3284 char BLVFace::_get_normals(Vec3_int_ *a2, Vec3_int_ *a3) | |
3285 { | |
3286 BLVFace *v3; // ebx@1 | |
3287 int v4; // eax@1 | |
3288 signed __int64 v5; // qax@2 | |
3289 double v6; // st7@8 | |
3290 Vec3_float_ a1; // [sp+Ch] [bp-Ch]@8 | |
3291 | |
3292 v3 = this; | |
3293 LOBYTE(v4) = this->uPolygonType; | |
3294 if ( (char)v4 == POLYGON_VerticalWall ) | |
3295 { | |
3296 a2->x = -this->pFacePlane_old.vNormal.y; | |
3297 LODWORD(v5) = this->pFacePlane_old.vNormal.x; | |
3298 LABEL_9: | |
3299 a2->y = v5; | |
3300 v4 = 0; | |
3301 a2->z = 0; | |
3302 a3->y = 0; | |
3303 a3->z = 0xFFFF0000u; | |
3304 LABEL_11: | |
3305 a3->x = v4; | |
3306 goto LABEL_12; | |
3307 } | |
3308 if ( (char)v4 == POLYGON_Floor || (char)v4 == POLYGON_Ceiling ) | |
3309 { | |
3310 LABEL_10: | |
3311 v4 = 0; | |
3312 a2->x = 0x10000u; | |
3313 a2->z = 0; | |
3314 a2->y = 0; | |
3315 a3->y = 0xFFFF0000u; | |
3316 a3->z = 0; | |
3317 goto LABEL_11; | |
3318 } | |
3319 if ( (char)v4 == POLYGON_InBetweenFloorAndWall || (char)v4 == POLYGON_InBetweenCeilingAndWall ) | |
3320 { | |
3321 if ( abs(this->pFacePlane_old.vNormal.z) < 46441 ) | |
3322 { | |
3323 a1.x = (double)-v3->pFacePlane_old.vNormal.y; | |
3324 a1.y = (double)v3->pFacePlane_old.vNormal.x; | |
3325 a1.z = 0.0; | |
3326 a1.Normalize(); | |
3327 v6 = a1.y * 65536.0; | |
3328 a2->x = (signed __int64)(a1.x * 65536.0); | |
3329 v5 = (signed __int64)v6; | |
3330 goto LABEL_9; | |
3331 } | |
3332 goto LABEL_10; | |
3333 } | |
3334 LABEL_12: | |
3335 if ( BYTE2(v3->uAttributes) & 0x80 ) | |
3336 { | |
3337 a2->x = -a2->x; | |
3338 a2->y = -a2->y; | |
3339 a2->z = -a2->z; | |
3340 } | |
3341 if ( BYTE3(v3->uAttributes) & 1 ) | |
3342 { | |
3343 a3->x = -a3->x; | |
3344 a3->y = -a3->y; | |
3345 a3->z = -a3->z; | |
3346 } | |
3347 return v4; | |
3348 } | |
3349 | |
3350 //----- (0044C23B) -------------------------------------------------------- | |
428 | 3351 bool BLVFaceExtra::HasEventint() |
3352 { | |
3353 signed int event_index; // eax@1 | |
3354 _evt_raw* start_evt; | |
3355 _evt_raw* end_evt; | |
3356 | |
3357 event_index = 0; | |
3358 if ( (uLevelEVT_NumEvents - 1) <= 0 ) | |
3359 return false; | |
3360 while ( pLevelEVT_Index[event_index].uEventID != this->uEventID ) | |
0 | 3361 { |
428 | 3362 ++event_index; |
3363 if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) | |
3364 return false; | |
0 | 3365 } |
428 | 3366 end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; |
3367 start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
3368 if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) | |
3369 return false; | |
0 | 3370 else |
428 | 3371 return true; |
0 | 3372 } |
3373 | |
3374 | |
3375 | |
3376 | |
3377 //----- (0046F228) -------------------------------------------------------- | |
3378 void __cdecl BLV_UpdateDoors() | |
3379 { | |
472 | 3380 //int v0; // ebx@1 |
3381 //int v1; // edi@1 | |
3382 //BLVDoor *v2; // esi@3 | |
3383 //unsigned __int16 v3; // ax@3 | |
3384 //unsigned int v4; // ecx@5 | |
3385 //int v5; // eax@8 | |
3386 //int v6; // ecx@8 | |
3387 //int v7; // eax@12 | |
3388 //int v8; // eax@16 | |
3389 //unsigned __int8 v9; // zf@18 | |
3390 //char v10; // sf@18 | |
3391 //unsigned __int8 v11; // of@18 | |
3392 //int v12; // edi@19 | |
3393 //int v13; // ecx@19 | |
3394 //__int16 v14; // ax@19 | |
0 | 3395 BLVFace *v15; // ebx@24 |
472 | 3396 //unsigned __int16 *v16; // ecx@24 |
0 | 3397 Vec3_short_ *v17; // esi@24 |
3398 int v18; // eax@24 | |
3399 int v19; // edx@24 | |
3400 signed int v20; // eax@24 | |
472 | 3401 //Vec3_short_ *v21; // ecx@24 |
3402 //double v22; // st7@24 | |
3403 //double v23; // st6@24 | |
0 | 3404 int v24; // esi@25 |
3405 int v25; // eax@25 | |
472 | 3406 //BLVDoor *v26; // edi@25 |
0 | 3407 signed __int64 v27; // qtt@27 |
3408 BLVFaceExtra *v28; // esi@32 | |
3409 int v29; // ecx@34 | |
3410 int v30; // edx@34 | |
3411 unsigned __int64 v31; // qax@34 | |
3412 int v32; // eax@34 | |
472 | 3413 //unsigned __int16 *v33; // eax@35 |
0 | 3414 Vec3_short_ *v34; // eax@35 |
3415 int v35; // ecx@35 | |
3416 int v36; // edx@35 | |
3417 signed int v37; // eax@35 | |
3418 signed int v38; // edx@35 | |
3419 int v39; // eax@35 | |
3420 int v40; // edx@35 | |
472 | 3421 //unsigned __int8 v41; // cf@35 |
3422 //unsigned __int16 *v42; // edi@36 | |
0 | 3423 Vec3_short_ *v43; // edi@36 |
472 | 3424 //int v44; // ecx@36 |
3425 //int v45; // edi@36 | |
3426 //int v46; // ecx@36 | |
3427 //__int16 *v47; // edx@44 | |
3428 //int v48; // ecx@44 | |
0 | 3429 unsigned int v49; // ecx@46 |
3430 unsigned __int16 v50; // ax@48 | |
3431 unsigned int v51; // eax@51 | |
3432 unsigned __int16 v52; // ax@54 | |
3433 int v53; // ecx@57 | |
472 | 3434 //int v54; // edx@57 |
0 | 3435 unsigned __int64 v55; // qax@57 |
3436 int v56; // ecx@58 | |
3437 int v57; // eax@58 | |
472 | 3438 //int v58; // eax@59 |
3439 //SoundID v59; // [sp-24h] [bp-88h]@12 | |
3440 //signed int v60; // [sp-20h] [bp-84h]@12 | |
3441 //unsigned int v61; // [sp-1Ch] [bp-80h]@12 | |
3442 //signed int v62; // [sp-18h] [bp-7Ch]@12 | |
3443 //signed int v63; // [sp-14h] [bp-78h]@12 | |
3444 //int v64; // [sp-10h] [bp-74h]@12 | |
3445 //unsigned int v65; // [sp-Ch] [bp-70h]@12 | |
3446 //int v66; // [sp-8h] [bp-6Ch]@12 | |
3447 Vec3_int_ v67; | |
3448 //int v67; // [sp+8h] [bp-5Ch]@31 | |
3449 //int v68; // [sp+Ch] [bp-58h]@34 | |
3450 //int v69; // [sp+10h] [bp-54h]@34 | |
3451 Vec3_int_ v70; | |
3452 //int v70; // [sp+14h] [bp-50h]@31 | |
3453 //int v71; // [sp+18h] [bp-4Ch]@34 | |
3454 //int v72; // [sp+1Ch] [bp-48h]@34 | |
0 | 3455 int v73; // [sp+20h] [bp-44h]@24 |
472 | 3456 //__int16 v74; // [sp+24h] [bp-40h]@24 |
0 | 3457 int v75; // [sp+28h] [bp-3Ch]@36 |
3458 int v76; // [sp+2Ch] [bp-38h]@36 | |
3459 int v77; // [sp+30h] [bp-34h]@36 | |
472 | 3460 //int v78; // [sp+34h] [bp-30h]@36 |
3461 //int v79; // [sp+38h] [bp-2Ch]@19 | |
3462 //unsigned int v80; // [sp+3Ch] [bp-28h]@2 | |
3463 //int v81; // [sp+40h] [bp-24h]@1 | |
0 | 3464 int v82; // [sp+44h] [bp-20h]@35 |
3465 int v83; // [sp+48h] [bp-1Ch]@34 | |
3466 int v84; // [sp+4Ch] [bp-18h]@34 | |
3467 int v85; // [sp+50h] [bp-14h]@19 | |
3468 SoundID eDoorSoundID; // [sp+54h] [bp-10h]@1 | |
472 | 3469 //BLVDoor *v87; // [sp+58h] [bp-Ch]@3 |
0 | 3470 int v88; // [sp+5Ch] [bp-8h]@18 |
3471 int v89; // [sp+60h] [bp-4h]@6 | |
3472 | |
472 | 3473 //v0 = 0; |
3474 //v1 = 0; | |
0 | 3475 eDoorSoundID = (SoundID)pDoorSoundIDsByLocationID[dword_6BE13C_uCurrentlyLoadedLocationID]; |
472 | 3476 //v81 = 0; |
3477 //if ( pIndoor->uNumDoors > 0 ) | |
3478 for (uint i = 0; i < pIndoor->uNumDoors; ++i) | |
0 | 3479 { |
472 | 3480 auto door = pIndoor->pDoors + i; |
3481 //v80 = 0; | |
3482 //do | |
3483 //{ | |
3484 //v2 = &pIndoor->pDoors[v80 / 0x50]; | |
3485 //v87 = &pIndoor->pDoors[v80 / 0x50]; | |
3486 //v3 = door->uState; | |
3487 if (door->uState == BLVDoor::Closed || door->uState == BLVDoor::Open) | |
0 | 3488 { |
472 | 3489 door->uAttributes &= 0xFFFFFFFDu; |
0 | 3490 goto LABEL_62; |
3491 } | |
472 | 3492 door->uTimeSinceTriggered += pEventTimer->uTimeElapsed; |
3493 //v4 = door->uTimeSinceTriggered; | |
3494 if (door->uState == BLVDoor::Opening) | |
0 | 3495 { |
472 | 3496 v89 = (signed int)(door->uTimeSinceTriggered * door->uCloseSpeed) / 128; |
3497 if ( v89 >= door->uMoveLength ) | |
0 | 3498 { |
472 | 3499 v89 = door->uMoveLength; |
3500 door->uState = BLVDoor::Open; | |
0 | 3501 LABEL_10: |
472 | 3502 if ( !(door->uAttributes & 6) && door->uNumVertices != 0) |
0 | 3503 { |
472 | 3504 //v66 = 0; |
3505 //v65 = 0; | |
3506 //v64 = 0; | |
862 | 3507 //v7 = PID(OBJECT_BLVDoor,i); |
472 | 3508 //v63 = 0; |
3509 //v62 = -1; | |
862 | 3510 //LOBYTE(v7) = PID(OBJECT_BLVDoor,i); |
472 | 3511 //v61 = 0; |
862 | 3512 //v60 = PID(OBJECT_BLVDoor,i); |
472 | 3513 //v59 = (SoundID)((int)eDoorSoundID + 1); |
3514 //LABEL_17: | |
862 | 3515 pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), PID(OBJECT_BLVDoor,i), 0, -1, 0, 0, 0, 0); |
472 | 3516 //goto LABEL_18; |
0 | 3517 } |
3518 goto LABEL_18; | |
3519 } | |
3520 } | |
3521 else | |
3522 { | |
472 | 3523 auto v5 = (signed int)(door->uTimeSinceTriggered * door->uOpenSpeed) / 128; |
3524 //v6 = door->uMoveLength; | |
3525 if ( v5 >= door->uMoveLength) | |
0 | 3526 { |
472 | 3527 v89 = 0; |
3528 door->uState = BLVDoor::Closed; | |
0 | 3529 goto LABEL_10; |
3530 } | |
472 | 3531 v89 = door->uMoveLength - v5; |
0 | 3532 } |
472 | 3533 if ( !(door->uAttributes & 6) && door->uNumVertices) |
0 | 3534 { |
472 | 3535 //v66 = 0; |
3536 //v65 = 0; | |
3537 //v64 = 0; | |
862 | 3538 //v8 = PID(OBJECT_BLVDoor,i); |
472 | 3539 //v63 = 0; |
3540 //v62 = -1; | |
3541 //LOBYTE(v8) = 8 * v1 | 1; | |
3542 //v61 = 1; | |
862 | 3543 //v60 = PID(OBJECT_BLVDoor,i); |
472 | 3544 //v59 = eDoorSoundID; |
862 | 3545 pAudioPlayer->PlaySound(eDoorSoundID, PID(OBJECT_BLVDoor,i), 1, -1, 0, 0, 0, 0); |
472 | 3546 //goto LABEL_18; |
0 | 3547 } |
3548 LABEL_18: | |
472 | 3549 //v11 = __OFSUB__(v2->uNumVertices, 0); |
3550 //v9 = v2->uNumVertices == 0; | |
3551 //v10 = (signed __int16)(v2->uNumVertices - 0) < 0; | |
3552 //v88 = 0; | |
3553 //if (door->uNumVertices > 0) | |
3554 for (uint j = 0; j < door->uNumVertices; ++j) | |
0 | 3555 { |
472 | 3556 //do |
3557 //{ | |
3558 //v12 = v88; | |
3559 //v13 = door->pVertexIDs[v88]; | |
3560 //v85 = v89; | |
3561 //v79 = door->vDirection.x; | |
3562 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
3563 //v13 *= 6; | |
3564 pIndoor->pVertices[door->pVertexIDs[j]].x = ((unsigned int)(door->vDirection.x * v89) >> 16) + door->pXOffsets[j]; | |
3565 //v85 = v89; | |
3566 //v79 = door->vDirection.y; | |
3567 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
3568 pIndoor->pVertices[door->pVertexIDs[j]].y = ((unsigned int)(door->vDirection.y * v89) >> 16) + door->pYOffsets[j]; | |
3569 //v85 = v89; | |
3570 //v79 = door->vDirection.z; | |
3571 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | |
3572 //v14 = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; | |
3573 pIndoor->pVertices[door->pVertexIDs[j]].z = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; | |
3574 //++v88; | |
3575 //} | |
3576 //while ( v88 < door->uNumVertices ); | |
3577 //v1 = v81; | |
0 | 3578 } |
472 | 3579 //v11 = __OFSUB__(v2->uNumFaces, 0); |
3580 //v9 = v2->uNumFaces == 0; | |
3581 //v10 = (signed __int16)(v2->uNumFaces - 0) < 0; | |
3582 v88 = 0; | |
3583 if (door->uNumFaces > 0) | |
0 | 3584 { |
3585 while ( 1 ) | |
3586 { | |
472 | 3587 v15 = &pIndoor->pFaces[door->pFaceIDs[v88]]; |
3588 //v16 = v15->pVertexIDs; | |
3589 v17 = &pIndoor->pVertices[v15->pVertexIDs[0]]; | |
0 | 3590 v18 = v15->pFacePlane_old.vNormal.y; |
3591 v73 = *(int *)&v17->x; | |
472 | 3592 //v74 = v17->z; |
0 | 3593 v19 = v15->pFacePlane_old.vNormal.z; |
472 | 3594 v20 = -(v19 * (int)v17->z + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); |
0 | 3595 v15->pFacePlane_old.dist = v20; |
472 | 3596 //v21 = &pIndoor->pVertices[v15->pVertexIDs[0]]; |
3597 //v79 = v21->x; | |
3598 //v22 = (double)v21->x; | |
3599 //v23 = (double)v21->y; | |
3600 //v79 = v21->z; | |
3601 v15->pFacePlane.dist = -((double)v17->z * v15->pFacePlane.vNormal.z | |
3602 + (double)v17->y * v15->pFacePlane.vNormal.y | |
3603 + (double)v17->x * v15->pFacePlane.vNormal.x); | |
0 | 3604 if ( v19 ) |
3605 { | |
3606 v24 = abs(v20 >> 15); | |
3607 v25 = abs(v15->pFacePlane_old.vNormal.z); | |
472 | 3608 //v26 = v87; |
0 | 3609 if ( v24 > v25 ) |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3610 Abortf("Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", |
472 | 3611 door->uDoorID, |
3612 door->pFaceIDs[v88], | |
0 | 3613 v15->pFacePlane_old.dist, |
3614 v15->pFacePlane_old.vNormal.z); | |
472 | 3615 //v79 = v15->pFacePlane_old.vNormal.z; |
3616 //v85 = v15->pFacePlane_old.dist; | |
3617 LODWORD(v27) = v15->pFacePlane_old.dist << 16; | |
3618 HIDWORD(v27) = v15->pFacePlane_old.dist >> 16; | |
3619 //v85 = v27 / v15->pFacePlane_old.vNormal.z; | |
3620 v15->zCalc3 = -v27 / v15->pFacePlane_old.vNormal.z; | |
0 | 3621 } |
472 | 3622 /*else |
0 | 3623 { |
3624 v26 = v87; | |
472 | 3625 }*/ |
0 | 3626 if ( BYTE2(v15->uAttributes) & 4 || pRenderer->pRenderD3D ) |
472 | 3627 v15->_get_normals(&v70, &v67); |
0 | 3628 v28 = &pIndoor->pFaceExtras[v15->uFaceExtraID]; |
3629 if ( !pRenderer->pRenderD3D ) | |
3630 { | |
3631 if ( !(BYTE2(v15->uAttributes) & 4) ) | |
3632 goto LABEL_59; | |
472 | 3633 //v79 = door->vDirection.x; |
3634 v83 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; | |
3635 //v85 = v71; | |
3636 //v79 = door->vDirection.y; | |
3637 v85 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; | |
3638 //v84 = v72; | |
3639 //v79 = door->vDirection.z; | |
3640 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; | |
3641 //v79 = v83 + v85 + v84; | |
0 | 3642 v29 = v89; |
472 | 3643 //v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; |
3644 v28->sTextureDeltaU = -((v83 + v85 + v84) * (signed __int64)v89) >> 16; | |
3645 //v79 = door->vDirection.x; | |
3646 v85 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; | |
3647 //v83 = v68; | |
3648 //v79 = door->vDirection.y; | |
3649 v83 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; | |
3650 //v84 = v69; | |
3651 //v79 = door->vDirection.z; | |
3652 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; | |
3653 //v30 = v83 + v84; | |
3654 //v79 = v85 + v30; | |
3655 v31 = (v85 + v83 + v84) * (signed __int64)v29; | |
3656 //v83 = v31 >> 16; | |
0 | 3657 v32 = v31 >> 16; |
3658 goto LABEL_58; | |
3659 } | |
3660 v28->sTextureDeltaU = 0; | |
3661 v28->sTextureDeltaV = 0; | |
472 | 3662 //v33 = v15->pVertexIDs; |
3663 //v85 = 1; | |
3664 v34 = &pIndoor->pVertices[v15->pVertexIDs[0]]; | |
0 | 3665 v35 = v34->z; |
3666 v36 = v34->y; | |
3667 v82 = v34->x; | |
472 | 3668 //v79 = v36; |
3669 v37 = v70.x * v82 + v70.y * v36 + v70.z * v35; | |
3670 v38 = v67.x * v82 + v67.y * v36 + v67.z * v35; | |
0 | 3671 v39 = v37 >> 16; |
3672 *v15->pVertexUIDs = v39; | |
3673 v40 = v38 >> 16; | |
3674 *v15->pVertexVIDs = v40; | |
472 | 3675 //v41 = v15->uNumVertices < 1u; |
3676 //v9 = v15->uNumVertices == 1; | |
3677 //v83 = v40; | |
0 | 3678 v84 = v39; |
3679 v82 = v40; | |
472 | 3680 //if (v15->uNumVertices > 1) |
3681 for (uint j = 1; j < v15->uNumVertices; ++j) | |
0 | 3682 { |
472 | 3683 //do |
3684 //{ | |
3685 //v42 = v15->pVertexIDs; | |
3686 //v75 = 2 * v85; | |
3687 v43 = &pIndoor->pVertices[v15->pVertexIDs[j]]; | |
3688 //v79 = v43->z; | |
3689 //v44 = v43->y; | |
3690 //v45 = v43->x; | |
3691 //v78 = v43->y; | |
3692 v76 = ((__int64)v70.z * v43->z + (__int64)v70.x * v43->x + (__int64)v70.y * v43->y) >> 16; | |
3693 //v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; | |
3694 v77 = ((__int64)v67.x * v43->x + (__int64)v67.y * v43->y + (__int64)v43->z * v67.z) >> 16; | |
0 | 3695 if ( v76 < v39 ) |
3696 v39 = v76; | |
472 | 3697 if ( v77 < v40 ) |
3698 v40 = v77; | |
0 | 3699 if ( v76 > v84 ) |
3700 v84 = v76; | |
472 | 3701 if ( v77 > v82 ) |
3702 v82 = v77; | |
3703 //v40 = v83; | |
3704 //v47 = v15->pVertexUIDs; | |
3705 //v48 = v75; | |
3706 //++v85; | |
3707 v15->pVertexUIDs[j] = v76; | |
3708 v15->pVertexVIDs[j] = v77; | |
3709 //} | |
3710 //while ( v85 < v15->uNumVertices ); | |
3711 //v26 = v87; | |
0 | 3712 } |
3713 v49 = v15->uAttributes; | |
3714 if ( BYTE1(v49) & 0x10 ) | |
3715 goto LABEL_50; | |
3716 if ( SBYTE1(v49) < 0 ) | |
3717 { | |
3718 v50 = v15->uBitmapID; | |
3719 if ( v50 != -1 ) | |
3720 break; | |
3721 } | |
3722 LABEL_51: | |
3723 v51 = v15->uAttributes; | |
3724 if ( v51 & 8 ) | |
3725 { | |
3726 v28->sTextureDeltaV -= v40; | |
3727 } | |
3728 else | |
3729 { | |
3730 if ( v51 & 0x20000 ) | |
3731 { | |
3732 v52 = v15->uBitmapID; | |
3733 if ( v52 != -1 ) | |
945 | 3734 v28->sTextureDeltaV -= v82 + pBitmaps_LOD->GetTexture(v52)->uTextureHeight; |
0 | 3735 } |
3736 } | |
3737 if ( BYTE2(v15->uAttributes) & 4 ) | |
3738 { | |
472 | 3739 //v75 = door->vDirection.x; |
3740 v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; | |
3741 //v82 = v71; | |
3742 //v75 = door->vDirection.y; | |
3743 v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; | |
3744 //v83 = v72; | |
3745 //v75 = door->vDirection.z; | |
3746 v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; | |
3747 v75 = v84 + v82 + v83; | |
0 | 3748 v53 = v89; |
3749 v82 = (unsigned __int64)(v75 * (signed __int64)v89) >> 16; | |
472 | 3750 v28->sTextureDeltaU = -v82; |
3751 //v75 = door->vDirection.x; | |
3752 v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; | |
3753 //v82 = v68; | |
3754 //v75 = door->vDirection.y; | |
3755 v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; | |
3756 //v83 = v69; | |
3757 //v75 = door->vDirection.z; | |
3758 v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; | |
3759 //v54 = v82 + v83; | |
3760 v75 = v84 + v82 + v83; | |
3761 v55 = v75 * (signed __int64)v53; | |
3762 //v82 = v55 >> 16; | |
0 | 3763 v32 = v55 >> 16; |
3764 LABEL_58: | |
3765 v56 = v88; | |
3766 v57 = -v32; | |
3767 v28->sTextureDeltaV = v57; | |
472 | 3768 v28->sTextureDeltaU += door->pDeltaUs[v56]; |
3769 v28->sTextureDeltaV = v57 + door->pDeltaVs[v56]; | |
0 | 3770 } |
3771 LABEL_59: | |
472 | 3772 //v58 = door->uNumFaces; |
0 | 3773 ++v88; |
472 | 3774 if ( v88 >= door->uNumFaces) |
0 | 3775 { |
472 | 3776 //v1 = v81; |
3777 //v0 = 0; | |
0 | 3778 goto LABEL_62; |
3779 } | |
472 | 3780 //v2 = v87; |
0 | 3781 } |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3782 LOWORD(v39) = v84; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3783 if (v15->uBitmapID != -1) |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
520
diff
changeset
|
3784 LOWORD(v39) += pBitmaps_LOD->pTextures[v15->uBitmapID].uTextureWidth; |
0 | 3785 LABEL_50: |
3786 v28->sTextureDeltaU -= v39; | |
3787 goto LABEL_51; | |
3788 } | |
3789 LABEL_62: | |
472 | 3790 ; |
3791 //v80 += 80; | |
3792 //++v1; | |
3793 //v81 = v1; | |
3794 //} | |
3795 //while ( v1 < pIndoor->uNumDoors ); | |
0 | 3796 } |
3797 } | |
3798 // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID; | |
3799 | |
3800 //----- (0046F90C) -------------------------------------------------------- | |
3801 void __cdecl UpdateActors_BLV() | |
3802 { | |
3803 Actor *v0; // esi@2 | |
3804 unsigned __int16 v1; // ax@2 | |
3805 int v2; // edi@6 | |
3806 int v3; // eax@6 | |
3807 int v4; // eax@8 | |
3808 __int16 v5; // ax@11 | |
3809 signed int v6; // ebx@14 | |
3810 unsigned __int8 v7; // zf@14 | |
3811 unsigned __int8 v8; // sf@14 | |
3812 signed __int16 v9; // ax@17 | |
3813 signed __int64 v10; // qax@18 | |
3814 unsigned __int16 v11; // ax@21 | |
3815 int v12; // eax@29 | |
3816 unsigned __int64 v13; // qax@29 | |
3817 int v14; // eax@30 | |
3818 unsigned __int64 v15; // qax@30 | |
3819 int v16; // ecx@33 | |
3820 BLVFace *v17; // edx@33 | |
3821 int v18; // ecx@33 | |
3822 BLVFace *v19; // eax@34 | |
3823 int v20; // ecx@46 | |
3824 int v21; // eax@46 | |
3825 int v22; // edi@46 | |
3826 int v23; // eax@48 | |
3827 unsigned int v24; // eax@51 | |
3828 int v25; // eax@52 | |
3829 int v26; // ebx@54 | |
3830 int v27; // ST08_4@54 | |
3831 int v28; // edi@54 | |
3832 int v29; // eax@54 | |
3833 int v30; // ecx@62 | |
3834 int v31; // ebx@62 | |
3835 int v32; // eax@62 | |
3836 int v33; // eax@64 | |
3837 unsigned int v34; // ecx@64 | |
3838 int v35; // ecx@64 | |
3839 signed int v36; // edx@85 | |
3840 signed int v37; // ebx@85 | |
3841 BLVFace *v38; // edi@89 | |
3842 int v39; // ecx@90 | |
3843 int v40; // ebx@90 | |
3844 PolygonType v41; // al@94 | |
3845 int v42; // eax@96 | |
3846 __int16 v43; // dx@96 | |
3847 int v44; // ecx@96 | |
3848 int v45; // edi@101 | |
3849 int v46; // edi@101 | |
3850 int v47; // eax@101 | |
3851 unsigned __int64 v48; // qax@101 | |
3852 unsigned __int8 v49; // zf@103 | |
3853 unsigned __int8 v50; // sf@103 | |
3854 unsigned __int8 v51; // of@103 | |
3855 AIDirection v52; // [sp+0h] [bp-60h]@75 | |
3856 AIDirection v53; // [sp+1Ch] [bp-44h]@116 | |
3857 int v54; // [sp+38h] [bp-28h]@53 | |
3858 unsigned int uSectorID; // [sp+3Ch] [bp-24h]@6 | |
3859 int v56; // [sp+40h] [bp-20h]@6 | |
3860 unsigned int _this; // [sp+44h] [bp-1Ch]@51 | |
3861 int v58; // [sp+48h] [bp-18h]@51 | |
3862 int v59; // [sp+4Ch] [bp-14h]@8 | |
3863 unsigned int uFaceID; // [sp+50h] [bp-10h]@6 | |
3864 int v61; // [sp+54h] [bp-Ch]@14 | |
3865 int v62; // [sp+58h] [bp-8h]@6 | |
3866 unsigned int v63; // [sp+5Ch] [bp-4h]@1 | |
3867 | |
3868 v63 = 0; | |
3869 if ( (signed int)uNumActors > 0 ) | |
3870 { | |
3871 while ( 1 ) | |
3872 { | |
3873 v0 = &pActors[v63]; | |
3874 v1 = v0->uAIState; | |
3875 if ( v1 == 11 || v1 == 19 || v1 == 17 || !v0->uMovementSpeed ) | |
3876 goto LABEL_123; | |
3877 uSectorID = v0->uSectorID; | |
783 | 3878 v2 = collide_against_floor(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, &uSectorID, &uFaceID); |
0 | 3879 v0->uSectorID = uSectorID; |
3880 v3 = v0->pMonsterInfo.uFlying; | |
3881 v56 = v2; | |
3882 v62 = v3; | |
3883 if ( !v0->CanAct() ) | |
3884 v62 = 0; | |
3885 v4 = v0->vPosition.z; | |
3886 v59 = 0; | |
3887 if ( v4 > v2 + 1 ) | |
3888 v59 = 1; | |
3889 if ( v2 <= -30000 ) | |
3890 { | |
3891 v5 = pIndoor->GetSector(v0->vPosition.x, v0->vPosition.y, v4); | |
3892 v0->uSectorID = v5; | |
3893 if ( !v5 | |
723 | 3894 || (v56 = BLV_GetFloorLevel(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &uFaceID), v56 == -30000) ) |
0 | 3895 goto LABEL_123; |
3896 } | |
305 | 3897 if ( v0->uCurrentActionAnimation == ANIM_Walking) |
0 | 3898 { |
3899 v6 = v0->uMovementSpeed; | |
3900 v7 = HIDWORD(v0->pActorBuffs[7].uExpireTime) == 0; | |
3901 v8 = SHIDWORD(v0->pActorBuffs[7].uExpireTime) < 0; | |
3902 v61 = v0->uMovementSpeed; | |
3903 if ( !v8 && (!(v8 | v7) || LODWORD(v0->pActorBuffs[7].uExpireTime)) ) | |
3904 { | |
3905 v9 = v0->pActorBuffs[7].uPower; | |
3906 if ( v9 ) | |
3907 LODWORD(v10) = v6 / (unsigned __int16)v9; | |
3908 else | |
3909 v10 = (signed __int64)((double)v61 * 0.5); | |
3910 v6 = v10; | |
3911 v61 = v10; | |
3912 } | |
3913 v11 = v0->uAIState; | |
3914 if ( v11 == 6 || v11 == 7 ) | |
3915 { | |
3916 v6 *= 2; | |
3917 v61 = v6; | |
3918 } | |
3919 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 1 ) | |
3920 v6 = (signed __int64)((double)v61 * flt_6BE3AC_debug_recmod1_x_1_6); | |
3921 if ( v6 > 1000 ) | |
3922 v6 = 1000; | |
323 | 3923 v12 = stru_5C6E00->Cos(v0->uYawAngle); |
0 | 3924 uSectorID = v12; |
3925 v13 = v12 * (signed __int64)v6; | |
3926 v61 = v13 >> 16; | |
3927 v0->vVelocity.x = WORD1(v13); | |
323 | 3928 uSectorID = stru_5C6E00->Sin(v0->uYawAngle); |
0 | 3929 v61 = (unsigned __int64)(uSectorID * (signed __int64)v6) >> 16; |
3930 v7 = v62 == 0; | |
3931 v0->vVelocity.y = (unsigned int)(uSectorID * v6) >> 16; | |
3932 if ( !v7 ) | |
3933 { | |
323 | 3934 v14 = stru_5C6E00->Sin(v0->uPitchAngle); |
0 | 3935 uSectorID = v14; |
3936 v15 = v14 * (signed __int64)v6; | |
3937 v61 = v15 >> 16; | |
3938 v0->vVelocity.z = WORD1(v15); | |
3939 } | |
3940 } | |
3941 else | |
3942 { | |
3943 v61 = v0->vVelocity.x; | |
3944 uSectorID = 55000; | |
3945 v61 = (unsigned __int64)(55000i64 * v61) >> 16; | |
3946 v0->vVelocity.x = v61; | |
3947 v61 = v0->vVelocity.y; | |
3948 v61 = (unsigned __int64)(uSectorID * (signed __int64)v61) >> 16; | |
3949 v7 = v62 == 0; | |
3950 v0->vVelocity.y = v61; | |
3951 if ( !v7 ) | |
3952 { | |
3953 uSectorID = 55000; | |
3954 v61 = v0->vVelocity.z; | |
3955 v61 = (unsigned __int64)(55000i64 * v61) >> 16; | |
3956 v0->vVelocity.z = v61; | |
3957 } | |
3958 } | |
3959 v16 = v0->vPosition.z; | |
3960 v17 = pIndoor->pFaces; | |
3961 v51 = __OFSUB__(v16, v56); | |
3962 v8 = v16 - v56 < 0; | |
3963 v18 = uFaceID; | |
3964 if ( v8 ^ v51 ) | |
3965 { | |
3966 v0->vPosition.z = v56 + 1; | |
3967 v19 = &v17[v18]; | |
3968 if ( v19->uPolygonType == 3 ) | |
3969 { | |
3970 if ( v0->vVelocity.z < 0 ) | |
3971 v0->vVelocity.z = 0; | |
3972 } | |
3973 else | |
3974 { | |
3975 if ( v19->pFacePlane_old.vNormal.z < 45000 ) | |
3976 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
3977 } | |
3978 } | |
3979 else | |
3980 { | |
3981 if ( v59 && !v62 ) | |
3982 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
3983 } | |
3984 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y + v0->vVelocity.z * v0->vVelocity.z >= 400 ) | |
3985 break; | |
3986 v0->vVelocity.z = 0; | |
3987 v0->vVelocity.y = 0; | |
3988 v0->vVelocity.x = 0; | |
3989 if ( BYTE2(v17[v18].uAttributes) & 0x40 ) | |
3990 { | |
3991 if (v0->uAIState == Dead) | |
3992 v0->uAIState = Removed; | |
3993 } | |
3994 LABEL_123: | |
3995 ++v63; | |
3996 if ( (signed int)v63 >= (signed int)uNumActors ) | |
3997 return; | |
3998 } | |
3999 v20 = v0->uActorRadius; | |
4000 v21 = v0->uActorHeight; | |
4001 stru_721530.field_84 = -1; | |
4002 stru_721530.field_70 = 0; | |
4003 uSectorID = 0; | |
4004 stru_721530.field_0 = 1; | |
4005 stru_721530.field_8 = v20; | |
4006 stru_721530.prolly_normal_d = v20; | |
4007 stru_721530.field_C = v21; | |
4008 v22 = 0; | |
4009 while ( 1 ) | |
4010 { | |
4011 stru_721530.field_34.x = v0->vPosition.x; | |
4012 stru_721530.normal.x = stru_721530.field_34.x; | |
4013 stru_721530.field_34.y = v0->vPosition.y; | |
4014 stru_721530.normal.y = stru_721530.field_34.y; | |
4015 v23 = v0->vPosition.z; | |
4016 stru_721530.normal.z = v23 + v20 + 1; | |
4017 stru_721530.field_34.z = v23 - v20 + stru_721530.field_C - 1; | |
4018 if ( stru_721530.field_34.z < stru_721530.normal.z ) | |
4019 stru_721530.field_34.z = v23 + v20 + 1; | |
4020 stru_721530.field_1C = v0->vVelocity.x; | |
4021 stru_721530.field_20 = v0->vVelocity.y; | |
4022 stru_721530.field_24 = v0->vVelocity.z; | |
4023 stru_721530.uSectorID = v0->uSectorID; | |
4024 if ( !stru_721530._47050A(v22) ) | |
4025 { | |
4026 v58 = v22; | |
4027 v24 = 8 * v63; | |
862 | 4028 LOBYTE(v24) = PID(OBJECT_Actor,v63); |
0 | 4029 v61 = v22; |
4030 _this = v24; | |
4031 do | |
4032 { | |
4033 _46E44E_collide_against_faces_and_portals(1u); | |
4034 _46E0B2_collide_against_decorations(); | |
4035 _46EF01_collision_chech_player(0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
4036 _46ED8A_collide_against_sprite_objects(_this); |
0 | 4037 v25 = 0; |
4038 v56 = 0; | |
4039 if ( ai_arrays_size > v22 ) | |
4040 { | |
4041 do | |
4042 { | |
390 | 4043 v54 = ai_near_actors_ids[v25]; |
0 | 4044 if ( v54 != v63 ) |
4045 { | |
4046 v26 = v54; | |
4047 v27 = abs(pActors[v54].vPosition.z - v0->vPosition.z); | |
4048 v28 = abs(pActors[v26].vPosition.y - v0->vPosition.y); | |
4049 v29 = abs(pActors[v26].vPosition.x - v0->vPosition.x); | |
322 | 4050 if ( int_get_vector_length(v29, v28, v27) >= v0->uActorRadius + (signed int)pActors[v26].uActorRadius |
0 | 4051 && _46DF1A_collide_against_actor(v54, 40) ) |
4052 ++v58; | |
4053 v22 = 0; | |
4054 } | |
4055 v25 = v56++ + 1; | |
4056 } | |
4057 while ( v56 < ai_arrays_size ); | |
4058 } | |
4059 if ( _46F04E_collide_against_portals() ) | |
4060 break; | |
4061 ++v61; | |
4062 } | |
4063 while ( v61 < 100 ); | |
4064 v56 = v58 > 1; | |
4065 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
4066 { | |
4067 v30 = stru_721530.normal2.x; | |
4068 v31 = stru_721530.normal2.y; | |
4069 v32 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
4070 } | |
4071 else | |
4072 { | |
4073 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; | |
4074 v30 = v58 + v0->vPosition.x; | |
4075 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; | |
4076 v31 = v58 + v0->vPosition.y; | |
4077 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; | |
4078 v32 = v58 + v0->vPosition.z; | |
4079 } | |
783 | 4080 v33 = collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID); |
0 | 4081 v34 = pIndoor->pFaces[uFaceID].uAttributes; |
4082 v35 = v34 & 0x400000; | |
4083 if (v35 && v0->uAIState == Dead) | |
4084 { | |
4085 v0->uAIState = Removed; | |
4086 goto LABEL_120; | |
4087 } | |
4088 if ( v59 != v22 || v62 != v22 || v35 == v22 ) | |
4089 { | |
4090 if ( v33 == -30000 ) | |
4091 goto LABEL_120; | |
4092 if ( v0->uCurrentActionAnimation != 1 || v33 >= v0->vPosition.z - 100 || v59 != v22 || v62 != v22 ) | |
4093 { | |
4094 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
4095 { | |
4096 v0->vPosition.x = LOWORD(stru_721530.normal2.x); | |
4097 v0->vPosition.y = LOWORD(stru_721530.normal2.y); | |
4098 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | |
4099 v0->uSectorID = LOWORD(stru_721530.uSectorID); | |
4100 goto LABEL_123; | |
4101 } | |
4102 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; | |
4103 v0->vPosition.x += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.x) >> 16; | |
4104 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; | |
4105 v0->vPosition.y += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.y) >> 16; | |
4106 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; | |
4107 v36 = stru_721530.uFaceID; | |
4108 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; | |
4109 v0->uSectorID = LOWORD(stru_721530.uSectorID); | |
4110 stru_721530.field_70 += stru_721530.field_7C; | |
848 | 4111 v37 = PID_ID(v36); |
4112 if ( PID_TYPE(v36) != OBJECT_Actor) | |
0 | 4113 { |
848 | 4114 if ( PID_TYPE(v36) != OBJECT_Player) |
0 | 4115 { |
848 | 4116 if ( PID_TYPE(v36) == OBJECT_Decoration) |
0 | 4117 { |
295 | 4118 _this = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); |
0 | 4119 v45 = stru_5C6E00->Atan2( |
4120 v0->vPosition.x - pLevelDecorations[v37].vPosition.x, | |
4121 v0->vPosition.y - pLevelDecorations[v37].vPosition.y); | |
323 | 4122 v54 = stru_5C6E00->Cos(v45); |
0 | 4123 v56 = (unsigned __int64)(v54 * (signed __int64)(signed int)_this) >> 16; |
4124 v46 = v45 - stru_5C6E00->uIntegerHalfPi; | |
4125 v0->vVelocity.x = v54 * _this >> 16; | |
323 | 4126 v47 = stru_5C6E00->Sin(v45); |
0 | 4127 v54 = v47; |
4128 v48 = v47 * (signed __int64)(signed int)_this; | |
4129 v56 = v48 >> 16; | |
4130 v0->vVelocity.y = WORD1(v48); | |
4131 goto LABEL_119; | |
4132 } | |
848 | 4133 if ( PID_TYPE(v36) == OBJECT_BModel) |
0 | 4134 { |
4135 stru_721530.field_84 = v36 >> 3; | |
4136 v38 = &pIndoor->pFaces[v37]; | |
4137 if ( v38->uPolygonType == 3 ) | |
4138 { | |
4139 v39 = v0->vVelocity.x; | |
4140 v40 = v0->vVelocity.y * v0->vVelocity.y; | |
4141 v0->vVelocity.z = 0; | |
4142 v0->vPosition.z = pIndoor->pVertices[*v38->pVertexIDs].z + 1; | |
4143 if ( v39 * v39 + v40 < 400 ) | |
4144 { | |
4145 v0->vVelocity.y = 0; | |
4146 v0->vVelocity.x = 0; | |
4147 goto LABEL_119; | |
4148 } | |
4149 } | |
4150 else | |
4151 { | |
4152 v61 = abs(v38->pFacePlane_old.vNormal.x * v0->vVelocity.x + v38->pFacePlane_old.vNormal.y | |
4153 * v0->vVelocity.y | |
4154 + v38->pFacePlane_old.vNormal.z | |
4155 * v0->vVelocity.z) >> 16; | |
4156 if ( stru_721530.field_64 >> 3 > v61 ) | |
4157 v61 = stru_721530.field_64 >> 3; | |
4158 v58 = v38->pFacePlane_old.vNormal.x; | |
4159 v58 = (unsigned __int64)(v61 * (signed __int64)v58) >> 16; | |
4160 _this = v38->pFacePlane_old.vNormal.y; | |
4161 _this = (unsigned __int64)(v61 * (signed __int64)(signed int)_this) >> 16; | |
4162 v56 = v38->pFacePlane_old.vNormal.z; | |
4163 v56 = (unsigned __int64)(v61 * (signed __int64)v56) >> 16; | |
4164 v0->vVelocity.x += v58; | |
4165 v0->vVelocity.y += _this; | |
4166 v0->vVelocity.z += v56; | |
4167 v41 = v38->uPolygonType; | |
4168 if ( v41 != 4 && v41 != 3 ) | |
4169 { | |
4170 v42 = v38->pFacePlane_old.vNormal.x; | |
4171 v43 = v0->vPosition.z; | |
4172 v44 = stru_721530.prolly_normal_d | |
4173 - ((v38->pFacePlane_old.dist | |
4174 + v38->pFacePlane_old.vNormal.z * v0->vPosition.z | |
4175 + v38->pFacePlane_old.vNormal.y * v0->vPosition.y | |
4176 + v42 * v0->vPosition.x) >> 16); | |
4177 if ( v44 > 0 ) | |
4178 { | |
4179 v0->vPosition.x += (unsigned int)(v44 * v42) >> 16; | |
4180 v0->vPosition.y += (unsigned int)(v44 * v38->pFacePlane_old.vNormal.y) >> 16; | |
4181 v0->vPosition.z = v43 + ((unsigned int)(v44 * v38->pFacePlane_old.vNormal.z) >> 16); | |
4182 } | |
4183 v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y); | |
4184 } | |
4185 } | |
4186 if ( BYTE3(v38->uAttributes) & 8 ) | |
4187 EventProcessor(pIndoor->pFaceExtras[v38->uFaceExtraID].uEventID, 0, 1); | |
4188 } | |
4189 LABEL_119: | |
4190 v56 = v0->vVelocity.x; | |
4191 v54 = 58500; | |
4192 v56 = (unsigned __int64)(58500i64 * v56) >> 16; | |
4193 v0->vVelocity.x = v56; | |
4194 v56 = v0->vVelocity.y; | |
4195 v56 = (unsigned __int64)(v54 * (signed __int64)v56) >> 16; | |
4196 v54 = 58500; | |
4197 v0->vVelocity.y = v56; | |
4198 v56 = v0->vVelocity.z; | |
4199 v56 = (unsigned __int64)(v54 * (signed __int64)v56) >> 16; | |
4200 v22 = 0; | |
4201 v0->vVelocity.z = v56; | |
4202 goto LABEL_120; | |
4203 } | |
4204 if ( v0->GetActorsRelation(0) ) | |
4205 { | |
1167 | 4206 v51 = __OFSUB__(HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime), v22); |
4207 v49 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == v22; | |
4208 v50 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) - v22 < 0; | |
0 | 4209 v0->vVelocity.y = v22; |
4210 v0->vVelocity.x = v22; | |
4211 if ( !(v50 ^ v51) | |
1167 | 4212 && (!((unsigned __int8)(v50 ^ v51) | v49) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > v22) ) |
4213 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 4214 viewparams->bRedrawGameUI = 1; |
4215 goto LABEL_119; | |
4216 } | |
4217 v36 = stru_721530.uFaceID; | |
4218 LABEL_118: | |
1060 | 4219 Actor::AI_FaceObject(v63, v36, v22, (AIDirection *)v22); |
0 | 4220 goto LABEL_119; |
4221 } | |
4222 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 2 || pTurnEngine->field_4 == 3) ) | |
4223 goto LABEL_119; | |
4224 if ( v0->pMonsterInfo.uHostilityType ) | |
4225 { | |
4226 if ( v56 == v22 ) | |
4227 goto LABEL_114; | |
4228 } | |
4229 else | |
4230 { | |
4231 if ( v56 == v22 ) | |
4232 { | |
4233 if ( !pActors[v37].pMonsterInfo.uHostilityType ) | |
4234 goto LABEL_118; | |
4235 LABEL_114: | |
1060 | 4236 Actor::AI_Flee(v63, v36, v22, (AIDirection *)v22); |
0 | 4237 goto LABEL_119; |
4238 } | |
4239 } | |
414 | 4240 Actor::AI_StandOrBored(v63, 4, v22, &v53); |
0 | 4241 goto LABEL_119; |
4242 } | |
4243 if ( v0->vPosition.x & 1 ) | |
4244 v0->uYawAngle += 100; | |
4245 else | |
4246 v0->uYawAngle -= 100; | |
4247 } | |
4248 else | |
4249 { | |
4250 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 2 || pTurnEngine->field_4 == 3) ) | |
4251 goto LABEL_123; | |
4252 if ( !v0->pMonsterInfo.uHostilityType || v56 != v22 ) | |
4253 { | |
414 | 4254 Actor::AI_StandOrBored(v63, 4, v22, &v52); |
0 | 4255 goto LABEL_123; |
4256 } | |
4257 } | |
4258 } | |
4259 LABEL_120: | |
4260 ++uSectorID; | |
4261 if ( uSectorID >= 100 ) | |
4262 goto LABEL_123; | |
4263 v20 = stru_721530.prolly_normal_d; | |
4264 } | |
4265 } | |
4266 } | |
4267 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
4268 // 4F75D8: using guessed type int ai_arrays_size; | |
4269 | |
4270 | |
4271 | |
4272 | |
4273 | |
4274 | |
4275 //----- (00460A78) -------------------------------------------------------- | |
4276 void __thiscall PrepareToLoadBLV(unsigned int bLoading) | |
4277 { | |
4278 unsigned int v1; // ebx@1 | |
4279 unsigned int v2; // eax@8 | |
4280 MapInfo *v3; // edi@9 | |
4281 int v4; // eax@11 | |
4282 int v5; // eax@12 | |
4283 int v6; // eax@13 | |
4284 int v7; // esi@27 | |
4285 SpawnPointMM7 *v8; // edx@28 | |
4286 //char v9; // bl@33 | |
4287 //int v10; // eax@34 | |
4288 //char *v11; // ecx@37 | |
4289 //int v12; // edi@44 | |
4290 //unsigned int v13; // edi@48 | |
4291 char *v14; // esi@49 | |
4292 __int16 v15; // ax@50 | |
4293 int v16; // ecx@52 | |
4294 DecorationDesc *v17; // eax@54 | |
4295 int v18; // ecx@55 | |
4296 //int *v19; // edi@58 | |
4297 //unsigned char v20; // dl@58 | |
4298 int v21; // eax@64 | |
4299 char v22; // cl@64 | |
4300 //signed int v23; // ebx@67 | |
4301 //char *v24; // esi@68 | |
4302 //int v25; // eax@70 | |
4303 //char *v26; // esi@78 | |
4304 //int v27; // eax@79 | |
4305 char v28; // zf@81 | |
4306 __int16 v29; // ax@85 | |
4307 signed int v30; // edi@94 | |
4308 int v31; // esi@94 | |
4309 char Args; // [sp+350h] [bp-C4h]@16 | |
4310 int v34[4]; // [sp+3E8h] [bp-2Ch]@96 | |
4311 int v35; // [sp+3F8h] [bp-1Ch]@1 | |
4312 //char b[4]; // [sp+3FCh] [bp-18h]@58 | |
4313 MapInfo *v37; // [sp+400h] [bp-14h]@1 | |
4314 int v38; // [sp+404h] [bp-10h]@1 | |
4315 unsigned int v39; // [sp+408h] [bp-Ch]@8 | |
4316 int pDest; // [sp+40Ch] [bp-8h]@1 | |
4317 //int i; // [sp+410h] [bp-4h]@27 | |
4318 | |
4319 v37 = (MapInfo *)bLoading; | |
4320 v1 = 0; | |
4321 v35 = 0; | |
4322 pGameLoadingUI_ProgressBar->Reset(0x20u); | |
4323 bUnderwater = 0; | |
4324 bNoNPCHiring = 0; | |
4325 v38 = 0; | |
4326 pDest = 1; | |
4327 uCurrentlyLoadedLevelType = LEVEL_Indoor; | |
4328 pGame->uFlags2 &= 0xFFFFFFF7u; | |
4329 if ( Is_out15odm_underwater() ) | |
4330 { | |
4331 bUnderwater = 1; | |
4332 pGame->uFlags2 |= 8u; | |
4333 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4334 if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d23.blv") ) |
0 | 4335 bNoNPCHiring = 1; |
4336 pPaletteManager->pPalette_tintColor[0] = 0; | |
4337 pPaletteManager->pPalette_tintColor[1] = 0; | |
4338 pPaletteManager->pPalette_tintColor[2] = 0; | |
4339 pPaletteManager->RecalculateAll(); | |
4340 if ( qword_A750D8 ) | |
4341 qword_A750D8 = 0i64; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4342 v2 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 4343 v39 = v2; |
4344 if ( v2 ) | |
4345 { | |
4346 v3 = &pMapStats->pInfos[v2]; | |
4347 v1 = v3->uRespawnIntervalDays; | |
4348 v38 = GetAlertStatus(); | |
4349 } | |
4350 else | |
4351 { | |
4352 v3 = v37; | |
4353 } | |
4354 dword_6BE13C_uCurrentlyLoadedLocationID = v39; | |
4355 pAllocator->FreeChunk(ptr_6A0D08); | |
4356 ptr_6A0D08 = 0; | |
4357 _6A0D0C_txt_lod_loading = 0; | |
4358 TryLoadLevelFromLOD(); | |
4359 pStationaryLightsStack->uNumLightsActive = 0; | |
4360 v4 = pIndoor->Load( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4361 pCurrentMapName.data(), |
0 | 4362 (unsigned int)(signed __int64)((double)pParty->uTimePlayed * 0.234375) / 60 / 60 / 24 + 1, |
4363 v1, | |
4364 (char *)&pDest) | |
4365 - 1; | |
4366 if ( !v4 ) | |
4367 { | |
4368 sprintf(&Args, "Unable to open %s", pCurrentMapName); | |
4369 Abortf(&Args); | |
4370 } | |
4371 v5 = v4 - 1; | |
4372 if ( !v5 ) | |
4373 { | |
4374 sprintf(&Args, "File %s is not a BLV File", pCurrentMapName); | |
4375 Abortf(&Args); | |
4376 } | |
4377 v6 = v5 - 1; | |
4378 if ( !v6 ) | |
4379 Abortf("Attempt to open new level before clearing old"); | |
4380 if ( v6 == 1 ) | |
4381 Abortf("Out of memory loading indoor level"); | |
4382 if ( !(dword_6BE364_game_settings_1 & 0x2000) ) | |
4383 { | |
4384 InitializeActors(); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
4385 InitializeSpriteObjects(); |
0 | 4386 } |
4387 BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; | |
4388 if ( !v39 ) | |
4389 pDest = 0; | |
4390 if ( pDest == 1 ) | |
4391 { | |
4392 v7 = 0; | |
4393 for (uint i = 0; i < pIndoor->uNumSpawnPoints; ++v7 ) | |
4394 { | |
4395 v8 = &pIndoor->pSpawnPoints[v7]; | |
4396 if ( pIndoor->pSpawnPoints[v7].uKind == 3 ) | |
4397 SpawnEncounter(v3, v8, 0, 0, 0); | |
4398 else | |
4399 v3->SpawnRandomTreasure(v8); | |
4400 ++i; | |
4401 } | |
4402 RespawnGlobalDecorations(); | |
4403 } | |
4404 | |
4405 pSoundList->LoadSound(pDoorSoundIDsByLocationID[v39], 0); | |
4406 pSoundList->LoadSound(pDoorSoundIDsByLocationID[v39] + 1, 0); | |
4407 | |
4408 for (uint i = 0; i < pIndoor->uNumDoors; ++i) | |
4409 { | |
4410 auto pDoor = pIndoor->pDoors + i; | |
4411 | |
4412 if (pDoor->uAttributes & 0x01) | |
4413 { | |
4414 pDoor->uState = BLVDoor::Opening; | |
4415 pDoor->uTimeSinceTriggered = 15360; | |
4416 pDoor->uAttributes = 2; | |
4417 } | |
4418 | |
4419 if (pDoor->uState == BLVDoor::Closed) | |
4420 { | |
4421 pDoor->uState = BLVDoor::Closing; | |
4422 pDoor->uTimeSinceTriggered = 15360; | |
4423 pDoor->uAttributes = 2; | |
4424 } | |
4425 else if (pDoor->uState == BLVDoor::Open) | |
4426 { | |
4427 pDoor->uState = BLVDoor::Opening; | |
4428 pDoor->uTimeSinceTriggered = 15360; | |
4429 pDoor->uAttributes = 2; | |
4430 } | |
4431 } | |
4432 | |
4433 /* | |
4434 i = 0; | |
4435 v9 = 2; | |
4436 if ( pIndoor->uNumDoors > 0 ) | |
4437 { | |
4438 v10 = 0; | |
4439 while ( 1 ) | |
4440 { | |
4441 if ( pIndoor->pDoors[v10].uAttributes & 1 ) | |
4442 { | |
4443 pIndoor->pDoors[v10].uState = 1; | |
4444 pIndoor->pDoors[v10].uTimeSinceTriggered = 15360; | |
4445 pIndoor->pDoors[v10].uAttributes = 2; | |
4446 } | |
4447 v11 = (char *)&pIndoor->pDoors[v10].uState; | |
4448 if ( !*(short *)v11 ) | |
4449 break; | |
4450 if ( *(short *)v11 == 2 ) | |
4451 { | |
4452 *(short *)v11 = 1; | |
4453 goto LABEL_41; | |
4454 } | |
4455 LABEL_42: | |
4456 ++i; | |
4457 ++v10; | |
4458 if ( i >= pIndoor->uNumDoors ) | |
4459 goto LABEL_43; | |
4460 } | |
4461 *(short *)v11 = 3; | |
4462 LABEL_41: | |
4463 pIndoor->pDoors[v10].uTimeSinceTriggered = 15360; | |
4464 pIndoor->pDoors[v10].uAttributes = 2; | |
4465 goto LABEL_42; | |
4466 } | |
4467 LABEL_43: | |
4468 */ | |
4469 | |
4470 for (uint i = 0; i < pIndoor->uNumFaces; ++i) | |
4471 { | |
4472 auto pFace = pIndoor->pFaces + i; | |
4473 if (!pFace->uBitmapID != -1) | |
4474 pBitmaps_LOD->pTextures[pFace->uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[pFace->uBitmapID].palette_id1); | |
4475 } | |
4476 | |
4477 /*i = 0; | |
4478 if ( (signed int)pIndoor->uNumFaces > 0 ) | |
4479 { | |
4480 v12 = 0; | |
4481 do | |
4482 { | |
4483 if ( pIndoor->pFaces[v12].uBitmapID != -1 ) | |
4484 pBitmaps_LOD->pTextures[pIndoor->pFaces[v12].uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[pIndoor->pFaces[v12].uBitmapID].palette_id1); | |
4485 ++i; | |
4486 ++v12; | |
4487 } | |
4488 while ( i < (signed int)pIndoor->uNumFaces ); | |
4489 }*/ | |
4490 | |
4491 | |
4492 pGameLoadingUI_ProgressBar->Progress(); | |
4493 | |
4494 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
4495 { | |
1202 | 4496 auto pDecortaion = &pLevelDecorations[i]; |
0 | 4497 |
4498 pDecorationList->InitializeDecorationSprite(pDecortaion->uDecorationDescID); | |
4499 | |
4500 v15 = pDecorationList->pDecorations[pDecortaion->uDecorationDescID].uSoundID; | |
4501 if (v15 && _6807E0_num_decorations_with_sounds_6807B8 < 9) | |
4502 { | |
4503 pSoundList->LoadSound(v15, 0); | |
4504 v16 = _6807E0_num_decorations_with_sounds_6807B8++; | |
4505 _6807B8_level_decorations_ids[v16] = i; | |
4506 } | |
4507 | |
4508 if ( !(pDecortaion->field_2 & 0x20) ) | |
4509 { | |
4510 v17 = &pDecorationList->pDecorations[pDecortaion->uDecorationDescID]; | |
380 | 4511 if (!v17->DontDraw()) |
0 | 4512 { |
4513 v18 = v17->uLightRadius; | |
4514 if ( v18 ) | |
4515 { | |
4516 unsigned char r = 255, | |
4517 g = 255, | |
4518 b = 255; | |
4519 if (pRenderer->pRenderD3D && pRenderer->bUseColoredLights) | |
4520 { | |
4521 r = v17->uColoredLightRed; | |
4522 g = v17->uColoredLightGreen; | |
4523 b = v17->uColoredLightBlue; | |
4524 } | |
4525 pStationaryLightsStack->AddLight(pDecortaion->vPosition.x, | |
4526 pDecortaion->vPosition.y, | |
4527 pDecortaion->vPosition.z + v17->uDecorationHeight, | |
4528 v18, | |
4529 r, | |
4530 g, | |
4531 b, | |
4532 byte_4E94D0); | |
4533 } | |
4534 } | |
4535 } | |
4536 | |
4537 if (!pDecortaion->field_16_event_id) | |
4538 { | |
4539 if (pDecortaion->IsInteractive()) | |
4540 { | |
4541 if ( v35 < 124 ) | |
4542 { | |
4543 v21 = v35 + 1; | |
4544 pDecortaion->_idx_in_stru123 = v35 + 75; | |
4545 v22 = stru_5E4C90._decor_events[v21 + 74 - 75]; | |
4546 v35 = v21; | |
4547 if ( !v22 ) | |
4548 pDecortaion->field_2 |= 0x20; | |
4549 } | |
4550 } | |
4551 } | |
4552 } | |
4553 | |
4554 pGameLoadingUI_ProgressBar->Progress(); | |
4555 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
486
diff
changeset
|
4556 for (uint i = 0; i < uNumSpriteObjects; ++i) |
0 | 4557 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4558 auto p = &pSpriteObjects[i]; |
0 | 4559 if (p->uObjectDescID) |
4560 { | |
4561 auto uItemID = p->stru_24.uItemID; | |
4562 if (uItemID) | |
4563 { | |
4564 if (uItemID != 220 && pItemsTable->pItems[uItemID].uEquipType == EQUIP_POTION && | |
570 | 4565 !p->stru_24.uEnchantmentType) |
4566 p->stru_24.uEnchantmentType = rand() % 15 + 5; | |
0 | 4567 pItemsTable->SetSpecialBonus(&p->stru_24); |
4568 } | |
4569 } | |
4570 } | |
4571 | |
4572 for (uint i = 0; i < uNumActors; ++i) | |
4573 //if ( (signed int)uNumActors > (signed int)v13 ) | |
4574 { | |
1202 | 4575 Actor *pActor = &pActors[i]; |
0 | 4576 //v26 = (char *)&pActors[0].uAttributes; |
4577 //do | |
4578 //{ | |
4579 //v27 = *(int *)v26; | |
4580 if (pActor->uAttributes & 0x100000) | |
4581 { | |
4582 if ( !v39 ) | |
4583 { | |
4584 pActor->pMonsterInfo.field_3E = 19; | |
4585 pActor->uAttributes |= 0x10000; | |
4586 continue; | |
4587 } | |
4588 v28 = v38 == 0; | |
4589 } | |
4590 else | |
4591 { | |
4592 v28 = v38 == 1; | |
4593 } | |
4594 | |
4595 if ( !v28 ) | |
4596 { | |
4597 pActor->PrepareSprites(0); | |
4598 v29 = pActor->pMonsterInfo.field_3E; | |
4599 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
4600 if ( v29 != 11 && v29 != 19 && (!pActor->sCurrentHP || !pActor->pMonsterInfo.uHP) ) | |
4601 { | |
4602 pActor->pMonsterInfo.field_3E = 5; | |
4603 pActor->UpdateAnimation(); | |
4604 } | |
4605 } | |
4606 else | |
4607 { | |
4608 pActor->pMonsterInfo.field_3E = 19; | |
4609 pActor->uAttributes |= 0x10000; | |
4610 } | |
4611 //} | |
4612 //while ( i < (signed int)uNumActors ); | |
4613 } | |
4614 | |
4615 pGameLoadingUI_ProgressBar->Progress(); | |
4616 | |
4617 Actor this_; | |
4618 this_.pMonsterInfo.uID = 45; | |
4619 this_.PrepareSprites(0); | |
4620 if ( !v37 ) | |
4621 { | |
4622 pParty->sRotationX = 0; | |
4623 pParty->sRotationY = 0; | |
4624 pParty->vPosition.z = 0; | |
4625 pParty->vPosition.y = 0; | |
4626 pParty->vPosition.x = 0; | |
4627 pParty->uFallStartY = 0; | |
4628 pParty->uFallSpeed = 0; | |
4629 TeleportToStartingPoint(uLevel_StartingPointType); | |
4630 } | |
4631 viewparams->_443365(); | |
4632 PlayLevelMusic(); | |
4633 if ( !v37 ) | |
4634 { | |
4635 v30 = 0; | |
4636 v31 = 1; | |
4637 do | |
4638 { | |
4639 if ( pPlayers[v31]->CanAct() ) | |
4640 v34[v30++] = v31; | |
4641 ++v31; | |
4642 } | |
4643 while ( v31 <= 4 ); | |
4644 if ( v30 ) | |
4645 { | |
4646 if ( pDest ) | |
4647 { | |
4648 qword_A750D8 = 256i64; | |
4649 word_A750E0 = 46; | |
4650 word_A750E2 = LOWORD(v34[rand() % v30]); | |
4651 } | |
4652 } | |
4653 } | |
1295 | 4654 } |
4655 //----- (0046CEC3) -------------------------------------------------------- | |
4656 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) | |
4657 { | |
4658 int v13; // ecx@13 | |
4659 signed int v14; // ebx@14 | |
4660 int v15; // eax@16 | |
4661 //int v16; // edx@19 | |
4662 //int v17; // ST18_4@19 | |
4663 //signed int v18; // edx@19 | |
4664 //signed __int64 v19; // qtt@19 | |
4665 int v21; // eax@27 | |
4666 //int v22; // ecx@29 | |
4667 signed int v28; // eax@45 | |
4668 int v29; // ebx@47 | |
4669 int v30; // edx@49 | |
4670 //int v31; // ST10_4@49 | |
4671 //signed int v32; // edx@49 | |
4672 signed __int64 v33; // qtt@49 | |
4673 //signed int v34; // eax@54 | |
4674 //signed int v35; // esi@56 | |
4675 //int result; // eax@57 | |
4676 int v38; // edx@62 | |
4677 //int v44; // [sp+20h] [bp-20h]@10 | |
4678 bool v47; // [sp+24h] [bp-1Ch]@43 | |
4679 bool v48; // [sp+28h] [bp-18h]@10 | |
4680 bool v49; // [sp+28h] [bp-18h]@41 | |
4681 bool v50; // [sp+2Ch] [bp-14h]@12 | |
4682 signed int v53; // [sp+30h] [bp-10h]@10 | |
4683 signed int v54; // [sp+30h] [bp-10h]@41 | |
4684 signed int v55; // [sp+34h] [bp-Ch]@1 | |
4685 | |
4686 //LOG_DECOMPILATION_WARNING(); | |
4687 | |
4688 static int blv_floor_id[50]; // 00721200 | |
4689 static int blv_floor_level[50]; // 007212C8 | |
4690 | |
4691 static __int16 word_721390_ys[104]; // idb | |
4692 static __int16 word_721460_xs[104]; // idb | |
4693 | |
4694 auto pSector = &pIndoor->pSectors[uSectorID]; | |
4695 v55 = 0; | |
4696 for (uint i = 0; i < pSector->uNumFloors; ++i) | |
4697 { | |
4698 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
4699 if (pFloor->Clickable()) | |
4700 continue; | |
4701 | |
4702 assert(pFloor->uNumVertices); | |
4703 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && | |
4704 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
4705 { | |
4706 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
4707 { | |
4708 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; | |
4709 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
4710 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
4711 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
4712 } | |
4713 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; | |
4714 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
4715 | |
4716 v50 = word_721390_ys[0] >= y; | |
4717 v53 = 0; | |
4718 | |
4719 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) | |
4720 { | |
4721 if (v53 >= 2) | |
4722 break; | |
4723 | |
4724 v48 = v50; | |
4725 v50 = word_721390_ys[j + 1] >= y; | |
4726 | |
4727 v13 = i; | |
4728 if (v48 == v50) | |
4729 continue; | |
4730 | |
4731 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
4732 v15 = v14 | (word_721460_xs[j] < x); | |
4733 | |
4734 if (v15 == 3) | |
4735 continue; | |
4736 else if (!v15) | |
4737 ++v53; | |
4738 else | |
4739 { | |
4740 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); | |
4741 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); | |
4742 | |
4743 if (res + word_721460_xs[j] >= x) | |
4744 ++v53; | |
4745 } | |
4746 } | |
4747 | |
4748 | |
4749 if ( v53 == 1 ) | |
4750 { | |
4751 if ( v55 >= 50 ) | |
4752 break; | |
4753 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) | |
4754 { | |
4755 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; | |
4756 } | |
4757 else | |
4758 { | |
4759 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); | |
4760 } | |
4761 blv_floor_level[v55] = v21; | |
4762 blv_floor_id[v55] = pSector->pFloors[i]; | |
4763 v55++; | |
4764 } | |
4765 } | |
4766 } | |
4767 | |
4768 | |
4769 if ( pSector->field_0 & 8 ) | |
4770 { | |
4771 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
4772 { | |
4773 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
4774 if (portal->uPolygonType != POLYGON_Floor) | |
4775 continue; | |
4776 | |
4777 if (!portal->uNumVertices) | |
4778 continue; | |
4779 | |
4780 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && | |
4781 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
4782 { | |
4783 for (uint j = 0; j < portal->uNumVertices; ++j) | |
4784 { | |
4785 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; | |
4786 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
4787 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
4788 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
4789 } | |
4790 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
4791 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
4792 v54 = 0; | |
4793 v47 = word_721390_ys[0] >= y; | |
4794 | |
4795 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
4796 { | |
4797 v49 = v47; | |
4798 if ( v54 >= 2 ) | |
4799 break; | |
4800 v47 = word_721390_ys[j + 1] >= y; | |
4801 if ( v49 != v47 ) | |
4802 { | |
4803 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
4804 v29 = v28 | (word_721460_xs[j] < x); | |
4805 if ( v29 != 3 ) | |
4806 { | |
4807 if ( !v29 ) | |
4808 ++v54; | |
4809 else | |
4810 { | |
4811 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); | |
4812 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); | |
4813 if (res + word_721460_xs[j] >= x) | |
4814 ++v54; | |
4815 } | |
4816 } | |
4817 } | |
4818 } | |
4819 if ( v54 == 1 ) | |
4820 { | |
4821 if ( v55 >= 50 ) | |
4822 break; | |
4823 blv_floor_level[v55] = -29000; | |
4824 blv_floor_id[v55] = pSector->pPortals[i]; | |
4825 v55++; | |
4826 } | |
4827 } | |
4828 } | |
4829 } | |
4830 if ( v55 == 1 ) | |
4831 { | |
4832 *pFaceID = blv_floor_id[0]; | |
4833 return blv_floor_level[0]; | |
4834 } | |
4835 if ( !v55 ) | |
4836 return -30000; | |
4837 *pFaceID = blv_floor_id[0]; | |
4838 //result = blv_floor_level[0]; | |
4839 | |
4840 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
4841 { | |
4842 if ( blv_floor_level[0] <= z + 5 ) | |
4843 { | |
4844 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
4845 continue; | |
4846 blv_floor_level[0] = blv_floor_level[v35]; | |
4847 *pFaceID = blv_floor_id[v35]; | |
4848 continue; | |
4849 } | |
4850 if ( blv_floor_level[v35] < blv_floor_level[0] ) | |
4851 { | |
4852 blv_floor_level[0] = blv_floor_level[v35]; | |
4853 *pFaceID = blv_floor_id[v35]; | |
4854 } | |
4855 }*/ | |
4856 | |
4857 | |
4858 int result = blv_floor_level[0]; | |
4859 for (uint i = 1; i < v55; ++i) | |
4860 { | |
4861 v38 = blv_floor_level[i]; | |
4862 if ( result <= z + 5 ) | |
4863 { | |
4864 if ( v38 > result && v38 <= z + 5 ) | |
4865 { | |
4866 result = blv_floor_level[i]; | |
4867 *pFaceID = blv_floor_id[i]; | |
4868 } | |
4869 } | |
4870 else if ( v38 < result ) | |
4871 { | |
4872 result = blv_floor_level[i]; | |
4873 *pFaceID = blv_floor_id[i]; | |
4874 } | |
4875 } | |
4876 | |
4877 return result; | |
4878 } | |
4879 //----- (004016FA) -------------------------------------------------------- | |
4880 int __cdecl MakeActorAIList_BLV() | |
4881 { | |
4882 Actor *v0; // esi@2 | |
4883 int v1; // eax@4 | |
4884 int v2; // ebx@4 | |
4885 unsigned int v3; // ecx@4 | |
4886 int v4; // edx@5 | |
4887 int v5; // edx@7 | |
4888 unsigned int v6; // edx@9 | |
4889 unsigned int v7; // ST24_4@10 | |
4890 int v8; // eax@10 | |
4891 int v9; // edi@10 | |
4892 int v10; // ebx@14 | |
4893 char v11; // zf@16 | |
4894 int v12; // eax@22 | |
4895 int v13; // edx@24 | |
4896 int v14; // ecx@25 | |
4897 int v15; // ebx@26 | |
4898 unsigned int *v16; // ecx@27 | |
4899 unsigned int v17; // esi@27 | |
4900 int v18; // ecx@31 | |
4901 signed int v19; // edi@31 | |
4902 Actor *v20; // esi@32 | |
4903 bool v21; // eax@33 | |
4904 int v22; // eax@34 | |
4905 signed int v23; // ebx@36 | |
4906 Actor *v24; // esi@37 | |
4907 signed int v25; // eax@40 | |
4908 int v26; // eax@43 | |
4909 int v27; // ebx@45 | |
4910 int j; // edi@45 | |
4911 unsigned int v29; // eax@46 | |
4912 int v30; // eax@48 | |
4913 int v31; // ecx@51 | |
4914 int v32; // eax@51 | |
4915 signed int v33; // eax@53 | |
4916 __int64 v34; // qax@55 | |
4917 char *v35; // ecx@56 | |
4918 int v37; // [sp+Ch] [bp-18h]@1 | |
4919 int v38; // [sp+10h] [bp-14h]@4 | |
4920 int v39; // [sp+14h] [bp-10h]@4 | |
4921 int v40; // [sp+18h] [bp-Ch]@10 | |
4922 int v41; // [sp+18h] [bp-Ch]@29 | |
4923 int i; // [sp+18h] [bp-Ch]@31 | |
4924 signed int v43; // [sp+1Ch] [bp-8h]@1 | |
4925 signed int v44; // [sp+1Ch] [bp-8h]@25 | |
4926 int v45; // [sp+20h] [bp-4h]@1 | |
4927 | |
4928 // __debugbreak(); // refactor for blv ai | |
4929 pParty->uFlags &= 0xFFFFFFCFu; | |
4930 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
4931 v45 = 0; | |
4932 v43 = 0; | |
4933 if ( (signed int)uNumActors > 0 ) | |
4934 { | |
4935 v0 = pActors.data();//[0].uAttributes; | |
4936 do | |
4937 { | |
4938 BYTE1(v0->uAttributes) &= 0xFBu; | |
4939 if ( ! v0->CanAct() ) | |
4940 goto LABEL_60; | |
4941 v39 = abs(pParty->vPosition.z - v0->vPosition.z); | |
4942 v38 = abs(pParty->vPosition.y - v0->vPosition.y); | |
4943 v1 = abs(pParty->vPosition.x - v0->vPosition.x); | |
4944 v2 = v38; | |
4945 v3 = v39; | |
4946 if ( v1 < v38 ) | |
4947 { | |
4948 v4 = v1; | |
4949 v1 = v38; | |
4950 v2 = v4; | |
4951 } | |
4952 if ( v1 < v39 ) | |
4953 { | |
4954 v5 = v1; | |
4955 v1 = v39; | |
4956 v3 = v5; | |
4957 } | |
4958 if ( v2 < (signed int)v3 ) | |
4959 { | |
4960 v6 = v3; | |
4961 v3 = v2; | |
4962 v2 = v6; | |
4963 } | |
4964 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | |
4965 v8 = v0->uActorRadius; | |
4966 v9 = v7 - v8; | |
4967 v40 = v7 - v8; | |
4968 if ( v40 < 0 ) | |
4969 { | |
4970 v9 = 0; | |
4971 v40 = 0; | |
4972 } | |
4973 if ( v9 < 10240 ) | |
4974 { | |
4975 v10 = v0->uAttributes & 0xFEFFFFFF; | |
4976 v0->uAttributes = v10; | |
4977 if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) | |
4978 { | |
4979 v11 = (pParty->uFlags & 0x10) == 0; | |
4980 v0->uAttributes = v10 | 0x1000000; | |
4981 if ( v11 && (double)v40 < 307.2 ) | |
4982 pParty->uFlags |= 0x10u; | |
4983 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) | |
4984 pParty->uFlags |= 0x20u; | |
4985 } | |
4986 v12 = v45++; | |
4987 ai_near_actors_distances[v12] = v9; | |
4988 ai_near_actors_ids[v12] = v43; | |
4989 } | |
4990 else | |
4991 { | |
4992 LABEL_60: | |
4993 BYTE1(v0->uAttributes) &= 0xBFu; | |
4994 } | |
4995 ++v43; | |
4996 ++v0; | |
4997 } | |
4998 while ( v43 < (signed int)uNumActors ); | |
4999 } | |
5000 v13 = 0; | |
5001 if ( v45 > 0 ) | |
5002 { | |
5003 v14 = 1; | |
5004 v44 = 1; | |
5005 do | |
5006 { | |
5007 while ( 1 ) | |
5008 { | |
5009 v41 = v14; | |
5010 if ( v14 >= v45 ) | |
5011 break; | |
5012 v15 = ai_near_actors_distances[v13]; | |
5013 if ( v15 > ai_near_actors_distances[v14] ) | |
5014 { | |
5015 v16 = &ai_near_actors_ids[v14]; | |
5016 v17 = ai_near_actors_ids[v13]; | |
5017 ai_near_actors_ids[v13] = *v16; | |
5018 *v16 = v17; | |
5019 v14 = v41; | |
5020 ai_near_actors_distances[v13] = ai_near_actors_distances[v41]; | |
5021 ai_near_actors_distances[v41] = v15; | |
5022 } | |
5023 ++v14; | |
5024 } | |
5025 ++v13; | |
5026 v14 = v44 + 1; | |
5027 v44 = v14; | |
5028 } | |
5029 while ( v14 - 1 < v45 ); | |
5030 } | |
5031 v18 = 0; | |
5032 v19 = 0; | |
5033 for ( i = 0; v18 < v45; i = v18 ) | |
5034 { | |
5035 v20 = &pActors[ai_near_actors_ids[v18]]; | |
5036 if ( v20->uAttributes & 0x8000 | |
5037 || (v21 = sub_4070EF_prolly_collide_objects(PID(OBJECT_Actor,ai_near_actors_ids[v18]), 4u), v18 = i, v21) ) | |
5038 { | |
5039 v22 = ai_near_actors_ids[v18]; | |
5040 v20->uAttributes |= 0x8000u; | |
5041 ai_array_4F6638_actor_ids[v19] = v22; | |
5042 ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; | |
5043 if ( v19 >= 30 ) | |
5044 break; | |
5045 } | |
5046 ++v18; | |
5047 } | |
5048 v23 = 0; | |
5049 ai_arrays_size = v19; | |
5050 if ( (signed int)uNumActors > 0 ) | |
5051 { | |
5052 v24 = pActors.data();//[0].uAttributes; | |
5053 do | |
5054 { | |
5055 if ( v24->CanAct() && v24->uSectorID == v37 ) | |
5056 { | |
5057 v25 = 0; | |
5058 if ( v19 <= 0 ) | |
5059 { | |
5060 LABEL_43: | |
5061 v26 = ai_arrays_size; | |
5062 BYTE1(v24->uAttributes) |= 0x40u; | |
5063 ++ai_arrays_size; | |
5064 ai_array_4F6638_actor_ids[v26] = v23; | |
5065 } | |
5066 else | |
5067 { | |
5068 while ( ai_array_4F6638_actor_ids[v25] != v23 ) | |
5069 { | |
5070 ++v25; | |
5071 if ( v25 >= v19 ) | |
5072 goto LABEL_43; | |
5073 } | |
5074 } | |
5075 } | |
5076 ++v23; | |
5077 ++v24; | |
5078 } | |
5079 while ( v23 < (signed int)uNumActors ); | |
5080 } | |
5081 v27 = ai_arrays_size; | |
5082 for ( j = 0; j < v45; ++j ) | |
5083 { | |
5084 v29 = ai_near_actors_ids[j]; | |
5085 if ( pActors[v29].uAttributes & 0xC000 && pActors[v29].CanAct() ) | |
5086 { | |
5087 v30 = 0; | |
5088 if ( v27 <= 0 ) | |
5089 { | |
5090 LABEL_51: | |
5091 v31 = ai_arrays_size; | |
5092 v32 = ai_near_actors_ids[j]; | |
5093 ++ai_arrays_size; | |
5094 ai_array_4F6638_actor_ids[v31] = v32; | |
5095 } | |
5096 else | |
5097 { | |
5098 while ( ai_array_4F6638_actor_ids[v30] != ai_near_actors_ids[j] ) | |
5099 { | |
5100 ++v30; | |
5101 if ( v30 >= v27 ) | |
5102 goto LABEL_51; | |
5103 } | |
5104 } | |
5105 } | |
5106 } | |
5107 v33 = ai_arrays_size; | |
5108 if ( ai_arrays_size > 30 ) | |
5109 { | |
5110 v33 = 30; | |
5111 ai_arrays_size = 30; | |
5112 } | |
5113 memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * v33); | |
5114 memcpy(ai_near_actors_distances.data(), ai_array_4F5E68.data(), 4 * ai_arrays_size); | |
5115 v34 = (unsigned int)ai_arrays_size; | |
5116 if ( ai_arrays_size > 0 ) | |
5117 { | |
5118 do | |
5119 { | |
5120 v35 = (char *)&pActors[ai_near_actors_ids[HIDWORD(v34)]].uAttributes; | |
5121 v35[1] |= 4u; | |
5122 ++HIDWORD(v34); | |
5123 } | |
5124 while ( SHIDWORD(v34) < (signed int)v34 ); | |
5125 } | |
5126 return v34; | |
5127 } | |
5128 //----- (0043FDED) -------------------------------------------------------- | |
5129 void PrepareActorRenderList_BLV() | |
5130 { | |
5131 RenderBillboard *v0; // esi@0 | |
5132 unsigned __int16 v3; // ax@3 | |
5133 unsigned int v4; // eax@5 | |
5134 unsigned __int16 v5; // cx@5 | |
5135 int v6; // esi@5 | |
5136 unsigned int v7; // eax@7 | |
5137 int v8; // eax@10 | |
5138 SpriteFrame *v9; // eax@16 | |
5139 SpriteFrame *v10; // ebx@18 | |
5140 //int *v11; // eax@18 | |
5141 int v12; // ecx@28 | |
5142 //IndoorCameraD3D **v14; // eax@36 | |
5143 double v15; // st7@36 | |
5144 float v16; // eax@36 | |
5145 //double v17; // ST30_8@36 | |
5146 signed __int64 v18; // qtt@36 | |
5147 int v19; // ST5C_4@36 | |
5148 signed __int64 v20; // qtt@37 | |
5149 int v21; // ST5C_4@37 | |
5150 signed __int16 v22; // cx@39 | |
5151 int v23; // ST50_4@40 | |
5152 signed int v24; // ecx@40 | |
5153 int v25; // edx@44 | |
5154 __int16 v26; // ax@44 | |
5155 //MonsterDesc *v27; // edx@44 | |
5156 //int v28; // ecx@44 | |
5157 unsigned __int8 v29; // zf@44 | |
5158 unsigned __int8 v30; // sf@44 | |
5159 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
5160 int v32; // [sp+1Ch] [bp-38h]@5 | |
5161 int a3; // [sp+20h] [bp-34h]@5 | |
5162 int a2; // [sp+24h] [bp-30h]@5 | |
5163 int a1a; // [sp+28h] [bp-2Ch]@5 | |
5164 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
5165 int a5a; // [sp+2Ch] [bp-28h]@36 | |
5166 int a5b; // [sp+2Ch] [bp-28h]@40 | |
5167 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
5168 int a6; // [sp+40h] [bp-14h]@34 | |
5169 int v43; // [sp+44h] [bp-10h]@34 | |
5170 int z; // [sp+48h] [bp-Ch]@32 | |
5171 signed int y; // [sp+4Ch] [bp-8h]@32 | |
5172 int x; // [sp+50h] [bp-4h]@32 | |
5173 | |
5174 for (uint i = 0; i < uNumActors; ++i) | |
5175 { | |
5176 auto p = &pActors[i]; | |
5177 | |
5178 if (p->uAIState == Removed || | |
5179 p->uAIState == Disabled) | |
5180 continue; | |
5181 | |
5182 a5 = p->uSectorID; | |
5183 a2 = p->vPosition.y; | |
5184 a1a = p->vPosition.x; | |
5185 a3 = p->vPosition.z; | |
5186 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
5187 LOWORD(v0) = p->uYawAngle; | |
5188 v5 = p->uCurrentActionAnimation; | |
5189 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
5190 v32 = v6; | |
5191 if ( pParty->bTurnBasedModeOn ) | |
5192 { | |
5193 if ( v5 == 1 ) | |
5194 { | |
5195 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
5196 goto LABEL_10; | |
5197 } | |
5198 } | |
5199 else | |
5200 { | |
5201 if ( v5 == 1 ) | |
5202 { | |
5203 v7 = pBLVRenderParams->field_0_timer_; | |
5204 LABEL_10: | |
5205 v8 = i * 32 + v7; | |
5206 goto LABEL_12; | |
5207 } | |
5208 } | |
5209 v8 = p->uCurrentActionTime; | |
5210 LABEL_12: | |
5211 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
5212 v8 = 0; | |
5213 v31 = p->pSpriteIDs[v5]; | |
5214 if (p->uAIState == Resurrected) | |
5215 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
5216 else | |
5217 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
5218 v41 = 0; | |
5219 v10 = v9; | |
5220 //v11 = (int *)v9->uFlags; | |
5221 if (v9->uFlags & 2) | |
5222 v41 = 2; | |
5223 if (v9->uFlags & 0x40000) | |
5224 v41 |= 0x40u; | |
5225 if (v9->uFlags & 0x20000) | |
5226 LOBYTE(v41) = v41 | 0x80; | |
5227 v0 = (RenderBillboard *)(256 << v6); | |
5228 if ( (unsigned int)v0 & v9->uFlags) | |
5229 v41 |= 4u; | |
5230 if ( v10->uGlowRadius ) | |
5231 { | |
5232 //LOBYTE(v11) = byte_4E94D3; | |
5233 pMobileLightsStack->AddLight( | |
5234 a1a, | |
5235 a2, | |
5236 a3, | |
5237 a5, | |
5238 v10->uGlowRadius, | |
5239 0xFFu, | |
5240 0xFFu, | |
5241 0xFFu, | |
5242 byte_4E94D3); | |
5243 } | |
5244 v12 = 0; | |
5245 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
5246 continue; | |
5247 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
5248 { | |
5249 ++v12; | |
5250 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
5251 goto _continue; | |
5252 } | |
5253 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
5254 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
5255 continue; | |
5256 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
5257 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
5258 if (uNumBillboardsToDraw >= 500) | |
5259 break; | |
5260 ++uNumBillboardsToDraw; | |
5261 ++uNumSpritesDrawnThisFrame; | |
5262 p->uAttributes |= 8u; | |
5263 v29 = pRenderer->pRenderD3D == 0; | |
5264 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
5265 v0->uPalette = v10->uPaletteIndex; | |
5266 v0->uIndoorSectorID = a5; | |
5267 if ( v29 ) | |
5268 { | |
5269 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
5270 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
5271 v21 = v20 / x; | |
5272 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; | |
5273 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; | |
5274 } | |
5275 else | |
5276 { | |
5277 //v14 = &pGame->pIndoorCameraD3D; | |
5278 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
5279 v15 = pGame->pIndoorCameraD3D->fov_y; | |
5280 v16 = v0->fov_x; | |
5281 v0->fov_y = v15; | |
5282 //v17 = v16 + 6.7553994e15; | |
5283 LODWORD(v18) = 0; | |
5284 HIDWORD(v18) = floorf(v16 + 0.5f); | |
5285 v19 = v18 / x; | |
5286 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; | |
5287 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; | |
5288 } | |
5289 v0->_screenspace_y_scaler_packedfloat = a5a; | |
5290 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) | |
5291 { | |
5292 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
5293 { | |
5294 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; | |
5295 goto LABEL_43; | |
5296 } | |
5297 } | |
5298 else | |
5299 { | |
5300 v22 = p->pActorBuffs[3].uPower; | |
5301 if ( v22 ) | |
5302 { | |
5303 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; | |
5304 v24 = p->pActorBuffs[3].uPower; | |
5305 v0->_screenspace_x_scaler_packedfloat = v23; | |
5306 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; | |
5307 LABEL_43: | |
5308 v0->_screenspace_y_scaler_packedfloat = a5b; | |
5309 goto LABEL_44; | |
5310 } | |
5311 } | |
5312 LABEL_44: | |
5313 HIWORD(v25) = HIWORD(x); | |
5314 v0->world_x = a1a; | |
5315 v0->world_y = a2; | |
5316 v0->world_z = a3; | |
5317 v0->uScreenSpaceX = v43; | |
5318 v0->uScreenSpaceY = a6; | |
5319 LOWORD(v25) = 0; | |
5320 LOBYTE(v26) = v41; | |
5321 | |
5322 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); | |
5323 v0->actual_z = HIWORD(x); | |
5324 v0->object_pid = PID(OBJECT_Actor,i); | |
5325 | |
5326 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; | |
5327 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
5328 v0->field_1E = v41; | |
5329 v0->pSpriteFrame = v10; | |
5330 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
5331 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
5332 { | |
5333 HIBYTE(v26) = HIBYTE(v41) | 1; | |
5334 v0->field_1E = v26; | |
5335 } | |
5336 | |
5337 _continue: | |
5338 ; | |
5339 } | |
5340 } | |
5341 //----- (0044028F) -------------------------------------------------------- | |
5342 void PrepareItemsRenderList_BLV() | |
5343 { | |
5344 ObjectDesc *v1; // ebx@4 | |
5345 __int16 v2; // ax@5 | |
5346 RenderBillboard *v3; // esi@12 | |
5347 SpriteFrame *v4; // eax@12 | |
5348 SpriteFrame *v5; // ebx@12 | |
5349 unsigned int v6; // eax@12 | |
5350 int v7; // ecx@12 | |
5351 int v8; // edx@12 | |
5352 int v9; // ecx@12 | |
5353 unsigned __int16 v10; // ax@12 | |
5354 int *v11; // eax@20 | |
5355 //char v12; // zf@26 | |
5356 __int64 v18; // ST5C_4@27 | |
5357 signed __int64 v19; // qtt@28 | |
5358 int v20; // ST5C_4@28 | |
5359 //int v21; // edx@29 | |
5360 __int16 v22; // ax@29 | |
5361 //int v23; // eax@29 | |
5362 SpriteFrame *v24; // [sp+1Ch] [bp-40h]@12 | |
5363 //__int16 a5; // [sp+28h] [bp-34h]@12 | |
5364 int a6; // [sp+2Ch] [bp-30h]@12 | |
5365 int a2; // [sp+30h] [bp-2Ch]@12 | |
5366 int a1; // [sp+34h] [bp-28h]@12 | |
5367 int v30; // [sp+38h] [bp-24h]@12 | |
5368 int v31; // [sp+38h] [bp-24h]@27 | |
5369 int a3; // [sp+40h] [bp-1Ch]@12 | |
5370 signed __int16 v34; // [sp+44h] [bp-18h]@14 | |
5371 int v35; // [sp+48h] [bp-14h]@25 | |
5372 int v36; // [sp+4Ch] [bp-10h]@25 | |
5373 signed int z; // [sp+50h] [bp-Ch]@24 | |
5374 signed int y; // [sp+54h] [bp-8h]@24 | |
5375 signed int x; // [sp+58h] [bp-4h]@24 | |
5376 | |
5377 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
5378 { | |
5379 auto p = &pSpriteObjects[i]; | |
5380 if (p->uObjectDescID) | |
5381 { | |
5382 v1 = &pObjectList->pObjects[p->uObjectDescID]; | |
5383 if ( !(v1->uFlags & 1) ) | |
5384 { | |
5385 if ( ((v2 = p->uType, v2 < 1000) || v2 >= 10000) | |
5386 && (v2 < 500 || v2 >= 600) | |
5387 && (v2 < 811 || v2 >= 815) | |
5388 || pGame->pStru6Instance->_4A81CA(p)) | |
5389 { | |
5390 //a5 = p->uSectorID; | |
5391 a1 = p->vPosition.x; | |
5392 a2 = p->vPosition.y; | |
5393 a3 = p->vPosition.z; | |
5394 v3 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
5395 v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, p->uSpriteFrameID); | |
5396 v5 = v4; | |
5397 v24 = v4; | |
5398 v30 = v4->uFlags; | |
5399 a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier; | |
5400 v6 = stru_5C6E00->Atan2(p->vPosition.x - pBLVRenderParams->vPartyPos.x, | |
5401 p->vPosition.y - pBLVRenderParams->vPartyPos.y); | |
5402 LOWORD(v7) = p->uFacing; | |
5403 v8 = v30; | |
5404 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; | |
5405 v10 = v5->pHwSpriteIDs[v9]; | |
5406 v3->uHwSpriteID = v10; | |
5407 if ( v30 & 0x20 ) | |
5408 { | |
5409 v8 = v30; | |
5410 a3 -= (signed int)((unsigned __int64)(v5->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; | |
5411 } | |
5412 v34 = 0; | |
5413 if ( v8 & 2 ) | |
5414 v34 = 2; | |
5415 if ( v8 & 0x40000 ) | |
5416 v34 |= 0x40u; | |
5417 if ( v8 & 0x20000 ) | |
5418 LOBYTE(v34) = v34 | 0x80; | |
5419 v11 = (int *)(256 << v9); | |
5420 if ( (256 << v9) & v8 ) | |
5421 v34 |= 4u; | |
5422 if ( a6 ) | |
5423 { | |
5424 LOBYTE(v11) = byte_4E94D3; | |
5425 pMobileLightsStack->AddLight( | |
5426 a1, | |
5427 a2, | |
5428 a3, | |
5429 p->uSectorID, | |
5430 a6, | |
5431 v1->uParticleTrailColorR, | |
5432 v1->uParticleTrailColorG, | |
5433 v1->uParticleTrailColorB, | |
5434 byte_4E94D3); | |
5435 } | |
5436 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | |
5437 a1, | |
5438 a2, | |
5439 a3, | |
5440 &x, | |
5441 &y, | |
5442 &z, | |
5443 1) ) | |
5444 { | |
5445 pGame->pIndoorCameraD3D->Project(x, y, z, &v36, &v35); | |
5446 | |
5447 assert(uNumBillboardsToDraw < 500); | |
5448 //if ( (signed int)uNumBillboardsToDraw >= 500 ) | |
5449 // return; | |
5450 ++uNumBillboardsToDraw; | |
5451 ++uNumSpritesDrawnThisFrame; | |
5452 p->uAttributes |= 1u; | |
5453 //v12 = pRenderer->pRenderD3D == 0; | |
5454 v3->uPalette = v24->uPaletteIndex; | |
5455 v3->uIndoorSectorID = p->uSectorID; | |
5456 if ( pRenderer->pRenderD3D ) | |
5457 { | |
5458 v3->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
5459 v3->fov_y = pGame->pIndoorCameraD3D->fov_y; | |
5460 LODWORD(v18) = 0; | |
5461 HIDWORD(v18) = (int)floorf(v3->fov_x + 0.5f); | |
5462 v18 = v18 / x; | |
5463 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16; | |
5464 v31 = (unsigned __int64)(v24->scale * v18) >> 16; | |
5465 } | |
5466 else | |
5467 { | |
5468 LODWORD(v19) = pBLVRenderParams->field_40 << 16; | |
5469 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16; | |
5470 v20 = v19 / x; | |
5471 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16; | |
5472 v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16; | |
5473 } | |
5474 //HIWORD(v21) = HIWORD(x); | |
5475 //LOWORD(v21) = 0; | |
5476 v3->_screenspace_y_scaler_packedfloat = v31; | |
5477 v3->field_1E = v34; | |
5478 v3->world_x = a1; | |
5479 v3->world_y = a2; | |
5480 v3->world_z = a3; | |
5481 v3->uScreenSpaceX = v36; | |
5482 v22 = v35; | |
5483 v3->uTintColor = 0; | |
5484 v3->uScreenSpaceY = v22; | |
5485 //v23 = 8 * i; | |
5486 //LOBYTE(v23) = PID(OBJECT_Item,i); | |
5487 v3->pSpriteFrame = v24; | |
5488 //v12 = (p->uAttributes & 0x20) == 0; | |
5489 //v3->sZValue = v21 + v23; | |
5490 v3->actual_z = HIWORD(x); | |
5491 v3->object_pid = PID(OBJECT_Item,i); | |
5492 if (p->uAttributes & 0x20) | |
5493 { | |
5494 if ( !pRenderer->pRenderD3D ) | |
5495 v3->sZValue = 0; | |
5496 } | |
5497 } | |
5498 } | |
5499 } | |
5500 } | |
5501 } | |
5502 } | |
5503 | |
5504 //----- (00440639) -------------------------------------------------------- | |
5505 void AddBspNodeToRenderList(unsigned int node_id) | |
5506 { | |
5507 BLVSector *pSector; // esi@1 | |
5508 | |
5509 pSector = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID]; | |
5510 if ( pRenderer->pRenderD3D ) | |
5511 { | |
5512 for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) | |
5513 //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); | |
5514 pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]); | |
5515 } | |
5516 else | |
5517 { | |
5518 for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) | |
5519 pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[i]); | |
5520 } | |
5521 if ( pSector->field_0 & 0x10 ) | |
5522 sub_4406BC(node_id, pSector->uFirstBSPNode); | |
5523 } | |
5524 | |
5525 //----- (004406BC) -------------------------------------------------------- | |
5526 void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode) | |
5527 { | |
5528 BLVSector *pSector; // esi@2 | |
5529 BSPNode *pNode; // edi@2 | |
5530 BLVFace *pFace; // eax@2 | |
5531 int v5; // ecx@2 | |
5532 __int16 v6; // ax@6 | |
5533 int v7; // ebp@10 | |
5534 int v8; // ebx@10 | |
5535 __int16 v9; // di@18 | |
5536 //int v10; // [sp+10h] [bp-Ch]@1 | |
5537 //bool v11; // [sp+14h] [bp-8h]@5 | |
5538 BspRenderer_stru0 *node; // [sp+18h] [bp-4h]@1 | |
5539 | |
5540 //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); | |
5541 | |
5542 //v10 = a1; | |
5543 node = &pBspRenderer->nodes[node_id]; | |
5544 while ( 1 ) | |
5545 { | |
5546 pSector = &pIndoor->pSectors[node->uSectorID]; | |
5547 pNode = &pIndoor->pNodes[uFirstNode]; | |
5548 pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]]; | |
5549 v5 = pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x | |
5550 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation | |
5551 if (pFace->Portal() && pFace->uSectorID != node->uSectorID ) | |
5552 v5 = -v5; | |
5553 //v11 = v5 > 0; | |
5554 if ( v5 <= 0 ) | |
5555 v6 = pNode->uFront; | |
5556 else | |
5557 v6 = pNode->uBack; | |
5558 if ( v6 != -1 ) | |
5559 sub_4406BC(node_id, v6); | |
5560 v7 = pNode->uCoplanarOffset; | |
5561 v8 = v7 + pNode->uCoplanarSize; | |
5562 | |
5563 //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]); | |
5564 | |
5565 if ( pRenderer->pRenderD3D ) | |
5566 { | |
5567 while ( v7 < v8 ) | |
5568 pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[v7++]); | |
5569 } | |
5570 else | |
5571 { | |
5572 while ( v7 < v8 ) | |
5573 pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[v7++]); | |
5574 } | |
5575 v9 = v5 > 0 ? pNode->uFront : pNode->uBack; | |
5576 if ( v9 == -1 ) | |
5577 break; | |
5578 uFirstNode = v9; | |
5579 } | |
5580 } | |
5581 //----- (0043FA33) -------------------------------------------------------- | |
5582 void __fastcall PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID) | |
5583 { | |
5584 LevelDecoration *v2; // esi@1 | |
5585 DecorationDesc *v3; // ebx@2 | |
5586 __int16 v4; // ax@2 | |
5587 double v5; // st7@3 | |
5588 int v6; // eax@5 | |
5589 int v7; // edx@5 | |
5590 unsigned int v8; // edi@5 | |
5591 int v9; // edi@5 | |
5592 int v10; // eax@7 | |
5593 SpriteFrame *v11; // eax@7 | |
5594 SpriteFrame *v12; // esi@7 | |
5595 int v13; // eax@7 | |
5596 int v14; // ebx@16 | |
5597 RenderBillboard *v15; // ecx@17 | |
5598 char v16; // zf@18 | |
5599 IndoorCameraD3D **v17; // eax@19 | |
5600 double v18; // st7@19 | |
5601 //float v19; // eax@19 | |
5602 signed __int64 v20; // qtt@19 | |
5603 signed __int64 v21; // qtt@20 | |
5604 //int v22; // edx@21 | |
5605 //int v23; // eax@21 | |
5606 Particle_sw local_0; // [sp+Ch] [bp-A0h]@3 | |
5607 //double v25; // [sp+74h] [bp-38h]@19 | |
5608 //unsigned int v26; // [sp+7Ch] [bp-30h]@1 | |
5609 int a2; // [sp+80h] [bp-2Ch]@5 | |
5610 int a3; // [sp+84h] [bp-28h]@5 | |
5611 int a1; // [sp+88h] [bp-24h]@5 | |
5612 int v30; // [sp+8Ch] [bp-20h]@7 | |
5613 //float v31; // [sp+90h] [bp-1Ch]@1 | |
5614 int a5; // [sp+94h] [bp-18h]@17 | |
5615 int z; // [sp+98h] [bp-14h]@15 | |
5616 int a6; // [sp+9Ch] [bp-10h]@17 | |
5617 int y; // [sp+A0h] [bp-Ch]@15 | |
5618 int x; // [sp+A4h] [bp-8h]@15 | |
5619 int v37; // [sp+A8h] [bp-4h]@5 | |
5620 | |
5621 //v26 = uDecorationID; | |
5622 //LODWORD(v31) = uSectorID; | |
5623 v2 = &pLevelDecorations[uDecorationID]; | |
5624 if (v2->field_2 & 0x20) | |
5625 return; | |
5626 | |
5627 v3 = &pDecorationList->pDecorations[v2->uDecorationDescID]; | |
5628 v4 = v3->uFlags; | |
5629 if (v3->uFlags & DECORATION_EMITS_FIRE) | |
5630 { | |
5631 memset(&local_0, 0, 0x68u); // fire, like at the Pit's tavern | |
5632 v5 = (double)v2->vPosition.x; | |
5633 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | |
5634 local_0.uDiffuse = 0xFF3C1E; | |
5635 local_0.x = v5; | |
5636 local_0.y = (double)v2->vPosition.y; | |
5637 local_0.z = (double)v2->vPosition.z; | |
5638 local_0.flt_10 = 0.0; | |
5639 local_0.flt_14 = 0.0; | |
5640 local_0.flt_18 = 0.0; | |
5641 local_0.flt_28 = 1.0; | |
5642 local_0.timeToLive = (rand() & 0x80) + 128; | |
5643 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | |
5644 pGame->pParticleEngine->AddParticle(&local_0); | |
5645 return; | |
5646 } | |
5647 | |
5648 | |
5649 if (v4 & DECORATION_DONT_DRAW) | |
5650 return; | |
5651 | |
5652 v6 = v2->vPosition.x; | |
5653 v7 = v2->vPosition.z; | |
5654 a2 = v2->vPosition.y; | |
5655 a1 = v6; | |
5656 a3 = v7; | |
5657 v8 = v2->field_10_y_rot | |
5658 + ((signed int)stru_5C6E00->uIntegerPi >> 3) | |
5659 - stru_5C6E00->Atan2(v6 - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
5660 v37 = pBLVRenderParams->field_0_timer_; | |
5661 v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7; | |
5662 if (pParty->bTurnBasedModeOn) | |
5663 v37 = pMiscTimer->uTotalGameTimeElapsed; | |
5664 v10 = abs(v2->vPosition.x + v2->vPosition.y); | |
5665 v11 = pSpriteFrameTable->GetFrame(v3->uSpriteID, v37 + v10); | |
5666 v30 = 0; | |
5667 v12 = v11; | |
5668 v13 = v11->uFlags; | |
5669 if ( v13 & 2 ) | |
5670 v30 = 2; | |
5671 if ( v13 & 0x40000 ) | |
5672 v30 |= 0x40u; | |
5673 if ( v13 & 0x20000 ) | |
5674 LOBYTE(v30) = v30 | 0x80; | |
5675 if ( (256 << v9) & v13 ) | |
5676 v30 |= 4u; | |
5677 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1, a2, a3, &x, &y, &z, 1) ) | |
5678 { | |
5679 v14 = abs(x); | |
5680 if ( v14 >= abs(y) ) | |
5681 { | |
5682 pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6); | |
5683 | |
5684 v15 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
5685 assert(uNumBillboardsToDraw < 500); | |
5686 | |
5687 ++uNumBillboardsToDraw; | |
5688 ++uNumDecorationsDrawnThisFrame; | |
5689 v16 = pRenderer->pRenderD3D == 0; | |
5690 v15->uHwSpriteID = v12->pHwSpriteIDs[v9]; | |
5691 v15->uPalette = v12->uPaletteIndex; | |
5692 v15->uIndoorSectorID = uSectorID; | |
5693 if ( v16 ) | |
5694 { | |
5695 LODWORD(v21) = pBLVRenderParams->field_40 << 16; | |
5696 HIDWORD(v21) = pBLVRenderParams->field_40 >> 16; | |
5697 v37 = v21 / x; | |
5698 //LODWORD(v31) = v12->scale; | |
5699 v37 = v21 / x; | |
5700 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v21 / x) >> 16; | |
5701 v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16; | |
5702 } | |
5703 else | |
5704 { | |
5705 v17 = &pGame->pIndoorCameraD3D; | |
5706 v15->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
5707 v18 = (*v17)->fov_y; | |
5708 //v19 = v15->fov_x; | |
5709 v15->fov_y = v18; | |
5710 //v31 = v19; | |
5711 //v25 = v19 + 6.7553994e15; | |
5712 //v25 = floorf(v15->fov_x + 0.5f); | |
5713 LODWORD(v20) = 0; | |
5714 HIDWORD(v20) = floorf(v15->fov_x + 0.5f); | |
5715 v37 = v20 / x; | |
5716 //LODWORD(v31) = v12->scale; | |
5717 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
5718 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
5719 //v31 = v15->fov_y; | |
5720 //v25 = v31 + 6.7553994e15; | |
5721 //v25 = floorf(v15->fov_y + 0.5f); | |
5722 LODWORD(v20) = 0; | |
5723 HIDWORD(v20) = floorf(v15->fov_y + 0.5f); | |
5724 v37 = v20 / x; | |
5725 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
5726 } | |
5727 //HIWORD(v22) = HIWORD(x); | |
5728 //LOWORD(v22) = 0; | |
5729 v15->_screenspace_y_scaler_packedfloat = v37; | |
5730 v15->field_1E = v30; | |
5731 v15->world_x = a1; | |
5732 v15->world_y = a2; | |
5733 v15->world_z = a3; | |
5734 v15->uScreenSpaceX = a5; | |
5735 v15->uScreenSpaceY = a6; | |
5736 //v23 = 8 * uDecorationID; | |
5737 //LOBYTE(v23) = PID(OBJECT_Decoration,uDecorationID); | |
5738 | |
5739 //v15->sZValue = v22 + v23; | |
5740 v15->actual_z = HIWORD(x); | |
5741 v15->object_pid = PID(OBJECT_Decoration,uDecorationID); | |
5742 | |
5743 v15->uTintColor = 0; | |
5744 v15->pSpriteFrame = v12; | |
5745 } | |
5746 } | |
5747 } | |
5748 //----- (0043F953) -------------------------------------------------------- | |
5749 void PrepareBspRenderList_BLV() | |
5750 { | |
5751 pBspRenderer->num_faces = 0; | |
5752 | |
5753 if (pBLVRenderParams->uPartySectorID) | |
5754 { | |
5755 pBspRenderer->nodes[0].uSectorID = pBLVRenderParams->uPartySectorID; | |
5756 pBspRenderer->nodes[0].uViewportW = pBLVRenderParams->uViewportW; | |
5757 pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ; | |
5758 pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY; | |
5759 pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX; | |
5760 pBspRenderer->nodes[0].field_C.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, | |
5761 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); | |
5762 pBspRenderer->nodes[0].uFaceID = -1; | |
5763 pBspRenderer->nodes[0].viewing_portal_id = -1; | |
5764 pBspRenderer->num_nodes = 1; | |
5765 AddBspNodeToRenderList(0); | |
5766 } | |
5767 | |
5768 pBspRenderer->MakeVisibleSectorList(); | |
5769 } | |
5770 | |
5771 //----- (0043F9E1) -------------------------------------------------------- | |
5772 void BspRenderer_stru2::GetViewportData(__int16 x, int y, __int16 z, int w) | |
5773 { | |
5774 _viewport_space_y = y; | |
5775 _viewport_space_w = w; | |
5776 | |
5777 for (uint i = 0; i < 480; ++i) | |
5778 { | |
5779 if ( i < y || i > w ) | |
5780 { | |
5781 viewport_left_side[i] = 640; | |
5782 viewport_right_side[i] = -1; | |
5783 } | |
5784 else | |
5785 { | |
5786 viewport_left_side[i] = x; | |
5787 viewport_right_side[i] = z; | |
5788 } | |
5789 } | |
5790 } | |
5791 //----- (0048653D) -------------------------------------------------------- | |
5792 int stru149::_48653D(int a2, int a3, int a4, int a5, int a6, int a7)//portal frustum culling | |
5793 { | |
5794 stru149 *v7; // esi@1 | |
5795 int v8; // edi@1 | |
5796 int v9; // eax@1 | |
5797 //int v10; // edx@1 | |
5798 //int v11; // ecx@1 | |
5799 int v12; // eax@1 | |
5800 int v13; // ebx@2 | |
5801 int v14; // ecx@2 | |
5802 int v15; // eax@2 | |
5803 int v16; // ST14_4@3 | |
5804 int v17; // ST10_4@3 | |
5805 int v18; // eax@5 | |
5806 int v19; // ST10_4@6 | |
5807 int v20; // eax@8 | |
5808 int v21; // ST10_4@9 | |
5809 int v22; // eax@10 | |
5810 int v23; // ecx@10 | |
5811 int v24; // eax@10 | |
5812 int result; // eax@10 | |
5813 //int v26; // [sp+14h] [bp-14h]@1 | |
5814 int v27; // [sp+18h] [bp-10h]@1 | |
5815 int v28; // [sp+1Ch] [bp-Ch]@1 | |
5816 int v29; // [sp+24h] [bp-4h]@1 | |
5817 int v30; // [sp+30h] [bp+8h]@10 | |
5818 int v31; // [sp+3Ch] [bp+14h]@10 | |
5819 | |
5820 v7 = this; | |
5821 v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY); | |
5822 v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY); | |
5823 v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX); | |
5824 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX); | |
5825 //v11 = -pBLVRenderParams->vPartyPos.y; | |
5826 //v26 = -pBLVRenderParams->vPartyPos.x; | |
5827 v27 = v9; | |
5828 v12 = -pBLVRenderParams->vPartyPos.z; | |
5829 if ( pBLVRenderParams->sPartyRotX ) | |
5830 { | |
5831 v16 = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; | |
5832 v13 = v28; | |
5833 v17 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5834 v7->field_0_party_dir_x = ((unsigned __int64)(v16 * (signed __int64)v28) >> 16) | |
5835 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)v27) >> 16); | |
5836 v7->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; | |
5837 v14 = v27; | |
5838 v15 = ((unsigned __int64)(v17 * (signed __int64)v28) >> 16) - ((unsigned __int64)(v16 * (signed __int64)v27) >> 16); | |
5839 } | |
5840 else | |
5841 { | |
5842 v7->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; | |
5843 v13 = v28; | |
5844 v7->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; | |
5845 v14 = v27; | |
5846 v15 = v12 << 16; | |
5847 } | |
5848 v7->field_8 = v15; | |
5849 if ( pBLVRenderParams->sPartyRotX ) | |
5850 { | |
5851 v19 = ((unsigned __int64)(a2 * (signed __int64)v8) >> 16) + ((unsigned __int64)(a3 * (signed __int64)v29) >> 16); | |
5852 v7->field_C = ((unsigned __int64)(v19 * (signed __int64)v13) >> 16) | |
5853 + ((unsigned __int64)(a4 * (signed __int64)v14) >> 16); | |
5854 v7->field_10 = ((unsigned __int64)(a3 * (signed __int64)v8) >> 16) | |
5855 - ((unsigned __int64)(a2 * (signed __int64)v29) >> 16); | |
5856 v18 = ((unsigned __int64)(a4 * (signed __int64)v13) >> 16) - ((unsigned __int64)(v19 * (signed __int64)v14) >> 16); | |
5857 } | |
5858 else | |
5859 { | |
5860 v7->field_C = ((unsigned __int64)(a2 * (signed __int64)v8) >> 16) | |
5861 + ((unsigned __int64)(a3 * (signed __int64)v29) >> 16); | |
5862 v7->field_10 = ((unsigned __int64)(a3 * (signed __int64)v8) >> 16) | |
5863 - ((unsigned __int64)(a2 * (signed __int64)v29) >> 16); | |
5864 v18 = a4; | |
5865 } | |
5866 v7->field_14 = v18; | |
5867 if ( pBLVRenderParams->sPartyRotX ) | |
5868 { | |
5869 v21 = ((unsigned __int64)(a5 * (signed __int64)v8) >> 16) + ((unsigned __int64)(a6 * (signed __int64)v29) >> 16); | |
5870 v7->field_18 = ((unsigned __int64)(v21 * (signed __int64)v13) >> 16) | |
5871 + ((unsigned __int64)(a7 * (signed __int64)v14) >> 16); | |
5872 v7->field_1C = ((unsigned __int64)(a6 * (signed __int64)v8) >> 16) | |
5873 - ((unsigned __int64)(a5 * (signed __int64)v29) >> 16); | |
5874 v20 = ((unsigned __int64)(a7 * (signed __int64)v13) >> 16) - ((unsigned __int64)(v21 * (signed __int64)v14) >> 16); | |
5875 } | |
5876 else | |
5877 { | |
5878 v7->field_18 = ((unsigned __int64)(a5 * (signed __int64)v8) >> 16) | |
5879 + ((unsigned __int64)(a6 * (signed __int64)v29) >> 16); | |
5880 v7->field_1C = ((unsigned __int64)(a6 * (signed __int64)v8) >> 16) | |
5881 - ((unsigned __int64)(a5 * (signed __int64)v29) >> 16); | |
5882 v20 = a7; | |
5883 } | |
5884 v7->field_18 = -v7->field_18; | |
5885 v7->field_1C = -v7->field_1C; | |
5886 v7->field_20 = v20; | |
5887 v22 = v7->field_C; | |
5888 v7->field_20 = -v7->field_20; | |
5889 v23 = ((unsigned __int64)(v22 * (signed __int64)v7->field_0_party_dir_x) >> 16) | |
5890 + ((unsigned __int64)(v7->field_10 * (signed __int64)v7->field_4_party_dir_y) >> 16) | |
5891 + ((unsigned __int64)(v7->field_14 * (signed __int64)v7->field_8) >> 16); | |
5892 v30 = v7->field_18; | |
5893 v24 = v7->field_0_party_dir_x; | |
5894 v7->field_24 = v23; | |
5895 v31 = (unsigned __int64)(v30 * (signed __int64)v24) >> 16; | |
5896 result = (unsigned __int64)(v7->field_1C * (signed __int64)v7->field_4_party_dir_y) >> 16; | |
5897 v7->field_28 = v31 + result + ((unsigned __int64)(v7->field_20 * (signed __int64)v7->field_8) >> 16); | |
5898 return result; | |
1297 | 5899 } |
5900 //----- (00407A1C) -------------------------------------------------------- | |
5901 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) | |
5902 { | |
5903 unsigned int v4; // esi@1 | |
5904 Vec3_int_ v5; // ST08_12@2 | |
5905 int v6; // edi@2 | |
5906 int v7; // ebx@2 | |
5907 int v8; // esi@2 | |
5908 signed int v9; // ecx@2 | |
5909 int v10; // eax@2 | |
5910 int v11; // ecx@4 | |
5911 int v12; // eax@4 | |
5912 int v13; // ebx@4 | |
5913 int v14; // edx@6 | |
5914 char *v15; // edi@16 | |
5915 ODMFace *v16; // esi@19 | |
5916 int v17; // ST34_4@25 | |
5917 int v18; // ST38_4@25 | |
5918 int v19; // eax@25 | |
5919 char v20; // zf@25 | |
5920 int v21; // ebx@25 | |
5921 int v22; // eax@26 | |
5922 signed int v23; // edi@26 | |
5923 int v24; // ST34_4@30 | |
5924 signed __int64 v25; // qtt@31 | |
5925 int v26; // eax@31 | |
5926 Vec3_int_ v27; // ST08_12@37 | |
5927 Vec3_int_ v28; // ST08_12@37 | |
5928 int v29; // edi@37 | |
5929 int v30; // ebx@37 | |
5930 int v31; // esi@37 | |
5931 signed int v32; // ecx@37 | |
5932 int v33; // eax@37 | |
5933 int v34; // ecx@39 | |
5934 int v35; // eax@39 | |
5935 int v36; // ebx@39 | |
5936 int v37; // edx@41 | |
5937 char *v38; // edi@51 | |
5938 ODMFace *v39; // esi@54 | |
5939 int v40; // ebx@60 | |
5940 int v41; // eax@61 | |
5941 signed int v42; // edi@61 | |
5942 signed __int64 v43; // qtt@66 | |
5943 int v44; // eax@66 | |
5944 Vec3_int_ v45; // ST08_12@73 | |
5945 int v46; // edi@73 | |
5946 int v47; // ebx@73 | |
5947 int v48; // esi@73 | |
5948 signed int v49; // ecx@73 | |
5949 int v50; // eax@73 | |
5950 int v51; // edx@75 | |
5951 int v52; // ecx@75 | |
5952 int v53; // eax@75 | |
5953 int v54; // ebx@75 | |
5954 int v55; // edi@77 | |
5955 int v56; // ecx@77 | |
5956 int v57; // eax@81 | |
5957 int v58; // esi@81 | |
5958 int v59; // eax@90 | |
5959 BLVSector *v60; // edx@90 | |
5960 int v61; // ecx@90 | |
5961 BLVFace *v62; // esi@91 | |
5962 int v63; // ST34_4@98 | |
5963 int v64; // ST30_4@98 | |
5964 int v65; // eax@98 | |
5965 int v66; // ebx@98 | |
5966 int v67; // eax@99 | |
5967 signed int v68; // edi@99 | |
5968 int v69; // ST2C_4@103 | |
5969 signed __int64 v70; // qtt@104 | |
5970 int v71; // eax@104 | |
5971 Vec3_int_ v72; // ST08_12@111 | |
5972 Vec3_int_ v73; // ST08_12@111 | |
5973 int v74; // edi@111 | |
5974 int v75; // ebx@111 | |
5975 int v76; // esi@111 | |
5976 signed int v77; // ecx@111 | |
5977 int v78; // eax@111 | |
5978 int v79; // edx@113 | |
5979 int v80; // ecx@113 | |
5980 int v81; // eax@113 | |
5981 int v82; // ebx@113 | |
5982 int v83; // edi@115 | |
5983 int v84; // ecx@115 | |
5984 int v85; // eax@119 | |
5985 int v86; // esi@119 | |
5986 int v87; // ecx@128 | |
5987 BLVSector *v88; // eax@128 | |
5988 int v89; // ecx@128 | |
5989 BLVFace *v90; // esi@129 | |
5990 int v91; // ebx@136 | |
5991 int v92; // eax@137 | |
5992 signed int v93; // edi@137 | |
5993 signed __int64 v94; // qtt@142 | |
5994 int v95; // eax@142 | |
5995 Vec3_int_ v97; // [sp-18h] [bp-94h]@1 | |
5996 int v98; // [sp-Ch] [bp-88h]@88 | |
5997 int v99; // [sp-Ch] [bp-88h]@126 | |
5998 int v100; // [sp-8h] [bp-84h]@88 | |
5999 int v101; // [sp-8h] [bp-84h]@126 | |
6000 int v102; // [sp-4h] [bp-80h]@88 | |
6001 int v103; // [sp-4h] [bp-80h]@126 | |
6002 int v104; // [sp+Ch] [bp-70h]@13 | |
6003 int v105; // [sp+Ch] [bp-70h]@48 | |
6004 int v106; // [sp+10h] [bp-6Ch]@18 | |
6005 int v107; // [sp+10h] [bp-6Ch]@98 | |
6006 int v108; // [sp+10h] [bp-6Ch]@104 | |
6007 int v109; // [sp+18h] [bp-64h]@25 | |
6008 int v110; // [sp+18h] [bp-64h]@31 | |
6009 int i; // [sp+18h] [bp-64h]@90 | |
6010 int v112; // [sp+18h] [bp-64h]@128 | |
6011 signed int v113; // [sp+20h] [bp-5Ch]@1 | |
6012 signed int v114; // [sp+24h] [bp-58h]@1 | |
6013 unsigned __int64 a4; // [sp+28h] [bp-54h]@1 | |
6014 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 | |
6015 int v117; // [sp+34h] [bp-48h]@4 | |
6016 int v118; // [sp+34h] [bp-48h]@39 | |
6017 int v119; // [sp+34h] [bp-48h]@75 | |
6018 int v120; // [sp+34h] [bp-48h]@113 | |
6019 int v121; // [sp+38h] [bp-44h]@4 | |
6020 int v122; // [sp+38h] [bp-44h]@39 | |
6021 int v123; // [sp+38h] [bp-44h]@76 | |
6022 int v124; // [sp+38h] [bp-44h]@114 | |
6023 int v125; // [sp+3Ch] [bp-40h]@4 | |
6024 int v126; // [sp+3Ch] [bp-40h]@39 | |
6025 int v127; // [sp+3Ch] [bp-40h]@77 | |
6026 int v128; // [sp+3Ch] [bp-40h]@115 | |
6027 int v129; // [sp+40h] [bp-3Ch]@11 | |
6028 int v130; // [sp+40h] [bp-3Ch]@46 | |
6029 int v131; // [sp+40h] [bp-3Ch]@78 | |
6030 int v132; // [sp+40h] [bp-3Ch]@116 | |
6031 int v133; // [sp+44h] [bp-38h]@10 | |
6032 int v134; // [sp+44h] [bp-38h]@45 | |
6033 int v135; // [sp+44h] [bp-38h]@81 | |
6034 int v136; // [sp+44h] [bp-38h]@119 | |
6035 int v137; // [sp+48h] [bp-34h]@7 | |
6036 int v138; // [sp+48h] [bp-34h]@42 | |
6037 int v139; // [sp+48h] [bp-34h]@82 | |
6038 int v140; // [sp+48h] [bp-34h]@120 | |
6039 int v141; // [sp+4Ch] [bp-30h]@6 | |
6040 int v142; // [sp+4Ch] [bp-30h]@41 | |
6041 int v143; // [sp+4Ch] [bp-30h]@75 | |
6042 int v144; // [sp+4Ch] [bp-30h]@113 | |
6043 int v145; // [sp+50h] [bp-2Ch]@5 | |
6044 int v146; // [sp+50h] [bp-2Ch]@40 | |
6045 int v147; // [sp+50h] [bp-2Ch]@75 | |
6046 int v148; // [sp+50h] [bp-2Ch]@113 | |
6047 int v149; // [sp+54h] [bp-28h]@4 | |
6048 int v150; // [sp+54h] [bp-28h]@39 | |
6049 int v151; // [sp+54h] [bp-28h]@75 | |
6050 int v152; // [sp+54h] [bp-28h]@113 | |
6051 int sDepth; // [sp+58h] [bp-24h]@17 | |
6052 int sDeptha; // [sp+58h] [bp-24h]@52 | |
6053 int sDepthb; // [sp+58h] [bp-24h]@90 | |
6054 char *a5; // [sp+5Ch] [bp-20h]@16 | |
6055 char *a5a; // [sp+5Ch] [bp-20h]@51 | |
6056 signed int a5b; // [sp+5Ch] [bp-20h]@83 | |
6057 signed int a5c; // [sp+5Ch] [bp-20h]@121 | |
6058 signed int v160; // [sp+60h] [bp-1Ch]@12 | |
6059 signed int v161; // [sp+60h] [bp-1Ch]@47 | |
6060 int v162; // [sp+60h] [bp-1Ch]@128 | |
6061 int v163; // [sp+64h] [bp-18h]@2 | |
6062 int outx; // [sp+68h] [bp-14h]@2 | |
6063 int outy; // [sp+6Ch] [bp-10h]@2 | |
6064 int outz; // [sp+70h] [bp-Ch]@2 | |
6065 Vec3_int_ pOut; // [sp+74h] [bp-8h]@2 | |
6066 int ya; // [sp+84h] [bp+8h]@60 | |
6067 int yb; // [sp+84h] [bp+8h]@136 | |
6068 int ve; // [sp+88h] [bp+Ch]@60 | |
6069 int va; // [sp+88h] [bp+Ch]@60 | |
6070 int vb; // [sp+88h] [bp+Ch]@66 | |
6071 int vf; // [sp+88h] [bp+Ch]@136 | |
6072 int vc; // [sp+88h] [bp+Ch]@136 | |
6073 int vd; // [sp+88h] [bp+Ch]@142 | |
6074 int v_4; // [sp+8Ch] [bp+10h]@60 | |
6075 int v_4a; // [sp+8Ch] [bp+10h]@65 | |
6076 int v_4b; // [sp+8Ch] [bp+10h]@136 | |
6077 int v_4c; // [sp+8Ch] [bp+10h]@141 | |
6078 int v_8; // [sp+90h] [bp+14h]@53 | |
6079 | |
6080 a4 = __PAIR__(z, x); | |
6081 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); | |
6082 v114 = 0; | |
6083 v97.z = y; | |
6084 v113 = 0; | |
6085 a4_8 = v4; | |
6086 *(_QWORD *)&v97.x = a4; | |
6087 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
6088 { | |
6089 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
6090 v45.z = v.z; | |
6091 *(_QWORD *)&v45.x = *(_QWORD *)&v; | |
6092 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163); | |
6093 v46 = outy - pOut.y; | |
6094 v47 = v163 - outz; | |
6095 v48 = outx - pOut.x; | |
6096 v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47); | |
6097 v50 = 65536; | |
6098 if ( v49 ) | |
6099 v50 = 65536 / v49; | |
6100 v51 = outx; | |
6101 v143 = v48 * v50; | |
6102 v52 = v46 * v50; | |
6103 v53 = v47 * v50; | |
6104 v54 = pOut.x; | |
6105 v147 = v52; | |
6106 v151 = v53; | |
6107 v119 = pOut.x; | |
6108 if ( pOut.x < outx ) | |
6109 { | |
6110 v123 = outx; | |
6111 } | |
6112 else | |
6113 { | |
6114 v119 = outx; | |
6115 v123 = pOut.x; | |
6116 } | |
6117 v55 = pOut.y; | |
6118 v56 = outy; | |
6119 v127 = pOut.y; | |
6120 if ( pOut.y < outy ) | |
6121 { | |
6122 v131 = outy; | |
6123 } | |
6124 else | |
6125 { | |
6126 v127 = outy; | |
6127 v131 = pOut.y; | |
6128 } | |
6129 v57 = v163; | |
6130 v58 = outz; | |
6131 v135 = outz; | |
6132 if ( outz < v163 ) | |
6133 { | |
6134 v139 = v163; | |
6135 } | |
6136 else | |
6137 { | |
6138 v135 = v163; | |
6139 v139 = outz; | |
6140 } | |
6141 a5b = 0; | |
6142 while ( !v114 ) | |
6143 { | |
6144 if ( a5b ) | |
6145 { | |
6146 v102 = v58; | |
6147 v100 = v55; | |
6148 v98 = v54; | |
6149 } | |
6150 else | |
6151 { | |
6152 v102 = v57; | |
6153 v100 = v56; | |
6154 v98 = v51; | |
6155 } | |
6156 v59 = pIndoor->GetSector(v98, v100, v102); | |
6157 v60 = pIndoor->pSectors; | |
6158 v61 = 116 * v59; | |
6159 sDepthb = 0; | |
6160 for ( i = 116 * v59; | |
6161 sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61) | |
6162 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); | |
6163 ++sDepthb ) | |
6164 { | |
6165 v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; | |
6166 if ( v62->Portal() | |
6167 || v119 > v62->pBounding.x2 | |
6168 || v123 < v62->pBounding.x1 | |
6169 || v127 > v62->pBounding.y2 | |
6170 || v131 < v62->pBounding.y1 | |
6171 || v135 > v62->pBounding.z2 | |
6172 || v139 < v62->pBounding.z1 | |
6173 || (v63 = (unsigned __int64)(v143 * (signed __int64)v62->pFacePlane_old.vNormal.x) >> 16, | |
6174 v64 = (unsigned __int64)(v151 * (signed __int64)v62->pFacePlane_old.vNormal.z) >> 16, | |
6175 v65 = (unsigned __int64)(v147 * (signed __int64)v62->pFacePlane_old.vNormal.y) >> 16, | |
6176 v20 = v63 + v64 + v65 == 0, | |
6177 v66 = v63 + v64 + v65, | |
6178 v107 = v63 + v64 + v65, | |
6179 v20) ) | |
6180 goto LABEL_107; | |
6181 v67 = outz * v62->pFacePlane_old.vNormal.z; | |
6182 v68 = -(v62->pFacePlane_old.dist | |
6183 + v67 | |
6184 + pOut.y * v62->pFacePlane_old.vNormal.y | |
6185 + pOut.x * v62->pFacePlane_old.vNormal.x); | |
6186 if ( v66 <= 0 ) | |
6187 { | |
6188 if ( v62->pFacePlane_old.dist | |
6189 + v67 | |
6190 + pOut.y * v62->pFacePlane_old.vNormal.y | |
6191 + pOut.x * v62->pFacePlane_old.vNormal.x < 0 ) | |
6192 goto LABEL_107; | |
6193 } | |
6194 else | |
6195 { | |
6196 if ( v62->pFacePlane_old.dist | |
6197 + v67 | |
6198 + pOut.y * v62->pFacePlane_old.vNormal.y | |
6199 + pOut.x * v62->pFacePlane_old.vNormal.x > 0 ) | |
6200 goto LABEL_107; | |
6201 } | |
6202 v69 = abs(-(v62->pFacePlane_old.dist | |
6203 + v67 | |
6204 + pOut.y * v62->pFacePlane_old.vNormal.y | |
6205 + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14; | |
6206 if ( v69 <= abs(v66) ) | |
6207 { | |
6208 LODWORD(v70) = v68 << 16; | |
6209 HIDWORD(v70) = v68 >> 16; | |
6210 v71 = v70 / v107; | |
6211 v108 = v70 / v107; | |
6212 if ( v71 >= 0 ) | |
6213 { | |
6214 if ( sub_4075DB( | |
6215 pOut.x + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v143) >> 16) + 32768) >> 16), | |
6216 pOut.y + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v147) >> 16) + 32768) >> 16), | |
6217 outz + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v151) >> 16) + 32768) >> 16), | |
6218 v62) ) | |
6219 { | |
6220 v114 = 1; | |
6221 break; | |
6222 } | |
6223 } | |
6224 } | |
6225 v61 = i; | |
6226 LABEL_107: | |
6227 v60 = pIndoor->pSectors; | |
6228 } | |
6229 ++a5b; | |
6230 if ( a5b >= 2 ) | |
6231 break; | |
6232 v57 = v163; | |
6233 v56 = outy; | |
6234 v51 = outx; | |
6235 v58 = outz; | |
6236 v55 = pOut.y; | |
6237 v54 = pOut.x; | |
6238 } | |
6239 v72.z = y; | |
6240 *(_QWORD *)&v72.x = a4; | |
6241 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); | |
6242 v73.z = v.z; | |
6243 *(_QWORD *)&v73.x = *(_QWORD *)&v; | |
6244 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); | |
6245 v74 = outy - pOut.y; | |
6246 v75 = v163 - outz; | |
6247 v76 = outx - pOut.x; | |
6248 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); | |
6249 v78 = 65536; | |
6250 if ( v77 ) | |
6251 v78 = 65536 / v77; | |
6252 v79 = outx; | |
6253 v144 = v76 * v78; | |
6254 v80 = v74 * v78; | |
6255 v81 = v75 * v78; | |
6256 v82 = pOut.x; | |
6257 v148 = v80; | |
6258 v152 = v81; | |
6259 v120 = pOut.x; | |
6260 if ( pOut.x < outx ) | |
6261 { | |
6262 v124 = outx; | |
6263 } | |
6264 else | |
6265 { | |
6266 v120 = outx; | |
6267 v124 = pOut.x; | |
6268 } | |
6269 v83 = pOut.y; | |
6270 v84 = outy; | |
6271 v128 = pOut.y; | |
6272 if ( pOut.y < outy ) | |
6273 { | |
6274 v132 = outy; | |
6275 } | |
6276 else | |
6277 { | |
6278 v128 = outy; | |
6279 v132 = pOut.y; | |
6280 } | |
6281 v85 = v163; | |
6282 v86 = outz; | |
6283 v136 = outz; | |
6284 if ( outz < v163 ) | |
6285 { | |
6286 v140 = v163; | |
6287 } | |
6288 else | |
6289 { | |
6290 v136 = v163; | |
6291 v140 = outz; | |
6292 } | |
6293 a5c = 0; | |
6294 while ( 1 ) | |
6295 { | |
6296 if ( v113 ) | |
6297 return !v114 || !v113; | |
6298 if ( a5c ) | |
6299 { | |
6300 v103 = v86; | |
6301 v101 = v83; | |
6302 v99 = v82; | |
6303 } | |
6304 else | |
6305 { | |
6306 v103 = v85; | |
6307 v101 = v84; | |
6308 v99 = v79; | |
6309 } | |
6310 v87 = pIndoor->GetSector(v99, v101, v103); | |
6311 v88 = pIndoor->pSectors; | |
6312 v89 = 116 * v87; | |
6313 v162 = 0; | |
6314 v112 = v89; | |
6315 if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) | |
6316 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) | |
6317 break; | |
6318 LABEL_148: | |
6319 ++a5c; | |
6320 if ( a5c >= 2 ) | |
6321 return !v114 || !v113; | |
6322 v85 = v163; | |
6323 v84 = outy; | |
6324 v79 = outx; | |
6325 v86 = outz; | |
6326 v83 = pOut.y; | |
6327 v82 = pOut.x; | |
6328 } | |
6329 while ( 1 ) | |
6330 { | |
6331 v90 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]]; | |
6332 if ( v90->Portal() | |
6333 || v120 > v90->pBounding.x2 | |
6334 || v124 < v90->pBounding.x1 | |
6335 || v128 > v90->pBounding.y2 | |
6336 || v132 < v90->pBounding.y1 | |
6337 || v136 > v90->pBounding.z2 | |
6338 || v140 < v90->pBounding.z1 | |
6339 || (yb = (unsigned __int64)(v144 * (signed __int64)v90->pFacePlane_old.vNormal.x) >> 16, | |
6340 v_4b = (unsigned __int64)(v148 * (signed __int64)v90->pFacePlane_old.vNormal.y) >> 16, | |
6341 vf = (unsigned __int64)(v152 * (signed __int64)v90->pFacePlane_old.vNormal.z) >> 16, | |
6342 v20 = yb + vf + v_4b == 0, | |
6343 v91 = yb + vf + v_4b, | |
6344 vc = yb + vf + v_4b, | |
6345 v20) ) | |
6346 goto LABEL_145; | |
6347 v92 = outz * v90->pFacePlane_old.vNormal.z; | |
6348 v93 = -(v90->pFacePlane_old.dist | |
6349 + v92 | |
6350 + pOut.y * v90->pFacePlane_old.vNormal.y | |
6351 + pOut.x * v90->pFacePlane_old.vNormal.x); | |
6352 if ( v91 <= 0 ) | |
6353 { | |
6354 if ( v90->pFacePlane_old.dist | |
6355 + v92 | |
6356 + pOut.y * v90->pFacePlane_old.vNormal.y | |
6357 + pOut.x * v90->pFacePlane_old.vNormal.x < 0 ) | |
6358 goto LABEL_145; | |
6359 } | |
6360 else | |
6361 { | |
6362 if ( v90->pFacePlane_old.dist | |
6363 + v92 | |
6364 + pOut.y * v90->pFacePlane_old.vNormal.y | |
6365 + pOut.x * v90->pFacePlane_old.vNormal.x > 0 ) | |
6366 goto LABEL_145; | |
6367 } | |
6368 v_4c = abs(-(v90->pFacePlane_old.dist | |
6369 + v92 | |
6370 + pOut.y * v90->pFacePlane_old.vNormal.y | |
6371 + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14; | |
6372 if ( v_4c <= abs(v91) ) | |
6373 { | |
6374 LODWORD(v94) = v93 << 16; | |
6375 HIDWORD(v94) = v93 >> 16; | |
6376 v95 = v94 / vc; | |
6377 vd = v94 / vc; | |
6378 if ( v95 >= 0 ) | |
6379 { | |
6380 if ( sub_4075DB( | |
6381 pOut.x + ((signed int)(((unsigned __int64)(vd * (signed __int64)v144) >> 16) + 32768) >> 16), | |
6382 pOut.y + ((signed int)(((unsigned __int64)(vd * (signed __int64)v148) >> 16) + 32768) >> 16), | |
6383 outz + ((signed int)(((unsigned __int64)(vd * (signed __int64)v152) >> 16) + 32768) >> 16), | |
6384 v90) ) | |
6385 { | |
6386 v113 = 1; | |
6387 goto LABEL_148; | |
6388 } | |
6389 } | |
6390 } | |
6391 v89 = v112; | |
6392 LABEL_145: | |
6393 v88 = pIndoor->pSectors; | |
6394 ++v162; | |
6395 if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) | |
6396 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) | |
6397 goto LABEL_148; | |
6398 } | |
6399 } | |
6400 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
6401 v5.z = v.z; | |
6402 *(_QWORD *)&v5.x = *(_QWORD *)&v; | |
6403 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163); | |
6404 v6 = outy - pOut.y; | |
6405 v7 = v163 - outz; | |
6406 v8 = outx - pOut.x; | |
6407 v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7); | |
6408 v10 = 65536; | |
6409 if ( v9 ) | |
6410 v10 = 65536 / v9; | |
6411 v125 = v8 * v10; | |
6412 v11 = v10; | |
6413 v12 = v7 * v10; | |
6414 v13 = pOut.x; | |
6415 v117 = v12; | |
6416 v121 = v6 * v11; | |
6417 v149 = pOut.x; | |
6418 if ( pOut.x < outx ) | |
6419 { | |
6420 v145 = outx; | |
6421 } | |
6422 else | |
6423 { | |
6424 v149 = outx; | |
6425 v145 = pOut.x; | |
6426 } | |
6427 v14 = outy; | |
6428 v141 = pOut.y; | |
6429 if ( pOut.y < outy ) | |
6430 { | |
6431 v137 = outy; | |
6432 } | |
6433 else | |
6434 { | |
6435 v141 = outy; | |
6436 v137 = pOut.y; | |
6437 } | |
6438 v133 = outz; | |
6439 if ( outz < v163 ) | |
6440 { | |
6441 v129 = v163; | |
6442 } | |
6443 else | |
6444 { | |
6445 v133 = v163; | |
6446 v129 = outz; | |
6447 } | |
6448 v160 = 0; | |
6449 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
6450 { | |
6451 v104 = 0; | |
6452 while ( 1 ) | |
6453 { | |
6454 v15 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
6455 a5 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
6456 if ( sub_4088E9(v13, pOut.y, outx, v14, pOutdoor->pBModels[v104].vPosition.x, pOutdoor->pBModels[v104].vPosition.y) <= pOutdoor->pBModels[v104].sBoundingRadius + 128 ) | |
6457 { | |
6458 sDepth = 0; | |
6459 if ( *((int *)v15 + 2) > 0 ) | |
6460 break; | |
6461 } | |
6462 LABEL_36: | |
6463 ++v160; | |
6464 ++v104; | |
6465 if ( v160 >= (signed int)pOutdoor->uNumBModels ) | |
6466 goto LABEL_37; | |
6467 v14 = outy; | |
6468 v13 = pOut.x; | |
6469 } | |
6470 v106 = 0; | |
6471 while ( 1 ) | |
6472 { | |
6473 v16 = (ODMFace *)(v106 + *((int *)a5 + 4)); | |
6474 if ( v149 > v16->pBoundingBox.x2 | |
6475 || v145 < v16->pBoundingBox.x1 | |
6476 || v141 > v16->pBoundingBox.y2 | |
6477 || v137 < v16->pBoundingBox.y1 | |
6478 || v133 > v16->pBoundingBox.z2 | |
6479 || v129 < v16->pBoundingBox.z1 | |
6480 || (v17 = (unsigned __int64)(v125 * (signed __int64)v16->pFacePlane.vNormal.x) >> 16, | |
6481 v18 = (unsigned __int64)(v121 * (signed __int64)v16->pFacePlane.vNormal.y) >> 16, | |
6482 v19 = (unsigned __int64)(v117 * (signed __int64)v16->pFacePlane.vNormal.z) >> 16, | |
6483 v20 = v17 + v18 + v19 == 0, | |
6484 v21 = v17 + v18 + v19, | |
6485 v109 = v17 + v18 + v19, | |
6486 v20) ) | |
6487 goto LABEL_33; | |
6488 v22 = pOut.y * v16->pFacePlane.vNormal.y; | |
6489 v23 = -(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x); | |
6490 if ( v21 <= 0 ) | |
6491 { | |
6492 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x < 0 ) | |
6493 goto LABEL_33; | |
6494 } | |
6495 else | |
6496 { | |
6497 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x > 0 ) | |
6498 goto LABEL_33; | |
6499 } | |
6500 v24 = abs(-(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x)) >> 14; | |
6501 if ( v24 <= abs(v21) ) | |
6502 { | |
6503 LODWORD(v25) = v23 << 16; | |
6504 HIDWORD(v25) = v23 >> 16; | |
6505 v26 = v25 / v109; | |
6506 v110 = v25 / v109; | |
6507 if ( v26 >= 0 ) | |
6508 { | |
6509 if ( sub_4077F1( | |
6510 pOut.x + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v125) >> 16) + 32768) >> 16), | |
6511 pOut.y + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v121) >> 16) + 32768) >> 16), | |
6512 outz + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v117) >> 16) + 32768) >> 16), | |
6513 v16, | |
6514 (BSPVertexBuffer *)a5) ) | |
6515 { | |
6516 v114 = 1; | |
6517 goto LABEL_36; | |
6518 } | |
6519 } | |
6520 } | |
6521 LABEL_33: | |
6522 ++sDepth; | |
6523 v106 += 308; | |
6524 if ( sDepth >= *((int *)a5 + 2) ) | |
6525 goto LABEL_36; | |
6526 } | |
6527 } | |
6528 LABEL_37: | |
6529 v27.z = y; | |
6530 *(_QWORD *)&v27.x = a4; | |
6531 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); | |
6532 v28.z = v.z; | |
6533 *(_QWORD *)&v28.x = *(_QWORD *)&v; | |
6534 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); | |
6535 v29 = outy - pOut.y; | |
6536 v30 = v163 - outz; | |
6537 v31 = outx - pOut.x; | |
6538 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); | |
6539 v33 = 65536; | |
6540 if ( v32 ) | |
6541 v33 = 65536 / v32; | |
6542 v126 = v31 * v33; | |
6543 v34 = v33; | |
6544 v35 = v30 * v33; | |
6545 v36 = pOut.x; | |
6546 v118 = v35; | |
6547 v122 = v29 * v34; | |
6548 v150 = pOut.x; | |
6549 if ( pOut.x < outx ) | |
6550 { | |
6551 v146 = outx; | |
6552 } | |
6553 else | |
6554 { | |
6555 v150 = outx; | |
6556 v146 = pOut.x; | |
6557 } | |
6558 v37 = outy; | |
6559 v142 = pOut.y; | |
6560 if ( pOut.y < outy ) | |
6561 { | |
6562 v138 = outy; | |
6563 } | |
6564 else | |
6565 { | |
6566 v142 = outy; | |
6567 v138 = pOut.y; | |
6568 } | |
6569 v134 = outz; | |
6570 if ( outz < v163 ) | |
6571 { | |
6572 v130 = v163; | |
6573 } | |
6574 else | |
6575 { | |
6576 v134 = v163; | |
6577 v130 = outz; | |
6578 } | |
6579 v161 = 0; | |
6580 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
6581 { | |
6582 v105 = 0; | |
6583 while ( 1 ) | |
6584 { | |
6585 v38 = (char *)&pOutdoor->pBModels[v105].pVertices; | |
6586 a5a = (char *)&pOutdoor->pBModels[v105].pVertices; | |
6587 if ( sub_4088E9(v36, pOut.y, outx, v37, pOutdoor->pBModels[v105].vPosition.x, pOutdoor->pBModels[v105].vPosition.y) <= pOutdoor->pBModels[v105].sBoundingRadius + 128 ) | |
6588 { | |
6589 sDeptha = 0; | |
6590 if ( *((int *)v38 + 2) > 0 ) | |
6591 break; | |
6592 } | |
6593 LABEL_71: | |
6594 ++v161; | |
6595 ++v105; | |
6596 if ( v161 >= (signed int)pOutdoor->uNumBModels ) | |
6597 return !v114 || !v113; | |
6598 v37 = outy; | |
6599 v36 = pOut.x; | |
6600 } | |
6601 v_8 = 0; | |
6602 while ( 1 ) | |
6603 { | |
6604 v39 = (ODMFace *)(v_8 + *((int *)a5a + 4)); | |
6605 if ( v150 > v39->pBoundingBox.x2 | |
6606 || v146 < v39->pBoundingBox.x1 | |
6607 || v142 > v39->pBoundingBox.y2 | |
6608 || v138 < v39->pBoundingBox.y1 | |
6609 || v134 > v39->pBoundingBox.z2 | |
6610 || v130 < v39->pBoundingBox.z1 | |
6611 || (ya = (unsigned __int64)(v126 * (signed __int64)v39->pFacePlane.vNormal.x) >> 16, | |
6612 ve = (unsigned __int64)(v122 * (signed __int64)v39->pFacePlane.vNormal.y) >> 16, | |
6613 v_4 = (unsigned __int64)(v118 * (signed __int64)v39->pFacePlane.vNormal.z) >> 16, | |
6614 v20 = ya + ve + v_4 == 0, | |
6615 v40 = ya + ve + v_4, | |
6616 va = ya + ve + v_4, | |
6617 v20) ) | |
6618 goto LABEL_68; | |
6619 v41 = pOut.y * v39->pFacePlane.vNormal.y; | |
6620 v42 = -(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x); | |
6621 if ( v40 <= 0 ) | |
6622 { | |
6623 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x < 0 ) | |
6624 goto LABEL_68; | |
6625 } | |
6626 else | |
6627 { | |
6628 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x > 0 ) | |
6629 goto LABEL_68; | |
6630 } | |
6631 v_4a = abs(-(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x)) >> 14; | |
6632 if ( v_4a <= abs(v40) ) | |
6633 { | |
6634 LODWORD(v43) = v42 << 16; | |
6635 HIDWORD(v43) = v42 >> 16; | |
6636 v44 = v43 / va; | |
6637 vb = v43 / va; | |
6638 if ( v44 >= 0 ) | |
6639 { | |
6640 if ( sub_4077F1( | |
6641 pOut.x + ((signed int)(((unsigned __int64)(vb * (signed __int64)v126) >> 16) + 32768) >> 16), | |
6642 pOut.y + ((signed int)(((unsigned __int64)(vb * (signed __int64)v122) >> 16) + 32768) >> 16), | |
6643 outz + ((signed int)(((unsigned __int64)(vb * (signed __int64)v118) >> 16) + 32768) >> 16), | |
6644 v39, | |
6645 (BSPVertexBuffer *)a5a) ) | |
6646 { | |
6647 v113 = 1; | |
6648 goto LABEL_71; | |
6649 } | |
6650 } | |
6651 } | |
6652 LABEL_68: | |
6653 ++sDeptha; | |
6654 v_8 += 308; | |
6655 if ( sDeptha >= *((int *)a5a + 2) ) | |
6656 goto LABEL_71; | |
6657 } | |
6658 } | |
6659 return !v114 || !v113; | |
6660 } | |
6661 //----- (0043F333) -------------------------------------------------------- | |
6662 void BspRenderer::MakeVisibleSectorList() | |
6663 { | |
6664 int v6; // ebx@3 | |
6665 | |
6666 uNumVisibleNotEmptySectors = 0; | |
6667 for (uint i = 0; i < num_nodes; ++i) | |
6668 { | |
6669 if (!uNumVisibleNotEmptySectors) | |
6670 { | |
6671 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; | |
6672 continue; | |
6673 } | |
6674 | |
6675 v6 = 0; | |
6676 while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID ) | |
6677 { | |
6678 ++v6; | |
6679 if ( v6 >= uNumVisibleNotEmptySectors) | |
6680 { | |
6681 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; | |
6682 } | |
6683 } | |
6684 | |
6685 } | |
6686 } | |
6687 //----- (0046A334) -------------------------------------------------------- | |
6688 char __fastcall DoInteractionWithTopmostZObject(int a1, int a2) | |
6689 { | |
6690 int v2; // edx@1 | |
6691 BLVFace *v4; // eax@9 | |
6692 unsigned int v5; // ecx@9 | |
6693 unsigned __int16 v6; // ax@11 | |
6694 //ODMFace *v7; // eax@16 | |
6695 LevelDecoration *v8; // esi@19 | |
6696 __int16 v9; // ax@19 | |
6697 int v10; // eax@22 | |
6698 int v11; // ecx@22 | |
6699 int v12; // edi@23 | |
6700 Actor *v13; // esi@23 | |
6701 unsigned __int16 v14; // ax@23 | |
6702 unsigned __int16 v15; // ax@33 | |
6703 const char *v16; // eax@34 | |
6704 int v17; // edi@36 | |
6705 int v18; // eax@36 | |
6706 ItemGen *v19; // esi@39 | |
6707 unsigned int v20; // eax@39 | |
6708 int v21; // ecx@40 | |
6709 std::string v22; // [sp-18h] [bp-2Ch]@5 | |
6710 const char *v23; // [sp-8h] [bp-1Ch]@5 | |
6711 int v24; // [sp-4h] [bp-18h]@5 | |
6712 char v25; // [sp+8h] [bp-Ch]@5 | |
6713 int v26; // [sp+Ch] [bp-8h]@1 | |
6714 int a3; // [sp+13h] [bp-1h]@5 | |
6715 | |
6716 v26 = a2; | |
6717 v2 = a1; | |
6718 switch ( PID_TYPE(a1) ) | |
6719 { | |
6720 case OBJECT_Item: // take the item | |
6721 v17 = PID_ID(a1); | |
6722 v26 = PID_ID(a1); | |
6723 v18 = PID_ID(a1); | |
6724 if ( pObjectList->pObjects[pSpriteObjects[v18].uObjectDescID].uFlags & 0x10 | |
6725 || v17 >= 1000 | |
6726 || !pSpriteObjects[v18].uObjectDescID ) | |
6727 return 1; | |
6728 v19 = &pSpriteObjects[v18].stru_24; | |
6729 v20 = pSpriteObjects[v18].stru_24.uItemID; | |
6730 if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD) | |
6731 { | |
6732 party_finds_gold(v19->uSpecEnchantmentType, 0); | |
6733 viewparams->bRedrawGameUI = 1; | |
6734 v21 = v17; | |
6735 } | |
6736 else | |
6737 { | |
6738 if ( pParty->pPickedItem.uItemID ) | |
6739 return 1; | |
6740 v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName; | |
6741 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v24); | |
6742 ShowStatusBarString(pTmpBuf2.data(), 2u); | |
6743 if ( v19->uItemID == 506 ) | |
6744 _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u); | |
6745 if ( v19->uItemID == 455 ) | |
6746 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u); | |
6747 if ( !pParty->AddItem(v19) ) | |
6748 pParty->SetHoldingItem(v19); | |
6749 v21 = v26; | |
6750 } | |
6751 SpriteObject::OnInteraction(v21); | |
6752 break; | |
6753 | |
6754 case OBJECT_Actor: | |
6755 v12 = PID_ID(a1); | |
6756 v13 = &pActors[PID_ID(a1)]; | |
6757 v14 = v13->uAIState; | |
6758 if ( v14 == 4 || v14 == 17 ) | |
6759 return 1; | |
6760 if ( v14 == 5 ) | |
6761 { | |
6762 stru_50C198.LootActor(&pActors[PID_ID(a1)]); | |
6763 } | |
6764 else | |
6765 { | |
6766 if ( !v13->GetActorsRelation(0) && !(BYTE2(v13->uAttributes) & 8) && v13->CanAct() ) | |
6767 { | |
6768 Actor::AI_FaceObject(v12, 4u, 0, 0); | |
6769 if ( v13->sNPC_ID ) | |
6770 { | |
6771 pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0); | |
6772 } | |
6773 else | |
6774 { | |
6775 v15 = pNPCStats->pGroups_copy[v13->uGroup]; | |
6776 if ( v15 ) | |
6777 { | |
6778 v16 = pNPCStats->pCatchPhrases[v15]; | |
6779 if ( v16 ) | |
6780 { | |
6781 pParty->uFlags |= 2u; | |
6782 strcpy(byte_5B0938.data(), v16); | |
6783 sub_4451A8_press_any_key(0, 0, 0); | |
6784 } | |
6785 } | |
6786 } | |
6787 } | |
6788 } | |
6789 break; | |
6790 | |
6791 case OBJECT_Decoration: | |
6792 v8 = &pLevelDecorations[PID_ID(a1)]; | |
6793 v9 = v8->field_16_event_id; | |
6794 if ( v9 ) | |
6795 { | |
6796 EventProcessor(v9, a1, 1); | |
6797 LOBYTE(v8->field_2) |= 8u; | |
6798 } | |
6799 else | |
6800 { | |
6801 if ( !pLevelDecorations[PID_ID(a1)].IsInteractive() ) | |
6802 return 1; | |
6803 v10 = v8->_idx_in_stru123; | |
6804 v24 = 1; | |
6805 v11 = stru_5E4C90._decor_events[v10 - 75] + 380; | |
6806 activeLevelDecoration = v8; | |
6807 EventProcessor(v11, 0, 1); | |
6808 activeLevelDecoration = NULL; | |
6809 } | |
6810 break; | |
6811 | |
6812 default: | |
6813 MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0); | |
6814 return 1; | |
6815 | |
6816 case OBJECT_BModel: | |
6817 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
6818 { | |
6819 int bmodel_id = a1 >> 9, | |
6820 face_id = PID_ID(a1) & 0x3F; | |
6821 if (bmodel_id >= pOutdoor->uNumBModels) | |
6822 return 1; | |
6823 auto face = &pOutdoor->pBModels[bmodel_id].pFaces[face_id]; | |
6824 if (face->uAttributes & 0x100000 || face->sCogTriggeredID == 0 ) | |
6825 return 1; | |
6826 EventProcessor((signed __int16)face->sCogTriggeredID, v2, 1); | |
6827 } | |
6828 else | |
6829 { | |
6830 v4 = &pIndoor->pFaces[PID_ID(a1)]; | |
6831 v5 = v4->uAttributes; | |
6832 if ( !(v5 & 0x2000000) ) | |
6833 { | |
6834 ShowNothingHereStatus(); | |
6835 return 1; | |
6836 } | |
6837 if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 ) | |
6838 return 1; | |
6839 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) | |
6840 EventProcessor((signed __int16)v6, v2, 1); | |
6841 } | |
6842 return 0; | |
6843 break; | |
6844 } | |
6845 return 0; | |
6846 } | |
6847 //----- (0046BDF1) -------------------------------------------------------- | |
6848 void __cdecl BLV_UpdateUserInputAndOther() | |
6849 { | |
6850 UpdateObjects(); | |
6851 BLV_ProcessPartyActions(); | |
6852 UpdateActors_BLV(); | |
6853 BLV_UpdateDoors(); | |
6854 check_event_triggers(); | |
6855 } | |
6856 //----- (00424829) -------------------------------------------------------- | |
6857 bool sub_424829(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID) | |
6858 { | |
6859 //int v4; // edi@1 | |
6860 //BspRenderer_stru2 *v5; // ebx@1 | |
6861 int v6; // eax@3 | |
6862 int min_y; // esi@5 | |
6863 int max_y; // edx@5 | |
6864 //int v9; // ecx@6 | |
6865 int v10; // eax@12 | |
6866 //int v11; // edi@13 | |
6867 //int v12; // edx@18 | |
6868 int v13; // eax@22 | |
6869 //int v14; // edi@28 | |
6870 int v15; // ecx@29 | |
6871 //int v16; // edi@30 | |
6872 //int v17; // edx@35 | |
6873 int v18; // eax@39 | |
6874 int v19; // eax@44 | |
6875 int v20; // ecx@44 | |
6876 //int v21; // edi@45 | |
6877 int v22; // edi@46 | |
6878 //__int16 *v23; // ecx@47 | |
6879 int v24; // edx@48 | |
6880 //int v25; // eax@50 | |
6881 int v26; // eax@55 | |
6882 signed int v27; // edi@55 | |
6883 //int v28; // edx@56 | |
6884 int v29; // edx@57 | |
6885 //int v30; // eax@59 | |
6886 int v31; // eax@64 | |
6887 signed int v32; // edi@64 | |
6888 //int v33; // edx@65 | |
6889 int v34; // eax@66 | |
6890 int v35; // dx@66 | |
6891 __int16 v36; // dx@67 | |
6892 __int16 v37; // di@67 | |
6893 __int16 v38; // dx@67 | |
6894 //BspRenderer_stru2 *v39; // ecx@69 | |
6895 //int v40; // edx@69 | |
6896 //int v41; // edi@70 | |
6897 //__int16 *v42; // eax@76 | |
6898 //__int16 *v43; // eax@81 | |
6899 //__int16 *v45; // eax@87 | |
6900 int v46; // edx@87 | |
6901 //__int16 v47; // cx@88 | |
6902 //int v48; // eax@93 | |
6903 int v49; // esi@93 | |
6904 //__int16 *v50; // ecx@94 | |
6905 //int v51; // eax@95 | |
6906 //int v52; // eax@97 | |
6907 int v53; // [sp+Ch] [bp-34h]@44 | |
6908 int v54; // [sp+10h] [bp-30h]@0 | |
6909 int v55; // [sp+14h] [bp-2Ch]@12 | |
6910 //__int16 *v56; // [sp+14h] [bp-2Ch]@47 | |
6911 //__int16 v57; // [sp+14h] [bp-2Ch]@76 | |
6912 //__int16 v58; // [sp+14h] [bp-2Ch]@81 | |
6913 int v59; // [sp+14h] [bp-2Ch]@87 | |
6914 //BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1 | |
6915 int v61; // [sp+1Ch] [bp-24h]@29 | |
6916 int v62; // [sp+20h] [bp-20h]@0 | |
6917 signed int v63; // [sp+24h] [bp-1Ch]@3 | |
6918 signed int v64; // [sp+28h] [bp-18h]@3 | |
6919 int v65; // [sp+2Ch] [bp-14h]@5 | |
6920 //int v66; // [sp+2Ch] [bp-14h]@39 | |
6921 //int v67; // [sp+30h] [bp-10h]@22 | |
6922 int v68; // [sp+34h] [bp-Ch]@12 | |
6923 int v69; // [sp+34h] [bp-Ch]@29 | |
6924 int v70; // [sp+34h] [bp-Ch]@46 | |
6925 int v71; // [sp+34h] [bp-Ch]@75 | |
6926 int v72; // [sp+34h] [bp-Ch]@80 | |
6927 //int v73; // [sp+38h] [bp-8h]@11 | |
6928 //int v74; // [sp+3Ch] [bp-4h]@1 | |
6929 //int a3a; // [sp+48h] [bp+8h]@76 | |
6930 //int a3b; // [sp+48h] [bp+8h]@87 | |
6931 | |
6932 //try graphic engine with function returning 1 always, and without | |
6933 //return true; | |
6934 if ( pNumVertices <= 1 ) | |
6935 return false; | |
6936 min_y = stru_50B700._screen_space_y[0]; | |
6937 v65 = 0; | |
6938 max_y = stru_50B700._screen_space_y[0]; | |
6939 if ( !stru_50B700.field_0 ) | |
6940 { | |
6941 v63 = 1; | |
6942 v64 = -1; | |
6943 } | |
6944 else | |
6945 { | |
6946 v63 = -1; | |
6947 v64 = 1; | |
6948 } | |
6949 | |
6950 for ( v6 = 1; v6 < pNumVertices; ++v6 ) | |
6951 { | |
6952 if ( stru_50B700._screen_space_y[v6] >= min_y ) | |
6953 { | |
6954 if ( stru_50B700._screen_space_y[v6] > max_y ) | |
6955 max_y = stru_50B700._screen_space_y[v6]; | |
6956 } | |
6957 if ( stru_50B700._screen_space_y[v6] < min_y ) | |
6958 { | |
6959 v65 = v6; | |
6960 min_y = stru_50B700._screen_space_y[v6]; | |
6961 } | |
6962 } | |
6963 if ( max_y == min_y ) | |
6964 return false; | |
6965 | |
6966 v10 = v65; | |
6967 a2->_viewport_space_y = min_y; | |
6968 a2->_viewport_space_w = max_y; | |
6969 v55 = v65; | |
6970 | |
6971 for ( v68 = 0; v68 < pNumVertices; ++v68 ) | |
6972 { | |
6973 v10 += v64; | |
6974 if ( v10 < pNumVertices ) | |
6975 { | |
6976 if ( v10 < 0 ) | |
6977 v10 += pNumVertices; | |
6978 } | |
6979 else | |
6980 v10 -= pNumVertices; | |
6981 if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] ) | |
6982 { | |
6983 v55 = v10; | |
6984 v65 = v10; | |
6985 } | |
6986 if ( stru_50B700._screen_space_y[v10] == max_y ) | |
6987 break; | |
6988 } | |
6989 v13 = v55 + v64; | |
6990 if ( v13 < pNumVertices ) | |
6991 { | |
6992 if ( v13 < 0 ) | |
6993 v13 += pNumVertices; | |
6994 } | |
6995 else | |
6996 v13 -= pNumVertices; | |
6997 if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] ) | |
6998 { | |
6999 v62 = stru_50B700._screen_space_x[v55] << 16; | |
7000 v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]); | |
7001 a2->viewport_left_side[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); | |
7002 } | |
7003 v15 = v65; | |
7004 v61 = v65; | |
7005 | |
7006 for ( v69 = 0; v69 < pNumVertices; ++v69 ) | |
7007 { | |
7008 v15 += v63; | |
7009 if ( v15 < pNumVertices ) | |
7010 { | |
7011 if ( v15 < 0 ) | |
7012 v15 += pNumVertices; | |
7013 } | |
7014 else | |
7015 v15 -= pNumVertices; | |
7016 if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] ) | |
7017 { | |
7018 v61 = v15; | |
7019 v65 = v15; | |
7020 } | |
7021 if ( stru_50B700._screen_space_y[v15] == max_y ) | |
7022 break; | |
7023 } | |
7024 v18 = v63 + v61; | |
7025 if ( v18 < pNumVertices ) | |
7026 { | |
7027 if ( v18 < 0 ) | |
7028 v18 += pNumVertices; | |
7029 } | |
7030 else | |
7031 v18 -= pNumVertices; | |
7032 v19 = v18; | |
7033 v20 = v61; | |
7034 if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] ) | |
7035 { | |
7036 v61 = stru_50B700._screen_space_x[v20] << 16; | |
7037 v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20]; | |
7038 a2->viewport_right_side[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); | |
7039 } | |
7040 v22 = min_y; | |
7041 if ( min_y <= max_y ) | |
7042 { | |
7043 //v56 = &a2->array_3D8[v7]; | |
7044 //v23 = &a2->array_18[v7]; | |
7045 for ( v70 = min_y; v70 <= max_y; ++v70 ) | |
7046 { | |
7047 v24 = v13; | |
7048 if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != max_y ) | |
7049 { | |
7050 v13 = v64 + v13; | |
7051 if ( v13 < pNumVertices ) | |
7052 { | |
7053 if ( v13 < 0 ) | |
7054 v13 += pNumVertices; | |
7055 } | |
7056 else | |
7057 v13 -= pNumVertices; | |
7058 v26 = v13; | |
7059 //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; | |
7060 if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 ) | |
7061 { | |
7062 v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; | |
7063 v62 = stru_50B700._screen_space_x[v24] << 16; | |
7064 } | |
7065 } | |
7066 v29 = v18; | |
7067 if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != max_y ) | |
7068 { | |
7069 v18 += v63; | |
7070 if ( v18 < pNumVertices ) | |
7071 { | |
7072 if ( v18 < 0 ) | |
7073 v18 += pNumVertices; | |
7074 } | |
7075 else | |
7076 v18 -= pNumVertices; | |
7077 v31 = v18; | |
7078 //v32 = stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; | |
7079 if ( stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29] > 0 ) | |
7080 { | |
7081 v53 = ((stru_50B700._screen_space_x[v31] - stru_50B700._screen_space_x[v29]) << 16) / stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; | |
7082 v61 = stru_50B700._screen_space_x[v29] << 16; | |
7083 } | |
7084 } | |
7085 //v34 = (char *)a2->array_18 - (char *)a2->array_3D8; | |
7086 //v35 = *(__int16 *)((char *)&a2->array_3D8[v70] + v34); | |
7087 //v35 = HIWORD(v62); | |
7088 a2->viewport_left_side[v70] = HIWORD(v62); | |
7089 a2->viewport_right_side[v70] = HIWORD(v61); | |
7090 //v34 = &a2->array_3D8[v70]; | |
7091 //v35 = a2->array_3D8[v70]; | |
7092 if ( a2->viewport_left_side[v70] > a2->viewport_right_side[v70] ) | |
7093 { | |
7094 v36 = a2->viewport_left_side[v70] ^ a2->viewport_right_side[v70]; | |
7095 v37 = a2->viewport_right_side[v70]; | |
7096 a2->viewport_left_side[v70] = v36; | |
7097 v38 = v37 ^ v36; | |
7098 a2->viewport_left_side[v70] ^= v38; | |
7099 a2->viewport_right_side[v70] = v38; | |
7100 } | |
7101 //++v56; | |
7102 v62 += v54; | |
7103 v22 = v70 + 1; | |
7104 v61 += v53; | |
7105 //++v23; | |
7106 } | |
7107 } | |
7108 if ( max_y < a3->_viewport_space_y ) | |
7109 return false; | |
7110 if ( min_y > a3->_viewport_space_w ) | |
7111 return false; | |
7112 if ( min_y < a3->_viewport_space_y ) | |
7113 min_y = a3->_viewport_space_y; | |
7114 if ( max_y > a3->_viewport_space_w ) | |
7115 max_y = a3->_viewport_space_w; | |
7116 if ( min_y <= max_y ) | |
7117 { | |
7118 //a3a = (char *)a2 - (char *)a3; | |
7119 //v42 = &a3->array_3D8[v7]; | |
7120 //v57 = *(__int16 *)((char *)v42 + a3a); | |
7121 for ( v71 = min_y; v71 <= max_y; ++v71 ) | |
7122 { | |
7123 if ( a2->viewport_left_side[v71] >= a3->viewport_left_side[v71] && a2->viewport_left_side[v71] <= a3->viewport_right_side[v71] ) | |
7124 break; | |
7125 //++v57; | |
7126 ++min_y; | |
7127 //++v42; | |
7128 } | |
7129 } | |
7130 if ( max_y < min_y ) | |
7131 return false; | |
7132 //a3a = (char *)a2 - (char *)a3; | |
7133 //v43 = &a3->array_3D8[v8]; | |
7134 //v58 = *(__int16 *)((char *)v43 + a3a); | |
7135 for ( v72 = max_y; v72 >= min_y; --v72 ) | |
7136 { | |
7137 if ( a2->viewport_right_side[v72] >= a3->viewport_left_side[v72] && a2->viewport_left_side[v72] <= a3->viewport_right_side[v72] ) | |
7138 break; | |
7139 //--v58; | |
7140 --max_y; | |
7141 //--v43; | |
7142 //v8 = v8; | |
7143 } | |
7144 if ( min_y >= max_y ) | |
7145 return false; | |
7146 //a3b = (char *)a3 - (char *)a2; | |
7147 v59 = min_y; | |
7148 //v45 = &a2->array_18[v7]; | |
7149 | |
7150 for ( v46 = max_y - min_y + 1; v46; --v46 ) | |
7151 { | |
7152 //v47 = *(__int16 *)((char *)v45 + a3b); | |
7153 if ( a2->viewport_left_side[v59] < a3->viewport_left_side[v59] ) | |
7154 a2->viewport_left_side[v59] = a3->viewport_left_side[v59]; | |
7155 if ( a2->viewport_right_side[v59] > a3->viewport_right_side[v59] ) | |
7156 a2->viewport_right_side[v59] = a3->viewport_right_side[v59]; | |
7157 ++v59; | |
7158 //++v45; | |
7159 } | |
7160 a2->_viewport_space_y = min_y; | |
7161 a2->_viewport_space_w = max_y; | |
7162 a2->field_8 = a2->viewport_left_side[min_y]; | |
7163 //v48 = a2->viewport_right_side[v7]; | |
7164 a2->field_10 = min_y; | |
7165 a2->field_14 = min_y; | |
7166 a2->field_C = a2->viewport_right_side[min_y]; | |
7167 v49 = min_y + 1; | |
7168 if ( v49 <= max_y ) | |
7169 { | |
7170 //v50 = &a2->array_3D8[v49]; | |
7171 for ( v49; v49 <= max_y; ++v49 ) | |
7172 { | |
7173 //v51 = a2->array_18[v49]; | |
7174 if ( a2->viewport_left_side[v49] < a2->field_8 ) | |
7175 { | |
7176 a2->field_8 = a2->viewport_left_side[v49]; | |
7177 a2->field_10 = v49; | |
7178 } | |
7179 if ( a2->viewport_right_side[v49] > a2->field_C ) | |
7180 { | |
7181 a2->field_C = a2->viewport_right_side[v49]; | |
7182 a2->field_14 = v49; | |
7183 } | |
7184 //++v50; | |
7185 } | |
7186 } | |
7187 return true; | |
7188 } | |
7189 //----- (00423B5D) -------------------------------------------------------- | |
7190 int __fastcall sub_423B5D(unsigned int uFaceID) | |
7191 { | |
7192 BLVFace *pFace; // ebx@1 | |
1301 | 7193 //Vec3_short_ *v2; // esi@1 |
1297 | 7194 //int v3; // ST28_4@1 |
7195 //__int16 v4; // ST2C_2@1 | |
1301 | 7196 //signed int v5; // esi@1 |
1297 | 7197 //Vec3_short_ *v6; // eax@4 |
1301 | 7198 //signed int v7; // edi@5 |
7199 //signed int bFound; // eax@5 | |
7200 //signed int v9; // ecx@10 | |
7201 //int v10; // eax@10 | |
7202 //int v11; // edx@11 | |
1297 | 7203 int v12; // ST28_4@12 |
7204 signed int v13; // edx@12 | |
7205 signed __int64 v14; // qtt@12 | |
7206 char *v15; // ebx@12 | |
7207 int v16; // ST28_4@14 | |
7208 signed int v17; // eax@14 | |
7209 signed __int64 v18; // qtt@14 | |
7210 signed int v19; // edx@15 | |
7211 signed int v20; // edx@17 | |
7212 signed int v21; // ebx@19 | |
7213 signed int v22; // esi@20 | |
7214 int v23; // edi@21 | |
7215 int v24; // eax@21 | |
7216 int v25; // eax@22 | |
7217 int v26; // eax@22 | |
7218 signed int v27; // ST30_4@24 | |
7219 signed __int64 v28; // qtt@24 | |
7220 int v29; // ST18_4@25 | |
7221 int v30; // eax@26 | |
7222 int v31; // eax@27 | |
7223 int v32; // eax@27 | |
7224 signed int v33; // ST30_4@29 | |
7225 signed __int64 v34; // qtt@29 | |
7226 int v35; // ST30_4@30 | |
7227 signed int v36; // edi@31 | |
7228 unsigned int v37; // eax@31 | |
7229 bool v38; // edx@31 | |
7230 int v39; // ecx@31 | |
7231 int v40; // ecx@32 | |
7232 int v41; // esi@32 | |
7233 int v42; // eax@34 | |
7234 signed int v43; // ebx@41 | |
7235 unsigned int v44; // eax@41 | |
7236 signed int v45; // ecx@42 | |
7237 int v46; // esi@42 | |
7238 int v47; // eax@44 | |
7239 signed int v48; // edi@51 | |
7240 unsigned int v49; // eax@51 | |
7241 bool v50; // edx@51 | |
7242 int v51; // ecx@51 | |
7243 int v52; // ecx@52 | |
7244 int v53; // esi@52 | |
7245 int v54; // eax@54 | |
7246 int v55; // ebx@61 | |
7247 unsigned int v56; // eax@61 | |
7248 signed int v57; // ecx@62 | |
7249 int v58; // esi@62 | |
7250 int v59; // eax@64 | |
7251 char v61; // zf@72 | |
7252 signed int v62; // edx@75 | |
7253 int v63; // ecx@76 | |
7254 int v64; // esi@76 | |
7255 int v65; // ecx@83 | |
1301 | 7256 //signed int v66; // [sp+14h] [bp-14h]@3 |
1297 | 7257 int v67; // [sp+14h] [bp-14h]@34 |
7258 int v68; // [sp+14h] [bp-14h]@44 | |
7259 int v69; // [sp+14h] [bp-14h]@54 | |
7260 int v70; // [sp+14h] [bp-14h]@64 | |
7261 signed int v71; // [sp+14h] [bp-14h]@75 | |
1301 | 7262 //IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 |
7263 bool current_vertices_flag; // [sp+18h] [bp-10h]@9 | |
1297 | 7264 int thisb; // [sp+18h] [bp-10h]@12 |
7265 int thisc; // [sp+18h] [bp-10h]@20 | |
7266 bool thisd; // [sp+18h] [bp-10h]@41 | |
7267 bool thise; // [sp+18h] [bp-10h]@61 | |
7268 int thisf; // [sp+18h] [bp-10h]@74 | |
1301 | 7269 signed int depth_num_vertices; // [sp+1Ch] [bp-Ch]@9 |
1297 | 7270 int v80; // [sp+1Ch] [bp-Ch]@76 |
1301 | 7271 bool next_vertices_flag; // [sp+20h] [bp-8h]@10 |
1297 | 7272 bool v82; // [sp+20h] [bp-8h]@32 |
7273 bool v83; // [sp+20h] [bp-8h]@42 | |
7274 bool v84; // [sp+20h] [bp-8h]@52 | |
7275 bool v85; // [sp+20h] [bp-8h]@62 | |
1301 | 7276 //signed int v86; // [sp+24h] [bp-4h]@9 |
1297 | 7277 signed int v87; // [sp+24h] [bp-4h]@19 |
7278 signed int v88; // [sp+24h] [bp-4h]@31 | |
7279 signed int v89; // [sp+24h] [bp-4h]@41 | |
7280 signed int v90; // [sp+24h] [bp-4h]@51 | |
7281 signed int v91; // [sp+24h] [bp-4h]@61 | |
7282 | |
7283 pFace = &pIndoor->pFaces[uFaceID]; | |
1301 | 7284 memset(&stru_50B700, 0, sizeof(stru367)); |
7285 //_this = pGame->pIndoorCameraD3D; | |
7286 //v2 = &pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]]; | |
1297 | 7287 //v3 = *(_DWORD *)pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x; |
7288 //v4 = pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z; | |
1301 | 7289 //v5 = 0; |
1297 | 7290 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) |
7291 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) | |
7292 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) | |
7293 { | |
7294 stru_50B700.field_0 = 1; | |
7295 } | |
7296 else | |
7297 { | |
7298 stru_50B700.field_0 = 0; | |
1301 | 7299 if ( !(pFace->Portal()) ) |
1297 | 7300 return 0; |
7301 } | |
1301 | 7302 //v66 = pFace->uNumVertices; |
1297 | 7303 if ( (signed int)pFace->uNumVertices > 0 ) |
7304 { | |
1301 | 7305 for (uint i = 0; i < pFace->uNumVertices; ++i) |
1297 | 7306 { |
7307 //v6 = &pIndoor->pVertices[pFace->pVertexIDs[v5]]; | |
7308 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | |
1301 | 7309 pIndoor->pVertices[pFace->pVertexIDs[i]].x, |
7310 pIndoor->pVertices[pFace->pVertexIDs[i]].y, | |
7311 pIndoor->pVertices[pFace->pVertexIDs[i]].z, | |
7312 &stru_50B700._view_transformed_xs[i + 3], | |
7313 &stru_50B700._view_transformed_zs[i + 3], | |
7314 &stru_50B700._view_transformed_ys[i + 3], | |
1297 | 7315 0); |
7316 } | |
1301 | 7317 } |
7318 //v7 = pFace->uNumVertices; | |
7319 if ( pFace->uNumVertices <= 0 ) | |
1297 | 7320 return 0; |
1301 | 7321 bool bFound = false; |
7322 for (uint i = 0; i < pFace->uNumVertices; ++i) | |
7323 { | |
7324 if ( stru_50B700._view_transformed_xs[i + 3] >= 524288 ) | |
7325 { | |
7326 bFound = true; | |
1297 | 7327 break; |
1301 | 7328 } |
7329 } | |
7330 if ( !bFound ) | |
1297 | 7331 return 0; |
1301 | 7332 |
7333 depth_num_vertices = 0; | |
7334 stru_50B700._view_transformed_xs[pFace->uNumVertices + 3] = stru_50B700._view_transformed_xs[3]; | |
7335 stru_50B700._view_transformed_zs[pFace->uNumVertices + 3] = stru_50B700._view_transformed_zs[3]; | |
7336 stru_50B700._view_transformed_ys[pFace->uNumVertices + 3] = stru_50B700._view_transformed_ys[3]; | |
7337 current_vertices_flag = stru_50B700._view_transformed_xs[3] >= 524288; | |
7338 //v86 = 1; | |
7339 if ( pFace->uNumVertices >= 1 ) | |
7340 { | |
7341 for ( uint i = 1; i <= pFace->uNumVertices; ++i) | |
1297 | 7342 { |
1301 | 7343 //v9 = v86; |
7344 //v10 = stru_50B700._view_transformed_xs[v86 + 3]; | |
7345 next_vertices_flag = stru_50B700._view_transformed_xs[i + 3] >= 524288; | |
7346 if ( current_vertices_flag ^ next_vertices_flag ) | |
1297 | 7347 { |
1301 | 7348 //v11 = stru_50B700._view_transformed_xs[i + 2]; |
7349 if ( stru_50B700._view_transformed_xs[i + 3] >= 524288 ) | |
1297 | 7350 { |
1301 | 7351 v12 = stru_50B700._view_transformed_xs[i + 3] - stru_50B700._view_transformed_xs[i + 2]; |
7352 v13 = 524288 - stru_50B700._view_transformed_xs[i + 2]; | |
1297 | 7353 LODWORD(v14) = v13 << 16; |
7354 HIDWORD(v14) = v13 >> 16; | |
1301 | 7355 v15 = (char *)&stru_50B700._view_transformed_ys[i + 2]; |
7356 stru_50B700._view_transformed_zs[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i + 3] | |
7357 - stru_50B700._view_transformed_zs[i + 2]) | |
1297 | 7358 * v14 |
7359 / v12) >> 16) | |
1301 | 7360 + stru_50B700._view_transformed_zs[i + 2]; |
7361 thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i + 3] - stru_50B700._view_transformed_ys[i + 2]) | |
1297 | 7362 * v14 |
7363 / v12) >> 16; | |
7364 } | |
7365 else | |
7366 { | |
1301 | 7367 v16 = stru_50B700._view_transformed_xs[i + 2] - stru_50B700._view_transformed_xs[i + 3]; |
7368 v17 = 524288 - stru_50B700._view_transformed_xs[i + 3]; | |
1297 | 7369 LODWORD(v18) = v17 << 16; |
7370 HIDWORD(v18) = v17 >> 16; | |
1301 | 7371 v15 = (char *)&stru_50B700._view_transformed_ys[i + 3]; |
7372 stru_50B700._view_transformed_zs[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i + 2] | |
7373 - stru_50B700._view_transformed_zs[i + 3]) | |
1297 | 7374 * v18 |
7375 / v16) >> 16) | |
1301 | 7376 + stru_50B700._view_transformed_zs[i + 3]; |
7377 thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i + 2] - stru_50B700._view_transformed_ys[i + 3]) | |
1297 | 7378 * v18 |
7379 / v16) >> 16; | |
7380 } | |
1301 | 7381 v19 = depth_num_vertices++; |
7382 //v7 = pFace->uNumVertices; | |
1297 | 7383 stru_50B700._view_transformed_ys[v19] = thisb + *(_DWORD *)v15; |
7384 stru_50B700._view_transformed_xs[v19] = 524288; | |
7385 } | |
1301 | 7386 if ( next_vertices_flag ) |
1297 | 7387 { |
1301 | 7388 v20 = depth_num_vertices++; |
7389 stru_50B700._view_transformed_xs[v20] = stru_50B700._view_transformed_xs[i + 3]; | |
7390 stru_50B700._view_transformed_zs[v20] = stru_50B700._view_transformed_zs[i + 3]; | |
7391 stru_50B700._view_transformed_ys[v20] = stru_50B700._view_transformed_ys[i + 3]; | |
1297 | 7392 } |
1301 | 7393 current_vertices_flag = next_vertices_flag; |
1297 | 7394 } |
1301 | 7395 } |
7396 | |
1297 | 7397 v87 = 0; |
1301 | 7398 v21 = depth_num_vertices; |
7399 stru_50B700._view_transformed_xs[depth_num_vertices] = stru_50B700._view_transformed_xs[0]; | |
7400 stru_50B700._view_transformed_zs[depth_num_vertices] = stru_50B700._view_transformed_zs[0]; | |
7401 for ( stru_50B700._view_transformed_ys[depth_num_vertices] = stru_50B700._view_transformed_ys[0]; | |
7402 v87 < depth_num_vertices; | |
1297 | 7403 stru_50B700._screen_space_y[v22 + 12] = pBLVRenderParams->uViewportCenterY - v35 ) |
7404 { | |
7405 v22 = v87; | |
7406 thisc = abs(stru_50B700._view_transformed_xs[v87]); | |
7407 if ( abs(stru_50B700._view_transformed_zs[v87]) >> 13 <= thisc ) | |
7408 { | |
7409 v27 = stru_50B700._view_transformed_zs[v22]; | |
7410 LODWORD(v28) = v27 << 16; | |
7411 HIDWORD(v28) = v27 >> 16; | |
7412 v26 = v28 / stru_50B700._view_transformed_xs[v22]; | |
7413 v23 = 0; | |
7414 } | |
7415 else | |
7416 { | |
7417 v23 = 0; | |
7418 v24 = 0; | |
7419 if ( stru_50B700._view_transformed_zs[v22] >= 0 ) | |
7420 { | |
1301 | 7421 //LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; |
7422 //v26 = ((v24 - 1) & 0xFF800000) + 4194304; | |
7423 if (stru_50B700._view_transformed_xs[v22] >= 0) | |
7424 v26 = 0x400000; // 64.0 | |
7425 else | |
7426 v26 = 0xFFC00000; | |
1297 | 7427 } |
7428 else | |
7429 { | |
1301 | 7430 //LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; |
7431 //v25 = v24 - 1; | |
7432 //v26 = (v25 & 0x800000) - 4194304; | |
7433 if (stru_50B700._view_transformed_xs[v22] >= 0) | |
7434 v26 = 0xFFC00000; // -63.0 | |
7435 else | |
7436 v26 = 0x400000; | |
1297 | 7437 } |
7438 } | |
1301 | 7439 |
1297 | 7440 v29 = stru_50B700._view_transformed_ys[v22]; |
7441 stru_50B700._screen_space_x[v22 + 12] = v26; | |
7442 if ( abs(v29) >> 13 <= thisc ) | |
7443 { | |
7444 v33 = stru_50B700._view_transformed_ys[v22]; | |
7445 LODWORD(v34) = v33 << 16; | |
7446 HIDWORD(v34) = v33 >> 16; | |
7447 v32 = v34 / stru_50B700._view_transformed_xs[v22]; | |
7448 } | |
7449 else | |
7450 { | |
7451 v30 = 0; | |
7452 if ( stru_50B700._view_transformed_ys[v22] >= v23 ) | |
7453 { | |
1301 | 7454 //LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; |
7455 //v32 = ((v30 - 1) & 0xFF800000) + 4194304; | |
7456 if (stru_50B700._view_transformed_xs[v22] >= v23) | |
7457 v32 = 0x400000; // 64.0 | |
7458 else | |
7459 v32 = 0xFFC00000; | |
1297 | 7460 } |
7461 else | |
7462 { | |
1301 | 7463 //LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; |
7464 //v31 = v30 - 1; | |
7465 //v32 = (v31 & 0x800000) - 4194304; | |
7466 if (stru_50B700._view_transformed_xs[v22] >= v23) | |
7467 v32 = 0xFFC00000; // -63.0 | |
7468 else | |
7469 v32 = 0x400000; | |
1297 | 7470 } |
7471 } | |
7472 stru_50B700._screen_space_y[v22 + 12] = v32; | |
7473 stru_50B700._screen_space_x[v22 + 12] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) | |
7474 * (signed __int64)stru_50B700._screen_space_x[v22 + 12]) >> 16; | |
7475 v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._screen_space_y[v22 + 12]) >> 16; | |
7476 stru_50B700._screen_space_x[v22 + 12] = pBLVRenderParams->uViewportCenterX - stru_50B700._screen_space_x[v22 + 12]; | |
7477 ++v87; | |
7478 } | |
7479 v36 = 0; | |
7480 stru_50B700._screen_space_x[v21 + 12] = stru_50B700._screen_space_x[12]; | |
7481 stru_50B700._screen_space_y[v21 + 12] = stru_50B700._screen_space_y[12]; | |
7482 v37 = pBLVRenderParams->uViewportX; | |
7483 v38 = stru_50B700._screen_space_x[12] < (signed int)pBLVRenderParams->uViewportX; | |
7484 LOBYTE(v38) = stru_50B700._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX; | |
7485 v39 = 1; | |
7486 v88 = 1; | |
1301 | 7487 if ( depth_num_vertices < 1 ) |
1297 | 7488 return 0; |
7489 do | |
7490 { | |
7491 v40 = v39; | |
7492 v41 = stru_50B700._screen_space_x[v40 + 12]; | |
7493 v82 = v41 >= (signed int)v37; | |
7494 if ( v38 ^ v82 ) | |
7495 { | |
7496 if ( v41 >= (signed int)v37 ) | |
7497 { | |
7498 v67 = (signed int)(v37 - stru_50B700._screen_space_x[v40 + 11]) | |
7499 * (signed __int64)(stru_50B700._screen_space_y[v40 + 12] - stru_50B700._screen_space_y[v40 + 11]) | |
7500 / (v41 - stru_50B700._screen_space_x[v40 + 11]); | |
7501 v42 = stru_50B700._screen_space_y[v40 + 11]; | |
7502 } | |
7503 else | |
7504 { | |
7505 v67 = (signed int)(v37 - v41) | |
7506 * (signed __int64)(stru_50B700._screen_space_y[v40 + 11] - stru_50B700._screen_space_y[v40 + 12]) | |
7507 / (stru_50B700._screen_space_x[v40 + 11] - v41); | |
7508 v42 = stru_50B700._screen_space_y[v40 + 12]; | |
7509 } | |
7510 ++v36; | |
7511 stru_50B700._screen_space_y[v36 + 8] = v67 + v42; | |
7512 v37 = pBLVRenderParams->uViewportX; | |
7513 stru_50B700._screen_space_x[v36 + 8] = pBLVRenderParams->uViewportX; | |
7514 } | |
7515 v38 = v82; | |
7516 if ( v82 ) | |
7517 { | |
7518 stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[v40 + 12]; | |
7519 stru_50B700._screen_space_y[v36++ + 9] = stru_50B700._screen_space_y[v40 + 12]; | |
7520 } | |
7521 v39 = v88++ + 1; | |
7522 } | |
1301 | 7523 while ( v88 <= depth_num_vertices ); |
1297 | 7524 if ( !v36 |
7525 || (v43 = 0, | |
7526 stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[9], | |
7527 stru_50B700._screen_space_y[v36 + 9] = stru_50B700._screen_space_y[9], | |
7528 v44 = pBLVRenderParams->uViewportZ, | |
7529 thisd = stru_50B700._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ, | |
7530 v89 = 1, | |
7531 v36 < 1) ) | |
7532 return 0; | |
7533 do | |
7534 { | |
7535 v45 = v89; | |
7536 v46 = stru_50B700._screen_space_x[v89 + 9]; | |
7537 v83 = v46 <= (signed int)v44; | |
7538 if ( thisd ^ v83 ) | |
7539 { | |
7540 if ( v46 <= (signed int)v44 ) | |
7541 { | |
7542 v68 = (signed int)(v44 - stru_50B700._screen_space_x[v45 + 8]) | |
7543 * (signed __int64)(stru_50B700._screen_space_y[v45 + 9] - stru_50B700._screen_space_y[v45 + 8]) | |
7544 / (v46 - stru_50B700._screen_space_x[v45 + 8]); | |
7545 v47 = stru_50B700._screen_space_y[v45 + 8]; | |
7546 } | |
7547 else | |
7548 { | |
7549 v68 = (signed int)(v44 - v46) | |
7550 * (signed __int64)(stru_50B700._screen_space_y[v45 + 8] - stru_50B700._screen_space_y[v45 + 9]) | |
7551 / (stru_50B700._screen_space_x[v45 + 8] - v46); | |
7552 v47 = stru_50B700._screen_space_y[v45 + 9]; | |
7553 } | |
7554 ++v43; | |
7555 stru_50B700._screen_space_y[v43 + 5] = v68 + v47; | |
7556 v44 = pBLVRenderParams->uViewportZ; | |
7557 stru_50B700._screen_space_x[v43 + 5] = pBLVRenderParams->uViewportZ; | |
7558 } | |
7559 if ( v83 ) | |
7560 { | |
7561 stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[v45 + 9]; | |
7562 stru_50B700._screen_space_y[v43++ + 6] = stru_50B700._screen_space_y[v45 + 9]; | |
7563 } | |
7564 ++v89; | |
7565 thisd = v83; | |
7566 } | |
7567 while ( v89 <= v36 ); | |
7568 if ( !v43 | |
7569 || (v48 = 0, | |
7570 stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[6], | |
7571 stru_50B700._screen_space_y[v43 + 6] = stru_50B700._screen_space_y[6], | |
7572 v49 = pBLVRenderParams->uViewportY, | |
7573 v50 = stru_50B700._screen_space_y[6] < (signed int)pBLVRenderParams->uViewportY, | |
7574 LOBYTE(v50) = stru_50B700._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY, | |
7575 v51 = 1, | |
7576 v90 = 1, | |
7577 v43 < 1) ) | |
7578 return 0; | |
7579 do | |
7580 { | |
7581 v52 = v51; | |
7582 v53 = stru_50B700._screen_space_y[v52 + 6]; | |
7583 v84 = v53 >= (signed int)v49; | |
7584 if ( v50 ^ v84 ) | |
7585 { | |
7586 if ( v53 >= (signed int)v49 ) | |
7587 { | |
7588 v69 = (signed int)(v49 - stru_50B700._screen_space_y[v52 + 5]) | |
7589 * (signed __int64)(stru_50B700._screen_space_x[v52 + 6] - stru_50B700._screen_space_x[v52 + 5]) | |
7590 / (v53 - stru_50B700._screen_space_y[v52 + 5]); | |
7591 v54 = stru_50B700._screen_space_x[v52 + 5]; | |
7592 } | |
7593 else | |
7594 { | |
7595 v69 = (signed int)(v49 - v53) | |
7596 * (signed __int64)(stru_50B700._screen_space_x[v52 + 5] - stru_50B700._screen_space_x[v52 + 6]) | |
7597 / (stru_50B700._screen_space_y[v52 + 5] - v53); | |
7598 v54 = stru_50B700._screen_space_x[v52 + 6]; | |
7599 } | |
7600 ++v48; | |
7601 stru_50B700._screen_space_x[v48 + 2] = v69 + v54; | |
7602 v49 = pBLVRenderParams->uViewportY; | |
7603 stru_50B700._screen_space_y[v48 + 2] = pBLVRenderParams->uViewportY; | |
7604 } | |
7605 v50 = v84; | |
7606 if ( v84 ) | |
7607 { | |
7608 stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[v52 + 6]; | |
7609 stru_50B700._screen_space_y[v48++ + 3] = stru_50B700._screen_space_y[v52 + 6]; | |
7610 } | |
7611 v51 = v90++ + 1; | |
7612 } | |
7613 while ( v90 <= v43 ); | |
7614 if ( !v48 | |
7615 || (v55 = 0, | |
7616 stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[3], | |
7617 stru_50B700._screen_space_y[v48 + 3] = stru_50B700._screen_space_y[3], | |
7618 v56 = pBLVRenderParams->uViewportW, | |
7619 thise = stru_50B700._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW, | |
7620 v91 = 1, | |
7621 v48 < 1) ) | |
7622 return 0; | |
7623 do | |
7624 { | |
7625 v57 = v91; | |
7626 v58 = stru_50B700._screen_space_y[v91 + 3]; | |
7627 v85 = v58 <= (signed int)v56; | |
7628 if ( thise ^ v85 ) | |
7629 { | |
7630 if ( v58 <= (signed int)v56 ) | |
7631 { | |
7632 v70 = (signed int)(v56 - stru_50B700._screen_space_y[v57 + 2]) | |
7633 * (signed __int64)(stru_50B700._screen_space_x[v57 + 3] - stru_50B700._screen_space_x[v57 + 2]) | |
7634 / (v58 - stru_50B700._screen_space_y[v57 + 2]); | |
7635 v59 = stru_50B700._screen_space_x[v57 + 2]; | |
7636 } | |
7637 else | |
7638 { | |
7639 v70 = (signed int)(v56 - v58) | |
7640 * (signed __int64)(stru_50B700._screen_space_x[v57 + 2] - stru_50B700._screen_space_x[v57 + 3]) | |
7641 / (stru_50B700._screen_space_y[v57 + 2] - v58); | |
7642 v59 = stru_50B700._screen_space_x[v57 + 3]; | |
7643 } | |
7644 ++v55; | |
7645 //stru_50B700._screen_space_y[v55 + 59] = v70 + v59; | |
7646 stru_50B700._screen_space_x[v55 - 1] = v70 + v59; | |
7647 v56 = pBLVRenderParams->uViewportW; | |
7648 //stru_50B700._view_transformed_xs[v55 + 47] = pBLVRenderParams->uViewportW; | |
7649 stru_50B700._screen_space_y[v55 - 1] = pBLVRenderParams->uViewportW; | |
7650 } | |
7651 if ( v85 ) | |
7652 { | |
7653 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[v57 + 3]; | |
7654 stru_50B700._screen_space_y[v55++] = stru_50B700._screen_space_y[v57 + 3]; | |
7655 } | |
7656 ++v91; | |
7657 thise = v85; | |
7658 } | |
7659 while ( v91 <= v48 ); | |
7660 if ( !v55 ) | |
7661 return 0; | |
7662 v61 = pRenderer->pRenderD3D == 0; | |
7663 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; | |
7664 stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; | |
7665 if ( v61 && v55 > 3 ) | |
7666 { | |
7667 stru_50B700._screen_space_x[v55 + 1] = stru_50B700._screen_space_x[1]; | |
7668 stru_50B700._screen_space_y[v55 + 1] = stru_50B700._screen_space_y[1]; | |
7669 thisf = 2 * (stru_50B700.field_0 != 0) - 1; | |
7670 if ( v55 > 0 ) | |
7671 { | |
7672 v62 = 1; | |
7673 v71 = 1; | |
7674 do | |
7675 { | |
7676 v63 = v62 - 1; | |
7677 v64 = v62 + 1; | |
7678 v80 = v62 + 1; | |
7679 if ( v62 - 1 >= v55 ) | |
7680 v63 -= v55; | |
7681 if ( v62 >= v55 ) | |
7682 v62 -= v55; | |
7683 if ( v64 >= v55 ) | |
7684 v64 -= v55; | |
7685 if ( thisf | |
7686 * ((stru_50B700._screen_space_y[v64] - stru_50B700._screen_space_y[v63]) | |
7687 * (stru_50B700._screen_space_x[v62] - stru_50B700._screen_space_x[v63]) | |
7688 - (stru_50B700._screen_space_y[v62] - stru_50B700._screen_space_y[v63]) | |
7689 * (stru_50B700._screen_space_x[v64] - stru_50B700._screen_space_x[v63])) < 0 ) | |
7690 { | |
7691 v62 = v80; | |
7692 v71 = v80; | |
7693 } | |
7694 else | |
7695 { | |
7696 v62 = v71; | |
7697 v65 = v71; | |
7698 if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) | |
7699 { | |
7700 memcpy( | |
7701 &stru_50B700._screen_space_y[v65], | |
7702 &stru_50B700._screen_space_y[v65 + 1], | |
7703 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | |
7704 memcpy( | |
7705 &stru_50B700._screen_space_x[v65], | |
7706 &stru_50B700._screen_space_x[v65 + 1], | |
7707 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | |
7708 } | |
7709 --v55; | |
7710 } | |
7711 } | |
7712 while ( v62 - 1 < v55 ); | |
7713 } | |
7714 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; | |
7715 stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; | |
7716 } | |
7717 return v55; | |
0 | 7718 } |