--- a/hedgewars/uWorld.pas Sun Apr 29 20:52:10 2012 +0200
+++ b/hedgewars/uWorld.pas Sun Apr 29 18:08:46 2012 +0200
@@ -36,6 +36,7 @@
procedure ShakeCamera(amount: LongInt);
procedure InitCameraBorders;
procedure InitTouchInterface;
+procedure SetUtilityWidgetState(ammoType: TAmmoType = amNothing);
procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean);
procedure MoveCamera;
procedure onFocusStateChanged;
@@ -727,20 +728,8 @@
animateWidget(@arrowUp, true, false);
animateWidget(@arrowDown, true, false);
end;
- if (Ammo^[Slot, Pos].Propz and ammoprop_Timerable) <> 0 then
- begin
- utilityWidget.sprite:= sprTimerButton;
- animateWidget(@utilityWidget, true, true);
- end
- else if (Ammo^[Slot, Pos].Propz and ammoprop_NeedTarget) <> 0 then
- begin
- utilityWidget.sprite:= sprTargetButton;
- animateWidget(@utilityWidget, true, true);
- end
- else if utilityWidget.show then
- animateWidget(@utilityWidget, true, false);
+ SetUtilityWidgetState(Ammo^[Slot, Pos].AmmoType);
{$ENDIF}
-
exit
end;
end
@@ -1760,6 +1749,26 @@
else UndampenAudio();
end;
+procedure SetUtilityWidgetState(ammoType: TAmmoType);
+begin
+if(ammoType = amNothing)then
+ ammoType:= CurrentHedgehog^.CurAmmoType;
+
+if(CurrentHedgehog <> nil)then
+ if (Ammoz[ammoType].Ammo.Propz and ammoprop_Timerable) <> 0 then
+ begin
+ utilityWidget.sprite:= sprTimerButton;
+ animateWidget(@utilityWidget, true, true);
+ end
+ else if (Ammoz[ammoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
+ begin
+ utilityWidget.sprite:= sprTargetButton;
+ animateWidget(@utilityWidget, true, true);
+ end
+ else if utilityWidget.show then
+ animateWidget(@utilityWidget, true, false);
+end;
+
procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean);
begin
with widget^ do