This commit is contained in:
Martin Haye 2014-06-01 07:22:11 -07:00
commit e07b7ac078
13 changed files with 134 additions and 116 deletions

View File

@ -0,0 +1,66 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.badvision.outlaweditor.ui;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.scene.control.ListCell;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.ComboBoxListCell;
import org.badvision.outlaweditor.data.PropertyHelper;
import org.badvision.outlaweditor.ui.impl.ApplicationUIControllerImpl;
/**
*
* @author blurry
*/
public abstract class EntitySelectorCell<T> extends ComboBoxListCell<T> {
static Map<TextField, Object> lastSelected = new HashMap<>();
TextField nameField;
public EntitySelectorCell(TextField tileNameField) {
super.setPrefWidth(125);
nameField = tileNameField;
}
@Override
public void updateSelected(boolean sel) {
if (sel) {
Object o = lastSelected.get(nameField);
if (o != null && !o.equals(getItem())) {
((ListCell) o).updateSelected(false);
}
textProperty().unbind();
textProperty().bind(nameField.textProperty());
lastSelected.put(nameField, this);
} else {
updateItem(getItem(), false);
}
}
@Override
public void updateItem(T item, boolean empty) {
textProperty().unbind();
super.updateItem(item, empty);
if (item != null && !(item instanceof String)) {
try {
textProperty().bind(PropertyHelper.stringProp(item, "name"));
} catch (NoSuchMethodException ex) {
Logger.getLogger(ApplicationUIControllerImpl.class.getName()).log(Level.SEVERE, null, ex);
}
finishUpdate(item);
} else {
setText(null);
}
}
public void finishUpdate(T item) {
}
}

View File

@ -127,7 +127,7 @@ public abstract class MapEditorTabController {
@FXML
abstract public void scrollMapUp(ActionEvent event);
protected void initalize() {
public void initalize() {
assert mapEditorAnchorPane != null : "fx:id=\"mapEditorAnchorPane\" was not injected: check your FXML file 'mapEditorTab.fxml'.";
assert mapHeightField != null : "fx:id=\"mapHeightField\" was not injected: check your FXML file 'mapEditorTab.fxml'.";
assert mapNameField != null : "fx:id=\"mapNameField\" was not injected: check your FXML file 'mapEditorTab.fxml'.";

View File

@ -85,4 +85,7 @@ public abstract class TileEditorTabController {
abstract public void rebuildTileSelectors();
public void initalize() {
}
}

View File

@ -1,17 +1,9 @@
package org.badvision.outlaweditor.ui.impl;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.Event;
import javafx.scene.control.ListCell;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.ComboBoxListCell;
import javafx.scene.input.DataFormat;
import org.badvision.outlaweditor.Application;
import org.badvision.outlaweditor.Editor;
import static org.badvision.outlaweditor.data.PropertyHelper.*;
import org.badvision.outlaweditor.data.TileUtils;
import org.badvision.outlaweditor.data.TilesetUtils;
import org.badvision.outlaweditor.data.xml.Tile;
@ -34,6 +26,9 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
rebuildTileSelectors();
}
});
tileController.initalize();
mapController.initalize();
imageController.initalize();
}
@Override
@ -127,51 +122,6 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
public static final DataFormat SCRIPT_DATA_FORMAT = new DataFormat("MythosScript");
abstract public static class EntitySelectorCell<T> extends ComboBoxListCell<T> {
static Map<TextField, Object> lastSelected = new HashMap<>();
TextField nameField;
public EntitySelectorCell(TextField tileNameField) {
super.setPrefWidth(125);
nameField = tileNameField;
}
@Override
public void updateSelected(boolean sel) {
if (sel) {
Object o = lastSelected.get(nameField);
if (o != null && !o.equals(getItem())) {
((ListCell) o).updateSelected(false);
}
textProperty().unbind();
textProperty().bind(nameField.textProperty());
lastSelected.put(nameField, this);
} else {
updateItem(getItem(), false);
}
}
@Override
public void updateItem(T item, boolean empty) {
textProperty().unbind();
super.updateItem(item, empty);
if (item != null && !(item instanceof String)) {
try {
textProperty().bind(stringProp(item, "name"));
} catch (NoSuchMethodException ex) {
Logger.getLogger(ApplicationUIControllerImpl.class.getName()).log(Level.SEVERE, null, ex);
}
finishUpdate(item);
} else {
setText(null);
}
}
public void finishUpdate(T item) {
}
};
@Override
public void clearData() {
tileController.setCurrentTile(null);

View File

@ -1,5 +1,6 @@
package org.badvision.outlaweditor.ui.impl;
import org.badvision.outlaweditor.ui.EntitySelectorCell;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
@ -52,7 +53,7 @@ public class ImageEditorTabControllerImpl extends ImageEditorTabController {
imageSelector.setCellFactory(new Callback<ListView<Image>, ListCell<Image>>() {
@Override
public ListCell<Image> call(ListView<Image> param) {
return new ApplicationUIControllerImpl.EntitySelectorCell<Image>(imageNameField) {
return new EntitySelectorCell<Image>(imageNameField) {
@Override
public void finishUpdate(Image item) {
}

View File

@ -1,5 +1,6 @@
package org.badvision.outlaweditor.ui.impl;
import org.badvision.outlaweditor.ui.EntitySelectorCell;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
@ -185,6 +186,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
}
}
@Override
public void completeInflightOperations() {
if (getCurrentEditor() != null) {
getCurrentEditor().getCurrentMap().updateBackingMap();
@ -248,7 +250,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
}
@Override
protected void initalize() {
public void initalize() {
super.initalize();
mapSelect.setButtonCell(new ComboBoxListCell<org.badvision.outlaweditor.data.xml.Map>() {
{
@ -256,7 +258,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
}
@Override
public void updateItem(org.badvision.outlaweditor.data.xml.Map item, boolean empty) {
public void updateItem(Map item, boolean empty) {
textProperty().unbind();
super.updateItem(item, empty);
if (item != null) {
@ -266,13 +268,13 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
}
}
});
mapSelect.setCellFactory(new Callback<ListView<org.badvision.outlaweditor.data.xml.Map>, ListCell<org.badvision.outlaweditor.data.xml.Map>>() {
mapSelect.setCellFactory(new Callback<ListView<Map>, ListCell<Map>>() {
@Override
public ListCell<org.badvision.outlaweditor.data.xml.Map> call(ListView<org.badvision.outlaweditor.data.xml.Map> param) {
return new ApplicationUIControllerImpl.EntitySelectorCell<org.badvision.outlaweditor.data.xml.Map>(mapNameField) {
public ListCell<org.badvision.outlaweditor.data.xml.Map> call(ListView<Map> param) {
return new EntitySelectorCell<Map>(mapNameField) {
@Override
public void finishUpdate(org.badvision.outlaweditor.data.xml.Map item) {
}
public void finishUpdate(Map item) {
}
};
}
});

View File

@ -1,5 +1,6 @@
package org.badvision.outlaweditor.ui.impl;
import org.badvision.outlaweditor.ui.EntitySelectorCell;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -156,7 +157,7 @@ public class TileEditorTabControllerImpl extends TileEditorTabController {
tileSelector.setCellFactory(new Callback<ListView<Tile>, ListCell<Tile>>() {
@Override
public ListCell<Tile> call(ListView<Tile> param) {
return new ApplicationUIControllerImpl.EntitySelectorCell<Tile>(tileNameField) {
return new EntitySelectorCell<Tile>(tileNameField) {
@Override
public void finishUpdate(Tile item) {
setGraphic(new ImageView(TileUtils.getImage(item, Application.currentPlatform)));

View File

@ -5,7 +5,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.web.*?>
<AnchorPane id="AnchorPane" prefHeight="748.0" prefWidth="1024.0" styleClass="mainFxmlClass" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="org.badvision.outlaweditor.MythosScriptEditorController">
<AnchorPane id="AnchorPane" prefHeight="748.0" prefWidth="1024.0" styleClass="mainFxmlClass" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="org.badvision.outlaweditor.ui.MythosScriptEditorController">
<!-- <stylesheets>
<URL value="@/styles/mythosscripteditor.css"/>
</stylesheets>-->

View File

@ -1,19 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="mapsTab" minHeight="0.0" minWidth="0.0" prefHeight="420.0000999999975" prefWidth="677.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.badvision.outlaweditor.ui.impl.MapEditorTabControllerImpl">
<AnchorPane id="mapsTab" minHeight="0.0" minWidth="0.0" prefHeight="480.0" prefWidth="677.0" stylesheets="@styles/applicationui.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.badvision.outlaweditor.ui.impl.MapEditorTabControllerImpl">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<ToolBar prefWidth="677.0">
<items>
<Label text="Map:" />
<ComboBox fx:id="mapSelect" minWidth="125.0" onAction="#onMapSelected"/>
<ComboBox fx:id="mapSelect" minWidth="125.0" onAction="#onMapSelected" />
<Button mnemonicParsing="false" onAction="#onMapCreatePressed" text="Create new" />
<Button mnemonicParsing="false" onAction="#onMapClonePressed" text="Clone" />
<Button mnemonicParsing="false" onAction="#onMapExportPressed" text="Export" />
@ -35,35 +33,35 @@
</MenuButton>
</items>
</ToolBar>
<HBox prefHeight="389.0" prefWidth="677.0" VBox.vgrow="ALWAYS">
<HBox prefHeight="438.0" prefWidth="677.0" VBox.vgrow="ALWAYS">
<children>
<AnchorPane prefHeight="200.0" prefWidth="200.0" HBox.hgrow="NEVER">
<children>
<Label text="Name" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="14.0" />
<TextField id="mapNameFiled" fx:id="mapNameField" layoutX="53.0" layoutY="11.0" prefWidth="147.0" />
<TextField fx:id="mapWidthField" layoutX="53.0" layoutY="33.0" prefWidth="147.0" />
<Label layoutX="4.0" layoutY="36.0" text="Width" />
<TextField fx:id="mapHeightField" layoutX="53.0" layoutY="55.0" prefWidth="147.0" />
<Label layoutX="4.0" layoutY="58.0" text="Height" />
<CheckBox fx:id="mapWrapAround" contentDisplay="RIGHT" layoutX="4.0" layoutY="77.0" mnemonicParsing="false" text="Wrap at edges" />
<Separator layoutX="4.0" layoutY="101.0" prefWidth="189.0" />
<Label layoutX="4.0" layoutY="108.0" text="Scripts" />
<ScrollPane fitToHeight="true" fitToWidth="true" prefHeight="232.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="157.0">
<TextField fx:id="mapWidthField" layoutX="53.0" layoutY="45.0" prefWidth="147.0" />
<Label layoutX="4.0" layoutY="50.0" prefHeight="16.0" prefWidth="42.0" text="Width" />
<TextField fx:id="mapHeightField" layoutX="53.0" layoutY="79.0" prefWidth="147.0" />
<Label layoutX="4.0" layoutY="84.0" prefHeight="16.0" prefWidth="42.0" text="Height" />
<CheckBox fx:id="mapWrapAround" contentDisplay="RIGHT" layoutX="25.0" layoutY="111.0" mnemonicParsing="false" text="Wrap at edges" />
<Separator layoutX="6.0" layoutY="140.0" prefWidth="189.0" />
<Label layoutX="4.0" layoutY="141.0" text="Scripts" />
<ScrollPane fitToHeight="true" fitToWidth="true" layoutY="171.0" prefHeight="133.0" prefWidth="201.0" AnchorPane.bottomAnchor="114.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="195.0">
<content>
<AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="200.0" prefWidth="200.0">
<AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="95.0" prefWidth="198.0">
<children>
<ListView fx:id="mapScriptsList" editable="true" prefHeight="217.0" prefWidth="199.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<ListView fx:id="mapScriptsList" editable="true" prefHeight="130.0" prefWidth="199.0" AnchorPane.bottomAnchor="-2.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</content>
</ScrollPane>
<ToolBar layoutY="124.0" prefWidth="200.0">
<ToolBar layoutX="1.0" layoutY="157.0" prefWidth="200.0">
<items>
<Button mnemonicParsing="false" onAction="#onMapScriptAddPressed" text="+" />
<Button mnemonicParsing="false" onAction="#onMapScriptDeletePressed" text="-" />
<Button mnemonicParsing="false" onAction="#onMapScriptClonePressed" text="Clone" />
</items>
</ToolBar>
</ToolBar><TextArea fx:id="scriptInfo" editable="false" layoutY="340.0" prefHeight="100.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
</children>
</AnchorPane>
<AnchorPane fx:id="mapEditorAnchorPane" prefHeight="389.0" prefWidth="477.0000999999975" HBox.hgrow="SOMETIMES">
@ -81,4 +79,4 @@
</children>
</VBox>
</children>
</AnchorPane>
</AnchorPane>

View File

@ -167,11 +167,9 @@ asm syscall
INX
LDA ESTKL,X
STA CMD
STX ESP
JSR $BF00
CMD: !BYTE 00
PARAMS: !WORD 0000
LDX ESP
STA ESTKL,X
LDY #$00
STY ESTKH,X
@ -1018,7 +1016,7 @@ def adddef(bank, addr, deflast)
end
def loadmod(mod)
word refnum, rdlen, modsize, bytecode, defofst, defcnt, init, fixup
word addr, defaddr, modaddr, modfix
word addr, defaddr, modaddr, modfix, modend
word deftbl, deflast
word moddep, rld, esd, sym
byte defbank, str[16], filename[64]
@ -1048,7 +1046,7 @@ def loadmod(mod)
; Load module dependencies.
;
while ^moddep
if lookupmod(moddep) == 0
if !lookupmod(moddep)
close(refnum)
refnum = 0
if loadmod(moddep) < 0
@ -1063,7 +1061,7 @@ def loadmod(mod)
deftbl = allocheap(defcnt * 5 + 1)
deflast = deftbl
^deflast = 0
if refnum == 0
if !refnum
;
; Reset read pointer.
;
@ -1094,9 +1092,10 @@ def loadmod(mod)
;
modfix = modaddr - modfix
bytecode = defofst + modfix - MODADDR
rld = modaddr + modsize ; Re-Locatable Directory
esd = rld ; Extern+Entry Symbol Directory
while ^esd <> $00 ; Scan to end of ESD
modend = modaddr + modsize
rld = modend ; Re-Locatable Directory
esd = rld ; Extern+Entry Symbol Directory
while !^esd ; Scan to end of ESD
esd = esd + 4
loop
esd = esd + 1
@ -1106,6 +1105,7 @@ def loadmod(mod)
if ^MACHID & $30 == $30
defbank = 1
defaddr = allocxheap(rld - bytecode)
modend = bytecode
else
defbank = 0
defaddr = bytecode
@ -1173,11 +1173,11 @@ def loadmod(mod)
; Move bytecode to AUX bank.
;
memxcpy(0, defaddr, bytecode, modsize - (bytecode - modaddr))
;
; Free up the bytecode in main memory.
;
releaseheap(bytecode)
fin
;
; Free up the end-of-module in main memory.
;
releaseheap(modend)
else
perr = perr | 0x100
return -perr

View File

@ -1,3 +1,4 @@
INTERP = $03D0
;*
;* MOVE CMD DOWN TO $1000-$2000
;*

View File

@ -509,7 +509,7 @@ void emit_def(char *name, int is_bytecode)
{
//printf("%s%c\n", name, LBL);
if (is_bytecode)
printf("\tJSR $03D0\n");
printf("\tJSR\tINTERP\n");
}
}
void emit_codetag(int tag)

View File

@ -209,8 +209,8 @@ PAGE3 = *
;*
;* PAGE 3 VECTORS INTO INTERPRETER
;*
BIT LCRDEN+LCBNK2 ; $03D0 - DIRECT INTERP ENTRY
JMP INTERP
INTERP BIT LCRDEN+LCBNK2 ; $03D0 - DIRECT INTERP ENTRY
JMP DINTERP
BIT LCRDEN+LCBNK2 ; $03D6 - INDIRECT INTERP ENTRY
JMP IINTRP
BIT LCRDEN+LCBNK2 ; $03DC - INDIRECT INTERPX ENTRY
@ -306,7 +306,7 @@ DISABLE80 !BYTE 21, 13, '1', 26, 13
;*
;* ENTER INTO BYTECODE INTERPRETER
;*
INTERP BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
DINTERP BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
BIT LCRWEN+LCBNK2
PLA
STA IPL
@ -384,10 +384,6 @@ TIMER JSR JMPTMR
;*
JMPTMR JMP (TMRVEC)
;*
;* INDIRECT JUMP TO (TMP)
;*
JMPTMP JMP (TMP)
;*
;* ADD TOS TO TOS-1
;*
ADD LDA ESTKL,X
@ -1818,17 +1814,17 @@ IBRNCHX LDA IPL
;*
CALL +INC_IP
LDA (IP),Y
STA TMPL
STA CALLADR+1
+INC_IP
LDA (IP),Y
STA TMPH
STA CALLADR+2
LDA IPH
PHA
LDA IPL
PHA
TYA
PHA
JSR JMPTMP
CALLADR JSR $FFFF
PLA
TAY
PLA
@ -1841,10 +1837,10 @@ CALL +INC_IP
;
CALLX +INC_IP
LDA (IP),Y
STA TMPL
STA CALXADR+1
+INC_IP
LDA (IP),Y
STA TMPH
STA CALXADR+2
LDA IPH
PHA
LDA IPL
@ -1853,7 +1849,7 @@ CALLX +INC_IP
PHA
STA ALTRDOFF
CLI
JSR JMPTMP
CALXADR JSR $FFFF
SEI
STA ALTRDON
PLA
@ -1869,9 +1865,9 @@ CALLX +INC_IP
;* INDIRECT CALL TO ADDRESS (NATIVE CODE)
;*
ICAL LDA ESTKL,X
STA TMPL
STA ICALADR+1
LDA ESTKH,X
STA TMPH
STA ICALADR+2
INX
LDA IPH
PHA
@ -1879,7 +1875,7 @@ ICAL LDA ESTKL,X
PHA
TYA
PHA
JSR JMPTMP
ICALADR JSR $FFFF
PLA
TAY
PLA
@ -1891,9 +1887,9 @@ ICAL LDA ESTKL,X
JMP NEXTOP
;
ICALX LDA ESTKL,X
STA TMPL
STA ICLXADR+1
LDA ESTKH,X
STA TMPH
STA ICLXADR+2
INX
LDA IPH
PHA
@ -1903,7 +1899,7 @@ ICALX LDA ESTKL,X
PHA
STA ALTRDOFF
CLI
JSR JMPTMP
ICLXADR JSR $FFFF
SEI
STA ALTRDON
PLA
@ -1952,7 +1948,7 @@ ENTER4 LDA ESTKH,X
STA (IFP),Y
DEY
INX
DEC TMPL
DEC NPARMS
BNE ENTER4
ENTER5 LDY IPY
JMP NEXTOP
@ -1992,7 +1988,7 @@ ENTERX4 LDA ESTKH,X
STA (IFP),Y
DEY
INX
DEC TMPL
DEC NPARMS
BNE ENTERX4
ENTERX5 STA ALTRDON
LDY IPY