--- a/hedgewars/GSHandlers.inc Thu Jun 30 18:20:41 2011 -0400
+++ b/hedgewars/GSHandlers.inc Fri Jul 01 10:38:00 2011 +0400
@@ -605,6 +605,7 @@
begin
with Gear^ do
begin
+ State:= State and not gstInvisible;
X:= X + cWindSpeed * 3200 + dX;
Y:= Y + dY + cGravity * vobFallSpeed * 8; // using same value as flakes to try and get similar results
xx:= hwRound(X);
--- a/hedgewars/VGSHandlers.inc Thu Jun 30 18:20:41 2011 -0400
+++ b/hedgewars/VGSHandlers.inc Fri Jul 01 10:38:00 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/uConsts.pas Thu Jun 30 18:20:41 2011 -0400
+++ b/hedgewars/uConsts.pas Fri Jul 01 10:38:00 2011 +0400
@@ -209,6 +209,7 @@
gstNotKickable = $00040000;
gstLoser = $00080000;
gstHHGone = $00100000;
+ gstInvisible = $00200000;
gmLeft = $00000001;
gmRight = $00000002;
--- a/hedgewars/uGame.pas Thu Jun 30 18:20:41 2011 -0400
+++ b/hedgewars/uGame.pas Fri Jul 01 10:38:00 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 18:20:41 2011 -0400
+++ b/hedgewars/uGears.pas Fri Jul 01 10:38:00 2011 +0400
@@ -107,7 +107,6 @@
@doStepFirePunch,
@doStepActionTimer,
@doStepActionTimer,
- @doStepActionTimer,
@doStepParachute,
@doStepAirAttack,
@doStepAirBomb,
@@ -222,65 +221,15 @@
gear^.SoundChannel:= -1;
gear^.ImpactSound:= sndNone;
gear^.nImpactSounds:= 0;
-gear^.AmmoType:= amNothing;
+// Define ammo association, if any.
+gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
if CurrentHedgehog <> nil then
begin
gear^.Hedgehog:= CurrentHedgehog;
gear^.IntersectGear:= CurrentHedgehog^.Gear
end;
-// Define ammo association, if any.
-case Kind of
- gtGrenade: gear^.AmmoType:= amGrenade;
- gtShell: gear^.AmmoType:= amBazooka;
- gtBee: gear^.AmmoType:= amBee;
- gtShotgunShot: gear^.AmmoType:= amShotgun;
- gtPickHammer: gear^.AmmoType:= amPickHammer;
- gtRope: gear^.AmmoType:= amRope;
- gtDEagleShot: gear^.AmmoType:= amDEagle;
- gtDynamite: gear^.AmmoType:= amDynamite;
- gtClusterBomb,
- gtCluster: gear^.AmmoType:= amClusterBomb;
- gtShover: gear^.AmmoType:= amBaseballBat; // Shover is only used for baseball bat right now
- gtFirePunch: gear^.AmmoType:= amFirePunch;
- gtParachute: gear^.AmmoType:= amParachute;
- gtAirBomb: gear^.AmmoType:= amAirAttack;
- gtBlowTorch: gear^.AmmoType:= amBlowTorch;
- gtGirder: gear^.AmmoType:= amGirder;
- gtTeleport: gear^.AmmoType:= amTeleport;
- gtSwitcher: gear^.AmmoType:= amSwitch;
- gtMortar: gear^.AmmoType:= amMortar;
- gtWhip: gear^.AmmoType:= amWhip;
- gtKamikaze: gear^.AmmoType:= amKamikaze;
- gtCake: gear^.AmmoType:= amCake;
- gtSeduction: gear^.AmmoType:= amSeduction;
- gtWatermelon,
- gtMelonPiece: gear^.AmmoType:= amWatermelon;
- gtHellishBomb: gear^.AmmoType:= amHellishBomb;
- gtDrill: gear^.AmmoType:= amDrill;
- gtBallGun,
- gtBall: gear^.AmmoType:= amBallgun;
- gtRCPlane: gear^.AmmoType:= amRCPlane;
-gtSniperRifleShot: gear^.AmmoType:= amSniperRifle;
- gtJetpack: gear^.AmmoType:= amJetpack;
- gtMolotov: gear^.AmmoType:= amMolotov;
- gtBirdy,
- gtEgg: gear^.AmmoType:= amBirdy;
- gtPortal: gear^.AmmoType:= amPortalGun;
- gtPiano: gear^.AmmoType:= amPiano;
- gtGasBomb: gear^.AmmoType:= amGasBomb;
- gtSineGunShot: gear^.AmmoType:= amSineGun;
- gtFlamethrower: gear^.AmmoType:= amFlamethrower;
- gtSMine: gear^.AmmoType:= amSMine;
- gtHammer,
- gtHammerHit: gear^.AmmoType:= amHammer;
- gtResurrector: gear^.AmmoType:= amResurrector;
- gtSnowball: gear^.AmmoType:= amSnowball;
- gtStructure: gear^.AmmoType:= amStructure; // TODO - This will undoubtedly change once there is more than one structure
- gtLandGun: gear^.AmmoType:= amLandGun;
- gtTardis: gear^.AmmoType:= amTardis;
-end;
-
+
case Kind of
gtGrenade,
gtClusterBomb,
@@ -341,6 +290,7 @@
dx.QWordValue:= GetRandom(100000000);
dy.isNegative:= false;
dy.QWordValue:= GetRandom(70000000);
+ State:= State or gstInvisible;
if GetRandom(2) = 0 then dx := -dx;
Health:= random(vobFrameTicks);
Timer:= random(vobFramesCount);
@@ -1175,9 +1125,12 @@
Gear:= GearsList;
while Gear <> nil do
begin
- x:= hwRound(Gear^.X) + WorldDx;
- y:= hwRound(Gear^.Y) + WorldDy;
- RenderGear(Gear, x, y);
+ if Gear^.State and gstInvisible = 0 then
+ begin
+ x:= hwRound(Gear^.X) + WorldDx;
+ y:= hwRound(Gear^.Y) + WorldDy;
+ RenderGear(Gear, x, y);
+ end;
Gear:= Gear^.NextGear
end;
end;
--- a/hedgewars/uScript.pas Thu Jun 30 18:20:41 2011 -0400
+++ b/hedgewars/uScript.pas Fri Jul 01 10:38:00 2011 +0400
@@ -1306,7 +1306,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 18:20:41 2011 -0400
+++ b/hedgewars/uTeams.pas Fri Jul 01 10:38:00 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 18:20:41 2011 -0400
+++ b/hedgewars/uTypes.pas Fri Jul 01 10:38:00 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 18:20:41 2011 -0400
+++ b/hedgewars/uVariables.pas Fri Jul 01 10:38:00 2011 +0400
@@ -2170,6 +2170,71 @@
ejectY: -3)
);
+ GearKindAmmoTypeMap : array [TGearType] of TAmmoType = (
+(* gtGrenade *) amGrenade
+(* gtHedgehog *) , amNothing
+(* gtShell *) , amBazooka
+(* gtGrave *) , amNothing
+(* gtBee *) , amBee
+(* gtShotgunShot *) , amShotgun
+(* gtPickHammer *) , amPickHammer
+(* gtRope *) , amRope
+(* gtMine *) , amNothing
+(* gtCase *) , amNothing
+(* gtDEagleShot *) , amDEagle
+(* gtDynamite *) , amDynamite
+(* gtClusterBomb *) , amClusterBomb
+(* gtCluster *) , amClusterBomb
+(* gtShover *) , amBaseballBat // Shover is only used for baseball bat right now
+(* gtFlame *) , amNothing
+(* gtFirePunch *) , amFirePunch
+(* gtATStartGame *) , amNothing
+(* gtATFinishGame *) , amNothing
+(* gtParachute *) , amParachute
+(* gtAirAttack *) , amAirAttack
+(* gtAirBomb *) , amAirAttack
+(* gtBlowTorch *) , amBlowTorch
+(* gtGirder *) , amGirder
+(* gtTeleport *) , amTeleport
+(* gtSwitcher *) , amSwitch
+(* gtTarget *) , amNothing
+(* gtMortar *) , amMortar
+(* gtWhip *) , amWhip
+(* gtKamikaze *) , amKamikaze
+(* gtCake *) , amCake
+(* gtSeduction *) , amSeduction
+(* gtWatermelon *) , amWatermelon
+(* gtMelonPiece *) , amWatermelon
+(* gtHellishBomb *) , amHellishBomb
+(* gtWaterUp *) , amNothing
+(* gtDrill *) , amDrill
+(* gtBallGun *) , amBallgun
+(* gtBall *) , amBallgun
+(* gtRCPlane *) , amRCPlane
+(*gtSniperRifleShot *) , amSniperRifle
+(* gtJetpack *) , amJetpack
+(* gtMolotov *) , amMolotov
+(* gtExplosives *) , amNothing
+(* gtBirdy *) , amBirdy
+(* gtEgg *) , amBirdy
+(* gtPortal *) , amPortalGun
+(* gtPiano *) , amPiano
+(* gtGasBomb *) , amGasBomb
+(* gtSineGunShot *) , amSineGun
+(* gtFlamethrower *) , amFlamethrower
+(* gtSMine *) , amSMine
+(* gtPoisonCloud *) , amNothing
+(* gtHammer *) , amHammer
+(* gtHammerHit *) , amHammer
+(* gtResurrector *) , amResurrector
+(* gtPoisonCloud *) , amNothing
+(* gtSnowball *) , amSnowball
+(* gtFlake *) , amNothing
+(* gtStructure *) , amStructure // TODO - This will undoubtedly change once there is more than one structure
+(* gtLandGun *) , amLandGun
+(* gtTardis *) , amTardis
+ );
+
var
Land: TCollisionArray;
LandPixels: TLandArray;
--- a/hedgewars/uVisualGears.pas Thu Jun 30 18:20:41 2011 -0400
+++ b/hedgewars/uVisualGears.pas Fri Jul 01 10:38:00 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;