# HG changeset patch # User unc0rr # Date 1124990136 0 # Node ID 9c1f00e7b43eff002559a9a3abdf8b99d1578603 # Parent 0dafbd19a04c0e49d570bf2c72be210a65f30dac Smooth change wind bar diff -r 0dafbd19a04c -r 9c1f00e7b43e hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Thu Aug 25 16:45:58 2005 +0000 +++ b/hedgewars/GSHandlers.inc Thu Aug 25 17:15:36 2005 +0000 @@ -267,14 +267,23 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepActionTimer(Gear: PGear); begin -dec(Gear.Timer); case Gear.State of gtsStartGame: begin + dec(Gear.Timer); AllInactive:= false; if Gear.Timer > 0 then exit; AddCaption('Let''s fight!', $FFFFFF, capgrpStartGame); DeleteGear(Gear) end; + gtsSmoothWindCh: begin + if Gear.Timer = 0 then + begin + Gear.Timer:= 10; + if WindBarWidth < Gear.Tag then inc(WindBarWidth) + else if WindBarWidth > Gear.Tag then dec(WindBarWidth) + else DeleteGear(Gear) + end else dec(Gear.Timer) + end; end; end; diff -r 0dafbd19a04c -r 9c1f00e7b43e hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Thu Aug 25 16:45:58 2005 +0000 +++ b/hedgewars/uConsts.pas Thu Aug 25 17:15:36 2005 +0000 @@ -118,6 +118,7 @@ gstHHThinking = $00000800; gtsStartGame = 1; + gtsSmoothWindCh = 2; gm_Left = $00000001; gm_Right = $00000002; diff -r 0dafbd19a04c -r 9c1f00e7b43e hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Aug 25 16:45:58 2005 +0000 +++ b/hedgewars/uGears.pas Thu Aug 25 17:15:36 2005 +0000 @@ -59,7 +59,7 @@ Hedgehog: pointer; Health, Damage: LongWord; CollIndex: Longword; - Tag: Longword; + Tag: integer; end; function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear; diff -r 0dafbd19a04c -r 9c1f00e7b43e hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Thu Aug 25 16:45:58 2005 +0000 +++ b/hedgewars/uTeams.pas Thu Aug 25 17:15:36 2005 +0000 @@ -122,6 +122,7 @@ end; ResetKbd; cWindSpeed:= (GetRandom * 2 - 1) * cMaxWindSpeed; +AddGear(0, 0, gtActionTimer, gtsSmoothWindCh).Tag:= round(72 * cWindSpeed / cMaxWindSpeed); {$IFDEF DEBUGFILE}AddFileLog('Wind = '+FloatToStr(cWindSpeed));{$ENDIF} ApplyAmmoChanges(@CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog]); TurnTimeLeft:= cHedgehogTurnTime diff -r 0dafbd19a04c -r 9c1f00e7b43e hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Aug 25 16:45:58 2005 +0000 +++ b/hedgewars/uWorld.pas Thu Aug 25 17:15:36 2005 +0000 @@ -48,6 +48,7 @@ var cntTicks: LongWord; {$ENDIF} var FollowGear: PGear = nil; + WindBarWidth: integer = 0; implementation uses uStore, uMisc, uConsts, uTeams, uIO; @@ -201,28 +202,31 @@ // Wind bar DrawGear(sWindBar, cScreenWidth - 180, cScreenHeight - 30, Surface); -if cWindSpeed > 0 then +if WindBarWidth > 0 then begin - t:= round(72 * cWindSpeed / cMaxWindSpeed); with StuffPoz[sWindR] do begin + {$WARNINGS OFF} r.x:= x + 8 - (RealTicks shr 6) mod 8; + {$WARNINGS ON} r.y:= y; - r.w:= t; + r.w:= WindBarWidth; r.h:= 13; end; DrawSpriteFromRect(r, cScreenWidth - 103, cScreenHeight - 28, 13, 0, Surface); end else + if WindBarWidth < 0 then begin - t:= - round(72 * cWindSpeed / cMaxWindSpeed); with StuffPoz[sWindL] do begin - r.x:= x + (RealTicks shr 6) mod 8; + {$WARNINGS OFF} + r.x:= x + (WindBarWidth + RealTicks shr 6) mod 8; + {$WARNINGS ON} r.y:= y; - r.w:= t; + r.w:= - WindBarWidth; r.h:= 13; end; - DrawSpriteFromRect(r, cScreenWidth - 106 - t, cScreenHeight - 28, 13, 0, Surface); + DrawSpriteFromRect(r, cScreenWidth - 106 + WindBarWidth, cScreenHeight - 28, 13, 0, Surface); end; // Cursor