aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_tex_init.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-03-12 17:48:43 +0100
committerRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-03-12 17:48:43 +0100
commit88cd7098410c7ab80baecc6c2a4d5da99e10162f (patch)
tree0090da4d5ca1e58466cf4c32a0c38ef0ee894287 /src/ft_tex_init.c
parentremoved junk (diff)
download42-cub3d-88cd7098410c7ab80baecc6c2a4d5da99e10162f.tar.gz
42-cub3d-88cd7098410c7ab80baecc6c2a4d5da99e10162f.tar.bz2
42-cub3d-88cd7098410c7ab80baecc6c2a4d5da99e10162f.tar.xz
42-cub3d-88cd7098410c7ab80baecc6c2a4d5da99e10162f.tar.zst
42-cub3d-88cd7098410c7ab80baecc6c2a4d5da99e10162f.zip
kk
Diffstat (limited to '')
-rw-r--r--src/ft_tex_init.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c
index 0290a0c..cae07bd 100644
--- a/src/ft_tex_init.c
+++ b/src/ft_tex_init.c
@@ -38,18 +38,17 @@
static void
ft_next_sprite_init(t_cub *cl)
{
- uint16_t i;
+ uint8_t i;
- i = 8;
- cl->tlist[i].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- "./media/img/larry.xpm", &cl->tlist[i].img_w, &cl->tlist[i].img_h);
- cl->tlist[i].ptr = mlx_get_data_addr(cl->tlist[i].img,
- &cl->tlist[i].bpp, &cl->tlist[i].sizeline, &cl->tlist[i].endian);
- i++;
- cl->tlist[i].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- "./media/img/crapaud.xpm", &cl->tlist[i].img_w, &cl->tlist[i].img_h);
- cl->tlist[i].ptr = mlx_get_data_addr(cl->tlist[i].img,
- &cl->tlist[i].bpp, &cl->tlist[i].sizeline, &cl->tlist[i].endian);
+ i = 1;
+ while (cl->mlist.sprite_path[i][0])
+ {
+ cl->tlist[i + 7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ cl->mlist.sprite_path[i], &cl->tlist[i + 7].img_w, &cl->tlist[i + 7].img_h);
+ cl->tlist[i + 7].ptr = mlx_get_data_addr(cl->tlist[i + 7].img,
+ &cl->tlist[i + 7].bpp, &cl->tlist[i + 7].sizeline, &cl->tlist[i + 7].endian);
+ i++;
+ }
}
static void
@@ -71,9 +70,9 @@ static void
}
cl->walltexgood = 1;
if (cl->mlist.sprite_var > 1)
- {
- ft_next_sprite_init(cl);
- }
+ {
+ ft_next_sprite_init(cl);
+ }
}
static void
@@ -123,7 +122,7 @@ void
cl->tlist[3].ptr = mlx_get_data_addr(cl->tlist[3].img,
&cl->tlist[3].bpp, &cl->tlist[3].sizeline, &cl->tlist[3].endian);
cl->tlist[4].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- cl->mlist.sprite_path, &cl->tlist[4].img_w, &cl->tlist[4].img_h);
+ cl->mlist.sprite_path[0], &cl->tlist[4].img_w, &cl->tlist[4].img_h);
cl->tlist[4].ptr = mlx_get_data_addr(cl->tlist[4].img,
&cl->tlist[4].bpp, &cl->tlist[4].sizeline, &cl->tlist[4].endian);
ft_wall_tex_init_norme(cl);