comparison Indoor.cpp @ 666:a5750c94b022

BSP
author Ritor1
date Wed, 13 Mar 2013 17:08:21 +0600
parents 92bc2544249d
children ecfb1b3c9a39 ee978b573798
comparison
equal deleted inserted replaced
665:92bc2544249d 666:a5750c94b022
273 { 273 {
274 pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); 274 pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
275 for (uint i = 0; i < pBspRenderer->uNumFaceIDs; ++i) 275 for (uint i = 0; i < pBspRenderer->uNumFaceIDs; ++i)
276 { 276 {
277 v2 = pBspRenderer->pFaceIDs[2 * i + 1]; 277 v2 = pBspRenderer->pFaceIDs[2 * i + 1];
278 if ( pBspRenderer->field_FA8[v2].std__vector_0007A8 == -1 ) 278 if ( pBspRenderer->pSectors[v2].std__vector_0007A8 == -1 )
279 { 279 {
280 v6 = 0; 280 v6 = 0;
281 v3 = 0; 281 v3 = 0;
282 } 282 }
283 else 283 else
284 { 284 {
285 v3 = pBspRenderer->field_FA8[v2].std__vector_0007AC; 285 v3 = pBspRenderer->pSectors[v2].std__vector_0007AC;
286 v6 = pBspRenderer->field_FA8[v2].pVertices; 286 v6 = pBspRenderer->pSectors[v2].pVertices;
287 } 287 }
288 IndoorLocation::ExecDraw_d3d(pBspRenderer->pFaceIDs[2 * i], v3, 4, v6); 288 IndoorLocation::ExecDraw_d3d(pBspRenderer->pFaceIDs[2 * i], v3, 4, v6);
289 } 289 }
290 } 290 }
291 else 291 else
292 { 292 {
293 for (uint j = 0; j < pBspRenderer->uNumFaceIDs; ++j ) 293 for (uint j = 0; j < pBspRenderer->uNumFaceIDs; ++j )
294 { 294 {
295 v5 = pBspRenderer->pFaceIDs[2 * j]; 295 v5 = pBspRenderer->pFaceIDs[2 * j];
296 pBLVRenderParams->field_7C = &pBspRenderer->field_FA8[pBspRenderer->pFaceIDs[2 * j + 1]].field_C; 296 pBLVRenderParams->field_7C = &pBspRenderer->pSectors[pBspRenderer->pFaceIDs[2 * j + 1]].field_C;
297 IndoorLocation::ExecDraw_sw(v5); 297 IndoorLocation::ExecDraw_sw(v5);
298 } 298 }
299 } 299 }
300 } 300 }
301 301
320 pBspRenderer->DrawFaceOutlines(); 320 pBspRenderer->DrawFaceOutlines();
321 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES) 321 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES)
322 { 322 {
323 v1 = pBLVRenderParams->pRenderTarget; 323 v1 = pBLVRenderParams->pRenderTarget;
324 v6 = 0; 324 v6 = 0;
325 if ( (signed int)pBspRenderer->std__vector_000FA8 > 0 ) 325 if ( (signed int)pBspRenderer->pNumSectors > 0 )
326 { 326 {
327 v7 = 0; 327 v7 = 0;
328 v2 = (char *)&pBspRenderer->field_FA8[0].field_C._viewport_space_w; 328 v2 = (char *)&pBspRenderer->pSectors[0].field_C._viewport_space_w;
329 do 329 do
330 { 330 {
331 v3 = *((int *)v2 - 1); 331 v3 = *((int *)v2 - 1);
332 v4 = pRenderer->uTargetSurfacePitch * *((int *)v2 - 1); 332 v4 = pRenderer->uTargetSurfacePitch * *((int *)v2 - 1);
333 if ( v3 <= *(int *)v2 ) 333 if ( v3 <= *(int *)v2 )
334 { 334 {
335 v5 = (char *)&pBspRenderer->field_FA8[0].field_C.array_3D8[v3 + v7]; 335 v5 = (char *)&pBspRenderer->pSectors[0].field_C.array_3D8[v3 + v7];
336 do 336 do
337 { 337 {
338 v1[v4 + *((short *)v5 - 480)] = 255; 338 v1[v4 + *((short *)v5 - 480)] = 255;
339 ++v3; 339 ++v3;
340 v1[v4 + *(short *)v5] = 255; 340 v1[v4 + *(short *)v5] = 255;
345 } 345 }
346 ++v6; 346 ++v6;
347 v7 += 1126; 347 v7 += 1126;
348 v2 += 2252; 348 v2 += 2252;
349 } 349 }
350 while ( v6 < (signed int)pBspRenderer->std__vector_000FA8 ); 350 while ( v6 < (signed int)pBspRenderer->pNumSectors );
351 } 351 }
352 } 352 }
353 } 353 }
354 } 354 }
355 355
1274 //BLVFace *v39; // [sp+1Ch] [bp-4h]@1 1274 //BLVFace *v39; // [sp+1Ch] [bp-4h]@1
1275 1275
1276 //v3 = uFaceID; 1276 //v3 = uFaceID;
1277 //v4 = this; 1277 //v4 = this;
1278 //v5 = &pIndoor->pFaces[uFaceID]; 1278 //v5 = &pIndoor->pFaces[uFaceID];
1279 field_FA8[std__vector_000FA8].std__vector_0007A8 = -1; 1279 pSectors[pNumSectors].std__vector_0007A8 = -1;
1280 //v39 = &pIndoor->pFaces[uFaceID]; 1280 //v39 = &pIndoor->pFaces[uFaceID];
1281 1281
1282 auto pFace = &pIndoor->pFaces[uFaceID]; 1282 auto pFace = &pIndoor->pFaces[uFaceID];
1283 1283
1284 if (pFace->TwoSided()) 1284 if (pFace->TwoSided())
1285 { 1285 {
1286 auto p = &field_FA8[a2]; 1286 auto p = &pSectors[a2];
1287 //v6 = (int)((char *)this + 2252 * a2); 1287 //v6 = (int)((char *)this + 2252 * a2);
1288 //a0 = v6; 1288 //a0 = v6;
1289 if (p->uFaceID == uFaceID) 1289 if (p->uFaceID == uFaceID)
1290 return; 1290 return;
1291 if (!a2 && 1291 if (!a2 &&
1299 if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x 1299 if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
1300 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y 1300 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
1301 + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) 1301 + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 )
1302 { 1302 {
1303 v7 = pFace->uSectorID; 1303 v7 = pFace->uSectorID;
1304 if ( field_FA8[0].uSectorID == v7 ) 1304 if ( pSectors[0].uSectorID == v7 )
1305 v7 = pFace->uBackSectorID; 1305 v7 = pFace->uBackSectorID;
1306 field_FA8[std__vector_000FA8].uSectorID = v7; 1306 pSectors[pNumSectors].uSectorID = v7;
1307 field_FA8[std__vector_000FA8].uFaceID = uFaceID; 1307 pSectors[pNumSectors].uFaceID = uFaceID;
1308 field_FA8[std__vector_000FA8].uViewportX = pBLVRenderParams->uViewportX; 1308 pSectors[pNumSectors].uViewportX = pBLVRenderParams->uViewportX;
1309 field_FA8[std__vector_000FA8].uViewportZ = pBLVRenderParams->uViewportZ; 1309 pSectors[pNumSectors].uViewportZ = pBLVRenderParams->uViewportZ;
1310 field_FA8[std__vector_000FA8].uViewportY = pBLVRenderParams->uViewportY; 1310 pSectors[pNumSectors].uViewportY = pBLVRenderParams->uViewportY;
1311 field_FA8[std__vector_000FA8].uViewportW = pBLVRenderParams->uViewportW; 1311 pSectors[pNumSectors].uViewportW = pBLVRenderParams->uViewportW;
1312 field_FA8[std__vector_000FA8++].field_C._43F9E1( 1312 pSectors[pNumSectors++].field_C._43F9E1(
1313 pBLVRenderParams->uViewportX, 1313 pBLVRenderParams->uViewportX,
1314 pBLVRenderParams->uViewportY, 1314 pBLVRenderParams->uViewportY,
1315 pBLVRenderParams->uViewportZ, 1315 pBLVRenderParams->uViewportZ,
1316 pBLVRenderParams->uViewportW); 1316 pBLVRenderParams->uViewportW);
1317 sub_440639(std__vector_000FA8 - 1); 1317 sub_440639(pNumSectors - 1);
1318 return; 1318 return;
1319 } 1319 }
1320 //v5 = v39; 1320 //v5 = v39;
1321 //v6 = a0; 1321 //v6 = a0;
1322 } 1322 }
1359 //v16 = a0; 1359 //v16 = a0;
1360 if (v11 >= p->uViewportX && 1360 if (v11 >= p->uViewportX &&
1361 a2 <= p->uViewportZ && 1361 a2 <= p->uViewportZ &&
1362 v12 >= p->uViewportY && 1362 v12 >= p->uViewportY &&
1363 v37 <= p->uViewportW && 1363 v37 <= p->uViewportW &&
1364 sub_424829(v10, &field_FA8[std__vector_000FA8].field_C, &p->field_C, uFaceID)) 1364 sub_424829(v10, &pSectors[pNumSectors].field_C, &p->field_C, uFaceID))
1365 { 1365 {
1366 //v17 = v39; 1366 //v17 = v39;
1367 v18 = pFace->uSectorID; 1367 v18 = pFace->uSectorID;
1368 if (p->uSectorID == v18 ) 1368 if (p->uSectorID == v18 )
1369 v18 = pFace->uBackSectorID; 1369 v18 = pFace->uBackSectorID;
1370 field_FA8[std__vector_000FA8].uSectorID = v18; 1370 pSectors[pNumSectors].uSectorID = v18;
1371 field_FA8[std__vector_000FA8].uFaceID = uFaceID; 1371 pSectors[pNumSectors].uFaceID = uFaceID;
1372 field_FA8[std__vector_000FA8].uViewportX = pBLVRenderParams->uViewportX; 1372 pSectors[pNumSectors].uViewportX = pBLVRenderParams->uViewportX;
1373 field_FA8[std__vector_000FA8].uViewportZ = pBLVRenderParams->uViewportZ; 1373 pSectors[pNumSectors].uViewportZ = pBLVRenderParams->uViewportZ;
1374 field_FA8[std__vector_000FA8].uViewportY = pBLVRenderParams->uViewportY; 1374 pSectors[pNumSectors].uViewportY = pBLVRenderParams->uViewportY;
1375 field_FA8[std__vector_000FA8].uViewportW = pBLVRenderParams->uViewportW; 1375 pSectors[pNumSectors].uViewportW = pBLVRenderParams->uViewportW;
1376 //v38 = pGame->pStru10Instance; 1376 //v38 = pGame->pStru10Instance;
1377 //a0a = pGame->pIndoorCameraD3D; 1377 //a0a = pGame->pIndoorCameraD3D;
1378 if (p->std__vector_0007A8 == -1 ) 1378 if (p->std__vector_0007A8 == -1 )
1379 { 1379 {
1380 v29 = pGame->pStru10Instance->_49C681_DrawDebugStuff( 1380 v29 = pGame->pStru10Instance->_49C681_DrawDebugStuff(pFace, pSectors[pNumSectors].std__vector_0007AC,
1381 pFace, 1381 pSectors[pNumSectors].pVertices);
1382 field_FA8[std__vector_000FA8].std__vector_0007AC,
1383 field_FA8[std__vector_000FA8].pVertices);
1384 } 1382 }
1385 else 1383 else
1386 { 1384 {
1387 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F7AA08[64]; 1385 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F7AA08[64];
1388 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F79E08[64]; 1386 static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F79E08[64];
1413 static_subAddFaceToRenderList_d3d_stru_F79E08, 1411 static_subAddFaceToRenderList_d3d_stru_F79E08,
1414 p->std__vector_0007AC, 1412 p->std__vector_0007AC,
1415 4, 1413 4,
1416 0, 1414 0,
1417 0); 1415 0);
1418 v29 = pGame->pStru10Instance->_49C5DA( 1416 v29 = pGame->pStru10Instance->_49C5DA(pFace, static_subAddFaceToRenderList_d3d_stru_F79E08, &a2,
1419 pFace, 1417 pSectors[pNumSectors].std__vector_0007AC,
1420 static_subAddFaceToRenderList_d3d_stru_F79E08, 1418 pSectors[pNumSectors].pVertices);
1421 &a2,
1422 field_FA8[std__vector_000FA8].std__vector_0007AC,
1423 field_FA8[std__vector_000FA8].pVertices);
1424 } 1419 }
1425 if ( v29 ) 1420 if ( v29 )
1426 { 1421 {
1427 field_FA8[std__vector_000FA8].std__vector_0007A8 = uFaceID; 1422 pSectors[pNumSectors].std__vector_0007A8 = uFaceID;
1428 v30 = std__vector_000FA8; 1423 v30 = pNumSectors;
1429 if ( v30 < 150 ) 1424 if ( v30 < 150 )
1430 { 1425 {
1431 v31 = v30 + 1; 1426 v31 = v30 + 1;
1432 std__vector_000FA8 = v31; 1427 pNumSectors = v31;
1433 sub_440639(v31 - 1); 1428 sub_440639(v31 - 1);
1434 } 1429 }
1435 } 1430 }
1436 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES) 1431 if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES)
1437 pGame->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF); 1432 pGame->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF);
1495 if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x 1490 if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x
1496 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y 1491 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y
1497 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) 1492 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
1498 { 1493 {
1499 v6 = v21->uSectorID; 1494 v6 = v21->uSectorID;
1500 if ( v3->field_FA8[0].uSectorID == v6 ) 1495 if ( v3->pSectors[0].uSectorID == v6 )
1501 v6 = v21->uBackSectorID; 1496 v6 = v21->uBackSectorID;
1502 v3->field_FA8[v3->std__vector_000FA8].uSectorID = v6; 1497 v3->pSectors[v3->pNumSectors].uSectorID = v6;
1503 v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID; 1498 v3->pSectors[v3->pNumSectors].uFaceID = uFaceID;
1504 v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); 1499 v3->pSectors[v3->pNumSectors].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
1505 v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); 1500 v3->pSectors[v3->pNumSectors].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
1506 v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); 1501 v3->pSectors[v3->pNumSectors].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
1507 v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); 1502 v3->pSectors[v3->pNumSectors].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
1508 v3->field_FA8[v3->std__vector_000FA8++].field_C._43F9E1( 1503 v3->pSectors[v3->pNumSectors++].field_C._43F9E1(
1509 SLOWORD(pBLVRenderParams->uViewportX), 1504 SLOWORD(pBLVRenderParams->uViewportX),
1510 pBLVRenderParams->uViewportY, 1505 pBLVRenderParams->uViewportY,
1511 SLOWORD(pBLVRenderParams->uViewportZ), 1506 SLOWORD(pBLVRenderParams->uViewportZ),
1512 pBLVRenderParams->uViewportW); 1507 pBLVRenderParams->uViewportW);
1513 v7 = v3->std__vector_000FA8 - 1; 1508 v7 = v3->pNumSectors - 1;
1514 goto LABEL_14; 1509 goto LABEL_14;
1515 } 1510 }
1516 v4 = v21; 1511 v4 = v21;
1517 v5 = v20; 1512 v5 = v20;
1518 } 1513 }
1554 } 1549 }
1555 if ( v11 >= *((short *)v20 + 2005) 1550 if ( v11 >= *((short *)v20 + 2005)
1556 && v23 <= *((short *)v20 + 2007) 1551 && v23 <= *((short *)v20 + 2007)
1557 && v12 >= *((short *)v20 + 2006) 1552 && v12 >= *((short *)v20 + 2006)
1558 && v22 <= *((short *)v20 + 2008) 1553 && v22 <= *((short *)v20 + 2008)
1559 && sub_424829(v10, &v3->field_FA8[v3->std__vector_000FA8].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) ) 1554 && sub_424829(v10, &v3->pSectors[v3->pNumSectors].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) )
1560 { 1555 {
1561 v16 = v21->uSectorID; 1556 v16 = v21->uSectorID;
1562 if ( *((short *)v20 + 2004) == v16 ) 1557 if ( *((short *)v20 + 2004) == v16 )
1563 v16 = v21->uBackSectorID; 1558 v16 = v21->uBackSectorID;
1564 v3->field_FA8[v3->std__vector_000FA8].uSectorID = v16; 1559 v3->pSectors[v3->pNumSectors].uSectorID = v16;
1565 v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID; 1560 v3->pSectors[v3->pNumSectors].uFaceID = uFaceID;
1566 v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); 1561 v3->pSectors[v3->pNumSectors].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
1567 v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); 1562 v3->pSectors[v3->pNumSectors].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
1568 v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); 1563 v3->pSectors[v3->pNumSectors].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
1569 v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); 1564 v3->pSectors[v3->pNumSectors].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
1570 v17 = v3->std__vector_000FA8; 1565 v17 = v3->pNumSectors;
1571 if ( v17 < 150 ) 1566 if ( v17 < 150 )
1572 { 1567 {
1573 v18 = v17 + 1; 1568 v18 = v17 + 1;
1574 v3->std__vector_000FA8 = v18; 1569 v3->pNumSectors = v18;
1575 v7 = v18 - 1; 1570 v7 = v18 - 1;
1576 LABEL_14: 1571 LABEL_14:
1577 sub_440639(v7); 1572 sub_440639(v7);
1578 return; 1573 return;
1579 } 1574 }
1609 if ( v1 >= 0 ) 1604 if ( v1 >= 0 )
1610 { 1605 {
1611 if ( v1 < (signed int)pIndoor->uNumFaces ) 1606 if ( v1 < (signed int)pIndoor->uNumFaces )
1612 { 1607 {
1613 v2 = pBspRenderer->pFaceIDs[2 * i]; 1608 v2 = pBspRenderer->pFaceIDs[2 * i];
1614 pBLVRenderParams->field_7C = &pBspRenderer->field_FA8[pBspRenderer->pFaceIDs[2 * i + 1]].field_C; 1609 pBLVRenderParams->field_7C = &pBspRenderer->pSectors[pBspRenderer->pFaceIDs[2 * i + 1]].field_C;
1615 v3 = sub_423B5D(v2); 1610 v3 = sub_423B5D(v2);
1616 if ( v3 ) 1611 if ( v3 )
1617 { 1612 {
1618 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) 1613 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) )
1619 { 1614 {