- Show explosion
authorunc0rr
Thu, 01 Sep 2005 18:41:23 +0000
changeset 9 4cbf854ad095
parent 8 24048039955c
child 10 edf56dca1587
- Show explosion - Use Gear.State instead of Gear.Tag in gtSmokeTrace
hedgewars/Data/Graphics/Expl50.png
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
Binary file hedgewars/Data/Graphics/Expl50.png has changed
--- a/hedgewars/GSHandlers.inc	Sun Aug 28 19:00:20 2005 +0000
+++ b/hedgewars/GSHandlers.inc	Thu Sep 01 18:41:23 2005 +0000
@@ -551,9 +551,21 @@
 if Gear.Timer > 64 then
    begin
    Gear.Timer:= 0;
-   dec(Gear.Tag)
+   dec(Gear.State)
    end;
 Gear.dX:= Gear.dX + cWindSpeed;
 Gear.X:= Gear.X + Gear.dX;
-if Gear.Tag = 0 then DeleteGear(Gear)
+if Gear.State = 0 then DeleteGear(Gear)
 end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepExplosion(Gear: PGear);
+begin
+inc(Gear.Timer);
+if Gear.Timer > 75 then
+   begin
+   inc(Gear.State);
+   Gear.Timer:= 0;
+   if Gear.State > 5 then DeleteGear(Gear)
+   end;
+end;
--- a/hedgewars/uConsts.pas	Sun Aug 28 19:00:20 2005 +0000
+++ b/hedgewars/uConsts.pas	Thu Sep 01 18:41:23 2005 +0000
@@ -43,10 +43,10 @@
                    ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts);
      TSprite    = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
                    sprLag, sprArrow, sprGrenade, sprTargetP, sprUFO,
-                   sprSmokeTrace, sprRopeHook);
+                   sprSmokeTrace, sprRopeHook, sprExplosion50);
      TGearType  = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope,
-                   gtSmokeTrace);
+                   gtSmokeTrace, gtExplosion);
      TSound     = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash,
                    sndShotgunReload, sndShotgunFire, sndGraveImpact);
      TAmmoType  = (amGrenade, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope);
@@ -220,7 +220,8 @@
                                          (FileName:   'Targetp.png'; Path: ptGraphics; Width:  32; Height: 32),// sprTargetP
                                          (FileName:       'UFO.png'; Path: ptGraphics; Width:  32; Height: 32),// sprUFO
                                          (FileName:'SmokeTrace.png'; Path: ptGraphics; Width:  32; Height: 32),// sprSmokeTrace
-                                         (FileName:  'RopeHook.png'; Path: ptGraphics; Width:  32; Height: 32) // sprRopeHook
+                                         (FileName:  'RopeHook.png'; Path: ptGraphics; Width:  32; Height: 32),// sprRopeHook
+                                         (FileName:    'Expl50.png'; Path: ptGraphics; Width:  64; Height: 64) // sprExplosion50
                                          );
       Soundz: array[TSound] of record
                                        FileName: String[31];
--- a/hedgewars/uGears.pas	Sun Aug 28 19:00:20 2005 +0000
+++ b/hedgewars/uGears.pas	Thu Sep 01 18:41:23 2005 +0000
@@ -104,7 +104,8 @@
                                                                doStepActionTimer,
                                                                doStepPickHammer,
                                                                doStepRope,
-                                                               doStepSmokeTrace
+                                                               doStepSmokeTrace,
+                                                               doStepExplosion
                                                                );
 
 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
@@ -170,7 +171,9 @@
                 Result.Timer:= 4000
                 end;
   gtSmokeTrace: begin
-                Result.Tag:= 8
+                Result.X:= Result.X - 16;
+                Result.Y:= Result.Y - 16;
+                Result.State:= 8
                 end;
         gtRope: begin
                 Result.HalfWidth:= 3;
@@ -178,6 +181,10 @@
                 Result.Friction:= 500;
                 RopePoints.Count:= 0;
                 end;
+   gtExplosion: begin
+                Result.X:= Result.X - 25;
+                Result.Y:= Result.Y - 25;
+                end;
      end;
 if GearsList = nil then GearsList:= Result
                    else begin
@@ -406,7 +413,7 @@
        gtHealthTag: DrawCaption(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, PHedgehog(Gear.Hedgehog).HealthTagRect, Surface, true);
            gtGrave: DrawSpriteFromRect(PHedgehog(Gear.Hedgehog).Team.GraveRect, Round(Gear.X) + WorldDx - 16, Round(Gear.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface);
              gtUFO: DrawSprite(sprUFO, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface);
-      gtSmokeTrace: if Gear.Tag < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, Gear.Tag, Surface);
+      gtSmokeTrace: if Gear.State < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface);
             gtRope: begin
                     DrawRopeLine(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy,
                                  Round(PHedgehog(Gear.Hedgehog).Gear.X) + WorldDx, Round(PHedgehog(Gear.Hedgehog).Gear.Y) + WorldDy);
@@ -425,6 +432,7 @@
                        end else
                        DrawSprite(sprRopeHook, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface);
                     end;
+       gtExplosion: DrawSprite(sprExplosion50, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface);
               end;
       Gear:= Gear.NextGear
       end;
@@ -459,6 +467,7 @@
 TargetPoint.X:= NoPointX;
 {$IFDEF DEBUGFILE}if Radius > 3 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
 DrawExplosion(X, Y, Radius);
+if Radius = 50 then AddGear(X, Y, gtExplosion, 0);
 if (Mask and EXPLAutoSound)<>0 then PlaySound(sndExplosion);
 if (Mask and EXPLNoDamage)<>0 then exit;
 if (Mask and EXPLAllDamageInRadius)=0 then Radius:= Radius shl 1;