Move TSPR_EXTRA_MDHACK from extra to clipdist

git-svn-id: https://svn.eduke32.com/eduke32@8522 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/src/mdsprite.cpp
#	source/build/src/polymer.cpp
This commit is contained in:
hendricks266 2019-12-26 06:28:03 +00:00 committed by Christoph Oelckers
parent 6465feb438
commit 6a5906833b
4 changed files with 11 additions and 7 deletions

View file

@ -365,7 +365,11 @@ typedef struct {
#define SPREXT_TSPRACCESS 16
#define SPREXT_TEMPINVISIBLE 32
#define TSPR_EXTRA_MDHACK 1
// using the clipdist field
enum
{
TSPR_FLAGS_MDHACK = 1u<<0u,
};
EXTERN int32_t guniqhudid;
EXTERN int32_t spritesortcnt;

View file

@ -1584,11 +1584,11 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; }
//------------
// TSPR_EXTRA_MDHACK is an ugly hack in game.c:G_DoSpriteAnimations() telling md2sprite
// TSPR_FLAGS_MDHACK is an ugly hack in game.c:G_DoSpriteAnimations() telling md2sprite
// to use Z-buffer hacks to hide overdraw problems with the flat-tsprite-on-floor shadows,
// also disabling detail, glow, normal, and specular maps.
if (tspr->extra&TSPR_EXTRA_MDHACK)
if (tspr->clipdist & TSPR_FLAGS_MDHACK)
{
double f = (double) (tspr->owner + 1) * (std::numeric_limits<double>::epsilon() * 8.0);
if (f != 0.0) f *= 1.0/(double) (sepldist(globalposx - tspr->x, globalposy - tspr->y)>>5);
@ -1640,7 +1640,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
if (sext->offset.y) // Compare with SCREEN_FACTORS above
a0.y = (float) sext->offset.y * f;
if ((sext->offset.z) && !(tspr->extra&TSPR_EXTRA_MDHACK)) // Compare with SCREEN_FACTORS above
if ((sext->offset.z) && !(tspr->clipdist & TSPR_FLAGS_MDHACK)) // Compare with SCREEN_FACTORS above
a0.z = (float)sext->offset.z / (gxyaspect * fxdimen * (65536.f/128.f) * (m0.z+m1.z));
k0 = (float)sintable[(sext->pitch+512)&2047] * (1.f/16384.f);
@ -1720,7 +1720,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
float detscale = 1.f;
// The data lookup here is one incredible mess. Thanks to whoever cooked this up... :(
if (!(tspr->extra&TSPR_EXTRA_MDHACK))
if (!(tspr->clipdist & TSPR_FLAGS_MDHACK))
{
det = tex = hw_detailmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, DETAILPAL, surfi, nullptr) : nullptr;
if (det)

View file

@ -1051,7 +1051,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
f = (65536.f*512.f) / ((float)xdimen*viewingrange);
g = 32.f / ((float)xdimen*gxyaspect);
int const shadowHack = !!(tspr->extra&TSPR_EXTRA_MDHACK);
int const shadowHack = !!(tspr->clipdist & TSPR_FLAGS_MDHACK);
m0.y *= f; a0.y = (((float)(tspr->x-globalposx)) * (1.f/1024.f) + a0.y) * f;
m0.x *=-f; a0.x = (((float)(tspr->y-globalposy)) * -(1.f/1024.f) + a0.x) * -f;

View file

@ -4168,7 +4168,7 @@ skip:
tsprShadow->yrepeat = 0;
// 512:trans reverse
//1024:tell MD2SPRITE.C to use Z-buffer hacks to hide overdraw issues
tsprShadow->extra |= TSPR_EXTRA_MDHACK;
tsprShadow->clipdist |= TSPR_FLAGS_MDHACK;
tsprShadow->cstat |= 512;
}
else