From 7b017f472aef982a0e4049809f4aefdeb57e6687 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 25 Nov 2015 11:49:34 +0100 Subject: [PATCH] - fixed: Due to the default skybox being moved to the global level data, there was insufficient information to distinguish between using the default skybox or the regular sky. Fixed by adding two new sector flags which get set by a 0-tid SkyPicker. --- src/g_shared/a_skies.cpp | 2 ++ src/p_sectors.cpp | 15 +++++++++++++++ src/r_bsp.cpp | 5 +++-- src/r_defs.h | 4 ++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/g_shared/a_skies.cpp b/src/g_shared/a_skies.cpp index d62a2a07b..54661ea14 100644 --- a/src/g_shared/a_skies.cpp +++ b/src/g_shared/a_skies.cpp @@ -186,10 +186,12 @@ void ASkyPicker::PostBeginPlay () if (0 == (args[1] & 2)) { Sector->CeilingSkyBox = box; + if (box == NULL) Sector->MoreFlags |= SECF_NOCEILINGSKYBOX; // sector should ignore the level's default skybox } if (0 == (args[1] & 1)) { Sector->FloorSkyBox = box; + if (box == NULL) Sector->MoreFlags |= SECF_NOFLOORSKYBOX; // sector should ignore the level's default skybox } } Destroy (); diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 904c76c1b..bc7abd380 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -29,6 +29,7 @@ #include "po_man.h" #include "farchive.h" #include "r_utility.h" +#include "a_sharedglobal.h" #include "r_data/colormaps.h" @@ -800,6 +801,20 @@ int sector_t::GetCeilingLight () const } } + +ASkyViewpoint *sector_t::GetSkyBox(int which) +{ + if (which == floor) + { + return FloorSkyBox != NULL ? FloorSkyBox : (MoreFlags & SECF_NOFLOORSKYBOX)? (ASkyViewpoint*)NULL : level.DefaultSkybox; + } + else + { + return CeilingSkyBox != NULL ? CeilingSkyBox : (MoreFlags & SECF_NOCEILINGSKYBOX)? (ASkyViewpoint*)NULL : level.DefaultSkybox; + } +} + + sector_t *sector_t::GetHeightSec() const { if (heightsec == NULL) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index bf0ac910f..545d009d9 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -1087,7 +1087,8 @@ void R_Subsector (subsector_t *sub) basecolormap = frontsector->ColorMap; } - skybox = frontsector->CeilingSkyBox != NULL ? frontsector->CeilingSkyBox : level.DefaultSkybox; + skybox = frontsector->GetSkyBox(sector_t::ceiling); + ceilingplane = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz) > 0 || frontsector->GetTexture(sector_t::ceiling) == skyflatnum || (skybox != NULL && skybox->bAlways) || @@ -1127,7 +1128,7 @@ void R_Subsector (subsector_t *sub) // killough 3/7/98: Add (x,y) offsets to flats, add deep water check // killough 3/16/98: add floorlightlevel // killough 10/98: add support for skies transferred from sidedefs - skybox = frontsector->FloorSkyBox != NULL ? frontsector->FloorSkyBox : level.DefaultSkybox; + skybox = frontsector->GetSkyBox(sector_t::floor); floorplane = frontsector->floorplane.PointOnSide(viewx, viewy, viewz) > 0 || // killough 3/7/98 frontsector->GetTexture(sector_t::floor) == skyflatnum || (skybox != NULL && skybox->bAlways) || diff --git a/src/r_defs.h b/src/r_defs.h index afda92089..a93622b41 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -340,6 +340,8 @@ enum SECF_UNDERWATERMASK = 32+64, SECF_DRAWN = 128, // sector has been drawn at least once SECF_HIDDEN = 256, // Do not draw on textured automap + SECF_NOFLOORSKYBOX = 512, // force use of regular sky + SECF_NOCEILINGSKYBOX = 1024, // force use of regular sky }; enum @@ -451,6 +453,8 @@ struct sector_t DInterpolation *SetInterpolation(int position, bool attach); void StopInterpolation(int position); + ASkyViewpoint *GetSkyBox(int which); + enum { floor,