diff --git a/demo2.cpp b/demo2.cpp index 8f15cf9..91fcfd7 100644 --- a/demo2.cpp +++ b/demo2.cpp @@ -22,7 +22,8 @@ //#define RENDER_PRECISE /* ^ Turns on rendering using a more precise but slower algorithm. This can - be seen at less shaky head bobbing when moving. */ + be seen at less shaky head bobbing when moving. However the latter + algorithm doesn't support rolling doors (these will be turned off). */ //#define NO_TEXTURES /* ^ Turns off textures and only uses colors, which increases FPS. */ @@ -767,11 +768,13 @@ unsigned char textureAverageColors[TEXTURES]; Unit floorHeightAt(int16_t x, int16_t y) { - if (x >= 0 && x < LEVEL_X_RES && y >= 0 && y < LEVEL_Y_RES) - return level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x] == 0 ? - 0 : UNITS_PER_SQUARE * 2; + Unit square = level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x]; - return UNITS_PER_SQUARE * 2; +#ifdef RENDER_PRECISE + return square == 0 || square == 6 ? 0 : UNITS_PER_SQUARE * 2; +#else + return square == 0 ? 0 : UNITS_PER_SQUARE * 2; +#endif } Unit collisionAt(int16_t x, int16_t y)