diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 6f57c90f2..c0ffe7e42 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -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; diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index be6582439..ec53a7c49 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -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); diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 357513ea9..2bdf09f4b 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -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); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index e0ce58264..cfaedf747 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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++;