From 05f8086400f7675b12992448de157760bf250884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 15 Sep 2018 12:01:38 +0200 Subject: [PATCH] Improve door --- demo2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/demo2.cpp b/demo2.cpp index 83ca4b7..1f8b4ea 100644 --- a/demo2.cpp +++ b/demo2.cpp @@ -39,6 +39,10 @@ memory and turning can be less precise (can be seen a lot with 64 item LUT). */ +#define DOOR_ROLL_SIGN -1 + /* ^ Defines how the door roll: -1 opens the door to the left, 1 to the + right, 0 to both. */ + #define FPS 60 #define HEAD_BOB_HEIGHT 200 #define HEAD_BOB_STEP 20 @@ -902,7 +906,7 @@ Unit rollAt(int16_t x, int16_t y) if (x >= 0 && x < LEVEL_X_RES && y >= 0 && y < LEVEL_Y_RES && level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x] == 6) - return (pokitto.frameCount * 10) % UNITS_PER_SQUARE; + return sinInt(pokitto.frameCount * 10) + DOOR_ROLL_SIGN * UNITS_PER_SQUARE; return 0; }