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

Fix steps

This commit is contained in:
Miloslav Číž 2018-09-08 11:11:43 +02:00
parent 519de2a17b
commit 32ddbca34c

View file

@ -1006,9 +1006,6 @@ void moveCameraWithCollision(Camera *camera, Vector2D planeOffset,
int16_t xSquare = divRoundDown(corner.x,UNITS_PER_SQUARE); int16_t xSquare = divRoundDown(corner.x,UNITS_PER_SQUARE);
int16_t ySquare = divRoundDown(corner.y,UNITS_PER_SQUARE); int16_t ySquare = divRoundDown(corner.y,UNITS_PER_SQUARE);
int8_t isOnGround = camera->height - CAMERA_COLL_HEIGHT_BELOW -
floorHeightFunc(xSquareNew,ySquareNew) < 2;
cornerNew.x = corner.x + planeOffset.x; cornerNew.x = corner.x + planeOffset.x;
cornerNew.y = corner.y + planeOffset.y; cornerNew.y = corner.y + planeOffset.y;
@ -1016,7 +1013,7 @@ void moveCameraWithCollision(Camera *camera, Vector2D planeOffset,
ySquareNew = divRoundDown(cornerNew.y,UNITS_PER_SQUARE); ySquareNew = divRoundDown(cornerNew.y,UNITS_PER_SQUARE);
Unit bottomLimit = camera->height - CAMERA_COLL_HEIGHT_BELOW + Unit bottomLimit = camera->height - CAMERA_COLL_HEIGHT_BELOW +
(isOnGround ? CAMERA_COLL_STEP_HEIGHT : 0); CAMERA_COLL_STEP_HEIGHT;
Unit topLimit = camera->height + CAMERA_COLL_HEIGHT_ABOVE; Unit topLimit = camera->height + CAMERA_COLL_HEIGHT_ABOVE;
// checks a single square for collision against the camera // checks a single square for collision against the camera