Engine:
authorsmaxx
Tue, 03 Aug 2010 14:19:47 +0200
changeset 3717 d88719b0f0dc
parent 3716 3a2ee9533e3e
child 3718 0039842ebba0
Engine: * Added a new weapon: Hammer: Crush half your enemies' health and let them break through thin floors! (Might need some visual improvements) * Removed orientation code from sticky mines due to their new graphics * Added an attachment sound to sticky mines Frontend: * Added the hammer to predefined weapon sets
QTfrontend/hwconsts.cpp.in
hedgewars/GSHandlers.inc
hedgewars/GearDrawing.inc
hedgewars/HHHandlers.inc
hedgewars/uAIAmmoTests.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uLocale.pas
share/hedgewars/Data/Graphics/Hedgehog/amHammer.png
share/hedgewars/Data/Locale/en.txt
--- a/QTfrontend/hwconsts.cpp.in	Tue Aug 03 12:52:21 2010 +0100
+++ b/QTfrontend/hwconsts.cpp.in	Tue Aug 03 14:19:47 2010 +0200
@@ -31,10 +31,10 @@
 QStringList * mapList;
 
 QString * cDefaultAmmoStore = new QString(
-        "93919294221991210322351110012010000002111101110"
-        "04050405416006555465544647765766666661555101111"
-        "00000000000002055000000400070040000000002000000"
-        "13111103121111111231141111111111111112111111112"
+        "939192942219912103223511100120100000021111011101"
+        "040504054160065554655446477657666666615551011111"
+        "000000000000020550000004000700400000000020000000"
+        "131111031211111112311411111111111111121111111121"
 		);
 int cAmmoNumber = cDefaultAmmoStore->size() / 4;
 
@@ -42,30 +42,30 @@
 	QList< QPair<QString, QString> >()
 	<< qMakePair(QString("Default"), *cDefaultAmmoStore)
 	<< qMakePair(QString("Crazy"),     QString(
-        "99999999999999999929999999999999992999999999999" // TODO: Remove Piano's unlimited uses!
-        "11111101111111111111111111111111111111111111111"
-        "00000000000000000000000000000000000000000000000"
-        "13111103121111111231141111111111111112111101011"))
+        "999999999999999999299999999999999929999999999999" // TODO: Remove Piano's unlimited uses!
+        "111111011111111111111111111111111111111111111111"
+        "000000000000000000000000000000000000000000000000"
+        "131111031211111112311411111111111111121111010111"))
 	<< qMakePair(QString("Pro mode"),  QString(
-        "90900090000000000000090000000000000000000009000"
-        "00000000000000000000000000000000000000000000000"
-        "00000000000002055000000400070040000000002000000"
-        "11111111111111111111111111111111111111111001112"))
+        "909000900000000000000900000000000000000000090000"
+        "000000000000000000000000000000000000000000000000"
+        "000000000000020550000004000700400000000020000000"
+        "111111111111111111111111111111111111111110011121"))
 	<< qMakePair(QString("Shoppa"),    QString(
-        "00000099000000000000000000000000000000000000000"
-        "44444100442444022101121212224220000000020004000"
-        "00000000000000000000000000000000000000000000000"
-        "11111111111111111111111111111111111111111011111"))
+        "000000990000000000000000000000000000000000000000"
+        "444441004424440221011212122242200000000200040001"
+        "000000000000000000000000000000000000000000000000"
+        "111111111111111111111111111111111111111110111111"))
 	<< qMakePair(QString("Basketball"),QString(
-		"00000090000009000000000000000000000000000000000"
-		"00000000000000000000000000000000000000000000000"
-		"00000000000000055000000400070040000000002000000"
-		"11111111111111111111111111111111111111111111111"))
+		"000000900000090000000000000000000000000000000000"
+		"000000000000000000000000000000000000000000000000"
+		"000000000000000550000004000700400000000020000000"
+		"111111111111111111111111111111111111111111111111"))
 	<< qMakePair(QString("Minefield"), QString(
-		"00000099000900000003000000000000000000000000000"
-		"00000000000000000000000000000000000000000000000"
-		"00000000000002055000000400070040000000002000000"
-		"11111111111111111111111111111111111111111111111"))
+		"000000990009000000030000000000000000000000000000"
+		"000000000000000000000000000000000000000000000000"
+		"000000000000020550000004000700400000000020000000"
+		"111111111111111111111111111111111111111111111111"))
 	;
 
 QColor * color1 = new QColor(221,   0,   0);
--- a/hedgewars/GSHandlers.inc	Tue Aug 03 12:52:21 2010 +0100
+++ b/hedgewars/GSHandlers.inc	Tue Aug 03 14:19:47 2010 +0200
@@ -1445,53 +1445,12 @@
 begin
     DeleteCI(Gear);
     // TODO: do real calculation?
-    if TestCollisionXwithGear(Gear, 2) and TestCollisionYwithGear(Gear, -2) then
-    begin
-        Gear^.dX:= _0;
-        Gear^.dY:= _0;
-        Gear^.DirAngle:= 225
-    end
-    else if TestCollisionXwithGear(Gear, -2) and TestCollisionYwithGear(Gear, -2) then
+    if TestCollisionXwithGear(Gear, 2) or TestCollisionYwithGear(Gear, -2) or TestCollisionXwithGear(Gear, -2) or TestCollisionYwithGear(Gear, 2) then
     begin
-        Gear^.dX:= _0;
-        Gear^.dY:= _0;
-        Gear^.DirAngle:= 135
-    end
-    else if TestCollisionXwithGear(Gear, 2) and TestCollisionYwithGear(Gear, 2) then
-    begin
-        Gear^.dX:= _0;
-        Gear^.dY:= _0;
-        Gear^.DirAngle:= 315
-    end
-    else if TestCollisionXwithGear(Gear, -2) and TestCollisionYwithGear(Gear, 2) then
-    begin
+        if (hwAbs(Gear^.dX) > _0) or (hwAbs(Gear^.dY) > _0) then
+            PlaySound(sndRopeAttach);
         Gear^.dX:= _0;
         Gear^.dY:= _0;
-        Gear^.DirAngle:= 45
-    end
-    else if TestCollisionYwithGear(Gear, -2) then
-    begin
-        Gear^.dX:= _0;
-        Gear^.dY:= _0;
-        Gear^.DirAngle:= 180
-    end
-    else if TestCollisionYwithGear(Gear, 2) then
-    begin
-        Gear^.dX:= _0;
-        Gear^.dY:= _0;
-        Gear^.DirAngle:= 0
-    end
-    else if TestCollisionXwithGear(Gear, -2) then
-    begin
-        Gear^.dX:= _0;
-        Gear^.dY:= _0;
-        Gear^.DirAngle:= 90
-    end
-    else if TestCollisionXwithGear(Gear, 2) then
-    begin
-        Gear^.dX:= _0;
-        Gear^.dY:= _0;
-        Gear^.DirAngle:= 270
     end
     else
     begin
@@ -3919,4 +3878,41 @@
     if (GameTicks mod 250) = 0 then
         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned);
     AllInactive:= false;
-end;
\ No newline at end of file
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepHammer(Gear: PGear);
+var HHGear, tmp: PGear;
+         t: PGearArray;
+         i: LongInt;
+         dust: PVisualGear;
+begin
+HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+HHGear^.State:= HHGear^.State or gstNoDamage;
+DeleteCI(HHGear);
+
+t:= CheckGearsCollision(Gear);
+i:= t^.Count;
+while i > 0 do
+    begin
+    dec(i);
+    tmp:= t^.ar[i];
+    if (tmp^.State and gstNoDamage) = 0 then
+        if (tmp^.Kind = gtHedgehog) then
+            begin
+            //tmp^.State:= tmp^.State or gstFlatened;
+            ApplyDamage(tmp, tmp^.Health div 2, dsUnknown);
+            DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
+            for i:= 5 downto 0 do
+                dust := AddVisualGear(hwRound(tmp^.X) - 5 + Random(10), hwRound(tmp^.Y) + 12, vgtDust);
+            SetAllToActive
+            end
+        else
+            begin
+            end
+    end;
+
+HHGear^.State:= HHGear^.State and not gstNoDamage;
+Gear^.Timer:= 250;
+Gear^.doStep:= @doStepIdle
+end;
--- a/hedgewars/GearDrawing.inc	Tue Aug 03 12:52:21 2010 +0100
+++ b/hedgewars/GearDrawing.inc	Tue Aug 03 14:19:47 2010 +0200
@@ -264,6 +264,15 @@
                         0);
                 defaultPos:= false
                 end;
+            gtHammer: begin
+                DrawRotatedF(sprHammer,
+                        sx,
+                        sy,
+                        1,
+                        hwSign(Gear^.dX),
+                        0);
+                defaultPos:= false
+                end;
             gtKamikaze: begin
                 if CurAmmoGear^.Pos = 0 then
                     DrawHedgehog(sx, sy,
@@ -439,6 +448,12 @@
                         0,
                         hwSign(Gear^.dX),
                         0);
+            amHammer: DrawRotatedF(sprHammer,
+                        sx,
+                        sy,
+                        0,
+                        hwSign(Gear^.dX),
+                        0);
         else
             DrawHedgehog(sx, sy,
                 hwSign(Gear^.dX),
--- a/hedgewars/HHHandlers.inc	Tue Aug 03 12:52:21 2010 +0100
+++ b/hedgewars/HHHandlers.inc	Tue Aug 03 14:19:47 2010 +0200
@@ -198,6 +198,10 @@
                                  CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
                                  PlaySound(sndWhipCrack)
                                  end;
+                       amHammer: begin
+                                 CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtHammer, 0, SignAs(_1, dX), - _0_8, 0);
+                                 PlaySound(sndWhack)
+                                 end;
                   amBaseballBat: begin
                                  CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtShover, gsttmpFlag, xx * _0_5, yy * _0_5, 0);
                                  PlaySound(sndBaseballBat) // TODO: Only play if something is hit?
--- a/hedgewars/uAIAmmoTests.pas	Tue Aug 03 12:52:21 2010 +0100
+++ b/hedgewars/uAIAmmoTests.pas	Tue Aug 03 14:19:47 2010 +0200
@@ -98,7 +98,8 @@
             (proc: @TestGrenade;     flags: 0), // amGasBomb
             (proc: @TestShotgun;     flags: 0), // amSineGun
             (proc: nil;              flags: 0), // amFlamethrower
-            (proc: @TestGrenade;     flags: 0)  // amSMine
+            (proc: @TestGrenade;     flags: 0), // amSMine
+            (proc: @TestFirePunch;   flags: 0)  // amHammer
             );
 
 const BadTurn = Low(LongInt) div 4;
--- a/hedgewars/uConsts.pas	Tue Aug 03 12:52:21 2010 +0100
+++ b/hedgewars/uConsts.pas	Tue Aug 03 14:19:47 2010 +0200
@@ -74,7 +74,7 @@
             sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee,
             sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal,
             sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote,
-            sprSMineOff, sprSMineOn, sprHandSMine
+            sprSMineOff, sprSMineOn, sprHandSMine, sprHammer
             );
 
     // Gears that interact with other Gears and/or Land
@@ -88,7 +88,7 @@
             gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40
             gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45
             gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51
-            gtSMine, gtPoisonCloud);
+            gtSMine, gtPoisonCloud, gtHammer);
 
     // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
     TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
@@ -122,7 +122,7 @@
             sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
             sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
             sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8,
-            sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3);
+            sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack);
 
     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer,
             amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip,
@@ -131,7 +131,7 @@
             amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun,
             amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime,
             amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun,
-            amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine);
+            amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer);
 
     THWFont = (fnt16, fntBig, fntSmall, CJKfnt16, CJKfntBig, CJKfntSmall);
 
@@ -801,8 +801,10 @@
             Width:   8; Height:  8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSMineOff
             (FileName:    'SMineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
             Width:   8; Height:  8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSMineOn
-            (FileName:  'amSMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprHandSMine
+            (FileName:   'amSMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSMine
+            (FileName:  'amHammer'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width: 128; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprWhip
             );
 
     Wavez: array [TWave] of record
@@ -929,7 +931,8 @@
             (FileName:          'shotgunfire.ogg'; Path: ptSounds),// sndSineGun
             (FileName:                'Ooff1.ogg'; Path: ptVoices),// sndOoff1
             (FileName:                'Ooff2.ogg'; Path: ptVoices),// sndOoff2
-            (FileName:                'Ooff3.ogg'; Path: ptVoices) // sndOoff3
+            (FileName:                'Ooff3.ogg'; Path: ptVoices),// sndOoff3
+            (FileName:            'whipcrack.ogg'; Path: ptSounds) // sndWhack
             );
 
     Ammoz: array [TAmmoType] of record
@@ -2155,7 +2158,7 @@
             ejectX: 0; //20;
             ejectY: -3),
 
-// Mine
+// Sticky Mine
             (NameId: sidSMine;
             NameTex: nil;
             Probability: 100;
@@ -2177,6 +2180,30 @@
             PosCount: 1;
             PosSprite: sprWater;
             ejectX: 0;
+            ejectY: 0),
+
+// Hammer
+            (NameId: sidHammer;
+            NameTex: nil;
+            Probability: 0;
+            NumberInCase: 1;
+            Ammo: (Propz: ammoprop_NoCrosshair;
+                Count: 1;
+                InitialCount: 1;
+                NumPerTurn: 0;
+                Timer: 0;
+                Pos: 0;
+                AmmoType: amHammer;
+                AttackVoice: sndNone);
+            Slot: 3;
+            TimeAfterTurn: 3000;
+            MinAngle: 0;
+            maxAngle: 0;
+            isDamaging: true;
+            SkipTurns: 0;
+            PosCount: 1;
+            PosSprite: sprWater;
+            ejectX: 0;
             ejectY: 0)
             );
 
--- a/hedgewars/uGears.pas	Tue Aug 03 12:52:21 2010 +0100
+++ b/hedgewars/uGears.pas	Tue Aug 03 14:19:47 2010 +0200
@@ -203,7 +203,8 @@
             @doStepSineGunShot,
             @doStepFlamethrower,
             @doStepSMine,
-            @doStepPoisonCloud
+            @doStepPoisonCloud,
+            @doStepHammer
             );
 
 procedure InsertGearToList(Gear: PGear);
@@ -434,6 +435,7 @@
                 gear^.Friction:= _0_08
                 end;
         gtWhip: gear^.Radius:= 20;
+      gtHammer: gear^.Radius:= 20;
     gtKamikaze: begin
                 gear^.Health:= 2048;
                 gear^.Radius:= 20
--- a/hedgewars/uLocale.pas	Tue Aug 03 12:52:21 2010 +0100
+++ b/hedgewars/uLocale.pas	Tue Aug 03 14:19:47 2010 +0200
@@ -30,7 +30,7 @@
             sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime,
             sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack,
             sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, sidSineGun, sidFlamethrower,
-            sidSMine);
+            sidSMine, sidHammer);
 
     TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused,
             sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,
Binary file share/hedgewars/Data/Graphics/Hedgehog/amHammer.png has changed
--- a/share/hedgewars/Data/Locale/en.txt	Tue Aug 03 12:52:21 2010 +0100
+++ b/share/hedgewars/Data/Locale/en.txt	Tue Aug 03 14:19:47 2010 +0200
@@ -48,6 +48,7 @@
 00:45=Sine Gun
 00:46=Flamethrower
 00:47=Sticky Mine
+00:48=Hammer
 
 01:00=Let's fight!
 01:01=Round draw