Skip to content

Commit d056f9e

Browse files
committed
v2.1.4
bugfix: spinner color be wrong after fast forward
1 parent 87db758 commit d056f9e

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

Source/Gameplay/AutoWatchEntity/CoreLogic.cs

+4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ private static void FakeGetInfo(Level level) {
114114

115115
public static void OnConfigChange() {
116116
InfoWatchEntity.ForceUpdateInfo = Config.MainEnabled;
117+
// when this gets removed, check that:
118+
// 1) works when both disabled
119+
// 2) if we can click the hidden triggers
120+
117121
if (Engine.Scene is not Level level) {
118122
return;
119123
}

Source/Gameplay/Spinner/SpinnerCalculateHelper.cs

+14-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using MonoMod.Cil;
66
using System.Reflection;
77
using System.Runtime.CompilerServices;
8+
using TAS;
89
// VivHelper namespace has a VivHelper class.... so if we want to visit VivHelper.Entities, we should use VivEntities
910

1011
namespace Celeste.Mod.TASHelper.Gameplay.Spinner;
@@ -43,14 +44,21 @@ private static void PrepareTags() {
4344
if (ModUtils.GetType("FrostHelper", "FrostHelper.Entities.WallBouncePresentation.WallbouncePlayback") is { } wallbouncePlayBack && wallbouncePlayBack.GetFieldInfo("tag") is { } fieldInfo && wallbouncePlayBack.GetConstructorInfo(new Type[] { typeof(string), typeof(Vector2) }) is { } ctorInfo) {
4445
ctorInfo.HookAfter<object>(x => fieldInfo.SetValue(x, (int)fieldInfo.GetValue(x) & ~IsHazardTagValue));
4546
}
46-
}
47+
}
48+
49+
public static bool WillFastForward => FastForwarding && Manager.NextState == Manager.State.Running;
50+
51+
public static int GroupCounter = 0;
4752

4853
// JIT optimization may cause PredictLoadTimeActive[2] != 524288f when TimeActive = 524288f
4954
[MethodImpl(MethodImplOptions.NoOptimization)]
5055
internal static void PreSpinnerCalculate(Scene self) {
51-
if (!TasHelperSettings.Enabled || FastForwarding || self is not Level) {
56+
if (!TasHelperSettings.Enabled || WillFastForward || self is not Level) {
5257
return;
53-
}
58+
}
59+
60+
// only sync this when we plan to render
61+
GroupCounter = TAS.EverestInterop.Hitboxes.CycleHitboxColor.GroupCounter;
5462
float time = TimeActive = self.TimeActive;
5563
for (int i = 0; i <= 9; i++) {
5664
PredictLoadTimeActive[i] = PredictUnloadTimeActive[i] = time;
@@ -437,13 +445,13 @@ public static int PredictCountdown(float offset, bool isDust, bool isLoad) {
437445

438446
public static int CalculateSpinnerGroup(float offset) {
439447
if (OnInterval(PredictLoadTimeActive[0], 0.05f, offset)) {
440-
return TAS.EverestInterop.Hitboxes.CycleHitboxColor.GroupCounter;
448+
return GroupCounter;
441449
}
442450
if (OnInterval(PredictLoadTimeActive[1], 0.05f, offset)) {
443-
return (1 + TAS.EverestInterop.Hitboxes.CycleHitboxColor.GroupCounter) % 3;
451+
return (1 + GroupCounter) % 3;
444452
}
445453
if (OnInterval(PredictLoadTimeActive[2], 0.05f, offset)) {
446-
return (2 + TAS.EverestInterop.Hitboxes.CycleHitboxColor.GroupCounter) % 3;
454+
return (2 + GroupCounter) % 3;
447455
}
448456
return 3;
449457
}

Source/Module/WhatsNew.cs

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public static void CreateUpdateLog() {
8989
AddLog("2.1.1", "Bugfix: fix a bug caused by CelesteTAS refactor.");
9090
AddLog("2.1.2", "Bugfix: Predictor not working properly, caused by CelesteTAS refactor.");
9191
AddLog("2.1.3", "Bugfix: Incompatibility with MotionSmoothing in event ch09_goto_the_future. (thanks @cameryn)");
92+
AddLog("2.1.4", "Bugfix: Fastforward makes spinner colors change. (thanks @trans_alexa)");
9293
UpdateLogs.Sort((x, y) => new Version(y.Item1).CompareTo(new Version(x.Item1)));
9394
}
9495

Source/TinySRT/ExtraSlActions.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ public static TH Create() {
202202
ExactSpinnerGroup.offsetGroup = TH_offsetGroup.TH_DeepCloneShared();
203203
MovementOvershootAssistant.MOA_Renderer.Instance = TH_MOA.TH_DeepCloneShared();
204204
Gameplay.AutoWatchEntity.CoreLogic.WhenWatchedRenderers = TH_WhenWatchedRenderers.TH_DeepCloneShared();
205-
AutoWatchRenderer.EverythingOnClone();
205+
AutoWatchRenderer.EverythingOnClone();
206+
SpinnerCalculateHelper.GroupCounter = CycleHitboxColor.GroupCounter;
206207
};
207208
Action clear = () => {
208209
TH_CachedNodes = null;
@@ -249,6 +250,7 @@ public static SRT CreateSRT() {
249250
Gameplay.AutoWatchEntity.CoreLogic.WhenWatchedRenderers = SRT_WhenWatchedRenderers.DeepCloneShared();
250251

251252
AutoWatchRenderer.EverythingOnClone();
253+
SpinnerCalculateHelper.GroupCounter = CycleHitboxColor.GroupCounter;
252254

253255
PredictorCore.delayedClearFutures = true;
254256
PredictorCore.HasCachedFutures = false;

Source/Utils/HookHelper.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ internal static class _Scene {
105105
public static event UpdateHandler AfterUpdate;
106106

107107
[EventOnHook]
108-
private static void CreateOnHook() {
109-
On.Monocle.Scene.BeforeUpdate += OnBeforeUpdate;
108+
private static void CreateOnHook() {
109+
// pre spinner calc needs this to be after tas
110+
using (new DetourContext { After = new List<string> { "CelesteTAS-EverestInterop" }, ID = "TAS Helper Scene.BeforeUpdate" }) {
111+
On.Monocle.Scene.BeforeUpdate += OnBeforeUpdate;
112+
}
110113

111114
using (new DetourContext { Before = new List<string> { "CelesteTAS-EverestInterop" }, ID = "TAS Helper Scene.AfterUpdate" }) {
112115
On.Monocle.Scene.AfterUpdate += OnAfterUpdate;

everest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- Name: TASHelper
2-
Version: 2.1.3
2+
Version: 2.1.4
33
DLL: bin/Release/net7.0/TASHelper.dll
44
Dependencies:
55
- Name: EverestCore

0 commit comments

Comments
 (0)