bit of an experiment in variable splash sizes based on object/speed. not sure if it looks good yet. need to drown more stuff.
--- a/hedgewars/GSHandlers.inc Sun Mar 18 18:19:20 2012 +0100
+++ b/hedgewars/GSHandlers.inc Tue Mar 20 01:30:54 2012 -0400
@@ -4511,9 +4511,9 @@
begin
Gear^.dY := Gear^.dY + cGravity * 2;
Gear^.Y := Gear^.Y + Gear^.dY;
- CheckGearDrowning(Gear);
- if (Gear^.State and gstDrowning) <> 0 then
+ if CheckGearDrowning(Gear) then
begin
+ Gear^.Y:= Gear^.Y + _50;
OnUsedAmmo(CurrentHedgehog^);
if CurrentHedgehog^.Gear <> nil then
begin
@@ -4536,6 +4536,7 @@
if (Gear^.State and gstDrowning) <> 0 then
begin
+ Gear^.Y:= Gear^.Y + _50;
OnUsedAmmo(CurrentHedgehog^);
if CurrentHedgehog^.Gear <> nil then
begin
--- a/hedgewars/uGearsUtils.pas Sun Mar 18 18:19:20 2012 +0100
+++ b/hedgewars/uGearsUtils.pas Tue Mar 20 01:30:54 2012 -0400
@@ -20,7 +20,7 @@
unit uGearsUtils;
interface
-uses uTypes;
+uses uTypes, math;
procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord = $FFFFFFFF);
function ModifyDamage(dmg: Longword; Gear: PGear): Longword;
@@ -327,7 +327,7 @@
skipSpeed, skipAngle, skipDecay: hwFloat;
i, maxDrops, X, Y: LongInt;
vdX, vdY: real;
- particle: PVisualGear;
+ particle, splash: PVisualGear;
isSubmersible: boolean;
begin
// probably needs tweaking. might need to be in a case statement based upon gear type
@@ -388,9 +388,15 @@
or (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0)
and (CurAmmoGear^.dY < _0_01)))) then
begin
- AddVisualGear(X, cWaterLine, vgtSplash);
+ splash:= AddVisualGear(X, cWaterLine, vgtSplash);
+ if splash <> nil then
+ begin
+ splash^.Scale:= hwFloat2Float(Gear^.Density / _3);
+ if splash^.Scale > 1 then splash^.Scale:= power(splash^.Scale,0.3333)
+ else splash^.Scale:= splash^.Scale + ((1-splash^.Scale) / 2);
+ end;
- maxDrops := (Gear^.Radius div 2) + round(vdX * Gear^.Radius * 2) + round(vdY * Gear^.Radius * 2);
+ maxDrops := (hwRound(Gear^.Density) * 3) div 2 + round(vdX * hwRound(Gear^.Density) * 6) + round(vdY * hwRound(Gear^.Density) * 6);
for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do
begin
particle := AddVisualGear(X - 3 + Random(6), cWaterLine, vgtDroplet);
@@ -398,6 +404,19 @@
begin
particle^.dX := particle^.dX - vdX / 10;
particle^.dY := particle^.dY - vdY / 5;
+ if splash <> nil then
+ begin
+ if splash^.Scale > 1 then
+ begin
+ particle^.dX:= particle^.dX * power(splash^.Scale,0.3333); // tone down the droplet height further
+ particle^.dY:= particle^.dY * power(splash^.Scale, 0.3333)
+ end
+ else
+ begin
+ particle^.dX:= particle^.dX * splash^.Scale;
+ particle^.dY:= particle^.dY * splash^.Scale
+ end
+ end
end
end
end;
--- a/hedgewars/uVisualGears.pas Sun Mar 18 18:19:20 2012 +0100
+++ b/hedgewars/uVisualGears.pas Tue Mar 20 01:30:54 2012 -0400
@@ -630,9 +630,11 @@
else
DrawTextureF(SpritesData[sprFlame].Texture, Gear^.FrameTicks / 900, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, (RealTicks shr 7 + Gear^.Frame) mod 8, 1, 16, 16);
vgtSplash: if SuddenDeathDmg then
- DrawSprite(sprSDSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37))
+ //DrawSprite(sprSDSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37))
+ DrawTextureF(SpritesData[sprSDSplash].Texture, Gear^.scale, round(Gear^.X + WorldDx), round(Gear^.Y + WorldDy - ((SpritesData[sprSDSplash].Height+8)*Gear^.Scale)/2), 19 - (Gear^.FrameTicks div 37), 1, SpritesData[sprSDSplash].Width, SpritesData[sprSDSplash].Height)
else
- DrawSprite(sprSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
+ //DrawSprite(sprSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
+ DrawTextureF(SpritesData[sprSplash].Texture, Gear^.scale, round(Gear^.X + WorldDx), round(Gear^.Y + WorldDy - ((SpritesData[sprSplash].Height+8)*Gear^.Scale)/2), 19 - (Gear^.FrameTicks div 37), 1, SpritesData[sprSplash].Width, SpritesData[sprSplash].Height);
vgtDroplet: if SuddenDeathDmg then
DrawSprite(sprSDDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame)
else