aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_time.c')
-rw-r--r--src/ft_time.c28
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);
}