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