From e12f2ce0fe9e073f871f42768f70b52f3d0d8922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Sat, 28 Oct 2023 00:01:06 -0300 Subject: [PATCH] Allow setting the colormap from mapinfo (dsda-doom) --- src/g_level.cpp | 6 ++++++ src/gamedata/g_mapinfo.cpp | 7 +++++++ src/gamedata/g_mapinfo.h | 2 ++ src/rendering/swrenderer/r_swrenderer.cpp | 6 +++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 953980386a8..abab3610632 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -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; diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index 13ca12c9ac3..a525e80d944 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -254,6 +254,7 @@ void level_info_t::Reset() LevelName = ""; AuthorName = ""; FadeTable = "COLORMAP"; + CustomColorMap = "COLORMAP"; WallHorizLight = -8; WallVertLight = +8; F1Pic = ""; @@ -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; diff --git a/src/gamedata/g_mapinfo.h b/src/gamedata/g_mapinfo.h index b7e48f30199..8906e043cc0 100644 --- a/src/gamedata/g_mapinfo.h +++ b/src/gamedata/g_mapinfo.h @@ -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 }; @@ -330,6 +331,7 @@ struct level_info_t FString SkyPic1; FString SkyPic2; FString FadeTable; + FString CustomColorMap; FString F1Pic; FString BorderTexture; FString MapBackground; diff --git a/src/rendering/swrenderer/r_swrenderer.cpp b/src/rendering/swrenderer/r_swrenderer.cpp index b449baef419..7c86a64d968 100644 --- a/src/rendering/swrenderer/r_swrenderer.cpp +++ b/src/rendering/swrenderer/r_swrenderer.cpp @@ -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()); }