diff --git a/base/all-all/compdb.lmp b/base/all-all/compdb.lmp index 5508c5855..0a984725b 100644 --- a/base/all-all/compdb.lmp +++ b/base/all-all/compdb.lmp @@ -19,6 +19,11 @@ } ] }, + { + "name": "doomsday_of_uac_e1m8", + "md5": "32fc3115a3162b623f0d0f4e7dee6861", + "complevel": "1.9" + }, { "name": "hell_revealed_map19", "md5": "811a0c97777a198bc9b2bb558cb46e6a", @@ -34,7 +39,6 @@ "md5": "145c4dfcf843f2b92c73036ba0e1d98a", "options": [ {"name": "comp_vile", "value": 1} ] }, - { "name": "hell_to_pay_map14", "md5": "5379c080299eb961792b50ad96821543", diff --git a/src/g_compatibility.c b/src/g_compatibility.c index 56207e06e..977a7a557 100644 --- a/src/g_compatibility.c +++ b/src/g_compatibility.c @@ -20,6 +20,7 @@ #include "doomstat.h" #include "doomtype.h" +#include "g_game.h" #include "i_printf.h" #include "m_array.h" #include "m_misc.h" @@ -77,6 +78,7 @@ typedef struct { md5_digest_t checksum; option_t *options; + demo_version_t complevel; } comp_record_t; static comp_record_t *comp_database; @@ -125,6 +127,18 @@ void G_ParseCompDatabase(void) I_Printf(VB_ERROR, "COMPDB: wrong key %s", md5); continue; } + + record.complevel = DV_MBF21; + const char *complevel = JS_GetStringValue(level, "complevel"); + if (complevel) + { + demo_version_t new_complevel = G_GetNamedComplevel(complevel); + if (new_complevel != DV_NONE) + { + record.complevel = new_complevel; + } + } + json_t *js_options = JS_GetObject(level, "options"); json_t *js_option = NULL; JS_ArrayForEach(js_option, js_options) @@ -184,19 +198,23 @@ static void GetLevelCheckSum(int lump, md5_checksum_t* cksum) void G_ApplyLevelCompatibility(int lump) { - if (demorecording || demoplayback || netgame || !mbf21) - { - return; - } - static boolean restore_comp; static int old_comp[COMP_TOTAL]; if (restore_comp) { + if (demo_version != DV_MBF21) + { + demo_version = DV_MBF21; + G_ReloadDefaults(true); + } memcpy(comp, old_comp, sizeof(*comp)); restore_comp = false; } + else if (demorecording || demoplayback || netgame || !mbf21) + { + return; + } md5_checksum_t cksum; @@ -212,6 +230,20 @@ void G_ApplyLevelCompatibility(int lump) memcpy(old_comp, comp, sizeof(*comp)); restore_comp = true; + demo_version_t new_demover = record->complevel; + if (new_demover != DV_MBF21) + { + demo_version = new_demover; + G_ReloadDefaults(true); + I_Printf(VB_INFO, "Automatically setting compatibility level \"%s\"", + G_GetCurrentComplevelName()); + } + + if (!mbf21) + { + return; + } + option_t *option; array_foreach(option, record->options) {