From 07776b44cb9e5a7cc0ae4aa766aad49fa8e93153 Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 23 Jun 2017 01:25:15 +0200 Subject: [PATCH] % switch Z writing later to narrow down var scope more --- SilentPatchSA/SilentPatchSA.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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;