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