Tutorial-Level.
[hackover2013-badge-firmware.git] / badge / jumpnrun / tiles.h
index a6a5f70..8e47800 100644 (file)
@@ -22,7 +22,7 @@ enum {
 typedef struct jumpnrun_tile_position {
   int16_t x;
   int8_t  y;
-} jumpnrun_tile_position;
+} __attribute__((packed)) jumpnrun_tile_position;
 
 typedef struct jumpnrun_tile_type {
   uint8_t      lethal_sides;
@@ -32,17 +32,17 @@ typedef struct jumpnrun_tile_type {
 typedef struct jumpnrun_tile {
   jumpnrun_tile_position pos;
   uint8_t                type;
-} jumpnrun_tile;
+} __attribute__((packed)) jumpnrun_tile;
 
 typedef struct jumpnrun_tile_range {
-  size_t first;
-  size_t last; // actually one past last.
+  uint16_t first;
+  uint16_t last; // actually one past last.
 } jumpnrun_tile_range;
 
-static inline fixed_point tile_left  (jumpnrun_tile const *tile) { return FIXED_POINT(tile->pos.x * JUMPNRUN_TILE_PIXEL_WIDTH , 0); }
-static inline fixed_point tile_top   (jumpnrun_tile const *tile) { return FIXED_POINT(tile->pos.y * JUMPNRUN_TILE_PIXEL_HEIGHT, 0); }
-static inline fixed_point tile_right (jumpnrun_tile const *tile) { return fixed_point_add(tile_left(tile), FIXED_POINT(JUMPNRUN_TILE_PIXEL_WIDTH , 0)); }
-static inline fixed_point tile_bottom(jumpnrun_tile const *tile) { return fixed_point_add(tile_top (tile), FIXED_POINT(JUMPNRUN_TILE_PIXEL_HEIGHT, 0)); }
+static inline fixed_point tile_left  (jumpnrun_tile const *tile) { return FIXED_INT(tile->pos.x * JUMPNRUN_TILE_PIXEL_WIDTH ); }
+static inline fixed_point tile_top   (jumpnrun_tile const *tile) { return FIXED_INT(tile->pos.y * JUMPNRUN_TILE_PIXEL_HEIGHT); }
+static inline fixed_point tile_right (jumpnrun_tile const *tile) { return fixed_point_add(tile_left(tile), FIXED_INT(JUMPNRUN_TILE_PIXEL_WIDTH )); }
+static inline fixed_point tile_bottom(jumpnrun_tile const *tile) { return fixed_point_add(tile_top (tile), FIXED_INT(JUMPNRUN_TILE_PIXEL_HEIGHT)); }
 
 /************************************/
 
This page took 0.024024 seconds and 4 git commands to generate.