Skip to content

Commit

Permalink
Merge branch 'main' into Fine_tune3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsunghao-C committed Sep 4, 2024
2 parents e2a7bcc + 1e644e3 commit 6d51bfa
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 14 deletions.
3 changes: 2 additions & 1 deletion includes/cub3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: tsuchen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/15 00:19:44 by tsuchen #+# #+# */
/* Updated: 2024/09/04 13:50:33 by tsuchen ### ########.fr */
/* Updated: 2024/09/04 13:57:10 by tsuchen ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -140,6 +140,7 @@ typedef struct s_data
} t_data;

int cleanup(t_data *data);
void cleanup_textures(t_textdata *textures, void *mlx);
int game_init(t_data *data);
int key_events(int keycode, t_data *data);
int mouse_move(int x, int y, t_data *data);
Expand Down
14 changes: 7 additions & 7 deletions includes/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* parser.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tsuchen <tsuchen@student.42.fr> +#+ +:+ +#+ */
/* By: jteissie <jteissie@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/15 15:00:57 by jteissie #+# #+# */
/* Updated: 2024/09/03 16:25:54 by tsuchen ### ########.fr */
/* Updated: 2024/09/04 13:29:24 by jteissie ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -29,11 +29,11 @@ typedef enum e_texture

typedef struct s_textdata
{
void *text_img[5];
int tex_h[5];
int tex_w[5];
char *text_paths[5];
char *text_addr[5];
void *text_img[TEXTURES_PATHS];
int tex_h[TEXTURES_PATHS];
int tex_w[TEXTURES_PATHS];
char *text_paths[TEXTURES_PATHS];
char *text_addr[TEXTURES_PATHS];
int floor;
int ceiling;
int textures_nb;
Expand Down
17 changes: 17 additions & 0 deletions maps/bad_maps/start_on_edge.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
NO ./assets/made_wall_n.xpm
SO ./assets/made_wall_s.xpm
WE ./assets/made_wall_w.xpm
EA ./assets/made_wall_e.xpm
D ./assets/made_door.xpm

F 64, 64, 64
C 182,182,182

1111111
1000001
1000001
100N001
1000001
1111111
1101 000001
111111110011111
6 changes: 3 additions & 3 deletions srcs/cleanup.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
/* ::: :::::::: */
/* cleanup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tsuchen <tsuchen@student.42.fr> +#+ +:+ +#+ */
/* By: jteissie <jteissie@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/27 17:04:32 by jteissie #+# #+# */
/* Updated: 2024/09/03 17:36:22 by tsuchen ### ########.fr */
/* Updated: 2024/09/04 13:17:57 by jteissie ### ########.fr */
/* */
/* ************************************************************************** */

#include "cub3d.h"

static void cleanup_textures(t_textdata *textures, void *mlx)
void cleanup_textures(t_textdata *textures, void *mlx)
{
if (textures->text_img[N])
mlx_destroy_image(mlx, textures->text_img[N]);
Expand Down
2 changes: 1 addition & 1 deletion srcs/parser/get_textures_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: tsuchen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/28 17:29:47 by jteissie #+# #+# */
/* Updated: 2024/09/04 13:49:02 by tsuchen ### ########.fr */
/* Updated: 2024/09/04 13:59:11 by tsuchen ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
5 changes: 3 additions & 2 deletions srcs/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: jteissie <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/15 12:12:00 by tsuchen #+# #+# */
/* Updated: 2024/09/02 14:37:40 by jteissie ### ########.fr */
/* Updated: 2024/09/04 13:18:57 by jteissie ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -102,10 +102,11 @@ int parse_map(t_data *data)
data->map = build_map(data, line);
close(data->map_fd);
if (!data->map)
return (PANIC);
return (cleanup_textures(data->textures, data->mlx), PANIC);
if (verify_map(data->map, data) == MAP_ERR)
{
ft_putstr_fd("Error\n", STDERR_FILENO);
cleanup_textures(data->textures, data->mlx);
return (ft_free_all(data->map), PANIC);
}
return (SUCCESS);
Expand Down

0 comments on commit 6d51bfa

Please sign in to comment.