Linedef type 403: Allow executor chaining and flat change at the same time

This commit is contained in:
MascaraSnake 2021-06-26 15:28:28 +02:00
parent 63eafff5fe
commit 446e78b6e2
5 changed files with 20 additions and 35 deletions

View file

@ -67,8 +67,8 @@ void T_MoveCeiling(ceiling_t *ceiling)
P_RemoveThinker(&ceiling->thinker);
return;
case moveCeilingByFrontSector:
if (ceiling->texture < -1) // chained linedef executing
P_LinedefExecute((INT16)(ceiling->texture + INT16_MAX + 2), NULL, NULL);
if (ceiling->tag) // chained linedef executing
P_LinedefExecute(ceiling->tag, NULL, NULL);
if (ceiling->texture > -1) // flat changing
ceiling->sector->ceilingpic = ceiling->texture;
/* FALLTHRU */
@ -262,13 +262,11 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type)
// chained linedef executing ability
// only set it on ONE of the moving sectors (the smallest numbered)
// only set it if there isn't also a floor mover
if (line->args[3] > 0 && line->args[1] == 1)
ceiling->texture = firstone ? line->args[3] - INT16_MAX - 2 : -1;
if (line->args[3] && line->args[1] == 1)
ceiling->tag = firstone ? (INT16)line->args[3] : 0;
// flat changing ability
else if (line->args[4])
ceiling->texture = line->frontsector->ceilingpic;
else
ceiling->texture = -1;
ceiling->texture = line->args[4] ? line->frontsector->ceilingpic : -1;
break;
// More linedef executor junk
@ -341,7 +339,6 @@ INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type)
}
ceiling->tag = tag;
ceiling->type = type;
firstone = 0;
}
@ -407,7 +404,6 @@ INT32 EV_DoCrush(mtag_t tag, line_t *line, ceiling_e type)
break;
}
ceiling->tag = tag;
ceiling->type = type;
}
return rtn;

View file

@ -193,8 +193,8 @@ void T_MoveFloor(floormove_t *movefloor)
switch (movefloor->type)
{
case moveFloorByFrontSector:
if (movefloor->texture < -1) // chained linedef executing
P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL);
if (movefloor->tag) // chained linedef executing
P_LinedefExecute(movefloor->tag, NULL, NULL);
/* FALLTHRU */
case instantMoveFloorByFrontSector:
if (movefloor->texture > -1) // flat changing
@ -1821,14 +1821,11 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype)
// chained linedef executing ability
// 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->args[4])
dofloor->texture = line->frontsector->floorpic;
else
dofloor->texture = -1; // nothing special to do after movement completes
if (line->args[3])
dofloor->tag = firstone ? (INT16)line->args[3] : -1;
// flat changing ability
dofloor->texture = line->args[4] ? line->frontsector->floorpic : -1;
break;
case moveFloorByDistance:

View file

@ -1991,7 +1991,7 @@ static void SaveCeilingThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, ht->crush);
WRITEINT32(save_p, ht->texture);
WRITEINT32(save_p, ht->direction);
WRITEINT32(save_p, ht->tag);
WRITEINT16(save_p, ht->tag);
WRITEINT32(save_p, ht->olddirection);
WRITEFIXED(save_p, ht->origspeed);
WRITEFIXED(save_p, ht->sourceline);
@ -2011,6 +2011,7 @@ static void SaveFloormoveThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, ht->origspeed);
WRITEFIXED(save_p, ht->delay);
WRITEFIXED(save_p, ht->delaytimer);
WRITEINT16(save_p, ht->tag);
}
static void SaveLightflashThinker(const thinker_t *th, const UINT8 type)
@ -3097,7 +3098,7 @@ static thinker_t* LoadCeilingThinker(actionf_p1 thinker)
ht->crush = READUINT8(save_p);
ht->texture = READINT32(save_p);
ht->direction = READINT32(save_p);
ht->tag = READINT32(save_p);
ht->tag = READINT16(save_p);
ht->olddirection = READINT32(save_p);
ht->origspeed = READFIXED(save_p);
ht->sourceline = READFIXED(save_p);
@ -3120,6 +3121,7 @@ static thinker_t* LoadFloormoveThinker(actionf_p1 thinker)
ht->origspeed = READFIXED(save_p);
ht->delay = READFIXED(save_p);
ht->delaytimer = READFIXED(save_p);
ht->tag = READINT16(save_p);
if (ht->sector)
ht->sector->floordata = ht;
return &ht->thinker;

View file

@ -3545,19 +3545,8 @@ static void P_ConvertBinaryMap(void)
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[3] = (lines[i].flags & ML_BLOCKMONSTERS) ? sides[lines[i].sidenum[0]].textureoffset >> FRACBITS : 0;
lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB);
}
lines[i].special = 403;
break;
case 405: //Move floor according to front texture offsets

View file

@ -296,7 +296,7 @@ typedef struct
INT32 direction; ///< 1 = up, 0 = waiting, -1 = down.
// ID
INT32 tag;
INT16 tag; ///< Tag of linedef executor to run when movement is done.
INT32 olddirection;
fixed_t origspeed; ///< The original, "real" speed.
INT32 sourceline; ///< Index of the source linedef
@ -356,6 +356,7 @@ typedef struct
fixed_t origspeed;
fixed_t delay;
fixed_t delaytimer;
INT16 tag;
} floormove_t;
typedef struct