summaryrefslogtreecommitdiffstats
path: root/src/rw
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-07-29 13:56:06 +0200
committerSergeanur <s.anureev@yandex.ua>2020-07-29 13:56:06 +0200
commit581cb5edfa39a263bcbcdf3e37c608a5c7758849 (patch)
tree2b25ac08ac733d3a72bd52dfbdd3028c60ce4c37 /src/rw
parentsynch fakerw with reVC; update librw (diff)
downloadre3-581cb5edfa39a263bcbcdf3e37c608a5c7758849.tar
re3-581cb5edfa39a263bcbcdf3e37c608a5c7758849.tar.gz
re3-581cb5edfa39a263bcbcdf3e37c608a5c7758849.tar.bz2
re3-581cb5edfa39a263bcbcdf3e37c608a5c7758849.tar.lz
re3-581cb5edfa39a263bcbcdf3e37c608a5c7758849.tar.xz
re3-581cb5edfa39a263bcbcdf3e37c608a5c7758849.tar.zst
re3-581cb5edfa39a263bcbcdf3e37c608a5c7758849.zip
Diffstat (limited to '')
-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