# Conflicts:
#	src/r_bsp.cpp
#	src/r_main.cpp
#	src/r_segs.cpp
#	src/r_things.cpp
#	wadsrc/static/language.enu
#	wadsrc/static/menudef.txt
This commit is contained in:
Rachael Alexanderson 2017-01-28 17:39:55 -05:00
commit 0c101102dc
41 changed files with 187 additions and 86 deletions

View file

@ -1898,6 +1898,7 @@ void AM_drawSubsectors()
double scalex, scaley;
double originx, originy;
FDynamicColormap *colormap;
PalEntry flatcolor;
mpoint_t originpt;
screen->StartSimplePolys();
@ -1941,6 +1942,7 @@ void AM_drawSubsectors()
colormap = sec->ColorMap;
FTextureID maptex = sec->GetTexture(sector_t::floor);
flatcolor = sec->SpecialColors[sector_t::floor];
scalex = sec->GetXScale(sector_t::floor);
scaley = sec->GetYScale(sector_t::floor);
@ -1989,6 +1991,7 @@ void AM_drawSubsectors()
if (roverz < cmpz)
{
maptex = *(rover->top.texture);
flatcolor = *(rover->top.flatcolor);
floorplane = rover->top.plane;
sector_t *model = rover->top.model;
int selector = (rover->flags & FF_INVERTPLANES) ? sector_t::floor : sector_t::ceiling;
@ -2049,6 +2052,7 @@ void AM_drawSubsectors()
scale / scaley,
rotation,
colormap,
flatcolor,
floorlight,
f_y + f_h
);

View file

@ -3875,7 +3875,7 @@ void FParser::SF_SetColor(void)
color.r=intvalue(t_argv[1]);
color.g=intvalue(t_argv[2]);
color.b=intvalue(t_argv[3]);
color.a=0;
color.a = 0;
}
else return;
@ -3883,7 +3883,17 @@ void FParser::SF_SetColor(void)
FSSectorTagIterator itr(tagnum);
while ((i = itr.Next()) >= 0)
{
level.sectors[i].ColorMap = GetSpecialLights (color, level.sectors[i].ColorMap->Fade, 0);
if (!DFraggleThinker::ActiveThinker->setcolormaterial)
level.sectors[i].ColorMap = GetSpecialLights(color, level.sectors[i].ColorMap->Fade, 0);
else
{
// little hack for testing the D64 color stuff.
for (int j = 0; j < 4; j++) level.sectors[i].SpecialColors[j] = color;
// simulates 'nocoloredspritelighting' settings.
int v = (color.r + color.g + color.b) / 3;
v = (255 + v + v) / 3;
level.sectors[i].SpecialColors[sector_t::sprites] = PalEntry(255, v, v, v);
}
}
}
}

View file

@ -73,15 +73,18 @@ struct FFsOptions : public FOptionalMapinfoData
{
identifier = "fragglescript";
nocheckposition = false;
setcolormaterial = false;
}
virtual FOptionalMapinfoData *Clone() const
{
FFsOptions *newopt = new FFsOptions;
newopt->identifier = identifier;
newopt->nocheckposition = nocheckposition;
newopt->setcolormaterial = setcolormaterial;
return newopt;
}
bool nocheckposition;
bool setcolormaterial;
};
DEFINE_MAP_OPTION(fs_nocheckposition, false)
@ -99,6 +102,21 @@ DEFINE_MAP_OPTION(fs_nocheckposition, false)
}
}
DEFINE_MAP_OPTION(fs_setcolormaterial, false)
{
FFsOptions *opt = info->GetOptData<FFsOptions>("fragglescript");
if (parse.CheckAssign())
{
parse.sc.MustGetNumber();
opt->setcolormaterial = !!parse.sc.Number;
}
else
{
opt->setcolormaterial = true;
}
}
//-----------------------------------------------------------------------------
//
// Process the lump to strip all unneeded information from it
@ -307,6 +325,7 @@ bool FScriptLoader::ParseInfo(MapData * map)
if (opt != NULL)
{
DFraggleThinker::ActiveThinker->nocheckposition = opt->nocheckposition;
DFraggleThinker::ActiveThinker->setcolormaterial = opt->setcolormaterial;
}
}

View file

@ -695,6 +695,7 @@ public:
TObjPtr<DRunningScript> RunningScripts;
TArray<TObjPtr<AActor> > SpawnedThings;
bool nocheckposition;
bool setcolormaterial;
DFraggleThinker();
void OnDestroy() override;

View file

@ -101,7 +101,6 @@ EXTERN_CVAR (Float, sv_gravity)
EXTERN_CVAR (Float, sv_aircontrol)
EXTERN_CVAR (Int, disableautosave)
EXTERN_CVAR (String, playerclass)
EXTERN_CVAR(Int, r_preservesectorcolor)
#define SNAP_ID MAKE_ID('s','n','A','p')
#define DSNP_ID MAKE_ID('d','s','N','p')
@ -1489,20 +1488,6 @@ bool FLevelLocals::IsFreelookAllowed() const
//
//==========================================================================
bool FLevelLocals::PreserveSectorColor() const
{
if (r_preservesectorcolor == 0)
return false;
if (r_preservesectorcolor == 1)
return true;
return !!(level.flags3 & LEVEL3_PRESERVESECTORCOLOR);
}
//==========================================================================
//
//
//==========================================================================
FString CalcMapName (int episode, int level)
{
FString lumpname;

View file

@ -223,7 +223,6 @@ enum ELevelFlags : unsigned int
// More flags!
LEVEL3_FORCEFAKECONTRAST = 0x00000001, // forces fake contrast even with fog enabled
LEVEL3_PRESERVESECTORCOLOR = 0x00000002,
};

View file

@ -79,7 +79,6 @@ struct FLevelLocals
bool IsJumpingAllowed() const;
bool IsCrouchingAllowed() const;
bool IsFreelookAllowed() const;
bool PreserveSectorColor() const;
};
extern FLevelLocals level;

View file

@ -1282,8 +1282,6 @@ MapFlagHandlers[] =
{ "unfreezesingleplayerconversations",MITYPE_SETFLAG2, LEVEL2_CONV_SINGLE_UNFREEZE, 0 },
{ "spawnwithweaponraised", MITYPE_SETFLAG2, LEVEL2_PRERAISEWEAPON, 0 },
{ "forcefakecontrast", MITYPE_SETFLAG3, LEVEL3_FORCEFAKECONTRAST, 0 },
{ "preservesectorcolor", MITYPE_SETFLAG3, LEVEL3_PRESERVESECTORCOLOR, 0 },
{ "nopreservesectorcolor", MITYPE_CLRFLAG3, LEVEL3_PRESERVESECTORCOLOR, 0 },
{ "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes
{ "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 },
{ "compat_stairs", MITYPE_COMPATFLAG, COMPATF_STAIRINDEX, 0 },

View file

@ -174,7 +174,7 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley,
DAngle rotation, FDynamicColormap *colormap, int lightlevel)
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel)
{
FMaterial *gltexture = FMaterial::ValidateTexture(texture, false);
@ -191,6 +191,7 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
poly.mLightLevel = lightlevel;
poly.mVertCount = npoints;
poly.mVertIndex = (int)mVertices.Reserve(npoints);
poly.mFlatColor = flatcolor;
bool dorotate = rotation != 0;
@ -438,8 +439,10 @@ void F2DDrawer::Draw()
cm = dsp->mColormap;
gl_SetColor(dsp->mLightLevel, 0, cm, 1.f);
gl_RenderState.SetMaterial(dsp->mTexture, CLAMP_NONE, 0, -1, false);
gl_RenderState.SetObjectColor(dsp->mFlatColor|0xff000000);
gl_RenderState.Apply();
glDrawArrays(GL_TRIANGLE_FAN, dsp->mVertIndex, dsp->mVertCount);
gl_RenderState.SetObjectColor(0xffffffff);
break;
}

View file

@ -45,6 +45,7 @@ class F2DDrawer : public FSimpleVertexBuffer
FMaterial *mTexture;
int mLightLevel;
FDynamicColormap *mColormap;
PalEntry mFlatColor;
};
TArray<FSimpleVertex> mVertices;
@ -61,7 +62,7 @@ public:
void AddPoly(FTexture *texture, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley,
DAngle rotation, FDynamicColormap *colormap, int lightlevel);
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel);
void AddLine(int x1, int y1, int x2, int y2, int palcolor, uint32 color);
void AddPixel(int x1, int y1, int palcolor, uint32 color);

View file

@ -304,6 +304,11 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
// uses approximations of Legacy's default settings.
density = fogdensity ? fogdensity : 18;
}
else if (sectorfogdensity != 0)
{
// case 2: Sector has an explicit fog density set.
density = sectorfogdensity;
}
else if ((fogcolor.d & 0xffffff) == 0)
{
// case 1: black fog
@ -316,11 +321,6 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
density = 0;
}
}
else if (sectorfogdensity != 0)
{
// case 2: Sector has an explicit fog density set.
density = sectorfogdensity;
}
else if (outsidefogdensity != 0 && outsidefogcolor.a != 0xff && (fogcolor.d & 0xffffff) == (outsidefogcolor.d & 0xffffff))
{
// case 3. outsidefogdensity has already been set as needed

View file

@ -216,7 +216,7 @@ public:
void FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley,
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip);
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip);
int PTM_BestColor (const uint32 *pal_in, int r, int g, int b, int first, int num);

View file

@ -72,6 +72,7 @@ void FRenderState::Reset()
mModelMatrixEnabled = false;
mTextureMatrixEnabled = false;
mObjectColor = 0xffffffff;
mObjectColor2 = 0;
mVertexBuffer = mCurrentVertexBuffer = NULL;
mColormapState = CM_DEFAULT;
mSoftLight = 0;
@ -141,10 +142,11 @@ bool FRenderState::ApplyShader()
fogset = -gl_fogmode;
}
}
glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec);
glVertexAttrib4fv(VATTR_COLOR, mColor.vec);
activeShader->muObjectColor.Set(mObjectColor);
glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec);
//activeShader->muObjectColor2.Set(mObjectColor2);
activeShader->muObjectColor2.Set(mObjectColor2);
activeShader->muDesaturation.Set(mDesaturation / 255.f);
activeShader->muFogEnabled.Set(fogset);
@ -153,6 +155,7 @@ bool FRenderState::ApplyShader()
activeShader->muCameraPos.Set(mCameraPos.vec);
activeShader->muLightParms.Set(mLightParms);
activeShader->muFogColor.Set(mFogColor);
activeShader->muObjectColor.Set(mObjectColor);
activeShader->muDynLightColor.Set(mDynColor.vec);
activeShader->muInterpolationFactor.Set(mInterpolationFactor);
activeShader->muClipHeight.Set(mClipHeight);
@ -166,8 +169,6 @@ bool FRenderState::ApplyShader()
{
activeShader->muGlowTopColor.Set(mGlowTop.vec);
activeShader->muGlowBottomColor.Set(mGlowBottom.vec);
activeShader->muGlowTopPlane.Set(mGlowTopPlane.vec);
activeShader->muGlowBottomPlane.Set(mGlowBottomPlane.vec);
activeShader->currentglowstate = 1;
}
else if (activeShader->currentglowstate)
@ -175,10 +176,13 @@ bool FRenderState::ApplyShader()
// if glowing is on, disable it.
activeShader->muGlowTopColor.Set(nulvec);
activeShader->muGlowBottomColor.Set(nulvec);
activeShader->muGlowTopPlane.Set(nulvec);
activeShader->muGlowBottomPlane.Set(nulvec);
activeShader->currentglowstate = 0;
}
if (mGlowEnabled || mObjectColor2.a != 0)
{
activeShader->muGlowTopPlane.Set(mGlowTopPlane.vec);
activeShader->muGlowBottomPlane.Set(mGlowBottomPlane.vec);
}
if (mSplitEnabled)
{

View file

@ -106,6 +106,7 @@ class FRenderState
FStateVec4 mClipLine;
PalEntry mFogColor;
PalEntry mObjectColor;
PalEntry mObjectColor2;
FStateVec4 mDynColor;
float mClipSplit[2];
@ -381,6 +382,11 @@ public:
mObjectColor = pe;
}
void SetObjectColor2(PalEntry pe)
{
mObjectColor2 = pe;
}
void SetFog(PalEntry c, float d)
{
const float LOG2E = 1.442692f; // = 1/log(2)

View file

@ -379,6 +379,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
case GLPASS_ALL: // Same, but also creates the dynlight data.
gl_SetColor(lightlevel, rel, Colormap,1.0f);
gl_SetFog(lightlevel, rel, &Colormap, false);
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
if (sector->special != GLSector_Skybox)
{
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
@ -391,6 +392,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
gl_RenderState.SetMaterial(gltexture, CLAMP_XY, 0, -1, false);
DrawSkyboxSector(pass, (pass == GLPASS_ALL || dynlightindex > -1));
}
gl_RenderState.SetObjectColor(0xffffffff);
break;
case GLPASS_LIGHTSONLY:
@ -404,7 +406,8 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
gl_SetColor(lightlevel, rel, Colormap, alpha);
gl_SetFog(lightlevel, rel, &Colormap, false);
if (!gltexture)
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
if (!gltexture)
{
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.EnableTexture(false);
@ -421,6 +424,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
gl_RenderState.EnableTextureMatrix(false);
}
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl_RenderState.SetObjectColor(0xffffffff);
break;
case GLPASS_LIGHTTEX:
@ -546,8 +550,16 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
lightlist_t *light = P_GetPlaneLight(sector, plane.plane, underside);
lightlevel = gl_ClampLight(*light->p_lightlevel);
if (rover->flags & FF_FOG) Colormap.LightColor = (light->extra_colormap)->Fade;
else Colormap.CopyFrom3DLight(light);
if (rover->flags & FF_FOG)
{
Colormap.LightColor = (light->extra_colormap)->Fade;
FlatColor = 0xffffffff;
}
else
{
Colormap.CopyFrom3DLight(light);
FlatColor = *plane.flatcolor;
}
alpha = rover->alpha/255.0f;
@ -604,6 +616,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
lightlevel = gl_ClampLight(frontsector->GetFloorLight());
Colormap = frontsector->ColorMap;
FlatColor = frontsector->SpecialColors[sector_t::floor];
port = frontsector->ValidatePortal(sector_t::floor);
if ((stack = (port != NULL)))
{
@ -663,6 +676,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
lightlevel = gl_ClampLight(frontsector->GetCeilingLight());
Colormap = frontsector->ColorMap;
FlatColor = frontsector->SpecialColors[sector_t::ceiling];
port = frontsector->ValidatePortal(sector_t::ceiling);
if ((stack = (port != NULL)))
{

View file

@ -308,6 +308,7 @@ void GLSprite::Draw(int pass)
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
gl_RenderState.SetColor(0.2f,0.2f,0.2f,fuzzalpha, Colormap.desaturation);
additivefog = true;
lightlist = nullptr; // the fuzz effect does not use the sector's light level so splitting is not needed.
}
else if (RenderStyle.BlendOp == STYLEOP_Add && RenderStyle.DestAlpha == STYLEALPHA_One)
{
@ -319,15 +320,21 @@ void GLSprite::Draw(int pass)
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.0f, -128.0f);
}
if (RenderStyle.BlendOp!=STYLEOP_Shadow)
if (RenderStyle.BlendOp != STYLEOP_Shadow)
{
if (gl_lights && GLRenderer->mLightCount && !gl_fixedcolormap && !fullbright)
{
gl_SetDynSpriteLight(gl_light_sprites ? actor : NULL, gl_light_particles ? particle : NULL);
}
PalEntry finalcol(ThingColor.a,
ThingColor.r * actor->Sector->SpecialColors[sector_t::sprites].r / 255,
ThingColor.g * actor->Sector->SpecialColors[sector_t::sprites].g / 255,
ThingColor.b * actor->Sector->SpecialColors[sector_t::sprites].b / 255);
gl_RenderState.SetObjectColor(finalcol);
gl_SetColor(lightlevel, rel, Colormap, trans);
}
gl_RenderState.SetObjectColor(ThingColor);
if (gl_isBlack(Colormap.FadeColor)) foglevel=lightlevel;

View file

@ -301,6 +301,7 @@ public:
FMaterial *gltexture;
FColormap Colormap; // light and fog
PalEntry FlatColor;
ERenderStyle renderstyle;
float alpha;

View file

@ -24,6 +24,7 @@
#include "p_local.h"
#include "p_lnspec.h"
#include "a_sharedglobal.h"
#include "g_levellocals.h"
#include "gl/gl_functions.h"
#include "gl/system/gl_interface.h"
@ -326,9 +327,9 @@ void GLWall::RenderTextured(int rflags)
if (flags & GLWF_GLOW)
{
gl_RenderState.EnableGlow(true);
gl_RenderState.SetGlowPlanes(topplane, bottomplane);
gl_RenderState.SetGlowParams(topglowcolor, bottomglowcolor);
}
gl_RenderState.SetGlowPlanes(topplane, bottomplane);
gl_RenderState.SetMaterial(gltexture, flags & 3, 0, -1, false);
if (type == RENDERWALL_M2SNF)
@ -339,12 +340,14 @@ void GLWall::RenderTextured(int rflags)
}
gl_SetFog(255, 0, NULL, false);
}
gl_RenderState.SetObjectColor(seg->frontsector->SpecialColors[sector_t::walltop] | 0xff000000);
gl_RenderState.SetObjectColor2(seg->frontsector->SpecialColors[sector_t::wallbottom] | 0xff000000);
float absalpha = fabsf(alpha);
if (lightlist == NULL)
{
gl_SetColor(lightlevel, rel, Colormap, absalpha);
if (type != RENDERWALL_M2SNF) gl_SetFog(lightlevel, rel, &Colormap, RenderStyle == STYLE_Add);
gl_SetColor(lightlevel, rel, Colormap, absalpha);
RenderWall(rflags);
}
else
@ -374,6 +377,8 @@ void GLWall::RenderTextured(int rflags)
gl_RenderState.EnableSplit(false);
}
gl_RenderState.SetObjectColor(0xffffffff);
gl_RenderState.SetObjectColor2(0);
gl_RenderState.SetTextureMode(tmode);
gl_RenderState.EnableGlow(false);
}

View file

@ -370,7 +370,12 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
// now draw the different layers of the weapon
gl_RenderState.EnableBrightmap(true);
gl_RenderState.SetObjectColor(ThingColor);
PalEntry finalcol(ThingColor.a,
ThingColor.r * viewsector->SpecialColors[sector_t::sprites].r / 255,
ThingColor.g * viewsector->SpecialColors[sector_t::sprites].g / 255,
ThingColor.b * viewsector->SpecialColors[sector_t::sprites].b / 255);
gl_RenderState.SetObjectColor(finalcol);
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
// hack alert! Rather than changing everything in the underlying lighting code let's just temporarily change

View file

@ -225,6 +225,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
muFogColor.Init(hShader, "uFogColor");
muDynLightColor.Init(hShader, "uDynLightColor");
muObjectColor.Init(hShader, "uObjectColor");
muObjectColor2.Init(hShader, "uObjectColor2");
muGlowBottomColor.Init(hShader, "uGlowBottomColor");
muGlowTopColor.Init(hShader, "uGlowTopColor");
muGlowBottomPlane.Init(hShader, "uGlowBottomPlane");

View file

@ -271,6 +271,7 @@ class FShader
FBufferedUniformPE muFogColor;
FBufferedUniform4f muDynLightColor;
FBufferedUniformPE muObjectColor;
FBufferedUniformPE muObjectColor2;
FUniform4f muGlowBottomColor;
FUniform4f muGlowTopColor;
FUniform4f muGlowBottomPlane;

View file

@ -470,11 +470,11 @@ void OpenGLFrameBuffer::Clear(int left, int top, int right, int bottom, int palc
void OpenGLFrameBuffer::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley,
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip)
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
{
if (GLRenderer != nullptr && GLRenderer->m2DDrawer != nullptr && npoints >= 3)
{
GLRenderer->m2DDrawer->AddPoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel);
GLRenderer->m2DDrawer->AddPoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, flatcolor, lightlevel);
}
}

View file

@ -71,7 +71,7 @@ public:
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley,
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip);
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip);
FNativePalette *CreatePalette(FRemapTable *remap);

View file

@ -549,6 +549,11 @@ xx(Lightceilingabsolute)
xx(Gravity)
xx(Lightcolor)
xx(Fadecolor)
xx(Color_Floor)
xx(Color_Ceiling)
xx(Color_Walltop)
xx(Color_Wallbottom)
xx(Color_Sprites)
xx(Desaturation)
xx(SoundSequence)
xx(Silent)

View file

@ -136,12 +136,14 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
{
ffloor->bottom.plane = &sec2->floorplane;
ffloor->bottom.texture = &sec2->planes[sector_t::floor].Texture;
ffloor->bottom.flatcolor = &sec2->SpecialColors[sector_t::floor];
ffloor->bottom.isceiling = sector_t::floor;
}
else
{
ffloor->bottom.plane = &sec2->ceilingplane;
ffloor->bottom.texture = &sec2->planes[sector_t::ceiling].Texture;
ffloor->bottom.flatcolor = &sec2->SpecialColors[sector_t::ceiling];
ffloor->bottom.isceiling = sector_t::ceiling;
}
@ -149,6 +151,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
{
ffloor->top.plane = &sec2->ceilingplane;
ffloor->top.texture = &sec2->planes[sector_t::ceiling].Texture;
ffloor->top.flatcolor = &sec2->SpecialColors[sector_t::ceiling];
ffloor->toplightlevel = &sec2->lightlevel;
ffloor->top.isceiling = sector_t::ceiling;
}
@ -156,6 +159,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
{
ffloor->top.plane = &sec->floorplane;
ffloor->top.texture = &sec2->planes[sector_t::floor].Texture;
ffloor->top.flatcolor = &sec2->SpecialColors[sector_t::floor];
ffloor->toplightlevel = &sec->lightlevel;
ffloor->top.isceiling = sector_t::floor;
ffloor->top.model = sec;
@ -165,10 +169,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
if (flags&FF_INVERTSECTOR)
{
// switch the planes
F3DFloor::planeref sp = ffloor->top;
ffloor->top=ffloor->bottom;
ffloor->bottom=sp;
std::swap(ffloor->top, ffloor->bottom);
if (flags&FF_SWIMMABLE)
{
@ -192,11 +193,10 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
ffloor->flags &= ~FF_ADDITIVETRANS;
}
if(flags & FF_THISINSIDE) {
if(flags & FF_THISINSIDE)
{
// switch the planes
F3DFloor::planeref sp = ffloor->top;
ffloor->top=ffloor->bottom;
ffloor->bottom=sp;
std::swap(ffloor->top, ffloor->bottom);
}
sec->e->XFloor.ffloors.Push(ffloor);

View file

@ -69,6 +69,7 @@ struct F3DFloor
secplane_t * plane;
const FTextureID * texture;
sector_t * model;
PalEntry * flatcolor;
int isceiling;
int vindex;
bool copied;

View file

@ -275,6 +275,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
("linked_floor", p.e->Linked.Floor.Sectors)
("linked_ceiling", p.e->Linked.Ceiling.Sectors)
("colormap", p.ColorMap, def->ColorMap)
.Array("specialcolors", p.SpecialColors, def->SpecialColors, 5, true)
("gravity", p.gravity, def->gravity)
.Terrain("floorterrain", p.terrainnum[0], &def->terrainnum[0])
.Terrain("ceilingterrain", p.terrainnum[1], &def->terrainnum[1])

View file

@ -1504,6 +1504,7 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
ss->SeqName = NAME_None;
ss->nextsec = -1; //jff 2/26/98 add fields to support locking out
ss->prevsec = -1; // stair retriggering until build completes
memset(ss->SpecialColors, -1, sizeof(ss->SpecialColors));
ss->SetAlpha(sector_t::floor, 1.);
ss->SetAlpha(sector_t::ceiling, 1.);

View file

@ -1307,6 +1307,7 @@ public:
sec->sectornum = index;
sec->damageinterval = 32;
sec->terrainnum[sector_t::ceiling] = sec->terrainnum[sector_t::floor] = -1;
memset(sec->SpecialColors, -1, sizeof(sec->SpecialColors));
if (floordrop) sec->Flags = SECF_FLOORDROP;
// killough 3/7/98: end changes
@ -1459,6 +1460,26 @@ public:
fadecolor = CheckInt(key);
continue;
case NAME_Color_Floor:
sec->SpecialColors[sector_t::floor] = CheckInt(key) || 0xff000000;
break;
case NAME_Color_Ceiling:
sec->SpecialColors[sector_t::ceiling] = CheckInt(key) || 0xff000000;
break;
case NAME_Color_Walltop:
sec->SpecialColors[sector_t::walltop] = CheckInt(key) || 0xff000000;
break;
case NAME_Color_Wallbottom:
sec->SpecialColors[sector_t::wallbottom] = CheckInt(key) || 0xff000000;
break;
case NAME_Color_Sprites:
sec->SpecialColors[sector_t::sprites] = CheckInt(key) || 0xff000000;
break;
case NAME_Desaturation:
desaturation = int(255*CheckFloat(key));
continue;

View file

@ -659,10 +659,15 @@ public:
FSectorPortal *ValidatePortal(int which);
void CheckPortalPlane(int plane);
enum
{
floor,
ceiling
ceiling,
// only used for specialcolors array
walltop,
wallbottom,
sprites
};
struct splane
@ -960,6 +965,7 @@ public:
// [RH] give floor and ceiling even more properties
FDynamicColormap *ColorMap; // [RH] Per-sector colormap
PalEntry SpecialColors[5];
TObjPtr<AActor> SoundTarget;

View file

@ -91,11 +91,6 @@ static TArray<DVector3a> InterpolationPath;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
CUSTOM_CVAR(Int, r_preservesectorcolor, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (self < -1 || self > 1) self = -1;
}
CVAR (Bool, r_deathcamera, false, CVAR_ARCHIVE)
CVAR (Int, r_clearbuffer, 0, 0)
CVAR (Bool, r_drawvoxels, true, 0)

View file

@ -1318,7 +1318,7 @@ void DCanvas::FinishSimplePolys()
void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley, DAngle rotation,
FDynamicColormap *colormap, int lightlevel, int bottomclip)
FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
{
#ifndef NO_SWRENDER
using namespace swrenderer;

View file

@ -225,7 +225,7 @@ public:
// Fill a simple polygon with a texture
virtual void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley, DAngle rotation,
struct FDynamicColormap *colormap, int lightlevel, int bottomclip);
struct FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip);
// Set an area to a specified color
virtual void Clear (int left, int top, int right, int bottom, int palcolor, uint32 color);

View file

@ -3128,7 +3128,7 @@ void D3DFB::FlatFill(int left, int top, int right, int bottom, FTexture *src, bo
void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley,
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip)
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
{
// Use an equation similar to player sprites to determine shade
double fadelevel = clamp((LIGHT2SHADE(lightlevel)/65536. - 12) / NUMCOLORMAPS, 0.0, 1.0);
@ -3149,7 +3149,7 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
}
if (In2D < 2)
{
Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel, bottomclip);
Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, flatcolor, lightlevel, bottomclip);
return;
}
if (!InScene)

View file

@ -265,7 +265,7 @@ public:
void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor);
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley,
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip) override;
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip) override;
bool WipeStartScreen(int type);
void WipeEndScreen();
bool WipeDo(int ticks);