mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
OpenGL: Ensure linked objects inherit translation in certain situations
This commit is contained in:
parent
db47eb512c
commit
19f2535403
4 changed files with 31 additions and 27 deletions
|
@ -74,8 +74,6 @@ typedef struct gl_vissprite_s
|
||||||
float spritexscale, spriteyscale;
|
float spritexscale, spriteyscale;
|
||||||
float spritexoffset, spriteyoffset;
|
float spritexoffset, spriteyoffset;
|
||||||
|
|
||||||
skincolornum_t color;
|
|
||||||
|
|
||||||
UINT32 renderflags;
|
UINT32 renderflags;
|
||||||
UINT8 rotateflags;
|
UINT8 rotateflags;
|
||||||
|
|
||||||
|
|
|
@ -5063,6 +5063,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(thing));
|
boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(thing));
|
||||||
boolean mirrored = thing->mirrored;
|
boolean mirrored = thing->mirrored;
|
||||||
boolean hflip = (!R_ThingHorizontallyFlipped(thing) != !mirrored);
|
boolean hflip = (!R_ThingHorizontallyFlipped(thing) != !mirrored);
|
||||||
|
skincolornum_t color;
|
||||||
|
UINT16 translation;
|
||||||
INT32 dispoffset;
|
INT32 dispoffset;
|
||||||
|
|
||||||
angle_t ang;
|
angle_t ang;
|
||||||
|
@ -5490,32 +5492,38 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||||
|
|
||||||
vis->mobj = thing;
|
vis->mobj = thing;
|
||||||
|
|
||||||
if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer && thing->color == SKINCOLOR_NONE)
|
if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer && thing->color == SKINCOLOR_NONE)
|
||||||
vis->color = thing->tracer->color;
|
color = thing->tracer->color;
|
||||||
else
|
else
|
||||||
vis->color = thing->color;
|
color = thing->color;
|
||||||
|
|
||||||
|
if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer && thing->translation == 0)
|
||||||
|
translation = thing->tracer->translation;
|
||||||
|
else
|
||||||
|
translation = thing->translation;
|
||||||
|
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
//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"
|
if (R_ThingIsFlashing(vis->mobj)) // Bosses "flash"
|
||||||
{
|
{
|
||||||
if (vis->mobj->type == MT_CYBRAKDEMON || vis->mobj->colorized)
|
if (vis->mobj->type == MT_CYBRAKDEMON || vis->mobj->colorized)
|
||||||
vis->colormap = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE);
|
vis->colormap = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE);
|
||||||
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
|
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
|
||||||
vis->colormap = R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE);
|
vis->colormap = R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE);
|
||||||
else
|
else
|
||||||
vis->colormap = R_GetTranslationColormap(TC_BOSS, vis->color, GTC_CACHE);
|
vis->colormap = R_GetTranslationColormap(TC_BOSS, color, GTC_CACHE);
|
||||||
}
|
}
|
||||||
else if (vis->mobj->translation)
|
else if (translation != 0)
|
||||||
{
|
{
|
||||||
remaptable_t *tr = R_GetTranslationByID(vis->mobj->translation);
|
remaptable_t *tr = R_GetTranslationByID(translation);
|
||||||
if (tr != NULL)
|
if (tr != NULL)
|
||||||
vis->colormap = tr->remap;
|
vis->colormap = tr->remap;
|
||||||
}
|
}
|
||||||
else if (vis->color)
|
else if (color != SKINCOLOR_NONE)
|
||||||
{
|
{
|
||||||
// New colormap stuff for skins Tails 06-07-2002
|
// New colormap stuff for skins Tails 06-07-2002
|
||||||
if (thing->colorized)
|
if (thing->colorized)
|
||||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, vis->color, GTC_CACHE);
|
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, color, GTC_CACHE);
|
||||||
else if (thing->player && thing->player->dashmode >= DASHMODE_THRESHOLD
|
else if (thing->player && thing->player->dashmode >= DASHMODE_THRESHOLD
|
||||||
&& (thing->player->charflags & SF_DASHMODE)
|
&& (thing->player->charflags & SF_DASHMODE)
|
||||||
&& ((leveltime/2) & 1))
|
&& ((leveltime/2) & 1))
|
||||||
|
@ -5523,15 +5531,15 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
if (thing->player->charflags & SF_MACHINE)
|
if (thing->player->charflags & SF_MACHINE)
|
||||||
vis->colormap = R_GetTranslationColormap(TC_DASHMODE, 0, GTC_CACHE);
|
vis->colormap = R_GetTranslationColormap(TC_DASHMODE, 0, GTC_CACHE);
|
||||||
else
|
else
|
||||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, vis->color, GTC_CACHE);
|
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, color, GTC_CACHE);
|
||||||
}
|
}
|
||||||
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
|
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
|
||||||
{
|
{
|
||||||
size_t skinnum = (skin_t*)thing->skin-skins;
|
size_t skinnum = (skin_t*)thing->skin-skins;
|
||||||
vis->colormap = R_GetTranslationColormap((INT32)skinnum, vis->color, GTC_CACHE);
|
vis->colormap = R_GetTranslationColormap((INT32)skinnum, color, GTC_CACHE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, vis->color ? vis->color : SKINCOLOR_CYAN, GTC_CACHE);
|
vis->colormap = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vis->colormap = NULL;
|
vis->colormap = NULL;
|
||||||
|
@ -5660,7 +5668,6 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||||
vis->flip = flip;
|
vis->flip = flip;
|
||||||
vis->mobj = (mobj_t *)thing;
|
vis->mobj = (mobj_t *)thing;
|
||||||
vis->color = SKINCOLOR_NONE;
|
|
||||||
|
|
||||||
vis->colormap = NULL;
|
vis->colormap = NULL;
|
||||||
|
|
||||||
|
|
|
@ -766,18 +766,9 @@ void R_DrawFlippedMaskedColumn(column_t *column)
|
||||||
dc_texturemid = basetexturemid;
|
dc_texturemid = basetexturemid;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean R_SpriteIsFlashing(vissprite_t *vis)
|
|
||||||
{
|
|
||||||
return (!(vis->cut & SC_PRECIP)
|
|
||||||
&& (vis->mobj->flags & (MF_ENEMY|MF_BOSS))
|
|
||||||
&& (vis->mobj->flags2 & MF2_FRET)
|
|
||||||
&& !(vis->mobj->flags & MF_GRENADEBOUNCE)
|
|
||||||
&& (leveltime & 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
|
UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
|
||||||
{
|
{
|
||||||
if (R_SpriteIsFlashing(vis)) // Bosses "flash"
|
if (R_ThingIsFlashing(vis->mobj)) // Bosses "flash"
|
||||||
{
|
{
|
||||||
if (vis->mobj->type == MT_CYBRAKDEMON || vis->mobj->colorized)
|
if (vis->mobj->type == MT_CYBRAKDEMON || vis->mobj->colorized)
|
||||||
return R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE);
|
return R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE);
|
||||||
|
@ -864,7 +855,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||||
dc_colormap = vis->colormap;
|
dc_colormap = vis->colormap;
|
||||||
dc_translation = R_GetSpriteTranslation(vis);
|
dc_translation = R_GetSpriteTranslation(vis);
|
||||||
|
|
||||||
if (R_SpriteIsFlashing(vis)) // Bosses "flash"
|
if (R_ThingIsFlashing(vis->mobj)) // Bosses "flash"
|
||||||
colfunc = colfuncs[COLDRAWFUNC_TRANS]; // translate certain pixels to white
|
colfunc = colfuncs[COLDRAWFUNC_TRANS]; // translate certain pixels to white
|
||||||
else if (dc_translation && vis->transmap) // Color mapping
|
else if (dc_translation && vis->transmap) // Color mapping
|
||||||
{
|
{
|
||||||
|
@ -3613,6 +3604,14 @@ boolean R_ThingIsFullDark(mobj_t *thing)
|
||||||
return ((thing->frame & FF_BRIGHTMASK) == FF_FULLDARK || (thing->renderflags & RF_BRIGHTMASK) == RF_FULLDARK);
|
return ((thing->frame & FF_BRIGHTMASK) == FF_FULLDARK || (thing->renderflags & RF_BRIGHTMASK) == RF_FULLDARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean R_ThingIsFlashing(mobj_t *thing)
|
||||||
|
{
|
||||||
|
if (thing == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->flags2 & MF2_FRET) && !(thing->flags & MF_GRENADEBOUNCE) && (leveltime & 1);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_DrawMasked
|
// R_DrawMasked
|
||||||
//
|
//
|
||||||
|
|
|
@ -88,6 +88,8 @@ boolean R_ThingIsFullBright (mobj_t *thing);
|
||||||
boolean R_ThingIsSemiBright (mobj_t *thing);
|
boolean R_ThingIsSemiBright (mobj_t *thing);
|
||||||
boolean R_ThingIsFullDark (mobj_t *thing);
|
boolean R_ThingIsFullDark (mobj_t *thing);
|
||||||
|
|
||||||
|
boolean R_ThingIsFlashing (mobj_t *thing);
|
||||||
|
|
||||||
// --------------
|
// --------------
|
||||||
// MASKED DRAWING
|
// MASKED DRAWING
|
||||||
// --------------
|
// --------------
|
||||||
|
@ -225,8 +227,6 @@ extern UINT32 visspritecount, numvisiblesprites;
|
||||||
|
|
||||||
void R_ClipSprites(drawseg_t* dsstart, portal_t* portal);
|
void R_ClipSprites(drawseg_t* dsstart, portal_t* portal);
|
||||||
|
|
||||||
boolean R_SpriteIsFlashing(vissprite_t *vis);
|
|
||||||
|
|
||||||
void R_DrawThingBoundingBox(vissprite_t *spr);
|
void R_DrawThingBoundingBox(vissprite_t *spr);
|
||||||
|
|
||||||
UINT8 *R_GetSpriteTranslation(vissprite_t *vis);
|
UINT8 *R_GetSpriteTranslation(vissprite_t *vis);
|
||||||
|
|
Loading…
Reference in a new issue