aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_warp_level.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_warp_level.c')
-rw-r--r--src/ft_warp_level.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 4a02c2b..faaf322 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -34,6 +34,7 @@ static void
ft_memdel((void**)&ml->ce_tex_path);
ft_memdel((void**)&ml->nlevel_path);
ft_memdel((void**)&ml->skybox_path);
+ ft_memdel((void**)&ml->traps_path);
ft_memdel((void**)&ml->music_path);
ft_memdel((void**)&ml->music_cmd);
ft_memdel((void**)&ml->mapl);
@@ -46,26 +47,22 @@ static void
{
uint8_t i;
- cl->plist.pos_x = 0;
- cl->plist.pos_y = 0;
- cl->plist.pos_z = 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.66;
+ cl->plist = ft_init_player();
cl->f_rgb = ft_init_rgb();
cl->c_rgb = ft_init_rgb();
cl->rlist = ft_init_s_ray();
- i = 0;
- while (i <= 5)
+ i = -1;
+ while (++i <= 5)
{
mlx_destroy_image(cl->wlist.wlx, cl->tlist[i].img);
cl->tlist[i].img = NULL;
- i++;
}
+ if (cl->mlist.isftex && cl->tlist[6].img)
+ mlx_destroy_image(cl->wlist.wlx, cl->tlist[6].img);
+ if (cl->mlist.isctex && cl->tlist[7].img)
+ mlx_destroy_image(cl->wlist.wlx, cl->tlist[7].img);
+ if (cl->mlist.istraps && cl->tlist[15].img)
+ mlx_destroy_image(cl->wlist.wlx, cl->tlist[15].img);
}
static void
@@ -96,9 +93,6 @@ 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 (!(next_path = (char *)malloc((ft_strlen(
cl->mlist.nlevel_path) + 1) * sizeof(char))))
return (-1);
@@ -115,6 +109,5 @@ int8_t
ft_memdel((void**)&tmp_mup);
ft_wall_tex_init(cl);
ft_memdel((void**)&next_path);
- }
return (0);
}