diff --git a/.gitignore b/.gitignore index fdf50675..bfd9e992 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ mg # Skip build directories **/build/ -/OutlawEditor/target/ +**/target/ /Platform/Apple/tools/*/nbproject/private/ /Platform/Apple/tools/*/dist/ diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/apple/AppleTileEditor.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/apple/AppleTileEditor.java index b55ba239..0495fdb0 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/apple/AppleTileEditor.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/apple/AppleTileEditor.java @@ -1,10 +1,10 @@ /* - * Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1 + * Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1 * (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at . - * Unless required by applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF - * ANY KIND, either express or implied. See the License for the specific language + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ package org.badvision.outlaweditor.apple; @@ -22,8 +22,8 @@ import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.shape.Shape; -import org.badvision.outlaweditor.api.Platform; import org.badvision.outlaweditor.TileEditor; +import org.badvision.outlaweditor.api.Platform; import org.badvision.outlaweditor.data.DataUtilities; import org.badvision.outlaweditor.data.TileUtils; import org.badvision.outlaweditor.data.xml.Tile; @@ -80,6 +80,9 @@ public class AppleTileEditor extends TileEditor { if (lastSelectedPattern != null) { changeCurrentPattern(lastSelectedPattern); } + if (lastDrawMode != null) { + setDrawMode(lastDrawMode); + } } @Override @@ -156,9 +159,11 @@ public class AppleTileEditor extends TileEditor { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } + static DrawMode lastDrawMode = null; @Override public void setDrawMode(DrawMode drawMode) { this.drawMode = drawMode; + lastDrawMode = drawMode; lastActionX = -1; lastActionY = -1; } diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/SheetEditorController.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/SheetEditorController.java index f023f9e1..58f57da3 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/SheetEditorController.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/SheetEditorController.java @@ -18,11 +18,7 @@ import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; import javafx.scene.control.TextField; -import org.badvision.outlaweditor.data.xml.Rows.Row; -import org.badvision.outlaweditor.data.xml.UserType; import org.controlsfx.control.spreadsheet.SpreadsheetColumn; import org.controlsfx.control.spreadsheet.SpreadsheetView; @@ -38,22 +34,22 @@ public abstract class SheetEditorController implements Initializable { @FXML protected SpreadsheetColumn addColumn; - + @FXML protected SpreadsheetView table; @FXML protected TextField sheetNameField; - + @FXML abstract public void addColumnAction(ActionEvent event); @FXML abstract public void addRowAction(ActionEvent event); - + @FXML abstract public void doImport(ActionEvent event); - + @FXML protected void initialize() { assert addColumn != null : "fx:id=\"addColumn\" was not injected: check your FXML file 'SheetEditor.fxml'."; diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/SheetEditorControllerImpl.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/SheetEditorControllerImpl.java index f0148a7d..74931eaa 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/SheetEditorControllerImpl.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/SheetEditorControllerImpl.java @@ -51,8 +51,14 @@ public class SheetEditorControllerImpl extends SheetEditorController { private SheetEditor editor; private ObservableList> tableData; - private int lastEditRow = 0; - private int lastEditCol = 0; + + private static Object getCellFromRow(ObservableList row, int sortCol) { + if (row.size() > sortCol) { + return row.get(sortCol).getItem(); + } else { + return null; + } + } /** * Initializes the controller class. @@ -66,9 +72,13 @@ public class SheetEditorControllerImpl extends SheetEditorController { createMenuItem("Insert Row", () -> insertRow(new Row(), getSelectedRow())), createMenuItem("Clone Row", () -> cloneRow(editor.getSheet().getRows().getRow().get(getSelectedRow()))), createMenuItem("Delete Row", () -> deleteRowWithConfirmation(editor.getSheet().getRows().getRow().get(getSelectedRow()))), - createMenuItem("Sort by", () -> { + createMenuItem("Sort ascending", () -> { int sortCol = table.getSelectionModel().getFocusedCell().getColumn(); - table.setComparator((a,b)->compare(a.get(sortCol).getItem(), b.get(sortCol).getItem())); + table.setComparator((a,b)->compare(getCellFromRow(a, sortCol), getCellFromRow(b, sortCol))); + }), + createMenuItem("Sort descending", () -> { + int sortCol = table.getSelectionModel().getFocusedCell().getColumn(); + table.setComparator((a,b)->compare(getCellFromRow(b, sortCol), getCellFromRow(a, sortCol))); }) ); } diff --git a/Platform/Apple/tools/jace/.gitignore b/Platform/Apple/tools/jace/.gitignore new file mode 100644 index 00000000..2f8180d0 --- /dev/null +++ b/Platform/Apple/tools/jace/.gitignore @@ -0,0 +1,6 @@ +/.settings/* +/target/ +/target/* +/.jace.conf +*.classpath +*.project diff --git a/Platform/Apple/tools/jace/src/main/java/jace/LawlessLegends.java b/Platform/Apple/tools/jace/src/main/java/jace/LawlessLegends.java index cd2726ce..825d7ee9 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/LawlessLegends.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/LawlessLegends.java @@ -67,12 +67,12 @@ public class LawlessLegends extends Application { primaryStage.show(); new Thread(() -> { new Emulator(getParameters().getRaw()); + configureEmulatorForGame(); reconnectUIHooks(); EmulatorUILogic.scaleIntegerRatio(); while (Emulator.computer.getVideo() == null || Emulator.computer.getVideo().getFrameBuffer() == null) { Thread.yield(); } - configureEmulatorForGame(); bootWatchdog(); }).start(); primaryStage.setOnCloseRequest(event -> { @@ -81,9 +81,9 @@ public class LawlessLegends extends Application { System.exit(0); }); } - + public void reconnectUIHooks() { - controller.connectComputer(Emulator.computer, primaryStage); + controller.connectComputer(Emulator.computer, primaryStage); } public static LawlessLegends getApplication() { diff --git a/Platform/Apple/tools/jace/src/main/java/jace/core/SoundGeneratorDevice.java b/Platform/Apple/tools/jace/src/main/java/jace/core/SoundGeneratorDevice.java index a6206666..992c5141 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/core/SoundGeneratorDevice.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/core/SoundGeneratorDevice.java @@ -25,7 +25,6 @@ public abstract class SoundGeneratorDevice extends Device { @Override public void reconfigure() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override diff --git a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessHacks.java b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessHacks.java index 1fdfe2da..75ab1752 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessHacks.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessHacks.java @@ -12,12 +12,17 @@ public class LawlessHacks extends Cheats { // Modes specified by the game engine int MODE_SOFTSWITCH = 0x0C020; - - + + public LawlessHacks(Computer computer) { super(computer); } + @Override + public void toggleCheats() { + // Do nothing -- you cannot toggle this once it's active. + } + @Override public void registerListeners() { // Observe graphics changes diff --git a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessVideo.java b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessVideo.java index 8c4f0b8c..9b8c4c35 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessVideo.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessVideo.java @@ -16,12 +16,12 @@ public class LawlessVideo extends VideoNTSC { private static RenderEngine activeEngine = RenderEngine.UNKNOWN; private boolean titleScreen = true; private boolean[][] activeMask = new boolean[192][80]; - - + + public static enum RenderEngine { FULL_COLOR, FULL_TEXT(new int[]{ - 2, 6, 78, 186 + 2, 6, 78, 186 }), _2D(new int[]{ 9, 8, 34, 17, @@ -31,15 +31,19 @@ public class LawlessVideo extends VideoNTSC { _3D(new int[]{ 9, 8, 34, 17, 44, 24, 76, 136, - 44, 143, 76, 184, + 44, 143, 76, 183, 8, 172, 14, 182,}), MAP(new int[]{ 2, 6, 78, 11, 2, 11, 4, 186, - 76, 11, 78, 186, + 76, 11, 78, 186, 2, 182, 78, 186, 28, 3, 52, 6 - }), + }), + STORYBOOK(new int[]{ + 0, 0, 39, 191, + 39, 130, 78, 191 + }), UNKNOWN; boolean[][] colorMask; @@ -81,7 +85,7 @@ public class LawlessVideo extends VideoNTSC { Emulator.computer.onNextVBL(() -> Emulator.computer.getVideo().forceRefresh()); System.out.println("Detected engine: " + e.name()); } else { - System.out.println("Detected engine same as before: " + e.name()); + System.out.println("Detected engine same as before: " + e.name()); } }