Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fine tune3 #36

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading