Merge branch 'master' of github.com:badvision/lawless-legends

This commit is contained in:
Martin Haye 2020-02-26 08:34:27 -08:00
commit db052ecf44
9 changed files with 56 additions and 31 deletions

2
.gitignore vendored
View File

@ -17,7 +17,7 @@ mg
# Skip build directories
**/build/
/OutlawEditor/target/
**/target/
/Platform/Apple/tools/*/nbproject/private/
/Platform/Apple/tools/*/dist/

View File

@ -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 <http://www.apache.org/licenses/LICENSE-1.1>.
* 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;
}

View File

@ -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'.";

View File

@ -51,8 +51,14 @@ public class SheetEditorControllerImpl extends SheetEditorController {
private SheetEditor editor;
private ObservableList<ObservableList<SpreadsheetCell>> tableData;
private int lastEditRow = 0;
private int lastEditCol = 0;
private static Object getCellFromRow(ObservableList<SpreadsheetCell> 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)));
})
);
}

6
Platform/Apple/tools/jace/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/.settings/*
/target/
/target/*
/.jace.conf
*.classpath
*.project

View File

@ -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() {

View File

@ -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

View File

@ -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

View File

@ -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());
}
}