# HG changeset patch # User Xeli # Date 1335708582 -7200 # Node ID ab8034208fcdd1fce519bcab18cf1cc12e1684f6 # Parent 7d9e2669c2f555f2dde89948a56cb80dfa2cd26b target using the utility button, this fixes bee diff -r 7d9e2669c2f5 -r ab8034208fcd hedgewars/uTouch.pas --- a/hedgewars/uTouch.pas Sun Apr 29 14:10:59 2012 +0200 +++ b/hedgewars/uTouch.pas Sun Apr 29 16:09:42 2012 +0200 @@ -80,7 +80,7 @@ targetAngle: LongInt; buttonsDown: Longword; - targetting: boolean; //true when targetting an airstrike or the like + targetting, targetted: boolean; //true when targetting an airstrike or the like procedure onTouchDown(x,y: Longword; pointerId: TSDL_FingerId); var @@ -101,9 +101,7 @@ if isOnWidget(fireButton, finger^) then begin - if not((CurrentHedgehog <> nil) and - (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0)) then - ParseTeamCommand('+attack'); + ParseTeamCommand('+attack'); moveCursor:= false; finger^.pressedWidget:= @fireButton; exit; @@ -149,11 +147,14 @@ if isOnWidget(utilityWidget, finger^) then begin + finger^.pressedWidget:= @utilityWidget; + moveCursor:= false; if(CurrentHedgehog <> nil) then begin if Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Timerable <> 0 then ParseTeamCommand('/timer ' + inttostr((GetCurAmmoEntry(CurrentHedgeHog^)^.Timer div 1000) mod 5 + 1)); end; + exit; end; dec(buttonsDown);//no buttonsDown, undo the inc() above if buttonsDown = 0 then @@ -161,7 +162,7 @@ moveCursor:= true; case pointerCount of 1: - targetting:= (CurrentHedgehog <> nil) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0); + targetting:= not(targetted) and (CurrentHedgehog <> nil) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0); 2: begin moveCursor:= false; @@ -259,15 +260,19 @@ ParseTeamCommand('-down'); if widget = @fireButton then + ParseTeamCommand('-attack'); + + if widget = @utilityWidget then if (CurrentHedgehog <> nil) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0)then - ParseTeamCommand('put') - else - ParseTeamCommand('-attack'); + begin + ParseTeamCommand('put'); + targetted:= true; + end; end; if targetting then - AddCaption('Press the attack button to mark the target', cWhiteColor, capgrpAmmoInfo); + AddCaption('Press the target button to mark the target', cWhiteColor, capgrpAmmoInfo); deleteFinger(pointerId); {$ENDIF} diff -r 7d9e2669c2f5 -r ab8034208fcd hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Sun Apr 29 14:10:59 2012 +0200 +++ b/hedgewars/uTypes.pas Sun Apr 29 16:09:42 2012 +0200 @@ -59,7 +59,7 @@ sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR, {$IFDEF USE_TOUCH_INTERFACE} sprFireButton, sprArrowUp, sprArrowDown, sprArrowLeft, sprArrowRight, - sprJumpWidget, sprAMWidget, sprPauseButton, sprTimerButton, + sprJumpWidget, sprAMWidget, sprPauseButton, sprTimerButton, sprTargetButton, {$ENDIF} sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun, sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer, diff -r 7d9e2669c2f5 -r ab8034208fcd hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sun Apr 29 14:10:59 2012 +0200 +++ b/hedgewars/uVariables.pas Sun Apr 29 16:09:42 2012 +0200 @@ -406,6 +406,8 @@ Width: 120; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprPauseButton (FileName: 'pause'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;//TODO correct image Width: 120; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprTimerButton + (FileName: 'forwardjump'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;//TODO correct image + Width: 120; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprTargetButton {$ENDIF} (FileName: 'Flake'; Path:ptCurrTheme; AltPath: ptNone; Texture: nil; Surface: nil; Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlake diff -r 7d9e2669c2f5 -r ab8034208fcd hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Sun Apr 29 14:10:59 2012 +0200 +++ b/hedgewars/uWorld.pas Sun Apr 29 16:09:42 2012 +0200 @@ -729,12 +729,16 @@ end; if (Ammo^[Slot, Pos].Propz and ammoprop_Timerable) <> 0 then begin - if not utilityWidget.show then - animateWidget(@utilityWidget, true, true); + 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); + else if utilityWidget.show then + animateWidget(@utilityWidget, true, false); {$ENDIF} exit