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.
This commit is contained in:
toaster 2023-07-12 16:32:23 +01:00
parent ba5047459c
commit 36e0a23c09
7 changed files with 1 additions and 56 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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')

View file

@ -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},

View file

@ -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)

View file

@ -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++)

View file

@ -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(&sectors[secnum], args[2],