hedgewars/uWorld.pas
changeset 6961 d5ac09894a1b
parent 6957 ab8034208fcd
child 6962 ec308eabe09b
equal deleted inserted replaced
6960:822f8269e13f 6961:d5ac09894a1b
    34 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    34 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    35 procedure HideMission;
    35 procedure HideMission;
    36 procedure ShakeCamera(amount: LongInt);
    36 procedure ShakeCamera(amount: LongInt);
    37 procedure InitCameraBorders;
    37 procedure InitCameraBorders;
    38 procedure InitTouchInterface;
    38 procedure InitTouchInterface;
       
    39 procedure SetUtilityWidgetState(ammoType: TAmmoType = amNothing);
    39 procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean);
    40 procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean);
    40 procedure MoveCamera;
    41 procedure MoveCamera;
    41 procedure onFocusStateChanged;
    42 procedure onFocusStateChanged;
    42 
    43 
    43 implementation
    44 implementation
   725                     if arrowUp.show then
   726                     if arrowUp.show then
   726                         begin
   727                         begin
   727                         animateWidget(@arrowUp, true, false);
   728                         animateWidget(@arrowUp, true, false);
   728                         animateWidget(@arrowDown, true, false);
   729                         animateWidget(@arrowDown, true, false);
   729                         end;
   730                         end;
   730                 if (Ammo^[Slot, Pos].Propz and ammoprop_Timerable) <> 0 then
   731                 SetUtilityWidgetState(Ammo^[Slot, Pos].AmmoType);
   731                     begin
       
   732                     utilityWidget.sprite:= sprTimerButton;
       
   733                     animateWidget(@utilityWidget, true, true);
       
   734                     end 
       
   735                 else if (Ammo^[Slot, Pos].Propz and ammoprop_NeedTarget) <> 0 then
       
   736                     begin
       
   737                     utilityWidget.sprite:= sprTargetButton;
       
   738                     animateWidget(@utilityWidget, true, true);
       
   739                     end
       
   740                 else if utilityWidget.show then
       
   741                     animateWidget(@utilityWidget, true, false); 
       
   742 {$ENDIF}
   732 {$ENDIF}
   743 
       
   744                 exit
   733                 exit
   745                 end;
   734                 end;
   746             end
   735             end
   747         end
   736         end
   748     else
   737     else
  1758 
  1747 
  1759 if not cHasFocus then DampenAudio()
  1748 if not cHasFocus then DampenAudio()
  1760 else UndampenAudio();
  1749 else UndampenAudio();
  1761 end;
  1750 end;
  1762 
  1751 
       
  1752 procedure SetUtilityWidgetState(ammoType: TAmmoType);
       
  1753 begin
       
  1754 if(ammoType = amNothing)then
       
  1755     ammoType:= CurrentHedgehog^.CurAmmoType;
       
  1756 
       
  1757 if(CurrentHedgehog <> nil)then
       
  1758     if (Ammoz[ammoType].Ammo.Propz and ammoprop_Timerable) <> 0 then
       
  1759         begin
       
  1760         utilityWidget.sprite:= sprTimerButton;
       
  1761         animateWidget(@utilityWidget, true, true);
       
  1762         end 
       
  1763     else if (Ammoz[ammoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
       
  1764         begin
       
  1765         utilityWidget.sprite:= sprTargetButton;
       
  1766         animateWidget(@utilityWidget, true, true);
       
  1767         end
       
  1768     else if utilityWidget.show then
       
  1769         animateWidget(@utilityWidget, true, false); 
       
  1770 end;
       
  1771 
  1763 procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean);
  1772 procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean);
  1764 begin
  1773 begin
  1765 with widget^ do
  1774 with widget^ do
  1766     begin
  1775     begin
  1767     show:= showWidget;
  1776     show:= showWidget;