From 2cbda0e5ac4d84926499a18f1bc36f19a9c0083e Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 4 Jul 2021 13:20:10 +0200 Subject: [PATCH] Adapt polyobject waypoint movement linedef to UDMF --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 40 ++++++++++++++++++++ src/p_setup.c | 15 ++++++++ src/p_spec.c | 23 +++-------- 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index b04b5e16a..5d9f32743 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2853,6 +2853,46 @@ udmf } } } + + 488 + { + title = "Move by Waypoints"; + prefix = "(488)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Waypoint sequence"; + } + arg3 + { + title = "Return behavior"; + type = 11; + enum + { + 0 = "Don't return"; + 1 = "Return to first waypoint"; + 2 = "Repeat sequence in reverse"; + } + } + arg4 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Move in reverse"; + 2 = "Loop movement"; + } + } + } } scrollpush diff --git a/src/p_setup.c b/src/p_setup.c index 7617e863f..6eef43a60 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3700,6 +3700,21 @@ static void P_ConvertBinaryMap(void) lines[i].args[3] |= TMPR_OVERRIDE; lines[i].special = 484; break; + case 488: //Polyobject - move by waypoints + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if (lines[i].flags & ML_EFFECT3) + lines[i].args[3] = PWR_WRAP; + else if (lines[i].flags & ML_EFFECT2) + lines[i].args[3] = PWR_COMEBACK; + else + lines[i].args[3] = PWR_STOP; + if (lines[i].flags & ML_EFFECT1) + lines[i].args[4] |= PWF_REVERSE; + if (lines[i].flags & ML_EFFECT4) + lines[i].args[4] |= PWF_LOOP; + break; case 500: //Scroll front wall left case 501: //Scroll front wall right lines[i].args[0] = 0; diff --git a/src/p_spec.c b/src/p_spec.c index 6434a55d7..306a11e4f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1178,24 +1178,11 @@ static boolean PolyWaypoint(line_t *line) { polywaypointdata_t pwd; - pwd.polyObjNum = Tag_FGet(&line->tags); - pwd.speed = sides[line->sidenum[0]].textureoffset / 8; - pwd.sequence = sides[line->sidenum[0]].rowoffset >> FRACBITS; // Sequence # - - // Behavior after reaching the last waypoint? - if (line->flags & ML_EFFECT3) - pwd.returnbehavior = PWR_WRAP; // Wrap back to first waypoint - else if (line->flags & ML_EFFECT2) - pwd.returnbehavior = PWR_COMEBACK; // Go through sequence in reverse - else - pwd.returnbehavior = PWR_STOP; // Stop - - // Flags - pwd.flags = 0; - if (line->flags & ML_EFFECT1) - pwd.flags |= PWF_REVERSE; - if (line->flags & ML_EFFECT4) - pwd.flags |= PWF_LOOP; + pwd.polyObjNum = line->args[0]; + pwd.speed = line->args[1] << (FRACBITS - 3); + pwd.sequence = line->args[2]; + pwd.returnbehavior = line->args[3]; + pwd.flags = line->args[4]; return EV_DoPolyObjWaypoint(&pwd); }