diff --git a/src/slope_anchors.c b/src/slope_anchors.c index ff1504a37..add9a33b7 100644 --- a/src/slope_anchors.c +++ b/src/slope_anchors.c @@ -118,11 +118,6 @@ anchor_height const mapthing_t * a, const sector_t * s ){ - if (a->extrainfo) - { - return a->options; - } - else { INT16 z = ( a->options >> ZSHIFT ); @@ -194,6 +189,7 @@ get_anchor mapthing_t ** anchors, fixed_t distances[3], const struct anchor_list * list, + const INT16 tag, const vertex_t * v ){ size_t i; @@ -202,7 +198,7 @@ get_anchor for (i = 0; i < list->count; ++i) { - if (list->points[i] == v) + if (list->points[i] == v && list->anchors[i]->extrainfo == tag) { for (k = 0; k < 3; ++k) { @@ -243,14 +239,15 @@ get_sector_anchors mapthing_t ** anchors, fixed_t distances[3], const struct anchor_list * list, + const INT16 tag, const sector_t * sector ){ size_t i; for (i = 0; i < sector->linecount; ++i) { - get_anchor(anchors, distances, list, sector->lines[i]->v1); - get_anchor(anchors, distances, list, sector->lines[i]->v2); + get_anchor(anchors, distances, list, tag, sector->lines[i]->v1); + get_anchor(anchors, distances, list, tag, sector->lines[i]->v2); } } @@ -258,7 +255,8 @@ static mapthing_t ** find_closest_anchors ( const sector_t * sector, - const struct anchor_list * list + const struct anchor_list * list, + const INT16 tag ){ fixed_t distances[3] = { INT32_MAX, INT32_MAX, INT32_MAX }; @@ -280,12 +278,12 @@ find_closest_anchors for (i = 0; i < sector->numattached; ++i) { get_sector_anchors - (anchors, distances, list, §ors[sector->attached[i]]); + (anchors, distances, list, tag, §ors[sector->attached[i]]); } } else { - get_sector_anchors(anchors, distances, list, sector); + get_sector_anchors(anchors, distances, list, tag, sector); } if (distances[2] < INT32_MAX) @@ -311,12 +309,13 @@ find_closest_anchors I_Error( "(Control Sector #%s)" - " Slope requires anchors near 3 of its target sectors' vertices" - " (%d found)" + " Slope requires anchors (with Parameter %d)" + " near 3 of its target sectors' vertices (%d found)" "\n\nCheck the log to see which sectors were searched.", sizeu1 (sector - sectors), + tag, last ); } @@ -324,9 +323,11 @@ find_closest_anchors { I_Error( "(Sector #%s)" - " Slope requires anchors near 3 of its vertices (%d found)", + " Slope requires anchors (with Parameter %d)" + " near 3 of its vertices (%d found)", sizeu1 (sector - sectors), + tag, last ); } @@ -367,6 +368,24 @@ new_vertex_slope return slope; } +static void +slope_sector +( + pslope_t ** slope, + sector_t * sector, + const INT16 flags, + const struct anchor_list * list, + const INT16 tag +){ + mapthing_t ** anchors = find_closest_anchors(sector, list, tag); + + if (anchors != NULL) + { + (*slope) = new_vertex_slope(anchors, flags); + sector->hasslope = true; + } +} + static void make_anchored_slope ( @@ -384,7 +403,6 @@ make_anchored_slope const int side = ( flags & ML_NOCLIMB ) != 0; sector_t * sector; - mapthing_t ** anchors; if (side == 0 || flags & ML_TWOSIDED) { @@ -392,17 +410,15 @@ make_anchored_slope if (plane & FLOOR) { - anchors = find_closest_anchors(sector, &floor_anchors); - sector->f_slope = new_vertex_slope(anchors, flags); + slope_sector + (§or->f_slope, sector, flags, &floor_anchors, line->tag); } if (plane & CEILING) { - anchors = find_closest_anchors(sector, &ceiling_anchors); - sector->c_slope = new_vertex_slope(anchors, flags); + slope_sector + (§or->c_slope, sector, flags, &ceiling_anchors, line->tag); } - - sector->hasslope = true; } }