From 457468a93d9a5a9ea6e1ca7d7f311e1c01048205 Mon Sep 17 00:00:00 2001 From: zlago Date: Sat, 14 Jun 2025 12:30:49 +0200 Subject: fixes --- src/hvy_guns.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/hvy_guns.c') diff --git a/src/hvy_guns.c b/src/hvy_guns.c index 1eabbe2..106cea6 100644 --- a/src/hvy_guns.c +++ b/src/hvy_guns.c @@ -324,8 +324,16 @@ int hvy_chaingun(struct gun *self, struct entity *parent, struct entity *target) entities.projectiles++; if (self->counter > HVY_CHAINGUN_MIN_RELOAD) { self->counter--; + self->timer = self->counter; + } else { + // this allows the projectiles to keep cycling up and down + // without the fire rate getting all wonky + self->counter--; + self->timer = HVY_CHAINGUN_MIN_RELOAD; + if (self->counter <= HVY_CHAINGUN_MIN_RELOAD - 4) { + self->counter = HVY_CHAINGUN_MIN_RELOAD; + } } - self->timer = self->counter; } else { self->counter = HVY_CHAINGUN_RELOAD; } @@ -335,7 +343,7 @@ int hvy_chaingun(struct gun *self, struct entity *parent, struct entity *target) void hvy_chaingun_new(struct gun *self, int x, int y) { self->update = hvy_chaingun; self->timer = HVY_CHAINGUN_RELOAD; - self->counter = 0; + self->counter = HVY_CHAINGUN_RELOAD; self->x = to_fixed(x); self->y = to_fixed(y); } -- cgit 1.4.1-2-gfad0