comparison Indoor.cpp @ 834:95d9727412c9

Слияние
author Ritor1
date Wed, 27 Mar 2013 21:24:24 +0600
parents 9c3f28b31b4a
children dfd683c4f538
comparison
equal deleted inserted replaced
833:3233927402e5 834:95d9727412c9
26 #include "GUIWindow.h" 26 #include "GUIWindow.h"
27 #include "GUIButton.h" 27 #include "GUIButton.h"
28 #include "GUIFont.h" 28 #include "GUIFont.h"
29 29
30 #include "mm7_data.h" 30 #include "mm7_data.h"
31 #include "MM7.h"
31 32
32 33
33 34
34 35
35 36
531 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0); 532 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0);
532 533
533 if (pDecalBuilder->uNumDecals > 0) 534 if (pDecalBuilder->uNumDecals > 0)
534 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID); 535 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID);
535 536
536 if (pFace->Fluid() &&
537 pFace->uBitmapID == pRenderer->hd_water_tile_id )
538 {
539 v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
540 v27 = pBitmaps_LOD->pHardwareTextures[v23];
541 if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
542 _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
543 else
544 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | OBJECT_BModel, v17, 0);
545 return;
546 }
547 if (pFace->Fluid()) 537 if (pFace->Fluid())
548 { 538 {
549 //auto v24 = GetTickCount() / 4; 539 if (pFace->uBitmapID == pRenderer->hd_water_tile_id)
550 //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi; 540 {
551 uint eightSeconds = GetTickCount() % 8000; 541 v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
552 float angle = (eightSeconds / 8000.0f) * 2 * 3.1415f; 542 v27 = pBitmaps_LOD->pHardwareTextures[v23];
553 543 }
554 //animte lava back and forth
555 for (uint i = 0; i < uNumVerticesa; ++i)
556 //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8));
557 array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle);
558 v23 = pFace->uBitmapID;
559 v27 = pBitmaps_LOD->pHardwareTextures[v23];
560 if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
561 _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
562 else 544 else
563 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | OBJECT_BModel, v17, 0); 545 {
564 return; 546 //auto v24 = GetTickCount() / 4;
547 //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi;
548 uint eightSeconds = GetTickCount() % 8000;
549 float angle = (eightSeconds / 8000.0f) * 2 * 3.1415f;
550
551 //animte lava back and forth
552 for (uint i = 0; i < uNumVerticesa; ++i)
553 //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8));
554 array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle);
555 v23 = pFace->uBitmapID;
556 v27 = pBitmaps_LOD->pHardwareTextures[v23];
557 }
565 } 558 }
566 else if (pFace->uAttributes & 0x4000) 559 else if (pFace->uAttributes & 0x4000)
567 { 560 {
568 v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_); 561 v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_);
569 v27 = pBitmaps_LOD->pHardwareTextures[v23]; 562 v27 = pBitmaps_LOD->pHardwareTextures[v23];
570 if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
571 _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
572 else
573 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | OBJECT_BModel, v17, 0);
574 return;
575 } 563 }
576 v17 = 0xFFFFFFFF; 564 else
577 v23 = pFace->uBitmapID; 565 {
578 v27 = pBitmaps_LOD->pHardwareTextures[v23]; 566 v17 = 0xFFD0D0D0;
567 v23 = pFace->uBitmapID;
568 v27 = pBitmaps_LOD->pHardwareTextures[v23];
569 }
570
579 if (pFace->uAttributes & FACE_DO_NOT_LIGHT) 571 if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
580 _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); 572 _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
581 else 573 else
582 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | OBJECT_BModel, v17, 0); 574 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0);
583 return;; 575 return;
584 } 576 }
585 } 577 }
586 } 578 }
587 } 579 }
588 580
1289 //v5 = &pIndoor->pFaces[uFaceID]; 1281 //v5 = &pIndoor->pFaces[uFaceID];
1290 nodes[num_nodes].viewing_portal_id = -1; 1282 nodes[num_nodes].viewing_portal_id = -1;
1291 //v39 = &pIndoor->pFaces[uFaceID]; 1283 //v39 = &pIndoor->pFaces[uFaceID];
1292 1284
1293 auto pFace = &pIndoor->pFaces[uFaceID]; 1285 auto pFace = &pIndoor->pFaces[uFaceID];
1286 auto p = &nodes[node_id];
1294 1287
1295 if (!pFace->Portal()) 1288 if (!pFace->Portal())
1296 { 1289 {
1297 if (num_faces < 1000) 1290 if (num_faces < 1000)
1298 { 1291 {
1300 faces[num_faces++].uNodeID = node_id; 1293 faces[num_faces++].uNodeID = node_id;
1301 } 1294 }
1302 return; 1295 return;
1303 } 1296 }
1304 1297
1305 auto p = &nodes[node_id]; 1298
1306 //v6 = (int)((char *)this + 2252 * a2); 1299
1307 //a0 = v6;
1308 if (p->uFaceID == uFaceID) 1300 if (p->uFaceID == uFaceID)
1309 return; 1301 return;
1310 if (!node_id && 1302 if (!node_id &&
1311 pBLVRenderParams->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane 1303 pBLVRenderParams->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane
1312 pBLVRenderParams->vPartyPos.x <= pFace->pBounding.x2 + 16 && 1304 pBLVRenderParams->vPartyPos.x <= pFace->pBounding.x2 + 16 &&
1314 pBLVRenderParams->vPartyPos.y <= pFace->pBounding.y2 + 16 && 1306 pBLVRenderParams->vPartyPos.y <= pFace->pBounding.y2 + 16 &&
1315 pBLVRenderParams->vPartyPos.z >= pFace->pBounding.z1 - 16 && 1307 pBLVRenderParams->vPartyPos.z >= pFace->pBounding.z1 - 16 &&
1316 pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 ) 1308 pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 )
1317 { 1309 {
1318 if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x 1310 if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
1319 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y 1311 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
1320 + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane 1312 + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane
1321 { 1313 {
1322 v7 = pFace->uSectorID; 1314 v7 = pFace->uSectorID;
1323 if ( nodes[0].uSectorID == v7 ) // draw back sector 1315 if ( nodes[0].uSectorID == v7 ) // draw back sector
1324 v7 = pFace->uBackSectorID; 1316 v7 = pFace->uBackSectorID;
1325 nodes[num_nodes].uSectorID = v7; 1317 nodes[num_nodes].uSectorID = v7;
1326 nodes[num_nodes].uFaceID = uFaceID; 1318 nodes[num_nodes].uFaceID = uFaceID;
1327 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; 1319 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX;
1328 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; 1320 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ;
1329 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; 1321 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY;
1330 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; 1322 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW;
1331 nodes[num_nodes++].field_C._43F9E1(pBLVRenderParams->uViewportX, 1323 nodes[num_nodes].field_C._43F9E1(pBLVRenderParams->uViewportX,
1332 pBLVRenderParams->uViewportY, 1324 pBLVRenderParams->uViewportY,
1333 pBLVRenderParams->uViewportZ, 1325 pBLVRenderParams->uViewportZ,
1334 pBLVRenderParams->uViewportW); 1326 pBLVRenderParams->uViewportW);
1335 AddBspNodeToRenderList(num_nodes - 1); 1327 AddBspNodeToRenderList(++num_nodes - 1);
1336 return; 1328 return;
1337 } 1329 }
1338 //v5 = v39; 1330 //v5 = v39;
1339 //v6 = a0; 1331 //v6 = a0;
1340 } 1332 }
1366 if (face_min_screenspace_y > _50B9D8_screen_space_y[i]) 1358 if (face_min_screenspace_y > _50B9D8_screen_space_y[i])
1367 face_min_screenspace_y = _50B9D8_screen_space_y[i]; 1359 face_min_screenspace_y = _50B9D8_screen_space_y[i];
1368 if (face_max_screenspace_y < _50B9D8_screen_space_y[i]) 1360 if (face_max_screenspace_y < _50B9D8_screen_space_y[i])
1369 face_max_screenspace_y = _50B9D8_screen_space_y[i]; 1361 face_max_screenspace_y = _50B9D8_screen_space_y[i];
1370 } 1362 }
1371 //v10 = sub_423B5D(uFaceID); 1363
1372 //v34 = v10;
1373 //if ( v10 )
1374 //{
1375 /* v11 = _50BAC8_screen_space_x[0];
1376 v12 = _50B9D8_screen_space_y[0];
1377 a2 = _50BAC8_screen_space_x[0];
1378 v13 = 1;
1379 v37 = _50B9D8_screen_space_y[0];
1380 if ( v10 > 1 )
1381 {
1382 do
1383 {
1384 v14 = _50BAC8_screen_space_x[v13];
1385 if ( v14 < a2 )
1386 a2 = _50BAC8_screen_space_x[v13];
1387 if ( v14 > v11 )
1388 v11 = v14;
1389 v15 = _50B9D8_screen_space_y[v13];
1390 if ( v15 < v37 )
1391 v37 = _50B9D8_screen_space_y[v13];
1392 if ( v15 > v12 )
1393 v12 = _50B9D8_screen_space_y[v13];
1394 v10 = v34;
1395 ++v13;
1396 }
1397 while ( v13 < v34 );
1398 }
1399 //v16 = a0;
1400 if (v11 >= p->uViewportX &&
1401 a2 <= p->uViewportZ &&
1402 v12 >= p->uViewportY &&
1403 v37 <= p->uViewportW &&
1404 sub_424829(v10, &nodes[num_nodes].field_C, &p->field_C, uFaceID))*/
1405 if (face_max_screenspace_x >= p->uViewportX && 1364 if (face_max_screenspace_x >= p->uViewportX &&
1406 face_min_screenspace_x <= p->uViewportZ && 1365 face_min_screenspace_x <= p->uViewportZ &&
1407 face_max_screenspace_y >= p->uViewportY && 1366 face_max_screenspace_y >= p->uViewportY &&
1408 face_min_screenspace_y <= p->uViewportW && 1367 face_min_screenspace_y <= p->uViewportW &&
1409 sub_424829(num_vertices, &nodes[num_nodes].field_C, &p->field_C, uFaceID)) 1368 sub_424829(num_vertices, &nodes[num_nodes].field_C, &p->field_C, uFaceID))