/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_draw_sprite.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/24 20:22:45 by rbousset #+# #+# */ /* Updated: 2020/02/24 20:22:47 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include #include #include /* void ft_draw_verline_sprite(t_cub *cl, int x, int y, int tex_y) { if (cl->tlist[4].tex_x) } */ void ft_draw_sprite(t_cub *cl) { int itx; int ity; int d; int tex_x; int tex_y; itx = cl->sp_list.s_start_x; while (itx < cl->sp_list.s_end_x) { tex_x = (int)((itx - (-cl->sp_list.s_w / 2 + cl->sp_list.s_screen_x)) * cl->tlist[4].img_w / cl->sp_list.s_w); ity = cl->sp_list.s_start_y; while (ity < cl->sp_list.s_end_y) { d = ity * 256 - cl->wlist->y_size * 128 + cl->sp_list.s_h * 128; tex_y = ((d * cl->tlist[4].img_h) / cl->sp_list.s_h) / 256; if (*(cl->tlist[4].ptr + tex_x + tex_y * cl->tlist[4].sizeline / 4)) { /*cl->img.ptr[tex_x * 4 + (cl->img.sizeline * tex_y)] =*/ /*(char)cl->tlist[4].ptr[cl->tlist[4].tex_x * 4 + 4 **/ /*cl->tlist[4].img_h * tex_y];*/ /*puts("qwe");*/ } ity++; } itx++; } }