A bit more on the knife. Also add missing files to CMakeLists
authornemo
Mon, 08 Oct 2012 13:27:46 -0400
changeset 7730 2013733f9ca9
parent 7729 c374746bb56e
child 7731 262228c64f15
A bit more on the knife. Also add missing files to CMakeLists
QTfrontend/hwconsts.h
hedgewars/CMakeLists.txt
hedgewars/GSHandlers.inc
hedgewars/uAIAmmoTests.pas
hedgewars/uGears.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png
share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png
share/hedgewars/Data/Graphics/knife.png
share/hedgewars/Data/Locale/en.txt
--- a/QTfrontend/hwconsts.h	Sun Oct 07 16:44:16 2012 -0400
+++ b/QTfrontend/hwconsts.h	Mon Oct 08 13:27:46 2012 -0400
@@ -63,40 +63,40 @@
 
 #define HEDGEHOGS_PER_TEAM           8
 
-#define AMMOLINE_DEFAULT_QT     "9391929422199121032235111001201000000211110101011111011"
-#define AMMOLINE_DEFAULT_PROB   "0405040541600655546554464776576666666155510101115411011"
-#define AMMOLINE_DEFAULT_DELAY  "0000000000000205500000040007004000000000220000000600000"
-#define AMMOLINE_DEFAULT_CRATE  "1311110312111111123114111111111111111211111101111111010"
+#define AMMOLINE_DEFAULT_QT     "93919294221991210322351110012010000002111101010111110111"
+#define AMMOLINE_DEFAULT_PROB   "04050405416006555465544647765766666661555101011154110111"
+#define AMMOLINE_DEFAULT_DELAY  "00000000000002055000000400070040000000002200000006000000"
+#define AMMOLINE_DEFAULT_CRATE  "13111103121111111231141111111111111112111111011111110101"
 
-#define AMMOLINE_CRAZY_QT       "9999999999999999992999999999999999299999999909999992099"
-#define AMMOLINE_CRAZY_PROB     "1111110111111111111111111111111111111111111101111111011"
-#define AMMOLINE_CRAZY_DELAY    "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CRAZY_CRATE    "1311110312111111123114111111111111111211110101111111011"
+#define AMMOLINE_CRAZY_QT       "99999999999999999929999999999999992999999999099999920999"
+#define AMMOLINE_CRAZY_PROB     "11111101111111111111111111111111111111111111011111110111"
+#define AMMOLINE_CRAZY_DELAY    "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CRAZY_CRATE    "13111103121111111231141111111111111112111101011111110111"
 
-#define AMMOLINE_PROMODE_QT     "9090009000000000000009000000000000000000000000000000000"
-#define AMMOLINE_PROMODE_PROB   "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_PROMODE_DELAY  "0000000000000205500000040007004000000000200000000000000"
-#define AMMOLINE_PROMODE_CRATE  "1111111111111111111111111111111111111111100101111111011"
+#define AMMOLINE_PROMODE_QT     "90900090000000000000090000000000000000000000000000000001"
+#define AMMOLINE_PROMODE_PROB   "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_PROMODE_DELAY  "00000000000002055000000400070040000000002000000000000009"
+#define AMMOLINE_PROMODE_CRATE  "11111111111111111111111111111111111111111001011111110111"
 
-#define AMMOLINE_SHOPPA_QT      "0000009900000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_PROB    "4444410044244402210112121222422000000002000400010011000"
-#define AMMOLINE_SHOPPA_DELAY   "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_CRATE   "1111111111111111111111111111111111111111101101111111001"
+#define AMMOLINE_SHOPPA_QT      "00000099000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_PROB    "44444100442444022101121212224220000000020004000100110000"
+#define AMMOLINE_SHOPPA_DELAY   "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_CRATE   "11111111111111111111111111111111111111111011011111110011"
 
-#define AMMOLINE_CLEAN_QT       "1010009000010000011000000000000000000000000000001000000"
-#define AMMOLINE_CLEAN_PROB     "0405040541600655546554464776576666666155510101115411011"
-#define AMMOLINE_CLEAN_DELAY    "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CLEAN_CRATE    "1311110312111111123114111111111111111211111101111111011"
+#define AMMOLINE_CLEAN_QT       "10100090000100000110000000000000000000000000000010000000"
+#define AMMOLINE_CLEAN_PROB     "04050405416006555465544647765766666661555101011154110111"
+#define AMMOLINE_CLEAN_DELAY    "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CLEAN_CRATE    "13111103121111111231141111111111111112111111011111110111"
 
-#define AMMOLINE_MINES_QT       "0000009900090000000300000000000000000000000000000000000"
-#define AMMOLINE_MINES_PROB     "0000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_MINES_DELAY    "0000000000000205500000040007004000000000200000000600000"
-#define AMMOLINE_MINES_CRATE    "1111111111111111111111111111111111111111111101111111011"
+#define AMMOLINE_MINES_QT       "00000099000900000003000000000000000000000000000000000000"
+#define AMMOLINE_MINES_PROB     "00000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_MINES_DELAY    "00000000000002055000000400070040000000002000000006000000"
+#define AMMOLINE_MINES_CRATE    "11111111111111111111111111111111111111111111011111110111"
 
-#define AMMOLINE_PORTALS_QT     "9000009002000000002100000000000000110000090000000000000"
-#define AMMOLINE_PORTALS_PROB   "0405040541600655546554464776576666666155510101115411011"
-#define AMMOLINE_PORTALS_DELAY  "0000000000000205500000040007004000000000200000000600000"
-#define AMMOLINE_PORTALS_CRATE  "1311110312111111123114111111111111111211111101111111011"
+#define AMMOLINE_PORTALS_QT     "90000090020000000021000000000000001100000900000000000000"
+#define AMMOLINE_PORTALS_PROB   "04050405416006555465544647765766666661555101011154110110"
+#define AMMOLINE_PORTALS_DELAY  "00000000000002055000000400070040000000002000000006000000"
+#define AMMOLINE_PORTALS_CRATE  "13111103121111111231141111111111111112111111011111110111"
 
 //Different seasons; assigned to season (int)
 #define SEASON_NONE 0
--- a/hedgewars/CMakeLists.txt	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/CMakeLists.txt	Mon Oct 08 13:27:46 2012 -0400
@@ -15,10 +15,12 @@
 
 set(engine_sources
     ${hwengine_project}
+    LuaPas.pas
+    PNGh.pas
     SDLh.pas
-    PNGh.pas
     uAI.pas
     uAIActions.pas
+    uAILandMarks.pas
     uAIAmmoTests.pas
     uAIMisc.pas
     uAmmos.pas
@@ -29,12 +31,15 @@
     uCommandHandlers.pas
     uConsole.pas
     uConsts.pas
+    uCursor.pas
     uDebug.pas
     uFloat.pas
     uGame.pas
     uGears.pas
     uGearsHandlers.pas
     uGearsHandlersRope.pas
+    uGearsHedgehog.pas
+    uGearsList.pas
     uGearsRender.pas
     uGearsUtils.pas
     uIO.pas
@@ -60,6 +65,7 @@
     uStore.pas
     uTeams.pas
     uTextures.pas
+    uTouch.pas
     uTypes.pas
     uUtils.pas
     uVariables.pas
--- a/hedgewars/GSHandlers.inc	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Mon Oct 08 13:27:46 2012 -0400
@@ -5196,7 +5196,7 @@
     exit
     end;
 
-// Search out a new target, as target seek time has expired, target is dead, target is out of range, or we didn't have a target
+// Search out a new target, as target seek time has expired, target is dead, target is out of range, or we did not have a target
 if (HHGear = nil) or (Gear^.Timer = 0) or 
    (((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) >  Gear^.Angle) and
         (Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > int2hwFloat(Gear^.Angle)))
@@ -5244,45 +5244,87 @@
     end;
 end;
 
-/* Yay. More incomplete code.
+////////////////////////////////////////////////////////////////////////////////
+// Make the knife initial angle based on the hog attack angle, or is that too hard?
+procedure doStepKnife(Gear: PGear);
+var t, ox, oy, w, h, cx, cy, tx, ty, hx, hy : LongInt;
+begin
+    doStepFallingGear(Gear);
+    with Gear^ do
+        begin
+        if State and gstCollision <> 0 then
+            begin
+(* Yay. More incomplete code.
 This is the set of postions for the knife.
-Using FlipSurface and copyToXY the knife can be written to the Land at 32 positions.
+Using FlipSurface and copyToXY the knife can be written to the LandPixels at 32 positions, and an appropriate line drawn in Land.
 0deg
 2,5   (x,y offset)
 25,5  (wXh of clip area)
-2,7   (tip x,y)
+13,2  (centre of mass, relative to the clip)
+-13,0 (tip relative to centre of mass)
+11,0  (handle relative to centre of mass)
 
 11.25deg
 2,15
 24,8
-2,22
+13,4
+-13,3
+10,-3
 
 22.5deg
 2,27
 23,12
-2,38
+12,6
+-12,5
+10,-5
 
 33.75deg
 2,43
 21,15
-2,57
+11,7
+-11,7
+9,-6
 
 45deg
 29,8
 19,19
-29,26
+9,9
+-9,8
+8,-9
 
 56.25deg
 29,32
 15,21
-29,52
+7,10
+-7,10
+7,-10
 
 67.5deg
 51,3
 11,23
-51,25
+5,11
+-5,11
+5,-11
 
 78.75deg
 51,34
 7,24
-51,57    */
+2,11
+-2,12
+4,-11
+*)
+            DeleteGear(Gear);
+            exit
+            end
+        else
+            begin
+            t := hwRound((dX + dY) * _10);
+            if not dX.isNegative then inc(Angle, t)
+            else dec(Angle,t);
+
+            if Angle < -2048 then inc(Angle, 4096)
+            else if 2048 < Angle then dec(Angle, 4096);
+            DirAngle:= (Angle+2048) / 4096 * 360;
+            end
+        end;
+end;
--- a/hedgewars/uAIAmmoTests.pas	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/uAIAmmoTests.pas	Mon Oct 08 13:27:46 2012 -0400
@@ -117,7 +117,8 @@
             (proc: nil;              flags: 0), // amTardis
             (proc: nil;              flags: 0), // amStructure
             (proc: nil;              flags: 0), // amLandGun
-            (proc: nil;              flags: 0)  // amIceGun
+            (proc: nil;              flags: 0), // amIceGun
+            (proc: nil;              flags: 0)  // amKnife
             );
 
 const BadTurn = Low(LongInt) div 4;
--- a/hedgewars/uGears.pas	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/uGears.pas	Mon Oct 08 13:27:46 2012 -0400
@@ -1341,7 +1341,8 @@
             @doStepTardis,
             @doStepIceGun,
             @doStepAddAmmo,
-            @doStepGenericFaller);
+            @doStepGenericFaller,
+            @doStepKnife);
 begin
     doStepHandlers:= handlers;
 
--- a/hedgewars/uGearsHedgehog.pas	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/uGearsHedgehog.pas	Mon Oct 08 13:27:46 2012 -0400
@@ -262,6 +262,7 @@
                          amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
                          amMine: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
                         amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
+                        amKnife: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKnife,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
                        amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
                       amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
                     amPortalGun: begin
--- a/hedgewars/uGearsList.pas	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/uGearsList.pas	Mon Oct 08 13:27:46 2012 -0400
@@ -104,14 +104,14 @@
 gear^.Density:= _1;
 // Define ammo association, if any.
 gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
+gear^.CollisionMask:= $FFFF;
 
 if CurrentHedgehog <> nil then 
     begin
     gear^.Hedgehog:= CurrentHedgehog;
     if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then
-        gear^.CollisionMask:= $FF7F;
-    end
-else gear^.CollisionMask:= $FFFF;
+        gear^.CollisionMask:= $FF7F
+    end;
 
 if (Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0) then
     gear^.Z:= cHHZ+1
@@ -250,6 +250,7 @@
                 gear^.Density:= _1_6;
                 gear^.Timer:= 500;
                 end;
+       gtKnife: gear^.Radius:= 5;
         gtCase: begin
                 gear^.ImpactSound:= sndGraveImpact;
                 gear^.nImpactSounds:= 1;
--- a/hedgewars/uGearsRender.pas	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/uGearsRender.pas	Mon Oct 08 13:27:46 2012 -0400
@@ -628,6 +628,7 @@
                 amGasBomb: DrawSpriteRotated(sprHandCheese, hx, hy, sign, aangle);
                 amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle);
                 amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle);
+                amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle);
                 amSeduction: begin
                              DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle);
                              DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); 
@@ -988,6 +989,7 @@
                        else if Gear^.Health <> 0 then
                            DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
                        else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
+           gtKnife: DrawSpriteRotatedF(sprKnife, x, y, 0, hwSign(Gear^.dX), Gear^.DirAngle);
                        
             gtCase: begin
                     if Gear^.Timer > 1000 then
--- a/hedgewars/uTypes.pas	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/uTypes.pas	Mon Oct 08 13:27:46 2012 -0400
@@ -86,7 +86,7 @@
             sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
             sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
             sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
-            sprSlider, sprBotlevels
+            sprSlider, sprBotlevels, sprHandKnife, sprKnife
             );
 
     // Gears that interact with other Gears and/or Land
@@ -102,7 +102,8 @@
             gtSniperRifleShot, gtJetpack, gtMolotov, gtBirdy, // 44
             gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 50
             gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 55
-            gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun, gtTardis, gtIceGun, gtAddAmmo, gtGenericFaller); // 62
+            gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun, gtTardis, // 61
+            gtIceGun, gtAddAmmo, gtGenericFaller, gtKnife); // 65
 
     // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
     TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
@@ -150,7 +151,7 @@
             amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35
             amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42
             amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48
-            amResurrector, amDrillStrike, amSnowball, amTardis, amStructure, amLandGun, amIceGun); // 54
+            amResurrector, amDrillStrike, amSnowball, amTardis, amStructure, amLandGun, amIceGun, amKnife); // 54
 
     // Different kind of crates that e.g. hedgehogs can pick up
     TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
@@ -409,7 +410,7 @@
             sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb,
             sidSineGun, sidFlamethrower,sidSMine, sidHammer, sidResurrector,
             sidDrillStrike, sidSnowball, sidNothing, sidTardis,
-            sidStructure, sidLandGun, sidIceGun);
+            sidStructure, sidLandGun, sidIceGun, sidKnife);
 
     TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused,
             sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,
--- a/hedgewars/uVariables.pas	Sun Oct 07 16:44:16 2012 -0400
+++ b/hedgewars/uVariables.pas	Mon Oct 08 13:27:46 2012 -0400
@@ -661,7 +661,11 @@
             (FileName:  'slider'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
             Width: 3; Height: 17; imageWidth: 3; imageHeight: 17; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprSlider
             (FileName:  'botlevels'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 22; Height: 15; imageWidth: 22; imageHeight: 15; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: false) // sprBotlevels
+            Width: 22; Height: 15; imageWidth: 22; imageHeight: 15; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprBotlevels
+            (FileName:  'amKnife'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandKnife
+            (FileName:  'knife'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width: 29; Height: 14; imageWidth: 64; imageHeight: 64; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: false) // sprKnife
             );
 
 const
@@ -2321,7 +2325,31 @@
             PosCount: 1;
             PosSprite: sprWater;
             ejectX: 0; //20;
-            ejectY: -3)
+            ejectY: -3),
+// Knife
+            (NameId: sidKnife;
+            NameTex: nil;
+            Probability: 100;
+            NumberInCase: 1;
+            Ammo: (Propz: ammoprop_Power or
+                          ammoprop_NeedUpDown; //FIXME: enable multishoot at altuse, until then removed ammoprop_AltUse
+                Count: 1;
+                NumPerTurn: 3;
+                Timer: 0;
+                Pos: 0;
+                AmmoType: amKnife;
+                AttackVoice: sndNone;
+                Bounciness: 1000);
+            Slot: 6;
+            TimeAfterTurn: 3000;
+            minAngle: 0;
+            maxAngle: 0;
+            isDamaging: true;
+            SkipTurns: 0;
+            PosCount: 1;
+            PosSprite: sprWater;
+            ejectX: 0;
+            ejectY: 0)
         );
 
 const
@@ -2391,6 +2419,7 @@
 (*         gtIceGun *) , amIceGun
 (*        gtAddAmmo *) , amNothing
 (*  gtGenericFaller *) , amNothing
+(*          gtKnife *) , amKnife
     );
 
 var
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/knife.png has changed
--- a/share/hedgewars/Data/Locale/en.txt	Sun Oct 07 16:44:16 2012 -0400
+++ b/share/hedgewars/Data/Locale/en.txt	Mon Oct 08 13:27:46 2012 -0400
@@ -57,6 +57,7 @@
 00:54=Structure
 00:55=Land Spray
 00:56=Freezer
+00:57=Knife
 
 01:00=Let's fight!
 01:01=Round draw