hedgewars/VGSHandlers.inc
changeset 4161 1f19dcdabe19
parent 4152 07008cb354f9
child 4172 03fe080d99d6
equal deleted inserted replaced
4160:043c17a8b3ca 4161:1f19dcdabe19
    40             Angle:= Angle + 360;
    40             Angle:= Angle + 360;
    41     
    41     
    42   
    42   
    43     if (round(X) >= cLeftScreenBorder) and
    43     if (round(X) >= cLeftScreenBorder) and
    44        (round(X) <= cRightScreenBorder) and
    44        (round(X) <= cRightScreenBorder) and
    45        (round(Y) <= (int64(LAND_HEIGHT) + 75)) and
    45        (round(Y) - 75 <= LAND_HEIGHT) and
    46        (Timer > 0) and (Timer-Steps > 0) then
    46        (Timer > 0) and (Timer-Steps > 0) then
    47         begin
    47         begin
    48         if tdX > 0 then sign := 1
    48         if tdX > 0 then sign := 1
    49         else sign:= -1;
    49         else sign:= -1;
    50         tdX:= tdX - 0.005*Steps*sign;
    50         tdX:= tdX - 0.005*Steps*sign;
    58     else
    58     else
    59         begin
    59         begin
    60         if round(X) < cLeftScreenBorder then X:= X + cScreenSpace else
    60         if round(X) < cLeftScreenBorder then X:= X + cScreenSpace else
    61         if round(X) > cRightScreenBorder then X:= X - cScreenSpace;
    61         if round(X) > cRightScreenBorder then X:= X - cScreenSpace;
    62         // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + float(25); // For if flag is set for flakes rising upwards?
    62         // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + float(25); // For if flag is set for flakes rising upwards?
    63         if round(Y) > (int64(LAND_HEIGHT) + 75) then Y:= Y - float(1024 + 150); // TODO - configure in theme (jellies for example could use limited range)
    63         if round(Y) - 75 > LAND_HEIGHT then Y:= Y - float(1024 + 150); // TODO - configure in theme (jellies for example could use limited range)
    64         Timer:= 0;
    64         Timer:= 0;
    65         tdX:= 0;
    65         tdX:= 0;
    66         tdY:= 0
    66         tdY:= 0
    67         end;
    67         end;
    68     end;
    68     end;
    88 // up-and-down-bounce magic
    88 // up-and-down-bounce magic
    89 s := (GameTicks + Gear^.Timer) mod 4096;
    89 s := (GameTicks + Gear^.Timer) mod 4096;
    90 t := 8 * AngleSin(s mod 2048).QWordValue / 4294967296;
    90 t := 8 * AngleSin(s mod 2048).QWordValue / 4294967296;
    91 if (s < 2048) then t := -t;
    91 if (s < 2048) then t := -t;
    92 
    92 
    93 Gear^.Y := int64(LAND_HEIGHT) - 1184 + Gear^.Timer mod 8 + t;
    93 Gear^.Y := LAND_HEIGHT - 1184 + LongInt(Gear^.Timer mod 8) + t;
    94 
    94 
    95 if round(Gear^.X) < cLeftScreenBorder then Gear^.X:= Gear^.X + cScreenSpace else
    95 if round(Gear^.X) < cLeftScreenBorder then Gear^.X:= Gear^.X + cScreenSpace else
    96 if round(Gear^.X) > cRightScreenBorder then Gear^.X:= Gear^.X - cScreenSpace
    96 if round(Gear^.X) > cRightScreenBorder then Gear^.X:= Gear^.X - cScreenSpace
    97 end;
    97 end;
    98 
    98 
   484     end;
   484     end;
   485 end;
   485 end;
   486 
   486 
   487 procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword);
   487 procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword);
   488 begin
   488 begin
   489 if round(Gear^.Y) < int64(cWaterLine) + 10 then
   489 if round(Gear^.Y) - 10 < cWaterLine then
   490     DeleteVisualGear(Gear)
   490     DeleteVisualGear(Gear)
   491 else
   491 else
   492     Gear^.Y:= Gear^.Y - 0.08 * Steps;
   492     Gear^.Y:= Gear^.Y - 0.08 * Steps;
   493 
   493 
   494 end;
   494 end;