X-Git-Url: http://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/9ae835c864d2b3e651a86ac4af7cfac0979f136a..80d0e04b451814c111610e8f977fdf2c84ec2e31:/badge/jumpnrun/tiles.h diff --git a/badge/jumpnrun/tiles.h b/badge/jumpnrun/tiles.h index f0cde4b..3ce7869 100644 --- a/badge/jumpnrun/tiles.h +++ b/badge/jumpnrun/tiles.h @@ -7,12 +7,12 @@ #include -typedef enum { - JUMPNRUN_TILE_TOP = 1, - JUMPNRUN_TILE_BOTTOM = 2, - JUMPNRUN_TILE_LEFT = 4, - JUMPNRUN_TILE_RIGHT = 8 -} jumpnrun_tile_sides; +enum { + JUMPNRUN_COLLISION_TOP = 1, + JUMPNRUN_COLLISION_BOTTOM = 2, + JUMPNRUN_COLLISION_LEFT = 4, + JUMPNRUN_COLLISION_RIGHT = 8 +}; enum { JUMPNRUN_TILE_PIXEL_WIDTH = 5, @@ -39,10 +39,10 @@ typedef struct jumpnrun_tile_range { size_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)); } /************************************/ @@ -53,6 +53,10 @@ enum { JUMPNRUN_TILE_TYPE_TUBE_TOP_RIGHT, JUMPNRUN_TILE_TYPE_TUBE_LEFT, JUMPNRUN_TILE_TYPE_TUBE_RIGHT, + JUMPNRUN_TILE_TYPE_SPIKE_UP, + JUMPNRUN_TILE_TYPE_SPIKE_RIGHT, + JUMPNRUN_TILE_TYPE_SPIKE_DOWN, + JUMPNRUN_TILE_TYPE_SPIKE_LEFT, JUMPNRUN_TILE_TYPE_COUNT };