comparison Indoor.cpp @ 1006:e865f349aa41

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