blob: a3371b44bed4df865a3e86b32f3c20603a74b7bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_draw_sprite.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/24 20:22:45 by rbousset #+# #+# */
/* Updated: 2020/02/24 20:22:47 by rbousset ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
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++;
}
}
|