From bad17f29e0567c25e409258b851125d471cc2f20 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 22 May 2020 16:27:45 +0200 Subject: [PATCH] - made some tweaks to the anti-z-fighting code in Polymost. It now picks the minimum of the current formula and the one from before June 2017 - the current one was causing problems with sprites in the distance so now the old one is used as an upper bound. --- source/build/src/polymost.cpp | 14 +++++++++----- source/core/initfs.cpp | 2 -- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 607f57341..cc10711af 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -3786,8 +3786,11 @@ static int32_t polymost_lintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y return rv; } -#define TSPR_OFFSET_FACTOR .000008f -#define TSPR_OFFSET(tspr) ((TSPR_OFFSET_FACTOR + ((tspr->owner != -1 ? tspr->owner & 63 : 1) * TSPR_OFFSET_FACTOR)) * (float)sepdist(globalposx - tspr->x, globalposy - tspr->y, globalposz - tspr->z) * 0.025f) +#define TSPR_OFFSET_FACTOR .0002f +#define TSPR_OFFSET(tspr) (TSPR_OFFSET_FACTOR + ((tspr->owner != -1 ? tspr->owner & 63 : 0) * TSPR_OFFSET_FACTOR)) + +#define TSPR_OFFSET_FACTOR2 .000008f +#define TSPR_OFFSET2(tspr) ((TSPR_OFFSET_FACTOR + ((tspr->owner != -1 ? tspr->owner & 63 : 1) * TSPR_OFFSET_FACTOR)) * (float)sepdist(globalposx - tspr->x, globalposy - tspr->y, globalposz - tspr->z) * 0.025f) void polymost_drawsprite(int32_t snum) @@ -3905,10 +3908,11 @@ void polymost_drawsprite(int32_t snum) int const ang = (getangle(tspr->x - globalposx, tspr->y - globalposy) + 1024) & 2047; - float const foffs = TSPR_OFFSET(tspr); + float foffs = TSPR_OFFSET(tspr); + float foffs2 = TSPR_OFFSET(tspr); + if (fabs(foffs2) < fabs(foffs)) foffs = foffs2; - vec2f_t const offs = { (float) (sintable[(ang + 512) & 2047] >> 6) * foffs, - (float) (sintable[(ang) & 2047] >> 6) * foffs }; + vec2f_t const offs = { (float)(sintable[(ang + 512) & 2047] >> 6)* foffs, (float) (sintable[(ang) & 2047] >> 6) * foffs }; vec2f_t s0 = { (float)(tspr->x - globalposx) + offs.x, (float)(tspr->y - globalposy) + offs.y}; diff --git a/source/core/initfs.cpp b/source/core/initfs.cpp index ba7debaf5..0712adda6 100644 --- a/source/core/initfs.cpp +++ b/source/core/initfs.cpp @@ -322,8 +322,6 @@ void InitFileSystem(TArray& groups) i--; } - const char* key; - const char* value; D_AddConfigFiles(Files, "Global.Autoload", "*.grp", GameConfig); long len;