Use same visual gear for health tags and hearts.
--- a/hedgewars/GSHandlers.inc Sun Aug 14 16:59:55 2011 -0400
+++ b/hedgewars/GSHandlers.inc Sun Aug 14 17:42:26 2011 -0400
@@ -3005,7 +3005,7 @@
if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then
begin
heart:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
- if heart <> nil then heart^.Sprite:= sprSeduction;
+ if heart <> nil then heart^.State:= ord(sprSeduction);
end;
if Gear^.Pos = 15 then
--- a/hedgewars/HHHandlers.inc Sun Aug 14 16:59:55 2011 -0400
+++ b/hedgewars/HHHandlers.inc Sun Aug 14 17:42:26 2011 -0400
@@ -582,7 +582,18 @@
i:= 0;
while i < Gear^.Health do
begin
- AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtHealth);
+ vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot);
+ if vga <> nil then
+ with vga^ do
+ begin
+ dx:= 0.001 * random(45);
+ dy:= 0.001 * (random(20) + 25);
+ Tint:= $00FF00FF;
+ State:= ord(sprHealth);
+ if random(2) = 0 then dx := -dx;
+ Frame:= 0;
+ FrameTicks:= random(750) + 1250;
+ end;
inc(i, 5);
end;
end;
--- a/hedgewars/VGSHandlers.inc Sun Aug 14 16:59:55 2011 -0400
+++ b/hedgewars/VGSHandlers.inc Sun Aug 14 17:42:26 2011 -0400
@@ -250,22 +250,6 @@
end;
////////////////////////////////////////////////////////////////////////////////
-procedure doStepHealth(Gear: PVisualGear; Steps: Longword);
-begin
-Gear^.X:= Gear^.X + Gear^.dX * Steps;
-Gear^.Y:= Gear^.Y - Gear^.dY * Steps;
-
-if Gear^.FrameTicks <= Steps then
- DeleteVisualGear(Gear)
-else
- begin
- dec(Gear^.FrameTicks, Steps);
- if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then
- Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500)
- end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
procedure doStepSteam(Gear: PVisualGear; Steps: Longword);
begin
Gear^.X:= Gear^.X + (cWindSpeedf * 100 + Gear^.dX) * Steps;
--- a/hedgewars/uGears.pas Sun Aug 14 16:59:55 2011 -0400
+++ b/hedgewars/uGears.pas Sun Aug 14 17:42:26 2011 -0400
@@ -1089,8 +1089,18 @@
i:= 0;
while i < vampDmg do
begin
- vg:= AddVisualGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), vgtHealth);
- if vg <> nil then vg^.Tint:= $FF0000FF;
+ vg:= AddVisualGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), vgtStraightShot);
+ if vg <> nil then
+ with vg^ do
+ begin
+ dx:= 0.001 * random(45);
+ dy:= 0.001 * (random(20) + 25);
+ Tint:= $FF0000FF;
+ State:= ord(sprHealth);
+ if random(2) = 0 then dx := -dx;
+ Frame:= 0;
+ FrameTicks:= random(750) + 1250;
+ end;
inc(i, 5);
end;
end
--- a/hedgewars/uTypes.pas Sun Aug 14 16:59:55 2011 -0400
+++ b/hedgewars/uTypes.pas Sun Aug 14 17:42:26 2011 -0400
@@ -102,7 +102,7 @@
// Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
- vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell,
+ vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtShell,
vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg,
vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion,
vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle,
@@ -276,7 +276,6 @@
Kind: TVisualGearType;
doStep: TVGearStepProcedure;
Tex: PTexture;
- Sprite: TSprite;
alpha, scale: GLfloat;
Hedgehog: PHedgehog;
Tag: LongInt;
--- a/hedgewars/uVisualGears.pas Sun Aug 14 16:59:55 2011 -0400
+++ b/hedgewars/uVisualGears.pas Sun Aug 14 17:42:26 2011 -0400
@@ -90,7 +90,6 @@
@doStepAmmo,
@doStepSmoke,
@doStepSmoke,
- @doStepHealth,
@doStepShell,
@doStepDust,
@doStepSplash,
@@ -236,14 +235,6 @@
Frame:= 7 - random(2);
FrameTicks:= cExplFrameTicks * 2;
end;
- vgtHealth: begin
- dx:= 0.001 * random(45);
- dy:= 0.001 * (random(20) + 25);
- Tint:= $00FF00FF; // default to green
- if random(2) = 0 then dx := -dx;
- Frame:= 0;
- FrameTicks:= random(750) + 1250;
- end;
vgtDust: begin
dx:= 0.005 * (random(15) + 10);
dy:= 0.001 * (random(40) + 20);
@@ -332,7 +323,7 @@
if random(2) = 0 then dy := -dy;
Frame:= 0;
FrameTicks:= random(750) + 1000;
- Sprite:= sprSnowDust;
+ State:= ord(sprSnowDust);
end;
end;
@@ -487,8 +478,7 @@
end;
vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
- vgtHealth: DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0);
- vgtStraightShot: DrawRotatedF(Gear^.Sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
+ vgtStraightShot: DrawRotatedF(TSprite(Gear^.State), round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
end;
if (cReducedQuality and rqAntiBoom) = 0 then
case Gear^.Kind of