From dad432566a5c74f86dc4ba874e631115e0f469d1 Mon Sep 17 00:00:00 2001 From: jacopo grandi Date: Wed, 24 Feb 2021 18:01:08 +0100 Subject: level selector and fx fic --- gst/gst.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gst/gst.c') diff --git a/gst/gst.c b/gst/gst.c index 6842826..9ded823 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -89,16 +89,18 @@ void gst_spawn_bullets (gamestate *gst, fxs *fx, a_dmg dmgs[], int dmgslen, gst_get_maparmy(gst, &m, &ar); bullet b; + + // for every unit count how many shots int counts[MAXUNITS]; for (int j=0;juslen; i++) { for (int j=0; jus+i; if (dmgs[j].u == u) { counts[i]++; } } } + + // then spawn a bullet for every shot int curr[MAXUNITS]; for (int j=0;juslen; i++) { @@ -111,9 +113,10 @@ void gst_spawn_bullets (gamestate *gst, fxs *fx, a_dmg dmgs[], int dmgslen, b.to[0] = t->pos[0]+16; b.to[1] = t->pos[1]+16; float n = (float)curr[i]/counts[i]; + float travel_time = 0.1; float shot_time = time + n*gst->turnspeed; b.starttime = shot_time; - b.endtime = shot_time + 0.1; + b.endtime = shot_time + travel_time; if (u->owner == 0) { b.color[0] = 0; b.color[1] = 255; b.color[2] = 0; } else { @@ -155,7 +158,6 @@ void gst_process (gamestate *gst, infos *info, fxs *fx, float t) { a_dmg dmgs[1024*8]; int fire = army_fire(info, ar, m, dmgs); army_upkeep(info, ar, m); - printf("%d, %d\n", move, fire); if (move == 0 && fire == 0) { gst->turn_until_finish--; } else { gst->turn_until_finish = 5; } -- cgit v1.2.3-54-g00ecf