comparison Indoor.cpp @ 1018:9ac94d00012e

Merge
author Grumpy7
date Tue, 21 May 2013 02:24:31 +0200
parents c45d51b3f4f4 e865f349aa41
children 6afa77761a00
comparison
equal deleted inserted replaced
1017:af20650a052f 1018:9ac94d00012e
71 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 404, 304, 71 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 404, 304,
72 400, 300, 300, 404, 304, 400, 300, 300, 404, 304, 400, 300, 300 72 400, 300, 300, 404, 304, 400, 300, 300, 404, 304, 400, 300, 300
73 }; 73 };
74 74
75 75
76 const char *_4E6BDC_loc_names[11]=
77 {
78 "mdt12.blv",
79 "d18.blv",
80 "mdt14.blv",
81 "d37.blv",
82 "mdk01.blv",
83 "mdt01.blv",
84 "mdr01.blv",
85 "mdt10.blv",
86 "mdt09.blv",
87 "mdt15.blv",
88 "mdt11.blv"
89 };
90
76 91
77 //----- (0043F39E) -------------------------------------------------------- 92 //----- (0043F39E) --------------------------------------------------------
78 void __fastcall PrepareDrawLists_BLV(IndoorLocation_drawstru *_this) 93 void __fastcall PrepareDrawLists_BLV(IndoorLocation_drawstru *_this)
79 { 94 {
80 //int *v1; // ecx@1 95 //int *v1; // ecx@1
147 162
148 //----- (004407D9) -------------------------------------------------------- 163 //----- (004407D9) --------------------------------------------------------
149 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2) 164 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2)
150 { 165 {
151 IndoorLocation_drawstru *v2; // ebx@1 166 IndoorLocation_drawstru *v2; // ebx@1
152 BLVRenderParams *v3; // esi@1
153 int v4; // ST08_4@1 167 int v4; // ST08_4@1
154 int v5; // ST04_4@1 168 int v5; // ST04_4@1
155 int v6; // ST00_4@1 169 int v6; // ST00_4@1
156 int v7; // eax@1 170 int v7; // eax@1
157 int v8; // ST08_4@2 171 int v8; // ST08_4@2
176 signed int v27; // eax@6 190 signed int v27; // eax@6
177 int result; // eax@6 191 int result; // eax@6
178 int v29; // [sp+24h] [bp+8h]@5 192 int v29; // [sp+24h] [bp+8h]@5
179 193
180 v2 = a2; 194 v2 = a2;
181 v3 = this;
182 this->field_0_timer_ = a2->field_0_timer; 195 this->field_0_timer_ = a2->field_0_timer;
183 this->uFlags = a2->uFlags; 196 this->uFlags = a2->uFlags;
184 this->vPartyPos.x = a2->vPosition.x; 197 this->vPartyPos.x = a2->vPosition.x;
185 this->vPartyPos.y = a2->vPosition.y; 198 this->vPartyPos.y = a2->vPosition.y;
186 this->vPartyPos.z = a2->vPosition.z; 199 this->vPartyPos.z = a2->vPosition.z;
188 v5 = this->vPartyPos.y; 201 v5 = this->vPartyPos.y;
189 this->sPartyRotY = a2->sRotationY; 202 this->sPartyRotY = a2->sRotationY;
190 v6 = this->vPartyPos.x; 203 v6 = this->vPartyPos.x;
191 this->sPartyRotX = a2->sRotationX; 204 this->sPartyRotX = a2->sRotationX;
192 v7 = pIndoor->GetSector(v6, v5, v4); 205 v7 = pIndoor->GetSector(v6, v5, v4);
193 v3->uPartySectorID = v7; 206 this->uPartySectorID = v7;
194 if ( !v7 ) 207 if ( !v7 )
195 { 208 {
196 v8 = v3->vPartyPos.z; 209 v8 = this->vPartyPos.z;
197 v3->vPartyPos.x = pParty->vPosition.x; 210 this->vPartyPos.x = pParty->vPosition.x;
198 v9 = pParty->vPosition.y; 211 v9 = pParty->vPosition.y;
199 v10 = v3->vPartyPos.x; 212 v10 = this->vPartyPos.x;
200 v3->vPartyPos.y = pParty->vPosition.y; 213 this->vPartyPos.y = pParty->vPosition.y;
201 v3->uPartySectorID = pIndoor->GetSector(v10, v9, v8); 214 this->uPartySectorID = pIndoor->GetSector(v10, v9, v8);
202 } 215 }
203 if ( pRenderer->pRenderD3D ) 216 if ( pRenderer->pRenderD3D )
204 { 217 {
205 v3->sCosineY = stru_5C6E00->Cos(v3->sPartyRotY); 218 this->sCosineY = stru_5C6E00->Cos(this->sPartyRotY);
206 v3->sSineY = stru_5C6E00->Sin(v3->sPartyRotY); 219 this->sSineY = stru_5C6E00->Sin(this->sPartyRotY);
207 v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX); 220 this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX);
208 v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX); 221 this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX);
209 v3->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); 222 this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125);
210 v3->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); 223 this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125);
211 v3->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125); 224 this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125);
212 v3->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125); 225 this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125);
213 v3->field_64 = a2->field_3C; 226 this->field_64 = a2->field_3C;
214 v11 = v3->uViewportW; 227 v11 = this->uViewportW;
215 v12 = v3->uViewportX; 228 v12 = this->uViewportX;
216 v13 = v3->uViewportZ - v12; 229 v13 = this->uViewportZ - v12;
217 v14 = v3->uViewportZ + v12; 230 v14 = this->uViewportZ + v12;
218 v3->field_70 = v13 + 1; 231 this->field_70 = v13 + 1;
219 v15 = v3->uViewportY; 232 v15 = this->uViewportY;
220 v3->uViewportHeight = v11 - v15 + 1; 233 this->uViewportHeight = v11 - v15 + 1;
221 v16 = v3->uViewportW; 234 v16 = this->uViewportW;
222 v3->uViewportCenterX = v14 >> 1; 235 this->uViewportCenterX = v14 >> 1;
223 v3->uViewportCenterY = (signed int)(v16 + v15) >> 1; 236 this->uViewportCenterY = (signed int)(v16 + v15) >> 1;
224 } 237 }
225 else 238 else
226 { 239 {
227 v3->sCosineY = stru_5C6E00->Cos(-v3->sPartyRotY); 240 this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY);
228 v3->sSineY = stru_5C6E00->Sin(-v3->sPartyRotY); 241 this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY);
229 v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX); 242 this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX);
230 v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX); 243 this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX);
231 v17 = cos((double)-v3->sPartyRotY * 0.0030664064); 244 v17 = cos((double)-this->sPartyRotY * 0.0030664064);
232 v18 = v3->sPartyRotY; 245 v18 = this->sPartyRotY;
233 v3->fCosineY = v17; 246 this->fCosineY = v17;
234 v19 = sin((double)-v18 * 0.0030664064); 247 v19 = sin((double)-v18 * 0.0030664064);
235 v20 = v3->sPartyRotX; 248 v20 = this->sPartyRotX;
236 v3->fSineY = v19; 249 this->fSineY = v19;
237 v21 = cos((double)-v20 * 0.0030664064); 250 v21 = cos((double)-v20 * 0.0030664064);
238 v22 = v3->sPartyRotX; 251 v22 = this->sPartyRotX;
239 v3->fCosineNegX = v21; 252 this->fCosineNegX = v21;
240 v3->fSineNegX = sin((double)-v22 * 0.0030664064); 253 this->fSineNegX = sin((double)-v22 * 0.0030664064);
241 v23 = v3->uViewportX; 254 v23 = this->uViewportX;
242 v3->field_64 = a2->field_3C; 255 this->field_64 = a2->field_3C;
243 v24 = v3->uViewportZ; 256 v24 = this->uViewportZ;
244 v3->field_70 = v3->uViewportZ - v23 + 1; 257 this->field_70 = this->uViewportZ - v23 + 1;
245 v25 = v3->uViewportW - v3->uViewportY + 1; 258 v25 = this->uViewportW - this->uViewportY + 1;
246 v3->uViewportHeight = v25; 259 this->uViewportHeight = v25;
247 v29 = v25; 260 v29 = v25;
248 v26 = v3->field_64; 261 v26 = this->field_64;
249 v3->uViewportCenterX = (signed int)(v24 + v23) >> 1; 262 this->uViewportCenterX = (signed int)(v24 + v23) >> 1;
250 v3->uViewportCenterY = v3->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16); 263 this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);
251 } 264 }
252 v27 = (unsigned int)(signed __int64)((double)v3->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329) 265 v27 = (unsigned int)(signed __int64)((double)this->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329)
253 + 0.5) << 16; 266 + 0.5) << 16;
254 v3->field_40 = v27; 267 this->field_40 = v27;
255 LODWORD(v3->field_44) = 4294967296i64 / v27; 268 this->field_44 = 0x100000000i64 / v27;
256 v3->pRenderTarget = v2->pRenderTarget; 269 this->pRenderTarget = v2->pRenderTarget;
257 v3->uTargetWidth = v2->uTargetWidth; 270 this->uTargetWidth = v2->uTargetWidth;
258 v3->uTargetHeight = v2->uTargetHeight; 271 this->uTargetHeight = v2->uTargetHeight;
259 v3->uViewportX = v2->uViewportX; 272 this->uViewportX = v2->uViewportX;
260 v3->uViewportY = v2->uViewportY; 273 this->uViewportY = v2->uViewportY;
261 v3->uViewportZ = v2->uViewportZ; 274 this->uViewportZ = v2->uViewportZ;
262 v3->uViewportW = v2->uViewportW; 275 this->uViewportW = v2->uViewportW;
263 v3->pTargetZBuffer = v2->pTargetZ; 276 this->pTargetZBuffer = v2->pTargetZ;
264 result = 0; 277 result = 0;
265 v3->field_8C = 0; 278 this->field_8C = 0;
266 v3->field_84 = 0; 279 this->field_84 = 0;
267 v3->uNumFacesRenderedThisFrame = 0; 280 this->uNumFacesRenderedThisFrame = 0;
268 v3->field_88 = 0; 281 this->field_88 = 0;
269 pBLVRenderParams->field_90 = 64; 282 pBLVRenderParams->field_90 = 64;
270 pBLVRenderParams->field_94 = 6; 283 pBLVRenderParams->field_94 = 6;
271 return result; 284 return result;
272 } 285 }
273 286
512 { 525 {
513 if (pGame->pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa, 526 if (pGame->pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa,
514 static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa ) 527 static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
515 { 528 {
516 a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel); 529 a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel);
517 v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8); 530 v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel))
531 | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8);
518 sub_4B0E07(uFaceID); 532 sub_4B0E07(uFaceID);
519 pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID); 533 pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
520 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID); 534 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
521 pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); 535 pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
522 pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0); 536 pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
1640 *(int *)v2 = 0; 1654 *(int *)v2 = 0;
1641 pAllocator->FreeChunk(v1->ptr_0002B0_sector_rdata); 1655 pAllocator->FreeChunk(v1->ptr_0002B0_sector_rdata);
1642 v1->ptr_0002B0_sector_rdata = 0; 1656 v1->ptr_0002B0_sector_rdata = 0;
1643 pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata); 1657 pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata);
1644 v1->ptr_0002B8_sector_lrdata = 0; 1658 v1->ptr_0002B8_sector_lrdata = 0;
1645 pAllocator->FreeChunk(v1->ptr_2AC); 1659 pAllocator->FreeChunk(v1->pLFaces);
1646 v1->ptr_2AC = 0; 1660 v1->pLFaces = 0;
1647 pAllocator->FreeChunk(v1->pSpawnPoints); 1661 pAllocator->FreeChunk(v1->pSpawnPoints);
1648 v3 = v1->pVertices; 1662 v3 = v1->pVertices;
1649 v1->pSpawnPoints = 0; 1663 v1->pSpawnPoints = 0;
1650 v1->uNumSectors = 0; 1664 v1->uNumSectors = 0;
1651 v1->uNumFaces = 0; 1665 v1->uNumFaces = 0;
2437 memcpy(&uNumFaces, pData += uNumVertices * sizeof(Vec3_short_), 4); 2451 memcpy(&uNumFaces, pData += uNumVertices * sizeof(Vec3_short_), 4);
2438 2452
2439 pGameLoadingUI_ProgressBar->Progress(); 2453 pGameLoadingUI_ProgressBar->Progress();
2440 2454
2441 memcpy(pFaces, pData += 4, uNumFaces * sizeof (BLVFace)); 2455 memcpy(pFaces, pData += 4, uNumFaces * sizeof (BLVFace));
2442 ptr_2AC = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_2AC, blv.uFaces_fdata_Size, "L.FData"); 2456 pLFaces = (unsigned __int16 *)pAllocator->AllocNamedChunk(pLFaces, blv.uFaces_fdata_Size, "L.FData");
2443 2457
2444 memcpy(ptr_2AC, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size); 2458 memcpy(pLFaces, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size);
2445 2459
2446 for (uint i = 0, j = 0; i < uNumFaces; ++i) 2460 for (uint i = 0, j = 0; i < uNumFaces; ++i)
2447 { 2461 {
2448 auto pFace = pFaces + i; 2462 auto pFace = pFaces + i;
2449 2463
2450 pFace->pVertexIDs = ptr_2AC + j; 2464 pFace->pVertexIDs = pLFaces + j;
2451 2465
2452 j += pFace->uNumVertices + 1; 2466 j += pFace->uNumVertices + 1;
2453 pFace->pXInterceptDisplacements = (short *)(ptr_2AC + j); 2467 pFace->pXInterceptDisplacements = (short *)(pLFaces + j);
2454 2468
2455 j += pFace->uNumVertices + 1; 2469 j += pFace->uNumVertices + 1;
2456 pFace->pYInterceptDisplacements = (short *)(ptr_2AC + j); 2470 pFace->pYInterceptDisplacements = (short *)(pLFaces + j);
2457 2471
2458 j += pFace->uNumVertices + 1; 2472 j += pFace->uNumVertices + 1;
2459 pFace->pZInterceptDisplacements = (short *)(ptr_2AC + j); 2473 pFace->pZInterceptDisplacements = (short *)(pLFaces + j);
2460 2474
2461 j += pFace->uNumVertices + 1; 2475 j += pFace->uNumVertices + 1;
2462 pFace->pVertexUIDs = (__int16 *)(ptr_2AC + j); 2476 pFace->pVertexUIDs = (__int16 *)(pLFaces + j);
2463 2477
2464 j += pFace->uNumVertices + 1; 2478 j += pFace->uNumVertices + 1;
2465 pFace->pVertexVIDs = (__int16 *)(ptr_2AC + j); 2479 pFace->pVertexVIDs = (__int16 *)(pLFaces + j);
2466 2480
2467 j += pFace->uNumVertices + 1; 2481 j += pFace->uNumVertices + 1;
2468 /*v93 = &pFaces[v92]; 2482 /*v93 = &pFaces[v92];
2469 Src = v93; 2483 Src = v93;
2470 v94 = (BLVSector *)((char *)v244 + 2 * v93->uNumVertices + 2); 2484 v94 = (BLVSector *)((char *)v244 + 2 * v93->uNumVertices + 2);