Fix switching arrows overlapping with hog tags of own hog (while finger is active)
--- a/ChangeLog.txt Thu Aug 15 16:07:57 2019 -0400
+++ b/ChangeLog.txt Thu Aug 15 22:03:43 2019 +0200
@@ -141,6 +141,7 @@
* Suppress “<team> is gone.” message at end of game
* Fix game engine ignoring appropriate number formatting of user language
* Fix buggy behaviour when entering speech bubble command in hog placement phase
+ * Fix switching arrows overlapping hedgehog tags of own hedgehog
Translations:
+ Complete: German, Polish
--- a/hedgewars/uGearsHandlersMess.pas Thu Aug 15 16:07:57 2019 -0400
+++ b/hedgewars/uGearsHandlersMess.pas Thu Aug 15 22:03:43 2019 +0200
@@ -3478,6 +3478,7 @@
HHGear := CurrentHedgehog^.Gear;
ApplyAmmoChanges(HHGear^.Hedgehog^);
DeleteGear(Gear);
+ bShowSwitcher:= false;
exit
end;
@@ -3539,6 +3540,9 @@
begin
Gear^.doStep := @doStepSwitcherWork;
+ // Note: The game assumes there's at most only one gtSwitcher gear in the game.
+ bShowSwitcher:= true;
+
HHGear := Gear^.Hedgehog^.Gear;
OnUsedAmmo(HHGear^.Hedgehog^);
with HHGear^ do
--- a/hedgewars/uGearsRender.pas Thu Aug 15 16:07:57 2019 -0400
+++ b/hedgewars/uGearsRender.pas Thu Aug 15 22:03:43 2019 +0200
@@ -260,13 +260,15 @@
if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
begin
ty := oy - 32;
- // move finger higher up if tags are above hog
+ // move finger higher up if tags or switching arrows are above hog
if (cTagsMask and htTeamName) <> 0 then
ty := ty - HH^.Team^.NameTagTex^.h - 2;
if (cTagsMask and htName) <> 0 then
ty := ty - HH^.NameTagTex^.h - 2;
if (cTagsMask and htHealth) <> 0 then
ty := ty - HH^.HealthTagTex^.h - 2;
+ if bShowSwitcher then
+ ty := ty - SpritesData[sprSwitch].Height - 4;
tx := ox;
// don't go offscreen
@@ -1296,7 +1298,7 @@
vg: PVisualGear;
i: Longword;
aAngle: real;
- startX, endX, startY, endY: LongInt;
+ startX, endX, startY, endY, ty: LongInt;
begin
// airmine has its own sprite
if (Gear^.State and gstFrozen <> 0) and (Gear^.Kind <> gtAirMine) then Tint($A0, $A0, $FF, $FF);
@@ -1547,10 +1549,26 @@
Tint($FFFFFFFF)
else
Tint($000000FF);
- DrawSpriteRotatedF(sprSwitch, x + 1, y - 40, 1, 0, (RealTicks div 5) mod 360);
+
+ ty := y - SpritesData[sprSwitch].Height;
+ // Move higher up if hedgehog tags are visible.
+ // This happens when finger is active. The finger is then moved above the switching arrows.
+ if bShowFinger then
+ begin
+ if (cTagsMask and htTeamName) <> 0 then
+ ty := ty - Gear^.Hedgehog^.Team^.NameTagTex^.h - 2;
+ if (cTagsMask and htName) <> 0 then
+ ty := ty - Gear^.Hedgehog^.NameTagTex^.h - 2;
+ if (cTagsMask and htHealth) <> 0 then
+ ty := ty - Gear^.Hedgehog^.HealthTagTex^.h - 2;
+ if (cTagsMask and (htTeamName or htName or htHealth)) <> 0 then
+ ty := ty - 4;
+ end;
+
+ DrawSpriteRotatedF(sprSwitch, x + 1, ty, 1, 0, (RealTicks div 5) mod 360);
Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF);
- DrawSpriteRotatedF(sprSwitch, x + 1, y - 40, 0, 0, (RealTicks div 5) mod 360);
+ DrawSpriteRotatedF(sprSwitch, x + 1, ty, 0, 0, (RealTicks div 5) mod 360);
untint;
setTintAdd(false);
end;
--- a/hedgewars/uVariables.pas Thu Aug 15 16:07:57 2019 -0400
+++ b/hedgewars/uVariables.pas Thu Aug 15 22:03:43 2019 +0200
@@ -2577,6 +2577,7 @@
bShowAmmoMenu: boolean;
bSelected: boolean;
bShowFinger: boolean;
+ bShowSwitcher: boolean;
Frames: Longword;
WaterColor, DeepWaterColor: TSDL_Color;
SDTint, SkyColor, RQSkyColor, SDSkyColor: TSDL_Color;