aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/cub3d.h1
-rw-r--r--src/ft_draw_scene.c1
-rw-r--r--src/ft_draw_sprite.c6
-rw-r--r--src/ft_raycasting.c5
4 files changed, 7 insertions, 6 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h
index c3236a5..8eebc00 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -90,6 +90,7 @@ void ft_draw_life_bar(size_t map_w,
const int8_t life,
t_cub *cl);
void ft_music(t_cub *cl);
+void ft_calc_sprite(t_cub *cl);
void ft_calc_sprite_norme(t_cub *cl);
void ft_draw_sprite(t_cub *cl);
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c
index b5f2283..0df3596 100644
--- a/src/ft_draw_scene.c
+++ b/src/ft_draw_scene.c
@@ -22,6 +22,7 @@ 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);
if (clist->ishud)
ft_draw_hud(clist);
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index a3371b4..7e7114f 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -44,9 +44,9 @@ void
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];*/
+ 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++;
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index 626ced4..5bf0785 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <math.h>
-static void
+void
ft_calc_sprite(t_cub *cl)
{
cl->sp_list.s_x = cl->sp_list.s_pos_x - cl->plist->pos_x;
@@ -57,7 +57,7 @@ void
cl->sp_list.s_end_x = cl->wlist->x_size - 1;
/*ft_printf("start x: %d\nstart y : %d\n", cl->sp_list.s_start_x, cl->sp_list.s_start_y);*/
/*ft_printf("end x: %d\nend y : %d\n", cl->sp_list.s_end_x, cl->sp_list.s_end_y);*/
- /*ft_draw_sprite(cl);*/
+ ft_draw_sprite(cl);
}
@@ -117,7 +117,6 @@ void
i = 0;
wl = cl->wlist;
- ft_calc_sprite(cl);
while (i < wl->x_size)
{
ft_initray(cl, i);