mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-29 07:32:02 +00:00
blentran part 2: Sprite & patch blendmodes.
This commit is contained in:
parent
f9d2fd9ce5
commit
470b069179
4 changed files with 63 additions and 21 deletions
|
@ -130,6 +130,7 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
|||
float cx = FIXED_TO_FLOAT(x);
|
||||
float cy = FIXED_TO_FLOAT(y);
|
||||
UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
UINT8 blendmode = ((option & V_BLENDMASK) >> V_BLENDSHIFT);
|
||||
GLPatch_t *hwrPatch;
|
||||
|
||||
// 3--2
|
||||
|
@ -345,9 +346,12 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
|||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = hwrPatch->max_t;
|
||||
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
// clip it since it is used for bunny scroll in doom I
|
||||
if (blendmode)
|
||||
flags = HWR_GetBlendModeFlag(blendmode+1)|PF_NoDepthTest;
|
||||
else
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
|
@ -371,6 +375,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||
float cx = FIXED_TO_FLOAT(x);
|
||||
float cy = FIXED_TO_FLOAT(y);
|
||||
UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
UINT8 blendmode = ((option & V_BLENDMASK) >> V_BLENDSHIFT);
|
||||
GLPatch_t *hwrPatch;
|
||||
|
||||
// 3--2
|
||||
|
@ -568,8 +573,6 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||
else
|
||||
v[2].t = v[3].t = (FIXED_TO_FLOAT(sy+h)/(float)(gpatch->height))*hwrPatch->max_t;
|
||||
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
// Auto-crop at splitscreen borders!
|
||||
if (splitscreen && (option & V_PERPLAYER))
|
||||
{
|
||||
|
@ -641,6 +644,11 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||
}
|
||||
|
||||
// clip it since it is used for bunny scroll in doom I
|
||||
if (blendmode)
|
||||
flags = HWR_GetBlendModeFlag(blendmode+1)|PF_NoDepthTest;
|
||||
else
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
|
|
|
@ -3853,6 +3853,12 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
|||
else
|
||||
occlusion = PF_Occlude;
|
||||
|
||||
INT32 blendmode;
|
||||
if (spr->mobj->frame & FF_BLENDMASK)
|
||||
blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
else
|
||||
blendmode = spr->mobj->blendmode;
|
||||
|
||||
if (!cv_translucency.value) // translucency disabled
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
|
@ -3862,12 +3868,12 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
|||
else if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
blend = HWR_GetBlendModeFlag(spr->mobj->blendmode);
|
||||
blend = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf);
|
||||
blend = HWR_SurfaceBlend(blendmode, trans, &Surf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3876,7 +3882,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
|||
// Hurdler: PF_Environement would be cool, but we need to fix
|
||||
// the issue with the fog before
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
blend = HWR_GetBlendModeFlag(spr->mobj->blendmode)|occlusion;
|
||||
blend = HWR_GetBlendModeFlag(blendmode)|occlusion;
|
||||
if (!occlusion) use_linkdraw_hack = true;
|
||||
}
|
||||
|
||||
|
@ -4291,6 +4297,12 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
|||
else
|
||||
occlusion = PF_Occlude;
|
||||
|
||||
INT32 blendmode;
|
||||
if (spr->mobj->frame & FF_BLENDMASK)
|
||||
blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
else
|
||||
blendmode = spr->mobj->blendmode;
|
||||
|
||||
if (!cv_translucency.value) // translucency disabled
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
|
@ -4300,12 +4312,12 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
|||
else if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
blend = HWR_GetBlendModeFlag(spr->mobj->blendmode);
|
||||
blend = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf);
|
||||
blend = HWR_SurfaceBlend(blendmode, trans, &Surf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4314,7 +4326,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
|||
// Hurdler: PF_Environement would be cool, but we need to fix
|
||||
// the issue with the fog before
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
blend = HWR_GetBlendModeFlag(spr->mobj->blendmode)|occlusion;
|
||||
blend = HWR_GetBlendModeFlag(blendmode)|occlusion;
|
||||
if (!occlusion) use_linkdraw_hack = true;
|
||||
}
|
||||
|
||||
|
@ -5009,10 +5021,16 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
if (thing->spritexscale < 1 || thing->spriteyscale < 1)
|
||||
return;
|
||||
|
||||
INT32 blendmode;
|
||||
if (thing->frame & FF_BLENDMASK)
|
||||
blendmode = ((thing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
else
|
||||
blendmode = thing->blendmode;
|
||||
|
||||
// Visibility check by the blend mode.
|
||||
if (thing->frame & FF_TRANSMASK)
|
||||
{
|
||||
if (!R_BlendLevelVisible(thing->blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT))
|
||||
if (!R_BlendLevelVisible(blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1802,13 +1802,19 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
return;
|
||||
}
|
||||
|
||||
INT32 blendmode;
|
||||
if (oldthing->frame & FF_BLENDMASK)
|
||||
blendmode = ((oldthing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
else
|
||||
blendmode = oldthing->blendmode;
|
||||
|
||||
// Determine the translucency value.
|
||||
if (oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
|
||||
trans = tr_trans80; // because now the translucency is set through FF_TRANSMASK
|
||||
else if (oldthing->frame & FF_TRANSMASK)
|
||||
{
|
||||
trans = (oldthing->frame & FF_TRANSMASK) >> FF_TRANSSHIFT;
|
||||
if (!R_BlendLevelVisible(oldthing->blendmode, trans))
|
||||
if (!R_BlendLevelVisible(blendmode, trans))
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -2020,8 +2026,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
vis->scale += FixedMul(scalestep, spriteyscale) * (vis->x1 - x1);
|
||||
}
|
||||
|
||||
if ((oldthing->blendmode != AST_COPY) && cv_translucency.value)
|
||||
vis->transmap = R_GetBlendTable(oldthing->blendmode, trans);
|
||||
if ((blendmode != AST_COPY) && cv_translucency.value)
|
||||
vis->transmap = R_GetBlendTable(blendmode, trans);
|
||||
else
|
||||
vis->transmap = NULL;
|
||||
|
||||
|
@ -3021,7 +3027,7 @@ boolean R_ThingVisible (mobj_t *thing)
|
|||
{
|
||||
return (!(
|
||||
thing->sprite == SPR_NULL ||
|
||||
( thing->flags2 & (MF2_DONTDRAW) ) || ( thing->renderflags & (RF_DONTDRAW) ) ||
|
||||
( thing->flags2 & (MF2_DONTDRAW) ) ||
|
||||
(r_viewmobj && (thing == r_viewmobj || (r_viewmobj->player && r_viewmobj->player->followmobj == thing)))
|
||||
));
|
||||
}
|
||||
|
|
|
@ -511,7 +511,8 @@ static inline UINT8 transmappedpdraw(const UINT8 *dest, const UINT8 *source, fix
|
|||
void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap)
|
||||
{
|
||||
UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t);
|
||||
UINT32 alphalevel = 0;
|
||||
UINT32 alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
UINT32 blendmode = ((scrn & V_BLENDMASK) >> V_BLENDSHIFT);
|
||||
|
||||
fixed_t col, ofs, colfrac, rowfrac, fdup, vdup;
|
||||
INT32 dupx, dupy;
|
||||
|
@ -538,7 +539,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
|||
patchdrawfunc = standardpdraw;
|
||||
|
||||
v_translevel = NULL;
|
||||
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
if (alphalevel)
|
||||
{
|
||||
if (alphalevel == 10)
|
||||
alphalevel = hudminusalpha[st_translucency];
|
||||
|
@ -552,7 +553,11 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
|||
|
||||
if (alphalevel)
|
||||
{
|
||||
v_translevel = R_GetTranslucencyTable(alphalevel);
|
||||
if (blendmode)
|
||||
v_translevel = R_GetBlendTable(blendmode+1, alphalevel);
|
||||
else
|
||||
v_translevel = R_GetTranslucencyTable(alphalevel);
|
||||
|
||||
patchdrawfunc = translucentpdraw;
|
||||
}
|
||||
}
|
||||
|
@ -801,7 +806,8 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
|||
void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
{
|
||||
UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t);
|
||||
UINT32 alphalevel = 0;
|
||||
UINT32 alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
UINT32 blendmode = ((scrn & V_BLENDMASK) >> V_BLENDSHIFT);
|
||||
// boolean flip = false;
|
||||
|
||||
fixed_t col, ofs, colfrac, rowfrac, fdup, vdup;
|
||||
|
@ -827,7 +833,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN
|
|||
patchdrawfunc = standardpdraw;
|
||||
|
||||
v_translevel = NULL;
|
||||
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
if (alphalevel)
|
||||
{
|
||||
if (alphalevel == 10)
|
||||
alphalevel = hudminusalpha[st_translucency];
|
||||
|
@ -841,7 +847,11 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN
|
|||
|
||||
if (alphalevel)
|
||||
{
|
||||
v_translevel = R_GetTranslucencyTable(alphalevel);
|
||||
if (blendmode)
|
||||
v_translevel = R_GetBlendTable(blendmode+1, alphalevel);
|
||||
else
|
||||
v_translevel = R_GetTranslucencyTable(alphalevel);
|
||||
|
||||
patchdrawfunc = translucentpdraw;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue