Ugly graphic for jetpack - jetpack should be essentially functional.
authornemo
Sun, 21 Jun 2009 17:47:57 +0000
changeset 2182 ed7e7eb3f9ed
parent 2181 26d3b13ee553
child 2183 6336e37acf2d
Ugly graphic for jetpack - jetpack should be essentially functional.
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Sun Jun 21 15:46:48 2009 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Jun 21 17:47:57 2009 +0000
@@ -2194,23 +2194,35 @@
 //dec(Gear^.Timer);
 move:= _0_2;
 fuel:= 50;
-if (HHGear^.Message and gm_Precise) <> 0 then
+(*if (HHGear^.Message and gm_Precise) <> 0 then
     begin
     move:= _0_02;
     fuel:= 5;
-    end;
+    end;*)
 if (HHGear^.Message and gm_Left) <> 0 then move.isNegative:= true;
 
 if (HHGear^.Message and gm_Up) <> 0 then
     begin
     HHGear^.dY:= HHGear^.dY - move;
-    dec(Gear^.Health, fuel)
+    dec(Gear^.Health, fuel);
+    Gear^.MsgParam:= Gear^.MsgParam or gm_Up;
+    Gear^.Timer:= GameTicks
     end;
 if (HHGear^.Message and (gm_Left or gm_Right)) <> 0 then
     begin
     HHGear^.dX:= HHGear^.dX + (move * _0_2);
-    dec(Gear^.Health, fuel div 5)
+    dec(Gear^.Health, fuel div 5);
+    Gear^.MsgParam:= Gear^.MsgParam or (HHGear^.Message and (gm_Left or gm_Right));
+    Gear^.Timer:= GameTicks
     end;
+
+// erases 'em all at once :-/ 
+if (Gear^.Timer <> 0) and (GameTicks - Gear^.Timer > 250) then
+    begin
+    Gear^.Timer:= 0;
+    Gear^.MsgParam:= 0
+    end;
+
 if Gear^.Health < 0 then Gear^.Health:= 0;
 if (GameTicks and $3F) = 0 then AddCaption('Fuel: '+inttostr(round(Gear^.Health/20))+'%', $FFFFFF, capgrpAmmostate);
 
@@ -2237,6 +2249,7 @@
 		end;
 	DeleteGear(Gear);
 	isCursorVisible:= false;
+    AddCaption('Fuel: '+inttostr(round(Gear^.Health/20))+'%', $FFFFFF, capgrpAmmostate);
 	end
 end;
 
--- a/hedgewars/uConsts.pas	Sun Jun 21 15:46:48 2009 +0000
+++ b/hedgewars/uConsts.pas	Sun Jun 21 17:47:57 2009 +0000
@@ -63,7 +63,7 @@
             sprSpeechCorner, sprSpeechEdge, sprSpeechTail, 
             sprThoughtCorner, sprThoughtEdge, sprThoughtTail, 
             sprShoutCorner, sprShoutEdge, sprShoutTail,
-            sprSniperRifle, sprBubbles);
+            sprSniperRifle, sprBubbles, sprJetpack);
 
 	TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, // 3
 			gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, // 8
@@ -563,7 +563,9 @@
 			(FileName:'amSniperRifle';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
 			Width: 128; Height: 32; saveSurf: false), // sprSniperRifle
 			(FileName:    'Bubbles'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-			Width:  16; Height: 16; saveSurf: false) // sprBubbles
+			Width:  16; Height: 16; saveSurf: false), // sprBubbles
+			(FileName:'amJetpack';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+			Width: 64; Height: 64; saveSurf: false) // sprJetpack
 			);
 
 	Wavez: array [TWave] of record
--- a/hedgewars/uGears.pas	Sun Jun 21 15:46:48 2009 +0000
+++ b/hedgewars/uGears.pas	Sun Jun 21 17:47:57 2009 +0000
@@ -388,7 +388,6 @@
                 Result^.Radius:= 8;
                 end;
      gtJetpack: begin
-                Result^.Timer:= 20000;
                 Result^.Health:= 2000;
                 end;
      end;
@@ -1098,7 +1097,8 @@
 		end;
 
 		defaultPos:= false
-	end
+	end;
+
 end else // not gstHHDriven
 	begin
 	if (Gear^.Damage > 0)
@@ -1163,7 +1163,27 @@
 				hwSign(Gear^.dX)*m,
 				32);
 	end;
-
+if (Gear^.State and gstHHDriven) <> 0 then
+    begin
+    if (CurAmmoGear = nil) then
+        begin
+        amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType;
+        case amt of
+            amJetpack: DrawSprite(sprJetpack, sx-32, sy-32, 0);
+            end
+        end;
+    if CurAmmoGear <> nil then
+        begin
+        case CurAmmoGear^.Kind of
+            gtJetpack: begin
+	                   DrawSprite(sprJetpack, sx-32, sy-32, 0);
+	                   if (CurAmmoGear^.MsgParam and gm_Up) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 1);
+	                   if (CurAmmoGear^.MsgParam and gm_Left) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 2);
+	                   if (CurAmmoGear^.MsgParam and gm_Right) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 3);
+                       end;
+            end;
+        end
+    end;
 
 with PHedgehog(Gear^.Hedgehog)^ do
 	begin