hedgewars/uGearsHandlersMess.pas
branchspacecampaign
changeset 9382 f1464fa10c0b
parent 9362 c9fdf8a3baf0
child 9385 dca86192d773
equal deleted inserted replaced
9346:1245c7636380 9382:f1464fa10c0b
  2002 var
  2002 var
  2003     gX,gY,i: LongInt;
  2003     gX,gY,i: LongInt;
  2004     sticky: Boolean;
  2004     sticky: Boolean;
  2005     vgt: PVisualGear;
  2005     vgt: PVisualGear;
  2006     tdX,tdY: HWFloat;
  2006     tdX,tdY: HWFloat;
       
  2007     landPixel: Word;
  2007 begin
  2008 begin
  2008     sticky:= (Gear^.State and gsttmpFlag) <> 0;
  2009     sticky:= (Gear^.State and gsttmpFlag) <> 0;
  2009     if not sticky then AllInactive := false;
  2010     if not sticky then AllInactive := false;
  2010 
  2011 
  2011     if TestCollisionYwithGear(Gear, 1) = 0 then
  2012     landPixel:= TestCollisionYwithGear(Gear, 1);
       
  2013     if landPixel = 0 then
  2012         begin
  2014         begin
  2013         AllInactive := false;
  2015         AllInactive := false;
  2014 
  2016 
  2015         if ((GameTicks mod 100) = 0) then
  2017         if ((GameTicks mod 100) = 0) then
  2016             begin
  2018             begin
  2045             PlaySound(sndVaporize);
  2047             PlaySound(sndVaporize);
  2046             DeleteGear(Gear);
  2048             DeleteGear(Gear);
  2047             exit
  2049             exit
  2048             end
  2050             end
  2049         end
  2051         end
  2050     else
  2052     else 
  2051         begin
  2053         begin
       
  2054         if (Gear^.Timer = 1) and (GameTicks and $3 = 0) then
       
  2055             begin
       
  2056             Gear^.Y:= Gear^.Y+_6;
       
  2057             if (landPixel and lfIce <> 0) or (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then
       
  2058                 begin
       
  2059                 gX := hwRound(Gear^.X);
       
  2060                 gY := hwRound(Gear^.Y)-6;
       
  2061                 DrawExplosion(gX, gY, 4);
       
  2062                 PlaySound(sndVaporize);
       
  2063                 AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSteam);
       
  2064                 DeleteGear(Gear);
       
  2065                 exit
       
  2066                 end;
       
  2067             Gear^.Y:= Gear^.Y-_6
       
  2068             end;
  2052         if sticky and (GameTicks and $F = 0) then
  2069         if sticky and (GameTicks and $F = 0) then
  2053             begin
  2070             begin
  2054             Gear^.Radius := 7;
  2071             Gear^.Radius := 7;
  2055             tdX:= Gear^.dX;
  2072             tdX:= Gear^.dX;
  2056             tdY:= Gear^.dY;
  2073             tdY:= Gear^.dY;
  2097                     for i:= Random(2) downto 0 do
  2114                     for i:= Random(2) downto 0 do
  2098                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2115                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2099 
  2116 
  2100                 if Gear^.Health > 0 then
  2117                 if Gear^.Health > 0 then
  2101                     dec(Gear^.Health);
  2118                     dec(Gear^.Health);
  2102                 Gear^.Timer := 450 - Gear^.Tag * 8
  2119                 Gear^.Timer := 450 - Gear^.Tag * 8 + GetRandom(2)
  2103                 end
  2120                 end
  2104             else
  2121             else
  2105                 begin
  2122                 begin
  2106                 // Modified fire
  2123                 // Modified fire
  2107                 if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then
  2124                 if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then
  2111                     for i:= Random(3) downto 0 do
  2128                     for i:= Random(3) downto 0 do
  2112                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2129                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2113                     end;
  2130                     end;
  2114 
  2131 
  2115 // 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.
  2132 // 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.
  2116                 Gear^.Timer := 100 - Gear^.Tag * 3;
  2133                 Gear^.Timer := 100 - Gear^.Tag * 3 + GetRandom(2);
  2117                 if (Gear^.Damage > 3000+Gear^.Tag*1500) then
  2134                 if (Gear^.Damage > 3000+Gear^.Tag*1500) then
  2118                     Gear^.Health := 0
  2135                     Gear^.Health := 0
  2119                 end
  2136                 end
  2120             end
  2137             end
  2121         end;
  2138         end;
  5247     i, t, gX, gY: LongInt;
  5264     i, t, gX, gY: LongInt;
  5248     hogs: PGearArrayS;
  5265     hogs: PGearArrayS;
  5249     vg: PVisualGear;
  5266     vg: PVisualGear;
  5250 begin
  5267 begin
  5251     HHGear := Gear^.Hedgehog^.Gear;
  5268     HHGear := Gear^.Hedgehog^.Gear;
  5252     if (Gear^.Message and gmAttack <> 0) or (HHGear = nil) or ((HHGear^.State and gstHHDriven) = 0) or (HHGear^.dX.QWordValue > 4294967)  then
  5269     if (Gear^.Message and gmAttack <> 0) or (Gear^.Health = 0) or (HHGear = nil) or ((HHGear^.State and gstHHDriven) = 0) or (HHGear^.dX.QWordValue > 4294967)  then
  5253         begin
  5270         begin
  5254         StopSoundChan(Gear^.SoundChannel);
  5271         StopSoundChan(Gear^.SoundChannel);
  5255         DeleteGear(Gear);
  5272         DeleteGear(Gear);
  5256         AfterAttack;
  5273         AfterAttack;
  5257         exit
  5274         exit