From c1329c8cf82deb49cf12a67af3349a0b8de30554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Wed, 5 Sep 2018 19:08:22 +0200 Subject: [PATCH] Make ceiling different --- game.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/game.cpp b/game.cpp index f4cf51d..871b332 100644 --- a/game.cpp +++ b/game.cpp @@ -86,11 +86,11 @@ const signed char levelFloor[] = const signed char levelCeiling[] = { - 40,40,40,40,40,40,40,99,99,99,99,99,40,40,40,40,40,40,99,99,99,99,99,99,99,99,99,99,99, - 40,99,99,99,99,99,20,99,99,99,99,99,40,99,99,99,99,40,99,99,99,99,99,99,99,99,99,99,99, - 40,99,99,99,99,99,20,99,99,99,99,99,40,99,99,99,99,40,99,99,99,99,99,99,99,99,99,99,99, - 40,99,99,99,99,99,48,99,99,99,99,99,24,24,24,24,24,40,99,99,99,99,99,99,99,99,99,99,99, - 40,99,48,48,48,48,48,99,99,99,99,99,42,42,42,42,42,99,99,99,99,99,99,99,99,99,99,99,99, + 40,40,40,40,40,40,40,99,99,99,99,36,40,40,40,40,40,36,99,99,99,99,99,99,99,99,99,99,99, + 40,99,99,99,99,99,20,99,99,99,99,36,40,99,99,99,99,36,99,99,99,99,99,99,99,99,99,99,99, + 40,99,99,99,99,99,20,99,99,99,99,36,40,99,99,99,99,36,99,99,99,99,99,99,99,99,99,99,99, + 40,99,99,99,99,99,48,99,99,99,99,36,24,24,24,24,24,36,99,99,99,99,99,99,99,99,99,99,99, + 40,99,48,48,48,48,47,99,99,99,99,36,36,36,36,36,36,36,99,99,99,99,99,99,99,99,99,99,99, 40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99, 40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99, 40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99, @@ -517,11 +517,11 @@ public: Character() { - mCamera.position.x = 961;//UNITS_PER_SQUARE * 1; - mCamera.position.y = 7381;//UNITS_PER_SQUARE * 5; - mCamera.direction = -575;//200; + mCamera.position.x = 27127;//UNITS_PER_SQUARE * 1; + mCamera.position.y = 1361;//UNITS_PER_SQUARE * 5; + mCamera.direction = -3400;//200; mCamera.fovAngle = UNITS_PER_SQUARE / 4; - mCamera.height = UNITS_PER_SQUARE / 2; + mCamera.height = UNITS_PER_SQUARE * 2; mCamera.resolution.x = 110 / SUBSAMPLE; mCamera.resolution.y = 88; } @@ -563,10 +563,8 @@ inline void pixelFunc(PixelInfo pixel) uint8_t c; - Unit depth = pixel.depth - UNITS_PER_SQUARE; - - if (depth < 0) - depth = 0; + Unit depth = pixel.depth - UNITS_PER_SQUARE * 3; + depth = depth > 0 ? depth : 1; int intensity = 7 - (depth * 7) / (UNITS_PER_SQUARE * 5); @@ -585,7 +583,10 @@ inline void pixelFunc(PixelInfo pixel) c = addIntensity(c,intensity - 3); } else - c = rgbToIndex(intensity/2,intensity,intensity/3); + c = pixel.isFloor ? + rgbToIndex(intensity/2,intensity,intensity/3) : + rgbToIndex(intensity,intensity/2,0); + uint8_t *buf = p.display.screenbuffer; @@ -632,9 +633,9 @@ void draw() p.display.setColor(rgbToIndex(7,7,3)); p.display.setCursor(1,1); -p.display.print(divRoundDown(player.mCamera.position.x,UNITS_PER_SQUARE)); +p.display.print(player.mCamera.position.x); p.display.print(" "); -p.display.print(divRoundDown(player.mCamera.position.y,UNITS_PER_SQUARE)); +p.display.print(player.mCamera.position.y); p.display.print(" "); p.display.print(player.mCamera.direction);