From f199b13df1350aa864a9104616f0d9b82606b4ed Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Sat, 11 May 2024 16:26:51 +0200 Subject: Finish map input --- src/tilemap.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/tilemap.c') diff --git a/src/tilemap.c b/src/tilemap.c index 45d9fa5..ef830c7 100644 --- a/src/tilemap.c +++ b/src/tilemap.c @@ -6,11 +6,12 @@ /* By: dkaiser tiles[l * tilemap->grid_size.x + x] = line[x]; - else + if (line[pos.x] != '0' && line[pos.x] != '1' && line[pos.x] != 'C' + && line[pos.x] != 'P' && line[pos.x] != 'E') return (1); - line++; + if (line[pos.x] == PLAYER_START && !found_player_start) + { + tilemap->player_start_tile = pos; + found_player_start = 1; + } + else if (line[pos.x] == EXIT && !found_exit) + { + tilemap->exit_tile = pos; + found_exit = 1; + } + tilemap->tiles[l * tilemap->grid_size.x + pos.x] = line[pos.x]; + pos.x++; } return (0); } -- cgit v1.2.3