a-game

2D platformer written from scratch.
git clone git://git.amin.space/a-game.git
Log | Files | Refs | README | LICENSE

commit 20ad9e642e3cd76e8ba45cc6d4939dcea77be9f7
parent a05dabc83199550810933de7c46033b1ab00534a
Author: amin <dev@aminmesbah.com>
Date:   Tue, 16 Jul 2019 02:43:03 +0000

Render different rooms at different color offsets

FossilOrigin-Name: 9e7bfd29b7786a894dcb9f6f21e3411cffb1a013fb8b71a596246506c267d763
Diffstat:
Msrc/game.c | 4++++
Msrc/world.h | 1+
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/game.c b/src/game.c @@ -119,6 +119,7 @@ internal void game_init(struct GameMemory *game_memory, v2u framebuffer) 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, }, + .tileset_offset = 0, }; struct Room collision_test_zone = { @@ -135,6 +136,7 @@ internal void game_init(struct GameMemory *game_memory, v2u framebuffer) 0, 37, 0, 38, 39, 3, 3, 3, 3, 3, 3, 4, 0, 2, 3, 3, 3, 3, 3, 3, 39, 40, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, + .tileset_offset = 8, }; i32 s = -3; @@ -168,6 +170,7 @@ internal void game_init(struct GameMemory *game_memory, v2u framebuffer) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, + .tileset_offset = 4, }; world_room_set(game_state->world, r, &game_state->world_allocator); } @@ -605,6 +608,7 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga tile_id = get_tile_value(current_room->tiles, tile_pos); assert(tile_id > 0); tile_id -= 1; + tile_id += current_room->tileset_offset; } else { diff --git a/src/world.h b/src/world.h @@ -26,6 +26,7 @@ static_assert( struct Room { v2i index; + u8 tileset_offset; u8 tiles[ROOM_TILE_COUNT]; };