- fixed texture overlays for SW's sector portals.

This commit is contained in:
Christoph Oelckers 2021-03-30 23:27:11 +02:00
parent a84060fda7
commit 7bea8ad6ba
4 changed files with 78 additions and 18 deletions

View file

@ -29,7 +29,9 @@ enum
CSTAT_SECTOR_XFLIP = 16,
CSTAT_SECTOR_YFLIP = 32,
CSTAT_SECTOR_ALIGN = 64,
CSTAT_SECTOR_METHOD = 384
CSTAT_SECTOR_TRANS = 128,
CSTAT_SECTOR_TRANS_INVERT = 256,
CSTAT_SECTOR_METHOD = 384,
};
enum

View file

@ -257,6 +257,7 @@ public:
float alpha;
FRenderStyle RenderStyle;
int iboindex;
bool stack;
//int vboheight;
int plane;

View file

@ -287,16 +287,18 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which)
shade = clamp(frontsector->floorshade, 0, numshades-1);
palette = frontsector->floorpal;
stack = frontsector->portalflags == PORTAL_SECTOR_FLOOR || frontsector->portalflags == PORTAL_SECTOR_FLOOR_REFLECT;
//port = frontsector->ValidatePortal(sector_t::floor);
#if 0
if ((stack = (port != NULL)))
if (stack && (frontsector->floorstat & CSTAT_SECTOR_METHOD))
{
alpha = frontsector->GetAlpha(sector_t::floor);
RenderStyle = GetRenderStyle(0, !!(frontsector->floorstat & CSTAT_SECTOR_TRANS_INVERT));
alpha = GetAlphaFromBlend((frontsector->floorstat & CSTAT_SECTOR_TRANS_INVERT) ? DAMETH_TRANS2 : DAMETH_TRANS1, 0);
}
else
#endif
alpha = 1.0f;
{
RenderStyle = STYLE_Translucent;
alpha = 1.f;
}
if (alpha != 0.f)
{
@ -307,7 +309,6 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which)
if (texture && texture->isValid())
{
//iboindex = frontsector->iboindex[sector_t::floor];
RenderStyle = STYLE_Translucent;
PutFlat(di, 0);
}
}
@ -326,16 +327,19 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which)
shade = clamp(frontsector->ceilingshade, 0, numshades-1);
palette = frontsector->ceilingpal;
stack = frontsector->portalflags == PORTAL_SECTOR_CEILING || frontsector->portalflags == PORTAL_SECTOR_CEILING_REFLECT;
/*
port = frontsector->ValidatePortal(sector_t::ceiling);
if ((stack = (port != NULL)))
if (stack && (frontsector->ceilingstat & CSTAT_SECTOR_METHOD))
{
alpha = frontsector->GetAlpha(sector_t::ceiling);
RenderStyle = GetRenderStyle(0, !!(frontsector->ceilingstat & CSTAT_SECTOR_TRANS_INVERT));
alpha = GetAlphaFromBlend((frontsector->ceilingstat & CSTAT_SECTOR_TRANS_INVERT) ? DAMETH_TRANS2 : DAMETH_TRANS1, 0);
}
else*/
alpha = 1.0f;
else
{
RenderStyle = STYLE_Translucent;
alpha = 1.f;
}
if (alpha != 0.f)
{
@ -348,7 +352,6 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which)
if (texture && texture->isValid())
{
//iboindex = frontsector->iboindex[sector_t::floor];
RenderStyle = STYLE_Translucent;
PutFlat(di, 1);
}
}

View file

@ -1412,8 +1412,63 @@ void UpdateWallPortalState()
}
}
}
int i;
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while ((i = it.NextIndex()) >= 0)
{
if (SPRITE_TAG3(i) == 0)
{
// back up ceilingpicnum and ceilingstat
SPRITE_TAG5(i) = sector[sprite[i].sectnum].ceilingpicnum;
sector[sprite[i].sectnum].ceilingpicnum = SPRITE_TAG2(i);
SPRITE_TAG4(i) = sector[sprite[i].sectnum].ceilingstat;
//SET(sector[sprite[i].sectnum].ceilingstat, ((int)SPRITE_TAG7(i))<<7);
SET(sector[sprite[i].sectnum].ceilingstat, SPRITE_TAG6(i));
RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_PLAX);
}
else if (SPRITE_TAG3(i) == 1)
{
SPRITE_TAG5(i) = sector[sprite[i].sectnum].floorpicnum;
sector[sprite[i].sectnum].floorpicnum = SPRITE_TAG2(i);
SPRITE_TAG4(i) = sector[sprite[i].sectnum].floorstat;
//SET(sector[sprite[i].sectnum].floorstat, ((int)SPRITE_TAG7(i))<<7);
SET(sector[sprite[i].sectnum].floorstat, SPRITE_TAG6(i));
RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_PLAX);
}
}
}
void RestorePortalState()
{
int i;
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while ((i = it.NextIndex()) >= 0)
{
// manually set gotpic
if (TEST_GOTSECTOR(sprite[i].sectnum))
{
SET_GOTPIC(FAF_MIRROR_PIC);
}
if (SPRITE_TAG3(i) == 0)
{
// restore ceilingpicnum and ceilingstat
sector[sprite[i].sectnum].ceilingpicnum = SPRITE_TAG5(i);
sector[sprite[i].sectnum].ceilingstat = SPRITE_TAG4(i);
//RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_TYPE_MASK);
RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_PLAX);
}
else if (SPRITE_TAG3(i) == 1)
{
sector[sprite[i].sectnum].floorpicnum = SPRITE_TAG5(i);
sector[sprite[i].sectnum].floorstat = SPRITE_TAG4(i);
//RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_TYPE_MASK);
RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_PLAX);
}
}
}
void
drawscreen(PLAYERp pp, double smoothratio)
@ -1569,9 +1624,8 @@ drawscreen(PLAYERp pp, double smoothratio)
else
{
UpdateWallPortalState();
auto cstat = pp->SpriteP->cstat;
render_drawrooms(pp->SpriteP, { tx, ty, tz }, tsectnum, tang, thoriz, trotscrnang);
pp->SpriteP->cstat = cstat;
RestorePortalState();
}