mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-07 00:41:26 +00:00
Implement an "ignore colormaps" sprite rendering flag
This commit is contained in:
parent
b03d95c5c6
commit
0f9d85694d
4 changed files with 46 additions and 33 deletions
|
@ -9602,6 +9602,7 @@ struct {
|
||||||
{"RF_BLENDMASK",RF_BLENDMASK},
|
{"RF_BLENDMASK",RF_BLENDMASK},
|
||||||
{"RF_FULLBRIGHT",RF_FULLBRIGHT},
|
{"RF_FULLBRIGHT",RF_FULLBRIGHT},
|
||||||
{"RF_FULLDARK",RF_FULLDARK},
|
{"RF_FULLDARK",RF_FULLDARK},
|
||||||
|
{"RF_NOCOLORMAPS",RF_NOCOLORMAPS},
|
||||||
{"RF_SPRITETYPEMASK",RF_SPRITETYPEMASK},
|
{"RF_SPRITETYPEMASK",RF_SPRITETYPEMASK},
|
||||||
{"RF_PAPERSPRITE",RF_PAPERSPRITE},
|
{"RF_PAPERSPRITE",RF_PAPERSPRITE},
|
||||||
{"RF_FLOORSPRITE",RF_FLOORSPRITE},
|
{"RF_FLOORSPRITE",RF_FLOORSPRITE},
|
||||||
|
|
|
@ -3616,16 +3616,17 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale)
|
||||||
shadowVerts[3].t = shadowVerts[2].t = 0;
|
shadowVerts[3].t = shadowVerts[2].t = 0;
|
||||||
shadowVerts[0].t = shadowVerts[1].t = ((GLPatch_t *)gpatch->hardware)->max_t;
|
shadowVerts[0].t = shadowVerts[1].t = ((GLPatch_t *)gpatch->hardware)->max_t;
|
||||||
|
|
||||||
|
if (!(thing->renderflags & RF_NOCOLORMAPS))
|
||||||
|
{
|
||||||
if (thing->subsector->sector->numlights)
|
if (thing->subsector->sector->numlights)
|
||||||
{
|
{
|
||||||
light = R_GetPlaneLight(thing->subsector->sector, groundz, false); // Always use the light at the top instead of whatever I was doing before
|
// Always use the light at the top instead of whatever I was doing before
|
||||||
|
light = R_GetPlaneLight(thing->subsector->sector, groundz, false);
|
||||||
|
|
||||||
if (*thing->subsector->sector->lightlist[light].extra_colormap)
|
if (*thing->subsector->sector->lightlist[light].extra_colormap)
|
||||||
colormap = *thing->subsector->sector->lightlist[light].extra_colormap;
|
colormap = *thing->subsector->sector->lightlist[light].extra_colormap;
|
||||||
}
|
}
|
||||||
else
|
else if (thing->subsector->sector->extra_colormap)
|
||||||
{
|
|
||||||
if (thing->subsector->sector->extra_colormap)
|
|
||||||
colormap = thing->subsector->sector->extra_colormap;
|
colormap = thing->subsector->sector->extra_colormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3675,7 +3676,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||||
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
||||||
patch_t *gpatch;
|
patch_t *gpatch;
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
extracolormap_t *colormap;
|
extracolormap_t *colormap = NULL;
|
||||||
FUINT lightlevel;
|
FUINT lightlevel;
|
||||||
boolean lightset = true;
|
boolean lightset = true;
|
||||||
FBITFIELD blend = 0;
|
FBITFIELD blend = 0;
|
||||||
|
@ -3810,7 +3811,9 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||||
|
|
||||||
// Start with the lightlevel and colormap from the top of the sprite
|
// Start with the lightlevel and colormap from the top of the sprite
|
||||||
lightlevel = *list[sector->numlights - 1].lightlevel;
|
lightlevel = *list[sector->numlights - 1].lightlevel;
|
||||||
|
if (!(spr->mobj->renderflags & RF_NOCOLORMAPS))
|
||||||
colormap = *list[sector->numlights - 1].extra_colormap;
|
colormap = *list[sector->numlights - 1].extra_colormap;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
temp = FLOAT_TO_FIXED(realtop);
|
temp = FLOAT_TO_FIXED(realtop);
|
||||||
|
|
||||||
|
@ -3828,6 +3831,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||||
{
|
{
|
||||||
if (!lightset)
|
if (!lightset)
|
||||||
lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel;
|
lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel;
|
||||||
|
if (!(spr->mobj->renderflags & RF_NOCOLORMAPS))
|
||||||
colormap = *list[i-1].extra_colormap;
|
colormap = *list[i-1].extra_colormap;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3843,6 +3847,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||||
{
|
{
|
||||||
if (!lightset)
|
if (!lightset)
|
||||||
lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel;
|
lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel;
|
||||||
|
if (!(spr->mobj->renderflags & RF_NOCOLORMAPS))
|
||||||
colormap = *list[i].extra_colormap;
|
colormap = *list[i].extra_colormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4160,7 +4165,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||||
sector_t *sector = spr->mobj->subsector->sector;
|
sector_t *sector = spr->mobj->subsector->sector;
|
||||||
UINT8 lightlevel = 0;
|
UINT8 lightlevel = 0;
|
||||||
boolean lightset = true;
|
boolean lightset = true;
|
||||||
extracolormap_t *colormap = sector->extra_colormap;
|
extracolormap_t *colormap = NULL;
|
||||||
|
|
||||||
if (R_ThingIsFullBright(spr->mobj))
|
if (R_ThingIsFullBright(spr->mobj))
|
||||||
lightlevel = 255;
|
lightlevel = 255;
|
||||||
|
@ -4169,6 +4174,9 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||||
else
|
else
|
||||||
lightset = false;
|
lightset = false;
|
||||||
|
|
||||||
|
if (!(spr->mobj->renderflags & RF_NOCOLORMAPS))
|
||||||
|
colormap = sector->extra_colormap;
|
||||||
|
|
||||||
if (splat && sector->numlights)
|
if (splat && sector->numlights)
|
||||||
{
|
{
|
||||||
INT32 light = R_GetPlaneLight(sector, spr->mobj->z, false);
|
INT32 light = R_GetPlaneLight(sector, spr->mobj->z, false);
|
||||||
|
@ -4176,7 +4184,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||||
if (!lightset)
|
if (!lightset)
|
||||||
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
|
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
|
||||||
|
|
||||||
if (*sector->lightlist[light].extra_colormap)
|
if (*sector->lightlist[light].extra_colormap && !(spr->mobj->renderflags & RF_NOCOLORMAPS))
|
||||||
colormap = *sector->lightlist[light].extra_colormap;
|
colormap = *sector->lightlist[light].extra_colormap;
|
||||||
}
|
}
|
||||||
else if (!lightset)
|
else if (!lightset)
|
||||||
|
@ -4301,9 +4309,8 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||||
|
|
||||||
if (sector->numlights)
|
if (sector->numlights)
|
||||||
{
|
{
|
||||||
INT32 light;
|
// Always use the light at the top instead of whatever I was doing before
|
||||||
|
INT32 light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false);
|
||||||
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
|
|
||||||
|
|
||||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
|
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
|
||||||
|
|
|
@ -729,6 +729,7 @@ typedef enum
|
||||||
RF_BLENDMASK = 0x0F00, // --Blending modes
|
RF_BLENDMASK = 0x0F00, // --Blending modes
|
||||||
RF_FULLBRIGHT = 0x0100, // Sprite is drawn at full brightness
|
RF_FULLBRIGHT = 0x0100, // Sprite is drawn at full brightness
|
||||||
RF_FULLDARK = 0x0200, // Sprite is drawn completely dark
|
RF_FULLDARK = 0x0200, // Sprite is drawn completely dark
|
||||||
|
RF_NOCOLORMAPS = 0x0400, // Sprite is not drawn with colormaps
|
||||||
|
|
||||||
RF_SPRITETYPEMASK = 0x7000, // ---Different sprite types, not all implemented
|
RF_SPRITETYPEMASK = 0x7000, // ---Different sprite types, not all implemented
|
||||||
RF_PAPERSPRITE = 0x1000, // Paper sprite
|
RF_PAPERSPRITE = 0x1000, // Paper sprite
|
||||||
|
|
|
@ -842,7 +842,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||||
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
|
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
|
||||||
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
||||||
|
|
||||||
if (vis->extra_colormap)
|
if (vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS))
|
||||||
{
|
{
|
||||||
if (!dc_colormap)
|
if (!dc_colormap)
|
||||||
dc_colormap = vis->extra_colormap->colormap;
|
dc_colormap = vis->extra_colormap->colormap;
|
||||||
|
@ -1354,6 +1354,10 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
||||||
x1 += (x2-x1)/2;
|
x1 += (x2-x1)/2;
|
||||||
shadow->shear.offset = shadow->x1-x1;
|
shadow->shear.offset = shadow->x1-x1;
|
||||||
|
|
||||||
|
if (thing->renderflags & RF_NOCOLORMAPS)
|
||||||
|
shadow->extra_colormap = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
if (thing->subsector->sector->numlights)
|
if (thing->subsector->sector->numlights)
|
||||||
{
|
{
|
||||||
INT32 lightnum;
|
INT32 lightnum;
|
||||||
|
@ -1367,13 +1371,13 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//light = R_GetPlaneLight(thing->subsector->sector, shadow->gzt, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thing->subsector->sector->numlights)
|
if (thing->subsector->sector->numlights)
|
||||||
shadow->extra_colormap = *thing->subsector->sector->lightlist[light].extra_colormap;
|
shadow->extra_colormap = *thing->subsector->sector->lightlist[light].extra_colormap;
|
||||||
else
|
else
|
||||||
shadow->extra_colormap = thing->subsector->sector->extra_colormap;
|
shadow->extra_colormap = thing->subsector->sector->extra_colormap;
|
||||||
|
}
|
||||||
|
|
||||||
shadow->transmap = R_GetTranslucencyTable(trans + 1);
|
shadow->transmap = R_GetTranslucencyTable(trans + 1);
|
||||||
shadow->colormap = scalelight[0][0]; // full dark!
|
shadow->colormap = scalelight[0][0]; // full dark!
|
||||||
|
|
Loading…
Reference in a new issue