/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* parse_map_sprites.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: qmennen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/06/10 15:45:12 by qmennen #+# #+# */ /* Updated: 2025/06/10 15:47:07 by qmennen ### ########.fr */ /* */ /* ************************************************************************** */ #include "cub3d.h" int count_sprites(char *line) { int count; int i; count = 0; i = 0; while (line[i]) { if (line[i] >= 'a' && line[i] <= 'z') count++; i++; } return (count); } int parse_map_line_sprites(char *line, t_game *game, int y) { int x; t_map *map; t_sprite_lib *sprite_lib; map = game->map; sprite_lib = map->sprite_lib; x = 0; while (line[x]) { if (line[x] >= 'a' && line[x] <= 'z') { if (sprite_lib[line[x] - 'a'].texture == NULL) { ft_putstr_fd("Error: Undefined sprite symbol\n", 2); return (FAILURE); } map->sprites[map->n_sprites] = make_sprite( &sprite_lib[line[x] - 'a'], (double)x + 0.5f, (double)y + 0.5f); map->n_sprites++; } x++; } return (SUCCESS); }