mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- moved the OpenGL fog properties to FLevelLocals to simplify their handling.
- added access to the glow properties for ZSCript and ACS.
This commit is contained in:
parent
72ecaba50a
commit
44a087554f
22 changed files with 248 additions and 200 deletions
|
@ -187,7 +187,10 @@ void FS_EmulateCmd(char * string)
|
|||
{
|
||||
sc.MustGetNumber();
|
||||
// Using this disables most MAPINFO fog options!
|
||||
Renderer->SetFogParams(sc.Number*70/400, 0xff000000, 0, 0);
|
||||
level.fogdensity = sc.Number * 70 / 400;
|
||||
level.outsidefogdensity = 0;
|
||||
level.skyfog = 0;
|
||||
level.info->outsidefog = 0;
|
||||
}
|
||||
else if (sc.Compare("gr_fogcolor"))
|
||||
{
|
||||
|
|
|
@ -1466,6 +1466,11 @@ void G_InitLevelLocals ()
|
|||
level.F1Pic = info->F1Pic;
|
||||
level.hazardcolor = info->hazardcolor;
|
||||
level.hazardflash = info->hazardflash;
|
||||
|
||||
// GL fog stuff modifiable by SetGlobalFogParameter.
|
||||
level.fogdensity = info->fogdensity;
|
||||
level.outsidefogdensity = info->outsidefogdensity;
|
||||
level.skyfog = info->skyfog;
|
||||
|
||||
compatflags.Callback();
|
||||
compatflags2.Callback();
|
||||
|
@ -1935,6 +1940,9 @@ DEFINE_FIELD(FLevelLocals, aircontrol)
|
|||
DEFINE_FIELD(FLevelLocals, airfriction)
|
||||
DEFINE_FIELD(FLevelLocals, airsupply)
|
||||
DEFINE_FIELD(FLevelLocals, teamdamage)
|
||||
DEFINE_FIELD(FLevelLocals, fogdensity)
|
||||
DEFINE_FIELD(FLevelLocals, outsidefogdensity)
|
||||
DEFINE_FIELD(FLevelLocals, skyfog)
|
||||
DEFINE_FIELD_BIT(FLevelLocals, flags, monsterstelefrag, LEVEL_MONSTERSTELEFRAG)
|
||||
DEFINE_FIELD_BIT(FLevelLocals, flags, actownspecial, LEVEL_ACTOWNSPECIAL)
|
||||
DEFINE_FIELD_BIT(FLevelLocals, flags, sndseqtotalctrl, LEVEL_SNDSEQTOTALCTRL)
|
||||
|
@ -1970,6 +1978,16 @@ CCMD(listmaps)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// For testing sky fog sheets
|
||||
//
|
||||
//==========================================================================
|
||||
CCMD(skyfog)
|
||||
{
|
||||
if (argv.argc()>1)
|
||||
{
|
||||
level.skyfog = MAX(0, (int)strtoull(argv[1], NULL, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -332,6 +332,9 @@ struct level_info_t
|
|||
FName slideshow;
|
||||
uint32_t hazardcolor;
|
||||
uint32_t hazardflash;
|
||||
int fogdensity;
|
||||
int outsidefogdensity;
|
||||
int skyfog;
|
||||
|
||||
// Redirection: If any player is carrying the specified item, then
|
||||
// you go to the RedirectMap instead of this one.
|
||||
|
|
|
@ -81,6 +81,12 @@ struct FLevelLocals
|
|||
|
||||
double teamdamage;
|
||||
|
||||
// former OpenGL-exclusive properties that should also be usable by the true color software renderer.
|
||||
int fogdensity;
|
||||
int outsidefogdensity;
|
||||
int skyfog;
|
||||
|
||||
|
||||
bool IsJumpingAllowed() const;
|
||||
bool IsCrouchingAllowed() const;
|
||||
bool IsFreelookAllowed() const;
|
||||
|
|
|
@ -1216,6 +1216,28 @@ DEFINE_MAP_OPTION(hazardflash, true)
|
|||
info->hazardflash = V_GetColor(NULL, parse.sc);
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(fogdensity, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetNumber();
|
||||
info->fogdensity = clamp(parse.sc.Number, 0, 512) >> 1;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(outsidefogdensity, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetNumber();
|
||||
info->outsidefogdensity = clamp(parse.sc.Number, 0, 512) >> 1;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(skyfog, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetNumber();
|
||||
info->skyfog = parse.sc.Number;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// All flag based map options
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actorinlines.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "gl/utility/gl_geometric.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
|
@ -464,6 +465,39 @@ bool gl_SetupLightTexture()
|
|||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Check fog in current sector for placing into the proper draw list.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static bool gl_CheckFog(FColormap *cm, int lightlevel)
|
||||
{
|
||||
bool frontfog;
|
||||
|
||||
PalEntry fogcolor = cm->FadeColor;
|
||||
|
||||
if ((fogcolor.d & 0xffffff) == 0)
|
||||
{
|
||||
frontfog = false;
|
||||
}
|
||||
else if (level.outsidefogdensity != 0 && APART(level.info->outsidefog) != 0xff && (fogcolor.d & 0xffffff) == (level.info->outsidefog & 0xffffff))
|
||||
{
|
||||
frontfog = true;
|
||||
}
|
||||
else if (level.fogdensity != 0 || (glset.lightmode & 4) || cm->fogdensity > 0)
|
||||
{
|
||||
// case 3: level has fog density set
|
||||
frontfog = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// case 4: use light level
|
||||
frontfog = lightlevel < 248;
|
||||
}
|
||||
return frontfog;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -172,50 +172,6 @@ void AdjustSpriteOffsets()
|
|||
|
||||
|
||||
|
||||
// Normally this would be better placed in p_lnspec.cpp.
|
||||
// But I have accidentally overwritten that file several times
|
||||
// so I'd rather place it here.
|
||||
int LS_Sector_SetPlaneReflection (line_t *ln, AActor *it, bool backSide,
|
||||
int arg0, int arg1, int arg2, int arg3, int arg4)
|
||||
{
|
||||
// Sector_SetPlaneReflection (tag, floor, ceiling)
|
||||
int secnum;
|
||||
FSectorTagIterator itr(arg0);
|
||||
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
{
|
||||
sector_t * s = &level.sectors[secnum];
|
||||
if (!s->floorplane.isSlope()) s->reflect[sector_t::floor] = arg1/255.f;
|
||||
if (!s->ceilingplane.isSlope()) level.sectors[secnum].reflect[sector_t::ceiling] = arg2/255.f;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int LS_SetGlobalFogParameter (line_t *ln, AActor *it, bool backSide,
|
||||
int arg0, int arg1, int arg2, int arg3, int arg4)
|
||||
{
|
||||
// SetGlobalFogParameter (type, value)
|
||||
switch(arg0)
|
||||
{
|
||||
case 0:
|
||||
fogdensity = arg1>>1;
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
outsidefogdensity = arg1>>1;
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
skyfog = arg1;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Portal identifier lists
|
||||
|
@ -234,9 +190,6 @@ struct FGLROptions : public FOptionalMapinfoData
|
|||
FGLROptions()
|
||||
{
|
||||
identifier = "gl_renderer";
|
||||
fogdensity = 0;
|
||||
outsidefogdensity = 0;
|
||||
skyfog = 0;
|
||||
brightfog = false;
|
||||
lightmode = -1;
|
||||
nocoloredspritelighting = -1;
|
||||
|
@ -251,9 +204,6 @@ struct FGLROptions : public FOptionalMapinfoData
|
|||
{
|
||||
FGLROptions *newopt = new FGLROptions;
|
||||
newopt->identifier = identifier;
|
||||
newopt->fogdensity = fogdensity;
|
||||
newopt->outsidefogdensity = outsidefogdensity;
|
||||
newopt->skyfog = skyfog;
|
||||
newopt->lightmode = lightmode;
|
||||
newopt->nocoloredspritelighting = nocoloredspritelighting;
|
||||
newopt->nolightfade = nolightfade;
|
||||
|
@ -264,9 +214,6 @@ struct FGLROptions : public FOptionalMapinfoData
|
|||
newopt->lightadditivesurfaces = lightadditivesurfaces;
|
||||
return newopt;
|
||||
}
|
||||
int fogdensity;
|
||||
int outsidefogdensity;
|
||||
int skyfog;
|
||||
int lightmode;
|
||||
int brightfog;
|
||||
int8_t lightadditivesurfaces;
|
||||
|
@ -278,14 +225,6 @@ struct FGLROptions : public FOptionalMapinfoData
|
|||
float pixelstretch;
|
||||
};
|
||||
|
||||
DEFINE_MAP_OPTION(fogdensity, false)
|
||||
{
|
||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetNumber();
|
||||
opt->fogdensity = parse.sc.Number;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(brightfog, false)
|
||||
{
|
||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||
|
@ -294,22 +233,6 @@ DEFINE_MAP_OPTION(brightfog, false)
|
|||
opt->brightfog = parse.sc.Number;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(outsidefogdensity, false)
|
||||
{
|
||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetNumber();
|
||||
opt->outsidefogdensity = parse.sc.Number;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(skyfog, false)
|
||||
{
|
||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetNumber();
|
||||
opt->skyfog = parse.sc.Number;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(lightmode, false)
|
||||
{
|
||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||
|
@ -440,7 +363,6 @@ void InitGLRMapinfoData()
|
|||
|
||||
if (opt != NULL)
|
||||
{
|
||||
gl_SetFogParams(clamp(opt->fogdensity, 0, 255), level.info->outsidefog, clamp(opt->outsidefogdensity, 0, 255), opt->skyfog);
|
||||
glset.map_lightmode = opt->lightmode;
|
||||
glset.map_lightadditivesurfaces = opt->lightadditivesurfaces;
|
||||
glset.map_brightfog = opt->brightfog;
|
||||
|
@ -453,7 +375,6 @@ void InitGLRMapinfoData()
|
|||
}
|
||||
else
|
||||
{
|
||||
gl_SetFogParams(0, level.info->outsidefog, 0, 0);
|
||||
glset.map_lightmode = -1;
|
||||
glset.map_lightadditivesurfaces = -1;
|
||||
glset.map_brightfog = -1;
|
||||
|
|
|
@ -206,12 +206,3 @@ bool gl_GetWallGlow(sector_t *sector, float *topglowcolor, float *bottomglowcolo
|
|||
return ret;
|
||||
}
|
||||
|
||||
#include "c_dispatch.h"
|
||||
#include "d_player.h"
|
||||
|
||||
CCMD(setglow)
|
||||
{
|
||||
auto s = players[0].mo->Sector;
|
||||
s->planes[sector_t::floor].GlowHeight = 128;
|
||||
s->planes[sector_t::floor].GlowColor = 0xff0000;
|
||||
}
|
||||
|
|
|
@ -42,10 +42,6 @@
|
|||
|
||||
// externally settable lighting properties
|
||||
static float distfogtable[2][256]; // light to fog conversion table for black fog
|
||||
static PalEntry outsidefogcolor;
|
||||
int fogdensity;
|
||||
int outsidefogdensity;
|
||||
int skyfog;
|
||||
|
||||
CVAR(Int, gl_weaponlight, 8, CVAR_ARCHIVE);
|
||||
CUSTOM_CVAR(Bool, gl_enhanced_nightvision, true, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
|
@ -165,23 +161,6 @@ void gl_GetRenderStyle(FRenderStyle style, bool drawopaque, bool allowcolorblend
|
|||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Set fog parameters for the level
|
||||
//
|
||||
//==========================================================================
|
||||
void gl_SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog)
|
||||
{
|
||||
fogdensity=_fogdensity;
|
||||
outsidefogcolor=_outsidefogcolor;
|
||||
outsidefogdensity=_outsidefogdensity;
|
||||
skyfog=_skyfog;
|
||||
|
||||
outsidefogdensity>>=1;
|
||||
fogdensity>>=1;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Get current light level
|
||||
|
@ -301,7 +280,7 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
|
|||
if (glset.lightmode & 4)
|
||||
{
|
||||
// uses approximations of Legacy's default settings.
|
||||
density = fogdensity ? fogdensity : 18;
|
||||
density = level.fogdensity ? level.fogdensity : 18;
|
||||
}
|
||||
else if (sectorfogdensity != 0)
|
||||
{
|
||||
|
@ -320,15 +299,15 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
|
|||
density = 0;
|
||||
}
|
||||
}
|
||||
else if (outsidefogdensity != 0 && outsidefogcolor.a != 0xff && (fogcolor.d & 0xffffff) == (outsidefogcolor.d & 0xffffff))
|
||||
else if (level.outsidefogdensity != 0 && APART(level.info->outsidefog) != 0xff && (fogcolor.d & 0xffffff) == (level.info->outsidefog & 0xffffff))
|
||||
{
|
||||
// case 3. outsidefogdensity has already been set as needed
|
||||
density = outsidefogdensity;
|
||||
density = level.outsidefogdensity;
|
||||
}
|
||||
else if (fogdensity != 0)
|
||||
else if (level.fogdensity != 0)
|
||||
{
|
||||
// case 4: level has fog density set
|
||||
density = fogdensity;
|
||||
density = level.fogdensity;
|
||||
}
|
||||
else if (lightlevel < 248)
|
||||
{
|
||||
|
@ -343,40 +322,6 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
|
|||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Check fog by current lighting info
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool gl_CheckFog(FColormap *cm, int lightlevel)
|
||||
{
|
||||
// Check for fog boundaries. This needs a few more checks for the sectors
|
||||
bool frontfog;
|
||||
|
||||
PalEntry fogcolor = cm->FadeColor;
|
||||
|
||||
if ((fogcolor.d & 0xffffff) == 0)
|
||||
{
|
||||
frontfog = false;
|
||||
}
|
||||
else if (outsidefogdensity != 0 && outsidefogcolor.a!=0xff && (fogcolor.d & 0xffffff) == (outsidefogcolor.d & 0xffffff))
|
||||
{
|
||||
frontfog = true;
|
||||
}
|
||||
else if (fogdensity!=0 || (glset.lightmode & 4))
|
||||
{
|
||||
// case 3: level has fog density set
|
||||
frontfog = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// case 4: use light level
|
||||
frontfog = lightlevel < 248;
|
||||
}
|
||||
return frontfog;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Check if the current linedef is a candidate for a fog boundary
|
||||
|
@ -400,10 +345,13 @@ bool gl_CheckFog(sector_t *frontsector, sector_t *backsector)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
else if (outsidefogdensity != 0 && outsidefogcolor.a!=0xff && (fogcolor.d & 0xffffff) == (outsidefogcolor.d & 0xffffff))
|
||||
else if (fogcolor.a != 0)
|
||||
{
|
||||
}
|
||||
else if (fogdensity!=0 || (glset.lightmode & 4))
|
||||
else if (level.outsidefogdensity != 0 && APART(level.info->outsidefog) != 0xff && (fogcolor.d & 0xffffff) == (level.info->outsidefog & 0xffffff))
|
||||
{
|
||||
}
|
||||
else if (level.fogdensity!=0 || (glset.lightmode & 4))
|
||||
{
|
||||
// case 3: level has fog density set
|
||||
}
|
||||
|
@ -418,11 +366,11 @@ bool gl_CheckFog(sector_t *frontsector, sector_t *backsector)
|
|||
if ((fogcolor.d & 0xffffff) == 0)
|
||||
{
|
||||
}
|
||||
else if (outsidefogdensity != 0 && outsidefogcolor.a!=0xff && (fogcolor.d & 0xffffff) == (outsidefogcolor.d & 0xffffff))
|
||||
else if (level.outsidefogdensity != 0 && APART(level.info->outsidefog) != 0xff && (fogcolor.d & 0xffffff) == (level.info->outsidefog & 0xffffff))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (fogdensity!=0 || (glset.lightmode & 4))
|
||||
else if (level.fogdensity!=0 || (glset.lightmode & 4))
|
||||
{
|
||||
// case 3: level has fog density set
|
||||
return false;
|
||||
|
@ -539,18 +487,3 @@ void gl_SetFog(int lightlevel, int rellight, bool fullbright, const FColormap *c
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// For testing sky fog sheets
|
||||
//
|
||||
//==========================================================================
|
||||
CCMD(skyfog)
|
||||
{
|
||||
if (argv.argc()>1)
|
||||
{
|
||||
skyfog = MAX(0, (int)strtoull(argv[1], NULL, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,14 +13,12 @@ inline int gl_ClampLight(int lightlevel)
|
|||
|
||||
void gl_GetRenderStyle(FRenderStyle style, bool drawopaque, bool allowcolorblending,
|
||||
int *tm, int *sb, int *db, int *be);
|
||||
void gl_SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog);
|
||||
|
||||
int gl_CalcLightLevel(int lightlevel, int rellight, bool weapon);
|
||||
void gl_SetColor(int light, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon=false);
|
||||
|
||||
float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity);
|
||||
struct sector_t;
|
||||
bool gl_CheckFog(FColormap *cm, int lightlevel);
|
||||
bool gl_CheckFog(sector_t *frontsector, sector_t *backsector);
|
||||
|
||||
void gl_SetFog(int lightlevel, int rellight, bool fullbright, const FColormap *cm, bool isadditive);
|
||||
|
@ -35,11 +33,6 @@ inline bool gl_isWhite(PalEntry color)
|
|||
return color.r + color.g + color.b == 3*0xff;
|
||||
}
|
||||
|
||||
extern int fogdensity;
|
||||
extern int outsidefogdensity;
|
||||
extern int skyfog;
|
||||
|
||||
|
||||
inline void FColormap::CopyFrom3DLight(lightlist_t *light)
|
||||
{
|
||||
LightColor = light->extra_colormap->Color;
|
||||
|
|
|
@ -991,7 +991,6 @@ struct FGLInterface : public FRenderer
|
|||
void StartSerialize(FSerializer &arc) override;
|
||||
void EndSerialize(FSerializer &arc) override;
|
||||
void RenderTextureView (FCanvasTexture *self, AActor *viewpoint, int fov) override;
|
||||
void SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog) override;
|
||||
void PreprocessLevel() override;
|
||||
void CleanLevelData() override;
|
||||
bool RequireGLNodes() override;
|
||||
|
@ -1033,19 +1032,13 @@ void FGLInterface::Precache(uint8_t *texhitlist, TMap<PClassActor*, bool> &actor
|
|||
|
||||
void FGLInterface::StartSerialize(FSerializer &arc)
|
||||
{
|
||||
if (arc.BeginObject("glinfo"))
|
||||
{
|
||||
arc("fogdensity", fogdensity)
|
||||
("outsidefogdensity", outsidefogdensity)
|
||||
("skyfog", skyfog)
|
||||
.EndObject();
|
||||
}
|
||||
}
|
||||
|
||||
void FGLInterface::EndSerialize(FSerializer &arc)
|
||||
{
|
||||
if (arc.isReading())
|
||||
{
|
||||
// The portal data needs to be recreated after reading a savegame.
|
||||
gl_InitPortals();
|
||||
}
|
||||
}
|
||||
|
@ -1170,11 +1163,6 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FGLInterface::SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog)
|
||||
{
|
||||
gl_SetFogParams(_fogdensity, _outsidefogcolor, _outsidefogdensity, _skyfog);
|
||||
}
|
||||
|
||||
void FGLInterface::PreprocessLevel()
|
||||
{
|
||||
gl_PreprocessLevel();
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "gl/utility/gl_convert.h"
|
||||
|
||||
CVAR(Bool,gl_noskyboxes, false, 0)
|
||||
extern int skyfog;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -98,7 +97,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
|
|||
x_offset[0] = GLRenderer->mSky1Pos;
|
||||
}
|
||||
}
|
||||
if (skyfog > 0)
|
||||
if (level.skyfog > 0)
|
||||
{
|
||||
fadecolor = FadeColor;
|
||||
fadecolor.a = 0;
|
||||
|
|
|
@ -86,8 +86,6 @@
|
|||
|
||||
CVAR(Float, skyoffset, 0, 0) // for testing
|
||||
|
||||
extern int skyfog;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -545,10 +543,10 @@ void GLSkyPortal::DrawContents()
|
|||
RenderDome(origin->texture[1], origin->x_offset[1], origin->y_offset, false, FSkyVertexBuffer::SKYMODE_SECONDLAYER);
|
||||
}
|
||||
|
||||
if (skyfog>0 && drawer->FixedColormap == CM_DEFAULT && (origin->fadecolor & 0xffffff) != 0)
|
||||
if (::level.skyfog>0 && drawer->FixedColormap == CM_DEFAULT && (origin->fadecolor & 0xffffff) != 0)
|
||||
{
|
||||
PalEntry FadeColor = origin->fadecolor;
|
||||
FadeColor.a = clamp<int>(skyfog, 0, 255);
|
||||
FadeColor.a = clamp<int>(::level.skyfog, 0, 255);
|
||||
|
||||
gl_RenderState.EnableTexture(false);
|
||||
gl_RenderState.SetObjectColor(FadeColor);
|
||||
|
|
|
@ -1649,7 +1649,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
|||
bool isportal = seg->linedef->isVisualPortal() && seg->sidedef == seg->linedef->sidedef[0];
|
||||
sector_t *backsec = isportal? seg->linedef->getPortalDestination()->frontsector : backsector;
|
||||
|
||||
bool drawfogboundary = gl_CheckFog(frontsector, backsec);
|
||||
bool drawfogboundary = mDrawer->FixedColormap != CM_DEFAULT && gl_CheckFog(frontsector, backsec);
|
||||
FTexture *tex = TexMan(seg->sidedef->GetTexture(side_t::mid));
|
||||
if (tex != NULL)
|
||||
{
|
||||
|
|
|
@ -3350,6 +3350,79 @@ FUNC(LS_Line_SetPortalTarget)
|
|||
return P_ChangePortal(ln, arg0, arg1);
|
||||
}
|
||||
|
||||
FUNC(LS_Sector_SetPlaneReflection)
|
||||
// Sector_SetPlaneReflection (tag, floor, ceiling)
|
||||
{
|
||||
int secnum;
|
||||
FSectorTagIterator itr(arg0);
|
||||
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
{
|
||||
sector_t * s = &level.sectors[secnum];
|
||||
if (!s->floorplane.isSlope()) s->reflect[sector_t::floor] = arg1 / 255.f;
|
||||
if (!s->ceilingplane.isSlope()) level.sectors[secnum].reflect[sector_t::ceiling] = arg2 / 255.f;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
FUNC(LS_SetGlobalFogParameter)
|
||||
// SetGlobalFogParameter (type, value)
|
||||
{
|
||||
switch (arg0)
|
||||
{
|
||||
case 0:
|
||||
level.fogdensity = arg1 >> 1;
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
level.outsidefogdensity = arg1 >> 1;
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
level.skyfog = arg1;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
FUNC(LS_Sector_SetFloorGlow)
|
||||
// Sector_SetFloorGlow(tag, height, r, g, b)
|
||||
{
|
||||
int secnum;
|
||||
PalEntry color(arg2, arg3, arg4);
|
||||
if (arg1 < 0) color = -1; // negative height invalidates the glow.
|
||||
FSectorTagIterator itr(arg0);
|
||||
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
{
|
||||
sector_t * s = &level.sectors[secnum];
|
||||
s->SetGlowColor(sector_t::floor, color);
|
||||
s->SetGlowHeight(sector_t::floor, float(arg1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FUNC(LS_Sector_SetCeilingGlow)
|
||||
// Sector_SetCeilingGlow(tag, height, r, g, b)
|
||||
{
|
||||
int secnum;
|
||||
PalEntry color(arg2, arg3, arg4);
|
||||
if (arg1 < 0) color = -1; // negative height invalidates the glow.
|
||||
FSectorTagIterator itr(arg0);
|
||||
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
{
|
||||
sector_t * s = &level.sectors[secnum];
|
||||
s->SetGlowColor(sector_t::ceiling, color);
|
||||
s->SetGlowHeight(sector_t::ceiling, float(arg1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static lnSpecFunc LineSpecials[] =
|
||||
{
|
||||
/* 0 */ LS_NOP,
|
||||
|
@ -3630,6 +3703,9 @@ static lnSpecFunc LineSpecials[] =
|
|||
/* 274 */ LS_Door_AnimatedClose,
|
||||
/* 275 */ LS_Floor_Stop,
|
||||
/* 276 */ LS_Ceiling_Stop,
|
||||
/* 277 */ LS_Sector_SetFloorGlow,
|
||||
/* 278 */ LS_Sector_SetCeilingGlow,
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -944,7 +944,10 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
("level.maptime", level.maptime)
|
||||
("level.totaltime", i)
|
||||
("level.skytexture1", level.skytexture1)
|
||||
("level.skytexture2", level.skytexture2);
|
||||
("level.skytexture2", level.skytexture2)
|
||||
("level.fogdensity", level.fogdensity)
|
||||
("level.outsidefogdensity", level.outsidefogdensity)
|
||||
("level.skyfog", level.skyfog);
|
||||
|
||||
// Hub transitions must keep the current total time
|
||||
if (!hubload)
|
||||
|
|
|
@ -1847,6 +1847,38 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, GetGlowHeight)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
ACTION_RETURN_FLOAT(self->GetGlowHeight(pos));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, GetGlowColor)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
ACTION_RETURN_INT(self->GetGlowColor(pos));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, SetGlowHeight)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
PARAM_FLOAT(o);
|
||||
self->SetGlowHeight(pos, float(o));
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, SetGlowColor)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
PARAM_COLOR(o);
|
||||
self->SetGlowColor(pos, o);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// line_t exports
|
||||
|
@ -2034,6 +2066,7 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
|
|||
ACTION_RETURN_INT(self->Index());
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
|
|
20
src/r_defs.h
20
src/r_defs.h
|
@ -794,6 +794,26 @@ public:
|
|||
planes[pos].Light = level;
|
||||
}
|
||||
|
||||
double GetGlowHeight(int pos)
|
||||
{
|
||||
return planes[pos].GlowHeight;
|
||||
}
|
||||
|
||||
PalEntry GetGlowColor(int pos)
|
||||
{
|
||||
return planes[pos].GlowColor;
|
||||
}
|
||||
|
||||
void SetGlowHeight(int pos, float height)
|
||||
{
|
||||
planes[pos].GlowHeight = height;
|
||||
}
|
||||
|
||||
void SetGlowColor(int pos, PalEntry color)
|
||||
{
|
||||
planes[pos].GlowColor = color;
|
||||
}
|
||||
|
||||
FTextureID GetTexture(int pos) const
|
||||
{
|
||||
return planes[pos].Texture;
|
||||
|
|
|
@ -53,7 +53,6 @@ struct FRenderer
|
|||
virtual void SetClearColor(int color) = 0;
|
||||
virtual void Init() = 0;
|
||||
virtual void RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov) = 0;
|
||||
virtual void SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog) {}
|
||||
virtual void PreprocessLevel() {}
|
||||
virtual void CleanLevelData() {}
|
||||
virtual bool RequireGLNodes() { return false; }
|
||||
|
|
|
@ -323,7 +323,7 @@ void ReadPalette(int lumpnum, uint8_t *buffer)
|
|||
{
|
||||
FScanner sc;
|
||||
|
||||
sc.OpenMem(Wads.GetLumpFullName(lumpnum), (char*)lumpmem, lump.GetSize());
|
||||
sc.OpenMem(Wads.GetLumpFullName(lumpnum), (char*)lumpmem, int(lump.GetSize()));
|
||||
sc.MustGetString();
|
||||
sc.MustGetNumber(); // version - ignore
|
||||
sc.MustGetNumber();
|
||||
|
|
|
@ -485,6 +485,9 @@ struct LevelLocals native
|
|||
native bool frozen;
|
||||
native readonly bool infinite_flight;
|
||||
native readonly bool no_dlg_freeze;
|
||||
native readonly int fogdensity;
|
||||
native readonly int outsidefogdensity;
|
||||
native readonly int skyfog;
|
||||
// level_info_t *info cannot be done yet.
|
||||
|
||||
native String GetUDMFString(int type, int index, Name key);
|
||||
|
|
|
@ -360,6 +360,11 @@ struct Sector native play
|
|||
native void ChangeFlags(int pos, int And, int Or);
|
||||
native int GetPlaneLight(int pos);
|
||||
native void SetPlaneLight(int pos, int level);
|
||||
native double GetGlowHeight(int pos);
|
||||
native color GetGlowColor(int pos);
|
||||
native void SetGlowHeight(int pos, double height);
|
||||
native void SetGlowColor(int pos, color color);
|
||||
|
||||
native TextureID GetTexture(int pos);
|
||||
native void SetTexture(int pos, TextureID tex, bool floorclip = true);
|
||||
native double GetPlaneTexZ(int pos);
|
||||
|
|
Loading…
Reference in a new issue