From 983304f361085ca8e8aa3f2870ea9a66756a1ae8 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 10 Oct 2022 10:16:40 -0400 Subject: [PATCH] Update birdslopes to use args --- src/p_mobj.c | 2 +- src/p_setup.c | 27 ++++++++++++++++++++++ src/p_slopes.h | 14 ++++++++++++ src/p_spec.h | 9 +++++--- src/slope_anchors.c | 56 ++++++++++++++++++--------------------------- 5 files changed, 70 insertions(+), 38 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index d4f8efcf3..41f56dcd3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11648,7 +11648,7 @@ static boolean P_SpawnNonMobjMapThing(mapthing_t *mthing) return true; } else if (mthing->type == 750 // Slope vertex point (formerly chaos spawn) - || (mthing->type == 777 || mthing->type == 778) // Slope anchors + || (mthing->type == FLOOR_SLOPE_THING || mthing->type == CEILING_SLOPE_THING) // Slope anchors || (mthing->type >= 600 && mthing->type <= 611) // Special placement patterns || mthing->type == 1713) // Hoops { diff --git a/src/p_setup.c b/src/p_setup.c index b268078fc..8b2cf2127 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -5751,6 +5751,29 @@ static void P_ConvertBinaryLinedefTypes(void) case 799: //Set dynamic slope vertex to front sector height lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); break; + case LT_SLOPE_ANCHORS_OLD_FLOOR: //Slope front sector floor by 3 tagged vertices + case LT_SLOPE_ANCHORS_OLD_CEILING: //Slope front sector ceiling by 3 tagged vertices + case LT_SLOPE_ANCHORS_OLD: //Slope back sector floor by 3 tagged vertices + { + if (lines[i].special == LT_SLOPE_ANCHORS_OLD_FLOOR) + lines[i].args[0] = TMSA_FLOOR; + else if (lines[i].special == LT_SLOPE_ANCHORS_OLD_CEILING) + lines[i].args[0] = TMSA_CEILING; + else if (lines[i].special == LT_SLOPE_ANCHORS_OLD) + lines[i].args[0] = (TMSA_FLOOR|TMSA_CEILING); + + if (lines[i].flags & ML_NETONLY) + lines[i].args[1] |= TMSAF_NOPHYSICS; + if (lines[i].flags & ML_NONET) + lines[i].args[1] |= TMSAF_DYNAMIC; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[1] |= TMSAF_BACKSIDE; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[1] |= TMSAF_MIRROR; + + lines[i].special = LT_SLOPE_ANCHORS; + break; + } case 909: //Fog wall lines[i].blendmode = AST_FOG; break; @@ -6545,6 +6568,10 @@ static void P_ConvertBinaryThingTypes(void) mapthings[i].args[2] |= TMBCF_BACKANDFORTH; } break; + case FLOOR_SLOPE_THING: + case CEILING_SLOPE_THING: + Tag_FSet(&mapthings[i].tags, mapthings[i].extrainfo); + break; default: break; } diff --git a/src/p_slopes.h b/src/p_slopes.h index 12d10e020..5543b785f 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -48,6 +48,20 @@ typedef enum TMSL_COPY = 1<<2, } textmapslopeflags_t; +typedef enum +{ + TMSA_FLOOR = 1, + TMSA_CEILING = 1<<1, +} textmapslopeanchor_t; + +typedef enum +{ + TMSAF_NOPHYSICS = 1, + TMSAF_DYNAMIC = 1<<1, + TMSAF_BACKSIDE = 1<<2, + TMSAF_MIRROR = 1<<3, +} textmapslopeanchorflags_t; + void P_LinkSlopeThinkers (void); void P_UpdateSlopeLightOffset(pslope_t *slope); diff --git a/src/p_spec.h b/src/p_spec.h index e3cae0bfe..ac501d056 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -1119,9 +1119,12 @@ void P_CalcHeight(player_t *player); /* line specials */ enum { - LT_SLOPE_ANCHORS_FLOOR = 777, - LT_SLOPE_ANCHORS_CEILING = 778, - LT_SLOPE_ANCHORS = 779, + LT_SLOPE_ANCHORS = 777, + + // binary converter + LT_SLOPE_ANCHORS_OLD_FLOOR = 777, + LT_SLOPE_ANCHORS_OLD_CEILING = 778, + LT_SLOPE_ANCHORS_OLD = 779, }; #endif diff --git a/src/slope_anchors.c b/src/slope_anchors.c index 2c8f4959d..d40fc7318 100644 --- a/src/slope_anchors.c +++ b/src/slope_anchors.c @@ -199,7 +199,7 @@ get_anchor for (i = 0; i < list->count; ++i) { - if (list->points[i] == v && list->anchors[i]->extrainfo == tag) + if (list->points[i] == v && Tag_FGet(&list->anchors[i]->tags) == tag) { for (k = 0; k < 3; ++k) { @@ -347,12 +347,12 @@ new_vertex_slope {anchors[2]->x << FRACBITS, anchors[2]->y << FRACBITS, anchors[2]->z << FRACBITS} }; - if (flags & ML_NETONLY) + if (flags & TMSAF_NOPHYSICS) { slope->flags |= SL_NOPHYSICS; } - if (flags & ML_NONET) + if (flags & TMSAF_DYNAMIC) { slope->flags |= SL_DYNAMIC; } @@ -410,8 +410,8 @@ slope_sector { (*slope) = new_vertex_slope(anchors, flags); - /* Effect 6 - invert slope to opposite side */ - if (flags & ML_BLOCKMONSTERS) + /* invert slope to opposite side */ + if (flags & TMSAF_MIRROR) { (*alt) = new_vertex_slope(flip_slope(anchors, sector), flags); } @@ -426,36 +426,30 @@ make_anchored_slope const line_t * line, const int plane ){ - enum - { - FLOOR = 0x1, - CEILING = 0x2, - }; + INT16 flags = line->args[1]; - INT16 flags = line->flags; - - const int side = ( flags & ML_NOCLIMB ) != 0; + const int side = ( flags & TMSAF_BACKSIDE ) != 0; sector_t * s; mtag_t tag = Tag_FGet(&line->tags); - if (side == 0 || flags & ML_TWOSIDED) + if (side == 0 || (line->flags & ML_TWOSIDED)) { s = sides[line->sidenum[side]].sector; - if (plane == (FLOOR|CEILING)) + if (plane == (TMSA_FLOOR|TMSA_CEILING)) { - flags &= ~ML_BLOCKMONSTERS; + flags &= ~TMSAF_MIRROR; } - if (plane & FLOOR) + if (plane & TMSA_FLOOR) { slope_sector (&s->f_slope, &s->c_slope, s, flags, &floor_anchors, tag); } - if (plane & CEILING) + if (plane & TMSA_CEILING) { slope_sector (&s->c_slope, &s->f_slope, s, flags, &ceiling_anchors, tag); @@ -469,27 +463,21 @@ static void P_BuildSlopeAnchorList (void) { } static void P_SetupAnchoredSlopes (void) { - enum - { - FLOOR = 0x1, - CEILING = 0x2, - }; - size_t i; for (i = 0; i < numlines; ++i) { - if (lines[i].special == LT_SLOPE_ANCHORS_FLOOR) + if (lines[i].special == LT_SLOPE_ANCHORS) { - make_anchored_slope(&lines[i], FLOOR); - } - else if (lines[i].special == LT_SLOPE_ANCHORS_CEILING) - { - make_anchored_slope(&lines[i], CEILING); - } - else if (lines[i].special == LT_SLOPE_ANCHORS) - { - make_anchored_slope(&lines[i], FLOOR|CEILING); + int plane = (lines[i].args[0] & (TMSA_FLOOR|TMSA_CEILING)); + + if (plane == 0) + { + CONS_Alert(CONS_WARNING, "Slope anchor linedef %u has no planes set.\n", i); + continue; + } + + make_anchored_slope(&lines[i], plane); } } }