From 1436b17c30145c20b2c96da3373092252771d16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Wed, 12 Sep 2018 12:47:16 +0200 Subject: [PATCH] Add lift --- testSDL.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testSDL.c b/testSDL.c index dff9094..d5509f5 100644 --- a/testSDL.c +++ b/testSDL.c @@ -41,6 +41,8 @@ int keys[KEYS]; +unsigned long frame = 0; + Unit zBuffer[SCREEN_WIDTH]; ///< 1D z-buffer for visibility determination. Camera camera; @@ -753,6 +755,9 @@ Unit textureAt(int16_t x, int16_t y) Unit floorHeightAt(int16_t x, int16_t y) { + if (x == 6 && (y == 13 || y == 14)) // moving lift + return ((absVal(-1 * (frame % 64) + 32)) * UNITS_PER_SQUARE) / 8; + if (x >= 0 && x < LEVEL_X_RES && y >= 0 && y < LEVEL_Y_RES) return (levelFloor[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x] * UNITS_PER_SQUARE) / 8; @@ -1022,6 +1027,8 @@ int main() SDL_RenderClear(renderer); SDL_RenderCopy(renderer,texture,NULL,NULL); SDL_RenderPresent(renderer); + + frame++; } return 0;