sheepluva adds back non-vgt health tag due to desyncs. we should still see about solving the desync though.
--- a/hedgewars/GSHandlers.inc Tue May 11 13:59:57 2010 +0000
+++ b/hedgewars/GSHandlers.inc Fri May 14 16:02:27 2010 +0000
@@ -447,6 +447,50 @@
end;
////////////////////////////////////////////////////////////////////////////////
+procedure doStepHealthTagWork(Gear: PGear);
+begin
+if Gear^.Kind = gtHealthTag then
+ AllInactive:= false;
+
+dec(Gear^.Timer);
+Gear^.Y:= Gear^.Y + Gear^.dY;
+
+if Gear^.Timer = 0 then
+ begin
+ if (Gear^.Kind = gtHealthTag) and (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then
+ PHedgehog(Gear^.Hedgehog)^.Gear^.Active:= true; // to let current hh die
+ DeleteGear(Gear)
+ end
+end;
+
+procedure doStepHealthTagWorkUnderWater(Gear: PGear);
+begin
+AllInactive:= false;
+
+Gear^.Y:= Gear^.Y - _0_08;
+
+if hwRound(Gear^.Y) < cWaterLine + 10 then
+ DeleteGear(Gear)
+end;
+
+procedure doStepHealthTag(Gear: PGear);
+var s: shortstring;
+begin
+AllInactive:= false;
+Gear^.dY:= -_0_08;
+
+str(Gear^.State, s);
+Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16);
+
+if hwRound(Gear^.Y) < cWaterLine then
+ Gear^.doStep:= @doStepHealthTagWork
+else
+ Gear^.doStep:= @doStepHealthTagWorkUnderWater;
+
+Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Tex^.h)
+end;
+
+////////////////////////////////////////////////////////////////////////////////
procedure doStepGrave(Gear: PGear);
begin
AllInactive := false;
--- a/hedgewars/GearDrawing.inc Tue May 11 13:59:57 2010 +0000
+++ b/hedgewars/GearDrawing.inc Fri May 14 16:02:27 2010 +0000
@@ -667,6 +667,8 @@
gtHedgehog: DrawHH(Gear);
gtAmmo_Grenade: DrawRotated(sprGrenade, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
+
+ gtHealthTag: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
gtGrave: DrawTextureF(PHedgehog(Gear^.Hedgehog)^.Team^.GraveTex, 1, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32);
--- a/hedgewars/uConsts.pas Tue May 11 13:59:57 2010 +0000
+++ b/hedgewars/uConsts.pas Fri May 14 16:02:27 2010 +0000
@@ -85,7 +85,7 @@
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); // 50
+ gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtHealthTag); // 51
// Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
--- a/hedgewars/uGears.pas Tue May 11 13:59:57 2010 +0000
+++ b/hedgewars/uGears.pas Fri May 14 16:02:27 2010 +0000
@@ -181,7 +181,8 @@
@doStepPortalShot,
@doStepPiano,
@doStepBomb,
- @doStepSineGunShot
+ @doStepSineGunShot,
+ @doStepHealthTag
);
procedure InsertGearToList(Gear: PGear);
@@ -297,6 +298,10 @@
gtAmmo_Grenade: begin // bazooka
gear^.Radius:= 4;
end;
+ gtHealthTag: begin
+ gear^.Timer:= 1500;
+ gear^.Z:= 2002;
+ end;
gtGrave: begin
gear^.ImpactSound:= sndGraveImpact;
gear^.nImpactSounds:= 1;
@@ -525,7 +530,7 @@
t:= max(Gear^.Damage, Gear^.Health);
Gear^.Damage:= t;
if (cWaterOpacity < $FF) and (hwRound(Gear^.Y) < cWaterLine + 256) then
- spawnHealthTagForHH(Gear, t);
+ AddGear(hwRound(Gear^.X), min(hwRound(Gear^.Y),cWaterLine+cVisibleWater+32), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; //spawnHealthTagForHH(Gear, t);
uStats.HedgehogDamaged(Gear)
end;
@@ -589,7 +594,8 @@
not SuddenDeathDmg then
Gear^.State:= Gear^.State or gstLoser;
- spawnHealthTagForHH(Gear, dmg);
+ AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) - cHHRadius - 12,
+ gtHealthTag, dmg, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; // spawnHealthTagForHH(Gear, dmg);
RenderHealth(PHedgehog(Gear^.Hedgehog)^);
RecountTeamHealth(PHedgehog(Gear^.Hedgehog)^.Team);
@@ -909,7 +915,10 @@
not CurrentHedgehog^.Gear^.Invulnerable then
begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
- spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
+
+ AddGear(hwRound(CurrentHedgehog^.Gear^.X),
+ hwRound(CurrentHedgehog^.Gear^.Y),
+ gtHealthTag, tmpDmg, _0, _0, 0)^.Hedgehog:= CurrentHedgehog; // spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
end;
end;
end;