# HG changeset patch # User Xeli # Date 1332025353 -3600 # Node ID 3e89dbdc7db914ab30393aeba5817dc8f2d5c640 # Parent e4831e13e04a18ba93dc8af1e607711fed919102 You can now change AMAnimType to enable the animation through the x/y axis and alpha for example AMAnimType:= AMTypeMaskX or AMTypeMaskAlpha will enable movement over the X axis and alpha diff -r e4831e13e04a -r 3e89dbdc7db9 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sat Mar 17 22:39:16 2012 +0100 +++ b/hedgewars/uConsts.pas Sun Mar 18 00:02:33 2012 +0100 @@ -290,11 +290,16 @@ htTransparent = $08; AMAnimDuration = 500; - AMHidden = 0; + AMHidden = 0;//AMState values AMShowingUp = 1; AMShowing = 2; AMHiding = 3; + AMTypeMaskX = $00000001; + AMTypeMaskY = $00000002; + AMTypeMaskAlpha = $00000004; + AMTypeMaskSlide = $00000008; + {$IFDEF MOBILE} AMSlotSize = 48; AMTITLE = 30; diff -r e4831e13e04a -r 3e89dbdc7db9 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sat Mar 17 22:39:16 2012 +0100 +++ b/hedgewars/uVariables.pas Sun Mar 18 00:02:33 2012 +0100 @@ -202,6 +202,8 @@ firebutton, jumpWidget, AMWidget : TOnScreenWidget; pauseButton : TOnScreenWidget; {$ENDIF} + + AMAnimType : LongInt; const cHHFileName = 'Hedgehog'; cCHFileName = 'Crosshair'; diff -r e4831e13e04a -r 3e89dbdc7db9 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Sat Mar 17 22:39:16 2012 +0100 +++ b/hedgewars/uWorld.pas Sun Mar 18 00:02:33 2012 +0100 @@ -64,12 +64,11 @@ var cWaveWidth, cWaveHeight: LongInt; AMShiftTargetX, AMShiftTargetY, AMShiftX, AMShiftY, SlotsNum: LongInt; + AMAnimStartTime, AMState : LongInt; + AMAnimState: Single; tmpSurface: PSDL_Surface; fpsTexture: PTexture; timeTexture: PTexture; - AMAnimStartTime : LongInt; - AMAnimState: Single; - AMState: LongInt; FPS: Longword; CountTicks: Longword; SoundTimerTicks: Longword; @@ -201,7 +200,7 @@ HorizontOffset:= 0; InitTouchInterface(); - +AMAnimType:= AMTypeMaskX or AMTypeMaskAlpha; end; procedure InitCameraBorders; @@ -501,8 +500,10 @@ AmmoRect.x:= (cScreenWidth shr 1) - AmmoRect.w - AMSlotSize; AmmoRect.y:= cScreenHeight - (AmmoRect.h + AMSlotSize); {$ENDIF} - AMShiftTargetX:= (cScreenWidth shr 1) - AmmoRect.x; - AMShiftTargetY:= cScreenHeight - AmmoRect.y; + if (AMAnimType and AMTypeMaskX) <> 0 then AMShiftTargetX:= (cScreenWidth shr 1) - AmmoRect.x + else AMShiftTargetX:= 0; + if (AMAnimType and AMTypeMaskY) <> 0 then AMShiftTargetY:= cScreenHeight - AmmoRect.y + else AMShiftTargetY:= 0; AMShiftX:= AMShiftTargetX; AMShiftY:= AMShiftTargetY; end; @@ -522,7 +523,8 @@ begin AMShiftX:= Round(AMShiftTargetX * (1 - AMAnimState)); AMShiftY:= Round(AMShiftTargetY * (1 - AMAnimState)); - Tint($FF, $ff, $ff, Round($ff * AMAnimState)); + if (AMAnimType and AMTypeMaskAlpha) <> 0 then + Tint($FF, $ff, $ff, Round($ff * AMAnimState)); end else begin @@ -546,7 +548,8 @@ begin AMShiftX:= Round(AMShiftTargetX * AMAnimState); AMShiftY:= Round(AMShiftTargetY * AMAnimState); - Tint($FF, $ff, $ff, Round($ff * (1-AMAnimState))); + if (AMAnimType and AMTypeMaskAlpha) <> 0 then + Tint($FF, $ff, $ff, Round($ff * (1-AMAnimState))); end else begin @@ -558,11 +561,13 @@ end; DrawTexture(AmmoRect.x + AMShiftX, AmmoRect.y + AMShiftY, AmmoMenuTex); -Tint($FF, $ff, $ff, $ff); + +if ((AMState = AMHiding) or (AMState = AMShowingUp)) and ((AMAnimType and AMTypeMaskAlpha) <> 0 )then + Tint($FF, $ff, $ff, $ff); - Pos:= -1; - Slot:= -1; - c:= -1; +Pos:= -1; +Slot:= -1; +c:= -1; {$IFDEF USE_LANDSCAPE_AMMOMENU} for i:= 0 to cMaxSlotIndex do if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then