diff options
author | salaaad2 <arthudurant263@gmail.com> | 2020-02-25 16:43:54 +0100 |
---|---|---|
committer | salaaad2 <arthudurant263@gmail.com> | 2020-02-25 16:43:54 +0100 |
commit | cc85b0a701b558e18299822f7091fc2fd137b14b (patch) | |
tree | d2d914c1242299e8c3d2afcec8ff6b3c12d2a82f /src/ft_draw_sprite.c | |
parent | gang (diff) | |
download | 42-cub3d-cc85b0a701b558e18299822f7091fc2fd137b14b.tar.gz 42-cub3d-cc85b0a701b558e18299822f7091fc2fd137b14b.tar.bz2 42-cub3d-cc85b0a701b558e18299822f7091fc2fd137b14b.tar.xz 42-cub3d-cc85b0a701b558e18299822f7091fc2fd137b14b.tar.zst 42-cub3d-cc85b0a701b558e18299822f7091fc2fd137b14b.zip |
bunch of garbage
Diffstat (limited to '')
-rw-r--r-- | src/ft_draw_sprite.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c index 7e7114f..28ffb10 100644 --- a/src/ft_draw_sprite.c +++ b/src/ft_draw_sprite.c @@ -16,32 +16,24 @@ #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) + cl->sprites.x = cl->sprites.s_start_x; + while (cl->sprites.x < cl->sprites.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) + tex_x = (int)((cl->sprites.x - (-cl->sprites.s_w / 2 + cl->sprites.s_screen_x)) + * cl->tlist[4].img_w / cl->sprites.s_w); + cl->sprites.y = cl->sprites.s_start_y; + while (cl->sprites.y < cl->sprites.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; + d = cl->sprites.y * 256 - cl->wlist->y_size * 128 + cl->sprites.s_h * 128; + tex_y = ((d * cl->tlist[4].img_h) / cl->sprites.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)] = @@ -49,8 +41,8 @@ void cl->tlist[4].img_h * tex_y]; /*puts("qwe");*/ } - ity++; + cl->sprites.y++; } - itx++; + cl->sprites.x++; } } |