aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_tex_bad_boy_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_tex_bad_boy_init.c')
-rw-r--r--src/ft_tex_bad_boy_init.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/ft_tex_bad_boy_init.c b/src/ft_tex_bad_boy_init.c
new file mode 100644
index 0000000..748d680
--- /dev/null
+++ b/src/ft_tex_bad_boy_init.c
@@ -0,0 +1,70 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_tex_bad_boy_init.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: fmoenne- <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:43:55 by fmoenne- #+# #+# */
+/* Updated: 2020/02/14 17:43:56 by fmoenne- ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <cub3d.h>
+#include <stdint.h>
+#include <mlx.h>
+
+static void
+ ft_tex_skel(t_cub *cl)
+{
+ cl->tlist[23].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_ENMY_WAIT_PATH, &cl->tlist[23].img_w, &cl->tlist[23].img_h);
+ cl->tlist[23].ptr = mlx_get_data_addr(cl->tlist[23].img,
+ &cl->tlist[23].bpp, &cl->tlist[23].sizeline, &cl->tlist[23].endian);
+ cl->tlist[24].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_ENMY_WALK_PATH, &cl->tlist[24].img_w, &cl->tlist[24].img_h);
+ cl->tlist[24].ptr = mlx_get_data_addr(cl->tlist[24].img,
+ &cl->tlist[24].bpp, &cl->tlist[24].sizeline, &cl->tlist[24].endian);
+ cl->tlist[25].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_ENMY_FIRE_PATH, &cl->tlist[25].img_w, &cl->tlist[25].img_h);
+ cl->tlist[25].ptr = mlx_get_data_addr(cl->tlist[25].img,
+ &cl->tlist[25].bpp, &cl->tlist[25].sizeline, &cl->tlist[25].endian);
+ cl->tlist[26].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_ENMY_DEAD_PATH, &cl->tlist[26].img_w, &cl->tlist[26].img_h);
+ cl->tlist[26].ptr = mlx_get_data_addr(cl->tlist[26].img,
+ &cl->tlist[26].bpp, &cl->tlist[26].sizeline, &cl->tlist[26].endian);
+}
+
+static void
+ ft_tex_cowboy(t_cub *cl)
+{
+ cl->tlist[23].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_CB_WAIT_PATH, &cl->tlist[23].img_w, &cl->tlist[23].img_h);
+ cl->tlist[23].ptr = mlx_get_data_addr(cl->tlist[23].img,
+ &cl->tlist[23].bpp, &cl->tlist[23].sizeline, &cl->tlist[23].endian);
+ cl->tlist[24].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_CB_WALK_PATH, &cl->tlist[24].img_w, &cl->tlist[24].img_h);
+ cl->tlist[24].ptr = mlx_get_data_addr(cl->tlist[24].img,
+ &cl->tlist[24].bpp, &cl->tlist[24].sizeline, &cl->tlist[24].endian);
+ cl->tlist[25].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_CB_FIRE_PATH, &cl->tlist[25].img_w, &cl->tlist[25].img_h);
+ cl->tlist[25].ptr = mlx_get_data_addr(cl->tlist[25].img,
+ &cl->tlist[25].bpp, &cl->tlist[25].sizeline, &cl->tlist[25].endian);
+ cl->tlist[26].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_CB_DEAD_PATH, &cl->tlist[26].img_w, &cl->tlist[26].img_h);
+ cl->tlist[26].ptr = mlx_get_data_addr(cl->tlist[26].img,
+ &cl->tlist[26].bpp, &cl->tlist[26].sizeline, &cl->tlist[26].endian);
+}
+
+void
+ ft_tex_bad_boy_init(t_cub *cl)
+{
+ if (cl->mlist.enemy == 1)
+ {
+ ft_tex_skel(cl);
+ }
+ else
+ {
+ ft_tex_cowboy(cl);
+ }
+}