aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalaaad2 <arthudurant263@gmail.com>2020-03-20 22:37:38 +0100
committersalaaad2 <arthudurant263@gmail.com>2020-03-20 22:37:38 +0100
commit86ad3ddaeea002da77612eb32c85e8eac916a4e8 (patch)
tree6c0aa9e49dde4b50a18c508641011fa6136e0205
parentR E A L I S T I C S H O O T I N G (diff)
download42-cub3d-86ad3ddaeea002da77612eb32c85e8eac916a4e8.tar.gz
42-cub3d-86ad3ddaeea002da77612eb32c85e8eac916a4e8.tar.bz2
42-cub3d-86ad3ddaeea002da77612eb32c85e8eac916a4e8.tar.xz
42-cub3d-86ad3ddaeea002da77612eb32c85e8eac916a4e8.tar.zst
42-cub3d-86ad3ddaeea002da77612eb32c85e8eac916a4e8.zip
before norme
-rw-r--r--src/ft_extra_keys.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c
index a801dee..96636a8 100644
--- a/src/ft_extra_keys.c
+++ b/src/ft_extra_keys.c
@@ -71,11 +71,8 @@ int
}
void
-ft_hitscan(t_cub *cl)
+ ft_hitscan(t_cub *cl, uint16_t hit)
{
- uint8_t hit;
-
- hit = 0;
while (hit == 0)
{
if (cl->rlist.x_side_dist < cl->rlist.y_side_dist)
@@ -90,18 +87,16 @@ ft_hitscan(t_cub *cl)
cl->rlist.sqy += cl->mlist.y_step;
cl->rlist.side = 1;
}
- if (ft_ischarset("234567",
+ if (ft_ischarset("23456",
cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy]))
{
hit = 1;
- puts("hit");
+ cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] = '0';
+ ft_get_sprite_spawn(cl);
}
else if (ft_ischarset("1",
cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy]))
- {
hit = 1;
- puts("wall (you missed retard)");
- }
}
}
@@ -124,7 +119,7 @@ void
cl->rlist.sqy = (int16_t)cl->rlist.y_ray_pos;
ft_detection_init_x(cl);
ft_detection_init_y(cl);
- ft_hitscan(cl);
+ ft_hitscan(cl, 0);
}
int