mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 14:22:13 +00:00
Remove slopetype from line_t.
- Recomputing it in the only two places where it's used is trivial, so it's basically a waste of space to precompute it.
This commit is contained in:
parent
e55e7b9a38
commit
4cf468452c
5 changed files with 36 additions and 71 deletions
|
@ -54,19 +54,8 @@ int FBoundingBox::BoxOnLineSide (const line_t *ld) const
|
||||||
int p1;
|
int p1;
|
||||||
int p2;
|
int p2;
|
||||||
|
|
||||||
switch (ld->slopetype)
|
if (ld->dx == 0)
|
||||||
{
|
{ // ST_VERTICAL
|
||||||
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:
|
|
||||||
p1 = m_Box[BOXRIGHT] < ld->v1->x;
|
p1 = m_Box[BOXRIGHT] < ld->v1->x;
|
||||||
p2 = m_Box[BOXLEFT] < ld->v1->x;
|
p2 = m_Box[BOXLEFT] < ld->v1->x;
|
||||||
if (ld->dy < 0)
|
if (ld->dy < 0)
|
||||||
|
@ -74,18 +63,26 @@ int FBoundingBox::BoxOnLineSide (const line_t *ld) const
|
||||||
p1 ^= 1;
|
p1 ^= 1;
|
||||||
p2 ^= 1;
|
p2 ^= 1;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
else if (ld->dy == 0)
|
||||||
case ST_POSITIVE:
|
{ // 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);
|
p1 = P_PointOnLineSide (m_Box[BOXLEFT], m_Box[BOXTOP], ld);
|
||||||
p2 = P_PointOnLineSide (m_Box[BOXRIGHT], m_Box[BOXBOTTOM], ld);
|
p2 = P_PointOnLineSide (m_Box[BOXRIGHT], m_Box[BOXBOTTOM], ld);
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
case ST_NEGATIVE:
|
{ // ST_NEGATIVE:
|
||||||
default: // Just to assure GCC that p1 and p2 really do get initialized
|
|
||||||
p1 = P_PointOnLineSide (m_Box[BOXRIGHT], m_Box[BOXTOP], ld);
|
p1 = P_PointOnLineSide (m_Box[BOXRIGHT], m_Box[BOXTOP], ld);
|
||||||
p2 = P_PointOnLineSide (m_Box[BOXLEFT], m_Box[BOXBOTTOM], ld);
|
p2 = P_PointOnLineSide (m_Box[BOXLEFT], m_Box[BOXBOTTOM], ld);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (p1 == p2) ? p1 : -1;
|
return (p1 == p2) ? p1 : -1;
|
||||||
|
|
|
@ -2244,24 +2244,8 @@ void FSlide::HitSlideLine (line_t* ld)
|
||||||
slidemo->z <= slidemo->floorz &&
|
slidemo->z <= slidemo->floorz &&
|
||||||
P_GetFriction (slidemo, NULL) > ORIG_FRICTION;
|
P_GetFriction (slidemo, NULL) > ORIG_FRICTION;
|
||||||
|
|
||||||
if (ld->slopetype == ST_HORIZONTAL)
|
if (ld->dx == 0)
|
||||||
{
|
{ // ST_VERTICAL
|
||||||
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 (icyfloor && (abs(tmxmove) > abs(tmymove)))
|
if (icyfloor && (abs(tmxmove) > abs(tmymove)))
|
||||||
{
|
{
|
||||||
tmxmove = -tmxmove/2; // absorb half the velocity
|
tmxmove = -tmxmove/2; // absorb half the velocity
|
||||||
|
@ -2276,6 +2260,22 @@ void FSlide::HitSlideLine (line_t* ld)
|
||||||
return;
|
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
|
// The wall is angled. Bounce if the angle of approach is // phares
|
||||||
// less than 45 degrees. // phares
|
// less than 45 degrees. // phares
|
||||||
|
|
||||||
|
|
|
@ -1888,13 +1888,6 @@ void P_AdjustLine (line_t *ld)
|
||||||
ld->dx = v2->x - v1->x;
|
ld->dx = v2->x - v1->x;
|
||||||
ld->dy = v2->y - v1->y;
|
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)
|
if (v1->x < v2->x)
|
||||||
{
|
{
|
||||||
ld->bbox[BOXLEFT] = v1->x;
|
ld->bbox[BOXLEFT] = v1->x;
|
||||||
|
|
|
@ -950,18 +950,6 @@ void FPolyObj::UpdateBBox ()
|
||||||
// Update the line's slopetype
|
// Update the line's slopetype
|
||||||
line->dx = line->v2->x - line->v1->x;
|
line->dx = line->v2->x - line->v1->x;
|
||||||
line->dy = line->v2->y - line->v1->y;
|
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();
|
CalcCenter();
|
||||||
}
|
}
|
||||||
|
|
13
src/r_defs.h
13
src/r_defs.h
|
@ -882,18 +882,6 @@ struct side_t
|
||||||
|
|
||||||
FArchive &operator<< (FArchive &arc, side_t::part &p);
|
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
|
struct line_t
|
||||||
{
|
{
|
||||||
vertex_t *v1, *v2; // vertices, from v1 to v2
|
vertex_t *v1, *v2; // vertices, from v1 to v2
|
||||||
|
@ -908,7 +896,6 @@ struct line_t
|
||||||
side_t *sidedef[2];
|
side_t *sidedef[2];
|
||||||
//DWORD sidenum[2]; // sidenum[1] will be NO_SIDE if one sided
|
//DWORD sidenum[2]; // sidenum[1] will be NO_SIDE if one sided
|
||||||
fixed_t bbox[4]; // bounding box, for the extent of the LineDef.
|
fixed_t bbox[4]; // bounding box, for the extent of the LineDef.
|
||||||
slopetype_t slopetype; // To aid move clipping.
|
|
||||||
sector_t *frontsector, *backsector;
|
sector_t *frontsector, *backsector;
|
||||||
int validcount; // if == validcount, already checked
|
int validcount; // if == validcount, already checked
|
||||||
int locknumber; // [Dusk] lock number for special
|
int locknumber; // [Dusk] lock number for special
|
||||||
|
|
Loading…
Reference in a new issue