aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_handweap.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-20 19:33:03 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-20 19:33:03 +0100
commitad0b32676e8ab435ea5767f7ca37496bf15df714 (patch)
treee33ded21db111ecfa4a96f1a718a6ef1cafc8a02 /src/ft_draw_handweap.c
parentit's not working (diff)
download42-cub3d-ad0b32676e8ab435ea5767f7ca37496bf15df714.tar.gz
42-cub3d-ad0b32676e8ab435ea5767f7ca37496bf15df714.tar.bz2
42-cub3d-ad0b32676e8ab435ea5767f7ca37496bf15df714.tar.xz
42-cub3d-ad0b32676e8ab435ea5767f7ca37496bf15df714.tar.zst
42-cub3d-ad0b32676e8ab435ea5767f7ca37496bf15df714.zip
Better bounce
Diffstat (limited to 'src/ft_draw_handweap.c')
-rw-r--r--src/ft_draw_handweap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ft_draw_handweap.c b/src/ft_draw_handweap.c
index 607cb9a..f171c42 100644
--- a/src/ft_draw_handweap.c
+++ b/src/ft_draw_handweap.c
@@ -28,18 +28,22 @@ static void
}
static int16_t
- ft_set_move(void)
+ ft_set_move(t_cub *cl)
{
static int8_t more = 0;
static int8_t less = 39;
if (more < 38)
{
+ if (!cl->moves)
+ return (more);
more += FT_BOUNCE_FACTOR;
return (more);
}
else
{
+ if (!cl->moves)
+ return (less);
less -= FT_BOUNCE_FACTOR;
if (less < 1)
{
@@ -67,7 +71,7 @@ void
x_ratio = (int32_t)(((cl->tweap[w_id].img_w - 50) << 16) / cl->wlist.x_size) + 1;
y_ratio = (int32_t)(((cl->tweap[w_id].img_h - 50) << 16) / cl->wlist.y_size) + 1;
y = 0;
- move = ft_set_move();
+ move = ft_set_move(cl);
move = (cl->plist.fire == 1) ? (0) : (move);
while (y < (int16_t)cl->wlist.y_size)
{