- 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_XFLIP = 16,
CSTAT_SECTOR_YFLIP = 32, CSTAT_SECTOR_YFLIP = 32,
CSTAT_SECTOR_ALIGN = 64, CSTAT_SECTOR_ALIGN = 64,
CSTAT_SECTOR_METHOD = 384 CSTAT_SECTOR_TRANS = 128,
CSTAT_SECTOR_TRANS_INVERT = 256,
CSTAT_SECTOR_METHOD = 384,
}; };
enum enum

View file

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

View file

@ -287,16 +287,18 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which)
shade = clamp(frontsector->floorshade, 0, numshades-1); shade = clamp(frontsector->floorshade, 0, numshades-1);
palette = frontsector->floorpal; palette = frontsector->floorpal;
stack = frontsector->portalflags == PORTAL_SECTOR_FLOOR || frontsector->portalflags == PORTAL_SECTOR_FLOOR_REFLECT;
//port = frontsector->ValidatePortal(sector_t::floor); if (stack && (frontsector->floorstat & CSTAT_SECTOR_METHOD))
#if 0
if ((stack = (port != NULL)))
{ {
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 else
#endif {
alpha = 1.0f; RenderStyle = STYLE_Translucent;
alpha = 1.f;
}
if (alpha != 0.f) if (alpha != 0.f)
{ {
@ -307,7 +309,6 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which)
if (texture && texture->isValid()) if (texture && texture->isValid())
{ {
//iboindex = frontsector->iboindex[sector_t::floor]; //iboindex = frontsector->iboindex[sector_t::floor];
RenderStyle = STYLE_Translucent;
PutFlat(di, 0); PutFlat(di, 0);
} }
} }
@ -326,16 +327,19 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which)
shade = clamp(frontsector->ceilingshade, 0, numshades-1); shade = clamp(frontsector->ceilingshade, 0, numshades-1);
palette = frontsector->ceilingpal; palette = frontsector->ceilingpal;
stack = frontsector->portalflags == PORTAL_SECTOR_CEILING || frontsector->portalflags == PORTAL_SECTOR_CEILING_REFLECT;
if (stack && (frontsector->ceilingstat & CSTAT_SECTOR_METHOD))
/*
port = frontsector->ValidatePortal(sector_t::ceiling);
if ((stack = (port != NULL)))
{ {
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*/ else
alpha = 1.0f; {
RenderStyle = STYLE_Translucent;
alpha = 1.f;
}
if (alpha != 0.f) if (alpha != 0.f)
{ {
@ -348,7 +352,6 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which)
if (texture && texture->isValid()) if (texture && texture->isValid())
{ {
//iboindex = frontsector->iboindex[sector_t::floor]; //iboindex = frontsector->iboindex[sector_t::floor];
RenderStyle = STYLE_Translucent;
PutFlat(di, 1); 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 void
drawscreen(PLAYERp pp, double smoothratio) drawscreen(PLAYERp pp, double smoothratio)
@ -1569,9 +1624,8 @@ drawscreen(PLAYERp pp, double smoothratio)
else else
{ {
UpdateWallPortalState(); UpdateWallPortalState();
auto cstat = pp->SpriteP->cstat;
render_drawrooms(pp->SpriteP, { tx, ty, tz }, tsectnum, tang, thoriz, trotscrnang); render_drawrooms(pp->SpriteP, { tx, ty, tz }, tsectnum, tang, thoriz, trotscrnang);
pp->SpriteP->cstat = cstat; RestorePortalState();
} }