aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_handweap.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-22 14:47:59 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-22 14:47:59 +0100
commit558151cd594920e8322f53f382d88863a0fd6377 (patch)
treedd7fc5b3de1f873a0423734038d61bebffbb6290 /src/ft_draw_handweap.c
parentRemoved bloat (diff)
download42-cub3d-558151cd594920e8322f53f382d88863a0fd6377.tar.gz
42-cub3d-558151cd594920e8322f53f382d88863a0fd6377.tar.bz2
42-cub3d-558151cd594920e8322f53f382d88863a0fd6377.tar.xz
42-cub3d-558151cd594920e8322f53f382d88863a0fd6377.tar.zst
42-cub3d-558151cd594920e8322f53f382d88863a0fd6377.zip
Normed so far
Diffstat (limited to 'src/ft_draw_handweap.c')
-rw-r--r--src/ft_draw_handweap.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/ft_draw_handweap.c b/src/ft_draw_handweap.c
index 9a1a44b..42e7bfd 100644
--- a/src/ft_draw_handweap.c
+++ b/src/ft_draw_handweap.c
@@ -55,23 +55,15 @@ static int16_t
}
}
-void
- ft_draw_handweap(t_cub *cl)
+static void
+ ft_put_handweap(int8_t w_id, int32_t y_ratio, int32_t x_ratio, t_cub *cl)
{
- int32_t x_ratio;
- int32_t y_ratio;
int16_t x;
int16_t y;
int16_t move;
- int8_t w_id;
- w_id = cl->plist.handles_weapon;
- w_id += (cl->plist.fire == 1) ? (1) : 0;
- 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(cl);
- move = (cl->plist.fire == 1) ? (0) : (move);
+ move = (cl->plist.fire == 1) ? (0) : (ft_set_move(cl));
while (y < (int16_t)cl->wlist.y_size)
{
cl->tweap[w_id].tex_y = ((y * y_ratio) >> 16);
@@ -89,3 +81,19 @@ void
y++;
}
}
+
+void
+ ft_draw_handweap(t_cub *cl)
+{
+ int32_t x_ratio;
+ int32_t y_ratio;
+ int8_t w_id;
+
+ w_id = cl->plist.handles_weapon;
+ w_id += (cl->plist.fire == 1) ? (1) : (0);
+ 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;
+ ft_put_handweap(w_id, y_ratio, x_ratio, cl);
+}