Commit fca2cbb9 authored by Dino Bollinger's avatar Dino Bollinger
Browse files

Engine: Add new tsprite flag TSPR_FLAGS_NO_GLOW (32, hex: 0x20)

Prevents the engine from rendering a glowmap on the sprite.
Applied to spriteshadows in Duke3D.
parent 02503e95
......@@ -594,6 +594,7 @@ enum
TSPR_FLAGS_NO_SHADOW = 1u<<2u,
TSPR_FLAGS_INVISIBLE_WITH_SHADOW = 1u<<3u,
TSPR_FLAGS_SLOPE_SPRITE = 1u<<4u,
TSPR_FLAGS_NO_GLOW = 1u<<5u,
};
EXTERN int32_t guniqhudid;
......
......@@ -1496,7 +1496,7 @@ static int32_t viewingrangerecip;
static int8_t globalxshift, globalyshift;
static int32_t globalxpanning, globalypanning;
int32_t globalshade, globalorientation;
int32_t globalshade, globalorientation, globalclipdist;
static int16_t globalshiftval;
#ifdef HIGH_PRECISION_SPRITE
static int64_t globalzd;
......
......@@ -178,6 +178,7 @@ extern int32_t globvis2, globalvisibility2, globalhisibility2, globalpisibility2
extern int32_t globvis, globalvisibility;
extern int32_t xyaspect;
extern int32_t globalshade;
extern int32_t globalclipdist;
extern int16_t globalpicnum;
extern int32_t globalorientation;
......
......@@ -2298,7 +2298,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
glMatrixMode(GL_MODELVIEW);
}
i = r_glowmapping ? mdloadskin((md2model_t *) m, skinNum, GLOWPAL, surfi) : 0;
i = (r_glowmapping & !(tspr->clipdist & TSPR_FLAGS_NO_GLOW)) ? mdloadskin((md2model_t *) m, skinNum, GLOWPAL, surfi) : 0;
if (i)
{
......
......@@ -3315,7 +3315,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
}
// glow texture
if (r_glowmapping)
if (r_glowmapping && !(globalclipdist & TSPR_FLAGS_NO_GLOW))
{
pthtyp *glowpth = NULL;
......@@ -5188,6 +5188,8 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i
polymost_setClamp((npot || xpanning != 0) ? 0 : 2);
int picnumbak = globalpicnum;
int32_t const ogclipdist = globalclipdist;
globalclipdist = 0;
ti = globalpicnum;
o.y = fviewingrange/(ghalfx*256.f); o.z = 1.f/o.y;
......@@ -5319,6 +5321,7 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i
while (ti >= 0);
globalpicnum = picnumbak;
globalclipdist = ogclipdist;
polymost_setClamp(0);
......@@ -5450,6 +5453,7 @@ static void polymost_drawalls(int32_t const bunch)
globalshade = sec->floorshade;
globalpal = sec->floorpal;
globalorientation = sec->floorstat;
globalclipdist = 0;
globvis = (sector[sectnum].visibility != 0) ?
mulscale4(globalcisibility, (uint8_t)(sector[sectnum].visibility + 16)) :
globalcisibility;
......@@ -5868,6 +5872,7 @@ static void polymost_drawalls(int32_t const bunch)
globalshade = sec->ceilingshade;
globalpal = sec->ceilingpal;
globalorientation = sec->ceilingstat;
globalclipdist = 0;
globvis = (sector[sectnum].visibility != 0) ?
mulscale4(globalcisibility, (uint8_t)(sector[sectnum].visibility + 16)) :
globalcisibility;
......@@ -6343,6 +6348,7 @@ static void polymost_drawalls(int32_t const bunch)
doeditorcheck = 1;
}
globalpicnum = wal->picnum; globalshade = wal->shade; globalpal = (int32_t)((uint8_t)wal->pal);
globalclipdist = 0;
globvis = globalvisibility;
if (sector[sectnum].visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sector[sectnum].visibility+16));
globvis2 = globalvisibility2;
......@@ -6399,6 +6405,7 @@ static void polymost_drawalls(int32_t const bunch)
ytex.u += (float)(nwal->xpanning - wal->xpanning) * ytex.d;
}
globalpicnum = nwal->picnum; globalshade = nwal->shade; globalpal = (int32_t)((uint8_t)nwal->pal);
globalclipdist = 0;
globvis = globalvisibility;
if (sector[sectnum].visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sector[sectnum].visibility+16));
globvis2 = globalvisibility2;
......@@ -6460,6 +6467,7 @@ static void polymost_drawalls(int32_t const bunch)
globalshade = wal->shade;
globalpal = wal->pal;
globalclipdist = 0;
globvis = (sector[sectnum].visibility != 0) ?
mulscale4(globalvisibility, (uint8_t)(sector[sectnum].visibility + 16)) :
globalvisibility;
......@@ -7147,6 +7155,7 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex)
buildgl_outputDebugMessage(3, "polymost_drawmaskwallinternal(wallIndex:%d)", wallIndex);
globalclipdist = 0;
globalpicnum = wal->overpicnum;
if ((uint32_t)globalpicnum >= MAXTILES)
globalpicnum = 0;
......@@ -7536,6 +7545,7 @@ void polymost2_drawsprite(int32_t snum)
globalshade = tspr->shade;
globalpal = tspr->pal;
globalorientation = tspr->cstat;
globalclipdist = tspr->clipdist;
globvis = globalvisibility;
if (sector[tspr->sectnum].visibility != 0)
......@@ -8120,6 +8130,7 @@ void polymost_drawsprite(int32_t snum)
globalshade = tspr->shade;
globalpal = tspr->pal;
globalorientation = tspr->cstat;
globalclipdist = tspr->clipdist;
globvis = globalvisibility;
if (sector[tspr->sectnum].visibility != 0)
......@@ -9110,6 +9121,8 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
globalpicnum = picnum;
int32_t const ogshade = globalshade;
globalshade = dashade;
int32_t const ogclipdist = globalclipdist;
globalclipdist = 0;
int32_t const ogpal = globalpal;
globalpal = (int32_t)((uint8_t)dapalnum);
float const oghalfx = ghalfx;
......@@ -9351,6 +9364,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
globalpicnum = ogpicnum;
globalshade = ogshade;
globalpal = ogpal;
globalclipdist = ogclipdist;
ghalfx = oghalfx;
ghalfy = oghalfy;
grhalfxdown10 = ogrhalfxdown10;
......
......@@ -4371,6 +4371,7 @@ skip:
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST)
{
tsprShadow->clipdist |= TSPR_FLAGS_NO_GLOW;
if (tilehasmodelorvoxel(t->picnum,t->pal))
{
tsprShadow->yrepeat = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment