hedgewars/GSHandlers.inc
changeset 70 82d93eeecebe
parent 68 cbb93eb90304
child 71 5f56c6979496
equal deleted inserted replaced
69:d8a526934b9f 70:82d93eeecebe
   315 ////////////////////////////////////////////////////////////////////////////////
   315 ////////////////////////////////////////////////////////////////////////////////
   316 procedure doStepPickHammerWork(Gear: PGear);
   316 procedure doStepPickHammerWork(Gear: PGear);
   317 var i, ei: integer;
   317 var i, ei: integer;
   318     HHGear: PGear;
   318     HHGear: PGear;
   319 begin
   319 begin
   320 Allinactive:= false;
   320 AllInactive:= false;
   321 dec(Gear.Timer);
   321 dec(Gear.Timer);
   322 if (Gear.Timer = 0)or((Gear.Message and gm_Destroy) <> 0) then
   322 if (Gear.Timer = 0)or((Gear.Message and gm_Destroy) <> 0) then
   323    begin
   323    begin
   324    DeleteGear(Gear);
   324    DeleteGear(Gear);
   325    AfterAttack;
   325    AfterAttack;
   382 Gear.doStep:= doStepPickHammerWork
   382 Gear.doStep:= doStepPickHammerWork
   383 end;
   383 end;
   384 
   384 
   385 ////////////////////////////////////////////////////////////////////////////////
   385 ////////////////////////////////////////////////////////////////////////////////
   386 procedure doStepRopeWork(Gear: PGear);
   386 procedure doStepRopeWork(Gear: PGear);
   387 const pidiv2: real = pi/2;
   387 const flCheck: boolean = false;
   388       flCheck: boolean = false;
       
   389 var HHGear: PGear;
   388 var HHGear: PGear;
   390     len, cs, cc, tx, ty: real;
   389     len, cs, cc, tx, ty: real;
   391     lx, ly: integer;
   390     lx, ly: integer;
   392 
   391 
   393     procedure DeleteMe;
   392     procedure DeleteMe;
   397            Message:= Message and not gm_Attack;
   396            Message:= Message and not gm_Attack;
   398            State:= State or gstFalling;
   397            State:= State or gstFalling;
   399            end;
   398            end;
   400       DeleteGear(Gear);
   399       DeleteGear(Gear);
   401       OnUsedAmmo(PHedgehog(Gear.Hedgehog)^.Ammo);
   400       OnUsedAmmo(PHedgehog(Gear.Hedgehog)^.Ammo);
   402       ApplyAmmoChanges(PHedgehog(Gear.Hedgehog))
   401       ApplyAmmoChanges(PHedgehog(Gear.Hedgehog)^)
   403     end;
   402     end;
   404 
   403 
   405 begin
   404 begin
   406 HHGear:= PHedgehog(Gear.Hedgehog).Gear;
   405 HHGear:= PHedgehog(Gear.Hedgehog).Gear;
   407 if (HHGear.State and gstHHDriven) = 0 then
   406 if (HHGear.State and gstHHDriven) = 0 then
   427    len:= Gear.Elasticity - 20;
   426    len:= Gear.Elasticity - 20;
   428    while len > 5 do
   427    while len > 5 do
   429          begin
   428          begin
   430          tx:= cc*len;
   429          tx:= cc*len;
   431          ty:= cs*len;
   430          ty:= cs*len;
   432          lx:= round(Gear.X + tx) + sign(HHGear.dX);
   431          lx:= round(Gear.X + tx) + Sign(HHGear.dX);
   433          ly:= round(Gear.Y + ty) + sign(HHGear.dY);
   432          ly:= round(Gear.Y + ty) + Sign(HHGear.dY);
   434          if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0)and (Land[ly, lx] <> 0) then
   433          if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0)and (Land[ly, lx] <> 0) then
   435            begin
   434            begin
   436            with RopePoints.ar[RopePoints.Count] do
   435            with RopePoints.ar[RopePoints.Count] do
   437                 begin
   436                 begin
   438                 X:= Gear.X;
   437                 X:= Gear.X;