|
2 | 2 | using MonoMod.Cil; |
3 | 3 | using System.Collections; |
4 | 4 | using System.Collections.Generic; |
| 5 | +using System.Linq; |
5 | 6 |
|
6 | 7 | namespace Celeste.Mod.CommunalHelper.Entities; |
7 | 8 |
|
@@ -154,22 +155,23 @@ protected virtual void SetupCustomParticles(float canvasWidth, float canvasHeigh |
154 | 155 |
|
155 | 156 | private Color GetParticleColor(int layer, Color[] dashColors) |
156 | 157 | { |
157 | | - Color defaultColor = layer switch |
158 | | - { |
159 | | - 0 => Calc.Random.Choose(DreamColors[0], DreamColors[1], DreamColors[2]), |
160 | | - 1 => Calc.Random.Choose(DreamColors[3], DreamColors[4], DreamColors[5]), |
161 | | - 2 => Calc.Random.Choose(DreamColors[6], DreamColors[7], DreamColors[8]), |
162 | | - _ => throw new NotImplementedException() |
163 | | - }; |
164 | | - (_, _, _, _, List<List<Color>> particleLayerColors) = Imports.PandorasBox.GetVisualSettingsFor(this); |
| 158 | + Imports.PandorasBox.GetVisualSettingsFor(this, out _, out _, out _, out _, out Color[][] activeParticleLayerColors, out Color[][] disabledParticleLayerColors); |
165 | 159 |
|
166 | 160 | return PlayerHasDreamDash |
167 | 161 | ? RefillCount != -1 |
168 | 162 | ? dashColors[layer] |
169 | | - : particleLayerColors is not null |
170 | | - ? Calc.Random.Choose(particleLayerColors[layer]) |
171 | | - : defaultColor |
172 | | - : Color.LightGray * (0.5f + layer / 2f * 0.5f); |
| 163 | + : activeParticleLayerColors is not null |
| 164 | + ? Calc.Random.Choose(activeParticleLayerColors[layer]) |
| 165 | + : layer switch |
| 166 | + { |
| 167 | + 0 => Calc.Random.Choose(DreamColors[0], DreamColors[1], DreamColors[2]), |
| 168 | + 1 => Calc.Random.Choose(DreamColors[3], DreamColors[4], DreamColors[5]), |
| 169 | + 2 => Calc.Random.Choose(DreamColors[6], DreamColors[7], DreamColors[8]), |
| 170 | + _ => throw new NotImplementedException() |
| 171 | + } |
| 172 | + : disabledParticleLayerColors is not null |
| 173 | + ? Calc.Random.Choose(disabledParticleLayerColors[layer]) |
| 174 | + : Color.LightGray * (0.5f + layer / 2f * 0.5f); |
173 | 175 | } |
174 | 176 |
|
175 | 177 | private void ShakeParticles() |
@@ -263,8 +265,12 @@ public override void Render() |
263 | 265 | if (Right < camera.Left || Left > camera.Right || Bottom < camera.Top || Top > camera.Bottom) |
264 | 266 | return; |
265 | 267 |
|
266 | | - (Color? controllerActiveBackColor, Color? controllerDisabledBackColor, Color? controllerActiveLineColor, Color? controllerDisabledLineColor, _) |
267 | | - = Imports.PandorasBox.GetVisualSettingsFor(this); |
| 268 | + Imports.PandorasBox.GetVisualSettingsFor(this, |
| 269 | + out Color? controllerActiveBackColor, |
| 270 | + out Color? controllerDisabledBackColor, |
| 271 | + out Color? controllerActiveLineColor, |
| 272 | + out Color? controllerDisabledLineColor, |
| 273 | + out _, out _); |
268 | 274 | Color backColor = Color.Lerp(PlayerHasDreamDash |
269 | 275 | ? controllerActiveBackColor ?? activeBackColor |
270 | 276 | : controllerDisabledBackColor ?? disabledBackColor, Color.White, ColorLerp); |
@@ -500,7 +506,7 @@ private static void Player_DreamDashBegin(On.Celeste.Player.orig_DreamDashBegin |
500 | 506 | player.Position += player.DashDir.Sign(); |
501 | 507 |
|
502 | 508 | // Only override speed if there isn't a Dream Dash Controller affecting this block |
503 | | - (_, _, bool? overrideDreamDashSpeed, _, _, _, _, _, _) = Imports.PandorasBox.GetGameplaySettingsFor(player.dreamBlock); |
| 509 | + Imports.PandorasBox.GetGameplaySettingsFor(player.dreamBlock, out _, out _, out bool? overrideDreamDashSpeed, out _, out _, out _, out _, out _, out _); |
504 | 510 | if (!(overrideDreamDashSpeed ?? false)) |
505 | 511 | player.Speed = player.DashDir * customDreamBlock.dashSpeed; |
506 | 512 | } |
@@ -532,10 +538,9 @@ private static void Player_DreamDashEnd(ILContext il) |
532 | 538 | return; |
533 | 539 |
|
534 | 540 | cursor.Emit(OpCodes.Ldarg_0); |
535 | | - cursor.EmitDelegate<Func<Player, bool>>(player => player.GetData().Get<DreamBlock>("dreamBlock") is CustomDreamBlock block && block.RefillCount == -2); |
| 541 | + cursor.EmitDelegate<Func<Player, bool>>(player => player.GetData().Get<DreamBlock>("dreamBlock") is CustomDreamBlock { RefillCount: -2 }); |
536 | 542 | cursor.Emit(OpCodes.Brtrue_S, cursor.Next.Next); |
537 | 543 | } |
538 | 544 |
|
539 | 545 | #endregion |
540 | | - |
541 | 546 | } |
0 commit comments