hedgewars/GSHandlers.inc
changeset 3391 77161719ec3c
parent 3388 ab9352a4ddcc
child 3396 e5b3e5f2818e
equal deleted inserted replaced
3390:1d4926d10a9e 3391:77161719ec3c
    51 var skipSpeed, skipAngle, skipDecay: hwFloat;
    51 var skipSpeed, skipAngle, skipDecay: hwFloat;
    52     i, maxDrops: LongInt;
    52     i, maxDrops: LongInt;
    53     particle: PVisualGear;
    53     particle: PVisualGear;
    54 begin
    54 begin
    55 // probably needs tweaking. might need to be in a case statement based upon gear type
    55 // probably needs tweaking. might need to be in a case statement based upon gear type
    56 //(not Gear^.dY.isNegative) and  this should not be necessary
       
    57 if cWaterLine < hwRound(Gear^.Y) + Gear^.Radius then
    56 if cWaterLine < hwRound(Gear^.Y) + Gear^.Radius then
    58     begin
    57     begin
    59     skipSpeed:= _0_25;  // was 0.36 - couldn't manage baseball bat. Tiy's build is 0.36...
    58     skipSpeed:= _0_25;
    60     skipAngle:= _1 + _0_9;  // these should perhaps also be constants, once work out what proper values are
    59     skipAngle:= _1_9;  
    61     skipDecay:= _0_87;  // this could perhaps be a tiny bit higher.
    60     skipDecay:= _0_87;  // this could perhaps be a tiny bit higher.
    62     if  (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and
    61     if  (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and
    63         (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then
    62         (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then
    64        begin
    63        begin
    65        Gear^.dY.isNegative:= true;
    64        Gear^.dY.isNegative:= true;
  3059 3) On any other shot, delete any existing portals of type X%2, and spawn a new portal of type X%2 oriented at angle 180° from the portal gun.  It might possibly be worth linking portals with a Gear reference, to save time on scanning through the Gear list every time we need a portal.
  3058 3) On any other shot, delete any existing portals of type X%2, and spawn a new portal of type X%2 oriented at angle 180° from the portal gun.  It might possibly be worth linking portals with a Gear reference, to save time on scanning through the Gear list every time we need a portal.
  3060 *)
  3059 *)
  3061 end;
  3060 end;
  3062 
  3061 
  3063 procedure doStepMovingPortal(Gear: PGear);
  3062 procedure doStepMovingPortal(Gear: PGear);
  3064 var i, x, y: LongWord;
  3063 var i, x, y: LongInt;
  3065     oX, oY: hwFloat;
  3064     oX, oY: hwFloat;
  3066 begin
  3065 begin
  3067 oX:= Gear^.X;
  3066 oX:= Gear^.X;
  3068 oY:= Gear^.Y;
  3067 oY:= Gear^.Y;
  3069 Gear^.X:= Gear^.X + Gear^.dX;
  3068 Gear^.X:= Gear^.X + Gear^.dX;
  3077 *)
  3076 *)
  3078 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] <> 0) then
  3077 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] <> 0) then
  3079     begin
  3078     begin
  3080     inc(Gear^.Tag);
  3079     inc(Gear^.Tag);
  3081     Gear^.doStep:= @doStepPortal;
  3080     Gear^.doStep:= @doStepPortal;
  3082     AfterAttack
  3081 //    AfterAttack;
  3083     end
  3082     end
  3084 // How laser checks for infinite
  3083 // How laser checks for infinite
  3085 else if (y > LAND_HEIGHT + LAND_WIDTH div 4) or (y < - LAND_WIDTH div 4) or (x > LAND_WIDTH + LAND_WIDTH div 4) or (x < - LAND_WIDTH div 4) then
  3084 else if (y > cWaterLine + cVisibleWater + Gear^.Radius) or (y < -LAND_WIDTH) or (x > LAND_WIDTH + LAND_WIDTH) or (x < -LAND_WIDTH) then
  3086     begin
  3085     begin
  3087     DeleteGear(Gear);
  3086     DeleteGear(Gear);
  3088     AfterAttack
  3087 //    AfterAttack
  3089     end;
  3088     end;
  3090 end;
  3089 end;
  3091 
  3090 
  3092 procedure doStepPiano(Gear: PGear);
  3091 procedure doStepPiano(Gear: PGear);
  3093 var r0, r1: LongInt;
  3092 var r0, r1: LongInt;