aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-14 19:34:06 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-14 19:34:06 +0100
commitee13e877d77ba62b28b7af510c7cc729987044ce (patch)
tree0c857982c626c87a9142cdf6d74e731676318433
parentIn progress (diff)
download42-cub3d-ee13e877d77ba62b28b7af510c7cc729987044ce.tar.gz
42-cub3d-ee13e877d77ba62b28b7af510c7cc729987044ce.tar.bz2
42-cub3d-ee13e877d77ba62b28b7af510c7cc729987044ce.tar.xz
42-cub3d-ee13e877d77ba62b28b7af510c7cc729987044ce.tar.zst
42-cub3d-ee13e877d77ba62b28b7af510c7cc729987044ce.zip
Elementary school math into leaks fix
Diffstat (limited to '')
-rw-r--r--map/map_one.cub6
-rw-r--r--src/ft_death_hooks.c24
-rw-r--r--src/ft_death_screen.c4
-rw-r--r--src/ft_del_extra_sprites.c4
-rw-r--r--src/ft_tex_init.c26
-rw-r--r--src/ft_warp_level.c7
6 files changed, 25 insertions, 46 deletions
diff --git a/map/map_one.cub b/map/map_one.cub
index 94c146c..60101c6 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -9,7 +9,7 @@ S ./media/img/pillar.xpm
C ./media/img/arrow1.xpm
F ./media/img/arrow2.xpm
-S3 ./media/img/spikes.xpm
+S3 ./media/img/larry.xpm
S4 ./media/img/linus.xpm
S5 ./media/img/crapaud.xpm
S6 ./media/img/larry.xpm
@@ -22,8 +22,8 @@ SH 1
111111111111111111
100000000000000001
1000E0T00000000001
-100100300000000001
-101104000111000001
+100100000000000001
+101100000111000001
111111111111110011
1000001 100001
1001001 100001
diff --git a/src/ft_death_hooks.c b/src/ft_death_hooks.c
index 5482e75..1f0cb6c 100644
--- a/src/ft_death_hooks.c
+++ b/src/ft_death_hooks.c
@@ -39,30 +39,6 @@ static int
{
(void)cl;
return (0);
-/* uint8_t i; */
-/* const float old_y = cl->plist.pos_y; */
-/* const float old_x = cl->plist.pos_x; */
-
-/* i = 0; */
-/* while (i < 5 && cl->key_input[i] != -1 && cl->key_input[i] <= 5) */
-/* { */
-/* cl->key_ptr[cl->key_input[i]](cl); */
-/* ft_collision(old_y, old_x, cl->key_input[i], cl); */
-/* if (cl->mlist.isnlvl) */
-/* { */
-/* if ((uint32_t)cl->plist.pos_x == cl->mlist.nlx && */
-/* (uint32_t)cl->plist.pos_y == cl->mlist.nly) */
-/* { */
-/* ft_sfx_new_level(cl); */
-/* return ((ft_warp_level(cl->mlist.nlevel_path, cl) < 0) ? */
-/* (ft_exit(FT_RET_FAILED_STRUCTS, cl)) : (0)); */
-/* } */
-/* } */
-/* i++; */
-/* } */
-/* if (cl->key_input[0] != -1) */
-/* ft_draw_scene(cl); */
-/* return (0); */
}
void
diff --git a/src/ft_death_screen.c b/src/ft_death_screen.c
index 16d75d5..cc299d1 100644
--- a/src/ft_death_screen.c
+++ b/src/ft_death_screen.c
@@ -71,7 +71,7 @@ void
ft_calc_death_screen(cl);
mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr,
cl->img.img, 0, 0);
- /* mlx_destroy_image(cl->wlist.wlx, cl->death_screen.img); */
- /* mlx_destroy_image(cl->wlist.wlx, cl->img.img); */
+ mlx_destroy_image(cl->wlist.wlx, cl->img.img);
+ mlx_destroy_image(cl->wlist.wlx, cl->death_screen.img);
ft_death_hooks(&cl->wlist, cl);
}
diff --git a/src/ft_del_extra_sprites.c b/src/ft_del_extra_sprites.c
index 21df608..91d09a2 100644
--- a/src/ft_del_extra_sprites.c
+++ b/src/ft_del_extra_sprites.c
@@ -24,8 +24,8 @@ void
i = 1;
while ((i + 2) <= cl->mlist.topsp)
{
- if (cl->tlist[i + 7].img)
- mlx_destroy_image(cl->wlist.wlx, cl->tlist[i + 7].img);
+ if (cl->tlist[i + 9].img)
+ mlx_destroy_image(cl->wlist.wlx, cl->tlist[i + 9].img);
i++;
}
}
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c
index 9a6da10..298fbfc 100644
--- a/src/ft_tex_init.c
+++ b/src/ft_tex_init.c
@@ -17,21 +17,23 @@
#include <mlx.h>
/*
+** tlist[] index summary
+** ---------------------
** 0 : no
** 1 : so
** 2 : ea
** 3 : we
-** 4 : sprite 1
+** 4 : sprite 2
** 5 : new level door
** 6 : floor
** 7 : ceil / skybox
-** 8 : sprite 2
-** 9 : sprite 3
-** 10 : sprite 4
-** 11 : sprite 5
-** 12 : sprite 6
-** 13 : sprite 7
-** 14 : sprite 8
+** 8 : sprite 3
+** 9 : sprite 4
+** 10 : sprite 5
+** 11 : sprite 6
+** 12 : sprite 7
+** 13 : sprite 8
+** 14 : sprite 9
** 15 : trap
*/
@@ -56,17 +58,17 @@ static void
static void
ft_wall_tex_init_norme_bis(t_cub *cl)
{
- if (cl->mlist.isctex)
+ if (cl->mlist.isskybox)
{
cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- cl->mlist.ce_tex_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h);
+ cl->mlist.skybox_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h);
cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img,
&cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian);
}
- if (cl->mlist.isskybox)
+ else if (cl->mlist.isctex)
{
cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- cl->mlist.skybox_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h);
+ cl->mlist.ce_tex_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h);
cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img,
&cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian);
}
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 69b7b78..56d4d67 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -51,11 +51,12 @@ static void
cl->f_rgb = ft_init_rgb();
cl->c_rgb = ft_init_rgb();
cl->rlist = ft_init_s_ray();
- i = -1;
- while (++i < 5)
+ i = 0;
+ while (i < 5)
{
mlx_destroy_image(cl->wlist.wlx, cl->tlist[i].img);
- cl->tlist[i].img = NULL;
+ cl->tlist[i].ptr = NULL;
+ i++;
}
if (cl->mlist.isnlvl && cl->tlist[5].img)
mlx_destroy_image(cl->wlist.wlx, cl->tlist[5].img);