1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-11-21 20:29:59 +01:00

Fix offset bug

This commit is contained in:
Miloslav Číž 2018-08-30 14:22:13 +02:00
parent 4ed686ea81
commit f58e9035da

View file

@ -225,10 +225,9 @@ void castRaySquare(Ray localRay, Vector2D *nextCellOffset,
{\ {\
nextCellOffset->c1 = n;\ nextCellOffset->c1 = n;\
collisionPointOffset->c1 = criticalLine.start.c1 - localRay.start.c1;\ collisionPointOffset->c1 = criticalLine.start.c1 - localRay.start.c1;\
collisionPointOffset->c2 = clamp(\ collisionPointOffset->c2 = \
(collisionPointOffset->c1 * localRay.direction.c2) /\ (((int32_t) collisionPointOffset->c1) * localRay.direction.c2) /\
(localRay.direction.c1 == 0 ? 1 : localRay.direction.c1),\ ((localRay.direction.c1 == 0) ? 1 : localRay.direction.c1);\
0,UNITS_PER_SQUARE - 1);\
} }
#define helper2(n1,n2,c)\ #define helper2(n1,n2,c)\