Adapt linedef type 459 to UDMF

This commit is contained in:
MascaraSnake 2021-09-21 09:05:40 +02:00
parent ea1d442f31
commit 69e0c636a0
4 changed files with 83 additions and 13 deletions

View file

@ -3366,6 +3366,41 @@ udmf
} }
} }
459
{
title = "Control Text Prompt";
prefix = "(459)";
arg0
{
title = "Prompt number";
}
arg1
{
title = "Page number";
}
arg2
{
title = "Flags";
type = 11;
enum
{
1 = "Close current text prompt";
2 = "Trigger linedef executor on close";
4 = "Find prompt by name";
8 = "Don't disable controls";
}
}
arg3
{
title = "Trigger linedef tag";
type = 15;
}
stringarg0
{
title = "Prompt name";
}
}
465 465
{ {
title = "Set Linedef Executor Delay"; title = "Set Linedef Executor Delay";

View file

@ -3966,6 +3966,30 @@ static void P_ConvertBinaryMap(void)
case 456: //Stop fading colormap case 456: //Stop fading colormap
lines[i].args[0] = Tag_FGet(&lines[i].tags); lines[i].args[0] = Tag_FGet(&lines[i].tags);
break; break;
case 459: //Control text prompt
lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS;
if (lines[i].flags & ML_BLOCKMONSTERS)
lines[i].args[2] |= TMP_CLOSE;
if (lines[i].flags & ML_EFFECT1)
lines[i].args[2] |= TMP_RUNPOSTEXEC;
if (lines[i].flags & ML_TFERLINE)
lines[i].args[2] |= TMP_CALLBYNAME;
if (lines[i].flags & ML_EFFECT2)
lines[i].args[2] |= TMP_KEEPCONTROLS;
if (lines[i].flags & ML_EFFECT3)
lines[i].args[2] |= TMP_KEEPREALTIME;
/*if (lines[i].flags & ML_NOCLIMB)
lines[i].args[2] |= TMP_ALLPLAYERS;
if (lines[i].flags & ML_EFFECT4)
lines[i].args[2] |= ML_EFFECT4;*/
lines[i].args[3] = (lines[i].sidenum[1] != 0xFFFF) ? sides[lines[i].sidenum[1]].textureoffset >> FRACBITS : tag;
if (sides[lines[i].sidenum[0]].text)
{
lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL);
M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1);
}
break;
case 460: //Award rings case 460: //Award rings
lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS;

View file

@ -3466,27 +3466,27 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
case 459: // Control Text Prompt case 459: // Control Text Prompt
// console player only unless NOCLIMB is set // console player only
if (mo && mo->player && P_IsLocalPlayer(mo->player) && (!bot || bot != mo)) if (mo && mo->player && P_IsLocalPlayer(mo->player) && (!bot || bot != mo))
{ {
INT32 promptnum = max(0, (sides[line->sidenum[0]].textureoffset>>FRACBITS)-1); INT32 promptnum = max(0, line->args[0] - 1);
INT32 pagenum = max(0, (sides[line->sidenum[0]].rowoffset>>FRACBITS)-1); INT32 pagenum = max(0, line->args[1] - 1);
INT32 postexectag = abs((line->sidenum[1] != 0xFFFF) ? sides[line->sidenum[1]].textureoffset>>FRACBITS : tag); INT32 postexectag = abs(line->args[3]);
boolean closetextprompt = (line->flags & ML_BLOCKMONSTERS); boolean closetextprompt = (line->args[2] & TMP_CLOSE);
//boolean allplayers = (line->flags & ML_NOCLIMB); //boolean allplayers = (line->args[2] & TMP_ALLPLAYERS);
boolean runpostexec = (line->flags & ML_EFFECT1); boolean runpostexec = (line->args[2] & TMP_RUNPOSTEXEC);
boolean blockcontrols = !(line->flags & ML_EFFECT2); boolean blockcontrols = !(line->args[2] & TMP_KEEPCONTROLS);
boolean freezerealtime = !(line->flags & ML_EFFECT3); boolean freezerealtime = !(line->args[2] & TMP_KEEPREALTIME);
//boolean freezethinkers = (line->flags & ML_EFFECT4); //boolean freezethinkers = (line->args[2] & TMP_FREEZETHINKERS);
boolean callbynamedtag = (line->flags & ML_TFERLINE); boolean callbynamedtag = (line->args[2] & TMP_CALLBYNAME);
if (closetextprompt) if (closetextprompt)
F_EndTextPrompt(false, false); F_EndTextPrompt(false, false);
else else
{ {
if (callbynamedtag && sides[line->sidenum[0]].text && sides[line->sidenum[0]].text[0]) if (callbynamedtag && line->stringargs[0] && line->stringargs[0][0])
F_GetPromptPageByNamedTag(sides[line->sidenum[0]].text, &promptnum, &pagenum); F_GetPromptPageByNamedTag(line->stringargs[0], &promptnum, &pagenum);
F_StartTextPrompt(promptnum, pagenum, mo, runpostexec ? postexectag : 0, blockcontrols, freezerealtime); F_StartTextPrompt(promptnum, pagenum, mo, runpostexec ? postexectag : 0, blockcontrols, freezerealtime);
} }
} }

View file

@ -146,6 +146,17 @@ typedef enum
TMS_BOTH = 2, TMS_BOTH = 2,
} textmapskybox_t; } textmapskybox_t;
typedef enum
{
TMP_CLOSE = 1,
TMP_RUNPOSTEXEC = 1<<1,
TMP_CALLBYNAME = 1<<2,
TMP_KEEPCONTROLS = 1<<3,
TMP_KEEPREALTIME = 1<<4,
//TMP_ALLPLAYERS = 1<<5,
//TMP_FREEZETHINKERS = 1<<6,
} textmappromptflags_t;
typedef enum typedef enum
{ {
TMSD_FRONT = 0, TMSD_FRONT = 0,