mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Fix exit to world map edge cases (Adventure) (#7522)
* Fixing an issue in which touching the space the map occupies outside of the world map does not allow the player to move (very relevant on maps with content in the top left corner) * Attempt to band-aid two problems relating to showing a dialog to return to the main map, one in which some patrolling enemies ignore the menu restriction and another in which such enemies touching a player who is transitioning out of a dungeon causing a soft lock upon returning to the map
This commit is contained in:
@@ -155,7 +155,7 @@ public class TileMapScene extends HudScene {
|
||||
|
||||
@Override
|
||||
public boolean isInHudOnlyMode() {
|
||||
return MapStage.getInstance().getDialogOnlyInput();
|
||||
return MapStage.getInstance().isDialogOnlyInput();
|
||||
}
|
||||
|
||||
public void loadNext(String targetMap, int entryTargetObject) {
|
||||
|
||||
@@ -313,7 +313,7 @@ public class GameHUD extends Stage {
|
||||
return true;
|
||||
}
|
||||
//auto follow touchpad
|
||||
if (GuiBase.isAndroid() && !MapStage.getInstance().getDialogOnlyInput() && !console.isVisible()) {
|
||||
if (GuiBase.isAndroid() && !MapStage.getInstance().isDialogOnlyInput() && !console.isVisible()) {
|
||||
if (!(Controls.actorContainsVector(avatar, touch)) // not inside avatar bounds
|
||||
&& !(Controls.actorContainsVector(miniMap, touch)) // not inside map bounds
|
||||
&& !(Controls.actorContainsVector(gamehud, touch)) //not inside gamehud bounds
|
||||
@@ -687,6 +687,7 @@ public class GameHUD extends Stage {
|
||||
}
|
||||
|
||||
private void exitDungeonCallback() {
|
||||
MapStage.getInstance().onBeginLeavingDungeon();
|
||||
hideDialog(true);
|
||||
}
|
||||
|
||||
@@ -874,6 +875,8 @@ public class GameHUD extends Stage {
|
||||
dialog.show(this, Actions.show());
|
||||
dialog.setPosition((this.getWidth() - dialog.getWidth()) / 2, (this.getHeight() - dialog.getHeight()) / 2);
|
||||
dialogOnlyInput = true;
|
||||
gameStage.hudIsShowingDialog(true);
|
||||
MapStage.getInstance().hudIsShowingDialog(true);
|
||||
if (Forge.hasGamepad() && !dialogButtonMap.isEmpty())
|
||||
this.setKeyboardFocus(dialogButtonMap.first());
|
||||
}
|
||||
@@ -891,7 +894,10 @@ public class GameHUD extends Stage {
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
|
||||
dialogOnlyInput = false;
|
||||
gameStage.hudIsShowingDialog(false);
|
||||
MapStage.getInstance().hudIsShowingDialog(false);
|
||||
}
|
||||
|
||||
private void selectNextDialogButton() {
|
||||
|
||||
@@ -85,10 +85,6 @@ public abstract class GameStage extends Stage {
|
||||
protected final Array<TextraButton> dialogButtonMap = new Array<>();
|
||||
TextraButton selectedKey;
|
||||
|
||||
public boolean getDialogOnlyInput() {
|
||||
return dialogOnlyInput;
|
||||
}
|
||||
|
||||
public Dialog getDialog() {
|
||||
return dialog;
|
||||
}
|
||||
@@ -113,6 +109,7 @@ public abstract class GameStage extends Stage {
|
||||
dialog.show(dialogStage, Actions.show());
|
||||
dialog.setPosition((dialogStage.getWidth() - dialog.getWidth()) / 2, (dialogStage.getHeight() - dialog.getHeight()) / 2);
|
||||
dialogOnlyInput = true;
|
||||
|
||||
if (Forge.hasGamepad() && !dialogButtonMap.isEmpty())
|
||||
dialogStage.setKeyboardFocus(dialogButtonMap.first());
|
||||
}
|
||||
@@ -124,6 +121,14 @@ public abstract class GameStage extends Stage {
|
||||
dialog.clearListeners();
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when the hud is showing a dialog, which is tracked separately
|
||||
* @param isShowing Whether a dialog is currently showing
|
||||
*/
|
||||
public void hudIsShowingDialog(boolean isShowing) {
|
||||
dialogOnlyInput = isShowing;
|
||||
}
|
||||
|
||||
public void effectDialog(EffectData effectData) {
|
||||
dialog.getButtonTable().clear();
|
||||
dialog.getContentTable().clear();
|
||||
|
||||
@@ -61,6 +61,7 @@ public class MapStage extends GameStage {
|
||||
private EnemySprite currentMob;
|
||||
Queue<Vector2> positions = new LinkedList<>();
|
||||
private boolean isLoadingMatch = false;
|
||||
private boolean isPlayerLeavingDungeon = false;
|
||||
//private HashMap<String, Byte> mapFlags = new HashMap<>(); //Stores local map flags. These aren't available outside this map.
|
||||
|
||||
|
||||
@@ -758,6 +759,8 @@ public class MapStage extends GameStage {
|
||||
if (defeated)
|
||||
WorldStage.getInstance().resetPlayerLocation();
|
||||
Forge.switchScene(GameScene.instance());
|
||||
isPlayerLeavingDungeon = false;
|
||||
dialogOnlyInput = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -934,8 +937,9 @@ public class MapStage extends GameStage {
|
||||
|
||||
@Override
|
||||
protected void onActing(float delta) {
|
||||
if (isPaused() || isDialogOnlyInput() || Forge.advFreezePlayerControls)
|
||||
if (isPaused() || isDialogOnlyInput() || Forge.advFreezePlayerControls || isPlayerLeavingDungeon)
|
||||
return;
|
||||
|
||||
Iterator<EnemySprite> it = enemies.iterator();
|
||||
|
||||
if (freezeAllEnemyBehaviors) {
|
||||
@@ -1110,6 +1114,10 @@ public class MapStage extends GameStage {
|
||||
return isInMap;
|
||||
}
|
||||
|
||||
public void onBeginLeavingDungeon() {
|
||||
isPlayerLeavingDungeon = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showDialog() {
|
||||
if (dialogStage == null){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package forge.adventure.util;
|
||||
|
||||
/**
|
||||
* Interface to save the content the the save game file
|
||||
* Interface to save the content of the save game file
|
||||
*/
|
||||
public interface SaveFileContent {
|
||||
void load(SaveFileData data);
|
||||
|
||||
Reference in New Issue
Block a user