Initial implementation of mortar
authorunc0rr
Sat, 10 May 2008 14:46:02 +0000
changeset 924 227f9fcdc2f4
parent 923 b3d097097b54
child 925 c20156328529
Initial implementation of mortar
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/Locale/en.txt
share/hedgewars/Data/Locale/pl.txt
share/hedgewars/Data/Locale/ru.txt
--- a/QTfrontend/hwconsts.cpp.in	Sat May 10 13:44:30 2008 +0000
+++ b/QTfrontend/hwconsts.cpp.in	Sat May 10 14:46:02 2008 +0000
@@ -28,7 +28,7 @@
 
 QStringList * Themes;
 
-QString * cDefaultAmmoStore = new QString("eammstore 93919294221912103323");
+QString * cDefaultAmmoStore = new QString("eammstore 939192942219121033235");
 
 QColor * color1 = new QColor(  0, 255, 255);
 QColor * color2 = new QColor(255, 127, 127);
--- a/hedgewars/GSHandlers.inc	Sat May 10 13:44:30 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Sat May 10 14:46:02 2008 +0000
@@ -95,6 +95,7 @@
 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
    begin
    Gear^.dX:= - Gear^.dX * Gear^.Elasticity;
+   Gear^.dY:=   Gear^.dY * Gear^.Elasticity;
    Gear^.State:= Gear^.State or gstCollision
    end;
 
@@ -1311,3 +1312,28 @@
      Message:= Message and not gm_Attack
      end
 end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepMortar(Gear: PGear);
+var dX, dY: hwFloat;
+    i: LongInt;
+begin
+AllInactive:= false;
+doStepFallingGear(Gear);
+if (Gear^.State and gstCollision) <> 0 then
+	begin
+	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound);
+	
+	for i:= 0 to 4 do
+		begin
+		dX:= - Gear^.dX + (GetRandom - _0_5) * _0_03;
+		dY:= - Gear^.dY + (GetRandom - _0_5) * _0_03;
+		AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 0);
+		end;
+	
+	DeleteGear(Gear);
+	exit
+	end;
+if (GameTicks and $3F) = 0 then
+	AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0)
+end;
--- a/hedgewars/HHHandlers.inc	Sat May 10 13:44:30 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Sat May 10 14:46:02 2008 +0000
@@ -126,6 +126,7 @@
                        amGirder: CurAmmoGear:= AddGear(0, 0, gtGirder, Ammo^[CurSlot, CurAmmo].Pos, _0, _0, 0);
                      amTeleport: CurAmmoGear:= AddGear(0, 0, gtTeleport, 0, _0, _0, 0);
                        amSwitch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtSwitcher, 0, _0, _0, 0);
+                       amMortar: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtMortar,  0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
                   end;
 
         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
--- a/hedgewars/uAIAmmoTests.pas	Sat May 10 13:44:30 2008 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Sat May 10 14:46:02 2008 +0000
@@ -63,7 +63,8 @@
                   (proc: nil;              flags: 0), // amBlowTorch
                   (proc: nil;              flags: 0), // amGirder
                   (proc: nil;              flags: amtest_OnTurn), // amTeleport
-                  (proc: nil;              flags: 0)  // amSwitch
+                  (proc: nil;              flags: 0), // amSwitch
+                  (proc: nil;              flags: 0)  // amMortar
                   );
 
 const BadTurn = Low(LongInt) div 4;
--- a/hedgewars/uConsts.pas	Sat May 10 13:44:30 2008 +0000
+++ b/hedgewars/uConsts.pas	Sat May 10 14:46:02 2008 +0000
@@ -52,7 +52,7 @@
                    gtTeamHealthSorter, gtClusterBomb, gtCluster, gtShover, gtFlame,
                    gtFirePunch, gtATStartGame, gtATSmoothWindCh, gtATFinishGame,
                    gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, gtGirder,
-                   gtTeleport, gtSmallDamage, gtSwitcher, gtTarget);
+                   gtTeleport, gtSmallDamage, gtSwitcher, gtTarget, gtMortar);
 
      TVisualGearType = (vgtFlake, vgtCloud);
 
@@ -69,7 +69,7 @@
      TAmmoType  = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer,
                    amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch,
                    amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch,
-                   amGirder, amTeleport, amSwitch);
+                   amGirder, amTeleport, amSwitch, amMortar);
 
      THWFont    = (fnt16, fntBig, fntSmall);
 
@@ -803,6 +803,23 @@
                                    maxAngle: 0;
                                    isDamaging: false;
                                    PosCount: 1;
+                                   PosSprite: sprWater),
+                                  (NameId: sidMortar;
+                                   NameTex: nil;
+                                   Probability: 100;
+                                   NumberInCase: 5;
+                                   Ammo: (Propz: 0;
+                                          Count: 5;
+                                          NumPerTurn: 0;
+                                          Timer: 0;
+                                          Pos: 0;
+                                          AmmoType: amMortar);
+                                   Slot: 1;
+                                   TimeAfterTurn: 3000;
+                                   minAngle: 0;
+                                   maxAngle: 0;
+                                   isDamaging: true;
+                                   PosCount: 1;
                                    PosSprite: sprWater));
 
 var CountTexz: array[1..9] of PTexture;
--- a/hedgewars/uGears.pas	Sat May 10 13:44:30 2008 +0000
+++ b/hedgewars/uGears.pas	Sat May 10 14:46:02 2008 +0000
@@ -133,7 +133,8 @@
                                                                @doStepTeleport,
                                                                @doStepHealthTag,
                                                                @doStepSwitcher,
-                                                               @doStepCase
+                                                               @doStepCase,
+                                                               @doStepMortar
                                                                );
 
 procedure InsertGearToList(Gear: PGear);
@@ -298,6 +299,10 @@
                 Result^.Radius:= 16;
                 Result^.Elasticity:= _0_3
                 end;
+      gtMortar: begin
+                Result^.Elasticity:= _0_2;
+                Result^.Friction:= _0_08
+                end;
      end;
 InsertGearToList(Result);
 AddGear:= Result
--- a/hedgewars/uLocale.pas	Sat May 10 13:44:30 2008 +0000
+++ b/hedgewars/uLocale.pas	Sat May 10 14:46:02 2008 +0000
@@ -22,7 +22,7 @@
                    sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
                    sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds,
                    sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch,
-                   sidGirder, sidTeleport, sidSwitch);
+                   sidGirder, sidTeleport, sidSwitch, sidMortar);
 
      TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused);
 
--- a/share/hedgewars/Data/Locale/en.txt	Sat May 10 13:44:30 2008 +0000
+++ b/share/hedgewars/Data/Locale/en.txt	Sat May 10 14:46:02 2008 +0000
@@ -20,7 +20,8 @@
 00:17=Blow Torch
 00:18=Construction
 00:19=Teleportation
-00:20=SwitchHedgehog
+00:20=Switch Hedgehog
+00:21=Mortar
 
 01:00=Let's fight!
 01:01=Round draw
--- a/share/hedgewars/Data/Locale/pl.txt	Sat May 10 13:44:30 2008 +0000
+++ b/share/hedgewars/Data/Locale/pl.txt	Sat May 10 14:46:02 2008 +0000
@@ -21,6 +21,7 @@
 00:18=Budowanie
 00:19=Teleportacja
 00:20=Zmień jeża
+00:21=Mortar
 
 01:00=Walczmy!
 01:01=Remis
--- a/share/hedgewars/Data/Locale/ru.txt	Sat May 10 13:44:30 2008 +0000
+++ b/share/hedgewars/Data/Locale/ru.txt	Sat May 10 14:46:02 2008 +0000
@@ -21,6 +21,7 @@
 00:18=Конструктор
 00:19=Телепортация
 00:20=Переключить ежа
+00:21=Миномёт
 
 01:00=Вперёд к победе!
 01:01=Ничья