From cd3ea897c36ea038815ce699c2a56cfb386ec4c0 Mon Sep 17 00:00:00 2001 From: Nev3r Date: Wed, 13 Mar 2019 11:13:54 +0100 Subject: [PATCH 1/2] Dealt with no-tag business: * Wind/current pushers affect front sector if left untagged. * Plane scrollers affect front sector if left untagged. Signed-off-by: Nev3r --- src/p_spec.c | 116 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 80 insertions(+), 36 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 22de3db12..07dc03b9f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7693,8 +7693,14 @@ static void P_SpawnScrollers(void) case 513: // scroll effect ceiling case 533: // scroll and carry objects on ceiling - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + if (l->tag == 0) + Add_Scroller(sc_ceiling, -dx, dy, control, l->frontsector - sectors, accel, l->flags & ML_NOCLIMB); + else + { + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + } + if (special != 533) break; /* FALLTHRU */ @@ -7702,14 +7708,26 @@ static void P_SpawnScrollers(void) case 523: // carry objects on ceiling dx = FixedMul(dx, CARRYFACTOR); dy = FixedMul(dy, CARRYFACTOR); - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + + if (l->tag == 0) + Add_Scroller(sc_carry_ceiling, dx, dy, control, l->frontsector - sectors, accel, l->flags & ML_NOCLIMB); + else + { + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + } break; case 510: // scroll effect floor case 530: // scroll and carry objects on floor - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + if (l->tag == 0) + Add_Scroller(sc_floor, -dx, dy, control, l->frontsector - sectors, accel, l->flags & ML_NOCLIMB); + else + { + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + } + if (special != 530) break; /* FALLTHRU */ @@ -7717,8 +7735,14 @@ static void P_SpawnScrollers(void) case 520: // carry objects on floor dx = FixedMul(dx, CARRYFACTOR); dy = FixedMul(dy, CARRYFACTOR); - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + + if (l->tag == 0) + Add_Scroller(sc_carry, dx, dy, control, l->frontsector - sectors, accel, l->flags & ML_NOCLIMB); + else + { + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + } break; // scroll wall according to linedef @@ -9081,43 +9105,63 @@ static void P_SpawnPushers(void) line_t *l = lines; register INT32 s; mobj_t *thing; + pushertype_e pushertype; for (i = 0; i < numlines; i++, l++) + { switch (l->special) { - case 541: // wind - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Pusher(p_wind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 544: // current - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Pusher(p_current, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 547: // push/pull + case 541: // wind + pushertype = p_wind; + break; + + case 544: // current + pushertype = p_current; + break; + case 547: // push/pull + if (l->tag == 0) + { + s = l->frontsector - sectors; + if ((thing = P_GetPushThing(s)) != NULL) // No MT_P* means no effect + Add_Pusher(p_push, l->dx, l->dy, thing, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + } + else for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) { - thing = P_GetPushThing(s); - if (thing) // No MT_P* means no effect + if ((thing = P_GetPushThing(s)) != NULL) // No MT_P* means no effect Add_Pusher(p_push, l->dx, l->dy, thing, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); } - break; - case 545: // current up - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Pusher(p_upcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 546: // current down - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Pusher(p_downcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 542: // wind up - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Pusher(p_upwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 543: // wind down - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Pusher(p_downwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; + + continue; + + case 545: // current up + pushertype = p_upcurrent; + break; + + case 546: // current down + pushertype = p_downcurrent; + break; + + case 542: // wind up + pushertype = p_upwind; + break; + + case 543: // wind down + pushertype = p_downwind; + break; + + default: + continue; } + + if (l->tag == 0) + Add_Pusher(pushertype, l->dx, l->dy, NULL, l->frontsector - sectors, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + else + { + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Pusher(pushertype, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + } + } } static void P_SearchForDisableLinedefs(void) From ae9f8856ac93ad2c4e2b95ae2c43b0a9a72fd51a Mon Sep 17 00:00:00 2001 From: Nev3r Date: Wed, 13 Mar 2019 12:24:47 +0100 Subject: [PATCH 2/2] Override vectorial magnitude with front X offset, if provided; takes the line's lengths into account otherwise, as usual. Signed-off-by: Nev3r --- src/p_spec.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 07dc03b9f..fb678a420 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7654,11 +7654,22 @@ static void P_SpawnScrollers(void) for (i = 0; i < numlines; i++, l++) { - fixed_t dx = l->dx >> SCROLL_SHIFT; // direction and speed of scrolling - fixed_t dy = l->dy >> SCROLL_SHIFT; + fixed_t dx = l->dx; // direction and speed of scrolling + fixed_t dy = l->dy; INT32 control = -1, accel = 0; // no control sector or acceleration INT32 special = l->special; + // If front texture X offset provided, override the amount with it. + if (sides[l->sidenum[0]].textureoffset != 0) + { + fixed_t len = sides[l->sidenum[0]].textureoffset; + fixed_t h = FixedHypot(dx, dy); + dx = FixedMul(FixedDiv(dx, h), len); + dy = FixedMul(FixedDiv(dy, h), len); + } + dx = dx >> SCROLL_SHIFT; + dy = dy >> SCROLL_SHIFT; + // These types are same as the ones they get set to except that the // first side's sector's heights cause scrolling when they change, and // this linedef controls the direction and speed of the scrolling. The @@ -9106,6 +9117,7 @@ static void P_SpawnPushers(void) register INT32 s; mobj_t *thing; pushertype_e pushertype; + fixed_t dx, dy; for (i = 0; i < numlines; i++, l++) { @@ -9154,12 +9166,25 @@ static void P_SpawnPushers(void) continue; } + dx = l->dx; + dy = l->dy; + + // Obtain versor and scale it up according to texture offset, if provided; line length is ignored in this case. + + if (sides[l->sidenum[0]].textureoffset != 0) + { + fixed_t len = sides[l->sidenum[0]].textureoffset; + fixed_t h = FixedHypot(dx, dy); + dx = FixedMul(FixedDiv(dx, h), len); + dy = FixedMul(FixedDiv(dy, h), len); + } + if (l->tag == 0) - Add_Pusher(pushertype, l->dx, l->dy, NULL, l->frontsector - sectors, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + Add_Pusher(pushertype, dx, dy, NULL, l->frontsector - sectors, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); else { for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Pusher(pushertype, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + Add_Pusher(pushertype, dx, dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); } } }