diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_draw_scene.c | 2 | ||||
-rw-r--r-- | src/ft_draw_sprite.c | 8 | ||||
-rw-r--r-- | src/ft_raycasting.c | 1 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 0df3596..3f43495 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -22,8 +22,8 @@ void clist->wlist->x_size, clist->wlist->y_size); clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, &clist->img.sizeline, &clist->img.endian); - ft_calc_sprite(clist); ft_castray(clist); + ft_calc_sprite(clist); if (clist->ishud) ft_draw_hud(clist); mlx_put_image_to_window(clist->wlist->wlx, diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c index 03d3ca7..701587f 100644 --- a/src/ft_draw_sprite.c +++ b/src/ft_draw_sprite.c @@ -21,6 +21,7 @@ void ft_draw_sprite(t_cub *cl, t_sprite *sprite) { int32_t d; + sprite->x = sprite->drawstartx; while (sprite->x < sprite->drawendx) { @@ -31,14 +32,15 @@ void sprite->x < (int32_t)cl->wlist->x_size) while (sprite->y < sprite->drawendy) { + puts("qwe"); d = (sprite->y) * 256 - cl->wlist->y_size * 128 + sprite->spriteheight * 128; sprite->tex_y = ((d * cl->tlist[4].img_h) / - sprite->spriteheight) / 256; + sprite->spriteheight) / 128; if (*(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4)) - *(cl->img.ptr + sprite->x + sprite->y * - cl->img.sizeline / 4) = + cl->img.ptr[sprite->x + sprite->y * + cl->img.sizeline / 4] = *(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4); sprite->y++; } diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index d97c231..59021d3 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -130,7 +130,6 @@ ft_castray(t_cub *cl) cl->rlist.wall_b = wl->y_size - 1; ft_choose_tex(cl); ft_calc_tex(cl); - ft_calc_sprite(cl); ft_draw_verline(cl, i, cl->rlist.wall_t, cl->rlist.wall_b); i++; } |