# HG changeset patch # User nemo # Date 1255355074 0 # Node ID b52344de23aed6e64d570af194f789e84d3fa7d5 # Parent 32213ae19ba928a69ca966cb4a854dac80e56253 In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally. diff -r 32213ae19ba9 -r b52344de23ae hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Mon Oct 12 00:14:42 2009 +0000 +++ b/hedgewars/GSHandlers.inc Mon Oct 12 13:44:34 2009 +0000 @@ -1231,7 +1231,7 @@ procedure doStepFlame(Gear: PGear); var i: Integer; begin -AllInactive:= false; + if (Gear^.State and gsttmpFlag) = 0 then AllInactive:= false; if not TestCollisionYwithGear(Gear, 1) then begin @@ -1254,21 +1254,35 @@ DeleteGear(Gear); exit end - end else begin - if Gear^.Timer > 0 then dec(Gear^.Timer) - else begin - Gear^.Radius:= 9; - AmmoShove(Gear, 4, 100); - Gear^.Radius:= 1; - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 4, EXPLNoDamage); - dec(Gear^.Health); - Gear^.Timer:= 450 - Gear^.Tag * 8 - end - end; - -//if (((GameTicks div 8) mod 64) = Gear^.Tag) then -// AmmoFlameWork(Gear); - + end else begin + if (Gear^.State and gsttmpFlag) <> 0 then + begin + Gear^.Radius:= 9; + AmmoShove(Gear, 4, 100); + Gear^.Radius:= 1 + end; + if Gear^.Timer > 0 then dec(Gear^.Timer) + else begin +// Standard fire + if (Gear^.State and gsttmpFlag) = 0 then + begin + Gear^.Radius:= 9; + AmmoShove(Gear, 4, 100); + Gear^.Radius:= 1; + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 4, EXPLNoDamage); + if Gear^.Health > 0 then dec(Gear^.Health); + Gear^.Timer:= 450 - Gear^.Tag * 8 + end + else begin +// Modified fire + if ((GameTicks and $1FF) = 0) and ((GameFlags and gfSolidLand) = 0) then + DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 4); + // 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 ((GameTicks and $FF) = 0) then Gear^.Health:= 0 + end + end + end; if Gear^.Health = 0 then DeleteGear(Gear) end; diff -r 32213ae19ba9 -r b52344de23ae hedgewars/uGears.pas --- a/hedgewars/uGears.pas Mon Oct 12 00:14:42 2009 +0000 +++ b/hedgewars/uGears.pas Mon Oct 12 13:44:34 2009 +0000 @@ -330,7 +330,7 @@ end; gtShover: Result^.Radius:= 20; gtFlame: begin - Result^.Tag:= Counter mod 32; + Result^.Tag:= GetRandom(32); Result^.Radius:= 1; Result^.Health:= 5; if (Result^.dY.QWordValue = 0) and (Result^.dX.QWordValue = 0) then @@ -1631,6 +1631,7 @@ procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); var t: PGearArray; + Gear: PGear; i: LongInt; begin t:= CheckGearsCollision(Ammo); @@ -1641,39 +1642,41 @@ while i > 0 do begin dec(i); - if (t^.ar[i]^.State and gstNoDamage) = 0 then - case t^.ar[i]^.Kind of + Gear:= t^.ar[i]; + if (Gear^.State and gstNoDamage) = 0 then + case Gear^.Kind of gtHedgehog, gtMine, gtTarget, gtCase: begin if (Ammo^.Kind = gtDrill) then begin Ammo^.Timer:= 0; exit; end; - if (not t^.ar[i]^.Invulnerable) then - ApplyDamage(t^.ar[i], Damage) + if (Ammo^.Kind = gtFlame) then Ammo^.Health:= 0; + if (not Gear^.Invulnerable) then + ApplyDamage(Gear, Damage) else - t^.ar[i]^.State:= t^.ar[i]^.State or gstWinner; + Gear^.State:= Gear^.State or gstWinner; - DeleteCI(t^.ar[i]); - t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01; - t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01; - t^.ar[i]^.Active:= true; - t^.ar[i]^.State:= t^.ar[i]^.State or gstMoving; + DeleteCI(Gear); + Gear^.dX:= Ammo^.dX * Power * _0_01; + Gear^.dY:= Ammo^.dY * Power * _0_01; + Gear^.Active:= true; + Gear^.State:= Gear^.State or gstMoving; - if TestCollisionXwithGear(t^.ar[i], hwSign(t^.ar[i]^.dX)) then + if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin - if not (TestCollisionXwithXYShift(t^.ar[i], _0, -3, hwSign(t^.ar[i]^.dX)) - or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; - if not (TestCollisionXwithXYShift(t^.ar[i], _0, -2, hwSign(t^.ar[i]^.dX)) - or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; - if not (TestCollisionXwithXYShift(t^.ar[i], _0, -1, hwSign(t^.ar[i]^.dX)) - or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; + if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) + or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) + or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) + or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; end; - - FollowGear:= t^.ar[i] + + FollowGear:= Gear end; end end; -SetAllToActive +if i <> 0 then SetAllToActive end; procedure AssignHHCoords;