hedgewars/GSHandlers.inc
changeset 1601 0cff69c8c4cf
parent 1590 646d56eacb8f
child 1603 dbcb2d531fad
--- a/hedgewars/GSHandlers.inc	Thu Jan 08 15:34:51 2009 +0000
+++ b/hedgewars/GSHandlers.inc	Thu Jan 08 15:42:36 2009 +0000
@@ -133,6 +133,7 @@
 	begin
 	case Gear^.Kind of
 		gtAmmo_Bomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
+		     gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 15, EXPLAutoSound);
 		gtClusterBomb: begin
 				doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound);
 				for i:= 0 to 4 do
@@ -1899,3 +1900,33 @@
 		Gear^.Timer:= 0
 	end
 end;
+
+procedure doStepBallgunWork(Gear: PGear);
+var HHGear: PGear;
+begin
+	AllInactive:= false;
+	dec(Gear^.Timer);
+	HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+	HedgehogChAngle(HHGear);
+	if (Gear^.Timer mod 100) = 0 then
+		begin
+		AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtBall, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX)+ rndSign(getRandom * _0_1), AngleCos(HHGear^.Angle) * ( - _0_8) + rndSign(getRandom * _0_1), 0);
+		
+		PlaySound(sndGun, false);
+		end;
+
+	if (Gear^.Timer = 0) then
+		begin
+		DeleteGear(Gear);
+		AfterAttack;
+	end
+end;
+
+procedure doStepBallgun(Gear: PGear);
+var HHGear: PGear;
+begin
+HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Down);
+HHGear^.State:= HHGear^.State or gstNotKickable;
+Gear^.doStep:= @doStepBallgunWork
+end;
\ No newline at end of file