From 00b04f6d9e37e25c64f57122fe01d3145a7da0e3 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 20 Sep 2021 13:31:32 +0200 Subject: [PATCH] Adapt some player-related linedef executors to UDMF --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 75 ++++++++++++++++++++ src/p_setup.c | 16 +++++ src/p_spec.c | 16 ++--- 3 files changed, 99 insertions(+), 8 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index f74210732..bc80549e4 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2876,6 +2876,81 @@ udmf } } + linedefexecplayer + { + title = "Linedef Executor (player/object)"; + + 426 + { + title = "Stop Object"; + prefix = "(426)"; + arg0 + { + title = "Move to center?"; + type = 11; + enum = "noyes"; + } + } + + 427 + { + title = "Award Score"; + prefix = "(427)"; + arg0 + { + title = "Score"; + } + } + + 432 + { + title = "Enable/Disable 2D Mode"; + prefix = "(432)"; + arg0 + { + title = "Mode"; + type = 11; + enum + { + 0 = "2D"; + 1 = "3D"; + } + } + } + + 433 + { + title = "Enable/Disable Gravity Flip"; + prefix = "(433)"; + arg0 + { + title = "Gravity"; + type = 11; + enum + { + 0 = "Reverse"; + 1 = "Normal"; + } + } + } + + 437 + { + title = "Disable Player Control"; + prefix = "(437)"; + arg0 + { + title = "Time"; + } + arg1 + { + title = "Allow jumping?"; + type = 11; + enum = "noyes"; + } + } + } + linedefexecmisc { title = "Linedef Executor (misc.)"; diff --git a/src/p_setup.c b/src/p_setup.c index 370fdb2fa..f5f3a22cc 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3780,6 +3780,12 @@ static void P_ConvertBinaryMap(void) lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); break; + case 426: //Stop object + lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 427: //Award score + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + break; case 428: //Start platform movement lines[i].args[0] = tag; lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; @@ -3804,10 +3810,20 @@ static void P_ConvertBinaryMap(void) } lines[i].special = 429; break; + case 432: //Enable/disable 2D mode + lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 433: //Enable/disable gravity flip + lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); + break; case 435: //Change plane scroller direction lines[i].args[0] = tag; lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; break; + case 437: //Disable player control + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + break; case 443: //Call Lua function if (lines[i].text) { diff --git a/src/p_spec.c b/src/p_spec.c index 3cd046e10..e6dcf118a 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2583,7 +2583,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (!mo) return; - if (line->flags & ML_NOCLIMB) + if (line->args[0]) { P_UnsetThingPosition(mo); mo->x = mo->subsector->sector->soundorg.x; @@ -2618,7 +2618,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 427: // Awards points if the mobj is a player if (mo && mo->player) - P_AddPlayerScore(mo->player, sides[line->sidenum[0]].textureoffset>>FRACBITS); + P_AddPlayerScore(mo->player, line->args[0]); break; case 428: // Start floating platform movement @@ -2634,10 +2634,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) EV_DoCrush(line->args[0], line, crushBothOnce); break; - case 432: // Enable 2D Mode (Disable if noclimb) + case 432: // Enable/Disable 2D Mode if (mo && mo->player) { - if (line->flags & ML_NOCLIMB) + if (line->args[0]) mo->flags2 &= ~MF2_TWOD; else mo->flags2 |= MF2_TWOD; @@ -2651,8 +2651,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } break; - case 433: // Flip gravity (Flop gravity if noclimb) Works on pushables, too! - if (line->flags & ML_NOCLIMB) + case 433: // Flip/flop gravity. Works on pushables, too! + if (line->args[0]) mo->flags2 &= ~MF2_OBJECTFLIP; else mo->flags2 |= MF2_OBJECTFLIP; @@ -2750,10 +2750,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 437: // Disable Player Controls if (mo && mo->player) { - UINT16 fractime = (UINT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); + UINT16 fractime = (UINT16)(line->args[0]); if (fractime < 1) fractime = 1; //instantly wears off upon leaving - if (line->flags & ML_NOCLIMB) + if (line->args[1]) fractime |= 1<<15; //more crazy &ing, as if music stuff wasn't enough mo->player->powers[pw_nocontrol] = fractime; if (bot)