# HG changeset patch # User Wuzzy # Date 1590530413 -7200 # Node ID e1078c72ad6051405e135fee6502f743aa921a74 # Parent 6a38a30e772aeafbaabb754ef46d755c1cc3f7b5 Fade out rising flakes at the top diff -r 6a38a30e772a -r e1078c72ad60 ChangeLog.txt --- a/ChangeLog.txt Tue May 26 23:02:49 2020 +0200 +++ b/ChangeLog.txt Wed May 27 00:00:13 2020 +0200 @@ -7,6 +7,7 @@ + Racer: Reset mines, air mines and sticky mines every turn + A Space Adventure: Spacetrip: Meteorite appears blown-up after victory + New flags: serbia, montenegro + + Themes: Rising flakes fade out at the top * Racer: Resize waypoints in custom-sized drawn maps * Mutant: Fix impossible to become mutant after mutant is gone * A Classic Fairytale: Mission 1: Fix possibility of getting stuck in “Leap of Faith” section diff -r 6a38a30e772a -r e1078c72ad60 hedgewars/uVisualGearsHandlers.pas --- a/hedgewars/uVisualGearsHandlers.pas Tue May 26 23:02:49 2020 +0200 +++ b/hedgewars/uVisualGearsHandlers.pas Wed May 27 00:00:13 2020 +0200 @@ -80,7 +80,7 @@ procedure doStepFlake(Gear: PVisualGear; Steps: Longword); var sign: real; moved, rising, outside: boolean; - vfc, vft: LongWord; + vfc, vft, diff: LongWord; spawnMargin: LongInt; const randMargin = 50; @@ -180,17 +180,40 @@ // flake fell far below map? outside:= (not rising) and (round(Y) - spawnMargin + randMargin > LAND_HEIGHT); // if not, did it rise far above map? - outside:= outside or (rising and (round(Y) < LAND_HEIGHT - 1024 - spawnMargin - randMargin)); + outside:= outside or (rising and (round(Y) < LAND_HEIGHT - 1024 - randMargin)); // if flake left acceptable vertical area, respawn it opposite side if outside then begin - X:= cLeftScreenBorder + random(cScreenSpace); if rising then - Y:= Y + (1024 + spawnMargin + random(50)) + begin + if State = 0 then + begin + // fade out rising flake + diff:= (LAND_HEIGHT - 1024 - randMargin) - round(Y); + diff:= Min(diff*2, $FF); + if diff >= $FF then + begin + diff:= $FF; + State:= 1; + end; + Tint:= (Tint and $FFFFFF00) or ($FF - diff); + end + else + begin + Y:= LAND_HEIGHT + spawnMargin + random(50); + moved:= true; + State:= 0; + Tint:= Tint or $FF; + end; + end else + begin Y:= Y - (1024 + spawnMargin + random(50)); - moved:= true; + moved:= true; + end; + if moved then + X:= cLeftScreenBorder + random(cScreenSpace); end; if moved then