Skip to content

Commit 5740798

Browse files
committed
bugfix: predictor PreventSendStateToStudio not working properly
1 parent 5a1137e commit 5740798

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

Source/Module/WhatsNew.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public static void CreateUpdateLog() {
9191
AddLog("2.1.3", "Bugfix: Incompatibility with MotionSmoothing in event ch09_goto_the_future. (thanks @cameryn)");
9292
AddLog("2.1.4", "Bugfix: Fastforward makes spinner colors change. (thanks @trans_alexa)");
9393
AddLog("2.1.5", "Bugfix: fix a bug caused by CelesteTAS refactor.");
94+
AddLog("2.1.6", "Bugfix: When predictor Update-on-Tas-File-Changed enabled, and edit a line above the current frame, it'll move selection to the current frame. (thanks @richconnergmn)");
9495
UpdateLogs.Sort((x, y) => new Version(y.Item1).CompareTo(new Version(x.Item1)));
9596
}
9697

Source/Predictor/PredictorCore.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ public static void Initialize() {
182182
if (StrictFrameStep && TasHelperSettings.PredictOnFrameStep && Engine.Scene is Level) {
183183
Predict(TasHelperSettings.TimelineLength + CacheFuturePeriod, false);
184184
}
185-
ClearPreventSendStateToStudio();
186185
});
187186

188187
typeof(Level).GetMethod("BeforeRender").HookBefore(DelayedActions);
@@ -308,18 +307,20 @@ private static void DelayedClearState() {
308307
}
309308
}
310309
private static void DelayedPredict() {
311-
if (hasDelayedPredict && !InPredict) {
310+
if (hasDelayedPredict && !InPredict) {
311+
preventSendStateToStudio = true;
312312
RefreshInputs();
313313
GameInfo.Update();
314314
Predict(TasHelperSettings.TimelineLength + CacheFuturePeriod, delayedMustRedo);
315-
hasDelayedPredict = false;
315+
hasDelayedPredict = false;
316+
preventSendStateToStudio = false;
316317
}
317318
// we shouldn't do this in half of the render process
318319

319-
void RefreshInputs() {
320+
void RefreshInputs() {
321+
320322
InputController c = Manager.Controller;
321323
c.NeedsReload = true;
322-
preventSendStateToStudio = true;
323324

324325
int lastChecksum = c.Checksum;
325326
bool firstRun = c.UsedFiles.IsEmpty();
@@ -347,7 +348,8 @@ void RefreshInputs() {
347348
c.Clear();
348349
}
349350

350-
c.CurrentFrameInTas = Math.Min(c.Inputs.Count, c.CurrentFrameInTas);
351+
c.CurrentFrameInTas = Math.Min(c.Inputs.Count, c.CurrentFrameInTas);
352+
351353
}
352354
}
353355

@@ -359,12 +361,6 @@ private static bool preventSendStateToStudio {
359361
}
360362

361363

362-
[EnableRun]
363-
[DisableRun]
364-
private static void ClearPreventSendStateToStudio() {
365-
preventSendStateToStudio = false;
366-
}
367-
368364
public static bool SkipPredictCheck() {
369365
foreach (Func<bool> check in SkipPredictChecks) {
370366
if (check()) {

0 commit comments

Comments
 (0)