mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-04-13 21:53:14 +00:00
added per-sector sky UDMF properties.
(Hardware rendering only, the SW renderer is not in a state where this is easily done.)
This commit is contained in:
parent
9a94472650
commit
bdee1f3d34
14 changed files with 63 additions and 21 deletions
|
@ -365,6 +365,11 @@ Note: All <bool> fields default to false unless mentioned otherwise.
|
|||
friction = <float>; // sets the sector's friction factor. Must be between 0 and 1.
|
||||
movefactor = <float> // sets the sector's movement acceleration factor. Must be > 0.
|
||||
|
||||
skyfloor = <string> // defines lower sky for this sector.
|
||||
skyceiling = <string> // defines upper sky for this sector.
|
||||
skyfloor2 = <string> // defines secondary lower sky for this sector. (for lightning or transparent layers)
|
||||
skyceiling2 = <string> // defines secondary upper sky for this sector.
|
||||
|
||||
colormap = <string>; // only provided for backwards compatibility. Do not use in GZDoom projects.
|
||||
|
||||
* Note about dropactors
|
||||
|
|
|
@ -667,6 +667,7 @@ struct sector_t
|
|||
float GlowHeight;
|
||||
FTextureID Texture;
|
||||
TextureManipulation TextureFx;
|
||||
FTextureID skytexture[2];
|
||||
};
|
||||
|
||||
|
||||
|
@ -690,7 +691,7 @@ struct sector_t
|
|||
|
||||
int special; // map-defined sector special type
|
||||
|
||||
int sky; // MBF sky transfer info.
|
||||
int skytransfer; // MBF sky transfer info.
|
||||
int validcount; // if == validcount, already checked
|
||||
|
||||
uint32_t selfmap, bottommap, midmap, topmap; // killough 4/4/98: dynamic colormaps
|
||||
|
@ -826,7 +827,6 @@ public:
|
|||
int CheckSpriteGlow(int lightlevel, const DVector3 &pos);
|
||||
bool GetWallGlow(float *topglowcolor, float *bottomglowcolor);
|
||||
|
||||
|
||||
void SetXOffset(int pos, double o)
|
||||
{
|
||||
planes[pos].xform.xOffs = o;
|
||||
|
|
|
@ -197,7 +197,6 @@ private:
|
|||
void CreateScroller(EScroll type, double dx, double dy, sector_t *sect, side_t* side, int accel, EScrollPos scrollpos = EScrollPos::scw_all, int scrollmode = 15/*SCROLL_All*/);
|
||||
void SpawnScrollers();
|
||||
void SpawnFriction();
|
||||
void SpawnUDMFFriction(double friction_factor, double move_factor, sector_t* sec);
|
||||
void SpawnPushers();
|
||||
AActor *GetPushThing (int s);
|
||||
void SpawnPortal(line_t *line, int sectortag, int plane, int bytealpha, int linked);
|
||||
|
|
|
@ -609,7 +609,7 @@ void MapLoader::InitSectorSpecial(sector_t *sector, int special)
|
|||
break;
|
||||
|
||||
case Sky2:
|
||||
sector->sky = PL_SKYFLAT;
|
||||
sector->skytransfer = PL_SKYFLAT;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -872,7 +872,7 @@ void MapLoader::SpawnSpecials ()
|
|||
{
|
||||
auto itr = Level->GetSectorTagIterator(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
Level->sectors[s].sky = (line.Index() + 1) | PL_SKYFLAT;
|
||||
Level->sectors[s].skytransfer = (line.Index() + 1) | PL_SKYFLAT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2124,6 +2124,22 @@ public:
|
|||
movefactor = CheckFloat(key);
|
||||
break;
|
||||
|
||||
case NAME_skyfloor:
|
||||
sec->planes[sector_t::floor].skytexture[0] = TexMan.CheckForTexture(CheckString(key), ETextureType::Wall, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
|
||||
break;
|
||||
|
||||
case NAME_skyfloor2:
|
||||
sec->planes[sector_t::floor].skytexture[1] = TexMan.CheckForTexture(CheckString(key), ETextureType::Wall, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
|
||||
break;
|
||||
|
||||
case NAME_skyceiling:
|
||||
sec->planes[sector_t::ceiling].skytexture[0] = TexMan.CheckForTexture(CheckString(key), ETextureType::Wall, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
|
||||
break;
|
||||
|
||||
case NAME_skyceiling2:
|
||||
sec->planes[sector_t::ceiling].skytexture[1] = TexMan.CheckForTexture(CheckString(key), ETextureType::Wall, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
|
||||
break;
|
||||
|
||||
// These two are used by Eternity for something I do not understand.
|
||||
//case NAME_portal_ceil_useglobaltex:
|
||||
//case NAME_portal_floor_useglobaltex:
|
||||
|
|
|
@ -886,6 +886,8 @@ xx(thrustlocation)
|
|||
xx(colormap)
|
||||
xx(skyfloor)
|
||||
xx(skyceiling)
|
||||
xx(skyfloor2)
|
||||
xx(skyceiling2)
|
||||
xx(frictionfactor)
|
||||
xx(movefactor)
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
|
|||
("damageinterval", p.damageinterval, def->damageinterval)
|
||||
("leakydamage", p.leakydamage, def->leakydamage)
|
||||
("damagetype", p.damagetype, def->damagetype)
|
||||
("sky", p.sky, def->sky)
|
||||
("sky", p.skytransfer, def->skytransfer)
|
||||
("moreflags", p.MoreFlags, def->MoreFlags)
|
||||
("flags", p.Flags, def->Flags)
|
||||
.Array("portals", p.Portals, def->Portals, 2, true)
|
||||
|
|
|
@ -186,6 +186,10 @@ static void PrecacheLevel(FLevelLocals *Level)
|
|||
{
|
||||
AddToList(hitlist.Data(), Level->sectors[i].GetTexture(sector_t::floor), FTextureManager::HIT_Flat);
|
||||
AddToList(hitlist.Data(), Level->sectors[i].GetTexture(sector_t::ceiling), FTextureManager::HIT_Flat);
|
||||
AddToList(hitlist.Data(), Level->sectors[i].planes[0].skytexture[0], FTextureManager::HIT_Wall);
|
||||
AddToList(hitlist.Data(), Level->sectors[i].planes[0].skytexture[1], FTextureManager::HIT_Wall);
|
||||
AddToList(hitlist.Data(), Level->sectors[i].planes[1].skytexture[0], FTextureManager::HIT_Wall);
|
||||
AddToList(hitlist.Data(), Level->sectors[i].planes[1].skytexture[1], FTextureManager::HIT_Wall);
|
||||
}
|
||||
|
||||
for (i = Level->sides.Size() - 1; i >= 0; i--)
|
||||
|
|
|
@ -1637,3 +1637,4 @@ void vertex_t::RecalcVertexHeights()
|
|||
if (numheights <= 2) numheights = 0; // is not in need of any special attention
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1029,7 +1029,7 @@ void HWEEHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
sector->GetTexture(sector_t::ceiling) == skyflatnum)
|
||||
{
|
||||
HWSkyInfo skyinfo;
|
||||
skyinfo.init(di, sector->sky, 0);
|
||||
skyinfo.init(di, sector, sector_t::ceiling, sector->skytransfer, 0);
|
||||
HWSkyPortal sky(screen->mSkyData, mState, &skyinfo, true);
|
||||
sky.DrawContents(di, state);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ struct HWSkyInfo
|
|||
{
|
||||
return !!memcmp(this, &inf, sizeof(*this));
|
||||
}
|
||||
void init(HWDrawInfo *di, int sky1, PalEntry fadecolor);
|
||||
void init(HWDrawInfo *di, sector_t* sec, int skypos, int sky1, PalEntry fadecolor);
|
||||
};
|
||||
|
||||
struct HWHorizonInfo
|
||||
|
|
|
@ -37,13 +37,26 @@
|
|||
|
||||
CVAR(Bool,gl_noskyboxes, false, 0)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FTextureID GetSkyTexture(sector_t* sec, int plane, int second)
|
||||
{
|
||||
auto tex = sec->planes[plane].skytexture[second];
|
||||
if (tex.isValid()) return tex;
|
||||
return second ? sec->Level->skytexture2 : sec->Level->skytexture1;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Set up the skyinfo struct
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWSkyInfo::init(HWDrawInfo *di, int sky1, PalEntry FadeColor)
|
||||
void HWSkyInfo::init(HWDrawInfo *di, sector_t* sec, int skypos, int sky1, PalEntry FadeColor)
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
if ((sky1 & PL_SKYFLAT) && (sky1 & (PL_SKYFLAT - 1)))
|
||||
|
@ -73,25 +86,27 @@ void HWSkyInfo::init(HWDrawInfo *di, int sky1, PalEntry FadeColor)
|
|||
else
|
||||
{
|
||||
normalsky:
|
||||
auto skytex1 = GetSkyTexture(sec, skypos, false);
|
||||
auto skytex2 = GetSkyTexture(sec, skypos, true);
|
||||
if (di->Level->flags&LEVEL_DOUBLESKY)
|
||||
{
|
||||
auto tex1 = TexMan.GetGameTexture(di->Level->skytexture1, true);
|
||||
auto tex1 = TexMan.GetGameTexture(skytex1);
|
||||
texture[1] = tex1;
|
||||
x_offset[1] = di->Level->hw_sky1pos;
|
||||
doublesky = true;
|
||||
}
|
||||
|
||||
if ((di->Level->flags&LEVEL_SWAPSKIES || (sky1 == PL_SKYFLAT) || (di->Level->flags&LEVEL_DOUBLESKY)) &&
|
||||
di->Level->skytexture2 != di->Level->skytexture1) // If both skies are equal use the scroll offset of the first!
|
||||
skytex2 != skytex1) // If both skies are equal use the scroll offset of the first!
|
||||
{
|
||||
texture[0] = TexMan.GetGameTexture(di->Level->skytexture2, true);
|
||||
skytexno1 = di->Level->skytexture2;
|
||||
texture[0] = TexMan.GetGameTexture(skytex2, true);
|
||||
skytexno1 = skytex2;
|
||||
sky2 = true;
|
||||
x_offset[0] = di->Level->hw_sky2pos;
|
||||
}
|
||||
else if (!doublesky)
|
||||
{
|
||||
texture[0] = TexMan.GetGameTexture(di->Level->skytexture1, true);
|
||||
texture[0] = TexMan.GetGameTexture(skytex1, true);
|
||||
skytexno1 = di->Level->skytexture1;
|
||||
x_offset[0] = di->Level->hw_sky1pos;
|
||||
}
|
||||
|
@ -125,7 +140,7 @@ void HWWall::SkyPlane(HWWallDispatcher *di, sector_t *sector, int plane, bool al
|
|||
if (di->di)
|
||||
{
|
||||
HWSkyInfo skyinfo;
|
||||
skyinfo.init(di->di, sector->sky, Colormap.FadeColor);
|
||||
skyinfo.init(di->di, sector, plane, sector->skytransfer, Colormap.FadeColor);
|
||||
ptype = PORTALTYPE_SKY;
|
||||
sky = &skyinfo;
|
||||
}
|
||||
|
@ -199,7 +214,7 @@ void HWWall::SkyLine(HWWallDispatcher *di, sector_t *fs, line_t *line)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (di->di) skyinfo.init(di->di, fs->sky, Colormap.FadeColor);
|
||||
if (di->di) skyinfo.init(di->di, fs, sector_t::ceiling, fs->skytransfer, Colormap.FadeColor);
|
||||
ptype = PORTALTYPE_SKY;
|
||||
sky = &skyinfo;
|
||||
}
|
||||
|
|
|
@ -555,7 +555,7 @@ namespace swrenderer
|
|||
frontsector->GetAlpha(sector_t::ceiling),
|
||||
!!(frontsector->GetFlags(sector_t::ceiling) & PLANEF_ADDITIVE),
|
||||
frontsector->planes[sector_t::ceiling].xform,
|
||||
frontsector->sky,
|
||||
frontsector->skytransfer,
|
||||
portal,
|
||||
basecolormap,
|
||||
Fake3DOpaque::Normal,
|
||||
|
@ -595,7 +595,7 @@ namespace swrenderer
|
|||
frontsector->GetAlpha(sector_t::floor),
|
||||
!!(frontsector->GetFlags(sector_t::floor) & PLANEF_ADDITIVE),
|
||||
frontsector->planes[sector_t::floor].xform,
|
||||
frontsector->sky,
|
||||
frontsector->skytransfer,
|
||||
portal,
|
||||
basecolormap,
|
||||
Fake3DOpaque::Normal,
|
||||
|
@ -732,7 +732,7 @@ namespace swrenderer
|
|||
tempsec.GetAlpha(sector_t::floor),
|
||||
!!(clip3d->fakeFloor->fakeFloor->flags & FF_ADDITIVETRANS),
|
||||
tempsec.planes[position].xform,
|
||||
tempsec.sky,
|
||||
tempsec.skytransfer,
|
||||
nullptr,
|
||||
basecolormap,
|
||||
Fake3DOpaque::FakeFloor,
|
||||
|
@ -800,7 +800,7 @@ namespace swrenderer
|
|||
tempsec.GetAlpha(sector_t::ceiling),
|
||||
!!(clip3d->fakeFloor->fakeFloor->flags & FF_ADDITIVETRANS),
|
||||
tempsec.planes[position].xform,
|
||||
tempsec.sky,
|
||||
tempsec.skytransfer,
|
||||
nullptr,
|
||||
basecolormap,
|
||||
Fake3DOpaque::FakeCeiling,
|
||||
|
|
|
@ -2861,7 +2861,7 @@ DEFINE_FIELD_X(Sector, sector_t, SoundTarget)
|
|||
DEFINE_FIELD_X(Sector, sector_t, special)
|
||||
DEFINE_FIELD_X(Sector, sector_t, lightlevel)
|
||||
DEFINE_FIELD_X(Sector, sector_t, seqType)
|
||||
DEFINE_FIELD_X(Sector, sector_t, sky)
|
||||
DEFINE_FIELD_NAMED_X(Sector, sector_t, skytransfer, sky)
|
||||
DEFINE_FIELD_X(Sector, sector_t, SeqName)
|
||||
DEFINE_FIELD_X(Sector, sector_t, centerspot)
|
||||
DEFINE_FIELD_X(Sector, sector_t, validcount)
|
||||
|
|
Loading…
Reference in a new issue