Ballsgun
authorunc0rr
Thu, 08 Jan 2009 15:42:36 +0000
changeset 1601 0cff69c8c4cf
parent 1600 305e13c5f327
child 1602 90694bfc6959
Ballsgun
QTfrontend/hwconsts.cpp.in
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uAIAmmoTests.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uLocale.pas
share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png
share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png
share/hedgewars/Data/Graphics/Balls.png
share/hedgewars/Data/Graphics/Hedgehog/amBallgun.png
share/hedgewars/Data/Locale/en.txt
share/hedgewars/Data/Locale/ru.txt
--- a/QTfrontend/hwconsts.cpp.in	Thu Jan 08 15:34:51 2009 +0000
+++ b/QTfrontend/hwconsts.cpp.in	Thu Jan 08 15:42:36 2009 +0000
@@ -29,7 +29,7 @@
 QStringList * Themes;
 QStringList * mapList;
 
-QString * cDefaultAmmoStore = new QString("93919294221991210322351110012");
+QString * cDefaultAmmoStore = new QString("939192942219912103223511100120");
 
 QColor * color1 = new QColor(221,   0,   0);
 QColor * color2 = new QColor( 67, 118, 233);
--- 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
--- a/hedgewars/HHHandlers.inc	Thu Jan 08 15:34:51 2009 +0000
+++ b/hedgewars/HHHandlers.inc	Thu Jan 08 15:42:36 2009 +0000
@@ -171,6 +171,7 @@
                   amHellishBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 5000);
                        amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
                         amDrill: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtDrill, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
+                        amBallgun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
                   end;
 
         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
--- a/hedgewars/uAIAmmoTests.pas	Thu Jan 08 15:34:51 2009 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Thu Jan 08 15:42:36 2009 +0000
@@ -73,7 +73,8 @@
 			(proc: nil;              flags: 0), // amBanana
 			(proc: nil;              flags: 0), // amHellishBomb
 			(proc: nil;              flags: 0), // amNapalm
-			(proc: nil;              flags: 0)  // amDrill
+			(proc: nil;              flags: 0),  // amDrill
+			(proc: nil;              flags: 0)  // amBallgun
 			);
 
 const BadTurn = Low(LongInt) div 4;
--- a/hedgewars/uConsts.pas	Thu Jan 08 15:34:51 2009 +0000
+++ b/hedgewars/uConsts.pas	Thu Jan 08 15:42:36 2009 +0000
@@ -49,7 +49,7 @@
 			sprHurrah, sprLemonade, sprExplPart, sprExplPart2,
 			sprCakeWalk, sprCakeDown, sprAMAmmosBW, sprWatermelon,
 			sprEvilTrace, sprHellishBomb, sprSeduction, sprDress,
-			sprCensored, sprDrill, sprHandDrill);
+			sprCensored, sprDrill, sprHandDrill, sprHandBallgun, sprBalls);
 
 	TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, // 3
 			gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, // 8
@@ -59,7 +59,7 @@
 			gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, gtGirder, // 28
 			gtTeleport, gtSwitcher, gtTarget, gtMortar, // 32
 			gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 38
-			gtHellishBomb, gtEvilTrace, gtWaterUp, gtDrill);
+			gtHellishBomb, gtEvilTrace, gtWaterUp, gtDrill, gtBallGun, gtBall);
 
 	TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
 			vgtSmallDamageTag);
@@ -81,7 +81,7 @@
 			amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip,
 			amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch,
 			amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake,
-			amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill);
+			amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun);
 
 	THWFont = (fnt16, fntBig, fntSmall);
 
@@ -449,7 +449,11 @@
 			(FileName:      'Drill'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
 			Width:  16; Height: 16; saveSurf: false),// sprDrill
 			(FileName:    'amDrill'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-			Width:  32; Height: 32; saveSurf: false)// sprHandDrill
+			Width:  32; Height: 32; saveSurf: false),// sprHandDrill
+			(FileName:    'amBallgun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+			Width:  64; Height: 64; saveSurf: false),// sprHandBallgun
+			(FileName:      'Balls'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+			Width:  32; Height: 20; saveSurf: false)// sprBalls
 			);
 
 	Wavez: array [TWave] of record
@@ -1102,7 +1106,25 @@
 			isDamaging: true;
 			SkipTurns: 0;
 			PosCount: 1;
-			PosSprite: sprDrill)
+			PosSprite: sprDrill),
+			(NameId: sidBallgun;
+			NameTex: nil;
+			Probability: 400;
+			NumberInCase: 1;
+			Ammo: (Propz:  ammoprop_ForwMsgs;
+					Count: AMMO_INFINITE;
+					NumPerTurn: 0;
+					Timer: 5001;
+					Pos: 0;
+					AmmoType: amBallgun);
+			Slot: 2;
+			TimeAfterTurn: 0;
+			minAngle: 0;
+			maxAngle: 0;
+			isDamaging: true;
+			SkipTurns: 0;
+			PosCount: 1;
+			PosSprite: sprWater)
 			);
 
 var CountTexz: array[1..9] of PTexture;
--- a/hedgewars/uGears.pas	Thu Jan 08 15:34:51 2009 +0000
+++ b/hedgewars/uGears.pas	Thu Jan 08 15:42:36 2009 +0000
@@ -145,7 +145,9 @@
 			@doStepBomb,
 			@doStepSmokeTrace,
 			@doStepWaterUp,
-			@doStepDrill
+			@doStepDrill,
+			@doStepBallgun,
+			@doStepBomb
 			);
 
 procedure InsertGearToList(Gear: PGear);
@@ -347,6 +349,16 @@
                 Result^.Timer:= 5000;
                 Result^.Radius:= 4;
                 end;
+        gtBall: begin
+                Result^.Radius:= 5;
+                Result^.Tag:= random(8);
+                Result^.Timer:= 5000;
+                Result^.Elasticity:= _0_7;
+                Result^.Friction:= _0_995;
+                end;
+     gtBallgun: begin
+                Result^.Timer:= 5001;
+                end;
      end;
 InsertGearToList(Result);
 AddGear:= Result
@@ -644,6 +656,7 @@
 					HatVisible:= true
 				end;
 			gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle);
+			gtBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle);
 			gtRope: begin
 				if Gear^.X < CurAmmoGear^.X then
 					begin
@@ -788,6 +801,7 @@
 		case amt of
 			amBazooka,
 			amMortar: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle);
+                        amBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle);
                         amDrill: DrawRotated(sprHandDrill, hx, hy, hwSign(Gear^.dX), aangle);
 			amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle);
 			amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle);
@@ -1039,6 +1053,7 @@
       begin
       case Gear^.Kind of
        gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
+       gtBall: DrawRotatedf(sprBalls, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tag,0, DxDy2Angle(Gear^.dY, Gear^.dX));
        gtDrill: DrawRotated(sprDrill, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
         gtHedgehog: DrawHH(Gear);
     gtAmmo_Grenade: DrawRotated(sprGrenade, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
--- a/hedgewars/uLocale.pas	Thu Jan 08 15:34:51 2009 +0000
+++ b/hedgewars/uLocale.pas	Thu Jan 08 15:42:36 2009 +0000
@@ -24,7 +24,7 @@
 			sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch,
 			sidGirder, sidTeleport, sidSwitch, sidMortar, sidWhip,
 			sidKamikaze, sidCake, sidSeduction, sidWatermelon,
-			sidHellishBomb, sidDrill);
+			sidHellishBomb, sidDrill, sidBallgun);
 
 	TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused,
 			sidConfirm, sidSuddenDeath);
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png has changed
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png has changed
Binary file share/hedgewars/Data/Graphics/Balls.png has changed
Binary file share/hedgewars/Data/Graphics/Hedgehog/amBallgun.png has changed
--- a/share/hedgewars/Data/Locale/en.txt	Thu Jan 08 15:34:51 2009 +0000
+++ b/share/hedgewars/Data/Locale/en.txt	Thu Jan 08 15:42:36 2009 +0000
@@ -29,6 +29,7 @@
 00:26=Watermelon Bomb
 00:27=Hellish hand-grenade
 00:28=Drill Rocket
+00:29=Ballgun
 
 01:00=Let's fight!
 01:01=Round draw
--- a/share/hedgewars/Data/Locale/ru.txt	Thu Jan 08 15:34:51 2009 +0000
+++ b/share/hedgewars/Data/Locale/ru.txt	Thu Jan 08 15:42:36 2009 +0000
@@ -29,6 +29,7 @@
 00:26=Арбузная бомба
 00:27=Адская граната
 00:28=Сверлящая ракета
+00:29=Ballgun
 
 01:00=Вперёд к победе!
 01:01=Ничья