From f1baf5c69c7452824a21c0034fa2dfc4dc0354b3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 4 Oct 2022 18:49:42 +0200 Subject: [PATCH] - use dot product for getslopeval as well --- source/core/gamefuncs.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index c520054e9..6d5b286bf 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -170,8 +170,7 @@ void getcorrectzsofslope(int sectnum, int dax, int day, double* ceilz, double* f int getslopeval(sectortype* sect, const DVector3& pos, double basez) { auto wal = sect->firstWall(); - auto delta = wal->delta(); - double i = (pos.Y - wal->pos.Y) * delta.X - (pos.X - wal->pos.X) * delta.Y; + double i = (pos.XY() - wal->pos).dot(wal->delta().Rotated90CCW()); return i == 0? 0 : SLOPEVAL_FACTOR * (pos.Z - basez) * wal->Length() / i; }