summaryrefslogtreecommitdiffstats
path: root/src/rw/RwHelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/rw/RwHelper.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 3503e27d..f568532a 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -11,7 +11,11 @@
RtCharset *debugCharset;
#endif
-bool gPS2alphaTest = 1;
+#ifdef PS2_ALPHA_TEST
+bool gPS2alphaTest = true;
+#else
+bool gPS2alphaTest = false;
+#endif
#ifndef FINAL
static bool charsetOpen;
@@ -611,3 +615,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 \ No newline at end of file