From 8866ef5699150d0549096efa94fc311ff7a48dc7 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 3 Mar 2020 14:47:33 +0100 Subject: Changing stuff --- src/ft_warp_level.c | 88 ++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'src/ft_warp_level.c') diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c index de87187..a50ff65 100644 --- a/src/ft_warp_level.c +++ b/src/ft_warp_level.c @@ -21,17 +21,17 @@ static void ft_del_map(t_map *ml) { - ft_memdel((void**)&ml->no_tex_path); - ft_memdel((void**)&ml->so_tex_path); - ft_memdel((void**)&ml->ea_tex_path); - ft_memdel((void**)&ml->we_tex_path); - ft_memdel((void**)&ml->sprite_path); - ft_memdel((void**)&ml->nl_tex_path); - ft_memdel((void**)&ml->nlevel_path); - ft_memdel((void**)&ml->music_path); - ft_memdel((void**)&ml->music_cmd); - ft_memdel((void**)&ml->mapl); - ft_free_words(ml->map); + ft_memdel((void**)&ml.no_tex_path); + ft_memdel((void**)&ml.so_tex_path); + ft_memdel((void**)&ml.ea_tex_path); + ft_memdel((void**)&ml.we_tex_path); + ft_memdel((void**)&ml.sprite_path); + ft_memdel((void**)&ml.nl_tex_path); + ft_memdel((void**)&ml.nlevel_path); + ft_memdel((void**)&ml.music_path); + ft_memdel((void**)&ml.music_cmd); + ft_memdel((void**)&ml.mapl); + ft_free_words(ml.map); ft_memdel((void**)&ml); } @@ -40,23 +40,23 @@ static void { uint8_t i; - cl->plist->pos_x = 0; - cl->plist->pos_y = 0; - cl->plist->start_x = 0; - cl->plist->start_y = 0; - cl->plist->cam_x = 0; - cl->plist->dir_x = -1; - cl->plist->dir_y = 0; - cl->plist->plane_x = 0; - cl->plist->plane_y = 0.66666666; - cl->f_rgb = ft_init_rgb(); - cl->c_rgb = ft_init_rgb(); - cl->rlist = ft_init_s_ray(); + cl.plist.pos_x = 0; + cl.plist.pos_y = 0; + cl.plist.start_x = 0; + cl.plist.start_y = 0; + cl.plist.cam_x = 0; + cl.plist.dir_x = -1; + cl.plist.dir_y = 0; + cl.plist.plane_x = 0; + cl.plist.plane_y = 0.66666666; + cl.f_rgb = ft_init_rgb(); + cl.c_rgb = ft_init_rgb(); + cl.rlist = ft_init_s_ray(); i = 0; while (i <= 5) { - mlx_destroy_image(cl->wlist->wlx, cl->tlist[i].img); - cl->tlist[i].img = NULL; + mlx_destroy_image(cl.wlist.wlx, cl.tlist[i].img); + cl.tlist[i].img = NULL; i++; } } @@ -64,21 +64,21 @@ static void static void ft_treat_music(uint8_t isoldmus, char *tmp_mup, t_cub *cl) { - if (isoldmus && !cl->mlist->ismusic) + if (isoldmus && !cl.mlist.ismusic) { - pthread_cancel(cl->tid); - pthread_join(cl->tid, NULL); - cl->isoldmus = 0; + pthread_cancel(cl.tid); + pthread_join(cl.tid, NULL); + cl.isoldmus = 0; } - else if (isoldmus && cl->mlist->ismusic - && ft_strncmp(tmp_mup, cl->mlist->music_path, ft_strlen(tmp_mup) + 1)) + else if (isoldmus && cl.mlist.ismusic + && ft_strncmp(tmp_mup, cl.mlist.music_path, ft_strlen(tmp_mup) + 1)) { - pthread_cancel(cl->tid); - pthread_join(cl->tid, NULL); - pthread_create(&cl->tid, NULL, ft_music_thread, cl); + pthread_cancel(cl.tid); + pthread_join(cl.tid, NULL); + pthread_create(&cl.tid, NULL, ft_music_thread, cl); } - else if (isoldmus && cl->mlist->ismusic - && !ft_strncmp(tmp_mup, cl->mlist->music_path, ft_strlen(tmp_mup) + 1)) + else if (isoldmus && cl.mlist.ismusic + && !ft_strncmp(tmp_mup, cl.mlist.music_path, ft_strlen(tmp_mup) + 1)) return ; } @@ -89,19 +89,19 @@ int8_t char *tmp_mup; uint8_t isoldmus; - if ((uint32_t)cl->plist->pos_x == cl->mlist->nlx && - (uint32_t)cl->plist->pos_y == cl->mlist->nly) + if ((uint32_t)cl.plist.pos_x == cl.mlist.nlx && + (uint32_t)cl.plist.pos_y == cl.mlist.nly) { if (!(next_path = (char *)malloc((ft_strlen( - cl->mlist->nlevel_path) + 1) * sizeof(char)))) + cl.mlist.nlevel_path) + 1) * sizeof(char)))) return (-1); - ft_sprintf(next_path, "%s", cl->mlist->nlevel_path); - isoldmus = cl->mlist->ismusic; + ft_sprintf(next_path, "%s", cl.mlist.nlevel_path); + isoldmus = cl.mlist.ismusic; if (isoldmus) - tmp_mup = ft_strdup(cl->mlist->music_path); + tmp_mup = ft_strdup(cl.mlist.music_path); ft_del_some(cl); - ft_del_map(cl->mlist); - if (!(cl->mlist = ft_init_map())) + ft_del_map(cl.mlist); + if (!(cl.mlist = ft_init_map())) return (-1); ft_parse_map(next_path, cl); ft_treat_music(isoldmus, tmp_mup, cl); -- cgit v1.2.3 From ce43b1cd1caa539af687425f58a6999a20807878 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 3 Mar 2020 16:14:26 +0100 Subject: Going full stack is bav --- src/ft_warp_level.c | 89 ++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 45 deletions(-) (limited to 'src/ft_warp_level.c') diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c index a50ff65..b122e46 100644 --- a/src/ft_warp_level.c +++ b/src/ft_warp_level.c @@ -21,18 +21,17 @@ static void ft_del_map(t_map *ml) { - ft_memdel((void**)&ml.no_tex_path); - ft_memdel((void**)&ml.so_tex_path); - ft_memdel((void**)&ml.ea_tex_path); - ft_memdel((void**)&ml.we_tex_path); - ft_memdel((void**)&ml.sprite_path); - ft_memdel((void**)&ml.nl_tex_path); - ft_memdel((void**)&ml.nlevel_path); - ft_memdel((void**)&ml.music_path); - ft_memdel((void**)&ml.music_cmd); - ft_memdel((void**)&ml.mapl); - ft_free_words(ml.map); - ft_memdel((void**)&ml); + ft_memdel((void**)&ml->no_tex_path); + ft_memdel((void**)&ml->so_tex_path); + ft_memdel((void**)&ml->ea_tex_path); + ft_memdel((void**)&ml->we_tex_path); + ft_memdel((void**)&ml->sprite_path); + ft_memdel((void**)&ml->nl_tex_path); + ft_memdel((void**)&ml->nlevel_path); + ft_memdel((void**)&ml->music_path); + ft_memdel((void**)&ml->music_cmd); + ft_memdel((void**)&ml->mapl); + ft_free_words(ml->map); } static void @@ -40,23 +39,23 @@ static void { uint8_t i; - cl.plist.pos_x = 0; - cl.plist.pos_y = 0; - cl.plist.start_x = 0; - cl.plist.start_y = 0; - cl.plist.cam_x = 0; - cl.plist.dir_x = -1; - cl.plist.dir_y = 0; - cl.plist.plane_x = 0; - cl.plist.plane_y = 0.66666666; - cl.f_rgb = ft_init_rgb(); - cl.c_rgb = ft_init_rgb(); - cl.rlist = ft_init_s_ray(); + cl->plist.pos_x = 0; + cl->plist.pos_y = 0; + cl->plist.start_x = 0; + cl->plist.start_y = 0; + cl->plist.cam_x = 0; + cl->plist.dir_x = -1; + cl->plist.dir_y = 0; + cl->plist.plane_x = 0; + cl->plist.plane_y = 0.66666666; + cl->f_rgb = ft_init_rgb(); + cl->c_rgb = ft_init_rgb(); + cl->rlist = ft_init_s_ray(); i = 0; while (i <= 5) { - mlx_destroy_image(cl.wlist.wlx, cl.tlist[i].img); - cl.tlist[i].img = NULL; + mlx_destroy_image(cl->wlist.wlx, cl->tlist[i].img); + cl->tlist[i].img = NULL; i++; } } @@ -64,21 +63,21 @@ static void static void ft_treat_music(uint8_t isoldmus, char *tmp_mup, t_cub *cl) { - if (isoldmus && !cl.mlist.ismusic) + if (isoldmus && !cl->mlist.ismusic) { - pthread_cancel(cl.tid); - pthread_join(cl.tid, NULL); - cl.isoldmus = 0; + pthread_cancel(cl->tid); + pthread_join(cl->tid, NULL); + cl->isoldmus = 0; } - else if (isoldmus && cl.mlist.ismusic - && ft_strncmp(tmp_mup, cl.mlist.music_path, ft_strlen(tmp_mup) + 1)) + else if (isoldmus && cl->mlist.ismusic + && ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1)) { - pthread_cancel(cl.tid); - pthread_join(cl.tid, NULL); - pthread_create(&cl.tid, NULL, ft_music_thread, cl); + pthread_cancel(cl->tid); + pthread_join(cl->tid, NULL); + pthread_create(&cl->tid, NULL, ft_music_thread, cl); } - else if (isoldmus && cl.mlist.ismusic - && !ft_strncmp(tmp_mup, cl.mlist.music_path, ft_strlen(tmp_mup) + 1)) + else if (isoldmus && cl->mlist.ismusic + && !ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1)) return ; } @@ -89,19 +88,19 @@ int8_t char *tmp_mup; uint8_t isoldmus; - if ((uint32_t)cl.plist.pos_x == cl.mlist.nlx && - (uint32_t)cl.plist.pos_y == cl.mlist.nly) + if ((uint32_t)cl->plist.pos_x == cl->mlist.nlx && + (uint32_t)cl->plist.pos_y == cl->mlist.nly) { if (!(next_path = (char *)malloc((ft_strlen( - cl.mlist.nlevel_path) + 1) * sizeof(char)))) + cl->mlist.nlevel_path) + 1) * sizeof(char)))) return (-1); - ft_sprintf(next_path, "%s", cl.mlist.nlevel_path); - isoldmus = cl.mlist.ismusic; + ft_sprintf(next_path, "%s", cl->mlist.nlevel_path); + isoldmus = cl->mlist.ismusic; if (isoldmus) - tmp_mup = ft_strdup(cl.mlist.music_path); + tmp_mup = ft_strdup(cl->mlist.music_path); ft_del_some(cl); - ft_del_map(cl.mlist); - if (!(cl.mlist = ft_init_map())) + ft_del_map(&cl->mlist); + if (ft_init_map(&cl->mlist) < 0) return (-1); ft_parse_map(next_path, cl); ft_treat_music(isoldmus, tmp_mup, cl); -- cgit v1.2.3