diff options
Diffstat (limited to 'src/ft_draw_handweap.c')
-rw-r--r-- | src/ft_draw_handweap.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/ft_draw_handweap.c b/src/ft_draw_handweap.c index f171c42..42e7bfd 100644 --- a/src/ft_draw_handweap.c +++ b/src/ft_draw_handweap.c @@ -55,24 +55,15 @@ static int16_t } } -#include <libft.h> -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); @@ -90,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); +} |