Skip to content

Commit

Permalink
Allow setting the colormap from mapinfo (dsda-doom)
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 authored and coelckers committed Oct 29, 2023
1 parent 478a832 commit e12f2ce
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/g_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1821,6 +1821,12 @@ void FLevelLocals::Init()
flags |= LEVEL_HASFADETABLE;
}
}

if (strnicmp (info->CustomColorMap.GetChars(), "COLORMAP", 8) != 0)
{
flags3 |= LEVEL3_HAS_CUSTOM_COLORMAP;
}

airsupply = info->airsupply*TICRATE;
outsidefog = info->outsidefog;
WallVertLight = info->WallVertLight*2;
Expand Down
7 changes: 7 additions & 0 deletions src/gamedata/g_mapinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ void level_info_t::Reset()
LevelName = "";
AuthorName = "";
FadeTable = "COLORMAP";
CustomColorMap = "COLORMAP";
WallHorizLight = -8;
WallVertLight = +8;
F1Pic = "";
Expand Down Expand Up @@ -1154,6 +1155,12 @@ DEFINE_MAP_OPTION(fadetable, true)
parse.ParseLumpOrTextureName(info->FadeTable);
}

DEFINE_MAP_OPTION(colormap, true)
{
parse.ParseAssign();
parse.ParseLumpOrTextureName(info->CustomColorMap);
}

DEFINE_MAP_OPTION(evenlighting, true)
{
info->WallVertLight = info->WallHorizLight = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/gamedata/g_mapinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ enum ELevelFlags : unsigned int
LEVEL3_AVOIDMELEE = 0x00020000, // global flag needed for proper MBF support.
LEVEL3_NOJUMPDOWN = 0x00040000, // only for MBF21. Inverse of MBF's dog_jumping flag.
LEVEL3_LIGHTCREATED = 0x00080000, // a light had been created in the last frame
LEVEL3_HAS_CUSTOM_COLORMAP = 0x00100000, // custom colormap property from dsda-doom
};


Expand Down Expand Up @@ -330,6 +331,7 @@ struct level_info_t
FString SkyPic1;
FString SkyPic2;
FString FadeTable;
FString CustomColorMap;
FString F1Pic;
FString BorderTexture;
FString MapBackground;
Expand Down
6 changes: 5 additions & 1 deletion src/rendering/swrenderer/r_swrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ void FSoftwareRenderer::SetColormap(FLevelLocals *Level)
NormalLight.Maps = realcolormaps.Maps;
NormalLight.ChangeColor(PalEntry(255, 255, 255), 0);
NormalLight.ChangeFade(Level->fadeto);
if (Level->fadeto == 0)
if(Level->info->flags3 & LEVEL3_HAS_CUSTOM_COLORMAP)
{
SetDefaultColormap(Level->info->CustomColorMap.GetChars());
}
else if (Level->fadeto == 0)
{
SetDefaultColormap(Level->info->FadeTable.GetChars());
}
Expand Down

0 comments on commit e12f2ce

Please sign in to comment.