Skip to content

Commit

Permalink
Merge pull request #27 from Skrelpoid/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Skrelpoid authored Jan 2, 2019
2 parents 3525257 + 3babd96 commit ef32f78
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 98 deletions.
14 changes: 0 additions & 14 deletions src/main/java/skrelpoid/superfastmode/SuperFastMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

import java.io.IOException;
import java.lang.reflect.Field;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics;
import com.badlogic.gdx.backends.lwjgl.LwjglGraphics;
import com.badlogic.gdx.graphics.Color;
import com.evacipated.cardcrawl.modthespire.lib.SpireConfig;
import com.evacipated.cardcrawl.modthespire.lib.SpireInitializer;
import com.megacrit.cardcrawl.vfx.AbstractGameEffect;

import basemod.BaseMod;
import basemod.ReflectionHacks;

Expand All @@ -29,11 +26,8 @@ public class SuperFastMode {
public static float deltaMultiplier = 2;
public static Field deltaField;
public static boolean isDeltaMultiplied = true;
public static boolean isInstantLerp = true;
public static SpireConfig config;

// TODO UI rendering should not be affected by multiplied delta. WIP

public static void initialize() {
logger.info("Initializing SuperFastMode");
BaseMod.subscribe(new UIManager());
Expand Down Expand Up @@ -64,13 +58,11 @@ private static void initConfig() {

private static void loadConfig() {
isDeltaMultiplied = config.getBool("isDeltaMultiplied");
isInstantLerp = config.getBool("isInstantLerp");
deltaMultiplier = config.getFloat("deltaMultiplier");
}

public static void writeConfig() {
config.setBool("isDeltaMultiplied", isDeltaMultiplied);
config.setBool("isInstantLerp", isInstantLerp);
config.setFloat("deltaMultiplier", deltaMultiplier);
}

Expand Down Expand Up @@ -107,12 +99,6 @@ public static float getDelta() {
return getDelta(Gdx.graphics);
}

public static void instantLerp(float[] start, float target) {
if (isInstantLerp) {
start[0] = target;
}
}

public static void updateVFX(AbstractGameEffect effect) {
// Copied from AbstractGameEffect.update()
effect.duration -= getDelta();
Expand Down
24 changes: 0 additions & 24 deletions src/main/java/skrelpoid/superfastmode/UIManager.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package skrelpoid.superfastmode;

import java.io.IOException;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.megacrit.cardcrawl.helpers.FontHelper;

import basemod.BaseMod;
import basemod.ModLabel;
import basemod.ModLabeledToggleButton;
Expand Down Expand Up @@ -40,9 +38,7 @@ public void receivePostInitialize() {
public static void buildUI() {
panel = new ModPanel();
panel.addUIElement(deltaToggle());
panel.addUIElement(skipToggle());
panel.addUIElement(deltaSlider());
panel.addUIElement(skipInfo());
panel.addUIElement(deltaInfo());
panel.addUIElement(speedInfo());
panel.addUIElement(progress());
Expand All @@ -64,19 +60,6 @@ private static void updateDeltaToggle(ModToggleButton b) {
speedUpdated = true;
}

private static ModLabeledToggleButton skipToggle() {
final float x = 350;
final float y = 590;
return new ModLabeledToggleButton("Make some Actions instant", x, y, Color.WHITE, FontHelper.tipBodyFont,
SuperFastMode.isInstantLerp, panel, l -> {}, UIManager::updateSkipToggle);
}

private static void updateSkipToggle(ModToggleButton b) {
SuperFastMode.isInstantLerp = b.enabled;
SuperFastMode.logger.info("Toggling skip actions (lerp) to " + b.enabled);
speedUpdated = true;
}

private static ModSlider deltaSlider() {
final float x = 1250;
final float y = 480;
Expand All @@ -92,13 +75,6 @@ private static void updateDeltaSlider(ModSlider s) {
speedUpdated = true;
}

private static ModLabel skipInfo() {
final float x = 350;
final float y = 650;
return new ModLabel("Recommended. If this is turned off,\nthe GUI might glitch out a bit.", x, y,
FontHelper.tipBodyFont, panel, l -> {});
}

private static ModLabel deltaInfo() {
final float x = 350;
final float y = 510;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,40 @@

import com.evacipated.cardcrawl.modthespire.lib.SpireInsertPatch;
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
import com.megacrit.cardcrawl.blights.AbstractBlight;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.monsters.AbstractMonster.Intent;
import com.megacrit.cardcrawl.powers.AbstractPower;
import com.megacrit.cardcrawl.scenes.AbstractScene;
import com.megacrit.cardcrawl.ui.DialogWord;
import com.megacrit.cardcrawl.ui.buttons.CardSelectConfirmButton;
import com.megacrit.cardcrawl.ui.buttons.SingingBowlButton;
import com.megacrit.cardcrawl.ui.buttons.SkipCardButton;
import com.megacrit.cardcrawl.ui.panels.BottomBgPanel;
import com.megacrit.cardcrawl.ui.panels.DiscardPilePanel;
import com.megacrit.cardcrawl.ui.panels.DrawPilePanel;
import com.megacrit.cardcrawl.vfx.EnemyTurnEffect;
import com.megacrit.cardcrawl.vfx.FlashPotionEffect;
import com.megacrit.cardcrawl.vfx.GainPennyEffect;
import com.megacrit.cardcrawl.vfx.GameDeckGlowEffect;
import com.megacrit.cardcrawl.vfx.PlayerTurnEffect;
import com.megacrit.cardcrawl.vfx.RoomShineEffect;
import com.megacrit.cardcrawl.vfx.RoomShineEffect2;
import com.megacrit.cardcrawl.vfx.TextAboveCreatureEffect;
import com.megacrit.cardcrawl.vfx.cardManip.CardGlowBorder;
import com.megacrit.cardcrawl.vfx.combat.BattleStartEffect;

import com.megacrit.cardcrawl.vfx.combat.BlockedNumberEffect;
import com.megacrit.cardcrawl.vfx.combat.FlashAtkImgEffect;
import com.megacrit.cardcrawl.vfx.combat.FlashIntentEffect;
import com.megacrit.cardcrawl.vfx.combat.FrostOrbPassiveEffect;
import com.megacrit.cardcrawl.vfx.combat.HealNumberEffect;
import com.megacrit.cardcrawl.vfx.combat.PowerBuffEffect;
import com.megacrit.cardcrawl.vfx.combat.PowerDebuffEffect;
import com.megacrit.cardcrawl.vfx.combat.PowerIconShowEffect;
import com.megacrit.cardcrawl.vfx.scene.BottomFogEffect;
import javassist.CannotCompileException;
import javassist.expr.ExprEditor;
import javassist.expr.MethodCall;
Expand All @@ -16,12 +45,18 @@
public class DefaultDeltaPatches {
// @formatter:off

@SpirePatch(clz = CardCrawlGame.class, method = "updateFade")
// Makes time not increase by multiplier.
@SpirePatch(clz = com.megacrit.cardcrawl.dungeons.AbstractDungeon.class, method = "update")
// Fixes mouse events not registering on map and flickering "Select a Starting Room"
@SpirePatch(clz = com.megacrit.cardcrawl.screens.DungeonMapScreen.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.screens.DungeonMapScreen.class, method = "updateAnimation")
@SpirePatch(clz = com.megacrit.cardcrawl.screens.DungeonMapScreen.class, method = "updateMouse")
@SpirePatch(clz = com.megacrit.cardcrawl.screens.DungeonMapScreen.class, method = "oscillateColor")
// Display SpeechBubbles long enough to read
@SpirePatch(clz = DialogWord.class, method = "update")
@SpirePatch(clz = DialogWord.class, method = "applyEffects")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.SpeechWord.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.SpeechWord.class, method = "applyEffects")
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.SpeechBubble.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.SpeechBubble.class, method = "updateScale")
Expand All @@ -36,12 +71,20 @@ public class DefaultDeltaPatches {
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.MegaSpeechBubble.class, method = "updateScale")
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.MegaDialogTextEffect.class, method = "update")
// Next prevent some flickering and make UI independent from multiplied delta
@SpirePatch(clz = CardSelectConfirmButton.class, method = "update")
@SpirePatch(clz = SingingBowlButton.class, method = "update")
@SpirePatch(clz = SkipCardButton.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.DynamicBanner.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.TintEffect.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.CancelButton.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.CancelButton.class, method = "updateGlow")
@SpirePatch(clz = com.megacrit.cardcrawl.screens.mainMenu.MenuCancelButton.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.screens.mainMenu.MenuCancelButton.class, method = "updateGlow")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.ConfirmButton.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.ConfirmButton.class, method = "updateGlow")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.EndTurnButton.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.EndTurnButton.class, method = "glow")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.GridSelectConfirmButton.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.GridSelectConfirmButton.class, method = "updateGlow")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.buttons.ProceedButton.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.map.MapRoomNode.class, method = "oscillateColor")
Expand All @@ -56,6 +99,10 @@ public class DefaultDeltaPatches {
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.GameDeckGlowEffect.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.ui.panels.DrawPilePanel.class, method = "updatePositions")
@SpirePatch(clz = com.megacrit.cardcrawl.cards.AbstractCard.class, method = "updateGlow")
@SpirePatch(clz = com.megacrit.cardcrawl.cards.AbstractCard.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.cards.AbstractCard.class, method = "updateHoverLogic")
@SpirePatch(clz = com.megacrit.cardcrawl.cards.AbstractCard.class, method = "updateColor")
@SpirePatch(clz = com.megacrit.cardcrawl.cards.AbstractCard.class, method = "updateTransparency")
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.cardManip.CardGlowBorder.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.rewards.RewardItem.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.RewardGlowEffect.class, method = "update")
Expand Down Expand Up @@ -83,10 +130,12 @@ public class DefaultDeltaPatches {
// Orbs
@SpirePatch(clz = com.megacrit.cardcrawl.orbs.Dark.class, method = "updateAnimation")
@SpirePatch(clz = com.megacrit.cardcrawl.orbs.Frost.class, method = "updateAnimation")
@SpirePatch(clz = FrostOrbPassiveEffect.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.orbs.Lightning.class, method = "updateAnimation")
@SpirePatch(clz = com.megacrit.cardcrawl.orbs.Plasma.class, method = "updateAnimation")
// Relic
@SpirePatch(clz = com.megacrit.cardcrawl.relics.AbstractRelic.class, method = "updateFlash")
@SpirePatch(clz = com.megacrit.cardcrawl.relics.AbstractRelic.class, method = "updateAnimation")
@SpirePatch(clz = com.megacrit.cardcrawl.relics.AbstractRelic.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.FloatyEffect.class, method = "update")
// MainMenuScreen
Expand All @@ -113,6 +162,7 @@ public class DefaultDeltaPatches {
@SpirePatch(clz = com.megacrit.cardcrawl.shop.ShopScreen.class, method = "update")
@SpirePatch(clz = com.megacrit.cardcrawl.shop.ShopScreen.class, method = "updateSpeech")
@SpirePatch(clz = com.megacrit.cardcrawl.shop.ShopScreen.class, method = "updateHand")
@SpirePatch(clz = com.megacrit.cardcrawl.shop.ShopScreen.class, method = "updateRug")
// RestRoom
@SpirePatch(clz = com.megacrit.cardcrawl.rooms.CampfireUI.class, method = "updateFire")
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.campfire.CampfireBurningEffect.class, method = "update")
Expand Down Expand Up @@ -143,6 +193,63 @@ public class DefaultDeltaPatches {
@SpirePatch(clz = com.megacrit.cardcrawl.vfx.DeathScreenFloatyEffect.class, method = "update")
// GridSelectScreen (Tramsform and Upgrade)
@SpirePatch(clz = com.megacrit.cardcrawl.screens.select.GridCardSelectScreen.class, method = "update")
// Math
@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")
// Blights
@SpirePatch(clz = AbstractBlight.class, method = "updateAnimation")
@SpirePatch(clz = AbstractBlight.class, method = "updateFlash")
@SpirePatch(clz = AbstractBlight.class, method = "update")
//BattleStart
@SpirePatch(clz = BattleStartEffect.class, method = "update")
@SpirePatch(clz = BattleStartEffect.class, method = "updateSwords")
// AbstractCreature
@SpirePatch(clz = AbstractCreature.class, method = "updateFastAttackAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateSlowAttackAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateFastShakeAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateShakeAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateHopAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateJumpAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateStaggerAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateHbHoverFade")
@SpirePatch(clz = AbstractCreature.class, method = "updateBlockAnimations")
@SpirePatch(clz = AbstractCreature.class, method = "updateHbPopInAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateHbDamageAnimation")
@SpirePatch(clz = AbstractCreature.class, method = "updateReticle")
// Misc
@SpirePatch(clz = PowerIconShowEffect.class, method = "update")
@SpirePatch(clz = EnemyTurnEffect.class, method = "update")
@SpirePatch(clz = GainPennyEffect.class, method = "update")
@SpirePatch(clz = GameDeckGlowEffect.class, method = "update")
@SpirePatch(clz = PlayerTurnEffect.class, method = "update")
@SpirePatch(clz = RoomShineEffect.class, method = "update")
@SpirePatch(clz = RoomShineEffect2.class, method = "update")
@SpirePatch(clz = AbstractScene.class, method = "updateBgOverlay")
@SpirePatch(clz = AbstractPower.class, method = "updateFontScale")
@SpirePatch(clz = DiscardPilePanel.class, method = "updatePositions")
@SpirePatch(clz = DiscardPilePanel.class, method = "updatePop")
@SpirePatch(clz = DrawPilePanel.class, method = "updatePositions")
@SpirePatch(clz = DrawPilePanel.class, method = "updatePop")
@SpirePatch(clz = PowerBuffEffect.class, method = "update")
@SpirePatch(clz = PowerDebuffEffect.class, method = "update")
@SpirePatch(clz = TextAboveCreatureEffect.class, method = "update")
@SpirePatch(clz = FlashAtkImgEffect.class, method = "update")
@SpirePatch(clz = FlashIntentEffect.class, method = "update")
@SpirePatch(clz = FlashPotionEffect.class, method = "update")
@SpirePatch(clz = BlockedNumberEffect.class, method = "update")
@SpirePatch(clz = BottomFogEffect.class, method = "update")
@SpirePatch(clz = BottomBgPanel.class, method = "updatePositions")
@SpirePatch(clz = CardGlowBorder.class, method = "update")
@SpirePatch(clz = HealNumberEffect.class, method = "update")
public static class DeltaPatch {
public static ExprEditor Instrument() {
return new ExprEditor() {
Expand Down

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/resources/ModTheSpire.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"name": "SuperFastMode",
"author_list": ["Skrelpoid"],
"description": "Artificially speeds up the Game. Ingame, go to Mods>SuperFastMode>Config to change Settings. WARNING: Very high values can cause screen flickering. Be careful if you're photo sensitive!",
"version": "0.9.5",
"sts_version": "10-18-2018",
"mts_version": "3.4.0",
"version": "1.0.1",
"sts_version": "12-20-2018",
"mts_version": "3.6.3",
"dependencies": ["basemod"],
"update_json": "https://api.github.com/repos/Skrelpoid/SuperFastMode/releases/latest"
}

0 comments on commit ef32f78

Please sign in to comment.