/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_tex_init.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: water_ma +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:43:55 by water_ma #+# #+# */ /* Updated: 2020/02/14 17:43:56 by water_ma ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include /* ** tlist[] index summary ** --------------------- ** 0: no ** 1: so ** 2: ea ** 3: we ** 4: sprite 2 ** 5: new level door ** 6: floor ** 7: ceil / skybox ** 8: sprite 3 ** 9: sprite 4 ** 10: sprite 5 ** 11: sprite 6 ** 12: sprite 7 ** 13: sprite 8 ** 14: sprite 9 ** 15: trap ** 16: HUD back ** 17: heal pack ** 18: weapon one sprite ** 19: weapon two sprite ** 20: weapon three sprite ** 21: health caption ** 22: ammo caption ** 23: enemy waiting ** 24: enemy walking ** 25: enemy firing ** 26: enemy dead */ static void ft_wall_tex_init_even_more_bonus(t_cub *cl) { cl->tlist[21].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_CAP_HEALTH_PATH, &cl->tlist[21].img_w, &cl->tlist[21].img_h); cl->tlist[21].ptr = mlx_get_data_addr(cl->tlist[21].img, &cl->tlist[21].bpp, &cl->tlist[21].sizeline, &cl->tlist[21].endian); cl->tlist[22].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_CAP_AMMO_PATH, &cl->tlist[22].img_w, &cl->tlist[22].img_h); cl->tlist[22].ptr = mlx_get_data_addr(cl->tlist[22].img, &cl->tlist[22].bpp, &cl->tlist[22].sizeline, &cl->tlist[22].endian); } static void ft_wall_tex_init_more_bonus(t_cub *cl) { cl->tlist[16].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_HUD_BACK_PATH, &cl->tlist[16].img_w, &cl->tlist[16].img_h); cl->tlist[16].ptr = mlx_get_data_addr(cl->tlist[16].img, &cl->tlist[16].bpp, &cl->tlist[16].sizeline, &cl->tlist[16].endian); cl->tlist[18].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_WEAPON_ONE_SPR_PATH, &cl->tlist[18].img_w, &cl->tlist[18].img_h); cl->tlist[18].ptr = mlx_get_data_addr(cl->tlist[18].img, &cl->tlist[18].bpp, &cl->tlist[18].sizeline, &cl->tlist[18].endian); cl->tlist[19].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_WEAPON_TWO_SPR_PATH, &cl->tlist[19].img_w, &cl->tlist[19].img_h); cl->tlist[19].ptr = mlx_get_data_addr(cl->tlist[19].img, &cl->tlist[19].bpp, &cl->tlist[19].sizeline, &cl->tlist[19].endian); cl->tlist[20].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_WEAPON_THREE_SPR_PATH, &cl->tlist[20].img_w, &cl->tlist[20].img_h); cl->tlist[20].ptr = mlx_get_data_addr(cl->tlist[20].img, &cl->tlist[20].bpp, &cl->tlist[20].sizeline, &cl->tlist[20].endian); ft_wall_tex_init_even_more_bonus(cl); ft_tex_bad_boy_init(cl); cl->walltexgood = 1; if (cl->mlist.sprite_var > 1) ft_next_sprite_init(cl); } static void ft_wall_tex_init_next_bonus(t_cub *cl) { if (cl->mlist.istraps) { cl->tlist[15].img = mlx_xpm_file_to_image(cl->wlist.wlx, cl->mlist.traps_path, &cl->tlist[15].img_w, &cl->tlist[15].img_h); cl->tlist[15].ptr = mlx_get_data_addr(cl->tlist[15].img, &cl->tlist[15].bpp, &cl->tlist[15].sizeline, &cl->tlist[15].endian); } if (cl->mlist.isheals) { if (cl->mlist.enemy == 1) { cl->tlist[17].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_HEAL_PACK_PATH, &cl->tlist[17].img_w, &cl->tlist[17].img_h); cl->tlist[17].ptr = mlx_get_data_addr(cl->tlist[17].img, &cl->tlist[17].bpp, &cl->tlist[17].sizeline, &cl->tlist[17].endian); } else { cl->tlist[17].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_WHISK_PACK_PATH, &cl->tlist[17].img_w, &cl->tlist[17].img_h); cl->tlist[17].ptr = mlx_get_data_addr(cl->tlist[17].img, &cl->tlist[17].bpp, &cl->tlist[17].sizeline, &cl->tlist[17].endian); } } ft_wall_tex_init_more_bonus(cl); } static void ft_wall_tex_init_bonus(t_cub *cl) { if (cl->mlist.isnlvl) { cl->tlist[5].img = mlx_xpm_file_to_image(cl->wlist.wlx, cl->mlist.nl_tex_path, &cl->tlist[5].img_w, &cl->tlist[5].img_h); cl->tlist[5].ptr = mlx_get_data_addr(cl->tlist[5].img, &cl->tlist[5].bpp, &cl->tlist[5].sizeline, &cl->tlist[5].endian); } if (cl->mlist.isftex) { cl->tlist[6].img = mlx_xpm_file_to_image(cl->wlist.wlx, cl->mlist.fl_tex_path, &cl->tlist[6].img_w, &cl->tlist[6].img_h); cl->tlist[6].ptr = mlx_get_data_addr(cl->tlist[6].img, &cl->tlist[6].bpp, &cl->tlist[6].sizeline, &cl->tlist[6].endian); } if (cl->mlist.isctex) { 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->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img, &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian); } ft_wall_tex_init_next_bonus(cl); } void ft_wall_tex_init(t_cub *cl) { cl->tlist[0].img = mlx_xpm_file_to_image(cl->wlist.wlx, cl->mlist.no_tex_path, &cl->tlist[0].img_w, &cl->tlist[0].img_h); cl->tlist[0].ptr = mlx_get_data_addr(cl->tlist[0].img, &cl->tlist[0].bpp, &cl->tlist[0].sizeline, &cl->tlist[0].endian); cl->tlist[1].img = mlx_xpm_file_to_image(cl->wlist.wlx, cl->mlist.so_tex_path, &cl->tlist[1].img_w, &cl->tlist[1].img_h); cl->tlist[1].ptr = mlx_get_data_addr(cl->tlist[1].img, &cl->tlist[1].bpp, &cl->tlist[1].sizeline, &cl->tlist[1].endian); cl->tlist[2].img = mlx_xpm_file_to_image(cl->wlist.wlx, cl->mlist.ea_tex_path, &cl->tlist[2].img_w, &cl->tlist[2].img_h); cl->tlist[2].ptr = mlx_get_data_addr(cl->tlist[2].img, &cl->tlist[2].bpp, &cl->tlist[2].sizeline, &cl->tlist[2].endian); cl->tlist[3].img = mlx_xpm_file_to_image(cl->wlist.wlx, cl->mlist.we_tex_path, &cl->tlist[3].img_w, &cl->tlist[3].img_h); 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[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_bonus(cl); }