Skip to content

Commit

Permalink
Merge pull request #36 from Haliris/Fine_tune3
Browse files Browse the repository at this point in the history
Fine tune3
  • Loading branch information
Haliris authored Sep 4, 2024
2 parents 1e644e3 + 6d51bfa commit 74e2f22
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 1,800 deletions.
434 changes: 0 additions & 434 deletions assets/door_frame/Kat_1.xpm

This file was deleted.

454 changes: 0 additions & 454 deletions assets/door_frame/Kat_2.xpm

This file was deleted.

454 changes: 0 additions & 454 deletions assets/door_frame/Kat_3.xpm

This file was deleted.

445 changes: 0 additions & 445 deletions assets/door_frame/Kat_4.xpm

This file was deleted.

4 changes: 0 additions & 4 deletions assets/door_frame/door_frame.txt

This file was deleted.

5 changes: 3 additions & 2 deletions includes/cub3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* cub3d.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jteissie <jteissie@student.42.fr> +#+ +:+ +#+ */
/* By: tsuchen <tsuchen@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/15 00:19:44 by tsuchen #+# #+# */
/* Updated: 2024/09/04 13:18:12 by jteissie ### ########.fr */
/* Updated: 2024/09/04 13:57:10 by tsuchen ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -59,6 +59,7 @@
# define MOUSE_PRESS 4
# define MOUSE_MOVE 6
# define FILE_EXTENSION ".cub"
# define FRAME_SCRIPT "./assets/animations/door_frame.txt"

typedef enum e_texture t_texture;
typedef struct s_textdata t_textdata;
Expand Down
12 changes: 7 additions & 5 deletions srcs/game_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: tsuchen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/27 17:03:43 by jteissie #+# #+# */
/* Updated: 2024/09/03 18:58:48 by tsuchen ### ########.fr */
/* Updated: 2024/09/04 13:36:40 by tsuchen ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -31,8 +31,10 @@ static int init_frame(char *line, t_data *data, t_frame *f)

path = ft_strtrim(line, "\n");
if (!path)
return (1);
return (PANIC);
f->img = mlx_xpm_file_to_image(data->mlx, path, &f->frm_w, &f->frm_h);
if (!f->img)
return (free(path), PANIC);
f->addr = mlx_get_data_addr(f->img, &f->bpp, &f->ll, &f->endian);
lst_add_back(&data->frames, f);
free(path);
Expand All @@ -45,9 +47,9 @@ static int load_frames(t_data *data)
int frame_fd;
char *line;

frame_fd = open("./assets/animations/door_frame.txt", O_RDONLY);
frame_fd = open(FRAME_SCRIPT, O_RDONLY);
if (frame_fd == -1)
return (SUCCESS);
return (PANIC);
line = get_next_line(frame_fd);
if (!line)
return (PANIC);
Expand All @@ -57,7 +59,7 @@ static int load_frames(t_data *data)
if (!f)
return (close(frame_fd), PANIC);
if (init_frame(line, data, f))
return (free(line), close(frame_fd), PANIC);
return (free(line), close(frame_fd), free(f), PANIC);
free(line);
line = get_next_line(frame_fd);
}
Expand Down
4 changes: 2 additions & 2 deletions srcs/parser/get_textures_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* get_textures_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jteissie <jteissie@student.42.fr> +#+ +:+ +#+ */
/* By: tsuchen <tsuchen@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/28 17:29:47 by jteissie #+# #+# */
/* Updated: 2024/09/04 13:29:06 by jteissie ### ########.fr */
/* Updated: 2024/09/04 13:59:11 by tsuchen ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down

0 comments on commit 74e2f22

Please sign in to comment.