summaryrefslogtreecommitdiffstats
path: root/src/rw
diff options
context:
space:
mode:
Diffstat (limited to 'src/rw')
-rw-r--r--src/rw/RwHelper.cpp34
-rw-r--r--src/rw/RwHelper.h10
2 files changed, 43 insertions, 1 deletions
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 3503e27d..bf70c8dc 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -611,3 +611,37 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }
#endif
+
+#if defined(FIX_BUGS) && defined(GTA_PC)
+RwUInt32 saved_alphafunc, saved_alpharef;
+
+void
+SetAlphaTest(RwUInt32 alpharef)
+{
+#ifdef LIBRW
+ saved_alphafunc = rw::GetRenderState(rw::ALPHATESTFUNC);
+ saved_alpharef = rw::GetRenderState(rw::ALPHATESTREF);
+
+ rw::SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL);
+ rw::SetRenderState(rw::ALPHATESTREF, 0);
+#else
+ RwD3D8GetRenderState(D3DRS_ALPHAFUNC, &saved_alphafunc);
+ RwD3D8GetRenderState(D3DRS_ALPHAREF, &saved_alpharef);
+
+ RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
+ RwD3D8SetRenderState(D3DRS_ALPHAREF, alpharef);
+#endif
+}
+
+void
+RestoreAlphaTest()
+{
+#ifdef LIBRW
+ rw::SetRenderState(rw::ALPHATESTFUNC, saved_alphafunc);
+ rw::SetRenderState(rw::ALPHATESTREF, saved_alpharef);
+#else
+ RwD3D8SetRenderState(D3DRS_ALPHAFUNC, saved_alphafunc);
+ RwD3D8SetRenderState(D3DRS_ALPHAREF, saved_alpharef);
+#endif
+}
+#endif
diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h
index a751ee39..eceaee07 100644
--- a/src/rw/RwHelper.h
+++ b/src/rw/RwHelper.h
@@ -52,4 +52,12 @@ RwCamera *CameraCreate(RwInt32 width,
void _TexturePoolsInitialise();
-void _TexturePoolsShutdown(); \ No newline at end of file
+void _TexturePoolsShutdown();
+
+#if defined(FIX_BUGS) && defined (GTA_PC)
+void SetAlphaTest(RwUInt32 alpharef);
+void RestoreAlphaTest();
+#else
+#define SetAlphaTest(a) (0)
+#define RestoreAlphaTest() (0)
+#endif \ No newline at end of file