Add drill rocket animation
authorWuzzy <Wuzzy2@mail.ru>
Fri, 24 May 2019 14:55:48 +0200
changeset 15043 01bb1d7ca14f
parent 15042 6c5502b9a038
child 15044 a4a058dcbbd6
Add drill rocket animation
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
share/hedgewars/Data/Graphics/AirDrill.png
share/hedgewars/Data/Graphics/Drill.png
--- a/ChangeLog.txt	Fri May 24 12:31:30 2019 +0200
+++ b/ChangeLog.txt	Fri May 24 14:55:48 2019 +0200
@@ -86,6 +86,7 @@
  * Fix broken default keyboard controls for team chat and camera movement
 
 Graphics:
+ + Animate drill rockets
  * Fix speech bubbles overlapping in the wrong order
  * Fix wrong ice beam angle if it goes diagonally up out of map through world wrap
  * Fix double water splash when flying saucer drowns
--- a/hedgewars/uGearsHandlersMess.pas	Fri May 24 12:31:30 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Fri May 24 14:55:48 2019 +0200
@@ -4170,6 +4170,7 @@
         Gear^.X:= Gear^.X+Gear^.dX*4;
         Gear^.Y:= Gear^.Y+Gear^.dY*4;
         Gear^.SoundChannel := LoopSound(sndDrillRocket);
+        Gear^.Pos:= 1;
         Gear^.doStep := @doStepDrillDrilling;
 
         if (Gear^.State and gsttmpFlag) <> 0 then
--- a/hedgewars/uGearsList.pas	Fri May 24 12:31:30 2019 +0200
+++ b/hedgewars/uGearsList.pas	Fri May 24 14:55:48 2019 +0200
@@ -628,6 +628,8 @@
                     gear^.Timer:= 5000;
                 // Tag for drill strike. if 1 then first impact occured already
                 gear^.Tag := 0;
+                // Pos for state. If 1, drill is drilling
+                gear^.Pos := 0;
                 gear^.Radius:= 4;
                 gear^.Density:= _1;
                 end;
--- a/hedgewars/uGearsRender.pas	Fri May 24 12:31:30 2019 +0200
+++ b/hedgewars/uGearsRender.pas	Fri May 24 14:55:48 2019 +0200
@@ -1300,11 +1300,16 @@
                      end;
                  end;
 
-           gtDrill: if (Gear^.State and gsttmpFlag) <> 0 then
-                        DrawSpriteRotated(sprAirDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX))
+           gtDrill: begin
+                    if (Gear^.Pos = 1) then
+                        i:= (RealTicks shr 5 + Gear^.uid) mod 4
                     else
-                        DrawSpriteRotated(sprDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-
+                        i:= Gear^.uid mod 4;
+                    if (Gear^.State and gsttmpFlag) <> 0 then
+                        DrawTextureRotatedF(SpritesData[sprAirDrill].texture, 0.5, 0, 0, x, y, i, 0, 64, 64, DxDy2Angle(Gear^.dY, Gear^.dX))
+                    else
+                        DrawTextureRotatedF(SpritesData[sprDrill].texture, 0.5, 0, 0, x, y, i, 0, 64, 64, DxDy2Angle(Gear^.dY, Gear^.dX));
+                    end;
         gtHedgehog: DrawHH(Gear, x, y);
 
            gtShell: DrawSpriteRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
Binary file share/hedgewars/Data/Graphics/AirDrill.png has changed
Binary file share/hedgewars/Data/Graphics/Drill.png has changed