Insert commit message here
authorpalewolf
Sun, 21 Mar 2010 15:50:38 +0000
changeset 3032 9c190d3c165b
parent 3031 542444bfe37d
child 3033 2a8f385ab466
Insert commit message here
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Graphics/BigExplosion.png
share/hedgewars/Data/Graphics/SmokeRing.png
--- a/hedgewars/GSHandlers.inc	Sun Mar 21 13:53:47 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Mar 21 15:50:38 2010 +0000
@@ -2858,3 +2858,26 @@
     Message:= Message and not (gm_Attack or gm_Up or gm_Precise or gm_Left or gm_Right)
     end
 end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepBigExplosionWork(Gear: PGear);
+var maxMovement: LongInt;
+begin
+inc(Gear^.Timer);
+if (Gear^.Timer and 5) = 0 then
+    begin
+    maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250));
+    ShakeCamera(maxMovement);
+    end;
+if Gear^.Timer > 250 then DeleteGear(Gear);
+end;
+
+procedure doStepBigExplosion(Gear: PGear);
+var i: LongWord;
+begin
+AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeRing);
+for i:= 0 to 46 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFire);
+for i:= 0 to 15 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart);
+for i:= 0 to 15 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart2);
+Gear^.doStep:= @doStepBigExplosionWork
+end;
--- a/hedgewars/uConsts.pas	Sun Mar 21 13:53:47 2010 +0000
+++ b/hedgewars/uConsts.pas	Sun Mar 21 15:50:38 2010 +0000
@@ -75,7 +75,8 @@
             sprSmoke, sprSmokeWhite, sprShell, sprDust, sprExplosives, sprExplosivesRoll,
             sprAmTeleport, sprSplash, sprDroplet, sprBirdy, sprHandCake, sprHandConstruction,
             sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster,
-            sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp);
+            sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp,
+            sprBigExplosion, sprSmokeRing);
 
     TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, // 3
             gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, // 8
@@ -86,12 +87,13 @@
             gtTeleport, gtSwitcher, gtTarget, gtMortar, // 31
             gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 37
             gtHellishBomb, gtEvilTrace, gtWaterUp, gtDrill, gtBallGun, gtBall,gtRCPlane,
-            gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy);
+            gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, 
+            gtBigExplosion);
 
     TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
             vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
             vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell,
-            vgtDust, vgtSplash, vgtDroplet);
+            vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing);
 
     TGearsType = set of TGearType;
 
@@ -710,7 +712,11 @@
             (FileName:  'amSeduction'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
             Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprHandSeduction
             (FileName:  'amVamp'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false)// sprHandVamp
+            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprHandVamp
+            (FileName:  'BigExplosion'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  385; Height: 385; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprBigExplosion
+            (FileName:  'SmokeRing'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  200; Height: 200; imageWidth: 0; imageHeight: 0; saveSurf: false)// sprSmokeRing
             );
 
     Wavez: array [TWave] of record
--- a/hedgewars/uGears.pas	Sun Mar 21 13:53:47 2010 +0000
+++ b/hedgewars/uGears.pas	Sun Mar 21 15:50:38 2010 +0000
@@ -20,7 +20,7 @@
 
 unit uGears;
 interface
-uses SDLh, uConsts, uFloat;
+uses SDLh, uConsts, uFloat, Math;
 
     
 type
@@ -182,7 +182,8 @@
             @doStepJetpack,
             @doStepMolotov,
             @doStepCase,
-            @doStepBirdy
+            @doStepBirdy,
+            @doStepBigExplosion
             );
 
 procedure InsertGearToList(Gear: PGear);
@@ -443,6 +444,11 @@
                 gear^.Timer:= 500;
                 gear^.Health:= 2000;
                 end;
+gtBigExplosion: begin
+                gear^.X:= gear^.X;
+                gear^.Y:= gear^.Y;
+                gear^.Angle:= random(360);
+                end;
      end;
 InsertGearToList(gear);
 AddGear:= gear;
@@ -1661,6 +1667,11 @@
      gtHellishBomb: DrawRotated(sprHellishBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
       gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
            gtBirdy: DrawTextureF(SpritesData[sprBirdy].Texture, 1 - Gear^.Timer / 500, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
+    gtBigExplosion: begin
+                    glColor4f(1, 1, 1, 1.0 * (power(2, -5 * (Gear^.Timer-200)/200)));
+                    DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -4 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle);
+                    glColor4f(1, 1, 1, 1);
+                    end;
          end;
       if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(hwRound(Gear^.X) + 8 + WorldDx, hwRound(Gear^.Y) + 8 + WorldDy, Gear^.Tex);
       Gear:= Gear^.NextGear
@@ -1737,7 +1748,11 @@
 begin
 TargetPoint.X:= NoPointX;
 {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
-if (Radius > 10) and ((Mask and EXPLNoGfx) = 0) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0);
+if ((Mask and EXPLNoGfx) = 0) then
+    begin
+    if Radius > 50 then AddGear(X, Y, gtBigExplosion, 0, _0, _0, 0)
+    else if Radius > 10 then AddGear(X, Y, gtExplosion, 0, _0, _0, 0);
+    end;
 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion);
 
 if (Mask and EXPLAllDamageInRadius) = 0 then
--- a/hedgewars/uVisualGears.pas	Sun Mar 21 13:53:47 2010 +0000
+++ b/hedgewars/uVisualGears.pas	Sun Mar 21 15:50:38 2010 +0000
@@ -20,7 +20,7 @@
 
 unit uVisualGears;
 interface
-uses SDLh, uConsts, uFloat,
+uses SDLh, uConsts, uFloat, Math,
 {$IFDEF GLES11}
     gles11;
 {$ELSE}
@@ -302,6 +302,17 @@
     end;
 end;
 
+procedure doStepSmokeRing(Gear: PVisualGear; Steps: Longword);
+begin
+inc(Gear^.Timer, Steps);
+if Gear^.Timer >= Gear^.FrameTicks then DeleteVisualGear(Gear)
+else
+    begin
+    Gear^.scale := 1.25 * (-power(2, -7 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4;
+    Gear^.alpha := 1.0 * (power(2, -3 * (Gear^.Timer - 350)/350));
+    end;
+end;
+
 ////////////////////////////////////////////////////////////////////////////////
 const cSorterWorkTime = 640;
 var thexchar: array[0..cMaxTeams] of
@@ -441,7 +452,8 @@
             @doStepShell,
             @doStepDust,
             @doStepSplash,
-            @doStepDroplet
+            @doStepDroplet,
+            @doStepSmokeRing
         );
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
@@ -578,6 +590,18 @@
                 FrameTicks:= 250 + random(1751);
                 Frame:= random(3)
                 end;
+    vgtSmokeRing: begin
+                dx:= _0;
+                dx.isNegative:= false;
+                dy:= _0;
+                dy.isNegative:= false;
+                FrameTicks:= 600;
+                Timer:= 0;
+                Frame:= 0;
+                scale:= 0.6;
+                alpha:= 1;
+                angle:= random(360);
+                end;
         end;
 
 if VisualGearsList <> nil then
@@ -699,6 +723,11 @@
                             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);
+                vgtSmokeRing: begin
+                            glColor4f(1, 1, 1, Gear^.alpha);
+                            DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
+                            glColor4f(1, 1, 1, 1);
+                            end;
             end;
         case Gear^.Kind of
             vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
--- a/hedgewars/uWorld.pas	Sun Mar 21 13:53:47 2010 +0000
+++ b/hedgewars/uWorld.pas	Sun Mar 21 15:50:38 2010 +0000
@@ -44,6 +44,7 @@
 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
 procedure HideMission;
+procedure ShakeCamera(amount: LongWord);
 
 implementation
 uses    uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand,
@@ -925,6 +926,13 @@
     missionTimer:= 0
 end;
 
+procedure ShakeCamera(amount: LongWord);
+begin
+    amount:= max(1, amount);
+    WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2));
+    WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2));
+end;
+
 procedure init_uWorld;
 begin
     fpsTexture:= nil;
Binary file share/hedgewars/Data/Graphics/BigExplosion.png has changed
Binary file share/hedgewars/Data/Graphics/SmokeRing.png has changed