mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-12 14:55:36 +00:00
- minor slope math optimization.
May save one division and merges the '<< 5' into the main calculation.
This commit is contained in:
parent
11f41a97d5
commit
24a6d45f97
2 changed files with 4 additions and 4 deletions
|
@ -170,9 +170,9 @@ void calcSlope(const sectortype* sec, float xpos, float ypos, float* pceilz, flo
|
||||||
int len = wal->Length();
|
int len = wal->Length();
|
||||||
if (len != 0)
|
if (len != 0)
|
||||||
{
|
{
|
||||||
float den = (wal->deltax() * (float(ypos - wal->y)) - wal->deltay() * (float(xpos - wal->x))) * (1.f / 8.f);
|
float fac = (wal->deltax() * (float(ypos - wal->y)) - wal->deltay() * (float(xpos - wal->x))) * (1.f / 256.f) / len;
|
||||||
if (pceilz && sec->ceilingstat & CSTAT_SECTOR_SLOPE) *pceilz += (sec->ceilingheinum * den) / len;
|
if (pceilz && sec->ceilingstat & CSTAT_SECTOR_SLOPE) *pceilz += (sec->ceilingheinum * fac);
|
||||||
if (pflorz && sec->floorstat & CSTAT_SECTOR_SLOPE) *pflorz += (sec->floorheinum * den) / len;
|
if (pflorz && sec->floorstat & CSTAT_SECTOR_SLOPE) *pflorz += (sec->floorheinum * fac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ void walltype::calcLength()
|
||||||
lengthflags &= ~1;
|
lengthflags &= ~1;
|
||||||
point2Wall()->lengthflags &= ~2;
|
point2Wall()->lengthflags &= ~2;
|
||||||
auto d = delta();
|
auto d = delta();
|
||||||
length = (int)sqrt(d.x * d.x + d.y * d.y) << 5;
|
length = (int)sqrt(d.x * d.x + d.y * d.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// needed for skipping over to get the map size first.
|
// needed for skipping over to get the map size first.
|
||||||
|
|
Loading…
Reference in a new issue