From 8f39e2310583ea9fbe1cfbc9f2ab77f604c4b118 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 26 Jun 2021 08:43:35 +0200 Subject: [PATCH] Adapt linedef type 405 and 407 to UDMF --- src/p_ceilng.c | 14 +++++++------- src/p_floor.c | 8 ++++---- src/p_setup.c | 5 +++++ src/p_spec.c | 11 +++++------ src/p_spec.h | 4 ++-- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/p_ceilng.c b/src/p_ceilng.c index 65bdd025b..7aa504416 100644 --- a/src/p_ceilng.c +++ b/src/p_ceilng.c @@ -81,7 +81,7 @@ void T_MoveCeiling(ceiling_t *ceiling) ceiling->sector->ceilingpic = ceiling->texture; /* FALLTHRU */ case raiseToHighest: - case moveCeilingByFrontTexture: + case moveCeilingByDistance: ceiling->sector->ceilingdata = NULL; ceiling->sector->ceilspeed = 0; P_RemoveThinker(&ceiling->thinker); @@ -203,7 +203,7 @@ void T_MoveCeiling(ceiling_t *ceiling) /* FALLTHRU */ // in all other cases, just remove the active ceiling - case moveCeilingByFrontTexture: + case moveCeilingByDistance: ceiling->sector->ceilingdata = NULL; ceiling->sector->ceilspeed = 0; P_RemoveThinker(&ceiling->thinker); @@ -498,19 +498,19 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type) ceiling->texture = (line->args[2] & 2) ? line->frontsector->ceilingpic : -1; break; - case moveCeilingByFrontTexture: - if (line->flags & ML_NOCLIMB) + case moveCeilingByDistance: + if (line->args[4]) ceiling->speed = INT32_MAX/2; // as above, "instant" is one tic else - ceiling->speed = FixedDiv(sides[line->sidenum[0]].textureoffset,8*FRACUNIT); // texture x offset + ceiling->speed = line->args[3] << (FRACBITS - 3); if (sides[line->sidenum[0]].rowoffset > 0) { ceiling->direction = 1; // up - ceiling->topheight = sec->ceilingheight + sides[line->sidenum[0]].rowoffset; // texture y offset + ceiling->topheight = sec->ceilingheight + (line->args[2] << FRACBITS); } else { ceiling->direction = -1; // down - ceiling->bottomheight = sec->ceilingheight + sides[line->sidenum[0]].rowoffset; // texture y offset + ceiling->bottomheight = sec->ceilingheight + (line->args[2] << FRACBITS); } break; diff --git a/src/p_floor.c b/src/p_floor.c index f3d7e036e..c64c1bb20 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1885,12 +1885,12 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype) break; - case moveFloorByFrontTexture: - if (line->flags & ML_NOCLIMB) + case moveFloorByDistance: + if (line->args[4]) dofloor->speed = INT32_MAX/2; // as above, "instant" is one tic else - dofloor->speed = FixedDiv(sides[line->sidenum[0]].textureoffset,8*FRACUNIT); // texture x offset - dofloor->floordestheight = sec->floorheight + sides[line->sidenum[0]].rowoffset; // texture y offset + dofloor->speed = line->args[3] << (FRACBITS - 3); + dofloor->floordestheight = sec->floorheight + (line->args[2] << FRACBITS); if (dofloor->floordestheight > sec->floorheight) dofloor->direction = 1; // up else diff --git a/src/p_setup.c b/src/p_setup.c index 9f7ba9504..6e7801618 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3543,6 +3543,11 @@ static void P_ConvertBinaryMap(void) case 405: //Move floor according to front texture offsets case 407: //Move ceiling according to front texture offsets lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 405) ? 0 : 1; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[3] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB); + lines[i].special = 405; break; case 428: //Start platform movement lines[i].args[0] = tag; diff --git a/src/p_spec.c b/src/p_spec.c index 4141e924f..222077e3d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2277,12 +2277,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) EV_DoCeiling(line->args[0], line, moveCeilingByFrontSector); break; - case 405: // Move floor by front side texture offsets, offset x = speed, offset y = amount to raise/lower - EV_DoFloor(line->args[0], line, moveFloorByFrontTexture); - break; - - case 407: // Move ceiling by front side texture offsets, offset x = speed, offset y = amount to raise/lower - EV_DoCeiling(line->args[0], line, moveCeilingByFrontTexture); + case 405: // Move planes by distance + if (line->args[1] != 1) + EV_DoFloor(line->args[0], line, moveFloorByDistance); + if (line->args[1] != 0) + EV_DoCeiling(line->args[0], line, moveCeilingByDistance); break; case 409: // Change tagged sectors' tag diff --git a/src/p_spec.h b/src/p_spec.h index e03f745ce..e6ea5a534 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -271,7 +271,7 @@ typedef enum moveCeilingByFrontSector, instantMoveCeilingByFrontSector, - moveCeilingByFrontTexture, + moveCeilingByDistance, bounceCeiling, bounceCeilingCrush, @@ -325,7 +325,7 @@ typedef enum moveFloorByFrontSector, instantMoveFloorByFrontSector, - moveFloorByFrontTexture, + moveFloorByDistance, bounceFloor, bounceFloorCrush,