Skip to content

Commit 6dd0342

Browse files
authored
Merge pull request #96 from CommunalHelper/misc-additions
fix windsnow not working with zoomout
2 parents 66004f3 + f920841 commit 6dd0342

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

Code/CustomWindSnow.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public override void Update(Scene scene)
5555
{
5656
base.Update(scene);
5757
Level level = scene as Level;
58-
visibleFade = Calc.Approach(visibleFade, IsVisible(level) ? 1f : 0f, Engine.DeltaTime * 2f);
58+
visibleFade = Calc.Approach(visibleFade, IsVisible(level) ? 1f : 0f, Engine.DeltaTime * 2f);
5959
foreach(SineWave sine in sines)
6060
{
6161
sine.Update();
@@ -84,10 +84,14 @@ public override void Update(Scene scene)
8484
}
8585
}
8686
rotation = Calc.Approach(rotation, target_rot, Engine.DeltaTime * 8f);
87+
if (windVector.X == 0f)
88+
{
89+
windVector.Y *= 3f;
90+
}
8791
for (int i = 0; i < positions.Length; i++)
8892
{
8993
float value = sines[i % sines.Length].Value;
90-
Vector2 zero = new Vector2(windVector.X + value * 10f, windVector.Y * 3f + value * 10f);
94+
Vector2 zero = new Vector2(windVector.X + value * 10f, windVector.Y + value * 10f);
9195
if (windVector.Length() == 0f)
9296
{
9397
zero.Y += 20f;
@@ -125,14 +129,20 @@ public override void Render(Scene scene)
125129
position.Y += 360f;
126130
}
127131
position.X -= (scene as Level).Camera.X + CameraOffset.X;
128-
position.X %= 360f;
132+
position.X %= 640f;
129133
if (position.X < 0f)
130134
{
131-
position.X += 360f;
135+
position.X += 640f;
132136
}
133137
if (index < amount * limit)
134138
{
135-
GFX.Game["particles/snow"].DrawCentered(position, color, scale, rotation);
139+
for (int draw_y = 0; draw_y < (scene as Level).Camera.Viewport.Height; draw_y += 360)
140+
{
141+
for (int draw_x = 0; draw_x < (scene as Level).Camera.Viewport.Width; draw_x += 640)
142+
{
143+
GFX.Game["particles/snow"].DrawCentered(position + new Vector2(draw_x, draw_y), color, scale, rotation);
144+
}
145+
}
136146
}
137147
index++;
138148
}

0 commit comments

Comments
 (0)