Adapt linedef types 400-401 to UDMF + some EV_ cleanup

This commit is contained in:
MascaraSnake 2021-06-25 18:34:56 +02:00
parent 825b4b384a
commit 6abcba6876
5 changed files with 32 additions and 98 deletions

View file

@ -80,7 +80,6 @@ void T_MoveCeiling(ceiling_t *ceiling)
ceiling->sector->ceilingpic = ceiling->texture;
/* FALLTHRU */
case raiseToHighest:
// case raiseCeilingByLine:
case moveCeilingByFrontTexture:
ceiling->sector->ceilingdata = NULL;
ceiling->sector->ceilspeed = 0;
@ -202,10 +201,6 @@ void T_MoveCeiling(ceiling_t *ceiling)
/* FALLTHRU */
// in all other cases, just remove the active ceiling
case lowerAndCrush:
case lowerToLowest:
case raiseToLowest:
// case lowerCeilingByLine:
case moveCeilingByFrontTexture:
ceiling->sector->ceilingdata = NULL;
ceiling->sector->ceilspeed = 0;
@ -279,7 +274,6 @@ void T_MoveCeiling(ceiling_t *ceiling)
switch (ceiling->type)
{
case crushAndRaise:
case lowerAndCrush:
ceiling->speed = FixedDiv(CEILSPEED,8*FRACUNIT);
break;
@ -426,8 +420,6 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type)
case crushAndRaise:
ceiling->crush = true;
ceiling->topheight = sec->ceilingheight;
/* FALLTHRU */
case lowerAndCrush:
ceiling->bottomheight = sec->floorheight;
ceiling->bottomheight += 4*FRACUNIT;
ceiling->direction = -1;
@ -440,19 +432,6 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type)
ceiling->speed = CEILSPEED;
break;
//SoM: 3/6/2000: Added Boom types
case lowerToLowest:
ceiling->bottomheight = P_FindLowestCeilingSurrounding(sec);
ceiling->direction = -1;
ceiling->speed = CEILSPEED;
break;
case raiseToLowest: // Graue 09-07-2004
ceiling->topheight = P_FindLowestCeilingSurrounding(sec) - 4*FRACUNIT;
ceiling->direction = 1;
ceiling->speed = line->dx; // hack
break;
case lowerToLowestFast:
ceiling->bottomheight = P_FindLowestCeilingSurrounding(sec);
ceiling->direction = -1;
@ -502,17 +481,27 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type)
case instantMoveCeilingByFrontSector:
ceiling->speed = INT32_MAX/2;
if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up
if (lines->args[1] & 2)
{
if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up
{
ceiling->direction = 1;
ceiling->topheight = line->frontsector->ceilingheight;
}
else // Move down
{
ceiling->direction = -1;
ceiling->bottomheight = line->frontsector->ceilingheight;
}
}
else
{
ceiling->direction = 1;
ceiling->topheight = line->frontsector->ceilingheight;
ceiling->topheight = sec->ceilingheight;
}
else // Move down
{
ceiling->direction = -1;
ceiling->bottomheight = line->frontsector->ceilingheight;
}
ceiling->texture = line->frontsector->ceilingpic;
// If flag is set, change ceiling texture after moving
ceiling->texture = (line->args[2] & 2) ? line->frontsector->ceilingpic : -1;
break;
case moveCeilingByFrontTexture:
@ -531,20 +520,6 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type)
}
break;
/*
case lowerCeilingByLine:
ceiling->speed = FixedDiv(abs(line->dx),8*FRACUNIT);
ceiling->direction = -1; // Move down
ceiling->bottomheight = sec->ceilingheight - abs(line->dy);
break;
case raiseCeilingByLine:
ceiling->speed = FixedDiv(abs(line->dx),8*FRACUNIT);
ceiling->direction = 1; // Move up
ceiling->topheight = sec->ceilingheight + abs(line->dy);
break;
*/
case bounceCeiling:
ceiling->speed = P_AproxDistance(line->dx, line->dy); // same speed as elevateContinuous
ceiling->speed = FixedDiv(ceiling->speed,4*FRACUNIT);

View file

@ -1834,23 +1834,15 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype)
switch (floortype)
{
// Lowers a floor to the lowest surrounding floor.
case lowerFloorToLowest:
dofloor->direction = -1; // down
dofloor->speed = FLOORSPEED*2; // 2 fracunits per tic
dofloor->floordestheight = P_FindLowestFloorSurrounding(sec);
break;
// Used for part of the Egg Capsule, when an FOF with type 666 is
// contacted by the player.
// Used to open the top of an Egg Capsule.
case raiseFloorToNearestFast:
dofloor->direction = -1; // down
dofloor->speed = FLOORSPEED*4; // 4 fracunits per tic
dofloor->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight);
break;
// Used for sectors tagged to 50 linedefs (effectively
// changing the base height for placing things in that sector).
// Instantly lower floor to surrounding sectors.
// Used as a hack in the binary map format to allow thing heights above 4096.
case instantLower:
dofloor->direction = -1; // down
dofloor->speed = INT32_MAX/2; // "instant" means "takes one tic"
@ -1861,22 +1853,15 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype)
// Front sector floor = destination height.
case instantMoveFloorByFrontSector:
dofloor->speed = INT32_MAX/2; // as above, "instant" is one tic
dofloor->floordestheight = line->frontsector->floorheight;
dofloor->floordestheight = (line->args[1] & 1) ? line->frontsector->floorheight : sec->floorheight;
if (dofloor->floordestheight >= sec->floorheight)
dofloor->direction = 1; // up
else
dofloor->direction = -1; // down
// New for 1.09: now you can use the no climb flag to
// DISABLE the flat changing. This makes it work
// totally opposite the way linetype 106 does. Yet
// another reason I'll be glad to break backwards
// compatibility for the final.
if (line->flags & ML_NOCLIMB)
dofloor->texture = -1; // don't mess with the floorpic
else
dofloor->texture = line->frontsector->floorpic;
// If flag is set, change floor texture after moving
dofloor->texture = (line->args[2] & 1) ? line->frontsector->floorpic : -1;
break;
// Linedef executor command, linetype 106.
@ -1923,28 +1908,6 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype)
dofloor->direction = -1; // down
break;
/*
// Linedef executor command, linetype 108.
// dx = speed, dy = amount to lower.
case lowerFloorByLine:
dofloor->direction = -1; // down
dofloor->speed = FixedDiv(abs(line->dx),8*FRACUNIT);
dofloor->floordestheight = sec->floorheight - abs(line->dy);
if (dofloor->floordestheight > sec->floorheight) // wrapped around
I_Error("Can't lower sector %d\n", secnum);
break;
// Linedef executor command, linetype 109.
// dx = speed, dy = amount to raise.
case raiseFloorByLine:
dofloor->direction = 1; // up
dofloor->speed = FixedDiv(abs(line->dx),8*FRACUNIT);
dofloor->floordestheight = sec->floorheight + abs(line->dy);
if (dofloor->floordestheight < sec->floorheight) // wrapped around
I_Error("Can't raise sector %d\n", secnum);
break;
*/
// Linetypes 2/3.
// Move floor up and down indefinitely like the old elevators.
case bounceFloor:

View file

@ -3516,6 +3516,9 @@ static void P_ConvertBinaryMap(void)
case 400: //Set tagged sector's floor height/texture
case 401: //Set tagged sector's ceiling height/texture
lines[i].args[0] = tag;
lines[i].args[1] = lines[i].special - 399;
lines[i].args[2] = (lines[i].flags & ML_NOCLIMB) ? 0 : lines[i].special - 399;
lines[i].special = 400;
break;
case 403: //Move tagged sector's floor
case 404: //Move tagged sector's ceiling

View file

@ -2233,12 +2233,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// note: only commands with linedef types >= 400 && < 500 can be used
switch (line->special)
{
case 400: // Set tagged sector's floor height/pic
EV_DoFloor(line->args[0], line, instantMoveFloorByFrontSector);
break;
case 401: // Set tagged sector's ceiling height/pic
EV_DoCeiling(line->args[0], line, instantMoveCeilingByFrontSector);
case 400: // Set tagged sector's heights/flats
if (line->args[1] & 1 || line->args[2] & 1)
EV_DoFloor(line->args[0], line, instantMoveFloorByFrontSector);
if (line->args[1] & 2 || line->args[2] & 2)
EV_DoCeiling(line->args[0], line, instantMoveCeilingByFrontSector);
break;
case 402: // Set tagged sector's light level

View file

@ -259,13 +259,10 @@ typedef enum
typedef enum
{
raiseToHighest,
lowerToLowest,
raiseToLowest,
lowerToLowestFast,
instantRaise, // instant-move for ceilings
lowerAndCrush,
crushAndRaise,
fastCrushAndRaise,
crushCeilOnce,
@ -319,9 +316,6 @@ void T_MoveCeiling(ceiling_t *ceiling);
//
typedef enum
{
// lower floor to lowest surrounding floor
lowerFloorToLowest,
// raise floor to next highest surrounding floor
raiseFloorToNearestFast,