/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   parser.h                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: qmennen <qmennen@student.codam.nl>         +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2025/04/19 14:41:55 by whaffman          #+#    #+#             */
/*   Updated: 2025/06/03 15:49:59 by qmennen          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef PARSER_H
# define PARSER_H
# include "cub3d.h"
# include "libft.h"

size_t			count_chars(const char *str, char c);
ssize_t			get_file_size(const char *filename);
char			*read_map_file(const char *filename);
int				is_map_line(const char *line);
unsigned int	parse_color(const char *color_str);
int				parse_config_line(char *line, t_map *map);
int				map_width(char **lines);
int				parse_tile(char c);
int				parse_map(char **lines, t_game *game);
int				parse_file(char *buffer, t_game *game);
void			print_config(t_map *map);
int				parse_map_line(char **lines, t_game *game, int i);
t_tile			**copy_map(t_tile **grid, int width, int height);
char			**pointer_lines(char *buffer, char c);
int				valid_arguments(int argc, char **argv);
int 			map_entries_present(t_game *game);
int				handle_wall(char *token, t_map *map);
int				handle_fc_color(char *token, t_map *map);
int				handle_fc_texture(char *token, t_map *map);
int				handle_sprite(char *token, t_map *map);
mlx_texture_t	*load_texture(const char *path);
int				map_create(t_game **game, const char *mapfile);
void			map_free(t_map *map);
void			print_map(t_map *map);
t_tile			get_tile(t_map *map, int x, int y);
int				enclosed_map(t_map *map);
void			grid_free(t_tile **grid, int height);
t_tile			**copy_map(t_tile **grid, int width, int height);
int				parse_args(const char *mapfile, t_game *game);
t_tile			**create_grid(int width, int height);
int				find_player_or_empty(t_map *map, int *x, int *y);
int				floodfill(t_map *map, int x, int y);
t_sprite		make_sprite(t_sprite_lib *def, double x, double y);

#endif