mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-30 17:01:03 +00:00
- use .dot() for calculating slopes
This commit is contained in:
parent
e83d0930bf
commit
02f1f79333
1 changed files with 2 additions and 1 deletions
|
@ -142,7 +142,8 @@ void calcSlope(const sectortype* sec, double xpos, double ypos, double* pceilz,
|
||||||
double len = wal->Length();
|
double len = wal->Length();
|
||||||
if (len != 0)
|
if (len != 0)
|
||||||
{
|
{
|
||||||
double fac = (wal->delta().X * (ypos - wal->pos.Y) - wal->delta().Y * (xpos - wal->pos.X)) / len * (1. / SLOPEVAL_FACTOR);
|
DVector2 wd = DVector2(xpos, ypos) - wal->pos;
|
||||||
|
double fac = wal->delta().dot(wd.Rotated90CW()) / len * (1. / SLOPEVAL_FACTOR);
|
||||||
if (pceilz && sec->ceilingstat & CSTAT_SECTOR_SLOPE) *pceilz += (sec->ceilingheinum * fac);
|
if (pceilz && sec->ceilingstat & CSTAT_SECTOR_SLOPE) *pceilz += (sec->ceilingheinum * fac);
|
||||||
if (pflorz && sec->floorstat & CSTAT_SECTOR_SLOPE) *pflorz += (sec->floorheinum * fac);
|
if (pflorz && sec->floorstat & CSTAT_SECTOR_SLOPE) *pflorz += (sec->floorheinum * fac);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue