shithub: cstory

Download patch

ref: 58a02a609cbb96dc11f5f31943b558e7adf3ce3b
parent: 04113870a5e6c1e196a1dfa4f42c02909631a820
author: Gabriel Ravier <gabravier@gmail.com>
date: Sun Sep 15 11:58:04 EDT 2019

Defined TILES_TO_UNITS and UNITS_TO_TILES in terms of TILES_TO_PIXELS, PIXELS_TO_TILES, PIXELS_TO_UNITS and UNITS_TO_PIXELS

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>

--- a/src/CommonDefines.h
+++ b/src/CommonDefines.h
@@ -3,12 +3,13 @@
 #define WINDOW_WIDTH 320
 #define WINDOW_HEIGHT 240
 
-#define TILES_TO_UNITS(x) ((x) * 0x2000)
-#define UNITS_TO_TILES(x) ((x) / 0x2000)
 #define TILES_TO_PIXELS(x) ((x) * 0x10)
 #define PIXELS_TO_TILES(x) ((x) / 0x10)
 #define PIXELS_TO_UNITS(x) ((x) * 0x200)
 #define UNITS_TO_PIXELS(x) ((x) / 0x200)
+#define TILES_TO_UNITS(x) (PIXELS_TO_UNITS(TILES_TO_PIXELS(x)))	// * 0x2000
+#define UNITS_TO_TILES(x) (PIXELS_TO_TILES(UNITS_TO_PIXELS(x)))	// / 0x2000
+
 #define SECONDS_TO_FRAMES(x) ((x) * 50)
 #define FRAMES_TO_SECONDS(x) ((x) / 50)