comparison Engine/Graphics/Indoor.cpp @ 2562:b8a56afc6ba1

new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
author Ritor1
date Sun, 17 May 2015 22:42:13 +0600
parents b6140dfeac27
children 30eb6dcac768
comparison
equal deleted inserted replaced
2561:98057834c9a0 2562:b8a56afc6ba1
47 BLVRenderParams *pBLVRenderParams = new BLVRenderParams; 47 BLVRenderParams *pBLVRenderParams = new BLVRenderParams;
48 48
49 49
50 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null; 50 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null;
51 51
52 stru320 stru_F8AD28; // idb 52 LightsData Lights; // stru_F8AD28
53 stru337 stru_F81018; 53 stru337 stru_F81018;
54 BspRenderer_PortalViewportData stru_F8A590; 54 BspRenderer_PortalViewportData stru_F8A590;
55 BspRenderer *pBspRenderer = new BspRenderer; // idb 55 BspRenderer *pBspRenderer = new BspRenderer; // idb
56 stru141_actor_collision_object stru_721530; 56 stru141_actor_collision_object stru_721530;
57 std::array<stru352, 480> stru_F83B80; 57 std::array<stru352, 480> stru_F83B80;
444 (pEngine->pStru9Instance->_498377(pPortalBounding, 4, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) ) 444 (pEngine->pStru9Instance->_498377(pPortalBounding, 4, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
445 { 445 {
446 if (pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa, 446 if (pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa,
447 static_vertices_F7B628, pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa ) 447 static_vertices_F7B628, pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
448 { 448 {
449 a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel); 449 a4a = SHIWORD(Lights.uCurrentAmbientLightLevel);
450 v17 = (248 - (SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel) << 3)) 450 v17 = (248 - (SHIWORD(Lights.uCurrentAmbientLightLevel) << 3))
451 | (((248 - (SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel) << 3)) 451 | (((248 - (SHIWORD(Lights.uCurrentAmbientLightLevel) << 3))
452 | ((248 - (SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel) << 3)) << 8)) << 8); 452 | ((248 - (SHIWORD(Lights.uCurrentAmbientLightLevel) << 3)) << 8)) << 8);
453 sub_4B0E07(uFaceID); 453 sub_4B0E07(uFaceID);
454 pEngine->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID); 454 pEngine->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
455 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID); 455 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
456 pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); 456 pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &Lights);
457 pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0); 457 pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
458 pEngine->pLightmapBuilder->std__vector_000004_size = 0; 458 pEngine->pLightmapBuilder->StationaryLightsCount = 0;
459 if (stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0) 459 if (Lights.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0)
460 { 460 {
461 stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x; 461 stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x;
462 stru_F7B60C.polygonType = pFace->uPolygonType; 462 stru_F7B60C.polygonType = pFace->uPolygonType;
463 stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y; 463 stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y;
464 stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z; 464 stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z;
465 stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist; 465 stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist;
466 } 466 }
467 467
468 if (stru_F8AD28.uNumLightsApplied > 0 && !pFace->Indoor_sky()) //for torchlight(для света факелов) 468 if (Lights.uNumLightsApplied > 0 && !pFace->Indoor_sky()) //for torchlight(для света факелов)
469 pEngine->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0); 469 pEngine->pLightmapBuilder->ApplyLights(&Lights, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0);
470 470
471 if (pDecalBuilder->uNumDecals > 0)//отрисовка пятен крови 471 if (pDecalBuilder->uNumDecals > 0)//отрисовка пятен крови
472 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID); 472 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID);
473 473
474 if (pFace->Fluid()) 474 if (pFace->Fluid())
510 //----- (004B0E07) -------------------------------------------------------- 510 //----- (004B0E07) --------------------------------------------------------
511 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) 511 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID)
512 { 512 {
513 unsigned int result; // eax@1 513 unsigned int result; // eax@1
514 514
515 stru_F8AD28.pDeltaUV[0] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaU; 515 Lights.pDeltaUV[0] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaU;
516 stru_F8AD28.pDeltaUV[1] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaV; 516 Lights.pDeltaUV[1] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaV;
517 result = GetTickCount() >> 3; 517 result = GetTickCount() >> 3;
518 if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_DIAGONAL ) 518 if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_DIAGONAL )
519 stru_F8AD28.pDeltaUV[1] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1; 519 Lights.pDeltaUV[1] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1;
520 else 520 else
521 { 521 {
522 if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_VERTICAL ) 522 if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_VERTICAL )
523 stru_F8AD28.pDeltaUV[1] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1; 523 Lights.pDeltaUV[1] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1;
524 } 524 }
525 if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_HORIZONTAL ) 525 if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_HORIZONTAL )
526 stru_F8AD28.pDeltaUV[0] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1; 526 Lights.pDeltaUV[0] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1;
527 else 527 else
528 { 528 {
529 if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_DONT_CACHE_TEXTURE ) 529 if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_DONT_CACHE_TEXTURE )
530 stru_F8AD28.pDeltaUV[0] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1; 530 Lights.pDeltaUV[0] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1;
531 } 531 }
532 return result; 532 return result;
533 } 533 }
534 534
535 //----- (004B0EA8) -------------------------------------------------------- 535 //----- (004B0EA8) --------------------------------------------------------
2578 int v59; // [sp+4Ch] [bp-14h]@8 2578 int v59; // [sp+4Ch] [bp-14h]@8
2579 unsigned int uFaceID; // [sp+50h] [bp-10h]@6 2579 unsigned int uFaceID; // [sp+50h] [bp-10h]@6
2580 int v61; // [sp+54h] [bp-Ch]@14 2580 int v61; // [sp+54h] [bp-Ch]@14
2581 int v62; // [sp+58h] [bp-8h]@6 2581 int v62; // [sp+58h] [bp-8h]@6
2582 unsigned int actor_id; // [sp+5Ch] [bp-4h]@1 2582 unsigned int actor_id; // [sp+5Ch] [bp-4h]@1
2583
2584 if(no_actors)
2585 uNumActors = 0;
2583 2586
2584 for ( actor_id = 0; actor_id < uNumActors; actor_id++ ) 2587 for ( actor_id = 0; actor_id < uNumActors; actor_id++ )
2585 { 2588 {
2586 if ( pActors[actor_id].uAIState == Removed || pActors[actor_id].uAIState == Disabled 2589 if ( pActors[actor_id].uAIState == Removed || pActors[actor_id].uAIState == Disabled
2587 || pActors[actor_id].uAIState == Summoned || !pActors[actor_id].uMovementSpeed ) 2590 || pActors[actor_id].uAIState == Summoned || !pActors[actor_id].uMovementSpeed )
3105 } 3108 }
3106 } 3109 }
3107 3110
3108 // INDOOR initialize actors 3111 // INDOOR initialize actors
3109 v38 = 0; 3112 v38 = 0;
3113
3110 for (uint i = 0; i < uNumActors; ++i) 3114 for (uint i = 0; i < uNumActors; ++i)
3111 { 3115 {
3112 if (pActors[i].uAttributes & ACTOR_UNKNOW7) 3116 if (pActors[i].uAttributes & ACTOR_UNKNOW7)
3113 { 3117 {
3114 if ( !map_id ) 3118 if ( !map_id )