mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'fof-rendering-mishaps' into 'next'
Fix a couple of FOF rendering issues See merge request STJr/SRB2!2115
This commit is contained in:
commit
4a89fc77c1
2 changed files with 33 additions and 38 deletions
|
@ -1699,7 +1699,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend)
|
if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend)
|
||||||
{
|
{
|
||||||
blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : 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 = max(0, min(rover->alpha, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_frontsector->numlights)
|
if (gl_frontsector->numlights)
|
||||||
|
@ -1822,7 +1822,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend)
|
if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend)
|
||||||
{
|
{
|
||||||
blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : 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 = max(0, min(rover->alpha, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_backsector->numlights)
|
if (gl_backsector->numlights)
|
||||||
|
@ -3095,7 +3095,7 @@ 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,
|
max(0, min(rover->alpha, 255)), rover->master->frontsector,
|
||||||
HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent),
|
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);
|
||||||
}
|
}
|
||||||
|
@ -3141,7 +3141,7 @@ 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,
|
max(0, min(rover->alpha, 255)), rover->master->frontsector,
|
||||||
HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent),
|
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);
|
||||||
}
|
}
|
||||||
|
|
63
src/p_spec.c
63
src/p_spec.c
|
@ -3286,19 +3286,18 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
foundrover = true;
|
foundrover = true;
|
||||||
|
|
||||||
// If fading an invisible FOF whose render flags we did not yet set,
|
// If fading an invisible FOF whose render flags we did not yet set,
|
||||||
// initialize its alpha to 1
|
// initialize its alpha to 0 for relative alpha calculation
|
||||||
// for relative alpha calc
|
|
||||||
if (!(line->args[3] & TMST_DONTDOTRANSLUCENT) && // do translucent
|
if (!(line->args[3] & TMST_DONTDOTRANSLUCENT) && // do translucent
|
||||||
(rover->spawnflags & FOF_NOSHADE) && // do not include light blocks, which don't set FOF_NOSHADE
|
(rover->spawnflags & FOF_NOSHADE) && // do not include light blocks, which don't set FOF_NOSHADE
|
||||||
!(rover->spawnflags & FOF_RENDERSIDES) &&
|
!(rover->spawnflags & FOF_RENDERSIDES) &&
|
||||||
!(rover->spawnflags & FOF_RENDERPLANES) &&
|
!(rover->spawnflags & FOF_RENDERPLANES) &&
|
||||||
!(rover->fofflags & FOF_RENDERALL))
|
!(rover->fofflags & FOF_RENDERALL))
|
||||||
rover->alpha = 1;
|
rover->alpha = 0;
|
||||||
|
|
||||||
P_RemoveFakeFloorFader(rover);
|
P_RemoveFakeFloorFader(rover);
|
||||||
P_FadeFakeFloor(rover,
|
P_FadeFakeFloor(rover,
|
||||||
rover->alpha,
|
rover->alpha,
|
||||||
max(1, min(256, (line->args[3] & TMST_RELATIVE) ? rover->alpha + destvalue : destvalue)),
|
max(0, min(255, (line->args[3] & TMST_RELATIVE) ? rover->alpha + destvalue : destvalue)),
|
||||||
0, // set alpha immediately
|
0, // set alpha immediately
|
||||||
false, NULL, // tic-based logic
|
false, NULL, // tic-based logic
|
||||||
false, // do not handle FOF_EXISTS
|
false, // do not handle FOF_EXISTS
|
||||||
|
@ -3372,19 +3371,18 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If fading an invisible FOF whose render flags we did not yet set,
|
// If fading an invisible FOF whose render flags we did not yet set,
|
||||||
// initialize its alpha to 1
|
// initialize its alpha to 1 for relative alpha calculation
|
||||||
// for relative alpha calc
|
|
||||||
if (!(line->args[4] & TMFT_DONTDOTRANSLUCENT) && // do translucent
|
if (!(line->args[4] & TMFT_DONTDOTRANSLUCENT) && // do translucent
|
||||||
(rover->spawnflags & FOF_NOSHADE) && // do not include light blocks, which don't set FOF_NOSHADE
|
(rover->spawnflags & FOF_NOSHADE) && // do not include light blocks, which don't set FOF_NOSHADE
|
||||||
!(rover->spawnflags & FOF_RENDERSIDES) &&
|
!(rover->spawnflags & FOF_RENDERSIDES) &&
|
||||||
!(rover->spawnflags & FOF_RENDERPLANES) &&
|
!(rover->spawnflags & FOF_RENDERPLANES) &&
|
||||||
!(rover->fofflags & FOF_RENDERALL))
|
!(rover->fofflags & FOF_RENDERALL))
|
||||||
rover->alpha = 1;
|
rover->alpha = 0;
|
||||||
|
|
||||||
P_RemoveFakeFloorFader(rover);
|
P_RemoveFakeFloorFader(rover);
|
||||||
P_FadeFakeFloor(rover,
|
P_FadeFakeFloor(rover,
|
||||||
rover->alpha,
|
rover->alpha,
|
||||||
max(1, min(256, (line->args[4] & TMFT_RELATIVE) ? rover->alpha + destvalue : destvalue)),
|
max(0, min(255, (line->args[4] & TMFT_RELATIVE) ? rover->alpha + destvalue : destvalue)),
|
||||||
0, // set alpha immediately
|
0, // set alpha immediately
|
||||||
false, NULL, // tic-based logic
|
false, NULL, // tic-based logic
|
||||||
!(line->args[4] & TMFT_DONTDOEXISTS), // do not handle FOF_EXISTS
|
!(line->args[4] & TMFT_DONTDOEXISTS), // do not handle FOF_EXISTS
|
||||||
|
@ -6565,10 +6563,10 @@ void P_SpawnSpecials(boolean fromnetsave)
|
||||||
//Cutting options
|
//Cutting options
|
||||||
if (ffloorflags & FOF_RENDERALL)
|
if (ffloorflags & FOF_RENDERALL)
|
||||||
{
|
{
|
||||||
//If inside is visible, cut inner walls
|
//If inside is visible from the outside, cut inner walls
|
||||||
if ((lines[i].args[1] < 255) || (lines[i].args[3] & TMFA_SPLAT) || (lines[i].args[4] & TMFT_VISIBLEFROMINSIDE))
|
if (lines[i].args[1] < 255 || (lines[i].args[3] & TMFA_SPLAT))
|
||||||
ffloorflags |= FOF_CUTEXTRA|FOF_EXTRA;
|
ffloorflags |= FOF_CUTEXTRA|FOF_EXTRA;
|
||||||
else
|
else if (!(lines[i].args[4] & TMFT_VISIBLEFROMINSIDE))
|
||||||
ffloorflags |= FOF_CUTLEVEL;
|
ffloorflags |= FOF_CUTLEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6624,20 +6622,19 @@ void P_SpawnSpecials(boolean fromnetsave)
|
||||||
if (lines[i].args[4] & TMFC_SPLAT)
|
if (lines[i].args[4] & TMFC_SPLAT)
|
||||||
ffloorflags |= FOF_SPLAT;
|
ffloorflags |= FOF_SPLAT;
|
||||||
|
|
||||||
//If inside is visible, cut inner walls
|
//If inside is visible from the outside, cut inner walls
|
||||||
if (lines[i].args[1] < 0xff || (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE) || (lines[i].args[4] & TMFC_SPLAT))
|
if (lines[i].args[1] < 255 || (lines[i].args[4] & TMFC_SPLAT))
|
||||||
ffloorflags |= FOF_CUTEXTRA|FOF_EXTRA;
|
ffloorflags |= FOF_CUTEXTRA|FOF_EXTRA;
|
||||||
else
|
//If player can view it from the inside, render insides
|
||||||
ffloorflags |= FOF_CUTLEVEL;
|
else if (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE)
|
||||||
|
|
||||||
//If player can enter it, render insides
|
|
||||||
if (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE)
|
|
||||||
{
|
{
|
||||||
if (ffloorflags & FOF_RENDERPLANES)
|
if (ffloorflags & FOF_RENDERPLANES)
|
||||||
ffloorflags |= FOF_BOTHPLANES;
|
ffloorflags |= FOF_BOTHPLANES;
|
||||||
if (ffloorflags & FOF_RENDERSIDES)
|
if (ffloorflags & FOF_RENDERSIDES)
|
||||||
ffloorflags |= FOF_ALLSIDES;
|
ffloorflags |= FOF_ALLSIDES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ffloorflags |= FOF_CUTLEVEL;
|
||||||
|
|
||||||
P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers);
|
P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers);
|
||||||
if (lines[i].args[4] & TMFC_AIRBOB)
|
if (lines[i].args[4] & TMFC_AIRBOB)
|
||||||
|
@ -6688,10 +6685,10 @@ void P_SpawnSpecials(boolean fromnetsave)
|
||||||
//Cutting options
|
//Cutting options
|
||||||
if (ffloorflags & FOF_RENDERALL)
|
if (ffloorflags & FOF_RENDERALL)
|
||||||
{
|
{
|
||||||
//If inside is visible, cut inner walls
|
//If inside is visible from the outside, cut inner walls
|
||||||
if ((lines[i].args[1] < 255) || (lines[i].args[3] & TMFA_SPLAT) || (lines[i].args[4] & TMFT_VISIBLEFROMINSIDE))
|
if (lines[i].args[1] < 255 || (lines[i].args[3] & TMFA_SPLAT))
|
||||||
ffloorflags |= FOF_CUTEXTRA|FOF_EXTRA;
|
ffloorflags |= FOF_CUTEXTRA|FOF_EXTRA;
|
||||||
else
|
else if (!(lines[i].args[4] & TMFT_VISIBLEFROMINSIDE))
|
||||||
ffloorflags |= FOF_CUTLEVEL;
|
ffloorflags |= FOF_CUTLEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7756,15 +7753,14 @@ static boolean P_FadeFakeFloor(ffloor_t *rover, INT16 sourcevalue, INT16 destval
|
||||||
if (rover->master->special == 258) // Laser block
|
if (rover->master->special == 258) // Laser block
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If fading an invisible FOF whose render flags we did not yet set,
|
// If fading an invisible FOF whose render flags we did not yet set, initialize its alpha to 1
|
||||||
// initialize its alpha to 1
|
|
||||||
if (dotranslucent &&
|
if (dotranslucent &&
|
||||||
(rover->spawnflags & FOF_NOSHADE) && // do not include light blocks, which don't set FOF_NOSHADE
|
(rover->spawnflags & FOF_NOSHADE) && // do not include light blocks, which don't set FOF_NOSHADE
|
||||||
!(rover->fofflags & FOF_FOG) && // do not include fog
|
!(rover->fofflags & FOF_FOG) && // do not include fog
|
||||||
!(rover->spawnflags & FOF_RENDERSIDES) &&
|
!(rover->spawnflags & FOF_RENDERSIDES) &&
|
||||||
!(rover->spawnflags & FOF_RENDERPLANES) &&
|
!(rover->spawnflags & FOF_RENDERPLANES) &&
|
||||||
!(rover->fofflags & FOF_RENDERALL))
|
!(rover->fofflags & FOF_RENDERALL))
|
||||||
rover->alpha = 1;
|
rover->alpha = 0;
|
||||||
|
|
||||||
if (fadingdata)
|
if (fadingdata)
|
||||||
alpha = fadingdata->alpha;
|
alpha = fadingdata->alpha;
|
||||||
|
@ -7850,7 +7846,7 @@ static boolean P_FadeFakeFloor(ffloor_t *rover, INT16 sourcevalue, INT16 destval
|
||||||
{
|
{
|
||||||
if (doexists && !(rover->spawnflags & FOF_BUSTUP))
|
if (doexists && !(rover->spawnflags & FOF_BUSTUP))
|
||||||
{
|
{
|
||||||
if (alpha <= 1)
|
if (alpha <= 0)
|
||||||
rover->fofflags &= ~FOF_EXISTS;
|
rover->fofflags &= ~FOF_EXISTS;
|
||||||
else
|
else
|
||||||
rover->fofflags |= FOF_EXISTS;
|
rover->fofflags |= FOF_EXISTS;
|
||||||
|
@ -7862,7 +7858,7 @@ static boolean P_FadeFakeFloor(ffloor_t *rover, INT16 sourcevalue, INT16 destval
|
||||||
|
|
||||||
if (dotranslucent && !(rover->fofflags & FOF_FOG))
|
if (dotranslucent && !(rover->fofflags & FOF_FOG))
|
||||||
{
|
{
|
||||||
if (alpha >= 256)
|
if (alpha >= 255)
|
||||||
{
|
{
|
||||||
if (!(rover->fofflags & FOF_CUTSOLIDS) &&
|
if (!(rover->fofflags & FOF_CUTSOLIDS) &&
|
||||||
(rover->spawnflags & FOF_CUTSOLIDS))
|
(rover->spawnflags & FOF_CUTSOLIDS))
|
||||||
|
@ -7962,11 +7958,11 @@ static boolean P_FadeFakeFloor(ffloor_t *rover, INT16 sourcevalue, INT16 destval
|
||||||
else // clamp fadingdata->alpha to software's alpha levels
|
else // clamp fadingdata->alpha to software's alpha levels
|
||||||
{
|
{
|
||||||
if (alpha < 12)
|
if (alpha < 12)
|
||||||
rover->alpha = destvalue < 12 ? destvalue : 1; // Don't even draw it
|
rover->alpha = destvalue < 12 ? destvalue : 0; // Don't even draw it
|
||||||
else if (alpha < 38)
|
else if (alpha < 38)
|
||||||
rover->alpha = destvalue >= 12 && destvalue < 38 ? destvalue : 25;
|
rover->alpha = destvalue >= 12 && destvalue < 38 ? destvalue : 25;
|
||||||
else if (alpha < 64)
|
else if (alpha < 64)
|
||||||
rover->alpha = destvalue >=38 && destvalue < 64 ? destvalue : 51;
|
rover->alpha = destvalue >= 38 && destvalue < 64 ? destvalue : 51;
|
||||||
else if (alpha < 89)
|
else if (alpha < 89)
|
||||||
rover->alpha = destvalue >= 64 && destvalue < 89 ? destvalue : 76;
|
rover->alpha = destvalue >= 64 && destvalue < 89 ? destvalue : 76;
|
||||||
else if (alpha < 115)
|
else if (alpha < 115)
|
||||||
|
@ -7982,7 +7978,7 @@ static boolean P_FadeFakeFloor(ffloor_t *rover, INT16 sourcevalue, INT16 destval
|
||||||
else if (alpha < 243)
|
else if (alpha < 243)
|
||||||
rover->alpha = destvalue >= 217 && destvalue < 243 ? destvalue : 230;
|
rover->alpha = destvalue >= 217 && destvalue < 243 ? destvalue : 230;
|
||||||
else // Opaque
|
else // Opaque
|
||||||
rover->alpha = destvalue >= 243 ? destvalue : 256;
|
rover->alpha = destvalue >= 243 ? destvalue : 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8012,17 +8008,16 @@ static void P_AddFakeFloorFader(ffloor_t *rover, size_t sectornum, size_t ffloor
|
||||||
{
|
{
|
||||||
fade_t *d;
|
fade_t *d;
|
||||||
|
|
||||||
// If fading an invisible FOF whose render flags we did not yet set,
|
// If fading an invisible FOF whose render flags we did not yet set, initialize its alpha to 1
|
||||||
// initialize its alpha to 1
|
|
||||||
if (dotranslucent &&
|
if (dotranslucent &&
|
||||||
(rover->spawnflags & FOF_NOSHADE) && // do not include light blocks, which don't set FOF_NOSHADE
|
(rover->spawnflags & FOF_NOSHADE) && // do not include light blocks, which don't set FOF_NOSHADE
|
||||||
!(rover->spawnflags & FOF_RENDERSIDES) &&
|
!(rover->spawnflags & FOF_RENDERSIDES) &&
|
||||||
!(rover->spawnflags & FOF_RENDERPLANES) &&
|
!(rover->spawnflags & FOF_RENDERPLANES) &&
|
||||||
!(rover->fofflags & FOF_RENDERALL))
|
!(rover->fofflags & FOF_RENDERALL))
|
||||||
rover->alpha = 1;
|
rover->alpha = 0;
|
||||||
|
|
||||||
// already equal, nothing to do
|
// already equal, nothing to do
|
||||||
if (rover->alpha == max(1, min(256, relative ? rover->alpha + destvalue : destvalue)))
|
if (rover->alpha == max(0, min(255, relative ? rover->alpha + destvalue : destvalue)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d = Z_Malloc(sizeof *d, PU_LEVSPEC, NULL);
|
d = Z_Malloc(sizeof *d, PU_LEVSPEC, NULL);
|
||||||
|
@ -8033,7 +8028,7 @@ static void P_AddFakeFloorFader(ffloor_t *rover, size_t sectornum, size_t ffloor
|
||||||
d->ffloornum = (UINT32)ffloornum;
|
d->ffloornum = (UINT32)ffloornum;
|
||||||
|
|
||||||
d->alpha = d->sourcevalue = rover->alpha;
|
d->alpha = d->sourcevalue = rover->alpha;
|
||||||
d->destvalue = max(1, min(256, relative ? rover->alpha + destvalue : destvalue)); // rover->alpha is 1-256
|
d->destvalue = max(0, min(255, relative ? rover->alpha + destvalue : destvalue)); // rover->alpha is 0-255
|
||||||
|
|
||||||
if (ticbased)
|
if (ticbased)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue