Fix uninitialized bSky

This commit is contained in:
RaveYard 2023-08-30 18:01:22 +02:00 committed by Christoph Oelckers
parent 34f8b8524b
commit ff7dff993d
2 changed files with 11 additions and 5 deletions

View file

@ -154,6 +154,7 @@ void DoomLevelMesh::CreateSideSurfaces(FLevelLocals &doomMap, side_t *side)
surf.type = ST_MIDDLEWALL;
surf.typeIndex = typeIndex;
surf.controlSector = xfloor->model;
surf.bSky = false;
FVector3 verts[4];
verts[0].X = verts[2].X = v2.X;
@ -213,6 +214,7 @@ void DoomLevelMesh::CreateSideSurfaces(FLevelLocals &doomMap, side_t *side)
surf.plane = ToPlane(verts[0], verts[1], verts[2]);
surf.type = ST_LOWERWALL;
surf.typeIndex = typeIndex;
surf.bSky = false;
surf.controlSector = nullptr;
Surfaces.Push(surf);
@ -265,6 +267,7 @@ void DoomLevelMesh::CreateSideSurfaces(FLevelLocals &doomMap, side_t *side)
if (back == nullptr)
{
Surface surf;
surf.bSky = false;
FVector3 verts[4];
verts[0].X = verts[2].X = v1.X;
@ -278,6 +281,7 @@ void DoomLevelMesh::CreateSideSurfaces(FLevelLocals &doomMap, side_t *side)
surf.startVertIndex = MeshVertices.Size();
surf.numVerts = 4;
surf.bSky = false;
MeshVertices.Push(verts[0]);
MeshVertices.Push(verts[1]);
MeshVertices.Push(verts[2]);
@ -295,6 +299,7 @@ void DoomLevelMesh::CreateSideSurfaces(FLevelLocals &doomMap, side_t *side)
void DoomLevelMesh::CreateFloorSurface(FLevelLocals &doomMap, subsector_t *sub, sector_t *sector, int typeIndex, bool is3DFloor)
{
Surface surf;
surf.bSky = IsSkySector(sector, sector_t::floor);
if (!is3DFloor)
{
@ -331,7 +336,7 @@ void DoomLevelMesh::CreateFloorSurface(FLevelLocals &doomMap, subsector_t *sub,
void DoomLevelMesh::CreateCeilingSurface(FLevelLocals &doomMap, subsector_t *sub, sector_t *sector, int typeIndex, bool is3DFloor)
{
Surface surf;
surf.bSky = IsSkySector(sector);
surf.bSky = IsSkySector(sector, sector_t::ceiling);
if (!is3DFloor)
{
@ -393,7 +398,7 @@ void DoomLevelMesh::CreateSubsectorSurfaces(FLevelLocals &doomMap)
bool DoomLevelMesh::IsTopSideSky(sector_t* frontsector, sector_t* backsector, side_t* side)
{
return IsSkySector(frontsector) && IsSkySector(backsector);
return IsSkySector(frontsector, sector_t::ceiling) && IsSkySector(backsector, sector_t::ceiling);
}
bool DoomLevelMesh::IsTopSideVisible(side_t* side)
@ -408,9 +413,10 @@ bool DoomLevelMesh::IsBottomSideVisible(side_t* side)
return tex && tex->isValid();
}
bool DoomLevelMesh::IsSkySector(sector_t* sector)
bool DoomLevelMesh::IsSkySector(sector_t* sector, int plane)
{
return sector->GetTexture(sector_t::ceiling) == skyflatnum;
// plane is either sector_t::ceiling or sector_t::floor
return sector->GetTexture(plane) == skyflatnum;
}
bool DoomLevelMesh::IsControlSector(sector_t* sector)

View file

@ -49,7 +49,7 @@ private:
static bool IsTopSideSky(sector_t* frontsector, sector_t* backsector, side_t* side);
static bool IsTopSideVisible(side_t* side);
static bool IsBottomSideVisible(side_t* side);
static bool IsSkySector(sector_t* sector);
static bool IsSkySector(sector_t* sector, int plane);
static bool IsControlSector(sector_t* sector);
static secplane_t ToPlane(const FVector3& pt1, const FVector3& pt2, const FVector3& pt3)