Get rid of customspeed in EV_DoElevator and read speed from args[1]

This commit is contained in:
MascaraSnake 2021-06-25 11:11:16 +02:00
parent 7025f12d95
commit 259700be3c
6 changed files with 40 additions and 63 deletions

View file

@ -3926,9 +3926,9 @@ void A_BossDeath(mobj_t *mo)
{ {
// Bring the egg trap up to the surface // Bring the egg trap up to the surface
// Incredibly shitty code ahead // Incredibly shitty code ahead
EV_DoElevator(LE_CAPSULE0, NULL, elevateHighest, false); EV_DoElevator(LE_CAPSULE0, NULL, elevateHighest);
EV_DoElevator(LE_CAPSULE1, NULL, elevateUp, false); EV_DoElevator(LE_CAPSULE1, NULL, elevateUp);
EV_DoElevator(LE_CAPSULE2, NULL, elevateHighest, false); EV_DoElevator(LE_CAPSULE2, NULL, elevateHighest);
if (mapheaderinfo[gamemap-1]->muspostbossname[0] && if (mapheaderinfo[gamemap-1]->muspostbossname[0] &&
S_MusicExists(mapheaderinfo[gamemap-1]->muspostbossname, !midi_disabled, !digital_disabled)) S_MusicExists(mapheaderinfo[gamemap-1]->muspostbossname, !midi_disabled, !digital_disabled))

View file

@ -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 // 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; INT32 secnum = -1;
sector_t *sec; sector_t *sec;
elevator_t *elevator; 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) TAG_ITER_SECTORS(tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
@ -2055,8 +2055,6 @@ void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype, boolean custom
elevator->sector = sec; elevator->sector = sec;
elevator->speed = ELEVATORSPEED/2; // half speed elevator->speed = ELEVATORSPEED/2; // half speed
elevator->floordestheight = P_FindNextLowestFloor(sec, sec->floorheight); elevator->floordestheight = P_FindNextLowestFloor(sec, sec->floorheight);
elevator->ceilingdestheight = elevator->floordestheight
+ sec->ceilingheight - sec->floorheight;
break; break;
// elevator up to next floor // 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->sector = sec;
elevator->speed = ELEVATORSPEED/4; // quarter speed elevator->speed = ELEVATORSPEED/4; // quarter speed
elevator->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight); elevator->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight);
elevator->ceilingdestheight = elevator->floordestheight
+ sec->ceilingheight - sec->floorheight;
break; break;
// elevator up to highest floor // 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->sector = sec;
elevator->speed = ELEVATORSPEED/4; // quarter speed elevator->speed = ELEVATORSPEED/4; // quarter speed
elevator->floordestheight = P_FindHighestFloorSurrounding(sec); elevator->floordestheight = P_FindHighestFloorSurrounding(sec);
elevator->ceilingdestheight = elevator->floordestheight
+ sec->ceilingheight - sec->floorheight;
break; break;
// elevator to floor height of activating switch's front sector // 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->sector = sec;
elevator->speed = ELEVATORSPEED; elevator->speed = ELEVATORSPEED;
elevator->floordestheight = line->frontsector->floorheight; elevator->floordestheight = line->frontsector->floorheight;
elevator->ceilingdestheight = elevator->floordestheight
+ sec->ceilingheight - sec->floorheight;
elevator->direction = elevator->floordestheight > sec->floorheight? 1 : -1; elevator->direction = elevator->floordestheight > sec->floorheight? 1 : -1;
break; break;
case elevateContinuous: case elevateContinuous:
if (customspeed) elevator->origspeed = line->args[1] << (FRACBITS - 2);
{
elevator->origspeed = P_AproxDistance(line->dx, line->dy);
elevator->origspeed = FixedDiv(elevator->origspeed,4*FRACUNIT);
elevator->speed = elevator->origspeed; elevator->speed = elevator->origspeed;
}
else
{
elevator->speed = ELEVATORSPEED/2;
elevator->origspeed = elevator->speed;
}
elevator->sector = sec; elevator->sector = sec;
elevator->low = !(line->flags & ML_NOCLIMB); // go down first unless noclimb is on 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->direction = 1;
elevator->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight); elevator->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight);
elevator->ceilingdestheight = elevator->floordestheight
+ sec->ceilingheight - sec->floorheight;
} }
else else
{ {
elevator->direction = -1; elevator->direction = -1;
elevator->floordestheight = P_FindNextLowestFloor(sec,sec->floorheight); elevator->floordestheight = P_FindNextLowestFloor(sec,sec->floorheight);
elevator->ceilingdestheight = elevator->floordestheight
+ sec->ceilingheight - sec->floorheight;
} }
elevator->floorwasheight = elevator->sector->floorheight; elevator->floorwasheight = elevator->sector->floorheight;
elevator->ceilingwasheight = elevator->sector->ceilingheight; 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->sector = sec;
elevator->speed = ELEVATORSPEED*4; // quadruple speed elevator->speed = ELEVATORSPEED*4; // quadruple speed
elevator->floordestheight = P_FindNextLowestFloor(sec, sec->floorheight); elevator->floordestheight = P_FindNextLowestFloor(sec, sec->floorheight);
elevator->ceilingdestheight = elevator->floordestheight
+ sec->ceilingheight - sec->floorheight;
break; break;
default: default:
break; break;
} }
elevator->ceilingdestheight = elevator->floordestheight + sec->ceilingheight - sec->floorheight;
} }
} }

View file

@ -1387,7 +1387,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->bot) if (player->bot)
return; return;
EV_DoElevator(LE_AXE, NULL, bridgeFall, false); EV_DoElevator(LE_AXE, NULL, bridgeFall);
// scan the remaining thinkers to find koopa // scan the remaining thinkers to find koopa
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)

View file

@ -3089,15 +3089,21 @@ static void P_ConvertBinaryMap(void)
case 54: //Continuous floor mover case 54: //Continuous floor mover
case 55: //Continuous ceiling mover case 55: //Continuous ceiling mover
lines[i].args[0] = tag; lines[i].args[0] = tag;
lines[i].args[1] = (lines[i].special == 53) ? 2 : lines[i].special - 54;
lines[i].special = 53;
break; break;
case 56: //Continuous two-speed floor/ceiling mover case 56: //Continuous two-speed floor/ceiling mover
case 57: //Continuous two-speed floor mover case 57: //Continuous two-speed floor mover
case 58: //Continuous two-speed ceiling mover case 58: //Continuous two-speed ceiling mover
lines[i].args[0] = tag; lines[i].args[0] = tag;
lines[i].args[1] = (lines[i].special == 56) ? 2 : lines[i].special - 57;
lines[i].special = 56;
break; break;
case 59: //Activate moving platform case 59: //Activate moving platform
case 60: //Activate moving platform (adjustable speed) case 60: //Activate moving platform (adjustable speed)
lines[i].args[0] = tag; 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; break;
case 61: //Crusher (Ceiling to floor) case 61: //Crusher (Ceiling to floor)
case 62: //Crusher (Floor to ceiling) case 62: //Crusher (Floor to ceiling)
@ -3518,6 +3524,7 @@ static void P_ConvertBinaryMap(void)
break; break;
case 428: //Start platform movement case 428: //Start platform movement
lines[i].args[0] = tag; lines[i].args[0] = tag;
lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS;
break; break;
case 429: //Crush ceiling once case 429: //Crush ceiling once
case 430: //Crush floor once case 430: //Crush floor once

View file

@ -2870,7 +2870,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
case 428: // Start floating platform movement case 428: // Start floating platform movement
EV_DoElevator(line->args[0], line, elevateContinuous, true); EV_DoElevator(line->args[0], line, elevateContinuous);
break; break;
case 429: // Crush Ceiling Down Once 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; sector->special = 0;
// Move the button down // Move the button down
EV_DoElevator(LE_CAPSULE0, NULL, elevateDown, false); EV_DoElevator(LE_CAPSULE0, NULL, elevateDown);
// Open the top FOF // Open the top FOF
EV_DoFloor(LE_CAPSULE1, NULL, raiseFloorToNearestFast); EV_DoFloor(LE_CAPSULE1, NULL, raiseFloorToNearestFast);
@ -6318,50 +6318,41 @@ void P_SpawnSpecials(boolean fromnetsave)
break; break;
case 50: // Insta-Lower Sector case 50: // Insta-Lower Sector
if (!udmf)
EV_DoFloor(lines[i].args[0], &lines[i], instantLower); EV_DoFloor(lines[i].args[0], &lines[i], instantLower);
break; break;
case 51: // Instant raise for ceilings 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; break;
case 52: // Continuously Falling sector 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)); EV_DoContinuousFall(lines[i].frontsector, lines[i].backsector, P_AproxDistance(lines[i].dx, lines[i].dy), (lines[i].flags & ML_NOCLIMB));
break; break;
case 53: // New super cool and awesome moving floor and ceiling type case 53: // Continuous plane movement (slowdown)
case 54: // New super cool and awesome moving floor type
if (lines[i].backsector) if (lines[i].backsector)
{
if (lines[i].args[1] != 1)
EV_DoFloor(lines[i].args[0], &lines[i], bounceFloor); EV_DoFloor(lines[i].args[0], &lines[i], bounceFloor);
if (lines[i].special == 54) if (lines[i].args[1] != 0)
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); EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeiling);
}
break; break;
case 56: // New super cool and awesome moving floor and ceiling crush type case 56: // Continuous plane movement (constant)
case 57: // New super cool and awesome moving floor crush type
if (lines[i].backsector) if (lines[i].backsector)
{
if (lines[i].args[1] != 1)
EV_DoFloor(lines[i].args[0], &lines[i], bounceFloorCrush); EV_DoFloor(lines[i].args[0], &lines[i], bounceFloorCrush);
if (lines[i].args[1] != 0)
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); EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeilingCrush);
}
break; break;
case 59: // Activate floating platform case 60: // Moving platform
EV_DoElevator(lines[i].args[0], &lines[i], elevateContinuous, false); EV_DoElevator(lines[i].args[0], &lines[i], elevateContinuous);
break;
case 60: // Floating platform with adjustable speed
EV_DoElevator(lines[i].args[0], &lines[i], elevateContinuous, true);
break; break;
case 61: // Crusher! case 61: // Crusher!

View file

@ -521,7 +521,7 @@ typedef enum
result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crush, result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crush,
boolean ceiling, INT32 direction); boolean ceiling, INT32 direction);
void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype); 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_CrumbleChain(sector_t *sec, ffloor_t *rover);
void EV_BounceSector(sector_t *sector, fixed_t momz, line_t *sourceline); void EV_BounceSector(sector_t *sector, fixed_t momz, line_t *sourceline);