hedgewars/uVisualGears.pas
changeset 2972 82828fd23dea
parent 2948 3f21a9dc93d0
child 2974 f3fa665f0874
--- a/hedgewars/uVisualGears.pas	Tue Mar 09 02:48:27 2010 +0000
+++ b/hedgewars/uVisualGears.pas	Wed Mar 10 06:50:06 2010 +0000
@@ -43,6 +43,7 @@
         Kind: TVisualGearType;
         doStep: TVGearStepProcedure;
         Tex: PTexture;
+        alpha, scale: GLfloat;
         Hedgehog: pointer;
         Text: shortstring
         end;
@@ -217,6 +218,16 @@
         else dec(Gear^.FrameTicks, Steps)
 end;
 
+procedure doStepAmmo(Gear: PVisualGear; Steps: Longword);
+begin
+    Gear^.Y:= Gear^.Y - cDrownSpeed * Steps;
+
+    Gear^.scale:= Gear^.scale + 0.0025 * Steps;
+    Gear^.alpha:= Gear^.alpha - 0.0015 * Steps;
+
+    if Gear^.alpha < 0 then DeleteVisualGear(Gear)
+end;
+
 procedure doStepSmoke(Gear: PVisualGear; Steps: Longword);
 begin
     Gear^.X:= Gear^.X + (cWindSpeed + Gear^.dX) * Steps;
@@ -385,6 +396,7 @@
             @doStepSpeechBubble,
             @doStepBubble,
             @doStepSteam,
+            @doStepAmmo,
             @doStepSmoke,
             @doStepSmoke,
             @doStepHealth,
@@ -481,6 +493,10 @@
                 Frame:= 7 - random(3);
                 FrameTicks:= cExplFrameTicks * 2;
                 end;
+    vgtAmmo: begin
+                alpha:= 1.0;
+                scale:= 1.0
+                end;
   vgtSmokeWhite, 
   vgtSmoke: begin
                 dx:= _0_0002 * (random(45) + 10);
@@ -577,6 +593,12 @@
                 vgtFire: DrawSprite(sprFlame, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy, (RealTicks div 64 + Gear^.Frame) mod 8);
                 vgtBubble: DrawSprite(sprBubbles, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
                 vgtSteam: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
+                vgtAmmo: begin
+                        glColor4f(1, 1, 1, Gear^.alpha);
+                        DrawTextureF(ropeIconTex, Gear^.scale, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 32, 32);
+                        DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
+                        glColor4f(1, 1, 1, 1);
+                        end;
                 vgtHealth:  begin
                             case Gear^.Frame div 10 of
                                 0:glColor4f(0, 1, 0, Gear^.FrameTicks / 1000);