From 7d177a9157ff91452372e647bbd36fa297581886 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 | 32 ++++++----- src/p_spec.c | 152 +++++++++++++++++++++++++++++++++++++++----------- src/p_spec.h | 2 +- 4 files changed, 140 insertions(+), 51 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index f4b30ccec..8871fa237 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1622,7 +1622,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; @@ -1850,7 +1849,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; @@ -1870,7 +1869,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 b2c2d5615..366348b26 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4515,7 +4515,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) @@ -4860,11 +4860,12 @@ 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 @@ -4872,13 +4873,14 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[1] = tag; lines[i].args[2] = 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 @@ -4890,12 +4892,12 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB); lines[i].special = 405; break; - case 408: //Set flats + 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 a6d77fc10..948d51a85 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2261,16 +2261,48 @@ void P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, char * // note: only commands with linedef types >= 400 && < 500 can be used switch (special) { - case 400: // Set tagged sector's heights/flats - if (line == NULL) + case 400: // Copy tagged sector's heights/flats { - break; // TODO - } + sector_t *copySector = NULL; - if (args[1] != TMP_CEILING) - EV_DoFloor(args[0], line, instantMoveFloorByFrontSector); - if (args[1] != TMP_FLOOR) - EV_DoCeiling(args[0], line, instantMoveCeilingByFrontSector); + if (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(args[0], 0); + if (destsec == -1) + { + CONS_Debug(DBG_GAMELOGIC, "Special type 400 Executor: No sector to copy planes from (tag %d)!\n", args[0]); + return; + } + copySector = §ors[destsec]; + } + + if (args[2] != TMP_CEILING) + { + EV_DoInstantMoveFloorByHeight( + args[1], + copySector->floorheight, + args[3] ? copySector->floorpic : -1 + ); + } + + if (args[2] != TMP_FLOOR) + { + EV_DoInstantMoveCeilingByHeight( + args[1], + copySector->ceilingheight, + args[3] ? copySector->ceilingpic : -1 + ); + } + } break; case 402: // Copy light level to tagged sectors @@ -2339,31 +2371,77 @@ void P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, char * } break; - case 403: // Move planes by front sector - if (line == NULL) + case 403: // Copy-move tagged sector's heights/flats { - break; // TODO - } + sector_t *copySector = NULL; - if (args[1] != TMP_CEILING) - EV_DoFloor(args[0], line, moveFloorByFrontSector); - if (args[1] != TMP_FLOOR) - EV_DoCeiling(args[0], line, moveCeilingByFrontSector); + if (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(args[0], 0); + if (destsec == -1) + { + CONS_Debug(DBG_GAMELOGIC, "Special type 403 Executor: No sector to copy planes from (tag %d)!\n", args[0]); + return; + } + copySector = §ors[destsec]; + } + + if (args[2] != TMP_CEILING) + { + EV_DoMoveFloorByHeight( + args[1], + copySector->floorheight, + args[3] << (FRACBITS - 3), + args[4], + args[5] ? copySector->floorpic : -1 + ); + } + + if (args[2] != TMP_FLOOR) + { + EV_DoMoveCeilingByHeight( + args[1], + copySector->floorheight, + args[3] << (FRACBITS - 3), + args[4], + args[5] ? copySector->floorpic : -1 + ); + } + } break; - case 405: // Move planes by distance - if (line == NULL) + case 405: // Move planes by offsets + if (args[1] != TMP_CEILING) { - break; // TODO + EV_DoMoveFloorByDistance( + args[0], + args[2] << FRACBITS, + args[3] << (FRACBITS - 3), + args[4] + ); } - if (args[1] != TMP_CEILING) - EV_DoFloor(args[0], line, moveFloorByDistance); if (args[1] != TMP_FLOOR) - EV_DoCeiling(args[0], line, moveCeilingByDistance); + { + EV_DoMoveCeilingByDistance( + args[0], + args[2] << FRACBITS, + args[3] << (FRACBITS - 3), + args[4] + ); + } break; - case 408: // Set flats + case 408: // Copy flats { sector_t *copySector = NULL; @@ -2762,17 +2840,27 @@ void P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, char * break; case 429: // Crush planes once - if (line == NULL) - { - break; // TODO - } - if (args[1] == TMP_FLOOR) - EV_DoFloor(args[0], line, crushFloorOnce); - else if (line->args[1] == TMP_CEILING) - EV_DoCrush(args[0], line, crushCeilOnce); + { + EV_DoCrushFloorOnce( + args[0], + args[2] << (FRACBITS - 2) + ); + } + else if (args[1] == TMP_CEILING) + { + EV_DoCrushCeilingOnce( + args[0], + args[2] << (FRACBITS - 2) + ); + } else - EV_DoCrush(args[0], line, crushBothOnce); + { + EV_DoCrushBothOnce( + args[0], + 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 2ceb5b8b9..8e4ba93f2 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -984,7 +984,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);