comparison Indoor.cpp @ 682:ee978b573798

Слияние
author Ritor1
date Wed, 13 Mar 2013 18:54:30 +0600
parents b54755fa0dbc a5750c94b022
children d4497b76a863
comparison
equal deleted inserted replaced
681:b54755fa0dbc 682:ee978b573798
127 PrepareDecorationsRenderList_BLV(v9[v12++], v7); 127 PrepareDecorationsRenderList_BLV(v9[v12++], v7);
128 while ( v12 < v8->uNumDecorations ); 128 while ( v12 < v8->uNumDecorations );
129 } 129 }
130 v6 = i + 1; 130 v6 = i + 1;
131 } 131 }
132 MessWithBillboards_BLV(); 132 FindBillboardsLightLevels_BLV();
133 pGame->PrepareBloodsplats(); 133 pGame->PrepareBloodsplats();
134 } 134 }
135 135
136 136
137 137
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);
1494 if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x 1489 if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x
1495 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y 1490 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y
1496 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) 1491 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
1497 { 1492 {
1498 v6 = v21->uSectorID; 1493 v6 = v21->uSectorID;
1499 if ( v3->field_FA8[0].uSectorID == v6 ) 1494 if ( v3->pSectors[0].uSectorID == v6 )
1500 v6 = v21->uBackSectorID; 1495 v6 = v21->uBackSectorID;
1501 v3->field_FA8[v3->std__vector_000FA8].uSectorID = v6; 1496 v3->pSectors[v3->pNumSectors].uSectorID = v6;
1502 v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID; 1497 v3->pSectors[v3->pNumSectors].uFaceID = uFaceID;
1503 v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); 1498 v3->pSectors[v3->pNumSectors].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
1504 v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); 1499 v3->pSectors[v3->pNumSectors].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
1505 v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); 1500 v3->pSectors[v3->pNumSectors].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
1506 v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); 1501 v3->pSectors[v3->pNumSectors].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
1507 v3->field_FA8[v3->std__vector_000FA8++].field_C._43F9E1( 1502 v3->pSectors[v3->pNumSectors++].field_C._43F9E1(
1508 SLOWORD(pBLVRenderParams->uViewportX), 1503 SLOWORD(pBLVRenderParams->uViewportX),
1509 pBLVRenderParams->uViewportY, 1504 pBLVRenderParams->uViewportY,
1510 SLOWORD(pBLVRenderParams->uViewportZ), 1505 SLOWORD(pBLVRenderParams->uViewportZ),
1511 pBLVRenderParams->uViewportW); 1506 pBLVRenderParams->uViewportW);
1512 v7 = v3->std__vector_000FA8 - 1; 1507 v7 = v3->pNumSectors - 1;
1513 goto LABEL_14; 1508 goto LABEL_14;
1514 } 1509 }
1515 v4 = v21; 1510 v4 = v21;
1516 v5 = v20; 1511 v5 = v20;
1517 } 1512 }
1553 } 1548 }
1554 if ( v11 >= *((short *)v20 + 2005) 1549 if ( v11 >= *((short *)v20 + 2005)
1555 && v23 <= *((short *)v20 + 2007) 1550 && v23 <= *((short *)v20 + 2007)
1556 && v12 >= *((short *)v20 + 2006) 1551 && v12 >= *((short *)v20 + 2006)
1557 && v22 <= *((short *)v20 + 2008) 1552 && v22 <= *((short *)v20 + 2008)
1558 && sub_424829(v10, &v3->field_FA8[v3->std__vector_000FA8].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) ) 1553 && sub_424829(v10, &v3->pSectors[v3->pNumSectors].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) )
1559 { 1554 {
1560 v16 = v21->uSectorID; 1555 v16 = v21->uSectorID;
1561 if ( *((short *)v20 + 2004) == v16 ) 1556 if ( *((short *)v20 + 2004) == v16 )
1562 v16 = v21->uBackSectorID; 1557 v16 = v21->uBackSectorID;
1563 v3->field_FA8[v3->std__vector_000FA8].uSectorID = v16; 1558 v3->pSectors[v3->pNumSectors].uSectorID = v16;
1564 v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID; 1559 v3->pSectors[v3->pNumSectors].uFaceID = uFaceID;
1565 v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); 1560 v3->pSectors[v3->pNumSectors].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
1566 v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); 1561 v3->pSectors[v3->pNumSectors].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
1567 v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); 1562 v3->pSectors[v3->pNumSectors].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
1568 v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); 1563 v3->pSectors[v3->pNumSectors].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
1569 v17 = v3->std__vector_000FA8; 1564 v17 = v3->pNumSectors;
1570 if ( v17 < 150 ) 1565 if ( v17 < 150 )
1571 { 1566 {
1572 v18 = v17 + 1; 1567 v18 = v17 + 1;
1573 v3->std__vector_000FA8 = v18; 1568 v3->pNumSectors = v18;
1574 v7 = v18 - 1; 1569 v7 = v18 - 1;
1575 LABEL_14: 1570 LABEL_14:
1576 sub_440639(v7); 1571 sub_440639(v7);
1577 return; 1572 return;
1578 } 1573 }
1608 if ( v1 >= 0 ) 1603 if ( v1 >= 0 )
1609 { 1604 {
1610 if ( v1 < (signed int)pIndoor->uNumFaces ) 1605 if ( v1 < (signed int)pIndoor->uNumFaces )
1611 { 1606 {
1612 v2 = pBspRenderer->pFaceIDs[2 * i]; 1607 v2 = pBspRenderer->pFaceIDs[2 * i];
1613 pBLVRenderParams->field_7C = &pBspRenderer->field_FA8[pBspRenderer->pFaceIDs[2 * i + 1]].field_C; 1608 pBLVRenderParams->field_7C = &pBspRenderer->pSectors[pBspRenderer->pFaceIDs[2 * i + 1]].field_C;
1614 v3 = sub_423B5D(v2); 1609 v3 = sub_423B5D(v2);
1615 if ( v3 ) 1610 if ( v3 )
1616 { 1611 {
1617 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) 1612 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) )
1618 { 1613 {
3335 v57 = (unsigned __int64)(v51 * (signed __int64)(sX << 16)) >> 16; 3330 v57 = (unsigned __int64)(v51 * (signed __int64)(sX << 16)) >> 16;
3336 v56 = sY << 16; 3331 v56 = sY << 16;
3337 v51 = v40->zCalc2; 3332 v51 = v40->zCalc2;
3338 v56 = (unsigned __int64)(v51 * (signed __int64)(sY << 16)) >> 16; 3333 v56 = (unsigned __int64)(v51 * (signed __int64)(sY << 16)) >> 16;
3339 v42 = (v56 + v40->zCalc3 + v57 + 32768) >> 16; 3334 v42 = (v56 + v40->zCalc3 + v57 + 32768) >> 16;
3340 goto LABEL_46; 3335 v39 = sZ - v42;
3341 } 3336 }
3342 LABEL_47: 3337 LABEL_47:
3343 if ( v39 >= 0 ) 3338 if ( v39 >= 0 )
3344 { 3339 {
3345 if ( v39 < v53 ) 3340 if ( v39 < v53 )
3351 ++v37; 3346 ++v37;
3352 if ( v37 >= v55 ) 3347 if ( v37 >= v55 )
3353 return v38; 3348 return v38;
3354 } 3349 }
3355 v42 = this->pVertices[*v40->pVertexIDs].z; 3350 v42 = this->pVertices[*v40->pVertexIDs].z;
3356 LABEL_46:
3357 v39 = sZ - v42; 3351 v39 = sZ - v42;
3358 goto LABEL_47; 3352 goto LABEL_47;
3359 } 3353 }
3360 return v38; 3354 return v38;
3361 } 3355 }