From a8b2a06aa2a1956347d992cbddd12925fa4b31fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 8 Sep 2018 07:09:46 +0200 Subject: [PATCH] Rework shear --- game.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/game.cpp b/game.cpp index c967b26..50f9be2 100644 --- a/game.cpp +++ b/game.cpp @@ -685,6 +685,7 @@ public: mCamera.height = UNITS_PER_SQUARE * 3; mCamera.resolution.x = 110 / SUBSAMPLE; mCamera.resolution.y = 88; + mCamera.shear = 0; mCamera.collisionRadius = UNITS_PER_SQUARE / 4; mCamera.collisionHeightBelow = UNITS_PER_SQUARE; @@ -767,8 +768,6 @@ inline void pixelFunc(PixelInfo pixel) unsigned short pal[256]; -Unit shear = 0; - void draw() { RayConstraints c; @@ -777,7 +776,7 @@ void draw() c.maxSteps = 10; c.computeTextureCoords = 1; - render(player.mCamera,floorHeightAt,ceilingHeightAt,textureAt,pixelFunc,c,shear); + render(player.mCamera,floorHeightAt,ceilingHeightAt,textureAt,pixelFunc,c); Unit previousDepth; @@ -877,7 +876,7 @@ int main() if (strafe) heightOffset = step; else if (lookUpDown) - shear = min(shear + 100, 2 * UNITS_PER_SQUARE); + player.mCamera.shear = min(player.mCamera.shear + 10,60); else moveOffset = d; } @@ -886,16 +885,18 @@ int main() if (strafe) heightOffset = -step; else if (lookUpDown) - shear = max(shear - 100, -2 * UNITS_PER_SQUARE); + player.mCamera.shear = max(player.mCamera.shear - 10,-60); else { moveOffset.x = -1 * d.x; moveOffset.y = -1 * d.y; } } - - if (!lookUpDown) - shear = shear / 2; + else + player.mCamera.shear /= 2; + + if (!lookUpDown) + player.mCamera.shear /= 2; int addition = 0;