diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-30 17:46:28 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-30 17:46:28 +0200 |
commit | df8d32e84a60558c38a0d75496c82de657103648 (patch) | |
tree | 964706cdd49ea979e42eef21dfa6f5af4299a7ce /src/ft_time.c | |
parent | Commit (diff) | |
download | 42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.tar.gz 42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.tar.bz2 42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.tar.xz 42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.tar.zst 42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.zip |
It's moving!
Diffstat (limited to 'src/ft_time.c')
-rw-r--r-- | src/ft_time.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ft_time.c b/src/ft_time.c index fb0b0d2..d175bbf 100644 --- a/src/ft_time.c +++ b/src/ft_time.c @@ -38,9 +38,32 @@ void } void + ft_bad_boys_time(clock_t before, t_cub *cl) +{ + int8_t i; + static clock_t dt = 0; + clock_t curr; + + curr = clock(); + dt += curr - before; + i = 0; + while (i < cl->mlist.sprite_nbr[13]) + { + 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++; + } +} + +void ft_timings(clock_t before, t_cub *cl) { if (cl->plist.fire == 1) ft_handle_firing(before, cl); + if (cl->mlist.sprite_nbr[13] > 0) + ft_bad_boys_time(before, cl); ft_get_fps_count(before, cl); } |