aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--map/map_one.cub4
-rw-r--r--src/ft_draw_scene.c2
-rw-r--r--src/ft_draw_sprite.c8
-rw-r--r--src/ft_raycasting.c1
4 files changed, 8 insertions, 7 deletions
diff --git a/map/map_one.cub b/map/map_one.cub
index 5a322c2..3f5eb59 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -1,4 +1,4 @@
-R 1400 900
+R 1000 700
NO ./media/img/BRIQUASSES.xpm
SO ./media/img/BRIQUASSE_3.xpm
@@ -10,7 +10,7 @@ C 50,100,200
F 50,190,124
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
-1 2 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1
+1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1
1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1 N 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1
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++;
}