Seduction animation. New visual gear type.
authornemo
Sun, 14 Aug 2011 16:59:55 -0400
changeset 5562 8056d82b4d23
parent 5561 dfbe55237c64
child 5563 fc73b6e941f7
Seduction animation. New visual gear type.
hedgewars/GSHandlers.inc
hedgewars/VGSHandlers.inc
hedgewars/hwengine.pas
hedgewars/uStore.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
hedgewars/uVisualGears.pas
--- a/hedgewars/GSHandlers.inc	Sun Aug 14 13:45:37 2011 -0400
+++ b/hedgewars/GSHandlers.inc	Sun Aug 14 16:59:55 2011 -0400
@@ -2955,9 +2955,9 @@
             if hogs[i] <> CurrentHedgehog^.Gear then
                 begin
                 //d:= Distance(Gear^.X - hogs[i]^.X, Gear^.Y - hogs[i]^.Y);
-                hogs[i]^.dX:= _0_25 * (Gear^.X - hogs[i]^.X) / _250;
+                hogs[i]^.dX:= _50 * cGravity * (Gear^.X - hogs[i]^.X) / _25;
                 //if Gear^.X < hogs[i]^.X then hogs[i]^.dX.isNegative:= true;
-                hogs[i]^.dY:= -_0_25;
+                hogs[i]^.dY:= -_450 * cGravity;
                 hogs[i]^.Active:= true;
                 end
             end;
@@ -2990,18 +2990,25 @@
 end;
 
 procedure doStepSeductionWear(Gear: PGear);
+var heart: PVisualGear;
 begin
     AllInactive := false;
     inc(Gear^.Timer);
     if Gear^.Timer > 250 then
-    begin
+        begin
         Gear^.Timer := 0;
         inc(Gear^.Pos);
         if Gear^.Pos = 5 then
             PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack)
-    end;
-
-    if Gear^.Pos = 14 then
+        end;
+
+    if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then 
+        begin
+        heart:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
+        if heart <> nil then heart^.Sprite:= sprSeduction;
+        end;
+
+    if Gear^.Pos = 15 then
         Gear^.doStep := @doStepSeductionWork
 end;
 
--- a/hedgewars/VGSHandlers.inc	Sun Aug 14 13:45:37 2011 -0400
+++ b/hedgewars/VGSHandlers.inc	Sun Aug 14 16:59:55 2011 -0400
@@ -711,4 +711,19 @@
 if WindBarWidth = Gear^.Tag then 
     DeleteVisualGear(Gear)
 end;
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword);
+begin
+Gear^.X:= Gear^.X + Gear^.dX * Steps;
+Gear^.Y:= Gear^.Y - Gear^.dY * Steps;
 
+if Gear^.FrameTicks <= Steps then
+    DeleteVisualGear(Gear)
+else
+    begin
+    dec(Gear^.FrameTicks, Steps);
+    if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then 
+        Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500)
+    end
+end;
+
--- a/hedgewars/hwengine.pas	Sun Aug 14 13:45:37 2011 -0400
+++ b/hedgewars/hwengine.pas	Sun Aug 14 16:59:55 2011 -0400
@@ -124,6 +124,7 @@
 begin
     WriteLnToConsole('Freeing resources...');
     FreeActionsList();
+    uVisualGears.freeModule;
     StoreRelease();
     ControllerClose();
     CloseIPC();
--- a/hedgewars/uStore.pas	Sun Aug 14 13:45:37 2011 -0400
+++ b/hedgewars/uStore.pas	Sun Aug 14 16:59:55 2011 -0400
@@ -390,13 +390,13 @@
     i, t: LongInt;
 begin
     for ii:= Low(TSprite) to High(TSprite) do
-    begin
+        begin
         FreeTexture(SpritesData[ii].Texture);
         SpritesData[ii].Texture:= nil;
         if SpritesData[ii].Surface <> nil then
             SDL_FreeSurface(SpritesData[ii].Surface);
         SpritesData[ii].Surface:= nil;
-    end;
+        end;
     SDL_FreeSurface(MissionIcons);
     FreeTexture(ropeIconTex);
     FreeTexture(HHTexture);
@@ -405,14 +405,12 @@
     FreeTexture(SyncTexture);
     // free all ammo name textures
     for ai:= Low(TAmmoType) to High(TAmmoType) do
-    begin
         FreeTexture(Ammoz[ai].NameTex);
-    end;
+
     // free all count textures
     for i:= Low(CountTexz) to High(CountTexz) do
-    begin
         FreeTexture(CountTexz[i]);
-    end;
+
     // free all team and hedgehog textures
     for t:= 0 to Pred(TeamsCount) do
     begin
@@ -465,10 +463,10 @@
     tmpsurf:= IMG_Load(Str2PChar(s));
 
     if tmpsurf = nil then
-    begin
+        begin
         OutError(msgFailed, (imageFlags and ifCritical) <> 0);
         exit(nil)
-    end;
+        end;
 
     if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then
     begin
@@ -1006,9 +1004,7 @@
     end;
     // init all count texture pointers
     for i:= Low(CountTexz) to High(CountTexz) do
-    begin
         CountTexz[i] := nil;
-    end;
 end;
 
 procedure freeModule;
--- a/hedgewars/uTypes.pas	Sun Aug 14 13:45:37 2011 -0400
+++ b/hedgewars/uTypes.pas	Sun Aug 14 16:59:55 2011 -0400
@@ -106,7 +106,7 @@
             vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg,
             vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion,
             vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle,
-            vgtSmoothWindBar);
+            vgtSmoothWindBar, vgtStraightShot);
 
     TGearsType = set of TGearType;
 
@@ -276,6 +276,7 @@
         Kind: TVisualGearType;
         doStep: TVGearStepProcedure;
         Tex: PTexture;
+        Sprite: TSprite;
         alpha, scale: GLfloat;
         Hedgehog: PHedgehog;
         Tag: LongInt;
--- a/hedgewars/uVariables.pas	Sun Aug 14 13:45:37 2011 -0400
+++ b/hedgewars/uVariables.pas	Sun Aug 14 16:59:55 2011 -0400
@@ -1389,7 +1389,7 @@
             NameTex: nil;
             Probability: 100;
             NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold;
+            Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold or ammoprop_NoCrosshair;
                 Count: 1;
                 NumPerTurn: 0;
                 Timer: 0;
--- a/hedgewars/uVisualGears.pas	Sun Aug 14 13:45:37 2011 -0400
+++ b/hedgewars/uVisualGears.pas	Sun Aug 14 16:59:55 2011 -0400
@@ -109,7 +109,8 @@
             @doStepLineTrail,
             @doStepBulletHit,
             @doStepCircle,
-            @doStepSmoothWindBar
+            @doStepSmoothWindBar,
+            @doStepStraightShot
         );
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0; Critical: Boolean = false): PVisualGear;
@@ -118,12 +119,9 @@
     t: Longword;
     sp: real;
 begin
-if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then // we are scrolling now
-    if (Kind <> vgtCloud) and not Critical then
-        begin
-        AddVisualGear:= nil;
-        exit
-        end;
+AddVisualGear:= nil;
+if ((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet))) and // we are scrolling now
+   ((Kind <> vgtCloud) and not Critical) then exit;
 
 if ((cReducedQuality and rqAntiBoom) <> 0) and
    not Critical and
@@ -136,11 +134,7 @@
     vgtSmokeTrace,
     vgtEvilTrace,
     vgtNote,
-    vgtSmoothWindBar]) then
-    begin
-      AddVisualGear:= nil;
-      exit
-    end;
+    vgtSmoothWindBar]) then exit;
 
 inc(VGCounter);
 New(gear);
@@ -331,6 +325,15 @@
                 Angle := 0;
                 end;
 vgtSmoothWindBar: Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
+ vgtStraightShot: begin
+                dx:= 0.001 * (random(200));
+                dy:= 0.001 * (random(200));
+                if random(2) = 0 then dx := -dx;
+                if random(2) = 0 then dy := -dy;
+                Frame:= 0;
+                FrameTicks:= random(750) + 1000;
+                Sprite:= sprSnowDust;
+                end;
         end;
 
 if State <> 0 then gear^.State:= State;
@@ -485,6 +488,7 @@
             vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
             vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
             vgtHealth: DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0);
+            vgtStraightShot: DrawRotatedF(Gear^.Sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
         end;
         if (cReducedQuality and rqAntiBoom) = 0 then
             case Gear^.Kind of