From 36e0a23c09e58516b35c73ad73ab9467705638cb Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 12 Jul 2023 16:32:23 +0100 Subject: [PATCH] Remove console script support from maps The linedef's behaviour was broken horribly by long map names, and it's not worth the effort to fix it for the following reasons. - It was considered a security vulnerability to have free access to the console when it was written. - The game literally had a cvar to disable running console scripts. That's "I am willingly distributing ActiveX Word Documents in 2023" levels of foolhardery. - Anything GOOD it can do, both Lua and ACS can do better. --- src/d_netcmd.c | 3 --- src/d_netcmd.h | 1 - src/deh_soc.c | 7 ------- src/deh_tables.c | 1 - src/doomstat.h | 2 +- src/p_setup.c | 31 ------------------------------- src/p_spec.c | 12 ------------ 7 files changed, 1 insertion(+), 56 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 823099cf6..059a39b7a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -547,8 +547,6 @@ consvar_t cv_inttime = CVAR_INIT ("inttime", "10", CV_SAVE|CV_NETVAR, inttime_co static CV_PossibleValue_t advancemap_cons_t[] = {{0, "Same"}, {1, "Next"}, {2, "Random"}, {3, "Vote"}, {0, NULL}}; consvar_t cv_advancemap = CVAR_INIT ("advancemap", "Vote", CV_NETVAR, advancemap_cons_t, NULL); -consvar_t cv_runscripts = CVAR_INIT ("runscripts", "Yes", 0, CV_YesNo, NULL); - consvar_t cv_pause = CVAR_INIT ("pausepermission", "Server", CV_SAVE|CV_NETVAR, pause_cons_t, NULL); consvar_t cv_mute = CVAR_INIT ("mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange); @@ -795,7 +793,6 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_startinglives); CV_RegisterVar(&cv_countdowntime); - CV_RegisterVar(&cv_runscripts); CV_RegisterVar(&cv_overtime); CV_RegisterVar(&cv_pause); CV_RegisterVar(&cv_mute); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 154c09717..eb1e5232b 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -70,7 +70,6 @@ extern consvar_t cv_scrambleonchange; extern consvar_t cv_netstat; extern consvar_t cv_countdowntime; -extern consvar_t cv_runscripts; extern consvar_t cv_mute; extern consvar_t cv_pause; diff --git a/src/deh_soc.c b/src/deh_soc.c index 48f4f6828..84b49aa76 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1296,13 +1296,6 @@ void readlevelheader(MYFILE *f, char * name) } } // Individual triggers for level flags, for ease of use (and 2.0 compatibility) - else if (fastcmp(word, "SCRIPTISFILE")) - { - if (i || word2[0] == 'T' || word2[0] == 'Y') - mapheaderinfo[num]->levelflags |= LF_SCRIPTISFILE; - else - mapheaderinfo[num]->levelflags &= ~LF_SCRIPTISFILE; - } else if (fastcmp(word, "NOZONE")) { if (i || word2[0] == 'T' || word2[0] == 'Y') diff --git a/src/deh_tables.c b/src/deh_tables.c index 59af77da5..3db11e57e 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -6452,7 +6452,6 @@ struct int_const_s const INT_CONST[] = { {"RF_GHOSTLYMASK",RF_GHOSTLYMASK}, // Level flags - {"LF_SCRIPTISFILE",LF_SCRIPTISFILE}, {"LF_NOZONE",LF_NOZONE}, {"LF_SECTIONRACE",LF_SECTIONRACE}, {"LF_SUBTRACTNUM",LF_SUBTRACTNUM}, diff --git a/src/doomstat.h b/src/doomstat.h index 2fc4a3878..6c8bc76db 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -527,7 +527,7 @@ struct mapheader_t }; // level flags -#define LF_SCRIPTISFILE (1<<0) ///< True if the script is a file, not a lump. +//#define LF_(this slot is free) (1<<0) #define LF_NOZONE (1<<1) ///< Don't include "ZONE" on level title #define LF_SECTIONRACE (1<<2) ///< Section race level #define LF_SUBTRACTNUM (1<<3) ///< Use subtractive position number (for bright levels) diff --git a/src/p_setup.c b/src/p_setup.c index 50eb148cd..1506d18c0 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7515,34 +7515,6 @@ void P_RespawnThings(void) } #endif -static void P_RunLevelScript(const char *scriptname) -{ - if (!(mapheaderinfo[gamemap-1]->levelflags & LF_SCRIPTISFILE)) - { - lumpnum_t lumpnum; - char newname[9]; - - strncpy(newname, scriptname, 8); - - newname[8] = '\0'; - - lumpnum = W_CheckNumForName(newname); - - if (lumpnum == LUMPERROR || W_LumpLength(lumpnum) == 0) - { - CONS_Debug(DBG_SETUP, "SOC Error: script lump %s not found/not valid.\n", newname); - return; - } - - COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE)); - } - else - { - COM_BufAddText(va("exec %s\n", scriptname)); - } - COM_BufExecute(); // Run it! -} - static void P_ResetSpawnpoints(void) { UINT8 i; @@ -7994,9 +7966,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) if (mapheaderinfo[gamemap-1]->runsoc[0] != '#') P_RunSOC(mapheaderinfo[gamemap-1]->runsoc); - if (cv_runscripts.value && mapheaderinfo[gamemap-1]->scriptname[0] != '#') - P_RunLevelScript(mapheaderinfo[gamemap-1]->scriptname); - P_InitLevelSettings(); for (i = 0; i <= r_splitscreen; i++) diff --git a/src/p_spec.c b/src/p_spec.c index d03505ea4..aa1e88256 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2970,18 +2970,6 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha P_PlaySFX(stringargs[0] ? get_number(stringargs[0]) : sfx_None, mo, callsec, args[3], args[1], args[2]); break; - case 415: // Run a script - if (cv_runscripts.value) - { - lumpnum_t lumpnum = W_CheckNumForName(stringargs[0]); - - if (lumpnum == LUMPERROR || W_LumpLength(lumpnum) == 0) - CONS_Debug(DBG_SETUP, "Line type 415 Executor: script lump %s not found/not valid.\n", stringargs[0]); - else - COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE)); - } - break; - case 416: // Spawn adjustable fire flicker TAG_ITER_SECTORS(args[0], secnum) P_SpawnAdjustableFireFlicker(§ors[secnum], args[2],