diff --git a/Makefile b/Makefile index 0ef8388..337416e 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ RUN_CMD := ./$(NAME) test_maps/valid_tex.cub # CFLAGS += -Wall -Wextra -Werror # CFLAGS += -Wall -Wextra -CFLAGS += -g -fsanitize=address -# CFLAGS += -g +# CFLAGS += -g -fsanitize=address +# # CFLAGS += -g # CFLAGS += -Ofast -flto -march=native LIBFT := libft/build/libft.a diff --git a/src/cub3d.c b/src/cub3d.c index 69bf406..37a5ef2 100644 --- a/src/cub3d.c +++ b/src/cub3d.c @@ -6,7 +6,7 @@ /* By: yzaim +#+ */ /* +#+ */ /* Created: 2024/01/08 15:24:47 by yzaim #+# #+# */ -/* Updated: 2024/02/02 15:42:44 by yesimzaim ######## odam.nl */ +/* Updated: 2024/02/07 12:04:12 by yzaim ######## odam.nl */ /* */ /* ************************************************************************** */ diff --git a/src/game/game.c b/src/game/game.c index dc8e9a6..09f4705 100644 --- a/src/game/game.c +++ b/src/game/game.c @@ -6,7 +6,7 @@ /* By: yzaim +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/08 15:26:51 by yzaim #+# #+# */ -/* Updated: 2024/01/29 12:51:57 by yesimzaim ######## odam.nl */ +/* Updated: 2024/02/07 12:15:51 by yzaim ######## odam.nl */ /* */ /* ************************************************************************** */ diff --git a/src/game/sprite.c b/src/game/sprite.c index 1e1958d..e39be1f 100644 --- a/src/game/sprite.c +++ b/src/game/sprite.c @@ -6,7 +6,7 @@ /* By: jboeve +#+ */ /* +#+ */ /* Created: 2024/01/25 16:01:20 by jboeve #+# #+# */ -/* Updated: 2024/01/29 13:00:59 by yesimzaim ######## odam.nl */ +/* Updated: 2024/02/07 12:48:55 by yzaim ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -58,7 +58,9 @@ void sprite_calculate(t_player *p) } sprite_sort(p->sprite_dist, p->sprite_order, p->meta->attributes.sprite_count); - + + // print_double_array("SPRITE DIST", p->sprite_dist, p->meta->attributes.sprite_count); + i = 0; while (i < p->meta->attributes.sprite_count) { @@ -70,7 +72,7 @@ void sprite_calculate(t_player *p) const t_vec2d transform = {inv_det * (p->direction.y * s_pos.x - p->direction.x * s_pos.y), - inv_det * (-p->cam_plane.y * s_pos.x + p->cam_plane.x * s_pos.y)}; + inv_det * (-(p->cam_plane.y) * s_pos.x + p->cam_plane.x * s_pos.y)}; const int32_t sprite_screen_x = (int32_t)(p->meta->image->width / 2) * (1 + transform.x / transform.y); diff --git a/src/parser/lexer.c b/src/parser/lexer.c index 504d002..e2fe866 100644 --- a/src/parser/lexer.c +++ b/src/parser/lexer.c @@ -6,7 +6,7 @@ /* By: yzaim +#+ */ /* +#+ */ /* Created: 2024/01/08 15:30:18 by yzaim #+# #+# */ -/* Updated: 2024/02/01 16:26:58 by yesimzaim ######## odam.nl */ +/* Updated: 2024/02/07 11:16:09 by yzaim ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -178,6 +178,7 @@ int lexer(t_meta *meta, char *map_file) if (!file) return(EXIT_FAILURE); if (lex(file, &meta->map, &meta->elements)) - return (free_t_flag_list(&meta->elements), EXIT_FAILURE); //also free everything in case of error! + return (free(file), free_t_flag_list(&meta->elements), EXIT_FAILURE); //also free everything in case of error! + free(file); return (EXIT_SUCCESS); } diff --git a/src/set_textures.c b/src/set_textures.c index ca1f231..300ae8b 100644 --- a/src/set_textures.c +++ b/src/set_textures.c @@ -6,7 +6,7 @@ /* By: yzaim +#+ */ /* +#+ */ /* Created: 2024/01/08 15:56:45 by yzaim #+# #+# */ -/* Updated: 2024/01/25 00:29:36 by joppe ######## odam.nl */ +/* Updated: 2024/02/07 12:03:56 by yzaim ######## odam.nl */ /* */ /* ************************************************************************** */ diff --git a/src/utils/free.c b/src/utils/free.c index 10edf1b..2906595 100644 --- a/src/utils/free.c +++ b/src/utils/free.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* :::::::: */ -/* free.c :+: :+: */ +/* free.c :+: :+: */ /* +:+ */ /* By: yzaim +#+ */ /* +#+ */ /* Created: 2024/01/08 15:53:55 by yzaim #+# #+# */ -/* Updated: 2024/01/24 11:22:41 by yzaim ######## odam.nl */ +/* Updated: 2024/02/07 12:04:35 by yzaim ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -19,7 +19,9 @@ void f_tex(t_tex *attr) if (attr->tex_path) free(attr->tex_path); if (attr->tex) + { mlx_delete_texture(attr->tex); + } } static void free_t_tex(t_attr *attributes) @@ -30,6 +32,7 @@ static void free_t_tex(t_attr *attributes) f_tex(&attributes->w); f_tex(&attributes->f); f_tex(&attributes->c); + f_tex(&attributes->c_alt); } void free_t_flag_list(t_flag **list) @@ -67,6 +70,7 @@ void meta_free(t_meta *meta) { free_t_tex(&meta->attributes); free(meta->map.level); - if (meta->attributes.sprites) - free_t_sprites(&meta->attributes.sprites, meta->attributes.sprite_count); + free_t_sprites(&meta->attributes.sprites, meta->attributes.sprite_count); + free(meta->player.sprite_dist); + free(meta->player.sprite_order); }