mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-01-24 00:31:07 +00:00
Update CheckSkySectors to consider floors
This commit is contained in:
parent
3e701313dc
commit
867af9edcc
3 changed files with 42 additions and 19 deletions
|
@ -120,6 +120,12 @@ struct MapSector
|
|||
short tag;
|
||||
};
|
||||
|
||||
enum SecPlaneType
|
||||
{
|
||||
PLANE_FLOOR,
|
||||
PLANE_CEILING,
|
||||
};
|
||||
|
||||
struct IntSector
|
||||
{
|
||||
// none of the sector properties are used by the node builder
|
||||
|
@ -140,7 +146,14 @@ struct IntSector
|
|||
|
||||
bool controlsector;
|
||||
TArray<IntSector*> x3dfloors;
|
||||
bool skySector;
|
||||
|
||||
union
|
||||
{
|
||||
bool skyPlanes[2];
|
||||
struct { bool skyFloor, skyCeiling; };
|
||||
};
|
||||
|
||||
inline const char* GetTextureName(int plane) const { return plane != PLANE_FLOOR ? data.ceilingpic : data.floorpic; }
|
||||
|
||||
TArray<UDMFKey> props;
|
||||
|
||||
|
|
|
@ -124,23 +124,21 @@ void FLevel::SetupLights()
|
|||
|
||||
void FLevel::CheckSkySectors()
|
||||
{
|
||||
char name[65];
|
||||
|
||||
for (int i = 0; i < (int)Sectors.Size(); ++i)
|
||||
for (auto& sector : Sectors)
|
||||
{
|
||||
//if (mapDef && mapDef->sunIgnoreTag != 0 && Sectors[i].data.tag == mapDef->sunIgnoreTag)
|
||||
// continue;
|
||||
|
||||
strncpy(name, Sectors[i].data.ceilingpic, 64);
|
||||
name[64] = 0;
|
||||
|
||||
if (!strncmp(name, "F_SKY001", 64) || !strncmp(name, "F_SKY1", 64) || !strncmp(name, "F_SKY", 64))
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
Sectors[i].skySector = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Sectors[i].skySector = false;
|
||||
sector.skyPlanes[i] = false;
|
||||
|
||||
//if (mapDef && mapDef->sunIgnoreTag != 0 && sector.data.tag == mapDef->sunIgnoreTag)
|
||||
// continue;
|
||||
|
||||
const auto name = sector.GetTextureName(i);
|
||||
|
||||
if (!strncmp(name, "F_SKY001", 64) || !strncmp(name, "F_SKY1", 64) || !strncmp(name, "F_SKY", 64))
|
||||
{
|
||||
sector.skyPlanes[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -570,7 +570,17 @@ void LevelMesh::CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
|
|||
// bottom seg
|
||||
if (v1Bottom < v1BottomBack || v2Bottom < v2BottomBack)
|
||||
{
|
||||
if (side->bottomtexture[0] != '-')
|
||||
bool bSky = false;
|
||||
|
||||
if (front->skyFloor && back->skyFloor)
|
||||
{
|
||||
if (front->data.floorheight != back->data.floorheight && side->bottomtexture[0] == '-')
|
||||
{
|
||||
bSky = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (side->bottomtexture[0] != '-' || bSky)
|
||||
{
|
||||
float texWidth = 128.0f;
|
||||
float texHeight = 128.0f;
|
||||
|
@ -593,6 +603,7 @@ void LevelMesh::CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
|
|||
surf->plane.SetDistance(surf->verts[0]);
|
||||
surf->type = ST_LOWERSIDE;
|
||||
surf->typeIndex = typeIndex;
|
||||
surf->bSky = bSky;
|
||||
surf->controlSector = nullptr;
|
||||
surf->sampleDimension = (surf->sampleDimension = side->GetSampleDistanceBottom()) ? surf->sampleDimension : defaultSamples;
|
||||
|
||||
|
@ -620,7 +631,7 @@ void LevelMesh::CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
|
|||
{
|
||||
bool bSky = false;
|
||||
|
||||
if (front->skySector && back->skySector)
|
||||
if (front->skyCeiling && back->skyCeiling)
|
||||
{
|
||||
if (front->data.ceilingheight != back->data.ceilingheight && side->toptexture[0] == '-')
|
||||
{
|
||||
|
@ -726,6 +737,7 @@ void LevelMesh::CreateFloorSurface(FLevel &doomMap, MapSubsectorEx *sub, IntSect
|
|||
surf->numVerts = sub->numlines;
|
||||
surf->verts.resize(surf->numVerts);
|
||||
surf->uvs.resize(surf->numVerts);
|
||||
surf->bSky = sector->skyFloor;
|
||||
|
||||
if (!is3DFloor)
|
||||
{
|
||||
|
@ -764,7 +776,7 @@ void LevelMesh::CreateCeilingSurface(FLevel &doomMap, MapSubsectorEx *sub, IntSe
|
|||
surf->numVerts = sub->numlines;
|
||||
surf->verts.resize(surf->numVerts);
|
||||
surf->uvs.resize(surf->numVerts);
|
||||
surf->bSky = sector->skySector;
|
||||
surf->bSky = sector->skyCeiling;
|
||||
|
||||
if (!is3DFloor)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue