From 381e53017de53a2a3f66ba96353bb0f3782c31ff Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 29 May 2020 00:44:13 +0200 Subject: [PATCH] - some hackery to make the camera textures in DN3D work again. They depend on a deleted texture not writing to the depth buffer, but other parts in the engine like ROR surfaces depend on them writing a proper depth buffer value, so for now there is a global variable that allows to exclude a single tile from ever getting rendered. --- source/build/include/build.h | 1 + source/build/src/polymost.cpp | 6 +++++- source/duke3d/src/game.cpp | 2 ++ source/glbackend/gl_texture.cpp | 3 ++- source/rr/src/game.cpp | 3 +++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 33bfa7d66..76113d36d 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1204,6 +1204,7 @@ int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos, # include "polymost.h" #endif +extern int skiptile; static vec2_t const zerovec = { 0, 0 }; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 3a65158e3..7fb1f4457 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -20,6 +20,7 @@ Ken Silverman's official web site: http://www.advsys.net/ken #include "flatvertices.h" #include "palettecontainer.h" #include "texturemanager.h" +#include "gamecontrol.h" CVAR(Bool, hw_detailmapping, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, hw_glowmapping, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) @@ -314,9 +315,12 @@ static void polymost_updaterotmat(void) static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, int32_t method, const vec2_16_t& tilesiz); +// Hack for Duke's camera until I can find out why this behaves erratically. +int skiptile = -1; + static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32_t method, const vec2_16_t &tilesize) { - if (method == DAMETH_BACKFACECULL || + if (method == DAMETH_BACKFACECULL || globalpicnum == skiptile || #ifdef YAX_ENABLE g_nodraw || #endif diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index ed3ee558c..5642a2970 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -5740,6 +5740,8 @@ int GameInterface::app_main() tileDelete(MIRROR); + skiptile = W_FORCEFIELD + 1; + Gv_ResetSystemDefaults(); // called here to populate our fake tilesizx and tilesizy arrays presented to CON with sizes generated by dummytiles if (numplayers == 1 && boardfilename[0] != 0) diff --git a/source/glbackend/gl_texture.cpp b/source/glbackend/gl_texture.cpp index f739bdde8..52e765f05 100644 --- a/source/glbackend/gl_texture.cpp +++ b/source/glbackend/gl_texture.cpp @@ -91,7 +91,8 @@ FHardwareTexture* GLInstance::CreateIndexedTexture(FGameTexture* tex) FHardwareTexture* GLInstance::CreateTrueColorTexture(FGameTexture* tex, int palid, bool checkfulltransparency, bool rgb8bit) { - if (tex == TexMan.GameByIndex(0)) return nullptr; + if (tex == TexMan.GameByIndex(0)) + return nullptr; auto texbuffer = tex->GetTexture()->CreateTexBuffer(palid, checkfulltransparency? 0: CTF_ProcessData); // Check if the texture is fully transparent. When creating a brightmap such textures can be discarded. if (checkfulltransparency) diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 7eb8130b8..9220cfddd 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7130,6 +7130,9 @@ int GameInterface::app_main() G_PostLoadPalette(); tileDelete(MIRROR); + + skiptile = W_FORCEFIELD + 1; + if (RR) tileDelete(0); if (RRRA)