Skip to content

Commit aa5dc05

Browse files
committed
v1.9.4
MovementOvershootAssistant now supports Inverted Gravity and DreamTunnelDashState
1 parent 76f0373 commit aa5dc05

File tree

5 files changed

+51
-3
lines changed

5 files changed

+51
-3
lines changed

Source/Gameplay/MovementOvershootAssistant.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Celeste.Mod.TASHelper.Module.Menu;
2+
using Celeste.Mod.TASHelper.Utils;
23
using Microsoft.Xna.Framework;
34
using Microsoft.Xna.Framework.Graphics;
45
using Mono.Cecil.Cil;
@@ -23,6 +24,8 @@ internal static class MovementOvershootAssistant {
2324
// your no_obs_position is what your position will be after MoveH/V(Speed.X/Y * Engine.DeltaTime, onCollideH/V), AS IF onCollideH/V is null.
2425
// Movements after this are not considered (e.g. player collider, moving block pushing)
2526

27+
// it behaves similar to ActualCollideHitbox if there's only moving blocks pushing/carrying you, but a bit different if you collide into solids on your own
28+
2629
[Initialize]
2730
private static void Initialize() {
2831
ILHookConfig config = default;
@@ -93,12 +96,12 @@ private static void GetNoObsPosition(Player player) {
9396
if (MOA_Renderer.Instance is not { } renderer) {
9497
return;
9598
}
96-
IsDreamDash = player.StateMachine.State == 9 || player.StateMachine.State == 22;
99+
IsDreamDash = player.StateMachine.State == 9 || player.StateMachine.State == 22 || player.StateMachine.state.IsDreamTunnelDashState();
97100
if (IsDreamDash) {
98101
renderer.Visible = false;
99102
return;
100103
}
101-
NoObsPosition = NaiveMove(player.Position, player.movementCounter, player.Speed * Engine.DeltaTime);
104+
NoObsPosition = NaiveMove(player.Position, player.movementCounter, player.Speed.GetGravityAffectedVector2() * Engine.DeltaTime);
102105
renderer.unselectableCollider = player.Collider.Clone();
103106
renderer.Position = NoObsPosition;
104107
}

Source/Module/WhatsNew.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static void CreateUpdateLog() {
5858
AddLog("1.9.1", "Rename some internal class names to resolve some custom info issues.");
5959
AddLog("1.9.2", "Bugfix: Predictor doesn't work properly when encountering Strawberry Jam Wonky Cassette Blocks.");
6060
AddLog("1.9.3", "Bugfix: Predictor makes BGSwitch related tas desync.", "Feature: Predictor now supports most common commands. (\"Set\", \"Invoke\", \"Console\", \"Mouse\", \"Press\", \"Gun\", \"EvalLua\")");
61+
AddLog("1.9.4", "MovementOvershootAssistant now supports Inverted Gravity and DreamTunnelDashState.");
6162
UpdateLogs.Sort((x, y) => new Version(y.Item1).CompareTo(new Version(x.Item1)));
6263
}
6364

Source/Utils/HookHelper.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ private static void CreateOnHook() {
131131
private static void Unload() {
132132
On.Monocle.Scene.BeforeUpdate -= OnBeforeUpdate;
133133
On.Monocle.Scene.AfterUpdate -= OnAfterUpdate;
134+
BeforeUpdate = AfterUpdate = null;
134135
}
135136

136137
private static void OnBeforeUpdate(On.Monocle.Scene.orig_BeforeUpdate orig, Monocle.Scene self) {
@@ -172,6 +173,10 @@ internal static class _Level {
172173

173174
[Initialize]
174175
private static void Initialize() {
176+
LoadLevel = LoadLevel_Before = null;
177+
LoadLevel_Parameter0 = LoadLevel_Before_Parameter0 = null;
178+
LoadLevel_Parameter1 = LoadLevel_Before_Parameter1 = null;
179+
LoadLevel_Parameter2 = LoadLevel_Before_Parameter2 = null;
175180
foreach (MethodInfo method in typeof(AttributeUtils).Assembly.GetTypesSafe().SelectMany(type => type
176181
.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))) {
177182
if (method.GetCustomAttribute<LoadLevelAttribute>() is not LoadLevelAttribute attr) {
@@ -282,6 +287,9 @@ internal static class _EntityList {
282287

283288
[Initialize]
284289
private static void Initialize() {
290+
DebugRender = null;
291+
DebugRender_Parameter0 = null;
292+
DebugRender_Parameter1 = null;
285293
foreach (MethodInfo method in typeof(AttributeUtils).Assembly.GetTypesSafe().SelectMany(type => type
286294
.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)).Where(method => method.GetCustomAttribute<AddDebugRenderAttribute>() is { })) {
287295
switch (method.GetParameters().Length) {

Source/Utils/ModImports.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Microsoft.Xna.Framework;
2+
using MonoMod.ModInterop;
3+
4+
namespace Celeste.Mod.TASHelper.Utils;
5+
6+
public static class ModImports {
7+
public static bool IsPlayerInverted => GravityHelperImport.IsPlayerInverted?.Invoke() ?? false;
8+
9+
public static Vector2 GetGravityAffectedVector2(this Vector2 vec) {
10+
if (IsPlayerInverted) {
11+
return new Vector2(vec.X, -vec.Y);
12+
}
13+
return vec;
14+
}
15+
16+
public static bool IsDreamTunnelDashState(this int state) => CommunalHelperDashStates.GetDreamTunnelDashState?.Invoke() == state;
17+
18+
[Initialize]
19+
private static void Initialize() {
20+
typeof(GravityHelperImport).ModInterop();
21+
typeof(CommunalHelperDashStates).ModInterop();
22+
}
23+
}
24+
25+
26+
[ModImportName("GravityHelper")]
27+
internal static class GravityHelperImport {
28+
public static Func<bool> IsPlayerInverted;
29+
}
30+
31+
[ModImportName("CommunalHelper.DashStates")]
32+
public static class CommunalHelperDashStates {
33+
public static Func<int> GetDreamTunnelDashState;
34+
35+
public static Func<int> HasDreamTunnelDash;
36+
}

everest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- Name: TASHelper
2-
Version: 1.9.3
2+
Version: 1.9.4
33
DLL: bin/Release/net4.5.2/TASHelper.dll
44
Dependencies:
55
- Name: Everest

0 commit comments

Comments
 (0)