Adapt linedef types 403-404 to UDMF

This commit is contained in:
MascaraSnake 2021-06-26 08:31:59 +02:00
parent 0eabbf0170
commit 53976e4b52
4 changed files with 31 additions and 35 deletions

View file

@ -448,8 +448,7 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type)
// Linedef executor excellence
case moveCeilingByFrontSector:
ceiling->speed = P_AproxDistance(line->dx, line->dy);
ceiling->speed = FixedDiv(ceiling->speed,8*FRACUNIT);
ceiling->speed = line->args[2] << (FRACBITS - 3);
if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up
{
ceiling->direction = 1;
@ -462,18 +461,11 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type)
}
// chained linedef executing ability
if (line->flags & ML_BLOCKMONSTERS)
{
// only set it on ONE of the moving sectors (the smallest numbered)
// and front side x offset must be positive
if (firstone && sides[line->sidenum[0]].textureoffset > 0)
ceiling->texture = (sides[line->sidenum[0]].textureoffset>>FRACBITS) - 32769;
else
ceiling->texture = -1;
}
// only set it on ONE of the moving sectors (the smallest numbered)
if (line->args[3] > 0)
ceiling->texture = firstone ? line->args[3] - INT16_MAX - 2 : -1;
// flat changing ability
else if (line->flags & ML_NOCLIMB)
else if (line->args[4])
ceiling->texture = line->frontsector->ceilingpic;
else
ceiling->texture = -1;

View file

@ -1864,11 +1864,8 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype)
dofloor->texture = (line->args[2] & 1) ? line->frontsector->floorpic : -1;
break;
// Linedef executor command, linetype 106.
// Line length = speed, front sector floor = destination height.
case moveFloorByFrontSector:
dofloor->speed = P_AproxDistance(line->dx, line->dy);
dofloor->speed = FixedDiv(dofloor->speed,8*FRACUNIT);
dofloor->speed = line->args[2] << (FRACBITS - 3);
dofloor->floordestheight = line->frontsector->floorheight;
if (dofloor->floordestheight >= sec->floorheight)
@ -1877,19 +1874,11 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype)
dofloor->direction = -1; // down
// chained linedef executing ability
if (line->flags & ML_BLOCKMONSTERS)
{
// Only set it on one of the moving sectors (the
// smallest numbered) and only if the front side
// x offset is positive, indicating a valid tag.
if (firstone && sides[line->sidenum[0]].textureoffset > 0)
dofloor->texture = (sides[line->sidenum[0]].textureoffset>>FRACBITS) - 32769;
else
dofloor->texture = -1;
}
// Only set it on one of the moving sectors (the smallest numbered)
if (line->args[3] > 0)
dofloor->texture = firstone ? line->args[3] - INT16_MAX - 2 : -1;
// flat changing ability
else if (line->flags & ML_NOCLIMB)
else if (line->args[4])
dofloor->texture = line->frontsector->floorpic;
else
dofloor->texture = -1; // nothing special to do after movement completes

View file

@ -3523,6 +3523,22 @@ static void P_ConvertBinaryMap(void)
case 403: //Move tagged sector's floor
case 404: //Move tagged sector's ceiling
lines[i].args[0] = tag;
lines[i].args[1] = lines[i].special - 403;
lines[i].args[2] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS;
if (lines[i].flags & ML_BLOCKMONSTERS)
{
if (sides[lines[i].sidenum[0]].textureoffset > 0)
lines[i].args[3] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
else
lines[i].args[3] = 0;
lines[i].args[4] = 0;
}
else
{
lines[i].args[3] = 0;
lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB);
}
lines[i].special = 403;
break;
case 405: //Move floor according to front texture offsets
case 407: //Move ceiling according to front texture offsets

View file

@ -2270,12 +2270,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
}
break;
case 403: // Move floor, linelen = speed, frontsector floor = dest height
EV_DoFloor(line->args[0], line, moveFloorByFrontSector);
break;
case 404: // Move ceiling, linelen = speed, frontsector ceiling = dest height
EV_DoCeiling(line->args[0], line, moveCeilingByFrontSector);
case 403: // Move planes by front sector
if (line->args[1] != 1)
EV_DoFloor(line->args[0], line, moveFloorByFrontSector);
if (line->args[1] != 0)
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