diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-30 18:24:38 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-30 18:24:38 +0200 |
commit | 6e27f12e8f780a82f114b42088973363f9a896ff (patch) | |
tree | ca69f8e50c30e2bc41c3e8bdf9aa2ee5b1a77e0e /src/ft_time.c | |
parent | It's moving! (diff) | |
download | 42-cub3d-6e27f12e8f780a82f114b42088973363f9a896ff.tar.gz 42-cub3d-6e27f12e8f780a82f114b42088973363f9a896ff.tar.bz2 42-cub3d-6e27f12e8f780a82f114b42088973363f9a896ff.tar.xz 42-cub3d-6e27f12e8f780a82f114b42088973363f9a896ff.tar.zst 42-cub3d-6e27f12e8f780a82f114b42088973363f9a896ff.zip |
Pretty coolio
Diffstat (limited to 'src/ft_time.c')
-rw-r--r-- | src/ft_time.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/ft_time.c b/src/ft_time.c index d175bbf..4d33dc8 100644 --- a/src/ft_time.c +++ b/src/ft_time.c @@ -38,32 +38,32 @@ void } void - ft_bad_boys_time(clock_t before, t_cub *cl) + ft_bad_boys_time(clock_t before, int8_t i, t_cub *cl) { - int8_t i; - static clock_t dt = 0; + static clock_t dt[32]; clock_t curr; curr = clock(); - dt += curr - before; - i = 0; - while (i < cl->mlist.sprite_nbr[13]) + dt[i] += curr - before; + if (cl->bad_boy[i].sleep == 1 && dt[i] > 0 && ft_clock_to_ms(dt[i]) > 700.0) { - if (cl->bad_boy[i].sleep == 1 && dt > 0 && ft_clock_to_ms(dt) > 600.0) - { - cl->bad_boy[i].sleep = 0; - dt = 0; - } - i++; + cl->bad_boy[i].sleep = 0; + dt[i] = 0; } } void ft_timings(clock_t before, t_cub *cl) { + int8_t i; + + i = 0; if (cl->plist.fire == 1) ft_handle_firing(before, cl); - if (cl->mlist.sprite_nbr[13] > 0) - ft_bad_boys_time(before, cl); + while (i < cl->mlist.sprite_nbr[13]) + { + ft_bad_boys_time(before, i, cl); + i++; + } ft_get_fps_count(before, cl); } |