- moved part of the fade init for LEVEL_HASFADETABLE to the common colormap initialization to have all of it in one place.

Otherwise this is easily overlooked when changing things later and potentially causing problems.
This commit is contained in:
Christoph Oelckers 2018-04-03 20:55:36 +02:00
parent 9ba32cb994
commit 91813ec43d
3 changed files with 9 additions and 10 deletions

View file

@ -86,6 +86,7 @@ struct FLevelLocals
TArray<FSectorPortal> sectorPortals; TArray<FSectorPortal> sectorPortals;
TArray<FLinePortal> linePortals; TArray<FLinePortal> linePortals;
// Portal information.
FDisplacementTable Displacements; FDisplacementTable Displacements;
FPortalBlockmap PortalBlockmap; FPortalBlockmap PortalBlockmap;
TArray<FLinePortal*> linkedPortals; // only the linked portals, this is used to speed up looking for them in P_CollectConnectedGroups. TArray<FLinePortal*> linkedPortals; // only the linked portals, this is used to speed up looking for them in P_CollectConnectedGroups.

View file

@ -1502,6 +1502,8 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
ss->ZoneNumber = 0xFFFF; ss->ZoneNumber = 0xFFFF;
ss->terrainnum[sector_t::ceiling] = ss->terrainnum[sector_t::floor] = -1; ss->terrainnum[sector_t::ceiling] = ss->terrainnum[sector_t::floor] = -1;
// [RH] Sectors default to white light with the default fade. // [RH] Sectors default to white light with the default fade.
// If they are outside (have a sky ceiling), they use the outside fog. // If they are outside (have a sky ceiling), they use the outside fog.
ss->Colormap.LightColor = PalEntry(255, 255, 255); ss->Colormap.LightColor = PalEntry(255, 255, 255);
@ -1509,11 +1511,16 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
{ {
ss->Colormap.FadeColor.SetRGB(level.outsidefog); ss->Colormap.FadeColor.SetRGB(level.outsidefog);
} }
else if (level.flags & LEVEL_HASFADETABLE)
{
ss->Colormap.FadeColor= 0x939393; // The true color software renderer needs this. (The hardware renderer will ignore this value if LEVEL_HASFADETABLE is set.)
}
else else
{ {
ss->Colormap.FadeColor.SetRGB(level.fadeto); ss->Colormap.FadeColor.SetRGB(level.fadeto);
} }
// killough 8/28/98: initialize all sectors to normal friction // killough 8/28/98: initialize all sectors to normal friction
ss->friction = ORIG_FRICTION; ss->friction = ORIG_FRICTION;
ss->movefactor = ORIG_FRICTION_FACTOR; ss->movefactor = ORIG_FRICTION_FACTOR;
@ -4123,6 +4130,7 @@ void P_SetupLevel (const char *lumpname, int position)
// This must be done BEFORE the PolyObj Spawn!!! // This must be done BEFORE the PolyObj Spawn!!!
InitRenderInfo(); InitRenderInfo();
Renderer->PreprocessLevel(); Renderer->PreprocessLevel();
SWRenderer->PreprocessLevel();
InitPortalGroups(); InitPortalGroups();
times[16].Clock(); times[16].Clock();

View file

@ -335,19 +335,9 @@ void FSoftwareRenderer::PreprocessLevel()
NormalLight.Maps = realcolormaps.Maps; NormalLight.Maps = realcolormaps.Maps;
NormalLight.ChangeColor(PalEntry(255, 255, 255), 0); NormalLight.ChangeColor(PalEntry(255, 255, 255), 0);
NormalLight.ChangeFade(level.fadeto); NormalLight.ChangeFade(level.fadeto);
if (level.fadeto == 0) if (level.fadeto == 0)
{ {
SetDefaultColormap(level.info->FadeTable); SetDefaultColormap(level.info->FadeTable);
if (level.flags & LEVEL_HASFADETABLE)
{
// This should really be done differently.
level.fadeto = 0xff939393; //[SP] Hexen True-color compatibility, just use gray.
for (auto &s : level.sectors)
{
s.Colormap.FadeColor = level.fadeto;
}
}
} }
} }