hedgewars/uVisualGears.pas
changeset 3115 831bd0f7050d
parent 3096 9330eead14fa
child 3118 1320933fd651
--- a/hedgewars/uVisualGears.pas	Sat Mar 27 17:03:27 2010 +0000
+++ b/hedgewars/uVisualGears.pas	Sat Mar 27 17:22:33 2010 +0000
@@ -176,6 +176,21 @@
     else dec(Gear^.FrameTicks, Steps)
 end;
 
+procedure doStepEgg(Gear: PVisualGear; Steps: Longword);
+begin
+Gear^.X:= Gear^.X + Gear^.dX * Steps;
+
+Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
+Gear^.dY:= Gear^.dY + cGravity * Steps;
+
+Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
+
+if Gear^.FrameTicks <= Steps then
+    DeleteVisualGear(Gear)
+else
+    dec(Gear^.FrameTicks, Steps)
+end;
+
 procedure doStepFire(Gear: PVisualGear; Steps: Longword);
 begin
 Gear^.X:= Gear^.X + Gear^.dX * Steps;
@@ -470,7 +485,8 @@
             @doStepSplash,
             @doStepDroplet,
             @doStepSmokeRing,
-            @doStepBeeTrace
+            @doStepBeeTrace,
+            @doStepEgg
         );
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
@@ -545,6 +561,16 @@
                 FrameTicks:= 650 + random(250);
                 Frame:= random(8)
                 end;
+         vgtEgg: begin
+                t:= random(1024);
+                sp:= _0_001 * (random(85) + 95);
+                dx:= AngleSin(t) * sp;
+                dx.isNegative:= random(2) = 0;
+                dy:= AngleCos(t) * sp;
+                dy.isNegative:= random(2) = 0;
+                FrameTicks:= 650 + random(250);
+                Frame:= 1
+                end;
         vgtShell: FrameTicks:= 500;
     vgtSmallDamageTag: begin
                 gear^.FrameTicks:= 1100
@@ -741,6 +767,13 @@
                             if Gear^.FrameTicks < 250 then
                                 glColor4f(1, 1, 1, 1);
                             end;
+                  vgtEgg: begin
+                            if Gear^.FrameTicks < 250 then
+                                glColor4f(1, 1, 1, Gear^.FrameTicks / 250);
+                            DrawRotatedF(sprEgg, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
+                            if Gear^.FrameTicks < 250 then
+                                glColor4f(1, 1, 1, 1);
+                            end;
                 vgtSplash: DrawSprite(sprSplash, hwRound(Gear^.X) + WorldDx - 64, hwRound(Gear^.Y) + WorldDy - 72, 19 - (Gear^.FrameTicks div 37));
                 vgtDroplet: DrawSprite(sprDroplet, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);
                vgtBeeTrace: begin