--- a/hedgewars/GSHandlers.inc Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/GSHandlers.inc Thu Jun 30 15:09:10 2011 +0400
@@ -1079,15 +1079,6 @@
AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState);
end
end;
- gtATSmoothWindCh:
- begin
- if Gear^.Timer = 0 then
- begin
- if WindBarWidth < Gear^.Tag then inc(WindBarWidth)
- else if WindBarWidth > Gear^.Tag then dec(WindBarWidth);
- if WindBarWidth <> Gear^.Tag then Gear^.Timer := 10;
- end
- end;
gtATFinishGame:
begin
AllInactive := false;
--- a/hedgewars/VGSHandlers.inc Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/VGSHandlers.inc Thu Jun 30 15:09:10 2011 +0400
@@ -607,6 +607,9 @@
(*
FIXME - This block desyncs due to the way WorldDx is important for various things network related.
One possible solution is, instead of using WorldDx, to use straight gl/SDL calls to jitter the screen a bit.
+
+// a comment by unC0Rr: instead of changing WorldDx shake cursor coordinates, that should be safe
+
if (Gear^.Timer and 5) = 0 then
begin
maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250));
@@ -688,3 +691,20 @@
end
end
end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepSmoothWindBar(Gear: PVisualGear; Steps: Longword);
+begin
+ inc(Gear^.Timer, Steps);
+
+ while Gear^.Timer >= 10 do
+ begin
+ dec(Gear^.Timer, 10);
+ if WindBarWidth < Gear^.Tag then inc(WindBarWidth)
+ else if WindBarWidth > Gear^.Tag then dec(WindBarWidth);
+ end;
+
+if WindBarWidth = Gear^.Tag then
+ DeleteVisualGear(Gear)
+end;
+
--- a/hedgewars/uGame.pas Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/uGame.pas Thu Jun 30 15:09:10 2011 +0400
@@ -75,6 +75,7 @@
if isSoundEnabled then playMusic;
GameType:= gmtLocal;
AddVisualGear(0, 0, vgtTeamHealthSorter);
+ AddVisualGear(0, 0, vgtSmoothWindBar);
{$IFDEF IPHONEOS}InitIPC;{$ENDIF}
uMobile.SaveFinished();
end;
--- a/hedgewars/uGears.pas Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/uGears.pas Thu Jun 30 15:09:10 2011 +0400
@@ -107,7 +107,6 @@
@doStepFirePunch,
@doStepActionTimer,
@doStepActionTimer,
- @doStepActionTimer,
@doStepParachute,
@doStepAirAttack,
@doStepAirBomb,
--- a/hedgewars/uScript.pas Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/uScript.pas Thu Jun 30 15:09:10 2011 +0400
@@ -1305,7 +1305,7 @@
cWindSpeedf:= SignAs(cWindSpeed,cWindSpeed).QWordValue / SignAs(_1,_1).QWordValue;
if cWindSpeed.isNegative then
CWindSpeedf := -cWindSpeedf;
- AddGear(0, 0, gtATSmoothWindCh, 0, _0, _0, 1)^.Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
+ AddVisualGear(0, 0, vgtSmoothWindBar);
end;
lc_setwind:= 0
end;
--- a/hedgewars/uTeams.pas Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/uTeams.pas Thu Jun 30 15:09:10 2011 +0400
@@ -179,8 +179,7 @@
end;
procedure AfterSwitchHedgehog;
-var g: PGear;
- i, t: LongInt;
+var i, t: LongInt;
CurWeapon: PAmmo;
begin
@@ -229,8 +228,7 @@
cWindSpeedf:= SignAs(cWindSpeed,cWindSpeed).QWordValue / SignAs(_1,_1).QWordValue;
if cWindSpeed.isNegative then
CWindSpeedf := -cWindSpeedf;
- g:= AddGear(0, 0, gtATSmoothWindCh, 0, _0, _0, 1);
- g^.Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
+ AddVisualGear(0, 0, vgtSmoothWindBar);
AddFileLog('Wind = '+FloatToStr(cWindSpeed));
end;
--- a/hedgewars/uTypes.pas Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/uTypes.pas Thu Jun 30 15:09:10 2011 +0400
@@ -89,15 +89,15 @@
TGearType = (gtGrenade, gtHedgehog, gtShell, gtGrave, gtBee, // 4
gtShotgunShot, gtPickHammer, gtRope, gtMine, gtCase, // 9
gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 14
- gtFlame, gtFirePunch, gtATStartGame, gtATSmoothWindCh, // 18
- gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23
- gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 28
- gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 34
- gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40
- gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45
- gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51
- gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56
- gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun, gtTardis); // 62
+ gtFlame, gtFirePunch, gtATStartGame, // 17
+ gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 22
+ gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 27
+ gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 33
+ gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 39
+ gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 44
+ gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 50
+ gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 55
+ gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun, gtTardis); // 61
// Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
@@ -105,7 +105,8 @@
vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell,
vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg,
vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion,
- vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle);
+ vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle,
+ vgtSmoothWindBar);
TGearsType = set of TGearType;
@@ -274,6 +275,7 @@
Tex: PTexture;
alpha, scale: GLfloat;
Hedgehog: PHedgehog;
+ Tag: LongInt;
Text: shortstring;
Tint: Longword;
uid: Longword;
--- a/hedgewars/uVariables.pas Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/uVariables.pas Thu Jun 30 15:09:10 2011 +0400
@@ -2189,7 +2189,6 @@
(* gtFlame *) , amNothing
(* gtFirePunch *) , amFirePunch
(* gtATStartGame *) , amNothing
-(* gtATSmoothWindCh *) , amNothing
(* gtATFinishGame *) , amNothing
(* gtParachute *) , amParachute
(* gtAirAttack *) , amAirAttack
--- a/hedgewars/uVisualGears.pas Thu Jun 30 14:28:13 2011 +0400
+++ b/hedgewars/uVisualGears.pas Thu Jun 30 15:09:10 2011 +0400
@@ -108,7 +108,8 @@
@doStepNote,
@doStepLineTrail,
@doStepBulletHit,
- @doStepCircle
+ @doStepCircle,
+ @doStepSmoothWindBar
);
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0; Critical: Boolean = false): PVisualGear;
@@ -134,7 +135,8 @@
vgtExplosion,
vgtSmokeTrace,
vgtEvilTrace,
- vgtNote]) then
+ vgtNote,
+ vgtSmoothWindBar]) then
begin
AddVisualGear:= nil;
exit
@@ -327,6 +329,7 @@
Frame:= 7;
Angle := 0;
end;
+vgtSmoothWindBar: Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
end;
if State <> 0 then gear^.State:= State;