From 420e25eba00a08b3f56e90e82eaa463ad9f5928e Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 27 Dec 2022 07:32:59 -0500 Subject: [PATCH] Update executors 400, 403, 405, and 429 for ACS --- src/p_floor.c | 5 +- src/p_setup.c | 35 +++++++------ src/p_spec.c | 142 ++++++++++++++++++++++++++++++++++++++++++++------ src/p_spec.h | 2 +- 4 files changed, 147 insertions(+), 37 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index e10c549f8..87a4a63d8 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1618,7 +1618,6 @@ void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype) case crushFloorOnce: EV_DoCrushFloorOnce( tag, - line->frontsector->ceilingheight, line->args[2] << (FRACBITS - 2) ); break; @@ -1846,7 +1845,7 @@ void EV_DoBounceFloor(mtag_t tag, boolean crush, fixed_t crushHeight, fixed_t cr } } -void EV_DoCrushFloorOnce(mtag_t tag, fixed_t height, fixed_t speed) +void EV_DoCrushFloorOnce(mtag_t tag, fixed_t speed) { INT32 secnum = -1; sector_t *sec; @@ -1866,7 +1865,7 @@ void EV_DoCrushFloorOnce(mtag_t tag, fixed_t height, fixed_t speed) dofloor->type = crushFloorOnce; dofloor->speed = dofloor->origspeed = speed; - dofloor->floordestheight = height; + dofloor->floordestheight = sec->ceilingheight - FRACUNIT; if (dofloor->floordestheight >= sec->floorheight) dofloor->direction = 1; // up diff --git a/src/p_setup.c b/src/p_setup.c index eda4820c1..27a64135a 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4853,7 +4853,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[3] |= TMFA_SPLAT; lines[i].special = 220; - break; + break; case 250: //FOF: Mario block lines[i].args[0] = tag; if (lines[i].flags & ML_NOCLIMB) @@ -5190,24 +5190,26 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[2] = TMC_EQUAL; lines[i].special = 340; break; - 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 - 400; - lines[i].args[2] = !(lines[i].flags & ML_NOCLIMB); + case 400: //Copy tagged sector's floor height/texture + case 401: //Copy tagged sector's ceiling height/texture + lines[i].args[0] = 0; + lines[i].args[1] = tag; + lines[i].args[2] = lines[i].special - 400; + lines[i].args[3] = !(lines[i].flags & ML_NOCLIMB); lines[i].special = 400; break; case 402: //Copy light level lines[i].args[0] = tag; lines[i].args[1] = 0; break; - 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; - lines[i].args[3] = (lines[i].flags & ML_BLOCKPLAYERS) ? sides[lines[i].sidenum[0]].textureoffset >> FRACBITS : 0; - lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB); + case 403: //Copy-move tagged sector's floor height/texture + case 404: //Copy-move tagged sector's ceiling height/texture + lines[i].args[0] = 0; + lines[i].args[1] = tag; + lines[i].args[2] = lines[i].special - 403; + lines[i].args[3] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[4] = (lines[i].flags & ML_BLOCKPLAYERS) ? sides[lines[i].sidenum[0]].textureoffset >> FRACBITS : 0; + lines[i].args[5] = !!(lines[i].flags & ML_NOCLIMB); lines[i].special = 403; break; case 405: //Move floor according to front texture offsets @@ -5219,11 +5221,12 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB); lines[i].special = 405; break; - case 408: //Set flats - lines[i].args[0] = tag; + case 408: //Copy flats + lines[i].args[0] = 0; + lines[i].args[1] = tag; if ((lines[i].flags & (ML_NOCLIMB|ML_MIDSOLID)) == (ML_NOCLIMB|ML_MIDSOLID)) { - CONS_Alert(CONS_WARNING, M_GetText("Set flats linedef (tag %d) doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"), tag); + CONS_Alert(CONS_WARNING, M_GetText("Copy flats linedef (tag %d) doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"), tag); lines[i].special = 0; } else if (lines[i].flags & ML_NOCLIMB) diff --git a/src/p_spec.c b/src/p_spec.c index 3ad1e470f..0bba2ae63 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2187,11 +2187,48 @@ 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 heights/flats - if (line->args[1] != TMP_CEILING) - EV_DoFloor(line->args[0], line, instantMoveFloorByFrontSector); - if (line->args[1] != TMP_FLOOR) - EV_DoCeiling(line->args[0], line, instantMoveCeilingByFrontSector); + case 400: // Copy tagged sector's heights/flats + { + sector_t *copySector = NULL; + + if (line->args[0] == 0) + { + if (line == NULL) + { + CONS_Debug(DBG_GAMELOGIC, "Special type 400 Executor: No frontsector to copy planes from!\n"); + return; + } + copySector = line->frontsector; + } + else + { + INT32 destsec = Tag_Iterate_Sectors(line->args[0], 0); + if (destsec == -1) + { + CONS_Debug(DBG_GAMELOGIC, "Special type 400 Executor: No sector to copy planes from (tag %d)!\n", line->args[0]); + return; + } + copySector = §ors[destsec]; + } + + if (line->args[2] != TMP_CEILING) + { + EV_DoInstantMoveFloorByHeight( + line->args[1], + copySector->floorheight, + line->args[3] ? copySector->floorpic : -1 + ); + } + + if (line->args[2] != TMP_FLOOR) + { + EV_DoInstantMoveCeilingByHeight( + line->args[1], + copySector->ceilingheight, + line->args[3] ? copySector->ceilingpic : -1 + ); + } + } break; case 402: // Copy light level to tagged sectors @@ -2236,21 +2273,77 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } break; - case 403: // Move planes by front sector - if (line->args[1] != TMP_CEILING) - EV_DoFloor(line->args[0], line, moveFloorByFrontSector); - if (line->args[1] != TMP_FLOOR) - EV_DoCeiling(line->args[0], line, moveCeilingByFrontSector); + case 403: // Copy-move tagged sector's heights/flats + { + sector_t *copySector = NULL; + + if (line->args[0] == 0) + { + if (line == NULL) + { + CONS_Debug(DBG_GAMELOGIC, "Special type 403 Executor: No frontsector to copy planes from!\n"); + return; + } + copySector = line->frontsector; + } + else + { + INT32 destsec = Tag_Iterate_Sectors(line->args[0], 0); + if (destsec == -1) + { + CONS_Debug(DBG_GAMELOGIC, "Special type 403 Executor: No sector to copy planes from (tag %d)!\n", line->args[0]); + return; + } + copySector = §ors[destsec]; + } + + if (line->args[2] != TMP_CEILING) + { + EV_DoMoveFloorByHeight( + line->args[1], + copySector->floorheight, + line->args[3] << (FRACBITS - 3), + line->args[4], + line->args[5] ? copySector->floorpic : -1 + ); + } + + if (line->args[2] != TMP_FLOOR) + { + EV_DoMoveCeilingByHeight( + line->args[1], + copySector->floorheight, + line->args[3] << (FRACBITS - 3), + line->args[4], + line->args[5] ? copySector->floorpic : -1 + ); + } + } break; - case 405: // Move planes by distance + case 405: // Move planes by offsets if (line->args[1] != TMP_CEILING) - EV_DoFloor(line->args[0], line, moveFloorByDistance); + { + EV_DoMoveFloorByDistance( + line->args[0], + line->args[2] << FRACBITS, + line->args[3] << (FRACBITS - 3), + line->args[4] + ); + } + if (line->args[1] != TMP_FLOOR) - EV_DoCeiling(line->args[0], line, moveCeilingByDistance); + { + EV_DoMoveCeilingByDistance( + line->args[0], + line->args[2] << FRACBITS, + line->args[3] << (FRACBITS - 3), + line->args[4] + ); + } break; - case 408: // Set flats + case 408: // Copy flats { TAG_ITER_SECTORS(line->args[0], secnum) { @@ -2617,11 +2710,26 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 429: // Crush planes once if (line->args[1] == TMP_FLOOR) - EV_DoFloor(line->args[0], line, crushFloorOnce); + { + EV_DoCrushFloorOnce( + line->args[0], + line->args[2] << (FRACBITS - 2) + ); + } else if (line->args[1] == TMP_CEILING) - EV_DoCrush(line->args[0], line, crushCeilOnce); + { + EV_DoCrushCeilingOnce( + line->args[0], + line->args[2] << (FRACBITS - 2) + ); + } else - EV_DoCrush(line->args[0], line, crushBothOnce); + { + EV_DoCrushBothOnce( + line->args[0], + line->args[2] << (FRACBITS - 2) + ); + } break; case 433: // Flip/flop gravity. Works on pushables, too! diff --git a/src/p_spec.h b/src/p_spec.h index 2dd7012da..771c6df8f 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -971,7 +971,7 @@ void EV_DoInstantMoveFloorByHeight(mtag_t tag, fixed_t height, INT32 texture); void EV_DoMoveFloorByHeight(mtag_t tag, fixed_t height, fixed_t speed, mtag_t chain, INT32 texture); void EV_DoMoveFloorByDistance(mtag_t tag, fixed_t distance, fixed_t speed, boolean instant); void EV_DoBounceFloor(mtag_t tag, boolean crush, fixed_t crushHeight, fixed_t crushSpeed, fixed_t returnHeight, fixed_t returnSpeed, INT32 delayInit, INT32 delay); -void EV_DoCrushFloorOnce(mtag_t tag, fixed_t height, fixed_t speed); +void EV_DoCrushFloorOnce(mtag_t tag, fixed_t speed); void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype); void EV_CrumbleChain(sector_t *sec, ffloor_t *rover);