diff --git a/src/p_enemy.c b/src/p_enemy.c index 09cd82894..6fa653c0e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3926,9 +3926,9 @@ void A_BossDeath(mobj_t *mo) { // Bring the egg trap up to the surface // Incredibly shitty code ahead - EV_DoElevator(LE_CAPSULE0, NULL, elevateHighest, false); - EV_DoElevator(LE_CAPSULE1, NULL, elevateUp, false); - EV_DoElevator(LE_CAPSULE2, NULL, elevateHighest, false); + EV_DoElevator(LE_CAPSULE0, NULL, elevateHighest); + EV_DoElevator(LE_CAPSULE1, NULL, elevateUp); + EV_DoElevator(LE_CAPSULE2, NULL, elevateHighest); if (mapheaderinfo[gamemap-1]->muspostbossname[0] && S_MusicExists(mapheaderinfo[gamemap-1]->muspostbossname, !midi_disabled, !digital_disabled)) diff --git a/src/p_floor.c b/src/p_floor.c index e06f65f5c..604f110ff 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2021,13 +2021,13 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype) // // jff 2/22/98 new type to move floor and ceiling in parallel // -void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean customspeed) +void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype) { INT32 secnum = -1; sector_t *sec; elevator_t *elevator; - // act on all sectors with the same tag as the triggering linedef + // act on all sectors with the given tag TAG_ITER_SECTORS(tag, secnum) { sec = §ors[secnum]; @@ -2055,8 +2055,6 @@ void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean custom elevator->sector = sec; elevator->speed = ELEVATORSPEED/2; // half speed elevator->floordestheight = P_FindNextLowestFloor(sec, sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; break; // elevator up to next floor @@ -2065,8 +2063,6 @@ void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean custom elevator->sector = sec; elevator->speed = ELEVATORSPEED/4; // quarter speed elevator->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; break; // elevator up to highest floor @@ -2075,8 +2071,6 @@ void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean custom elevator->sector = sec; elevator->speed = ELEVATORSPEED/4; // quarter speed elevator->floordestheight = P_FindHighestFloorSurrounding(sec); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; break; // elevator to floor height of activating switch's front sector @@ -2084,23 +2078,12 @@ void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean custom elevator->sector = sec; elevator->speed = ELEVATORSPEED; elevator->floordestheight = line->frontsector->floorheight; - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; elevator->direction = elevator->floordestheight > sec->floorheight? 1 : -1; break; case elevateContinuous: - if (customspeed) - { - elevator->origspeed = P_AproxDistance(line->dx, line->dy); - elevator->origspeed = FixedDiv(elevator->origspeed,4*FRACUNIT); - elevator->speed = elevator->origspeed; - } - else - { - elevator->speed = ELEVATORSPEED/2; - elevator->origspeed = elevator->speed; - } + elevator->origspeed = line->args[1] << (FRACBITS - 2); + elevator->speed = elevator->origspeed; elevator->sector = sec; elevator->low = !(line->flags & ML_NOCLIMB); // go down first unless noclimb is on @@ -2108,15 +2091,11 @@ void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean custom { elevator->direction = 1; elevator->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; } else { elevator->direction = -1; elevator->floordestheight = P_FindNextLowestFloor(sec,sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; } elevator->floorwasheight = elevator->sector->floorheight; elevator->ceilingwasheight = elevator->sector->ceilingheight; @@ -2130,13 +2109,13 @@ void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean custom elevator->sector = sec; elevator->speed = ELEVATORSPEED*4; // quadruple speed elevator->floordestheight = P_FindNextLowestFloor(sec, sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; break; default: break; } + + elevator->ceilingdestheight = elevator->floordestheight + sec->ceilingheight - sec->floorheight; } } diff --git a/src/p_inter.c b/src/p_inter.c index 33052c3b8..6689165ea 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1387,7 +1387,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->bot) return; - EV_DoElevator(LE_AXE, NULL, bridgeFall, false); + EV_DoElevator(LE_AXE, NULL, bridgeFall); // scan the remaining thinkers to find koopa for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) diff --git a/src/p_setup.c b/src/p_setup.c index 9bea8f868..67d5f669f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3089,15 +3089,21 @@ static void P_ConvertBinaryMap(void) case 54: //Continuous floor mover case 55: //Continuous ceiling mover lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 53) ? 2 : lines[i].special - 54; + lines[i].special = 53; break; case 56: //Continuous two-speed floor/ceiling mover case 57: //Continuous two-speed floor mover case 58: //Continuous two-speed ceiling mover lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 56) ? 2 : lines[i].special - 57; + lines[i].special = 56; break; case 59: //Activate moving platform case 60: //Activate moving platform (adjustable speed) lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 60) ? P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS : 8; + lines[i].special = 60; break; case 61: //Crusher (Ceiling to floor) case 62: //Crusher (Floor to ceiling) @@ -3518,6 +3524,7 @@ static void P_ConvertBinaryMap(void) break; case 428: //Start platform movement lines[i].args[0] = tag; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; break; case 429: //Crush ceiling once case 430: //Crush floor once diff --git a/src/p_spec.c b/src/p_spec.c index 936551e0e..e72013590 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2870,7 +2870,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 428: // Start floating platform movement - EV_DoElevator(line->args[0], line, elevateContinuous, true); + EV_DoElevator(line->args[0], line, elevateContinuous); break; case 429: // Crush Ceiling Down Once @@ -4418,7 +4418,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers sector->special = 0; // Move the button down - EV_DoElevator(LE_CAPSULE0, NULL, elevateDown, false); + EV_DoElevator(LE_CAPSULE0, NULL, elevateDown); // Open the top FOF EV_DoFloor(LE_CAPSULE1, NULL, raiseFloorToNearestFast); @@ -6318,50 +6318,41 @@ void P_SpawnSpecials(boolean fromnetsave) break; case 50: // Insta-Lower Sector - EV_DoFloor(lines[i].args[0], &lines[i], instantLower); + if (!udmf) + EV_DoFloor(lines[i].args[0], &lines[i], instantLower); break; case 51: // Instant raise for ceilings - EV_DoCeiling(lines[i].args[0], &lines[i], instantRaise); + if (!udmf) + EV_DoCeiling(lines[i].args[1], &lines[i], instantRaise); break; case 52: // Continuously Falling sector EV_DoContinuousFall(lines[i].frontsector, lines[i].backsector, P_AproxDistance(lines[i].dx, lines[i].dy), (lines[i].flags & ML_NOCLIMB)); break; - case 53: // New super cool and awesome moving floor and ceiling type - case 54: // New super cool and awesome moving floor type + case 53: // Continuous plane movement (slowdown) if (lines[i].backsector) - EV_DoFloor(lines[i].args[0], &lines[i], bounceFloor); - if (lines[i].special == 54) - break; - /* FALLTHRU */ - - case 55: // New super cool and awesome moving ceiling type - if (lines[i].backsector) - EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeiling); + { + if (lines[i].args[1] != 1) + EV_DoFloor(lines[i].args[0], &lines[i], bounceFloor); + if (lines[i].args[1] != 0) + EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeiling); + } break; - case 56: // New super cool and awesome moving floor and ceiling crush type - case 57: // New super cool and awesome moving floor crush type + case 56: // Continuous plane movement (constant) if (lines[i].backsector) - EV_DoFloor(lines[i].args[0], &lines[i], bounceFloorCrush); - - if (lines[i].special == 57) - break; //only move the floor - /* FALLTHRU */ - - case 58: // New super cool and awesome moving ceiling crush type - if (lines[i].backsector) - EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeilingCrush); + { + if (lines[i].args[1] != 1) + EV_DoFloor(lines[i].args[0], &lines[i], bounceFloorCrush); + if (lines[i].args[1] != 0) + EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeilingCrush); + } break; - case 59: // Activate floating platform - EV_DoElevator(lines[i].args[0], &lines[i], elevateContinuous, false); - break; - - case 60: // Floating platform with adjustable speed - EV_DoElevator(lines[i].args[0], &lines[i], elevateContinuous, true); + case 60: // Moving platform + EV_DoElevator(lines[i].args[0], &lines[i], elevateContinuous); break; case 61: // Crusher! diff --git a/src/p_spec.h b/src/p_spec.h index a06c677e3..1829188a9 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -521,7 +521,7 @@ typedef enum result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crush, boolean ceiling, INT32 direction); void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype); -void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean customspeed); +void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype); void EV_CrumbleChain(sector_t *sec, ffloor_t *rover); void EV_BounceSector(sector_t *sector, fixed_t momz, line_t *sourceline);