From 558151cd594920e8322f53f382d88863a0fd6377 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 22 Mar 2020 14:47:59 +0100 Subject: Normed so far --- src/ft_draw_handweap.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src/ft_draw_handweap.c') 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); +} -- cgit v1.2.3