aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2020-02-28 15:30:53 +0100
committersalaaad2 <arthurdurant263@gmail.com>2020-02-28 15:30:53 +0100
commit8f852afcfa170070b6f0ac2e321546990d87e401 (patch)
treec75ea70c8de7d3a7e349ae8d10adec1eab5917ae /src
parentlets GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO... (diff)
download42-cub3d-8f852afcfa170070b6f0ac2e321546990d87e401.tar.gz
42-cub3d-8f852afcfa170070b6f0ac2e321546990d87e401.tar.bz2
42-cub3d-8f852afcfa170070b6f0ac2e321546990d87e401.tar.xz
42-cub3d-8f852afcfa170070b6f0ac2e321546990d87e401.tar.zst
42-cub3d-8f852afcfa170070b6f0ac2e321546990d87e401.zip
gang
Diffstat (limited to '')
-rw-r--r--src/ft_draw_scene.c2
-rw-r--r--src/ft_draw_sprite.c4
-rw-r--r--src/ft_key_loop.c5
-rw-r--r--src/ft_raycasting.c1
4 files changed, 8 insertions, 4 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c
index 3f43495..f974d42 100644
--- a/src/ft_draw_scene.c
+++ b/src/ft_draw_scene.c
@@ -23,9 +23,9 @@ void
clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp,
&clist->img.sizeline, &clist->img.endian);
ft_castray(clist);
- ft_calc_sprite(clist);
if (clist->ishud)
ft_draw_hud(clist);
+ ft_calc_sprite(clist);
mlx_put_image_to_window(clist->wlist->wlx,
clist->wlist->winptr, clist->img.img, 0, 0);
mlx_destroy_image(clist->wlist->wlx, clist->img.img);
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index 875e527..0430e2f 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -22,7 +22,7 @@ void
{
int32_t d;
- printf("start x : %d\nstart y : %d\nend x : %d\nend y : %d\n", sprite->drawstartx, sprite->drawstarty, sprite->drawendy, sprite->drawendy);
+ /* printf("start x : %d\nstart y : %d\nend x : %d\nend y : %d\n", sprite->drawstartx, sprite->drawstarty, sprite->drawendy, sprite->drawendy); */
sprite->x = sprite->drawstartx;
while (sprite->x < sprite->drawendx)
{
@@ -37,7 +37,7 @@ void
sprite->spriteheight * 128;
sprite->tex_y = ((d * cl->tlist[4].img_h / 2) /
sprite->spriteheight) / 128;
- if (cl->tlist[4].ptr[sprite->tex_x * 4 + 4 * cl->tlist[4].img_h * sprite->tex_y] != (char)0)
+ if (cl->tlist[4].ptr[sprite->tex_x * 4 + 4 * cl->tlist[4].img_h * sprite->tex_y])
{
cl->img.ptr[sprite->x * 4 + (sprite->y *
cl->img.sizeline)] =
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c
index d92b37e..d913c49 100644
--- a/src/ft_key_loop.c
+++ b/src/ft_key_loop.c
@@ -42,6 +42,9 @@ int
ft_collision(old_y, old_x, cl->plist, cl->mlist);
i++;
}
- ft_draw_scene(cl);
+ if (cl->key_input[0] != -1)
+ {
+ ft_draw_scene(cl);
+ }
return (0);
}
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index e7cc4ef..0173fe6 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -49,6 +49,7 @@ void
sprite = cl->sprites;
sprite.spritex = (sprite.spritex + 1) - cl->plist->pos_x;
sprite.spritey = (sprite.spritey + 1) - cl->plist->pos_y;
+ printf("%f%f\n", sprite.spritex, sprite.spritey);
sprite.invdet = 1.0 / (cl->plist->plane_x *
cl->plist->dir_y - cl->plist->dir_x * cl->plist->plane_y);
sprite.transformx = sprite.invdet * (cl->plist->dir_y *