mobj_t: add shadowcolor member to change shadow palette index

This commit is contained in:
James R. 2023-09-17 18:56:03 -07:00
parent 6cab4bca74
commit 72ef1d352b
8 changed files with 13 additions and 3 deletions

View file

@ -10408,6 +10408,7 @@ static void P_DefaultMobjShadowScale(mobj_t *thing)
{
thing->shadowscale = 0;
thing->whiteshadow = ((thing->frame & FF_BRIGHTMASK) == FF_FULLBRIGHT);
thing->shadowcolor = 15;
switch (thing->type)
{

View file

@ -415,6 +415,7 @@ struct mobj_t
fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius
boolean whiteshadow; // Use white shadow, set to true by default for fullbright objects
UINT8 shadowcolor; // Palette index to use for rendering the shadow
fixed_t sprxoff, spryoff, sprzoff; // Sprite offsets in real space, does NOT affect position or collision

View file

@ -3023,6 +3023,7 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
{
WRITEFIXED(save->p, mobj->shadowscale);
WRITEUINT8(save->p, mobj->whiteshadow);
WRITEUINT8(save->p, mobj->shadowcolor);
}
if (diff2 & MD2_RENDERFLAGS)
{
@ -4249,6 +4250,7 @@ static thinker_t* LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
{
mobj->shadowscale = READFIXED(save->p);
mobj->whiteshadow = READUINT8(save->p);
mobj->shadowcolor = READUINT8(save->p);
}
if (diff2 & MD2_RENDERFLAGS)
mobj->renderflags = READUINT32(save->p);

View file

@ -128,6 +128,8 @@ UINT8 *ds_source; // points to the start of a flat
UINT8 *ds_brightmap; // start of brightmap flat
UINT8 *ds_transmap; // one of the translucency tables
UINT8 dc_shadowcolor;
// Vectors for Software's tilted slope drawers
floatv3_t *ds_su, *ds_sv, *ds_sz;
floatv3_t *ds_sup, *ds_svp, *ds_szp;

View file

@ -59,6 +59,8 @@ extern INT32 dc_numlights, dc_maxlights;
//Fix TUTIFRUTI
extern INT32 dc_texheight;
extern UINT8 dc_shadowcolor;
// -----------------------
// SPAN DRAWING CODE STUFF
// -----------------------

View file

@ -584,9 +584,7 @@ void R_DrawDropShadowColumn_8(void)
dest = &topleft[dc_yl*vid.width + dc_x];
{
#define DSCOLOR 15 // palette index for the color of the shadow
register const UINT8 *transmap_offset = dc_transmap + (dc_colormap[DSCOLOR] << 8);
#undef DSCOLOR
register const UINT8 *transmap_offset = dc_transmap + (dc_colormap[dc_shadowcolor] << 8);
while ((count -= 2) >= 0)
{
*dest = *(transmap_offset + (*dest));

View file

@ -926,6 +926,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
{
R_SetColumnFunc(COLDRAWFUNC_DROPSHADOW, false);
dc_transmap = vis->transmap;
dc_shadowcolor = vis->color;
}
else if (!(vis->cut & SC_PRECIP) &&
R_ThingIsFlashing(vis->mobj)) // Bosses "flash"
@ -1543,6 +1544,8 @@ static void R_ProjectDropShadow(
shadow->transmap = R_GetBlendTable(thing->whiteshadow ? AST_ADD : AST_SUBTRACT, 0);
shadow->colormap = colormaps;
shadow->color = thing->shadowcolor;
objectsdrawn++;
}

View file

@ -225,6 +225,7 @@ struct vissprite_t
fixed_t spritexoffset, spriteyoffset;
fixed_t shadowscale;
UINT8 color; // palette index
INT16 clipbot[MAXVIDWIDTH], cliptop[MAXVIDWIDTH];