diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 495c9985e..af54a350a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5518,10 +5518,11 @@ static void HWR_ProjectSprite(mobj_t *thing) vis->mobj = thing; //Hurdler: 25/04/2000: now support colormap in hardware mode - if (vis->mobj->hitlag > 0 && (vis->mobj->eflags & MFE_DAMAGEHITLAG)) + if (R_ThingIsFlashing(vis->mobj)) { vis->colormap = R_GetTranslationColormap(TC_HITLAG, 0, GTC_CACHE); } + /* else if ((vis->mobj->flags & (MF_ENEMY|MF_BOSS)) && (vis->mobj->flags2 & MF2_FRET) && !(vis->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash" { if (vis->mobj->type == MT_CYBRAKDEMON || vis->mobj->colorized) @@ -5531,6 +5532,7 @@ static void HWR_ProjectSprite(mobj_t *thing) else vis->colormap = R_GetTranslationColormap(TC_BOSS, 0, GTC_CACHE); } + */ else if (thing->color) { // New colormap stuff for skins Tails 06-07-2002 diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 84835d284..896ef7b8c 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1499,10 +1499,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) { INT32 skinnum = TC_DEFAULT; - if (spr->mobj->hitlag > 0 && (spr->mobj->eflags & MFE_DAMAGEHITLAG)) + if (R_ThingIsFlashing(spr->mobj)) { skinnum = TC_HITLAG; } + /* else if ((spr->mobj->flags & (MF_ENEMY|MF_BOSS)) && (spr->mobj->flags2 & MF2_FRET) && !(spr->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash" { if (spr->mobj->type == MT_CYBRAKDEMON || spr->mobj->colorized) @@ -1512,6 +1513,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) else skinnum = TC_BOSS; } + */ else if ((skincolornum_t)spr->mobj->color != SKINCOLOR_NONE) { if (spr->mobj->colorized) diff --git a/src/k_boss.c b/src/k_boss.c index 0c1217fc4..490adb27e 100644 --- a/src/k_boss.c +++ b/src/k_boss.c @@ -110,15 +110,13 @@ void K_InitBossHealthBar(const char *enemyname, const char *subtitle, sfxenum_t { if (enemyname && enemyname[0]) { - if (bossinfo.enemyname) - Z_Free(bossinfo.enemyname); + Z_Free(bossinfo.enemyname); bossinfo.enemyname = Z_StrDup(enemyname); } if (subtitle && subtitle[0]) { - if (bossinfo.subtitle) - Z_Free(bossinfo.subtitle); + Z_Free(bossinfo.subtitle); bossinfo.subtitle = Z_StrDup(subtitle); } diff --git a/src/p_setup.c b/src/p_setup.c index 466241d54..80315bb2e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4488,10 +4488,8 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) // Reset some pesky boss state that can't be handled elsewhere. bossinfo.barlen = BOSSHEALTHBARLEN; bossinfo.visualbar = 0; - if (bossinfo.enemyname) - Z_Free(bossinfo.enemyname); - if (bossinfo.subtitle) - Z_Free(bossinfo.subtitle); + Z_Free(bossinfo.enemyname); + Z_Free(bossinfo.subtitle); bossinfo.enemyname = bossinfo.subtitle = NULL; bossinfo.titleshow = 0; bossinfo.titlesound = sfx_typri1; diff --git a/src/r_things.c b/src/r_things.c index 5c966f9d0..9441804b1 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -757,17 +757,32 @@ void R_DrawFlippedMaskedColumn(column_t *column, column_t *brightmap) dc_texturemid = basetexturemid; } -boolean R_SpriteIsFlashing(vissprite_t *vis) +static boolean hitlag_is_flashing(mobj_t *thing) { - return (!(vis->cut & SC_PRECIP) - && (vis->mobj->flags & (MF_ENEMY|MF_BOSS)) - && (vis->mobj->flags2 & MF2_FRET) - && !(vis->mobj->flags & MF_GRENADEBOUNCE)); + return + (thing->hitlag > 0) && + (thing->eflags & (MFE_DAMAGEHITLAG)); +} + +static boolean baddie_is_flashing(mobj_t *thing) +{ + return + (thing->flags & (MF_ENEMY|MF_BOSS)) && + (thing->flags2 & (MF2_FRET)) && + !(thing->flags & MF_GRENADEBOUNCE); +} + +boolean R_ThingIsFlashing(mobj_t *thing) +{ + return + hitlag_is_flashing(thing) || + baddie_is_flashing(thing); } UINT8 *R_GetSpriteTranslation(vissprite_t *vis) { - if ((vis->mobj->hitlag > 0 && (vis->mobj->eflags & MFE_DAMAGEHITLAG)) || R_SpriteIsFlashing(vis)) + if (!(vis->cut & SC_PRECIP) && + R_ThingIsFlashing(vis->mobj)) { return R_GetTranslationColormap(TC_HITLAG, 0, GTC_CACHE); } @@ -845,8 +860,11 @@ static void R_DrawVisSprite(vissprite_t *vis) R_SetColumnFunc(COLDRAWFUNC_DROPSHADOW, false); dc_transmap = vis->transmap; } - else if (R_SpriteIsFlashing(vis)) // Bosses "flash" + else if (!(vis->cut & SC_PRECIP) && + R_ThingIsFlashing(vis->mobj)) // Bosses "flash" + { R_SetColumnFunc(COLDRAWFUNC_TRANS, false); // translate certain pixels to white + } else if (vis->mobj->color && vis->transmap) // Color mapping { R_SetColumnFunc(COLDRAWFUNC_TRANSTRANS, false); diff --git a/src/r_things.h b/src/r_things.h index c34af2ef4..98f9b2618 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -84,6 +84,8 @@ boolean R_ThingIsFullBright (mobj_t *thing); boolean R_ThingIsSemiBright (mobj_t *thing); boolean R_ThingIsFullDark (mobj_t *thing); +boolean R_ThingIsFlashing(mobj_t *thing); + // -------------- // MASKED DRAWING // -------------- @@ -218,7 +220,6 @@ extern UINT32 visspritecount; void R_ClipSprites(drawseg_t* dsstart, portal_t* portal); void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2, drawseg_t* dsstart, portal_t* portal); -boolean R_SpriteIsFlashing(vissprite_t *vis); UINT8 *R_GetSpriteTranslation(vissprite_t *vis); // ----------