From 1e69da6ce57416b022ae5da42915a5d743e37f34 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 25 Mar 2017 13:46:35 +0100 Subject: [PATCH] Correct imshadows a bit --- SilentPatchSA/GeneralSA.cpp | 19 ++++++++++++------- SilentPatchSA/versionmeta.props | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/SilentPatchSA/GeneralSA.cpp b/SilentPatchSA/GeneralSA.cpp index 083fd5f..8895973 100644 --- a/SilentPatchSA/GeneralSA.cpp +++ b/SilentPatchSA/GeneralSA.cpp @@ -27,7 +27,7 @@ static void SetVehicleColour(unsigned char primaryColour, unsigned char secondar static void ResetEditableMaterials(std::pair* pData) { - for ( auto* i = pData; i->first; i++ ) + for ( auto* i = pData; i->first != nullptr; i++ ) *static_cast(i->first) = i->second; } @@ -38,13 +38,18 @@ RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic, void* pData) if ( RpAtomicGetFlags(pAtomic) & rpATOMICRENDER ) { RpGeometry* pGeometry = RpAtomicGetGeometry(pAtomic); - RwUInt32 geometryFlags = RpGeometryGetFlags(pGeometry); - RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT| - /*rpGEOMETRYNORMALS|*/rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2)); - - AtomicDefaultRenderCallBack(pAtomic); - RpGeometrySetFlags(pGeometry, geometryFlags); + if ( pGeometry->repEntry != nullptr ) // Only switch to optimized flags if already instanced so as not to break the instanced model + { + RwUInt32 geometryFlags = RpGeometryGetFlags(pGeometry); + pGeometry->flags &= ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT|rpGEOMETRYNORMALS|rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2); + pAtomic = AtomicDefaultRenderCallBack(pAtomic); + RpGeometrySetFlags(pGeometry, geometryFlags); + } + else + { + pAtomic = AtomicDefaultRenderCallBack(pAtomic); + } } return pAtomic; } diff --git a/SilentPatchSA/versionmeta.props b/SilentPatchSA/versionmeta.props index dc8efef..3a3ff7b 100644 --- a/SilentPatchSA/versionmeta.props +++ b/SilentPatchSA/versionmeta.props @@ -6,7 +6,7 @@ .asi SilentPatch for San Andreas 28 - 3 + 5 2014-2017