hedgewars/GSHandlers.inc
changeset 6011 519f8a58c021
parent 6002 7f790689205c
child 6081 537bbd5c1a62
equal deleted inserted replaced
6010:10913a80cb50 6011:519f8a58c021
   507 end;
   507 end;
   508 
   508 
   509 ////////////////////////////////////////////////////////////////////////////////
   509 ////////////////////////////////////////////////////////////////////////////////
   510 procedure doStepMolotov(Gear: PGear);
   510 procedure doStepMolotov(Gear: PGear);
   511 var 
   511 var 
       
   512 	s: Longword;
   512     i, gX, gY: LongInt;
   513     i, gX, gY: LongInt;
   513     dX, dY: hwFloat;
   514     dX, dY: hwFloat;
   514     Fire: PGear;
   515     Fire: PGear;
   515     smoke, glass: PVisualGear;
   516     smoke, glass: PVisualGear;
   516 begin
   517 begin
   518 
   519 
   519     doStepFallingGear(Gear);
   520     doStepFallingGear(Gear);
   520     CalcRotationDirAngle(Gear);
   521     CalcRotationDirAngle(Gear);
   521 
   522 
   522     // let's add some smoke depending on speed
   523     // let's add some smoke depending on speed
   523     i:= max(32,152 - hwRound(Distance(Gear^.dX,Gear^.dY)*120))+random(10);
   524     s:= max(32,152 - hwRound(Distance(Gear^.dX,Gear^.dY)*120))+random(10);
   524     if (GameTicks mod i) = 0 then
   525     if (GameTicks mod s) = 0 then
   525         begin
   526         begin
   526         // adjust angle to match the texture
   527         // adjust angle to match the texture
   527         if Gear^.dX.isNegative then i:= 130 else i:= 50;
   528         if Gear^.dX.isNegative then i:= 130 else i:= 50;
   528         smoke:= AddVisualGear(hwRound(Gear^.X)-round(cos((Gear^.DirAngle+i) * pi / 180)*20), hwRound(Gear^.Y)-round(sin((Gear^.DirAngle+i) * pi / 180)*20), vgtSmoke);
   529         smoke:= AddVisualGear(hwRound(Gear^.X)-round(cos((Gear^.DirAngle+i) * pi / 180)*20), hwRound(Gear^.Y)-round(sin((Gear^.DirAngle+i) * pi / 180)*20), vgtSmoke);
   529         if smoke <> nil then smoke^.Scale:= 0.75;
   530         if smoke <> nil then smoke^.Scale:= 0.75;
  4807         AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
  4808         AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
  4808 
  4809 
  4809         i := hwRound(Gear^.X) - HitGear^.Radius + 2;
  4810         i := hwRound(Gear^.X) - HitGear^.Radius + 2;
  4810         ei := hwRound(Gear^.X) + HitGear^.Radius - 2;
  4811         ei := hwRound(Gear^.X) + HitGear^.Radius - 2;
  4811         for j := 1 to 4 do DrawExplosion(i - GetRandom(5), hwRound(Gear^.Y) + 6*j, 3);
  4812         for j := 1 to 4 do DrawExplosion(i - GetRandom(5), hwRound(Gear^.Y) + 6*j, 3);
  4812         for j := 1 to 4 do DrawExplosion(ei + GetRandom(5), hwRound(Gear^.Y) + 6*j, 3);
  4813         for j := 1 to 4 do DrawExplosion(ei + LongInt(GetRandom(5)), hwRound(Gear^.Y) + 6*j, 3);
  4813         while i <= ei do
  4814         while i <= ei do
  4814             begin
  4815             begin
  4815             for j := 1 to 11 do DrawExplosion(i, hwRound(Gear^.Y) + 3*j, 3);
  4816             for j := 1 to 11 do DrawExplosion(i, hwRound(Gear^.Y) + 3*j, 3);
  4816             inc(i, 1)
  4817             inc(i, 1)
  4817             end;
  4818             end;