hedgewars/GSHandlers.inc
changeset 3408 56e636b83cb4
parent 3407 dcc129c4352e
child 3413 d08eaae8d3e8
equal deleted inserted replaced
3407:dcc129c4352e 3408:56e636b83cb4
  3081 Gear^.Y:= Gear^.Y + Gear^.dY;
  3081 Gear^.Y:= Gear^.Y + Gear^.dY;
  3082 x:= hwRound(Gear^.X);
  3082 x:= hwRound(Gear^.X);
  3083 y:= hwRound(Gear^.Y);
  3083 y:= hwRound(Gear^.Y);
  3084 tx:= 0; ty:= 0; // avoid compiler hints
  3084 tx:= 0; ty:= 0; // avoid compiler hints
  3085 
  3085 
  3086 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and ((Land[y, x] and $FF00) <> 0) then
  3086 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] > 255) then
  3087     begin
  3087     begin
  3088     if not calcSlopeNormal(Gear, x, y, tx, ty, 255) then
  3088     if not calcSlopeTangent(Gear, x, y, tx, ty, 255) then
  3089         begin
  3089         begin
  3090         DeleteGear(Gear);
  3090         DeleteGear(Gear);
  3091         EXIT;
  3091         EXIT;
  3092         end;
  3092         end;
  3093     //AddFileLog(IntToStr(tx)+' '+IntToStr(ty));
  3093     if not Gear^.dX.isNegative then ty:= -ty;
  3094     if Gear^.dX.isNegative then ty:= -ty;
  3094     Gear^.DirAngle:= DxDy2Angle(Int2hwFloat(tx),Int2hwFloat(ty));
  3095     Gear^.DirAngle:= DxDy2Angle(Int2hwFloat(ty),Int2hwFloat(tx));
       
  3096 (* 
  3095 (* 
  3097 This is not quite doing what I want, but basically hoping to avoid portals just sitting out in midair
  3096 This is not quite doing what I want, but basically hoping to avoid portals just sitting out in midair
  3098 Works ok for right angles, aaaand that's about it.
  3097 Works ok for right angles, aaaand that's about it.
  3099 The opposite approach could be taken, we could determine the angle of the land using sheepluva's code and snap the Angle/DirAngle to it.
  3098 The opposite approach could be taken, we could determine the angle of the land using sheepluva's code and snap the Angle/DirAngle to it.
  3100 tangle:= Gear^.Angle+1024;
  3099 tangle:= Gear^.Angle+1024;