diff --git a/src/m_bbox.cpp b/src/m_bbox.cpp index 6d3a5b7443..199da8d68e 100644 --- a/src/m_bbox.cpp +++ b/src/m_bbox.cpp @@ -54,19 +54,8 @@ int FBoundingBox::BoxOnLineSide (const line_t *ld) const int p1; int p2; - switch (ld->slopetype) - { - case ST_HORIZONTAL: - p1 = m_Box[BOXTOP] > ld->v1->y; - p2 = m_Box[BOXBOTTOM] > ld->v1->y; - if (ld->dx < 0) - { - p1 ^= 1; - p2 ^= 1; - } - break; - - case ST_VERTICAL: + if (ld->dx == 0) + { // ST_VERTICAL p1 = m_Box[BOXRIGHT] < ld->v1->x; p2 = m_Box[BOXLEFT] < ld->v1->x; if (ld->dy < 0) @@ -74,18 +63,26 @@ int FBoundingBox::BoxOnLineSide (const line_t *ld) const p1 ^= 1; p2 ^= 1; } - break; - - case ST_POSITIVE: + } + else if (ld->dy == 0) + { // ST_HORIZONTAL: + p1 = m_Box[BOXTOP] > ld->v1->y; + p2 = m_Box[BOXBOTTOM] > ld->v1->y; + if (ld->dx < 0) + { + p1 ^= 1; + p2 ^= 1; + } + } + else if ((ld->dy ^ ld->dx) >= 0) + { // ST_POSITIVE: p1 = P_PointOnLineSide (m_Box[BOXLEFT], m_Box[BOXTOP], ld); p2 = P_PointOnLineSide (m_Box[BOXRIGHT], m_Box[BOXBOTTOM], ld); - break; - - case ST_NEGATIVE: - default: // Just to assure GCC that p1 and p2 really do get initialized + } + else + { // ST_NEGATIVE: p1 = P_PointOnLineSide (m_Box[BOXRIGHT], m_Box[BOXTOP], ld); p2 = P_PointOnLineSide (m_Box[BOXLEFT], m_Box[BOXBOTTOM], ld); - break; } return (p1 == p2) ? p1 : -1; diff --git a/src/p_map.cpp b/src/p_map.cpp index db0c092021..96b2b61955 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -2244,24 +2244,8 @@ void FSlide::HitSlideLine (line_t* ld) slidemo->z <= slidemo->floorz && P_GetFriction (slidemo, NULL) > ORIG_FRICTION; - if (ld->slopetype == ST_HORIZONTAL) - { - if (icyfloor && (abs(tmymove) > abs(tmxmove))) - { - tmxmove /= 2; // absorb half the velocity - tmymove = -tmymove/2; - if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING)) - { - S_Sound (slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff! - } - } - else - tmymove = 0; // no more movement in the Y direction - return; - } - - if (ld->slopetype == ST_VERTICAL) - { + if (ld->dx == 0) + { // ST_VERTICAL if (icyfloor && (abs(tmxmove) > abs(tmymove))) { tmxmove = -tmxmove/2; // absorb half the velocity @@ -2276,6 +2260,22 @@ void FSlide::HitSlideLine (line_t* ld) return; } + if (ld->dy == 0) + { // ST_HORIZONTAL + if (icyfloor && (abs(tmymove) > abs(tmxmove))) + { + tmxmove /= 2; // absorb half the velocity + tmymove = -tmymove/2; + if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING)) + { + S_Sound (slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff! + } + } + else + tmymove = 0; // no more movement in the Y direction + return; + } + // The wall is angled. Bounce if the angle of approach is // phares // less than 45 degrees. // phares diff --git a/src/p_setup.cpp b/src/p_setup.cpp index f84862ef08..a6dbca868f 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1888,13 +1888,6 @@ void P_AdjustLine (line_t *ld) ld->dx = v2->x - v1->x; ld->dy = v2->y - v1->y; - if (ld->dx == 0) - ld->slopetype = ST_VERTICAL; - else if (ld->dy == 0) - ld->slopetype = ST_HORIZONTAL; - else - ld->slopetype = ((ld->dy ^ ld->dx) >= 0) ? ST_POSITIVE : ST_NEGATIVE; - if (v1->x < v2->x) { ld->bbox[BOXLEFT] = v1->x; diff --git a/src/po_man.cpp b/src/po_man.cpp index d844133b08..e19acc53ab 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -950,18 +950,6 @@ void FPolyObj::UpdateBBox () // Update the line's slopetype line->dx = line->v2->x - line->v1->x; line->dy = line->v2->y - line->v1->y; - if (!line->dx) - { - line->slopetype = ST_VERTICAL; - } - else if (!line->dy) - { - line->slopetype = ST_HORIZONTAL; - } - else - { - line->slopetype = ((line->dy ^ line->dx) >= 0) ? ST_POSITIVE : ST_NEGATIVE; - } } CalcCenter(); } diff --git a/src/r_defs.h b/src/r_defs.h index 2e9c0876ba..dd21365087 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -882,18 +882,6 @@ struct side_t FArchive &operator<< (FArchive &arc, side_t::part &p); -// -// Move clipping aid for LineDefs. -// -enum slopetype_t -{ - ST_HORIZONTAL, - ST_VERTICAL, - ST_POSITIVE, - ST_NEGATIVE -}; - - struct line_t { vertex_t *v1, *v2; // vertices, from v1 to v2 @@ -908,7 +896,6 @@ struct line_t side_t *sidedef[2]; //DWORD sidenum[2]; // sidenum[1] will be NO_SIDE if one sided fixed_t bbox[4]; // bounding box, for the extent of the LineDef. - slopetype_t slopetype; // To aid move clipping. sector_t *frontsector, *backsector; int validcount; // if == validcount, already checked int locknumber; // [Dusk] lock number for special