Idle hedgehog animation
authorunc0rr
Mon, 26 May 2008 22:47:48 +0000
changeset 954 0cc31e998f4e
parent 953 237fc147950c
child 955 474afaab0365
Idle hedgehog animation
hedgewars/uConsts.pas
hedgewars/uGears.pas
share/hedgewars/Data/Graphics/Hedgehog/Idle.png
--- a/hedgewars/uConsts.pas	Mon May 26 20:41:12 2008 +0000
+++ b/hedgewars/uConsts.pas	Mon May 26 22:47:48 2008 +0000
@@ -44,7 +44,7 @@
                    sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun,
                    sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer,
                    sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath,
-                   sprShotgun, sprDEagle);
+                   sprShotgun, sprDEagle, sprHHIdle);
 
      TGearType  = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -383,7 +383,9 @@
                      (FileName:'amShotgun_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
                       Width:  64; Height: 64; saveSurf: false),// sprShotgun
                      (FileName: 'amDEagle_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-                      Width:  64; Height: 64; saveSurf: false) // sprDEagle
+                      Width:  64; Height: 64; saveSurf: false),// sprDEagle
+                     (FileName:       'Idle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+                      Width:  32; Height: 32; saveSurf: false) // sprHHIdle
                      );
 
       Soundz: array[TSound] of record
--- a/hedgewars/uGears.pas	Mon May 26 20:41:12 2008 +0000
+++ b/hedgewars/uGears.pas	Mon May 26 22:47:48 2008 +0000
@@ -209,6 +209,7 @@
                 Result^.Elasticity:= _0_35;
                 Result^.Friction:= _0_999;
                 Result^.Angle:= cMaxAngle div 2;
+                Result^.Pos:= GetRandom(19);
                 Result^.Z:= cHHZ;
                 end;
 gtAmmo_Grenade: begin
@@ -590,8 +591,7 @@
 			defaultPos:= false
 		end else
 
-	if (Gear^.Message and (gm_Left or gm_Right) <> 0)
-       or ((Gear^.State and gstAttacked) <> 0) then
+	if (Gear^.Message and (gm_Left or gm_Right) <> 0) then
 		begin
 		DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
 			hwSign(Gear^.dX),
@@ -602,6 +602,7 @@
 		end
     else
 
+	if ((Gear^.State and gstAttacked) = 0) then
 	begin
 		amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType;
 		case amt of
@@ -645,10 +646,11 @@
 end;
 
 if defaultPos then
-	DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
+	DrawRotatedF(sprHHIdle,
+		hwRound(Gear^.X) + 1 + WorldDx,
+		hwRound(Gear^.Y) - 3 + WorldDy,
+		(RealTicks div 256 + Gear^.Pos) mod 19,
 		hwSign(Gear^.dX),
-		0,
-		3,
 		0);
 
 with PHedgehog(Gear^.Hedgehog)^ do
Binary file share/hedgewars/Data/Graphics/Hedgehog/Idle.png has changed