hedgewars/GSHandlers.inc
changeset 107 b08ce0293a51
parent 100 f324a18698fe
child 108 08f1fe6f21f8
equal deleted inserted replaced
106:98cb6606bf67 107:b08ce0293a51
    57 end;
    57 end;
    58 
    58 
    59 ////////////////////////////////////////////////////////////////////////////////
    59 ////////////////////////////////////////////////////////////////////////////////
    60 ////////////////////////////////////////////////////////////////////////////////
    60 ////////////////////////////////////////////////////////////////////////////////
    61 procedure CalcRotationDirAngle(Gear: PGear);
    61 procedure CalcRotationDirAngle(Gear: PGear);
    62 var dAngle: real;
    62 var dAngle: Double;
    63 begin
    63 begin
    64 dAngle:= (abs(Gear.dX) + abs(Gear.dY))*0.1;
    64 dAngle:= (abs(Gear.dX) + abs(Gear.dY))*0.1;
    65 if Gear.dX >= 0 then Gear.DirAngle:= Gear.DirAngle + dAngle
    65 if Gear.dX >= 0 then Gear.DirAngle:= Gear.DirAngle + dAngle
    66                 else Gear.DirAngle:= Gear.DirAngle - dAngle;
    66                 else Gear.DirAngle:= Gear.DirAngle - dAngle;
    67 if Gear.DirAngle < 0 then Gear.DirAngle:= Gear.DirAngle + 16
    67 if Gear.DirAngle < 0 then Gear.DirAngle:= Gear.DirAngle + 16
   222 Gear.dY:= Gear.dY + cGravity
   222 Gear.dY:= Gear.dY + cGravity
   223 end;
   223 end;
   224 
   224 
   225 ////////////////////////////////////////////////////////////////////////////////
   225 ////////////////////////////////////////////////////////////////////////////////
   226 procedure doStepUFOWork(Gear: PGear);
   226 procedure doStepUFOWork(Gear: PGear);
   227 var t: real;
   227 var t: Double;
   228 begin
   228 begin
   229 AllInactive:= false;
   229 AllInactive:= false;
   230 t:= sqrt(sqr(Gear.dX) + sqr(Gear.dY));
   230 t:= sqrt(sqr(Gear.dX) + sqr(Gear.dY));
   231 Gear.dX:= Gear.Elasticity * (Gear.dX + 0.000004 * (TargetPoint.X - trunc(Gear.X)));
   231 Gear.dX:= Gear.Elasticity * (Gear.dX + 0.000004 * (TargetPoint.X - trunc(Gear.X)));
   232 Gear.dY:= Gear.Elasticity * (Gear.dY + 0.000004 * (TargetPoint.Y - trunc(Gear.Y)));
   232 Gear.dY:= Gear.Elasticity * (Gear.dY + 0.000004 * (TargetPoint.Y - trunc(Gear.Y)));
   299 end;
   299 end;
   300 
   300 
   301 ////////////////////////////////////////////////////////////////////////////////
   301 ////////////////////////////////////////////////////////////////////////////////
   302 procedure doStepDEagleShot(Gear: PGear);
   302 procedure doStepDEagleShot(Gear: PGear);
   303 var i, x, y: LongWord;
   303 var i, x, y: LongWord;
   304     oX, oY: real;
   304     oX, oY: Double;
   305 begin
   305 begin
   306 AllInactive:= false;
   306 AllInactive:= false;
   307 i:= 80;
   307 i:= 80;
   308 oX:= Gear.X;
   308 oX:= Gear.X;
   309 oY:= Gear.Y;
   309 oY:= Gear.Y;
   426 
   426 
   427 ////////////////////////////////////////////////////////////////////////////////
   427 ////////////////////////////////////////////////////////////////////////////////
   428 procedure doStepRopeWork(Gear: PGear);
   428 procedure doStepRopeWork(Gear: PGear);
   429 const flCheck: boolean = false;
   429 const flCheck: boolean = false;
   430 var HHGear: PGear;
   430 var HHGear: PGear;
   431     len, cs, cc, tx, ty: real;
   431     len, cs, cc, tx, ty: Double;
   432     lx, ly: integer;
   432     lx, ly: integer;
   433 
   433 
   434     procedure DeleteMe;
   434     procedure DeleteMe;
   435     begin
   435     begin
   436       with HHGear^ do
   436       with HHGear^ do
   541 end;
   541 end;
   542 
   542 
   543 
   543 
   544 procedure doStepRopeAttach(Gear: PGear);
   544 procedure doStepRopeAttach(Gear: PGear);
   545 var HHGear: PGear;
   545 var HHGear: PGear;
   546     tx, ty, tt: real;
   546     tx, ty, tt: Double;
   547 begin
   547 begin
   548 Gear.X:= Gear.X + Gear.dX;
   548 Gear.X:= Gear.X + Gear.dX;
   549 Gear.Y:= Gear.Y + Gear.dY;
   549 Gear.Y:= Gear.Y + Gear.dY;
   550 Gear.Elasticity:= Gear.Elasticity + 1.0;
   550 Gear.Elasticity:= Gear.Elasticity + 1.0;
   551 HHGear:= PHedgehog(Gear.Hedgehog)^.Gear;
   551 HHGear:= PHedgehog(Gear.Hedgehog)^.Gear;