--- a/ChangeLog.txt Wed May 27 01:24:50 2020 +0200
+++ b/ChangeLog.txt Wed May 27 01:58:27 2020 +0200
@@ -7,7 +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
+ + Themes: Add fade-in and fade-out effects
+ Themes: Make Sudden Death flakes in Underwater theme rise
* Racer: Resize waypoints in custom-sized drawn maps
* Mutant: Fix impossible to become mutant after mutant is gone
--- a/hedgewars/uVisualGearsHandlers.pas Wed May 27 01:24:50 2020 +0200
+++ b/hedgewars/uVisualGearsHandlers.pas Wed May 27 01:58:27 2020 +0200
@@ -79,11 +79,12 @@
procedure doStepFlake(Gear: PVisualGear; Steps: Longword);
var sign: real;
- moved, rising, outside: boolean;
+ moved, rising, outside, fallingFadeIn: boolean;
vfc, vft, diff: LongWord;
spawnMargin: LongInt;
const
randMargin = 50;
+ maxFallSpeedForFadeIn = 750;
begin
if SuddenDeathDmg then
begin
@@ -103,12 +104,14 @@
Y:= Y + (dY + tdY + cGravityf * vobSDFallSpeed) * Steps * Gear^.Scale;
vfc:= vobSDFramesCount;
vft:= vobSDFrameTicks;
+ fallingFadeIn := vobSDFallSpeed <= maxFallSpeedForFadeIn;
end
else
begin
Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps * Gear^.Scale;
vfc:= vobFramesCount;
vft:= vobFrameTicks;
+ fallingFadeIn := vobFallSpeed <= maxFallSpeedForFadeIn;
end;
if vft > 0 then
@@ -186,6 +189,7 @@
if outside then
begin
if rising then
+ // rising flake
begin
if State = 0 then
begin
@@ -194,6 +198,7 @@
diff:= Min(diff*2, $FF);
if diff >= $FF then
begin
+ // end of fade-out
diff:= $FF;
State:= 1;
end;
@@ -201,6 +206,7 @@
end
else
begin
+ // reset and move back to bottom
Y:= LAND_HEIGHT + spawnMargin + random(50);
moved:= true;
State:= 0;
@@ -208,12 +214,29 @@
end;
end
else
+ // falling flake
begin
+ // move back to top
Y:= Y - (1024 + spawnMargin + random(50));
moved:= true;
+ // activate fade-in if not falling too fast
+ if fallingFadeIn then
+ begin
+ State:= $FF;
+ Tint:= (Tint and $FFFFFF00) or ($FF - State);
+ end;
end;
if moved then
X:= cLeftScreenBorder + random(cScreenSpace);
+ end
+ else if (not rising) and (State > 0) then
+ begin
+ // quickly fade in falling flake after appearing at top
+ if State > 16 then
+ Dec(State, 16)
+ else
+ State:= 0;
+ Tint:= (Tint and $FFFFFF00) or ($FF - State);
end;
if moved then
--- a/hedgewars/uVisualGearsList.pas Wed May 27 01:24:50 2020 +0200
+++ b/hedgewars/uVisualGearsList.pas Wed May 27 01:58:27 2020 +0200
@@ -100,6 +100,7 @@
case Kind of
vgtFlake:
begin
+ State:= 0;
Timer:= 0;
tdX:= 0;
tdY:= 0;