hedgewars/uVisualGearsHandlers.pas
changeset 15585 f8c1492601fe
parent 15583 e1078c72ad60
child 15586 19c85b010144
equal deleted inserted replaced
15584:b2b72fc7fc14 15585:f8c1492601fe
   178             spawnMargin:= 200;
   178             spawnMargin:= 200;
   179 
   179 
   180         // flake fell far below map?
   180         // flake fell far below map?
   181         outside:= (not rising) and (round(Y) - spawnMargin + randMargin > LAND_HEIGHT);
   181         outside:= (not rising) and (round(Y) - spawnMargin + randMargin > LAND_HEIGHT);
   182         // if not, did it rise far above map?
   182         // if not, did it rise far above map?
   183         outside:= outside or (rising and (round(Y) < LAND_HEIGHT - 1024 - randMargin));
   183         outside:= outside or (rising and (round(Y) < LAND_HEIGHT - (cCloudOffset - 110)));
   184 
   184 
   185         // if flake left acceptable vertical area, respawn it opposite side
   185         // if flake left acceptable vertical area, respawn it opposite side
   186         if outside then
   186         if outside then
   187             begin
   187             begin
   188             if rising then
   188             if rising then
   189                 begin
   189                 begin
   190                 if State = 0 then
   190                 if State = 0 then
   191                     begin
   191                     begin
   192                     // fade out rising flake
   192                     // fade out rising flake
   193                     diff:= (LAND_HEIGHT - 1024 - randMargin) - round(Y);
   193                     diff:= (LAND_HEIGHT - (cCloudOffset - 110)) - round(Y);
   194                     diff:= Min(diff*2, $FF);
   194                     diff:= Min(diff*2, $FF);
   195                     if diff >= $FF then
   195                     if diff >= $FF then
   196                         begin
   196                         begin
   197                         diff:= $FF;
   197                         diff:= $FF;
   198                         State:= 1;
   198                         State:= 1;
   250 // up-and-down-bounce magic
   250 // up-and-down-bounce magic
   251 s := (GameTicks + Gear^.Timer) mod 4096;
   251 s := (GameTicks + Gear^.Timer) mod 4096;
   252 t := 8 * Gear^.Scale * hwFloat2Float(AngleSin(s mod 2048));
   252 t := 8 * Gear^.Scale * hwFloat2Float(AngleSin(s mod 2048));
   253 if (s < 2048) then t := -t;
   253 if (s < 2048) then t := -t;
   254 
   254 
   255 Gear^.Y := LAND_HEIGHT - 1184 + LongInt(Gear^.Timer mod 8) + t;
   255 Gear^.Y := LAND_HEIGHT - cCloudOffset + LongInt(Gear^.Timer mod 8) + t;
   256 
   256 
   257 if round(Gear^.X) < cLeftScreenBorder then
   257 if round(Gear^.X) < cLeftScreenBorder then
   258     Gear^.X:= Gear^.X + cScreenSpace
   258     Gear^.X:= Gear^.X + cScreenSpace
   259 else
   259 else
   260     if round(Gear^.X) > cRightScreenBorder then
   260     if round(Gear^.X) > cRightScreenBorder then