hedgewars/GSHandlers.inc
changeset 3986 99178ffb817d
parent 3985 57121975b64b
child 3991 82e4a5ef18f7
equal deleted inserted replaced
3985:57121975b64b 3986:99178ffb817d
  1091 end;
  1091 end;
  1092 
  1092 
  1093 procedure doStepRopeWork(Gear: PGear);
  1093 procedure doStepRopeWork(Gear: PGear);
  1094 var 
  1094 var 
  1095     HHGear: PGear;
  1095     HHGear: PGear;
  1096     len, tx, ty, nx, ny, rDxDy, ropeDx, ropeDy, mdX, mdY: hwFloat;
  1096     len, tx, ty, nx, ny, ropeDx, ropeDy, mdX, mdY: hwFloat;
  1097     lx, ly: LongInt;
  1097     lx, ly: LongInt;
  1098     haveCollision,
  1098     haveCollision,
  1099     haveDivided: boolean;
  1099     haveDivided: boolean;
  1100 
  1100 
  1101 procedure DeleteMe;
  1101 procedure DeleteMe;
  1181     nx := Gear^.X + mdX * len;
  1181     nx := Gear^.X + mdX * len;
  1182     ny := Gear^.Y + mdY * len;
  1182     ny := Gear^.Y + mdY * len;
  1183     tx := mdX * _0_3; // should be the same as increase step
  1183     tx := mdX * _0_3; // should be the same as increase step
  1184     ty := mdY * _0_3;
  1184     ty := mdY * _0_3;
  1185 
  1185 
  1186     rDxDy.isNegative:= true;
       
  1187     while len > _3 do
  1186     while len > _3 do
  1188         begin
  1187         begin
  1189         lx := hwRound(nx);
  1188         lx := hwRound(nx);
  1190         ly := hwRound(ny);
  1189         ly := hwRound(ny);
  1191         if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0) then
  1190         if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0) then
  1192             begin
  1191             begin
  1193             if rDxDy.isNegative then rDxDy := _1 / Distance(ropeDx, ropeDy);
  1192             ny := _1 / Distance(ropeDx, ropeDy);
  1194             // old rope pos
  1193             // old rope pos
  1195             nx := ropeDx * rDxDy;
  1194             nx := ropeDx * ny;
  1196             ny := ropeDy * rDxDy;
  1195             ny := ropeDy * ny;
  1197 
  1196 
  1198             with RopePoints.ar[RopePoints.Count] do
  1197             with RopePoints.ar[RopePoints.Count] do
  1199                 begin
  1198                 begin
  1200                 X := Gear^.X;
  1199                 X := Gear^.X;
  1201                 Y := Gear^.Y;
  1200                 Y := Gear^.Y;