Adapt linedef type 415 to UDMF

This commit is contained in:
MascaraSnake 2021-09-20 12:32:01 +02:00
parent 1b339a9e00
commit d2eb4587c2
3 changed files with 38 additions and 27 deletions

View file

@ -2880,6 +2880,17 @@ udmf
{ {
title = "Linedef Executor (misc.)"; title = "Linedef Executor (misc.)";
415
{
title = "Run Script";
prefix = "(415)";
stringarg0
{
title = "Lump name";
type = 2;
}
}
443 443
{ {
title = "Call Lua Function"; title = "Call Lua Function";

View file

@ -3696,6 +3696,31 @@ static void P_ConvertBinaryMap(void)
case 411: //Stop plane movement case 411: //Stop plane movement
lines[i].args[0] = tag; lines[i].args[0] = tag;
break; break;
case 415: //Run script
{
INT32 scrnum;
lines[i].stringargs[0] = Z_Malloc(9, PU_LEVEL, NULL);
strcpy(lines[i].stringargs[0], G_BuildMapName(gamemap));
lines[i].stringargs[0][0] = 'S';
lines[i].stringargs[0][1] = 'C';
lines[i].stringargs[0][2] = 'R';
scrnum = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
if (scrnum < 0 || scrnum > 999)
{
scrnum = 0;
lines[i].stringargs[0][5] = lines[i].stringargs[0][6] = lines[i].stringargs[0][7] = '0';
}
else
{
lines[i].stringargs[0][5] = (char)('0' + (char)((scrnum / 100)));
lines[i].stringargs[0][6] = (char)('0' + (char)((scrnum % 100) / 10));
lines[i].stringargs[0][7] = (char)('0' + (char)(scrnum % 10));
}
lines[i].stringargs[0][8] = '\0';
break;
}
case 416: //Start adjustable flickering light case 416: //Start adjustable flickering light
case 417: //Start adjustable pulsating light case 417: //Start adjustable pulsating light
case 602: //Adjustable pulsating light case 602: //Adjustable pulsating light

View file

@ -2469,35 +2469,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
case 415: // Run a script case 415: // Run a script
if (cv_runscripts.value) if (cv_runscripts.value)
{ {
INT32 scrnum; lumpnum_t lumpnum = W_CheckNumForName(line->stringargs[0]);
lumpnum_t lumpnum;
char newname[9];
strcpy(newname, G_BuildMapName(gamemap));
newname[0] = 'S';
newname[1] = 'C';
newname[2] = 'R';
scrnum = sides[line->sidenum[0]].textureoffset>>FRACBITS;
if (scrnum < 0 || scrnum > 999)
{
scrnum = 0;
newname[5] = newname[6] = newname[7] = '0';
}
else
{
newname[5] = (char)('0' + (char)((scrnum/100)));
newname[6] = (char)('0' + (char)((scrnum%100)/10));
newname[7] = (char)('0' + (char)(scrnum%10));
}
newname[8] = '\0';
lumpnum = W_CheckNumForName(newname);
if (lumpnum == LUMPERROR || W_LumpLength(lumpnum) == 0) if (lumpnum == LUMPERROR || W_LumpLength(lumpnum) == 0)
{ CONS_Debug(DBG_SETUP, "Line type 415 Executor: script lump %s not found/not valid.\n", line->stringargs[0]);
CONS_Debug(DBG_SETUP, "SOC Error: script lump %s not found/not valid.\n", newname);
}
else else
COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE)); COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE));
} }