Skip to content

Commit 645a748

Browse files
committed
Hasty decompile dust cleanup
It's not *done* but it's cleaner
1 parent 9f6d862 commit 645a748

File tree

2 files changed

+134
-199
lines changed

2 files changed

+134
-199
lines changed

Entities/CrystalBombDetonator.cs

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,37 @@ namespace Celeste.Mod.SpringCollab2020.Entities {
99
[Tracked(false)]
1010
[CustomEntity("SpringCollab2020/crystalBombDetonator")]
1111
public class CrystalBombDetonator : Solid {
12+
// Duration of flashing anim
13+
public float Flash = 0f;
14+
15+
// Used in the shape of the "wave" on the renderer
16+
public float Solidify = 0f;
17+
private float solidifyDelay = 0f;
18+
19+
// Used to propagate state
20+
private List<CrystalBombDetonator> adjacent = new List<CrystalBombDetonator>();
21+
22+
// If the field is currently in its flashing state (used to propagate Flashing state to adjacent fields)
23+
public bool Flashing = false;
24+
25+
// Particle array and a list of speeds
26+
private List<Vector2> particles = new List<Vector2>();
27+
private readonly static float[] speeds = new float[] {
28+
12f,
29+
20f,
30+
40f
31+
};
32+
33+
// Cached method reference, first calculated in Update
34+
private static MethodInfo bombExplosionMethod;
35+
1236
public CrystalBombDetonator(Vector2 position, float width, float height) : base(position, width, height, false) {
13-
Flash = 0f;
14-
Solidify = 0f;
15-
Flashing = false;
16-
solidifyDelay = 0f;
17-
particles = new List<Vector2>();
18-
adjacent = new List<CrystalBombDetonator>();
19-
speeds = new float[]
20-
{
21-
12f,
22-
20f,
23-
40f
24-
};
2537
Collidable = false;
26-
int num = 0;
27-
while ((float) num < Width * Height / 16f) {
38+
for (int num = 0; (float) num < Width * Height / 16f; num++)
2839
particles.Add(new Vector2(Calc.Random.NextFloat(Width - 1f), Calc.Random.NextFloat(Height - 1f)));
29-
num++;
30-
}
3140
}
3241

33-
public CrystalBombDetonator(EntityData data, Vector2 offset) : this(data.Position + offset, (float) data.Width, (float) data.Height) {
34-
}
42+
public CrystalBombDetonator(EntityData data, Vector2 offset) : this(data.Position + offset, (float) data.Width, (float) data.Height) { }
3543

3644
public override void Added(Scene scene) {
3745
base.Added(scene);
@@ -44,33 +52,22 @@ public override void Removed(Scene scene) {
4452
}
4553

4654
public override void Update() {
47-
bool flashing = Flashing;
48-
if (flashing) {
55+
if (Flashing) {
4956
Flash = Calc.Approach(Flash, 0f, Engine.DeltaTime * 4f);
50-
bool flag = Flash <= 0f;
51-
if (flag) {
57+
if (Flash <= 0f) {
5258
Flashing = false;
5359
}
5460
} else {
55-
bool flag2 = solidifyDelay > 0f;
56-
if (flag2) {
61+
if (solidifyDelay > 0f)
5762
solidifyDelay -= Engine.DeltaTime;
58-
} else {
59-
bool flag3 = Solidify > 0f;
60-
if (flag3) {
61-
Solidify = Calc.Approach(Solidify, 0f, Engine.DeltaTime);
62-
}
63-
}
63+
else if (Solidify > 0f)
64+
Solidify = Calc.Approach(Solidify, 0f, Engine.DeltaTime);
6465
}
65-
int num = speeds.Length;
66-
float height = Height;
67-
int i = 0;
68-
int count = particles.Count;
69-
while (i < count) {
70-
Vector2 value = particles[i] + Vector2.UnitY * speeds[i % num] * Engine.DeltaTime;
71-
value.Y %= height - 1f;
72-
particles[i] = value;
73-
i++;
66+
67+
for (int i = 0; i < particles.Count; i++) {
68+
Vector2 newPosition = particles[i] + Vector2.UnitY * speeds[i % speeds.Length] * Engine.DeltaTime;
69+
newPosition.Y %= Height - 1f;
70+
particles[i] = newPosition;
7471
}
7572
base.Update();
7673

@@ -111,15 +108,5 @@ private void CheckForBombs() {
111108
}
112109
}
113110
}
114-
115-
public float Flash;
116-
public float Solidify;
117-
public bool Flashing;
118-
private float solidifyDelay;
119-
private List<Vector2> particles;
120-
private List<CrystalBombDetonator> adjacent;
121-
private float[] speeds;
122-
123-
private static MethodInfo bombExplosionMethod;
124111
}
125112
}

0 commit comments

Comments
 (0)