mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-21 11:31:41 +00:00
- moved the static sky variables into FLevelLocals and removed the redundant ones for the texture ID.
This commit is contained in:
parent
06e5dd1d86
commit
3c565c9e86
13 changed files with 89 additions and 91 deletions
|
@ -1055,21 +1055,21 @@ CCMD(changesky)
|
||||||
|
|
||||||
if (netgame || argv.argc()<2) return;
|
if (netgame || argv.argc()<2) return;
|
||||||
|
|
||||||
|
// This only alters the primary level's sky setting. For testing out a sky that is sufficient.
|
||||||
sky1name = argv[1];
|
sky1name = argv[1];
|
||||||
if (sky1name[0] != 0)
|
if (sky1name[0] != 0)
|
||||||
{
|
{
|
||||||
FTextureID newsky = TexMan.GetTextureID(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
|
FTextureID newsky = TexMan.GetTextureID(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
|
||||||
if (newsky.Exists())
|
if (newsky.Exists())
|
||||||
{
|
{
|
||||||
// This only alters the primary level's sky setting.
|
currentUILevel->skytexture1 = newsky;
|
||||||
sky1texture = currentUILevel->skytexture1 = newsky;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Printf("changesky: Texture '%s' not found\n", sky1name);
|
Printf("changesky: Texture '%s' not found\n", sky1name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
R_InitSkyMap ();
|
InitSkyMap (currentUILevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -390,8 +390,7 @@ CUSTOM_CVAR (Int, dmflags, 0, CVAR_SERVERINFO)
|
||||||
{
|
{
|
||||||
// In case DF_NO_FREELOOK was changed, reinitialize the sky
|
// In case DF_NO_FREELOOK was changed, reinitialize the sky
|
||||||
// map. (If no freelook, then no need to stretch the sky.)
|
// map. (If no freelook, then no need to stretch the sky.)
|
||||||
if (sky1texture.isValid())
|
R_InitSkyMap ();
|
||||||
R_InitSkyMap ();
|
|
||||||
|
|
||||||
if (self & DF_NO_FREELOOK)
|
if (self & DF_NO_FREELOOK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,8 +143,8 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc)
|
||||||
sc.MustGetStringName("=");
|
sc.MustGetStringName("=");
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
|
|
||||||
sky2texture = sky1texture = Level->skytexture1 = Level->skytexture2 = TexMan.GetTextureID (sc.String, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
Level->skytexture1 = Level->skytexture2 = TexMan.GetTextureID (sc.String, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
||||||
R_InitSkyMap ();
|
InitSkyMap (Level);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("interpic"))
|
else if (sc.Compare("interpic"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1001,14 +1001,8 @@ void G_DoLoadLevel (const FString &nextmapname, int position, bool autosave, boo
|
||||||
// setting one.
|
// setting one.
|
||||||
skyflatnum = TexMan.GetTextureID (gameinfo.SkyFlatName, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
|
skyflatnum = TexMan.GetTextureID (gameinfo.SkyFlatName, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
|
||||||
|
|
||||||
// DOOM determines the sky texture to be used
|
|
||||||
// depending on the current episode and the game version.
|
|
||||||
// [RH] Fetch sky parameters from FLevelLocals.
|
|
||||||
sky1texture = level.skytexture1;
|
|
||||||
sky2texture = level.skytexture2;
|
|
||||||
|
|
||||||
// [RH] Set up details about sky rendering
|
// [RH] Set up details about sky rendering
|
||||||
R_InitSkyMap ();
|
InitSkyMap (&level);
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
@ -2162,9 +2156,9 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, ChangeSky)
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||||
PARAM_INT(sky1);
|
PARAM_INT(sky1);
|
||||||
PARAM_INT(sky2);
|
PARAM_INT(sky2);
|
||||||
sky1texture = self->skytexture1 = FSetTextureID(sky1);
|
self->skytexture1 = FSetTextureID(sky1);
|
||||||
sky2texture = self->skytexture2 = FSetTextureID(sky2);
|
self->skytexture2 = FSetTextureID(sky2);
|
||||||
R_InitSkyMap();
|
InitSkyMap(self);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -492,6 +492,10 @@ public:
|
||||||
float skyspeed1; // Scrolling speed of sky textures, in pixels per ms
|
float skyspeed1; // Scrolling speed of sky textures, in pixels per ms
|
||||||
float skyspeed2;
|
float skyspeed2;
|
||||||
|
|
||||||
|
double sky1pos, sky2pos;
|
||||||
|
float hw_sky1pos, hw_sky2pos;
|
||||||
|
bool skystretch;
|
||||||
|
|
||||||
int total_secrets;
|
int total_secrets;
|
||||||
int found_secrets;
|
int found_secrets;
|
||||||
|
|
||||||
|
|
|
@ -72,24 +72,24 @@ void GLSkyInfo::init(HWDrawInfo *di, int sky1, PalEntry FadeColor)
|
||||||
normalsky:
|
normalsky:
|
||||||
if (di->Level->flags&LEVEL_DOUBLESKY)
|
if (di->Level->flags&LEVEL_DOUBLESKY)
|
||||||
{
|
{
|
||||||
texture[1] = FMaterial::ValidateTexture(sky1texture, false, true);
|
texture[1] = FMaterial::ValidateTexture(di->Level->skytexture1, false, true);
|
||||||
x_offset[1] = hw_sky1pos;
|
x_offset[1] = di->Level->hw_sky1pos;
|
||||||
doublesky = true;
|
doublesky = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((di->Level->flags&LEVEL_SWAPSKIES || (sky1 == PL_SKYFLAT) || (di->Level->flags&LEVEL_DOUBLESKY)) &&
|
if ((di->Level->flags&LEVEL_SWAPSKIES || (sky1 == PL_SKYFLAT) || (di->Level->flags&LEVEL_DOUBLESKY)) &&
|
||||||
sky2texture != sky1texture) // If both skies are equal use the scroll offset of the first!
|
di->Level->skytexture2 != di->Level->skytexture1) // If both skies are equal use the scroll offset of the first!
|
||||||
{
|
{
|
||||||
texture[0] = FMaterial::ValidateTexture(sky2texture, false, true);
|
texture[0] = FMaterial::ValidateTexture(di->Level->skytexture2, false, true);
|
||||||
skytexno1 = sky2texture;
|
skytexno1 = di->Level->skytexture2;
|
||||||
sky2 = true;
|
sky2 = true;
|
||||||
x_offset[0] = hw_sky2pos;
|
x_offset[0] = di->Level->hw_sky2pos;
|
||||||
}
|
}
|
||||||
else if (!doublesky)
|
else if (!doublesky)
|
||||||
{
|
{
|
||||||
texture[0] = FMaterial::ValidateTexture(sky1texture, false, true);
|
texture[0] = FMaterial::ValidateTexture(di->Level->skytexture1, false, true);
|
||||||
skytexno1 = sky1texture;
|
skytexno1 = di->Level->skytexture1;
|
||||||
x_offset[0] = hw_sky1pos;
|
x_offset[0] = di->Level->hw_sky1pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (di->Level->skyfog > 0)
|
if (di->Level->skyfog > 0)
|
||||||
|
|
|
@ -9762,13 +9762,13 @@ scriptwait:
|
||||||
sky2name = Level->Behaviors.LookupString (STACK(1));
|
sky2name = Level->Behaviors.LookupString (STACK(1));
|
||||||
if (sky1name[0] != 0)
|
if (sky1name[0] != 0)
|
||||||
{
|
{
|
||||||
sky1texture = Level->skytexture1 = TexMan.GetTextureID(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
Level->skytexture1 = TexMan.GetTextureID(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
||||||
}
|
}
|
||||||
if (sky2name[0] != 0)
|
if (sky2name[0] != 0)
|
||||||
{
|
{
|
||||||
sky2texture = Level->skytexture2 = TexMan.GetTextureID(sky2name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
Level->skytexture2 = TexMan.GetTextureID(sky2name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
||||||
}
|
}
|
||||||
R_InitSkyMap ();
|
InitSkyMap (Level);
|
||||||
sp -= 2;
|
sp -= 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "p_destructible.h"
|
#include "p_destructible.h"
|
||||||
|
#include "r_sky.h"
|
||||||
#include "fragglescript/t_script.h"
|
#include "fragglescript/t_script.h"
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -976,9 +977,7 @@ void FLevelLocals::Serialize(FSerializer &arc, bool hubload)
|
||||||
|
|
||||||
if (arc.isReading())
|
if (arc.isReading())
|
||||||
{
|
{
|
||||||
sky1texture = skytexture1;
|
InitSkyMap(this);
|
||||||
sky2texture = skytexture2;
|
|
||||||
R_InitSkyMap();
|
|
||||||
AirControlChanged();
|
AirControlChanged();
|
||||||
bglobal.freeze = !!(frozenstate & 2);
|
bglobal.freeze = !!(frozenstate & 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,20 +175,14 @@ static void PrecacheLevel(FLevelLocals *Level)
|
||||||
AddToList(hitlist.Data(), Level->sides[i].GetTexture(side_t::bottom), FTextureManager::HIT_Wall);
|
AddToList(hitlist.Data(), Level->sides[i].GetTexture(side_t::bottom), FTextureManager::HIT_Wall);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sky texture is always present.
|
|
||||||
// Note that F_SKY1 is the name used to
|
|
||||||
// indicate a sky floor/ceiling as a flat,
|
|
||||||
// while the sky texture is stored like
|
|
||||||
// a wall texture, with an episode dependant
|
|
||||||
// name.
|
|
||||||
|
|
||||||
if (sky1texture.isValid())
|
if (Level->skytexture1.isValid())
|
||||||
{
|
{
|
||||||
AddToList(hitlist.Data(), sky1texture, FTextureManager::HIT_Sky);
|
AddToList(hitlist.Data(), Level->skytexture1, FTextureManager::HIT_Sky);
|
||||||
}
|
}
|
||||||
if (sky2texture.isValid())
|
if (Level->skytexture2.isValid())
|
||||||
{
|
{
|
||||||
AddToList(hitlist.Data(), sky2texture, FTextureManager::HIT_Sky);
|
AddToList(hitlist.Data(), Level->skytexture2, FTextureManager::HIT_Sky);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto n : gameinfo.PrecachedTextures)
|
for (auto n : gameinfo.PrecachedTextures)
|
||||||
|
|
|
@ -291,9 +291,10 @@ void PolySkySetup::Update()
|
||||||
double skyscale = 0.0;
|
double skyscale = 0.0;
|
||||||
float skyiscale = 0.0f;
|
float skyiscale = 0.0f;
|
||||||
fixed_t sky1cyl = 0, sky2cyl = 0;
|
fixed_t sky1cyl = 0, sky2cyl = 0;
|
||||||
|
auto Level = PolyRenderer::Instance()->Level;
|
||||||
|
|
||||||
auto skytex1 = TexMan.GetPalettedTexture(sky1texture, true);
|
auto skytex1 = TexMan.GetPalettedTexture(Level->skytexture1, true);
|
||||||
auto skytex2 = TexMan.GetPalettedTexture(sky2texture, true);
|
auto skytex2 = TexMan.GetPalettedTexture(Level->skytexture2, true);
|
||||||
|
|
||||||
if (skytex1)
|
if (skytex1)
|
||||||
{
|
{
|
||||||
|
@ -307,7 +308,7 @@ void PolySkySetup::Update()
|
||||||
}
|
}
|
||||||
else if (skyheight > 200)
|
else if (skyheight > 200)
|
||||||
{
|
{
|
||||||
skytexturemid = (200 - skyheight) * sskytex1->GetScale().Y + ((r_skymode == 2 && !(PolyRenderer::Instance()->Level->flags & LEVEL_FORCETILEDSKY)) ? skytex1->GetSkyOffset() : 0);
|
skytexturemid = (200 - skyheight) * sskytex1->GetScale().Y + ((r_skymode == 2 && !(Level->flags & LEVEL_FORCETILEDSKY)) ? skytex1->GetSkyOffset() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewwidth != 0 && viewheight != 0)
|
if (viewwidth != 0 && viewheight != 0)
|
||||||
|
@ -319,7 +320,7 @@ void PolySkySetup::Update()
|
||||||
skyscale *= float(90. / r_viewpoint.FieldOfView.Degrees);
|
skyscale *= float(90. / r_viewpoint.FieldOfView.Degrees);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skystretch)
|
if (Level->skystretch)
|
||||||
{
|
{
|
||||||
skyscale *= (double)SKYSTRETCH_HEIGHT / skyheight;
|
skyscale *= (double)SKYSTRETCH_HEIGHT / skyheight;
|
||||||
skyiscale *= skyheight / (float)SKYSTRETCH_HEIGHT;
|
skyiscale *= skyheight / (float)SKYSTRETCH_HEIGHT;
|
||||||
|
@ -339,13 +340,13 @@ void PolySkySetup::Update()
|
||||||
|
|
||||||
if ((PolyRenderer::Instance()->Level->flags & LEVEL_SWAPSKIES) && !(PolyRenderer::Instance()->Level->flags & LEVEL_DOUBLESKY))
|
if ((PolyRenderer::Instance()->Level->flags & LEVEL_SWAPSKIES) && !(PolyRenderer::Instance()->Level->flags & LEVEL_DOUBLESKY))
|
||||||
{
|
{
|
||||||
sky1tex = sky2texture;
|
sky1tex = Level->skytexture2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sky1tex = sky1texture;
|
sky1tex = Level->skytexture1;
|
||||||
}
|
}
|
||||||
sky2tex = sky2texture;
|
sky2tex = Level->skytexture2;
|
||||||
skymid = skytexturemid;
|
skymid = skytexturemid;
|
||||||
skyangle = 0;
|
skyangle = 0;
|
||||||
|
|
||||||
|
@ -360,8 +361,8 @@ void PolySkySetup::Update()
|
||||||
else
|
else
|
||||||
backskytex = nullptr;
|
backskytex = nullptr;
|
||||||
skyflip = false;
|
skyflip = false;
|
||||||
frontdpos = sky1pos;
|
frontdpos = Level->sky1pos;
|
||||||
backdpos = sky2pos;
|
backdpos = Level->sky2pos;
|
||||||
frontcyl = sky1cyl;
|
frontcyl = sky1cyl;
|
||||||
backcyl = sky2cyl;
|
backcyl = sky2cyl;
|
||||||
}
|
}
|
||||||
|
@ -371,7 +372,7 @@ void PolySkySetup::Update()
|
||||||
backskytex = nullptr;
|
backskytex = nullptr;
|
||||||
frontcyl = sky2cyl;
|
frontcyl = sky2cyl;
|
||||||
skyflip = false;
|
skyflip = false;
|
||||||
frontdpos = sky2pos;
|
frontdpos = Level->sky2pos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // MBF's linedef-controlled skies
|
{ // MBF's linedef-controlled skies
|
||||||
|
|
|
@ -43,10 +43,6 @@
|
||||||
// sky mapping
|
// sky mapping
|
||||||
//
|
//
|
||||||
FTextureID skyflatnum;
|
FTextureID skyflatnum;
|
||||||
FTextureID sky1texture, sky2texture;
|
|
||||||
double sky1pos, sky2pos;
|
|
||||||
float hw_sky1pos, hw_sky2pos;
|
|
||||||
bool skystretch;
|
|
||||||
|
|
||||||
// [RH] Stretch sky texture if not taller than 128 pixels?
|
// [RH] Stretch sky texture if not taller than 128 pixels?
|
||||||
// Also now controls capped skies. 0 = normal, 1 = stretched, 2 = capped
|
// Also now controls capped skies. 0 = normal, 1 = stretched, 2 = capped
|
||||||
|
@ -65,31 +61,32 @@ CVAR(Float, skyoffset, 0, 0) // for testing
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void R_InitSkyMap()
|
void InitSkyMap(FLevelLocals *Level)
|
||||||
{
|
{
|
||||||
int skyheight;
|
int skyheight;
|
||||||
FTexture *skytex1, *skytex2;
|
FTexture *skytex1, *skytex2;
|
||||||
|
|
||||||
// Do not allow the null texture which has no bitmap and will crash.
|
// Do not allow the null texture which has no bitmap and will crash.
|
||||||
if (sky1texture.isNull())
|
if (Level->skytexture1.isNull())
|
||||||
{
|
{
|
||||||
sky1texture = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
|
Level->skytexture1 = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
|
||||||
}
|
}
|
||||||
if (sky2texture.isNull())
|
if (Level->skytexture2.isNull())
|
||||||
{
|
{
|
||||||
sky2texture = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
|
Level->skytexture2 = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
|
||||||
}
|
}
|
||||||
|
|
||||||
skytex1 = TexMan.GetTexture(sky1texture, false);
|
skytex1 = TexMan.GetTexture(Level->skytexture1, false);
|
||||||
skytex2 = TexMan.GetTexture(sky2texture, false);
|
skytex2 = TexMan.GetTexture(Level->skytexture2, false);
|
||||||
|
|
||||||
if (skytex1 == nullptr)
|
if (skytex1 == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((level.flags & LEVEL_DOUBLESKY) && skytex1->GetDisplayHeight() != skytex2->GetDisplayHeight())
|
if ((Level->flags & LEVEL_DOUBLESKY) && skytex1->GetDisplayHeight() != skytex2->GetDisplayHeight())
|
||||||
{
|
{
|
||||||
Printf(TEXTCOLOR_BOLD "Both sky textures must be the same height." TEXTCOLOR_NORMAL "\n");
|
Printf(TEXTCOLOR_BOLD "Both sky textures must be the same height." TEXTCOLOR_NORMAL "\n");
|
||||||
sky2texture = sky1texture;
|
Level->flags &= ~LEVEL_DOUBLESKY;
|
||||||
|
Level->skytexture1 = Level->skytexture2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are various combinations for sky rendering depending on how tall the sky is:
|
// There are various combinations for sky rendering depending on how tall the sky is:
|
||||||
|
@ -109,14 +106,23 @@ void R_InitSkyMap()
|
||||||
|
|
||||||
if (skyheight >= 128 && skyheight < 200)
|
if (skyheight >= 128 && skyheight < 200)
|
||||||
{
|
{
|
||||||
skystretch = (r_skymode == 1
|
Level->skystretch = (r_skymode == 1
|
||||||
&& skyheight >= 128
|
&& skyheight >= 128
|
||||||
&& level.IsFreelookAllowed()
|
&& Level->IsFreelookAllowed()
|
||||||
&& !(level.flags & LEVEL_FORCETILEDSKY)) ? 1 : 0;
|
&& !(Level->flags & LEVEL_FORCETILEDSKY)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
else skystretch = false;
|
else Level->skystretch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_InitSkyMap()
|
||||||
|
{
|
||||||
|
for(auto Level : AllLevels())
|
||||||
|
{
|
||||||
|
InitSkyMap(Level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// R_UpdateSky
|
// R_UpdateSky
|
||||||
|
@ -127,14 +133,16 @@ void R_InitSkyMap()
|
||||||
|
|
||||||
void R_UpdateSky (uint64_t mstime)
|
void R_UpdateSky (uint64_t mstime)
|
||||||
{
|
{
|
||||||
// Scroll the sky
|
|
||||||
double ms = (double)mstime * FRACUNIT;
|
double ms = (double)mstime * FRACUNIT;
|
||||||
sky1pos = ms * level.skyspeed1;
|
for(auto Level : AllLevels())
|
||||||
sky2pos = ms * level.skyspeed2;
|
{
|
||||||
|
// Scroll the sky
|
||||||
// The hardware renderer uses a different value range and clamps it to a single rotation
|
Level->sky1pos = ms * level.skyspeed1;
|
||||||
hw_sky1pos = (float)(fmod((double(mstime) * level.skyspeed1), 1024.) * (90. / 256.));
|
Level->sky2pos = ms * level.skyspeed2;
|
||||||
hw_sky2pos = (float)(fmod((double(mstime) * level.skyspeed2), 1024.) * (90. / 256.));
|
|
||||||
|
|
||||||
|
// The hardware renderer uses a different value range and clamps it to a single rotation
|
||||||
|
Level->hw_sky1pos = (float)(fmod((double(mstime) * level.skyspeed1), 1024.) * (90. / 256.));
|
||||||
|
Level->hw_sky2pos = (float)(fmod((double(mstime) * level.skyspeed2), 1024.) * (90. / 256.));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,17 +30,16 @@
|
||||||
|
|
||||||
#include "textures/textures.h"
|
#include "textures/textures.h"
|
||||||
|
|
||||||
|
struct FLevelLocals;
|
||||||
|
|
||||||
extern FTextureID skyflatnum;
|
extern FTextureID skyflatnum;
|
||||||
extern FTextureID sky1texture, sky2texture;
|
|
||||||
extern double sky1pos, sky2pos;
|
|
||||||
extern float hw_sky1pos, hw_sky2pos;
|
|
||||||
extern bool skystretch;
|
|
||||||
extern int freelookviewheight;
|
extern int freelookviewheight;
|
||||||
|
|
||||||
#define SKYSTRETCH_HEIGHT 228
|
#define SKYSTRETCH_HEIGHT 228
|
||||||
|
|
||||||
// Called whenever the sky changes.
|
// Called whenever the sky changes.
|
||||||
void R_InitSkyMap ();
|
void InitSkyMap(FLevelLocals *Level);
|
||||||
|
void R_InitSkyMap();
|
||||||
void R_UpdateSky (uint64_t mstime);
|
void R_UpdateSky (uint64_t mstime);
|
||||||
|
|
||||||
// 57 world units roughly represent one sky texel for the glTranslate call.
|
// 57 world units roughly represent one sky texel for the glTranslate call.
|
||||||
|
|
|
@ -72,8 +72,8 @@ namespace swrenderer
|
||||||
Thread = thread;
|
Thread = thread;
|
||||||
auto Level = Thread->Viewport->Level();
|
auto Level = Thread->Viewport->Level();
|
||||||
|
|
||||||
auto skytex1 = TexMan.GetPalettedTexture(sky1texture, true);
|
auto skytex1 = TexMan.GetPalettedTexture(Level->skytexture1, true);
|
||||||
auto skytex2 = TexMan.GetPalettedTexture(sky2texture, true);
|
auto skytex2 = TexMan.GetPalettedTexture(Level->skytexture2, true);
|
||||||
|
|
||||||
if (skytex1 == nullptr)
|
if (skytex1 == nullptr)
|
||||||
return;
|
return;
|
||||||
|
@ -100,7 +100,7 @@ namespace swrenderer
|
||||||
skyscale *= float(90. / r_viewpoint.FieldOfView.Degrees);
|
skyscale *= float(90. / r_viewpoint.FieldOfView.Degrees);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skystretch)
|
if (Level->skystretch)
|
||||||
{
|
{
|
||||||
skyscale *= (double)SKYSTRETCH_HEIGHT / skyheight;
|
skyscale *= (double)SKYSTRETCH_HEIGHT / skyheight;
|
||||||
skyiscale *= skyheight / (float)SKYSTRETCH_HEIGHT;
|
skyiscale *= skyheight / (float)SKYSTRETCH_HEIGHT;
|
||||||
|
@ -123,13 +123,13 @@ namespace swrenderer
|
||||||
|
|
||||||
if ((Level->flags & LEVEL_SWAPSKIES) && !(Level->flags & LEVEL_DOUBLESKY))
|
if ((Level->flags & LEVEL_SWAPSKIES) && !(Level->flags & LEVEL_DOUBLESKY))
|
||||||
{
|
{
|
||||||
sky1tex = sky2texture;
|
sky1tex = Level->skytexture2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sky1tex = sky1texture;
|
sky1tex = Level->skytexture1;
|
||||||
}
|
}
|
||||||
sky2tex = sky2texture;
|
sky2tex = Level->skytexture2;
|
||||||
skymid = skytexturemid;
|
skymid = skytexturemid;
|
||||||
skyangle = Thread->Viewport->viewpoint.Angles.Yaw.BAMs();
|
skyangle = Thread->Viewport->viewpoint.Angles.Yaw.BAMs();
|
||||||
|
|
||||||
|
@ -144,8 +144,8 @@ namespace swrenderer
|
||||||
else
|
else
|
||||||
backskytex = NULL;
|
backskytex = NULL;
|
||||||
skyflip = 0;
|
skyflip = 0;
|
||||||
frontdpos = sky1pos;
|
frontdpos = Level->sky1pos;
|
||||||
backdpos = sky2pos;
|
backdpos = Level->sky2pos;
|
||||||
frontcyl = sky1cyl;
|
frontcyl = sky1cyl;
|
||||||
backcyl = sky2cyl;
|
backcyl = sky2cyl;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ namespace swrenderer
|
||||||
backskytex = NULL;
|
backskytex = NULL;
|
||||||
frontcyl = sky2cyl;
|
frontcyl = sky2cyl;
|
||||||
skyflip = 0;
|
skyflip = 0;
|
||||||
frontdpos = sky2pos;
|
frontdpos = Level->sky2pos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // MBF's linedef-controlled skies
|
{ // MBF's linedef-controlled skies
|
||||||
|
@ -202,7 +202,7 @@ namespace swrenderer
|
||||||
|
|
||||||
int frontxscale = int(frontskytex->GetScale().X * 1024);
|
int frontxscale = int(frontskytex->GetScale().X * 1024);
|
||||||
frontcyl = MAX(frontskytex->GetWidth(), frontxscale);
|
frontcyl = MAX(frontskytex->GetWidth(), frontxscale);
|
||||||
if (skystretch)
|
if (Level->skystretch)
|
||||||
{
|
{
|
||||||
skymid = skymid * frontskytex->GetScaledHeightDouble() / SKYSTRETCH_HEIGHT;
|
skymid = skymid * frontskytex->GetScaledHeightDouble() / SKYSTRETCH_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue