mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 13:51:43 +00:00
Add a color field to vissprites and use that instead of referencing its mobj
This commit is contained in:
parent
e24fe29114
commit
7ea73bf817
4 changed files with 23 additions and 14 deletions
|
@ -74,6 +74,8 @@ typedef struct gl_vissprite_s
|
|||
float spritexscale, spriteyscale;
|
||||
float spritexoffset, spriteyoffset;
|
||||
|
||||
skincolornum_t color;
|
||||
|
||||
UINT32 renderflags;
|
||||
UINT8 rotateflags;
|
||||
|
||||
|
|
|
@ -5332,6 +5332,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||
|
||||
vis->mobj = thing;
|
||||
vis->color = thing->color;
|
||||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
if ((vis->mobj->flags & (MF_ENEMY|MF_BOSS)) && (vis->mobj->flags2 & MF2_FRET) && !(vis->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash"
|
||||
|
@ -5341,13 +5342,13 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
|
||||
vis->colormap = R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE);
|
||||
else
|
||||
vis->colormap = R_GetTranslationColormap(TC_BOSS, vis->mobj->color, GTC_CACHE);
|
||||
vis->colormap = R_GetTranslationColormap(TC_BOSS, vis->color, GTC_CACHE);
|
||||
}
|
||||
else if (thing->color)
|
||||
else if (vis->color)
|
||||
{
|
||||
// New colormap stuff for skins Tails 06-07-2002
|
||||
if (thing->colorized)
|
||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE);
|
||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, vis->color, GTC_CACHE);
|
||||
else if (thing->player && thing->player->dashmode >= DASHMODE_THRESHOLD
|
||||
&& (thing->player->charflags & SF_DASHMODE)
|
||||
&& ((leveltime/2) & 1))
|
||||
|
@ -5355,15 +5356,15 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
if (thing->player->charflags & SF_MACHINE)
|
||||
vis->colormap = R_GetTranslationColormap(TC_DASHMODE, 0, GTC_CACHE);
|
||||
else
|
||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE);
|
||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, vis->color, GTC_CACHE);
|
||||
}
|
||||
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
|
||||
{
|
||||
size_t skinnum = (skin_t*)thing->skin-skins;
|
||||
vis->colormap = R_GetTranslationColormap((INT32)skinnum, thing->color, GTC_CACHE);
|
||||
vis->colormap = R_GetTranslationColormap((INT32)skinnum, vis->color, GTC_CACHE);
|
||||
}
|
||||
else
|
||||
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color ? vis->mobj->color : SKINCOLOR_CYAN, GTC_CACHE);
|
||||
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, vis->color ? vis->color : SKINCOLOR_CYAN, GTC_CACHE);
|
||||
}
|
||||
else
|
||||
vis->colormap = NULL;
|
||||
|
@ -5473,6 +5474,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||
vis->flip = flip;
|
||||
vis->mobj = (mobj_t *)thing;
|
||||
vis->color = SKINCOLOR_NONE;
|
||||
|
||||
vis->colormap = NULL;
|
||||
|
||||
|
|
|
@ -753,13 +753,13 @@ UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
|
|||
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
|
||||
return R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE);
|
||||
else
|
||||
return R_GetTranslationColormap(TC_BOSS, vis->mobj->color, GTC_CACHE);
|
||||
return R_GetTranslationColormap(TC_BOSS, vis->color, GTC_CACHE);
|
||||
}
|
||||
else if (vis->mobj->color)
|
||||
else if (vis->color)
|
||||
{
|
||||
// New colormap stuff for skins Tails 06-07-2002
|
||||
if (!(vis->cut & SC_PRECIP) && vis->mobj->colorized)
|
||||
return R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
return R_GetTranslationColormap(TC_RAINBOW, vis->color, GTC_CACHE);
|
||||
else if (!(vis->cut & SC_PRECIP)
|
||||
&& vis->mobj->player && vis->mobj->player->dashmode >= DASHMODE_THRESHOLD
|
||||
&& (vis->mobj->player->charflags & SF_DASHMODE)
|
||||
|
@ -768,15 +768,15 @@ UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
|
|||
if (vis->mobj->player->charflags & SF_MACHINE)
|
||||
return R_GetTranslationColormap(TC_DASHMODE, 0, GTC_CACHE);
|
||||
else
|
||||
return R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
return R_GetTranslationColormap(TC_RAINBOW, vis->color, GTC_CACHE);
|
||||
}
|
||||
else if (!(vis->cut & SC_PRECIP) && vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // This thing is a player!
|
||||
{
|
||||
size_t skinnum = (skin_t*)vis->mobj->skin-skins;
|
||||
return R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE);
|
||||
return R_GetTranslationColormap((INT32)skinnum, vis->color, GTC_CACHE);
|
||||
}
|
||||
else // Use the defaults
|
||||
return R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
|
||||
return R_GetTranslationColormap(TC_DEFAULT, vis->color, GTC_CACHE);
|
||||
}
|
||||
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
|
||||
return R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLUE, GTC_CACHE);
|
||||
|
@ -821,7 +821,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
|
||||
if (R_SpriteIsFlashing(vis)) // Bosses "flash"
|
||||
colfunc = colfuncs[COLDRAWFUNC_TRANS]; // translate certain pixels to white
|
||||
else if (vis->mobj->color && vis->transmap) // Color mapping
|
||||
else if (vis->color && vis->transmap) // Color mapping
|
||||
{
|
||||
colfunc = colfuncs[COLDRAWFUNC_TRANSTRANS];
|
||||
dc_transmap = vis->transmap;
|
||||
|
@ -831,7 +831,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||
dc_transmap = vis->transmap; //Fab : 29-04-98: translucency table
|
||||
}
|
||||
else if (vis->mobj->color) // translate green skin to another color
|
||||
else if (vis->color) // translate green skin to another color
|
||||
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
||||
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];
|
||||
|
@ -1326,6 +1326,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
|||
shadow->shear.tan = shadowskew; // repurposed variable
|
||||
|
||||
shadow->mobj = thing; // Easy access! Tails 06-07-2002
|
||||
shadow->color = thing->color;
|
||||
|
||||
shadow->x1 = x1 < portalclipstart ? portalclipstart : x1;
|
||||
shadow->x2 = x2 >= portalclipend ? portalclipend-1 : x2;
|
||||
|
@ -1961,6 +1962,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
vis->shear.offset = 0;
|
||||
|
||||
vis->mobj = thing; // Easy access! Tails 06-07-2002
|
||||
vis->color = oldthing->color;
|
||||
|
||||
vis->x1 = x1 < portalclipstart ? portalclipstart : x1;
|
||||
vis->x2 = x2 >= portalclipend ? portalclipend-1 : x2;
|
||||
|
@ -2209,6 +2211,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
vis->cut = SC_PRECIP;
|
||||
vis->extra_colormap = thing->subsector->sector->extra_colormap;
|
||||
vis->heightsec = thing->subsector->sector->heightsec;
|
||||
vis->color = SKINCOLOR_NONE;
|
||||
|
||||
// Fullbright
|
||||
vis->colormap = colormaps;
|
||||
|
|
|
@ -199,6 +199,8 @@ typedef struct vissprite_s
|
|||
|
||||
fixed_t shadowscale;
|
||||
|
||||
skincolornum_t color;
|
||||
|
||||
INT16 clipbot[MAXVIDWIDTH], cliptop[MAXVIDWIDTH];
|
||||
|
||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||
|
|
Loading…
Reference in a new issue