Palewolf's smoke traces for fire.
authornemo
Sun, 24 Jan 2010 19:01:51 +0000
changeset 2713 71250942e95b
parent 2712 8f4527c9137c
child 2714 c85ffe57d971
Palewolf's smoke traces for fire.
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Graphics/Smoke.png
--- a/hedgewars/GSHandlers.inc	Sun Jan 24 16:46:06 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Jan 24 19:01:51 2010 +0000
@@ -1382,21 +1382,41 @@
                 AmmoShove(Gear, 4, 100);
                 Gear^.Radius:= 1;
                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 4, EXPLNoDamage);
+                if Random(100) > 90 then
+                  for i:= 0 to Random(3) do
+                    AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), hwRound(Gear^.Y) - 2, vgtSmoke);
                 if Gear^.Health > 0 then dec(Gear^.Health);
                 Gear^.Timer:= 450 - Gear^.Tag * 8
                 end
                 else begin
 // Modified fire
-                if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then
+                if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then begin
                     DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 4);
+                    
+                    for i:= 0 to Random(3) do
+                      AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), hwRound(Gear^.Y) - 2, vgtSmoke);
+                end;
                 // This one is interesting.  I think I understand the purpose, but I wonder if a bit more fuzzy of kicking could be done with getrandom.
         	    Gear^.Timer:= 100 - Gear^.Tag * 3;
                 if (Gear^.Damage > 3000+Gear^.Tag*1500) then Gear^.Health:= 0
                 end
             end
         end;
-if Gear^.Health = 0 then
-	DeleteGear(Gear)
+if Gear^.Health = 0 then begin
+  if (Gear^.State and gsttmpFlag) = 0 then begin
+    if Random(100) > 80 then begin
+      for i:= 0 to Random(3) do begin
+        AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), hwRound(Gear^.Y) - 2, vgtSmoke);
+      end;
+    end;
+  end else begin
+    for i:= 0 to Random(3) do begin
+      AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), hwRound(Gear^.Y) - 2, vgtSmoke);
+    end;
+  end;
+  
+  DeleteGear(Gear)
+  end;
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/uConsts.pas	Sun Jan 24 16:46:06 2010 +0000
+++ b/hedgewars/uConsts.pas	Sun Jan 24 19:01:51 2010 +0000
@@ -71,7 +71,8 @@
             sprSpeechCorner, sprSpeechEdge, sprSpeechTail,
             sprThoughtCorner, sprThoughtEdge, sprThoughtTail,
             sprShoutCorner, sprShoutEdge, sprShoutTail,
-            sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov);
+            sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov,
+						sprSmoke);
 
 	TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, // 3
 			gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, // 8
@@ -86,7 +87,7 @@
 
 	TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
 			vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
-			vgtSteam, vgtHealth);
+			vgtSteam, vgtSmoke, vgtHealth);
 
 	TGearsType = set of TGearType;
 
@@ -644,7 +645,9 @@
 			(FileName:  'amMolotov'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; 
 			Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false), //sprHandMolotov
 			(FileName:  'Molotov'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-			Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false) // sprMolotov
+			Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprMolotov
+			(FileName: 'Smoke'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+			Width:  22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false)// sprSmoke
 			);
 
 	Wavez: array [TWave] of record
--- a/hedgewars/uVisualGears.pas	Sun Jan 24 16:46:06 2010 +0000
+++ b/hedgewars/uVisualGears.pas	Sun Jan 24 19:01:51 2010 +0000
@@ -200,6 +200,24 @@
 		else dec(Gear^.FrameTicks, Steps)
 end;
 
+procedure doStepSmoke(Gear: PVisualGear; Steps: Longword);
+begin
+	Gear^.X:= Gear^.X + (cWindSpeed + Gear^.dX) * Steps;
+	Gear^.Y:= Gear^.Y - (cDrownSpeed + Gear^.dY) * Steps;
+
+	Gear^.dX := Gear^.dX + (cWindSpeed * _0_3 * Steps);
+	//Gear^.dY := Gear^.dY - (cDrownSpeed * _0_995);
+
+	if Gear^.FrameTicks <= Steps then
+		if Gear^.Frame = 0 then DeleteVisualGear(Gear)
+		else
+			begin
+			if Random(2) = 0 then dec(Gear^.Frame);
+			Gear^.FrameTicks:= cExplFrameTicks
+			end
+		else dec(Gear^.FrameTicks, Steps)
+end;
+
 ////////////////////////////////////////////////////////////////////////////////
 const cSorterWorkTime = 640;
 var thexchar: array[0..cMaxTeams] of
@@ -332,6 +350,7 @@
 			@doStepSpeechBubble,
 			@doStepBubble,
 			@doStepSteam,
+			@doStepSmoke,
 			@doStepHealth
 		);
 
@@ -423,6 +442,14 @@
 				Frame:= 7 - random(3);
 				FrameTicks:= cExplFrameTicks * 2;
 				end;
+  vgtSmoke: begin
+				dx:= _0_0002 * (random(45) + 10);
+				dx.isNegative:= random(2) = 0;
+				dy:= _0_0002 * (random(45) + 10);
+				dy.isNegative:= false;
+				Frame:= 7 - random(2);
+				FrameTicks:= cExplFrameTicks * 2;
+				end;
 	vgtHealth: begin
 				dx:= _0_001 * random(45);
 				dx.isNegative:= random(2) = 0;
@@ -486,6 +513,14 @@
 		end;
 	1: while Gear <> nil do
 		begin
+			if not cReducedQuality then
+				case Gear^.Kind of
+					vgtSmoke: DrawSprite(sprSmoke, hwRound(Gear^.X) + WorldDx - 11, hwRound(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
+				end;
+		Gear:= Gear^.NextGear
+		end;
+	2: while Gear <> nil do
+		begin
         if not cReducedQuality then
             case Gear^.Kind of
                 vgtExplPart: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
--- a/hedgewars/uWorld.pas	Sun Jan 24 16:46:06 2010 +0000
+++ b/hedgewars/uWorld.pas	Sun Jan 24 19:01:51 2010 +0000
@@ -409,9 +409,11 @@
 				end
 		end;
 
+DrawVisualGears(1);
+
 DrawGears;
 
-DrawVisualGears(1);
+DrawVisualGears(2);
 
 DrawWater(cWaterOpacity);
 
Binary file share/hedgewars/Data/Graphics/Smoke.png has changed