Engine:
authorsmxx
Tue, 23 Feb 2010 00:21:20 +0000
changeset 2848 8a1725b4f724
parent 2847 cde320fd3122
child 2849 5e9325659be2
Engine: * Added Palewolf's dust clouds when an hog suffers fall damage
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uVisualGears.pas
share/hedgewars/Data/Graphics/Dust.png
share/hedgewars/Data/Themes/Bath/Dust.png
share/hedgewars/Data/Themes/Underwater/Dust.png
--- a/hedgewars/GSHandlers.inc	Tue Feb 23 00:18:57 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Feb 23 00:21:20 2010 +0000
@@ -88,7 +88,10 @@
 end;
 
 procedure CheckHHDamage(Gear: PGear);
-var dmg: Longword;
+var 
+	dmg: Longword;
+	i: LongInt;
+	particle: PVisualGear;
 begin
 if(Gear^.Invulnerable) then exit;
 if _0_4 < Gear^.dY then
@@ -101,7 +104,12 @@
 	else
 		PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
 
-    ApplyDamage(Gear, dmg);
+	for i:= min(12, (3 + dmg div 10)) downto 0 do begin
+		particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
+		particle^.dX := particle^.dX + (Gear^.dX / 5);
+		end;
+		
+  ApplyDamage(Gear, dmg);
 	end
 end;
 
--- a/hedgewars/uConsts.pas	Tue Feb 23 00:18:57 2010 +0000
+++ b/hedgewars/uConsts.pas	Tue Feb 23 00:21:20 2010 +0000
@@ -72,7 +72,7 @@
             sprThoughtCorner, sprThoughtEdge, sprThoughtTail,
             sprShoutCorner, sprShoutEdge, sprShoutTail,
             sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov,
-						sprSmoke, sprShell);
+						sprSmoke, sprShell, sprDust);
 
 	TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, // 3
 			gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, // 8
@@ -87,7 +87,7 @@
 
 	TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
 			vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
-			vgtSteam, vgtSmoke, vgtHealth, vgtShell);
+			vgtSteam, vgtSmoke, vgtHealth, vgtShell, vgtDust);
 
 	TGearsType = set of TGearType;
 
@@ -661,7 +661,9 @@
 			(FileName: 'Smoke'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
 			Width:  22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprSmoke
 			(FileName: 'Shells'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-			Width:  8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false) // sprShell
+			Width:  8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprShell
+			(FileName: 'Dust'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
+			Width:  22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false)// sprDust
 			);
 
 	Wavez: array [TWave] of record
--- a/hedgewars/uVisualGears.pas	Tue Feb 23 00:18:57 2010 +0000
+++ b/hedgewars/uVisualGears.pas	Tue Feb 23 00:21:20 2010 +0000
@@ -235,6 +235,24 @@
 		else dec(Gear^.FrameTicks, Steps)
 end;
 
+procedure doStepDust(Gear: PVisualGear; Steps: Longword);
+begin
+	Gear^.X:= Gear^.X + (cWindSpeed + (cWindSpeed * _0_03 * Steps) + Gear^.dX) * Steps;
+	Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps;
+
+	Gear^.dX := Gear^.dX - (Gear^.dX * _0_005 * Steps);
+	Gear^.dY := Gear^.dY - (cDrownSpeed * _0_001 * Steps);
+
+	if Gear^.FrameTicks <= Steps then
+		if Gear^.Frame = 0 then DeleteVisualGear(Gear)
+		else
+			begin
+			dec(Gear^.Frame);
+			Gear^.FrameTicks:= cExplFrameTicks
+			end
+		else dec(Gear^.FrameTicks, Steps)
+end;
+
 ////////////////////////////////////////////////////////////////////////////////
 const cSorterWorkTime = 640;
 var thexchar: array[0..cMaxTeams] of
@@ -369,7 +387,8 @@
 			@doStepSteam,
 			@doStepSmoke,
 			@doStepHealth,
-			@doStepShell
+			@doStepShell,
+			@doStepDust
 		);
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
@@ -476,6 +495,13 @@
 				Frame:= 0;
 				FrameTicks:= random(750) + 1250;
 				end;
+  vgtDust: begin
+				dx:= _0_005 * (random(15) + 10);
+				dx.isNegative:= random(2) = 0;
+				dy:= _0_001 * (random(40) + 20);
+				Frame:= 7 - random(2);
+				FrameTicks:= random(20) + 15;
+				end;
 		end;
 
 if VisualGearsList <> nil then
@@ -535,6 +561,7 @@
 			if not cReducedQuality then
 				case Gear^.Kind of
 					vgtSmoke: DrawSprite(sprSmoke, hwRound(Gear^.X) + WorldDx - 11, hwRound(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
+					vgtDust: DrawSprite(sprDust, hwRound(Gear^.X) + WorldDx - 11, hwRound(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
 				end;
 		Gear:= Gear^.NextGear
 		end;
Binary file share/hedgewars/Data/Graphics/Dust.png has changed
Binary file share/hedgewars/Data/Themes/Bath/Dust.png has changed
Binary file share/hedgewars/Data/Themes/Underwater/Dust.png has changed