summary refs log tree commit diff
path: root/src/hvy_guns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hvy_guns.c')
-rw-r--r--src/hvy_guns.c12
1 files changed, 10 insertions, 2 deletions
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);
 }