- Fixed: side_t::GetLightLevel relied on the global 'linedef' variable for

automatic fake contrast.
- Changed: Fake contrast now uses the WALLF_AUTOCONTRAST globally instead
  of manipulating the sides' light values individually. This allows changing
  the fake contrast at run time and also allows adding individual relative
  lighting on top of it which is a planned UDMF feature.


SVN r991 (trunk)
This commit is contained in:
Christoph Oelckers 2008-05-23 07:54:09 +00:00
parent 4649d011c6
commit 5574aaca15
6 changed files with 27 additions and 29 deletions

View file

@ -1,3 +1,11 @@
May 23, 2008 (Changes by Graf Zahl)
- Fixed: side_t::GetLightLevel relied on the global 'linedef' variable for
automatic fake contrast.
- Changed: Fake contrast now uses the WALLF_AUTOCONTRAST globally instead
of manipulating the sides' light values individually. This allows changing
the fake contrast at run time and also allows adding individual relative
lighting on top of it which is a planned UDMF feature.
May 22, 2008
- Fixed: ActorStencilColor() did not set the palette part of the actor's
fill color, so it would always produce black for STYLE_Shaded.

View file

@ -2373,8 +2373,8 @@ void G_InitLevelLocals ()
}
level.airsupply = info->airsupply*TICRATE;
level.outsidefog = info->outsidefog;
level.WallVertLight = info->WallVertLight;
level.WallHorizLight = info->WallHorizLight;
level.WallVertLight = info->WallVertLight*2;
level.WallHorizLight = info->WallHorizLight*2;
if (info->gravity != 0.f)
{
level.gravity = info->gravity * 35/TICRATE;

View file

@ -1601,7 +1601,6 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
ld->backsector = ld->sidenum[1]!=NO_SIDE ? sides[ld->sidenum[1]].sector : 0;
float dx = FIXED2FLOAT(ld->v2->x - ld->v1->x);
float dy = FIXED2FLOAT(ld->v2->y - ld->v1->y);
SBYTE light;
int linenum = ld-lines;
if (ld->frontsector == NULL)
@ -1611,20 +1610,16 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
// [RH] Set some new sidedef properties
int len = (int)(sqrtf (dx*dx + dy*dy) + 0.5f);
light = dy == 0 ? level.WallHorizLight :
dx == 0 ? level.WallVertLight : 0;
if (ld->sidenum[0] != NO_SIDE)
{
sides[ld->sidenum[0]].linenum = linenum;
sides[ld->sidenum[0]].TexelLength = len;
sides[ld->sidenum[0]].Light = light;
}
if (ld->sidenum[1] != NO_SIDE)
{
sides[ld->sidenum[1]].linenum = linenum;
sides[ld->sidenum[1]].TexelLength = len;
sides[ld->sidenum[1]].Light = light;
}
switch (ld->special)
@ -2171,6 +2166,7 @@ void P_LoadSideDefs2 (MapData * map)
sd->SetTextureXOffset(LittleShort(msd->textureoffset)<<FRACBITS);
sd->SetTextureYOffset(LittleShort(msd->rowoffset)<<FRACBITS);
sd->linenum = NO_INDEX;
sd->Flags = WALLF_AUTOCONTRAST;
// killough 4/4/98: allow sidedef texture names to be overloaded
// killough 4/11/98: refined to allow colormaps to work as wall

View file

@ -791,12 +791,12 @@ void DWallLightTransfer::DoTransfer (BYTE lightlevel, int target, BYTE flags)
if (flags & WLF_SIDE1 && line->sidenum[0]!=NO_SIDE)
{
sides[line->sidenum[0]].Light = (BYTE)lightlevel;
sides[line->sidenum[0]].Light = lightlevel;
}
if (flags & WLF_SIDE2 && line->sidenum[1]!=NO_SIDE)
{
sides[line->sidenum[1]].Light = (BYTE)lightlevel;
sides[line->sidenum[1]].Light = lightlevel;
}
}
}

View file

@ -489,7 +489,7 @@ struct side_t
WORD linenum;
DWORD LeftSide, RightSide; // [RH] Group walls into loops
WORD TexelLength;
SBYTE Light;
SWORD Light;
BYTE Flags;
int GetLightLevel (bool foggy, int baselight) const;

View file

@ -1423,31 +1423,25 @@ void R_NewWall (bool needlights)
int side_t::GetLightLevel (bool foggy, int baselight) const
{
// [RH] Get wall light level
if (this->Flags & WALLF_ABSLIGHTING && (!(this->Flags & WALLF_AUTOCONTRAST) || foggy))
if (Flags & WALLF_ABSLIGHTING)
{
return (BYTE)this->Light;
baselight = (BYTE)Light;
}
else
if (!foggy) // Don't do relative lighting in foggy sectors
{
if (!foggy) // Don't do relative lighting in foggy sectors
if (Flags & WALLF_AUTOCONTRAST)
{
int rellight;
if (this->Flags & WALLF_AUTOCONTRAST)
{
baselight = (BYTE)this->Light;
rellight = linedef->dx==0? level.WallVertLight : linedef->dy==0 ? level.WallHorizLight : 0;
}
else
{
rellight = this->Light;
}
baselight += rellight * 2;
baselight += lines[linenum].dx==0? level.WallVertLight :
lines[linenum].dy==0? level.WallHorizLight : 0;
}
if (!(Flags & WALLF_ABSLIGHTING))
{
baselight += this->Light;
}
return baselight;
}
return clamp(baselight, 0, 255);
}
FArchive &operator<< (FArchive &arc, side_t::part &p)