static shadows fix, cutscene shadows switches

This commit is contained in:
Fire-Head 2020-08-08 15:06:45 +03:00
parent 7d8ffa9ebd
commit d2e090317f
4 changed files with 23 additions and 15 deletions

View file

@ -232,6 +232,9 @@ enum Config {
// #define PC_WATER // #define PC_WATER
#define WATER_CHEATS #define WATER_CHEATS
//#define USE_CUTSCENE_SHADOW_FOR_PED
#define DISABLE_CUTSCENE_SHADOWS
// Pad // Pad
#if !defined(RW_GL3) && defined(_WIN32) #if !defined(RW_GL3) && defined(_WIN32)
#define XINPUT #define XINPUT

View file

@ -147,7 +147,7 @@ void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((
// --MIAMI: Done // --MIAMI: Done
CPed::~CPed(void) CPed::~CPed(void)
{ {
#if 1 #ifdef USE_CUTSCENE_SHADOW_FOR_PED
if ( m_pRTShadow ) delete m_pRTShadow; if ( m_pRTShadow ) delete m_pRTShadow;
#endif #endif
CWorld::Remove(this); CWorld::Remove(this);
@ -207,8 +207,8 @@ CPed::FlagToDestroyWhenNextProcessed(void)
CPed::CPed(uint32 pedType) : m_pedIK(this) CPed::CPed(uint32 pedType) : m_pedIK(this)
{ {
#if 1 #ifdef USE_CUTSCENE_SHADOW_FOR_PED
m_pRTShadow = NULL; m_pRTShadow = nil;
#endif #endif
m_type = ENTITY_TYPE_PED; m_type = ENTITY_TYPE_PED;
bPedPhysics = true; bPedPhysics = true;
@ -2795,7 +2795,7 @@ CPed::SetModelIndex(uint32 mi)
if (IsClumpSkinned(GetClump())) // condition isn't there in VC if (IsClumpSkinned(GetClump())) // condition isn't there in VC
UpdateRpHAnim(); UpdateRpHAnim();
#endif #endif
#if 1 #ifdef USE_CUTSCENE_SHADOW_FOR_PED
if (!m_pRTShadow) if (!m_pRTShadow)
{ {
m_pRTShadow = new CCutsceneShadow; m_pRTShadow = new CCutsceneShadow;

View file

@ -363,7 +363,7 @@ class CVehicle;
class CPed : public CPhysical class CPed : public CPhysical
{ {
public: public:
#if 1 #ifdef USE_CUTSCENE_SHADOW_FOR_PED
class CCutsceneShadow *m_pRTShadow; class CCutsceneShadow *m_pRTShadow;
#endif #endif
// 0x128 // 0x128

View file

@ -236,9 +236,9 @@ CShadows::StoreStaticShadow(uint32 nID, uint8 ShadowType, RwTexture *pTexture, C
float fDistToCamSqr = (*pPosn - TheCamera.GetPosition()).MagnitudeSqr2D(); float fDistToCamSqr = (*pPosn - TheCamera.GetPosition()).MagnitudeSqr2D();
if ( SQR(fDrawDistance) > fDistToCamSqr || fDistToCamSqr == 0.0f ) if ( SQR(fDrawDistance) > fDistToCamSqr || fDrawDistance == 0.0f )
{ {
if ( fDistToCamSqr != 0.0f ) if ( fDrawDistance != 0.0f )
{ {
float fDistToCam = Sqrt(fDistToCamSqr); float fDistToCam = Sqrt(fDistToCamSqr);
@ -277,8 +277,10 @@ CShadows::StoreStaticShadow(uint32 nID, uint8 ShadowType, RwTexture *pTexture, C
aStaticShadows[nSlot].m_fScale = fScale; aStaticShadows[nSlot].m_fScale = fScale;
aStaticShadows[nSlot].m_bTemp = bTempShadow; aStaticShadows[nSlot].m_bTemp = bTempShadow;
aStaticShadows[nSlot].m_nTimeCreated = CTimer::GetTimeInMilliseconds(); aStaticShadows[nSlot].m_nTimeCreated = CTimer::GetTimeInMilliseconds();
return true;
} }
else if ( Abs(pPosn->x - aStaticShadows[nSlot].m_vecPosn.x) < 0.05f else if ( Abs(pPosn->x - aStaticShadows[nSlot].m_vecPosn.x) < 0.05f
&& Abs(pPosn->y - aStaticShadows[nSlot].m_vecPosn.y) < 0.05f && Abs(pPosn->y - aStaticShadows[nSlot].m_vecPosn.y) < 0.05f
&& Abs(pPosn->z - aStaticShadows[nSlot].m_vecPosn.z) < 2.0f && Abs(pPosn->z - aStaticShadows[nSlot].m_vecPosn.z) < 2.0f
@ -299,7 +301,7 @@ CShadows::StoreStaticShadow(uint32 nID, uint8 ShadowType, RwTexture *pTexture, C
aStaticShadows[nSlot].m_bTemp = bTempShadow; aStaticShadows[nSlot].m_bTemp = bTempShadow;
aStaticShadows[nSlot].m_nTimeCreated = CTimer::GetTimeInMilliseconds(); aStaticShadows[nSlot].m_nTimeCreated = CTimer::GetTimeInMilliseconds();
return false; return true;
} }
else else
{ {
@ -585,7 +587,7 @@ CShadows::StoreShadowForVehicle(CVehicle *pCar, VEH_SHD_TYPE type)
CarPos.x -= pCar->GetForward().x * (((fVehicleHeight/2) - pCar->GetColModel()->boundingBox.max.y)*size); CarPos.x -= pCar->GetForward().x * (((fVehicleHeight/2) - pCar->GetColModel()->boundingBox.max.y)*size);
CarPos.y -= pCar->GetForward().y * (((fVehicleHeight/2) - pCar->GetColModel()->boundingBox.max.y)*size); CarPos.y -= pCar->GetForward().y * (((fVehicleHeight/2) - pCar->GetColModel()->boundingBox.max.y)*size);
RwTexture *tex; RwTexture *tex = gpShadowCarTex;
switch ( type ) switch ( type )
{ {
case VEH_SHD_TYPE_BIKE: case VEH_SHD_TYPE_BIKE:
@ -625,8 +627,8 @@ CShadows::StoreShadowForVehicle(CVehicle *pCar, VEH_SHD_TYPE type)
float frontx = pCar->GetForward().x; float frontx = pCar->GetForward().x;
float fronty = pCar->GetForward().y; float fronty = pCar->GetForward().y;
float sidex = pCar->GetRight().x; float sidex = pCar->GetRight().x;
float sidey = pCar->GetRight().y; float sidey = pCar->GetRight().y;
switch ( type ) switch ( type )
{ {
@ -769,7 +771,7 @@ CShadows::StoreCarLightShadow(CAutomobile *pCar, int32 nID, RwTexture *pTexture,
} }
#if 1 #ifdef USE_CUTSCENE_SHADOW_FOR_PED
void void
StoreShadowForCutscenePedObject(CPed *pObject, float fDisplacementX, float fDisplacementY, StoreShadowForCutscenePedObject(CPed *pObject, float fDisplacementX, float fDisplacementY,
float fFrontX, float fFrontY, float fSideX, float fSideY) float fFrontX, float fFrontY, float fSideX, float fSideY)
@ -853,7 +855,7 @@ CShadows::StoreShadowForPed(CPed *pPed, float fDisplacementX, float fDisplacemen
{ {
if ( CTimeCycle::GetShadowStrength() != 0 ) if ( CTimeCycle::GetShadowStrength() != 0 )
{ {
#if 1 #ifdef USE_CUTSCENE_SHADOW_FOR_PED
CCutsceneShadow *pShadow = pPed->m_pRTShadow; CCutsceneShadow *pShadow = pPed->m_pRTShadow;
if (pShadow) if (pShadow)
@ -864,7 +866,7 @@ CShadows::StoreShadowForPed(CPed *pPed, float fDisplacementX, float fDisplacemen
} }
return; return;
#endif #endif
StoreShadowForPedObject(pPed, StoreShadowForPedObject(pPed,
fDisplacementX, fDisplacementY, fDisplacementX, fDisplacementY,
@ -920,6 +922,9 @@ void
CShadows::StoreShadowForCutscenePedObject(CCutsceneObject *pObject, float fDisplacementX, float fDisplacementY, CShadows::StoreShadowForCutscenePedObject(CCutsceneObject *pObject, float fDisplacementX, float fDisplacementY,
float fFrontX, float fFrontY, float fSideX, float fSideY) float fFrontX, float fFrontY, float fSideX, float fSideY)
{ {
#ifdef DISABLE_CUTSCENE_SHADOWS
return;
#endif
ASSERT(pObject != nil); ASSERT(pObject != nil);
CCutsceneShadow *shadow = pObject->m_pShadow; CCutsceneShadow *shadow = pObject->m_pShadow;