Use kamiakze sprite
authorunc0rr
Wed, 11 Jun 2008 15:42:53 +0000
changeset 987 0fcd3fadda41
parent 986 434b95f00211
child 988 cdff3f6f9b38
Use kamiakze sprite
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
share/hedgewars/Data/Graphics/Hedgehog.png
share/hedgewars/Data/Graphics/Hedgehog/amKamikaze.png
--- a/hedgewars/GSHandlers.inc	Tue Jun 10 20:40:43 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Wed Jun 11 15:42:53 2008 +0000
@@ -1387,8 +1387,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepKamikazeWork(Gear: PGear);
 const upd: Longword = 0;
-var i, x, y: LongWord;
-    oX, oY: hwFloat;
+var i: LongWord;
     HHGear: PGear;
 begin
 AllInactive:= false;
@@ -1398,8 +1397,6 @@
 DeleteCI(HHGear);
 
 i:= 2;
-oX:= Gear^.X;
-oY:= Gear^.Y;
 repeat
 	Gear^.X:= Gear^.X + HHGear^.dX;
 	Gear^.Y:= Gear^.Y + HHGear^.dY;
@@ -1418,6 +1415,8 @@
 inc(upd);
 if upd > 3 then
 	begin
+	if Gear^.Health < 1500 then Gear^.Pos:= 2;
+	
 	AmmoShove(Gear, 30, 40);
 	
 	DrawTunnel(HHGear^.X - HHGear^.dX * 10,
@@ -1443,6 +1442,17 @@
 	end
 end;
 
+procedure doStepKamikazeIdle(Gear: PGear);
+begin
+AllInactive:= false;
+dec(Gear^.Timer);
+if Gear^.Timer = 0 then
+	begin
+	Gear^.Pos:= 1;
+	Gear^.doStep:= @doStepKamikazeWork
+	end
+end;
+
 procedure doStepKamikaze(Gear: PGear);
 var HHGear: PGear;
 begin
@@ -1456,6 +1466,8 @@
 Gear^.dX:= SignAs(_0_45, Gear^.dX);
 Gear^.dY:= - _0_9;
 
-Gear^.doStep:= @doStepKamikazeWork
+Gear^.Timer:= 550;
+
+Gear^.doStep:= @doStepKamikazeIdle
 end;
 
--- a/hedgewars/uConsts.pas	Tue Jun 10 20:40:43 2008 +0000
+++ b/hedgewars/uConsts.pas	Wed Jun 11 15:42:53 2008 +0000
@@ -45,7 +45,7 @@
                    sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer,
                    sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath,
                    sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft,
-                   sprHat);
+                   sprHat, sprKamikaze);
 
      TGearType  = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -393,7 +393,9 @@
                      (FileName:  'TurnsLeft'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
                       Width:  16; Height: 16; saveSurf: false),// sprTurnsLeft
                      (FileName:    'Samurai'; Path: ptHats    ; AltPath: ptNone; Texture: nil; Surface: nil;
-                      Width:  32; Height: 32; saveSurf: false) // sprHat
+                      Width:  32; Height: 32; saveSurf: false),// sprHat
+                     (FileName: 'amKamikaze'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+                      Width: 256; Height: 32; saveSurf: false) // sprKamikaze
                      );
 
       Soundz: array[TSound] of record
--- a/hedgewars/uGears.pas	Tue Jun 10 20:40:43 2008 +0000
+++ b/hedgewars/uGears.pas	Wed Jun 11 15:42:53 2008 +0000
@@ -562,6 +562,23 @@
 					end;
 				gtPickHammer,
 				gtTeleport: defaultPos:= false;
+				gtKamikaze: begin
+							if CurAmmoGear^.Pos = 0 then
+								DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
+										hwSign(Gear^.dX),
+										1,
+										6,
+										0)
+							else
+								DrawRotatedF(sprKamikaze,
+										hwRound(Gear^.X) + WorldDx,
+										hwRound(Gear^.Y) + WorldDy,
+										CurAmmoGear^.Pos - 1,
+										1,
+										DxDy2Angle(Gear^.dY, Gear^.dX));
+										
+							defaultPos:= false
+							end;
 			end;
 
 			case CurAmmoGear^.Kind of
@@ -632,6 +649,11 @@
 							3,
 							0);
 				amTeleport: DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, 0, hwSign(Gear^.dX), 0);
+				amKamikaze: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
+							hwSign(Gear^.dX),
+							1,
+							5,
+							0);
 			else
 				DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
 					hwSign(Gear^.dX),
Binary file share/hedgewars/Data/Graphics/Hedgehog.png has changed
Binary file share/hedgewars/Data/Graphics/Hedgehog/amKamikaze.png has changed