engine: give sprite cstat 1024 a marco name, CSTAT_SPRITE_MDHACK.

git-svn-id: https://svn.eduke32.com/eduke32@3584 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-03-21 10:19:32 +00:00
parent ba6ad362bc
commit 182121a0aa
4 changed files with 33 additions and 36 deletions

View file

@ -301,7 +301,7 @@ typedef struct
// bit 7: 1 = Real centered centering, 0 = foot center "C"
// bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1) "H"
// bit 9: 1 = Transluscence reversing, 0 = normal "T"
// bit 10: reserved (in use by a renderer hack)
// bit 10: reserved (in use by a renderer hack, see CSTAT_SPRITE_MDHACK)
// bit 11: 1 = determine shade based only on its own shade member (see CON's spritenoshade command)
// bit 12: reserved
// bit 13: 1 = does not cast shadow
@ -358,6 +358,8 @@ typedef struct {
#define SPREXT_TSPRACCESS 16
#define SPREXT_TEMPINVISIBLE 32
#define CSTAT_SPRITE_MDHACK 1024
EXTERN int32_t guniqhudid;
EXTERN int32_t spritesortcnt;

View file

@ -2149,9 +2149,10 @@ static int32_t md3draw(md3model_t *m, const spritetype *tspr)
if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; }
//------------
//bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE
//to use Z-buffer hacks to hide overdraw problems with the shadows
if (tspr->cstat&1024)
// Bit 10 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.
if (tspr->cstat&CSTAT_SPRITE_MDHACK)
{
bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
bglDepthRange(0.0,0.9999);
@ -2217,7 +2218,7 @@ static int32_t md3draw(md3model_t *m, const spritetype *tspr)
a0.y = (float)(spriteext[tspr->owner].yoff / (2560 * (m0.x+m1.x)));
else
a0.y = 0;
if ((spriteext[tspr->owner].zoff) && !(tspr->cstat&1024))
if ((spriteext[tspr->owner].zoff) && !(tspr->cstat&CSTAT_SPRITE_MDHACK))
a0.z = (float)(spriteext[tspr->owner].zoff / (655360 * (m0.z+m1.z)));
else
a0.z = 0;
@ -2296,7 +2297,7 @@ static int32_t md3draw(md3model_t *m, const spritetype *tspr)
//i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,surfi); //hack for testing multiple surfaces per MD3
bglBindTexture(GL_TEXTURE_2D, i);
if (r_detailmapping && !(tspr->cstat&1024))
if (r_detailmapping && !(tspr->cstat&CSTAT_SPRITE_MDHACK))
i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi);
else
i = 0;
@ -2336,7 +2337,7 @@ static int32_t md3draw(md3model_t *m, const spritetype *tspr)
bglMatrixMode(GL_MODELVIEW);
}
if (r_glowmapping && !(tspr->cstat&1024))
if (r_glowmapping && !(tspr->cstat&CSTAT_SPRITE_MDHACK))
i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi);
else
i = 0;
@ -2532,7 +2533,7 @@ static int32_t md3draw(md3model_t *m, const spritetype *tspr)
if (m->usesalpha) bglDisable(GL_ALPHA_TEST);
bglDisable(GL_CULL_FACE);
bglPopAttrib();
if (tspr->cstat&1024)
if (tspr->cstat&CSTAT_SPRITE_MDHACK)
{
bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
bglDepthRange(0.0,0.99999);
@ -3330,10 +3331,7 @@ int32_t voxdraw(voxmodel_t *m, const spritetype *tspr)
//Mirrors
if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; }
//------------
//bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE
//to use Z-buffer hacks to hide overdraw problems with the shadows
if (tspr->cstat&1024)
if (tspr->cstat&CSTAT_SPRITE_MDHACK)
{
bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
bglDepthRange(0.0,0.9999);
@ -3408,7 +3406,7 @@ int32_t voxdraw(voxmodel_t *m, const spritetype *tspr)
//------------
bglDisable(GL_CULL_FACE);
bglPopAttrib();
if (tspr->cstat&1024)
if (tspr->cstat&CSTAT_SPRITE_MDHACK)
{
bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
bglDepthRange(0.0,0.99999);

View file

@ -4279,7 +4279,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
if (!mdspritematerial.diffusemap)
continue;
if (!(tspr->cstat&1024))
if (!(tspr->cstat&CSTAT_SPRITE_MDHACK))
{
mdspritematerial.detailmap =
mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi);
@ -4291,13 +4291,13 @@ static void polymer_drawmdsprite(spritetype *tspr)
mdspritematerial.detailscale[0] = mdspritematerial.detailscale[1] = sk->param;
}
if (!(tspr->cstat&1024))
if (!(tspr->cstat&CSTAT_SPRITE_MDHACK))
{
mdspritematerial.specmap =
mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,SPECULARPAL,surfi);
}
if (!(tspr->cstat&1024))
if (!(tspr->cstat&CSTAT_SPRITE_MDHACK))
{
mdspritematerial.normalmap =
mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,NORMALPAL,surfi);
@ -4311,7 +4311,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
}
}
if (!(tspr->cstat&1024))
if (!(tspr->cstat&CSTAT_SPRITE_MDHACK))
{
mdspritematerial.glowmap =
mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi);

View file

@ -6933,29 +6933,26 @@ skip:
newt->z = daz;
newt->pal = 4;
/*
xrep = newt->xrepeat;// - (klabs(daz-t->z)>>11);
newt->xrepeat = xrep;
yrep = newt->yrepeat;// - (klabs(daz-t->z)>>11);
newt->yrepeat = yrep;
*/
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0)
if (getrendermode() >= REND_POLYMOST)
{
newt->yrepeat = 0;
// 512:trans reverse
//1024:tell MD2SPRITE.C to use Z-buffer hacks to hide overdraw issues
newt->cstat |= (512+1024);
}
else if (getrendermode() >= REND_POLYMOST)
{
int32_t ii;
if (usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0)
{
newt->yrepeat = 0;
// 512:trans reverse
//1024:tell MD2SPRITE.C to use Z-buffer hacks to hide overdraw issues
newt->cstat |= (512+CSTAT_SPRITE_MDHACK);
}
else
{
int32_t ii;
ii = getangle(newt->x-g_player[screenpeek].ps->pos.x,
newt->y-g_player[screenpeek].ps->pos.y);
ii = getangle(newt->x-g_player[screenpeek].ps->pos.x,
newt->y-g_player[screenpeek].ps->pos.y);
newt->x += sintable[(ii+2560)&2047]>>9;
newt->y += sintable[(ii+2048)&2047]>>9;
newt->x += sintable[(ii+2560)&2047]>>9;
newt->y += sintable[(ii+2048)&2047]>>9;
}
}
#endif
spritesortcnt++;