mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- Instead of setting the default skybox in every sector without an explicit skybox set, set it
once in the level struct and then use that for sectors with a NULL skybox. This fixes zpack's E2M3 so that when it removes its sector stacks, you will get the default skybox in their place, since stacked sectors and skyboxes use the same pointers in a sector. SVN r4224 (trunk)
This commit is contained in:
parent
9f71c7cb4e
commit
92d54ca0fc
5 changed files with 23 additions and 18 deletions
|
@ -307,6 +307,7 @@ static void MarkRoot()
|
|||
DThinker::MarkRoots();
|
||||
FCanvasTextureInfo::Mark();
|
||||
Mark(DACSThinker::ActiveThinker);
|
||||
Mark(level.DefaultSkybox);
|
||||
// Mark dead bodies.
|
||||
for (i = 0; i < BODYQUESIZE; ++i)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
#include "d_netinf.h"
|
||||
#include "v_palette.h"
|
||||
#include "menu/menu.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "a_strifeglobal.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "farchive.h"
|
||||
|
@ -1272,6 +1273,7 @@ void G_InitLevelLocals ()
|
|||
NormalLight.ChangeFade (level.fadeto);
|
||||
|
||||
level.DefaultEnvironment = info->DefaultEnvironment;
|
||||
level.DefaultSkybox = NULL;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1435,6 +1437,11 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
|
|||
P_SerializeSubsectors(arc);
|
||||
StatusBar->Serialize (arc);
|
||||
|
||||
if (SaveVersion >= 4222)
|
||||
{ // This must be done *after* thinkers are serialized.
|
||||
arc << level.DefaultSkybox;
|
||||
}
|
||||
|
||||
arc << level.total_monsters << level.total_items << level.total_secrets;
|
||||
|
||||
// Does this level have custom translations?
|
||||
|
|
|
@ -426,6 +426,8 @@ struct FLevelLocals
|
|||
int airsupply;
|
||||
int DefaultEnvironment; // Default sound environment.
|
||||
|
||||
TObjPtr<class ASkyViewpoint> DefaultSkybox;
|
||||
|
||||
FSectorScrollValues *Scrolls; // NULL if no DScrollers in this level
|
||||
|
||||
SBYTE WallVertLight; // Light diffs for vert/horiz walls
|
||||
|
|
|
@ -49,21 +49,9 @@ void ASkyViewpoint::BeginPlay ()
|
|||
{
|
||||
Super::BeginPlay ();
|
||||
|
||||
if (tid == 0)
|
||||
if (tid == 0 && level.DefaultSkybox == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i <numsectors; i++)
|
||||
{
|
||||
if (sectors[i].FloorSkyBox == NULL)
|
||||
{
|
||||
sectors[i].FloorSkyBox = this;
|
||||
}
|
||||
if (sectors[i].CeilingSkyBox == NULL)
|
||||
{
|
||||
sectors[i].CeilingSkyBox = this;
|
||||
}
|
||||
}
|
||||
level.DefaultSkybox = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,6 +75,10 @@ void ASkyViewpoint::Destroy ()
|
|||
sectors[i].CeilingSkyBox = NULL;
|
||||
}
|
||||
}
|
||||
if (level.DefaultSkybox == this)
|
||||
{
|
||||
level.DefaultSkybox = NULL;
|
||||
}
|
||||
Super::Destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -1015,6 +1015,7 @@ void R_Subsector (subsector_t *sub)
|
|||
int ceilinglightlevel; // killough 4/11/98
|
||||
bool outersubsector;
|
||||
int fll, cll, position;
|
||||
ASkyViewpoint *skybox;
|
||||
|
||||
// kg3D - fake floor stuff
|
||||
visplane_t *backupfp;
|
||||
|
@ -1082,9 +1083,10 @@ void R_Subsector (subsector_t *sub)
|
|||
basecolormap = frontsector->ColorMap;
|
||||
}
|
||||
|
||||
skybox = frontsector->CeilingSkyBox != NULL ? frontsector->CeilingSkyBox : level.DefaultSkybox;
|
||||
ceilingplane = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz) > 0 ||
|
||||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum ||
|
||||
(frontsector->CeilingSkyBox != NULL && frontsector->CeilingSkyBox->bAlways) ||
|
||||
(skybox != NULL && skybox->bAlways) ||
|
||||
(frontsector->heightsec &&
|
||||
!(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
|
||||
frontsector->heightsec->GetTexture(sector_t::floor) == skyflatnum) ?
|
||||
|
@ -1099,7 +1101,7 @@ void R_Subsector (subsector_t *sub)
|
|||
frontsector->GetYScale(sector_t::ceiling),
|
||||
frontsector->GetAngle(sector_t::ceiling),
|
||||
frontsector->sky,
|
||||
frontsector->CeilingSkyBox
|
||||
skybox
|
||||
) : NULL;
|
||||
|
||||
if (fixedlightlev < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
||||
|
@ -1121,9 +1123,10 @@ 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;
|
||||
floorplane = frontsector->floorplane.PointOnSide(viewx, viewy, viewz) > 0 || // killough 3/7/98
|
||||
frontsector->GetTexture(sector_t::floor) == skyflatnum ||
|
||||
(frontsector->FloorSkyBox != NULL && frontsector->FloorSkyBox->bAlways) ||
|
||||
(skybox != NULL && skybox->bAlways) ||
|
||||
(frontsector->heightsec &&
|
||||
!(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
|
||||
frontsector->heightsec->GetTexture(sector_t::ceiling) == skyflatnum) ?
|
||||
|
@ -1138,7 +1141,7 @@ void R_Subsector (subsector_t *sub)
|
|||
frontsector->GetYScale(sector_t::floor),
|
||||
frontsector->GetAngle(sector_t::floor),
|
||||
frontsector->sky,
|
||||
frontsector->FloorSkyBox
|
||||
skybox
|
||||
) : NULL;
|
||||
|
||||
// kg3D - fake planes rendering
|
||||
|
|
Loading…
Reference in a new issue