mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
blentran part 3: Wall & plane blendmodes.
This commit is contained in:
parent
a3be09bb3f
commit
7601afb6c1
8 changed files with 120 additions and 86 deletions
|
@ -556,7 +556,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||||
|
|
||||||
HWR_Lighting(&Surf, lightlevel, planecolormap);
|
HWR_Lighting(&Surf, lightlevel, planecolormap);
|
||||||
|
|
||||||
if (PolyFlags & (PF_Translucent|PF_Fog))
|
if (PolyFlags & (PF_Translucent|PF_Fog|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment))
|
||||||
{
|
{
|
||||||
Surf.PolyColor.s.alpha = (UINT8)alpha;
|
Surf.PolyColor.s.alpha = (UINT8)alpha;
|
||||||
PolyFlags |= PF_Modulated;
|
PolyFlags |= PF_Modulated;
|
||||||
|
@ -980,8 +980,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||||
|
|
||||||
if (cutflag & FF_FOG)
|
if (cutflag & FF_FOG)
|
||||||
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap);
|
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap);
|
||||||
else if (cutflag & FF_TRANSLUCENT)
|
else if (polyflags & (PF_Translucent|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment))
|
||||||
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap);
|
HWR_AddTransparentWall(wallVerts, Surf, texnum, polyflags, false, lightnum, colormap);
|
||||||
else
|
else
|
||||||
HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap);
|
HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap);
|
||||||
|
|
||||||
|
@ -1009,8 +1009,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||||
|
|
||||||
if (cutflag & FF_FOG)
|
if (cutflag & FF_FOG)
|
||||||
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap);
|
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap);
|
||||||
else if (cutflag & FF_TRANSLUCENT)
|
else if (polyflags & (PF_Translucent|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment))
|
||||||
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap);
|
HWR_AddTransparentWall(wallVerts, Surf, texnum, polyflags, false, lightnum, colormap);
|
||||||
else
|
else
|
||||||
HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap);
|
HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap);
|
||||||
}
|
}
|
||||||
|
@ -1264,6 +1264,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
else
|
else
|
||||||
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
|
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||||
if (gl_midtexture)
|
if (gl_midtexture)
|
||||||
{
|
{
|
||||||
|
@ -1453,10 +1454,20 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
case 221:
|
case 221:
|
||||||
case 253:
|
case 253:
|
||||||
case 256:
|
case 256:
|
||||||
blendmode = PF_Translucent;
|
if (gl_linedef->blendmode)
|
||||||
|
blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf);
|
||||||
|
else
|
||||||
|
blendmode = PF_Translucent;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT)
|
if (gl_linedef->blendmode)
|
||||||
|
{
|
||||||
|
if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT)
|
||||||
|
blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf);
|
||||||
|
else
|
||||||
|
blendmode = HWR_GetBlendModeFlag(gl_linedef->blendmode);
|
||||||
|
}
|
||||||
|
else if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT)
|
||||||
blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), &Surf);
|
blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), &Surf);
|
||||||
else
|
else
|
||||||
blendmode = PF_Masked;
|
blendmode = PF_Masked;
|
||||||
|
@ -1481,11 +1492,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
if (gl_frontsector->numlights)
|
if (gl_frontsector->numlights)
|
||||||
{
|
{
|
||||||
if (!(blendmode & PF_Masked))
|
if (!(blendmode & PF_Masked))
|
||||||
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL, PF_Decal);
|
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL, blendmode);
|
||||||
else
|
else
|
||||||
{
|
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL, blendmode);
|
||||||
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL, PF_Decal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (!(blendmode & PF_Masked))
|
else if (!(blendmode & PF_Masked))
|
||||||
HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, blendmode, false, lightnum, colormap);
|
HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, blendmode, false, lightnum, colormap);
|
||||||
|
@ -1745,7 +1754,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
|
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
|
||||||
|
|
||||||
if (gl_frontsector->numlights)
|
if (gl_frontsector->numlights)
|
||||||
HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover, 0);
|
HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover, blendmode);
|
||||||
else
|
else
|
||||||
HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap);
|
HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap);
|
||||||
}
|
}
|
||||||
|
@ -1753,14 +1762,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
{
|
{
|
||||||
FBITFIELD blendmode = PF_Masked;
|
FBITFIELD blendmode = PF_Masked;
|
||||||
|
|
||||||
if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256)
|
if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend)
|
||||||
{
|
{
|
||||||
blendmode = PF_Translucent;
|
blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent;
|
||||||
Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1;
|
Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_frontsector->numlights)
|
if (gl_frontsector->numlights)
|
||||||
HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover, 0);
|
HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover, blendmode);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (blendmode != PF_Masked)
|
if (blendmode != PF_Masked)
|
||||||
|
@ -1868,7 +1877,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
|
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
|
||||||
|
|
||||||
if (gl_backsector->numlights)
|
if (gl_backsector->numlights)
|
||||||
HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover, 0);
|
HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover, blendmode);
|
||||||
else
|
else
|
||||||
HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap);
|
HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap);
|
||||||
}
|
}
|
||||||
|
@ -1876,14 +1885,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
{
|
{
|
||||||
FBITFIELD blendmode = PF_Masked;
|
FBITFIELD blendmode = PF_Masked;
|
||||||
|
|
||||||
if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256)
|
if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend)
|
||||||
{
|
{
|
||||||
blendmode = PF_Translucent;
|
blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent;
|
||||||
Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1;
|
Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_backsector->numlights)
|
if (gl_backsector->numlights)
|
||||||
HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover, 0);
|
HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover, blendmode);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (blendmode != PF_Masked)
|
if (blendmode != PF_Masked)
|
||||||
|
@ -2960,6 +2969,13 @@ static void HWR_AddPolyObjectPlanes(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FBITFIELD HWR_RippleBlend(sector_t *sector, ffloor_t *rover, boolean ceiling)
|
||||||
|
{
|
||||||
|
(void)sector;
|
||||||
|
(void)ceiling;
|
||||||
|
return /*R_IsRipplePlane(sector, rover, ceiling)*/ (rover->flags & FF_RIPPLE) ? PF_Ripple : 0;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------+
|
// -----------------+
|
||||||
// HWR_Subsector : Determine floor/ceiling planes.
|
// HWR_Subsector : Determine floor/ceiling planes.
|
||||||
// : Add sprites of things in sector.
|
// : Add sprites of things in sector.
|
||||||
|
@ -3150,7 +3166,7 @@ static void HWR_Subsector(size_t num)
|
||||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||||
true, rover->master->frontsector->extra_colormap);
|
true, rover->master->frontsector->extra_colormap);
|
||||||
}
|
}
|
||||||
else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) // SoM: Flags are more efficient
|
else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) // SoM: Flags are more efficient
|
||||||
{
|
{
|
||||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
||||||
|
|
||||||
|
@ -3159,14 +3175,15 @@ static void HWR_Subsector(size_t num)
|
||||||
false,
|
false,
|
||||||
*rover->bottomheight,
|
*rover->bottomheight,
|
||||||
*gl_frontsector->lightlist[light].lightlevel,
|
*gl_frontsector->lightlist[light].lightlevel,
|
||||||
rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent,
|
rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector,
|
||||||
|
HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent),
|
||||||
false, *gl_frontsector->lightlist[light].extra_colormap);
|
false, *gl_frontsector->lightlist[light].extra_colormap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWR_GetLevelFlat(&levelflats[*rover->bottompic]);
|
HWR_GetLevelFlat(&levelflats[*rover->bottompic]);
|
||||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
||||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic],
|
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic],
|
||||||
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3195,7 +3212,7 @@ static void HWR_Subsector(size_t num)
|
||||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||||
true, rover->master->frontsector->extra_colormap);
|
true, rover->master->frontsector->extra_colormap);
|
||||||
}
|
}
|
||||||
else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256)
|
else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend)
|
||||||
{
|
{
|
||||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
||||||
|
|
||||||
|
@ -3204,14 +3221,15 @@ static void HWR_Subsector(size_t num)
|
||||||
true,
|
true,
|
||||||
*rover->topheight,
|
*rover->topheight,
|
||||||
*gl_frontsector->lightlist[light].lightlevel,
|
*gl_frontsector->lightlist[light].lightlevel,
|
||||||
rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent,
|
rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector,
|
||||||
|
HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent),
|
||||||
false, *gl_frontsector->lightlist[light].extra_colormap);
|
false, *gl_frontsector->lightlist[light].extra_colormap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWR_GetLevelFlat(&levelflats[*rover->toppic]);
|
HWR_GetLevelFlat(&levelflats[*rover->toppic]);
|
||||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
||||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic],
|
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic],
|
||||||
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,6 +196,7 @@ enum ffloor_e {
|
||||||
ffloor_next,
|
ffloor_next,
|
||||||
ffloor_prev,
|
ffloor_prev,
|
||||||
ffloor_alpha,
|
ffloor_alpha,
|
||||||
|
ffloor_blend,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const ffloor_opt[] = {
|
static const char *const ffloor_opt[] = {
|
||||||
|
@ -214,6 +215,7 @@ static const char *const ffloor_opt[] = {
|
||||||
"next",
|
"next",
|
||||||
"prev",
|
"prev",
|
||||||
"alpha",
|
"alpha",
|
||||||
|
"blend",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
#ifdef HAVE_LUA_SEGS
|
#ifdef HAVE_LUA_SEGS
|
||||||
|
@ -1807,6 +1809,9 @@ static int ffloor_get(lua_State *L)
|
||||||
case ffloor_alpha:
|
case ffloor_alpha:
|
||||||
lua_pushinteger(L, ffloor->alpha);
|
lua_pushinteger(L, ffloor->alpha);
|
||||||
return 1;
|
return 1;
|
||||||
|
case ffloor_blend:
|
||||||
|
lua_pushinteger(L, ffloor->blend);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1885,6 +1890,9 @@ static int ffloor_set(lua_State *L)
|
||||||
case ffloor_alpha:
|
case ffloor_alpha:
|
||||||
ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
|
ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
|
case ffloor_blend:
|
||||||
|
ffloor->blend = (INT32)luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1350,8 +1350,11 @@ static void P_LoadSidedefs(UINT8 *data)
|
||||||
if (msd->toptexture[0] == '#')
|
if (msd->toptexture[0] == '#')
|
||||||
{
|
{
|
||||||
char *col = msd->toptexture;
|
char *col = msd->toptexture;
|
||||||
sd->toptexture = sd->bottomtexture =
|
sd->toptexture =
|
||||||
((col[1]-'0')*100 + (col[2]-'0')*10 + col[3]-'0') + 1;
|
((col[1]-'0')*100 + (col[2]-'0')*10 + col[3]-'0')+1;
|
||||||
|
if (col[4]) // extra num for blendmode
|
||||||
|
sd->toptexture += (col[4]-'0')*1000;
|
||||||
|
sd->bottomtexture = sd->toptexture;
|
||||||
sd->midtexture = R_TextureNumForName(msd->midtexture);
|
sd->midtexture = R_TextureNumForName(msd->midtexture);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3314,22 +3317,30 @@ static void P_ConvertBinaryMap(void)
|
||||||
lines[i].args[4] |= TMSC_BACKTOFRONTCEILING;
|
lines[i].args[4] |= TMSC_BACKTOFRONTCEILING;
|
||||||
lines[i].special = 720;
|
lines[i].special = 720;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 900: //Translucent wall (10%)
|
|
||||||
case 901: //Translucent wall (20%)
|
|
||||||
case 902: //Translucent wall (30%)
|
|
||||||
case 903: //Translucent wall (40%)
|
|
||||||
case 904: //Translucent wall (50%)
|
|
||||||
case 905: //Translucent wall (60%)
|
|
||||||
case 906: //Translucent wall (70%)
|
|
||||||
case 907: //Translucent wall (80%)
|
|
||||||
case 908: //Translucent wall (90%)
|
|
||||||
lines[i].alpha = ((909 - lines[i].special) << FRACBITS)/10;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set alpha for translucent walls
|
||||||
|
if (lines[i].special >= 900 && lines[i].special < 909)
|
||||||
|
lines[i].alpha = ((909 - lines[i].special) << FRACBITS)/10;
|
||||||
|
|
||||||
|
// Set alpha for additive/subtractive/reverse subtractive walls
|
||||||
|
if (lines[i].special >= 910 && lines[i].special <= 939)
|
||||||
|
lines[i].alpha = ((10 - lines[i].special % 10) << FRACBITS)/10;
|
||||||
|
|
||||||
|
if (lines[i].special >= 910 && lines[i].special <= 919) // additive
|
||||||
|
lines[i].blendmode = AST_ADD;
|
||||||
|
|
||||||
|
if (lines[i].special >= 920 && lines[i].special <= 929) // subtractive
|
||||||
|
lines[i].blendmode = AST_SUBTRACT;
|
||||||
|
|
||||||
|
if (lines[i].special >= 930 && lines[i].special <= 939) // reverse subtractive
|
||||||
|
lines[i].blendmode = AST_REVERSESUBTRACT;
|
||||||
|
|
||||||
|
if (lines[i].special == 940) // modulate
|
||||||
|
lines[i].blendmode = AST_MODULATE;
|
||||||
|
|
||||||
//Linedef executor delay
|
//Linedef executor delay
|
||||||
if (lines[i].special >= 400 && lines[i].special < 500)
|
if (lines[i].special >= 400 && lines[i].special < 500)
|
||||||
{
|
{
|
||||||
|
|
11
src/p_spec.c
11
src/p_spec.c
|
@ -5601,7 +5601,16 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||||
if (flags & FF_TRANSLUCENT)
|
if (flags & FF_TRANSLUCENT)
|
||||||
{
|
{
|
||||||
if (sides[master->sidenum[0]].toptexture > 0)
|
if (sides[master->sidenum[0]].toptexture > 0)
|
||||||
fflr->alpha = sides[master->sidenum[0]].toptexture; // for future reference, "#0" is 1, and "#255" is 256. Be warned
|
{
|
||||||
|
// for future reference, "#0" is 1, and "#255" is 256. Be warned
|
||||||
|
fflr->alpha = sides[master->sidenum[0]].toptexture;
|
||||||
|
|
||||||
|
if (fflr->alpha >= 1001) // fourth digit
|
||||||
|
{
|
||||||
|
fflr->blend = (fflr->alpha/1000)+1; // becomes an AST
|
||||||
|
fflr->alpha %= 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fflr->alpha = 0x80;
|
fflr->alpha = 0x80;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,6 +184,7 @@ typedef struct ffloor_s
|
||||||
|
|
||||||
INT32 lastlight;
|
INT32 lastlight;
|
||||||
INT32 alpha;
|
INT32 alpha;
|
||||||
|
UINT8 blend; // blendmode
|
||||||
tic_t norender; // for culling
|
tic_t norender; // for culling
|
||||||
|
|
||||||
// these are saved for netgames, so do not let Lua touch these!
|
// these are saved for netgames, so do not let Lua touch these!
|
||||||
|
@ -397,6 +398,7 @@ typedef struct line_s
|
||||||
// Visual appearance: sidedefs.
|
// Visual appearance: sidedefs.
|
||||||
UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided
|
UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided
|
||||||
fixed_t alpha; // translucency
|
fixed_t alpha; // translucency
|
||||||
|
UINT8 blendmode; // blendmode
|
||||||
INT32 executordelay;
|
INT32 executordelay;
|
||||||
|
|
||||||
fixed_t bbox[4]; // bounding box for the extent of the linedef
|
fixed_t bbox[4]; // bounding box for the extent of the linedef
|
||||||
|
|
|
@ -248,6 +248,9 @@ static void BlendTab_Subtractive(UINT8 *table, int style, UINT8 blendamt)
|
||||||
result.s.green = max(0, result.s.green - blendamt);
|
result.s.green = max(0, result.s.green - blendamt);
|
||||||
result.s.blue = max(0, result.s.blue - blendamt);
|
result.s.blue = max(0, result.s.blue - blendamt);
|
||||||
|
|
||||||
|
//probably incorrect, but does look better at lower opacity...
|
||||||
|
//result.rgba = ASTBlendPixel(result, frontrgba, AST_TRANSLUCENT, blendamt);
|
||||||
|
|
||||||
table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue);
|
table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -855,28 +855,16 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
spanfunctype = (pl->ffloor->master->flags & ML_EFFECT6) ? SPANDRAWFUNC_TRANSSPLAT : SPANDRAWFUNC_TRANS;
|
spanfunctype = (pl->ffloor->master->flags & ML_EFFECT6) ? SPANDRAWFUNC_TRANSSPLAT : SPANDRAWFUNC_TRANS;
|
||||||
|
|
||||||
// Hacked up support for alpha value in software mode Tails 09-24-2002
|
// Hacked up support for alpha value in software mode Tails 09-24-2002
|
||||||
if (pl->ffloor->alpha < 12)
|
// ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021
|
||||||
return; // Don't even draw it
|
{
|
||||||
else if (pl->ffloor->alpha < 38)
|
INT32 trans = (10*((256+12) - pl->ffloor->alpha))/255;
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans90);
|
if (trans >= 10)
|
||||||
else if (pl->ffloor->alpha < 64)
|
return; // Don't even draw it
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans80);
|
if (pl->ffloor->blend) // additive, (reverse) subtractive, modulative
|
||||||
else if (pl->ffloor->alpha < 89)
|
ds_transmap = R_GetBlendTable(pl->ffloor->blend, trans);
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans70);
|
else if (!(ds_transmap = R_GetTranslucencyTable(trans)))
|
||||||
else if (pl->ffloor->alpha < 115)
|
spanfunctype = SPANDRAWFUNC_SPLAT; // Opaque, but allow transparent flat pixels
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans60);
|
}
|
||||||
else if (pl->ffloor->alpha < 140)
|
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans50);
|
|
||||||
else if (pl->ffloor->alpha < 166)
|
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans40);
|
|
||||||
else if (pl->ffloor->alpha < 192)
|
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans30);
|
|
||||||
else if (pl->ffloor->alpha < 217)
|
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans20);
|
|
||||||
else if (pl->ffloor->alpha < 243)
|
|
||||||
ds_transmap = R_GetTranslucencyTable(tr_trans10);
|
|
||||||
else // Opaque, but allow transparent flat pixels
|
|
||||||
spanfunctype = SPANDRAWFUNC_SPLAT;
|
|
||||||
|
|
||||||
if ((spanfunctype == SPANDRAWFUNC_SPLAT) || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG)))
|
if ((spanfunctype == SPANDRAWFUNC_SPLAT) || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG)))
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||||
|
|
43
src/r_segs.c
43
src/r_segs.c
|
@ -155,11 +155,18 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
||||||
if (!ldef->alpha)
|
if (!ldef->alpha)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ldef->alpha > 0 && ldef->alpha < FRACUNIT)
|
if (ldef->blendmode)
|
||||||
|
{
|
||||||
|
if (ldef->alpha == NUMTRANSMAPS || ldef->blendmode == AST_MODULATE)
|
||||||
|
dc_transmap = R_GetBlendTable(ldef->blendmode, 0);
|
||||||
|
else
|
||||||
|
dc_transmap = R_GetBlendTable(ldef->blendmode, R_GetLinedefTransTable(ldef->alpha));
|
||||||
|
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||||
|
}
|
||||||
|
else if (ldef->alpha > 0 && ldef->alpha < FRACUNIT)
|
||||||
{
|
{
|
||||||
dc_transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha));
|
dc_transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha));
|
||||||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ldef->special == 909)
|
else if (ldef->special == 909)
|
||||||
{
|
{
|
||||||
|
@ -600,28 +607,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
boolean fuzzy = true;
|
boolean fuzzy = true;
|
||||||
|
|
||||||
// Hacked up support for alpha value in software mode Tails 09-24-2002
|
// Hacked up support for alpha value in software mode Tails 09-24-2002
|
||||||
if (pfloor->alpha < 12)
|
// ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021
|
||||||
return; // Don't even draw it
|
{
|
||||||
else if (pfloor->alpha < 38)
|
INT32 trans = (10*((256+12) - pfloor->alpha))/255;
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans90);
|
if (trans >= 10)
|
||||||
else if (pfloor->alpha < 64)
|
return; // Don't even draw it
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans80);
|
if (pfloor->blend) // additive, (reverse) subtractive, modulative
|
||||||
else if (pfloor->alpha < 89)
|
dc_transmap = R_GetBlendTable(pfloor->blend, trans);
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans70);
|
else if (!(dc_transmap = R_GetTranslucencyTable(trans)))
|
||||||
else if (pfloor->alpha < 115)
|
fuzzy = false; // Opaque
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans60);
|
}
|
||||||
else if (pfloor->alpha < 140)
|
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans50);
|
|
||||||
else if (pfloor->alpha < 166)
|
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans40);
|
|
||||||
else if (pfloor->alpha < 192)
|
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans30);
|
|
||||||
else if (pfloor->alpha < 217)
|
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans20);
|
|
||||||
else if (pfloor->alpha < 243)
|
|
||||||
dc_transmap = R_GetTranslucencyTable(tr_trans10);
|
|
||||||
else
|
|
||||||
fuzzy = false; // Opaque
|
|
||||||
|
|
||||||
if (fuzzy)
|
if (fuzzy)
|
||||||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||||
|
|
Loading…
Reference in a new issue