Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
--- a/hedgewars/HHHandlers.inc Tue Mar 09 02:48:27 2010 +0000
+++ b/hedgewars/HHHandlers.inc Wed Mar 10 06:50:06 2010 +0000
@@ -307,6 +307,7 @@
var s: shortstring;
a: TAmmoType;
i: Integer;
+ vga: PVisualGear;
begin
Gear^.Message:= gm_Destroy;
PlaySound(sndShotgunReload);
@@ -319,12 +320,18 @@
// On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up
if (not (PHedgehog(HH^.Hedgehog)^.Team^.ExtDriven
or (PHedgehog(HH^.Hedgehog)^.BotLevel > 0)))
- or (PHedgehog(HH^.Hedgehog)^.Team^.Clan^.ClanIndex = LocalClan)
- or (GameType = gmtDemo) then
- begin
- s:= trammo[Ammoz[a].NameId] + '(+' + IntToStr(Ammoz[a].NumberInCase) + ')';
- AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo);
- end
+ or (PHedgehog(HH^.Hedgehog)^.Team^.Clan^.ClanIndex = LocalClan)
+ or (GameType = gmtDemo) then
+ begin
+ s:= trammo[Ammoz[a].NameId] + '(+' + IntToStr(Ammoz[a].NumberInCase) + ')';
+ AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo);
+
+ // show ammo icon
+ vga:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtAmmo);
+ if vga <> nil then
+ vga^.Frame:= Longword(a);
+ end;
+
end;
posCaseHealth: begin
inc(HH^.Health, Gear^.Health);
--- a/hedgewars/uConsts.pas Tue Mar 09 02:48:27 2010 +0000
+++ b/hedgewars/uConsts.pas Wed Mar 10 06:50:06 2010 +0000
@@ -87,7 +87,7 @@
TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
- vgtSteam, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell, vgtDust);
+ vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell, vgtDust);
TGearsType = set of TGearType;
--- a/hedgewars/uVisualGears.pas Tue Mar 09 02:48:27 2010 +0000
+++ b/hedgewars/uVisualGears.pas Wed Mar 10 06:50:06 2010 +0000
@@ -43,6 +43,7 @@
Kind: TVisualGearType;
doStep: TVGearStepProcedure;
Tex: PTexture;
+ alpha, scale: GLfloat;
Hedgehog: pointer;
Text: shortstring
end;
@@ -217,6 +218,16 @@
else dec(Gear^.FrameTicks, Steps)
end;
+procedure doStepAmmo(Gear: PVisualGear; Steps: Longword);
+begin
+ Gear^.Y:= Gear^.Y - cDrownSpeed * Steps;
+
+ Gear^.scale:= Gear^.scale + 0.0025 * Steps;
+ Gear^.alpha:= Gear^.alpha - 0.0015 * Steps;
+
+ if Gear^.alpha < 0 then DeleteVisualGear(Gear)
+end;
+
procedure doStepSmoke(Gear: PVisualGear; Steps: Longword);
begin
Gear^.X:= Gear^.X + (cWindSpeed + Gear^.dX) * Steps;
@@ -385,6 +396,7 @@
@doStepSpeechBubble,
@doStepBubble,
@doStepSteam,
+ @doStepAmmo,
@doStepSmoke,
@doStepSmoke,
@doStepHealth,
@@ -481,6 +493,10 @@
Frame:= 7 - random(3);
FrameTicks:= cExplFrameTicks * 2;
end;
+ vgtAmmo: begin
+ alpha:= 1.0;
+ scale:= 1.0
+ end;
vgtSmokeWhite,
vgtSmoke: begin
dx:= _0_0002 * (random(45) + 10);
@@ -577,6 +593,12 @@
vgtFire: DrawSprite(sprFlame, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy, (RealTicks div 64 + Gear^.Frame) mod 8);
vgtBubble: DrawSprite(sprBubbles, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
vgtSteam: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
+ vgtAmmo: begin
+ glColor4f(1, 1, 1, Gear^.alpha);
+ DrawTextureF(ropeIconTex, Gear^.scale, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 32, 32);
+ DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
+ glColor4f(1, 1, 1, 1);
+ end;
vgtHealth: begin
case Gear^.Frame div 10 of
0:glColor4f(0, 1, 0, Gear^.FrameTicks / 1000);