From ac5eb1518dc161619f405b1cae978b382e034da7 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 27 Jun 2021 12:36:46 +0200 Subject: [PATCH] Add floor/ceiling/both enum --- src/p_setup.c | 14 +++++++------- src/p_spec.c | 28 ++++++++++++++-------------- src/p_spec.h | 7 +++++++ 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 2b03fe173..46397dafb 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3093,7 +3093,7 @@ static void P_ConvertBinaryMap(void) case 54: //Continuous floor mover case 55: //Continuous ceiling mover lines[i].args[0] = tag; - lines[i].args[1] = (lines[i].special == 53) ? 2 : lines[i].special - 54; + lines[i].args[1] = (lines[i].special == 53) ? TMP_BOTH : lines[i].special - 54; lines[i].args[2] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; lines[i].args[3] = lines[i].args[2]; lines[i].args[4] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; @@ -3104,7 +3104,7 @@ static void P_ConvertBinaryMap(void) case 57: //Continuous two-speed floor mover case 58: //Continuous two-speed ceiling mover lines[i].args[0] = tag; - lines[i].args[1] = (lines[i].special == 56) ? 2 : lines[i].special - 57; + lines[i].args[1] = (lines[i].special == 56) ? TMP_BOTH : lines[i].special - 57; lines[i].args[2] = abs(lines[i].dx) >> FRACBITS; lines[i].args[3] = abs(lines[i].dy) >> FRACBITS; lines[i].args[4] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; @@ -3564,7 +3564,7 @@ static void P_ConvertBinaryMap(void) case 405: //Move floor according to front texture offsets case 407: //Move ceiling according to front texture offsets lines[i].args[0] = tag; - lines[i].args[1] = (lines[i].special == 405) ? 0 : 1; + lines[i].args[1] = (lines[i].special == 405) ? TMP_FLOOR : TMP_CEILING; lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; lines[i].args[3] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB); @@ -3578,11 +3578,11 @@ static void P_ConvertBinaryMap(void) lines[i].special = 0; } else if (lines[i].flags & ML_NOCLIMB) - lines[i].args[1] = 1; + lines[i].args[1] = TMP_CEILING; else if (lines[i].flags & ML_EFFECT4) - lines[i].args[1] = 0; + lines[i].args[1] = TMP_FLOOR; else - lines[i].args[1] = 2; + lines[i].args[1] = TMP_BOTH; break; case 411: //Stop plane movement lines[i].args[0] = tag; @@ -3598,7 +3598,7 @@ static void P_ConvertBinaryMap(void) case 430: //Crush floor once case 431: //Crush floor and ceiling once lines[i].args[0] = tag; - lines[i].args[1] = (lines[i].special == 429) ? 1 : ((lines[i].special == 430) ? 0 : 2); + lines[i].args[1] = (lines[i].special == 429) ? TMP_CEILING : ((lines[i].special == 430) ? TMP_FLOOR : TMP_BOTH); if (lines[i].special == 430 || lines[i].flags & ML_EFFECT4) { lines[i].args[2] = abs(lines[i].dx) >> FRACBITS; diff --git a/src/p_spec.c b/src/p_spec.c index a3fdbe629..9987a7c6f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2234,9 +2234,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) switch (line->special) { case 400: // Set tagged sector's heights/flats - if (line->args[1] != 1) + if (line->args[1] != TMP_CEILING) EV_DoFloor(line->args[0], line, instantMoveFloorByFrontSector); - if (line->args[1] != 0) + if (line->args[1] != TMP_FLOOR) EV_DoCeiling(line->args[0], line, instantMoveCeilingByFrontSector); break; @@ -2271,16 +2271,16 @@ 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] != 1) + if (line->args[1] != TMP_CEILING) EV_DoFloor(line->args[0], line, moveFloorByFrontSector); - if (line->args[1] != 0) + if (line->args[1] != TMP_FLOOR) EV_DoCeiling(line->args[0], line, moveCeilingByFrontSector); break; case 405: // Move planes by distance - if (line->args[1] != 1) + if (line->args[1] != TMP_CEILING) EV_DoFloor(line->args[0], line, moveFloorByDistance); - if (line->args[1] != 0) + if (line->args[1] != TMP_FLOOR) EV_DoCeiling(line->args[0], line, moveCeilingByDistance); break; @@ -2288,9 +2288,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { TAG_ITER_SECTORS(line->args[0], secnum) { - if (line->args[1] != 1) + if (line->args[1] != TMP_CEILING) sectors[secnum].floorpic = line->frontsector->floorpic; - if (line->args[1] != 0) + if (line->args[1] != TMP_FLOOR) sectors[secnum].ceilingpic = line->frontsector->ceilingpic; } break; @@ -2883,9 +2883,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 429: // Crush planes once - if (line->args[1] == 0) + if (line->args[1] == TMP_FLOOR) EV_DoFloor(line->args[0], line, crushFloorOnce); - else if (line->args[1] == 1) + else if (line->args[1] == TMP_CEILING) EV_DoCrush(line->args[0], line, crushCeilOnce); else EV_DoCrush(line->args[0], line, crushBothOnce); @@ -6340,9 +6340,9 @@ void P_SpawnSpecials(boolean fromnetsave) case 53: // Continuous plane movement (slowdown) if (lines[i].backsector) { - if (lines[i].args[1] != 1) + if (lines[i].args[1] != TMP_CEILING) EV_DoFloor(lines[i].args[0], &lines[i], bounceFloor); - if (lines[i].args[1] != 0) + if (lines[i].args[1] != TMP_FLOOR) EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeiling); } break; @@ -6350,9 +6350,9 @@ void P_SpawnSpecials(boolean fromnetsave) case 56: // Continuous plane movement (constant) if (lines[i].backsector) { - if (lines[i].args[1] != 1) + if (lines[i].args[1] != TMP_CEILING) EV_DoFloor(lines[i].args[0], &lines[i], bounceFloorCrush); - if (lines[i].args[1] != 0) + if (lines[i].args[1] != TMP_FLOOR) EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeilingCrush); } break; diff --git a/src/p_spec.h b/src/p_spec.h index 921af714e..642f7fadf 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -102,6 +102,13 @@ typedef enum TMFL_SPLAT = 1<<1, } textmapfoflaserflags_t; +typedef enum +{ + TMP_FLOOR = 0, + TMP_CEILING = 1, + TMP_BOTH = 2, +} textmapplanes_t; + // GETSECSPECIAL (specialval, section) // // Pulls out the special # from a particular section.