-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from Skrelpoid/develop
Develop
- Loading branch information
Showing
7 changed files
with
98 additions
and
15 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/skrelpoid/superfastmode/patches/MathHelperPatches.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package skrelpoid.superfastmode.patches; | ||
|
||
import com.evacipated.cardcrawl.modthespire.lib.ByRef; | ||
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch; | ||
|
||
import skrelpoid.superfastmode.SuperFastMode; | ||
|
||
// The methods patched here normally return a value between start and target. | ||
// If start == target, these methods all return target. This makes many things instant | ||
// E.G. Cards that animate from your deck to your hand will be instantly in | ||
// your hand because currentX will be set to targetX instantly | ||
public class MathHelperPatches { | ||
|
||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "mouseLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "cardLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "cardScaleLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "uiLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "orbLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "scaleLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "fadeLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "popLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "angleLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "slowColorLerpSnap") | ||
@SpirePatch(clz = com.megacrit.cardcrawl.helpers.MathHelper.class, method = "scrollSnapLerpSpeed") | ||
public static class InstantLerp { | ||
public static void Prefix(@ByRef float[] start, float target) { | ||
SuperFastMode.instantLerp(start, target); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/skrelpoid/superfastmode/patches/MathUtilsPatches.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package skrelpoid.superfastmode.patches; | ||
|
||
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch; | ||
|
||
import skrelpoid.superfastmode.SuperFastMode; | ||
|
||
public class MathUtilsPatches { | ||
|
||
// I do not know why this is not the way this method works by default | ||
// Fixes pretty much everything that uses this method | ||
@SpirePatch(clz = com.badlogic.gdx.math.MathUtils.class, method = "lerp") | ||
public static class LerpPatch { | ||
public static float Replace(float fromValue, float toValue, float progress) { | ||
float result = lerp(fromValue, toValue, progress); | ||
// result should never be higher than toValue | ||
if (SuperFastMode.isInstantLerp) { | ||
result = toValue; | ||
} | ||
return result; | ||
} | ||
} | ||
|
||
public static float lerp(float from, float to, float progress) { | ||
return from + (to - from) * progress; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters