Engine:
authorsmaxx
Mon, 02 Aug 2010 18:19:55 +0200
changeset 3710 411f5c2b5292
parent 3709 c7849b74748d
child 3711 de3b3df215c3
Engine: * Added sticky mines (still missing proper alignment once sticky) Frontend: * Added sticky mines
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/AmmoMenu/Ammos.png
share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png
share/hedgewars/Data/Graphics/Hedgehog/amSMine.png
share/hedgewars/Data/Graphics/SMineOff.png
share/hedgewars/Data/Graphics/SMineOn.png
share/hedgewars/Data/Locale/en.txt
--- a/QTfrontend/hwconsts.cpp.in	Mon Aug 02 18:13:29 2010 +0200
+++ b/QTfrontend/hwconsts.cpp.in	Mon Aug 02 18:19:55 2010 +0200
@@ -31,10 +31,10 @@
 QStringList * mapList;
 
 QString * cDefaultAmmoStore = new QString(
-        "9391929422199121032235111001201000000211110111"
-        "0405040541600655546554464776576666666155510111"
-        "0000000000000205500000040007004000000000200000"
-        "1311110312111111123114111111111111111211111111"
+        "93919294221991210322351110012010000002111101110"
+        "04050405416006555465544647765766666661555101111"
+        "00000000000002055000000400070040000000002000000"
+        "13111103121111111231141111111111111112111111112"
 		);
 int cAmmoNumber = cDefaultAmmoStore->size() / 4;
 
@@ -42,30 +42,30 @@
 	QList< QPair<QString, QString> >()
 	<< qMakePair(QString("Default"), *cDefaultAmmoStore)
 	<< qMakePair(QString("Crazy"),     QString(
-        "9999999999999999992999999999999999299999999999" // TODO: Remove Piano's unlimited uses!
-        "1111110111111111111111111111111111111111111111"
-        "0000000000000000000000000000000000000000000000"
-        "1311110312111111123114111111111111111211110101"))
+        "99999999999999999929999999999999992999999999999" // TODO: Remove Piano's unlimited uses!
+        "11111101111111111111111111111111111111111111111"
+        "00000000000000000000000000000000000000000000000"
+        "13111103121111111231141111111111111112111101011"))
 	<< qMakePair(QString("Pro mode"),  QString(
-        "9090009000000000000009000000000000000000000900"
-        "0000000000000000000000000000000000000000000000"
-        "0000000000000205500000040007004000000000200000"
-        "1111111111111111111111111111111111111111100111"))
+        "90900090000000000000090000000000000000000009000"
+        "00000000000000000000000000000000000000000000000"
+        "00000000000002055000000400070040000000002000000"
+        "11111111111111111111111111111111111111111001112"))
 	<< qMakePair(QString("Shoppa"),    QString(
-        "0000009900000000000000000000000000000000000000"
-        "4444410044244402210112121222422000000002000400"
-        "0000000000000000000000000000000000000000000000"
-        "1111111111111111111111111111111111111111101111"))
+        "00000099000000000000000000000000000000000000000"
+        "44444100442444022101121212224220000000020004000"
+        "00000000000000000000000000000000000000000000000"
+        "11111111111111111111111111111111111111111011111"))
 	<< qMakePair(QString("Basketball"),QString(
-		"0000009000000900000000000000000000000000000000"
-		"0000000000000000000000000000000000000000000000"
-		"0000000000000005500000040007004000000000200000"
-		"1111111111111111111111111111111111111111111111"))
+		"00000090000009000000000000000000000000000000000"
+		"00000000000000000000000000000000000000000000000"
+		"00000000000000055000000400070040000000002000000"
+		"11111111111111111111111111111111111111111111111"))
 	<< qMakePair(QString("Minefield"), QString(
-		"0000009900090000000300000000000000000000000000"
-		"0000000000000000000000000000000000000000000000"
-		"0000000000000205500000040007004000000000200000"
-		"1111111111111111111111111111111111111111111111"))
+		"00000099000900000003000000000000000000000000000"
+		"00000000000000000000000000000000000000000000000"
+		"00000000000002055000000400070040000000002000000"
+		"11111111111111111111111111111111111111111111111"))
 	;
 
 QColor * color1 = new QColor(221,   0,   0);
--- a/hedgewars/GSHandlers.inc	Mon Aug 02 18:13:29 2010 +0200
+++ b/hedgewars/GSHandlers.inc	Mon Aug 02 18:19:55 2010 +0200
@@ -1436,6 +1436,55 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
+procedure doStepSMine(Gear: PGear);
+begin
+    if (Gear^.State and gstMoving) <> 0 then
+    begin
+        if ((Gear^.State and gstCollision) <> 0) and (Gear^.dX < _0_2) and (Gear^.dY < _0_2) then
+        begin
+            Gear^.dX := _0;
+            Gear^.dY := _0
+            // TODO: calc attach dir
+        end
+        else
+            CalcRotationDirAngle(Gear);
+
+        DeleteCI(Gear);
+        doStepFallingGear(Gear);
+        if (Gear^.State and gstMoving) = 0 then
+            AddGearCI(Gear);
+        AllInactive := false
+    end
+    else
+    begin
+        if ((GameTicks and $3F) = 25) then
+            doStepFallingGear(Gear);
+    end;
+
+    if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
+        if ((Gear^.State and gstAttacking) = 0) then
+        begin
+            if ((GameTicks and $1F) = 0) then
+                if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear^.State := Gear^.State or
+                                                                                      gstAttacking
+        end
+    else // gstAttacking <> 0
+    begin
+        AllInactive := false;
+        if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
+        if Gear^.Timer = 0 then
+        begin
+            doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
+            DeleteGear(Gear);
+            exit
+        end;
+        dec(Gear^.Timer);
+    end
+    else // gsttmpFlag = 0
+        if TurnTimeLeft = 0 then Gear^.State := Gear^.State or gsttmpFlag;
+end;
+
+////////////////////////////////////////////////////////////////////////////////
 procedure doStepDynamite(Gear: PGear);
 begin
     doStepFallingGear(Gear);
--- a/hedgewars/GearDrawing.inc	Mon Aug 02 18:13:29 2010 +0200
+++ b/hedgewars/GearDrawing.inc	Mon Aug 02 18:19:55 2010 +0200
@@ -398,6 +398,7 @@
             amHellishBomb: DrawRotated(sprHandHellish, hx, hy, hwSign(Gear^.dX), aangle);
             amGasBomb: DrawRotated(sprHandCheese, hx, hy, hwSign(Gear^.dX), aangle);
             amMine: DrawRotated(sprHandMine, hx, hy, hwSign(Gear^.dX), aangle);
+            amSMine: DrawRotated(sprHandSMine, hx, hy, hwSign(Gear^.dX), aangle);
             amSeduction: DrawRotated(sprHandSeduction, hx, hy, hwSign(Gear^.dX), aangle);
             amVampiric: DrawRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, hwSign(Gear^.dX), aangle);
             amRCPlane: begin
@@ -692,6 +693,10 @@
                            DrawRotated(sprMineOff, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle)
                        else if Gear^.Health <> 0 then DrawRotated(sprMineOn, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle)
                        else DrawRotated(sprMineDead, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
+           gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
+                           DrawRotated(sprSMineOff, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle)
+                       else if Gear^.Health <> 0 then DrawRotated(sprSMineOn, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle)
+                       else DrawRotated(sprMineDead, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
             gtCase: case Gear^.Pos of
                          posCaseAmmo  : begin
                                         i:= (GameTicks shr 6) mod 64;
--- a/hedgewars/HHHandlers.inc	Mon Aug 02 18:13:29 2010 +0200
+++ b/hedgewars/HHHandlers.inc	Mon Aug 02 18:19:55 2010 +0200
@@ -184,6 +184,7 @@
                          amSkip: ParseCommand('/skip', true);
                          amRope: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
                          amMine: AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
+                        amSMine: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
                        amDEagle: CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
                       amSineGun: CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
                     amPortalGun: AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, 0);
--- a/hedgewars/uAIAmmoTests.pas	Mon Aug 02 18:13:29 2010 +0200
+++ b/hedgewars/uAIAmmoTests.pas	Mon Aug 02 18:19:55 2010 +0200
@@ -97,7 +97,8 @@
             (proc: nil;              flags: 0), // amPiano
             (proc: @TestGrenade;     flags: 0), // amGasBomb
             (proc: @TestShotgun;     flags: 0), // amSineGun
-            (proc: nil;              flags: 0)  // amFlamethrower
+            (proc: nil;              flags: 0), // amFlamethrower
+            (proc: @TestGrenade;     flags: 0)  // amSMine
             );
 
 const BadTurn = Low(LongInt) div 4;
--- a/hedgewars/uConsts.pas	Mon Aug 02 18:13:29 2010 +0200
+++ b/hedgewars/uConsts.pas	Mon Aug 02 18:19:55 2010 +0200
@@ -73,7 +73,8 @@
             sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp,
             sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee,
             sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal,
-            sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote
+            sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote,
+            sprSMineOff, sprSMineOn, sprHandSMine
             );
 
     // Gears that interact with other Gears and/or Land
@@ -86,7 +87,8 @@
             gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 34
             gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40
             gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45
-            gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower); // 51
+            gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51
+            gtSMine);
 
     // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
     TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
@@ -129,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);
+            amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine);
 
     THWFont = (fnt16, fntBig, fntSmall, CJKfnt16, CJKfntBig, CJKfntSmall);
 
@@ -793,7 +795,13 @@
             (FileName:  'Chunk'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
             Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprChunk
             (FileName:  'Note'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprNote
+            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprNote
+            (FileName:   'SMineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            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
             );
 
     Wavez: array [TWave] of record
@@ -2144,7 +2152,31 @@
             PosCount: 1;
             PosSprite: sprWater;
             ejectX: 0; //20;
-            ejectY: -3)
+            ejectY: -3),
+
+// Mine
+            (NameId: sidSMine;
+            NameTex: nil;
+            Probability: 100;
+            NumberInCase: 1;
+            Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
+                Count: 2;
+                InitialCount: 0;
+                NumPerTurn: 0;
+                Timer: 0;
+                Pos: 0;
+                AmmoType: amSMine;
+                AttackVoice: sndLaugh);
+            Slot: 4;
+            TimeAfterTurn: 5000;
+            minAngle: 0;
+            maxAngle: 0;
+            isDamaging: true;
+            SkipTurns: 0;
+            PosCount: 1;
+            PosSprite: sprWater;
+            ejectX: 0;
+            ejectY: 0)
             );
 
 
--- a/hedgewars/uGears.pas	Mon Aug 02 18:13:29 2010 +0200
+++ b/hedgewars/uGears.pas	Mon Aug 02 18:19:55 2010 +0200
@@ -201,7 +201,8 @@
             @doStepPiano,
             @doStepBomb,
             @doStepSineGunShot,
-            @doStepFlamethrower
+            @doStepFlamethrower,
+            @doStepSMine
             );
 
 procedure InsertGearToList(Gear: PGear);
@@ -354,6 +355,14 @@
                 else
                     gear^.Timer:= cMinesTime*1;
                 end;
+       gtSMine: begin
+                gear^.Health:= 10;
+                gear^.State:= gear^.State or gstMoving;
+                gear^.Radius:= 2;
+                gear^.Elasticity:= _0_55;
+                gear^.Friction:= _0_995;
+                gear^.Timer:= 500;
+                end;
         gtCase: begin
                 gear^.ImpactSound:= sndGraveImpact;
                 gear^.nImpactSounds:= 1;
@@ -1211,6 +1220,7 @@
         case Gear^.Kind of
             gtHedgehog,
                 gtMine,
+                gtSMine,
                 gtCase,
                 gtTarget,
                 gtFlame,
@@ -1286,6 +1296,7 @@
     case t^.Kind of
         gtHedgehog,
             gtMine,
+            gtSMine,
             gtCase,
             gtTarget,
             gtExplosives: begin
@@ -1340,6 +1351,7 @@
         case Gear^.Kind of
             gtHedgehog,
             gtMine,
+            gtSMine,
             gtTarget,
             gtCase,
             gtExplosives: begin
--- a/hedgewars/uLocale.pas	Mon Aug 02 18:13:29 2010 +0200
+++ b/hedgewars/uLocale.pas	Mon Aug 02 18:19:55 2010 +0200
@@ -29,7 +29,8 @@
             sidHellishBomb, sidDrill, sidBallgun, sidNapalm, sidRCPlane,
             sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime,
             sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack,
-            sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, sidSineGun, sidFlamethrower);
+            sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, sidSineGun, sidFlamethrower,
+            sidSMine);
 
     TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused,
             sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,
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/Hedgehog/amSMine.png has changed
Binary file share/hedgewars/Data/Graphics/SMineOff.png has changed
Binary file share/hedgewars/Data/Graphics/SMineOn.png has changed
--- a/share/hedgewars/Data/Locale/en.txt	Mon Aug 02 18:13:29 2010 +0200
+++ b/share/hedgewars/Data/Locale/en.txt	Mon Aug 02 18:19:55 2010 +0200
@@ -47,6 +47,7 @@
 00:44=Old Limburger
 00:45=Sine Gun
 00:46=Flamethrower
+00:47=Sticky Mine
 
 01:00=Let's fight!
 01:01=Round draw