diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index 4a5dc0f..83b6873 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -405,11 +405,9 @@ RpAtomic* TwoPassAlphaRender_Silent(RpAtomic* atomic) return AtomicDefaultRenderCallBack(atomic); int nPushedAlpha, nAlphaFunction; - int nZWrite; int nAlphaBlending; RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha); - RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite); RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending); RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTION, &nAlphaFunction); @@ -422,17 +420,21 @@ RpAtomic* TwoPassAlphaRender_Silent(RpAtomic* atomic) if ( atomic != nullptr ) { + int nZWrite; + RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite); + // 2nd pass RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(TRUE)); RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(rwALPHATESTFUNCTIONLESS)); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE); atomic = AtomicDefaultRenderCallBack(atomic); + + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast(nZWrite)); } RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(nPushedAlpha)); RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(nAlphaFunction)); - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast(nZWrite)); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending)); return atomic;