Fix the mouse events so they are passed to cheat listeners, fixed PoP teleport cheat

This commit is contained in:
Brendan Robert 2024-03-08 17:41:05 -06:00
parent 25c6cfedf4
commit 264f317c90
2 changed files with 8 additions and 4 deletions

View File

@ -109,7 +109,7 @@ public class JaceUIController {
controlOverlay.setVisible(false);
menuButtonPane.setVisible(false);
controlOverlay.setFocusTraversable(false);
menuButtonPane.setFocusTraversable(false);
menuButtonPane.setFocusTraversable(true);
NumberBinding aspectCorrectedWidth = rootPane.heightProperty().multiply(3.0).divide(2.0);
NumberBinding width = new When(
aspectRatioCorrectionEnabled.and(aspectCorrectedWidth.lessThan(rootPane.widthProperty()))
@ -122,7 +122,9 @@ public class JaceUIController {
rootPane.setBackground(new Background(new BackgroundFill(Color.BLACK, null, null)));
rootPane.setOnMouseMoved(this::showMenuButton);
rootPane.setOnMouseExited(this::hideControlOverlay);
rootPane.setOnMouseClicked((evt)->rootPane.requestFocus());
rootPane.setOnMouseClicked((evt)->{
rootPane.requestFocus();
});
menuButton.setOnMouseClicked(this::showControlOverlay);
controlOverlay.setOnMouseClicked(this::hideControlOverlay);
delayTimer.getKeyFrames().add(new KeyFrame(Duration.millis(3000), evt -> {
@ -454,10 +456,12 @@ public class JaceUIController {
public void addMouseListener(EventHandler<MouseEvent> handler) {
appleScreen.addEventHandler(MouseEvent.ANY, handler);
rootPane.addEventHandler(MouseEvent.ANY, handler);
}
public void removeMouseListener(EventHandler<MouseEvent> handler) {
appleScreen.removeEventHandler(MouseEvent.ANY, handler);
rootPane.removeEventHandler(MouseEvent.ANY, handler);
}
Label currentNotification = null;

View File

@ -147,7 +147,7 @@ public class PrinceOfPersiaCheats extends Cheats {
Node source = (Node) event.getSource();
mouseX = event.getSceneX() / source.getBoundsInLocal().getWidth();
mouseY = event.getSceneY() / source.getBoundsInLocal().getHeight();
if (event.isPrimaryButtonDown()) {
if (event.isPrimaryButtonDown() || event.isSecondaryButtonDown()) {
mouseClicked(event.getButton());
}
};
@ -254,7 +254,7 @@ public class PrinceOfPersiaCheats extends Cheats {
byte warpX = (byte) (x * 140 + 58);
// This aliases the Y coordinate so the prince is on the floor at the correct spot.
byte warpY = (byte) ((row * 63) + 54);
// System.out.println("Warping to " + warpX + "," + warpY);
// System.out.println("Warping to " + warpX + "," + warpY);
auxMem.writeByte(KidX, warpX);
auxMem.writeByte(KidY, warpY);
auxMem.writeByte(KidBlockX, (byte) col);