mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-23 05:29:50 +00:00
Merge branch 'master' of https://github.com/peterferrie/lawless-legends into peterferrie-master
This commit is contained in:
commit
6745f5c556
@ -111,13 +111,6 @@
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<!-- <dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>javafx</artifactId>
|
||||
<version>2</version>
|
||||
<systemPath>${java.home}/lib/jfxrt.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>javafx-packager</groupId>
|
||||
<artifactId>javafx-packager</artifactId>
|
||||
|
@ -67,7 +67,7 @@ public abstract class Editor<T, D> implements DataObserver<T> {
|
||||
startY = Math.min(y1, y2);
|
||||
endX = Math.max(x1, x2);
|
||||
endY = Math.max(y1, y2);
|
||||
if (startX + startY + endX + endY == 0) {
|
||||
if (startX + startY + endX + endY <= 0) {
|
||||
selectInfo = null;
|
||||
} else {
|
||||
selectInfo = "x1/" + startX + "/y1/" + startY + "/x2/" + endX + "/y2/" + endY;
|
||||
@ -79,7 +79,6 @@ public abstract class Editor<T, D> implements DataObserver<T> {
|
||||
}
|
||||
|
||||
String selectInfo;
|
||||
|
||||
public String getSelectionInfo() {
|
||||
if (selectInfo == null) {
|
||||
return getSelectedAllInfo();
|
||||
|
@ -11,6 +11,8 @@
|
||||
package org.badvision.outlaweditor;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.scene.control.Menu;
|
||||
import org.badvision.outlaweditor.data.xml.Image;
|
||||
import org.badvision.outlaweditor.data.xml.PlatformData;
|
||||
@ -23,7 +25,7 @@ public abstract class ImageEditor extends Editor<Image, ImageEditor.DrawMode> {
|
||||
|
||||
public static enum DrawMode {
|
||||
|
||||
Toggle, Pencil1px, Pencil3px, Pencil5px, Rectangle, Circle, Stamp
|
||||
Toggle, Pencil1px, Pencil3px, Pencil5px, Rectangle, Circle, Stamp, Select
|
||||
}
|
||||
|
||||
abstract public EnumMap getState();
|
||||
@ -52,4 +54,9 @@ public abstract class ImageEditor extends Editor<Image, ImageEditor.DrawMode> {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
StringProperty cursorInfo = new SimpleStringProperty();
|
||||
public StringProperty cursorInfoProperty() {
|
||||
return cursorInfo;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Group;
|
||||
@ -508,6 +510,12 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringProperty cursorInfo = new SimpleStringProperty();
|
||||
public StringProperty cursorInfoProperty() {
|
||||
return cursorInfo;
|
||||
}
|
||||
|
||||
public static Rectangle selectRect = null;
|
||||
public double selectStartX = 0;
|
||||
public double selectStartY = 0;
|
||||
@ -564,14 +572,15 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent t) {
|
||||
int x = (int) (t.getX() / tileWidth) + posX;
|
||||
int y = (int) (t.getY() / tileHeight) + posY;
|
||||
updateCursorAssistant(t);
|
||||
cursorInfo.set("X="+x+" Y="+y);
|
||||
if (!t.isPrimaryButtonDown() && drawMode != DrawMode.FilledRect && t.getEventType() != MouseEvent.MOUSE_RELEASED) return;
|
||||
if (getCurrentTile() == null && drawMode != DrawMode.Eraser) {
|
||||
return;
|
||||
}
|
||||
t.consume();
|
||||
int x = (int) (t.getX() / tileWidth) + posX;
|
||||
int y = (int) (t.getY() / tileHeight) + posY;
|
||||
boolean canSkip = false;
|
||||
if (getCurrentTile() == lastTile && x == lastX && y == lastY && drawMode == lastDrawMode) {
|
||||
canSkip = true;
|
||||
|
@ -7,7 +7,6 @@
|
||||
* 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;
|
||||
|
||||
import java.io.File;
|
||||
@ -55,7 +54,10 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
protected double zoom = 1.0;
|
||||
protected int xScale = 2;
|
||||
protected int yScale = 2;
|
||||
public static enum StateVars{PATTERN, DRAW_MODE};
|
||||
|
||||
public static enum StateVars {
|
||||
PATTERN, DRAW_MODE
|
||||
};
|
||||
|
||||
public Platform getPlatform() {
|
||||
return Platform.AppleII;
|
||||
@ -66,13 +68,14 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
super.onEntityUpdated();
|
||||
data = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void buildEditorUI(Pane editorAnchorPane) {
|
||||
anchorPane = editorAnchorPane;
|
||||
redraw();
|
||||
screen = new ImageView(currentImage);
|
||||
anchorPane.getChildren().add(0, screen);
|
||||
screen.setOnMouseMoved(this);
|
||||
screen.setOnMousePressed(this);
|
||||
screen.setOnMouseClicked(this);
|
||||
screen.setOnMouseReleased(this);
|
||||
@ -89,7 +92,9 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
}
|
||||
|
||||
public void changeCurrentPattern(FillPattern pattern) {
|
||||
if (pattern == null) return;
|
||||
if (pattern == null) {
|
||||
return;
|
||||
}
|
||||
currentFillPattern = pattern.getBytePattern();
|
||||
hiBitMatters = pattern.hiBitMatters;
|
||||
lastActionX = -1;
|
||||
@ -97,6 +102,7 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
}
|
||||
|
||||
EnumMap<StateVars, Object> state = new EnumMap<>(StateVars.class);
|
||||
|
||||
@Override
|
||||
public EnumMap getState() {
|
||||
return state;
|
||||
@ -113,17 +119,21 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
state.put(StateVars.DRAW_MODE, currentDrawMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDrawMode(DrawMode drawMode) {
|
||||
_setDrawMode(drawMode);
|
||||
state.put(StateVars.DRAW_MODE, drawMode);
|
||||
}
|
||||
|
||||
|
||||
private void _setDrawMode(DrawMode drawMode) {
|
||||
currentDrawMode = drawMode;
|
||||
lastActionX = -1;
|
||||
lastActionY = -1;
|
||||
lastActionY = -1;
|
||||
selectionFinished = false;
|
||||
if (drawMode != DrawMode.Stamp) {
|
||||
selectNone();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -152,6 +162,7 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
}
|
||||
|
||||
PlatformData data = null;
|
||||
|
||||
public PlatformData getPlatformData() {
|
||||
if (data == null) {
|
||||
data = getPlatformData(getPlatform());
|
||||
@ -162,7 +173,7 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public byte[] getImageData() {
|
||||
return getPlatformData().getValue();
|
||||
}
|
||||
@ -213,7 +224,13 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent t) {
|
||||
if (performAction(t.isShiftDown() || t.isSecondaryButtonDown(), t.getEventType().equals(MouseEvent.MOUSE_RELEASED), (int) t.getX() / xScale, (int) t.getY() / yScale)) {
|
||||
int x = (int) t.getX() / xScale;
|
||||
int y = (int) t.getY() / yScale;
|
||||
cursorInfoProperty().set("X="+x+"("+(x/7)+","+(x%7)+") Y="+y);
|
||||
if (t.getEventType().equals(MouseEvent.MOUSE_MOVED)) {
|
||||
return;
|
||||
}
|
||||
if (performAction(t.isShiftDown() || t.isSecondaryButtonDown(), t.getEventType().equals(MouseEvent.MOUSE_RELEASED), x, y)) {
|
||||
t.consume();
|
||||
}
|
||||
|
||||
@ -283,15 +300,28 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
updateSelection(x, y);
|
||||
}
|
||||
break;
|
||||
case Select:
|
||||
debounce = System.currentTimeMillis();
|
||||
if (selectionFinished && !released) {
|
||||
startSelection(x, y);
|
||||
} else {
|
||||
updateSelection(x, y);
|
||||
}
|
||||
selectionFinished = released;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
// observedObjectChanged(getEntity());
|
||||
}
|
||||
public boolean selectionFinished = false;
|
||||
public static Rectangle selectRect = null;
|
||||
public int selectStartX = -1;
|
||||
public int selectStartY = -1;
|
||||
public int selectEndX = -1;
|
||||
public int selectEndY = -1;
|
||||
|
||||
private void startSelection(int x, int y) {
|
||||
selectNone();
|
||||
selectRect = new Rectangle(1, 1, Color.NAVY);
|
||||
selectRect.setTranslateX(x * xScale);
|
||||
selectRect.setTranslateY(y * yScale);
|
||||
@ -306,14 +336,22 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
startSelection(x, y);
|
||||
}
|
||||
|
||||
double minX = Math.min(selectStartX, x) * xScale;
|
||||
double minY = Math.min(selectStartY, y) * yScale;
|
||||
double maxX = Math.max(selectStartX, x) * xScale;
|
||||
double maxY = Math.max(selectStartY, y) * yScale;
|
||||
selectRect.setTranslateX(minX);
|
||||
selectRect.setTranslateY(minY);
|
||||
selectRect.setWidth(maxX - minX);
|
||||
selectRect.setHeight(maxY - minY);
|
||||
int startX = Math.min(selectStartX, x);
|
||||
int endX = Math.max(selectStartX, x);
|
||||
int startY = Math.min(selectStartY, y);
|
||||
int endY = Math.max(selectStartY, y);
|
||||
|
||||
selectStartX = startX;
|
||||
selectStartY = startY;
|
||||
selectEndX = endX;
|
||||
selectEndY = endY;
|
||||
|
||||
selectRect.setTranslateX(startX * xScale);
|
||||
selectRect.setTranslateY(startY * yScale);
|
||||
selectRect.setWidth((endX - startX) * xScale);
|
||||
selectRect.setHeight((endY - startY) * yScale);
|
||||
|
||||
setSelectionArea(selectStartX, selectStartY, selectEndX, selectEndY);
|
||||
}
|
||||
|
||||
private void fillSelection(int x, int y) {
|
||||
@ -392,12 +430,15 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
return getPlatformData(getPlatform()).getHeight();
|
||||
}
|
||||
|
||||
byte[] copyData = null;
|
||||
|
||||
@Override
|
||||
public void copy() {
|
||||
java.util.Map<DataFormat, Object> clip = new HashMap<>();
|
||||
clip.put(DataFormat.IMAGE, currentImage);
|
||||
clip.put(DataFormat.PLAIN_TEXT, "selection/image/" + Application.gameData.getImage().indexOf(getEntity()) + "/" + getSelectionInfo());
|
||||
Clipboard.getSystemClipboard().setContent(clip);
|
||||
copyData = Arrays.copyOf(getImageData(), getImageData().length);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -416,6 +457,7 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
//selection/map/2/x1/0/y1/0/x2/19/y2/11
|
||||
|
||||
public boolean pasteAppContent(String contentPath) {
|
||||
trackState();
|
||||
System.out.println("Clipboard >> " + contentPath);
|
||||
if (contentPath.startsWith("selection/map")) {
|
||||
String[] bufferDetails = contentPath.substring(14).split("/");
|
||||
@ -437,18 +479,65 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
} else if (contentPath.startsWith("selection/image")) {
|
||||
String[] bufferDetails = contentPath.substring(16).split("/");
|
||||
int imageNumber = Integer.parseInt(bufferDetails[0]);
|
||||
Image sourceImage = Application.gameData.getImage().get(imageNumber);
|
||||
byte[] sourceData;
|
||||
if (sourceImage.equals(getEntity())) {
|
||||
sourceData = copyData;
|
||||
} else {
|
||||
PlatformData platformData = sourceImage.getDisplayData().stream().filter(d -> d.getPlatform().equals(getPlatform().name())).findFirst().orElse(null);
|
||||
if (platformData == null) {
|
||||
throw new NullPointerException("Unable to paste from source image, no matching platform data.");
|
||||
}
|
||||
sourceData = platformData.getValue();
|
||||
}
|
||||
|
||||
if ("all".equals(bufferDetails[1])) {
|
||||
Image sourceImage = Application.gameData.getImage().get(imageNumber);
|
||||
for (PlatformData data : sourceImage.getDisplayData()) {
|
||||
if (data.getPlatform().equals(getPlatform().toString())) {
|
||||
setData(Arrays.copyOf(data.getValue(), data.getValue().length));
|
||||
redraw();
|
||||
return true;
|
||||
setData(Arrays.copyOf(sourceData, sourceData.length));
|
||||
redraw();
|
||||
return true;
|
||||
} else {
|
||||
int xStart = Integer.parseInt(bufferDetails[2]);
|
||||
int yStart = Integer.parseInt(bufferDetails[4]);
|
||||
int xEnd = Integer.parseInt(bufferDetails[6]);
|
||||
int yEnd = Integer.parseInt(bufferDetails[8]);
|
||||
byte[] targetData = getImageData();
|
||||
int pasteX = lastActionX;
|
||||
int pasteY = lastActionY;
|
||||
// fix odd/even: Try to nudge left or right where it might work best.
|
||||
if ((xStart % 2) != pasteX % 2) {
|
||||
if (pasteX == 0 || pasteX % 7 > 3 || (pasteX + (xEnd - xStart) / 7) < getWidth()) {
|
||||
pasteX++;
|
||||
} else {
|
||||
pasteX--;
|
||||
}
|
||||
}
|
||||
System.err.println("Unable to paste from source image, no matching platform data.");
|
||||
} else {
|
||||
System.err.println("Unable to paste partial images at this time... sorry. :-(");
|
||||
System.out.println("Paste to " + pasteX + "," + pasteY);
|
||||
for (int sourceY = yStart, targetY = pasteY; sourceY <= yEnd; sourceY++, targetY++) {
|
||||
if (targetY < 0 || targetY >= getHeight()) {
|
||||
continue;
|
||||
}
|
||||
int sourceRow = sourceY * getWidth();
|
||||
int targetRow = targetY * getWidth();
|
||||
for (int sourceX = xStart, targetX = pasteX; sourceX <= xEnd; sourceX++, targetX++) {
|
||||
if (targetX < 0 || targetX / 7 >= getWidth()) {
|
||||
continue;
|
||||
}
|
||||
int targetLoc = targetRow + targetX / 7;
|
||||
byte sourceByte = sourceData[sourceRow + sourceX / 7];
|
||||
byte targetByte = targetData[targetLoc];
|
||||
int targetBit = targetX % 7;
|
||||
int sourceBit = sourceX % 7;
|
||||
// Remove hi-bit and image bit
|
||||
targetByte &= 0x07f ^ (1 << targetBit);
|
||||
// Copy hi-bit
|
||||
targetByte |= sourceByte & 0x080;
|
||||
// Copy x bit
|
||||
targetByte |= ((sourceByte >> sourceBit) & 1) << targetBit;
|
||||
targetData[targetLoc] = targetByte;
|
||||
}
|
||||
}
|
||||
setDataAndRedraw(targetData);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -456,12 +545,16 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
|
||||
@Override
|
||||
public void select() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
_setDrawMode(DrawMode.Select);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectNone() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
selectStartX = selectStartY = selectEndX = selectEndY = -1;
|
||||
setSelectionArea(selectStartX, selectStartY, selectEndX, selectEndY);
|
||||
if (selectRect != null) {
|
||||
anchorPane.getChildren().remove(selectRect);
|
||||
}
|
||||
}
|
||||
|
||||
private void importImage(javafx.scene.image.Image image) {
|
||||
@ -504,7 +597,7 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
public void resize(final int newWidth, final int newHeight) {
|
||||
UIAction.confirm("Do you want to scale the image? If you select no, the image will be cropped as needed.", () -> {
|
||||
rescale(newWidth, newHeight);
|
||||
}, () -> {
|
||||
}, () -> {
|
||||
crop(newWidth, newHeight);
|
||||
});
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
package org.badvision.outlaweditor.ui;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Group;
|
||||
@ -50,6 +52,8 @@ public abstract class ImageEditorTabController {
|
||||
protected TextField imageWidthField; // Value injected by FXMLLoader
|
||||
@FXML
|
||||
protected Label zoomLabel;
|
||||
@FXML
|
||||
protected Label cursorInfo;
|
||||
|
||||
@FXML
|
||||
public void initalize() {
|
||||
@ -64,6 +68,7 @@ public abstract class ImageEditorTabController {
|
||||
assert imageEditorZoomGroup != null : "fx:id\"imageEditorZoomGroup\" was not injected: check your FXML file 'imageEditorTab.fxml'";
|
||||
assert imageEditorScrollAnchorPane != null : "fx:id\"imageEditorScrollAnchorPane\" was not injected: check your FXML file 'imageEditorTab.fxml'";
|
||||
assert zoomLabel != null : "fx:id=\"zoomLabel\" was not injected: check your FXML file 'imageEditorTab.fxml'.";
|
||||
assert cursorInfo != null : "fx:id=\"cursorInfo\" was not injected: check your FXML file 'imageEditorTab.fxml'.";
|
||||
}
|
||||
|
||||
abstract public void rebuildImageSelector();
|
||||
|
@ -15,6 +15,7 @@ import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.Menu;
|
||||
import javafx.scene.control.TextField;
|
||||
@ -65,6 +66,8 @@ public abstract class MapEditorTabController {
|
||||
protected CheckBox mapWrapAround; // Value injected by FXMLLoader
|
||||
@FXML
|
||||
protected Button scriptEraseTool;
|
||||
@FXML
|
||||
protected Label cursorInfo;
|
||||
|
||||
@FXML
|
||||
abstract public void mapEraser(ActionEvent event);
|
||||
@ -152,6 +155,7 @@ public abstract class MapEditorTabController {
|
||||
assert mapSelectTile != null : "fx:id=\"mapSelectTile\" was not injected: check your FXML file 'mapEditorTab.fxml'.";
|
||||
assert mapWidthField != null : "fx:id=\"mapWidthField\" was not injected: check your FXML file 'mapEditorTab.fxml'.";
|
||||
assert mapWrapAround != null : "fx:id=\"mapWrapAround\" was not injected: check your FXML file 'mapEditorTab.fxml'.";
|
||||
assert cursorInfo != null : "fx:id=\"cursorInfo\" was not injected: check your FXML file 'imageEditorTab.fxml'.";
|
||||
}
|
||||
|
||||
abstract public void rebuildTileSelectors();
|
||||
|
@ -11,10 +11,8 @@ package org.badvision.outlaweditor.ui.impl;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import org.badvision.outlaweditor.ui.EntitySelectorCell;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.ActionEvent;
|
||||
@ -22,16 +20,16 @@ import javafx.scene.control.ListView;
|
||||
import javafx.util.StringConverter;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import org.badvision.outlaweditor.Application;
|
||||
import static org.badvision.outlaweditor.Application.currentPlatform;
|
||||
import org.badvision.outlaweditor.Editor;
|
||||
import org.badvision.outlaweditor.ImageEditor;
|
||||
import static org.badvision.outlaweditor.Application.currentPlatform;
|
||||
import org.badvision.outlaweditor.TransferHelper;
|
||||
import static org.badvision.outlaweditor.ui.UIAction.confirm;
|
||||
import static org.badvision.outlaweditor.data.PropertyHelper.bind;
|
||||
import static org.badvision.outlaweditor.data.PropertyHelper.stringProp;
|
||||
import org.badvision.outlaweditor.data.xml.GameData;
|
||||
import org.badvision.outlaweditor.data.xml.Image;
|
||||
import org.badvision.outlaweditor.ui.EntitySelectorCell;
|
||||
import org.badvision.outlaweditor.ui.ImageEditorTabController;
|
||||
import static org.badvision.outlaweditor.ui.UIAction.confirm;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
@ -205,6 +203,8 @@ public class ImageEditorTabControllerImpl extends ImageEditorTabController {
|
||||
if (currentImageEditor != null) {
|
||||
oldEditorState = currentImageEditor.getState();
|
||||
currentImageEditor.unregister();
|
||||
cursorInfo.textProperty().unbind();
|
||||
cursorInfo.setText("");
|
||||
}
|
||||
if (i == null) {
|
||||
bind(imageCategoryField.textProperty(), null);
|
||||
@ -216,6 +216,8 @@ public class ImageEditorTabControllerImpl extends ImageEditorTabController {
|
||||
imageNameField.setDisable(true);
|
||||
imageWidthField.setDisable(true);
|
||||
currentImageEditor = null;
|
||||
cursorInfo.textProperty().unbind();
|
||||
cursorInfo.setText("");
|
||||
} else {
|
||||
if (i.getName() == null) {
|
||||
i.setName("Untitled");
|
||||
@ -246,6 +248,7 @@ public class ImageEditorTabControllerImpl extends ImageEditorTabController {
|
||||
currentImageEditor.setState(oldEditorState);
|
||||
}
|
||||
}
|
||||
cursorInfo.textProperty().bind(currentImageEditor.cursorInfoProperty());
|
||||
}
|
||||
|
||||
private Image getCurrentImage() {
|
||||
|
@ -286,6 +286,8 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
mapWidthField.setDisable(true);
|
||||
mapWrapAround.setDisable(true);
|
||||
setCurrentEditor(null);
|
||||
cursorInfo.textProperty().unbind();
|
||||
cursorInfo.setText("");
|
||||
} else {
|
||||
if (m.getScripts() != null) {
|
||||
DataUtilities.sortNamedEntities(m.getScripts().getScript());
|
||||
@ -321,6 +323,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
if (currentTile != null) {
|
||||
e.setCurrentTile(currentTile);
|
||||
}
|
||||
cursorInfo.textProperty().bind(e.cursorInfoProperty());
|
||||
}
|
||||
redrawMapScripts();
|
||||
}
|
||||
|
@ -7,14 +7,14 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane id="tilesTab" minHeight="0.0" minWidth="0.0" prefHeight="420.0" prefWidth="677.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.badvision.outlaweditor.ui.impl.ImageEditorTabControllerImpl">
|
||||
<AnchorPane id="tilesTab" minHeight="0.0" minWidth="0.0" prefHeight="420.0" prefWidth="677.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.badvision.outlaweditor.ui.impl.ImageEditorTabControllerImpl">
|
||||
<children>
|
||||
<VBox prefHeight="420.0000999999975" prefWidth="677.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<ToolBar prefWidth="686.0">
|
||||
<items>
|
||||
<Label text="Image:" />
|
||||
<ComboBox id="tileSelect" fx:id="imageSelector" onAction="#onImageSelected" prefHeight="26.0" prefWidth="271.0" />
|
||||
<ComboBox id="tileSelect" fx:id="imageSelector" onAction="#onImageSelected" prefHeight="27.0" prefWidth="242.0" />
|
||||
<Button mnemonicParsing="false" onAction="#onImageCreatePressed" text="Create new" />
|
||||
<Button mnemonicParsing="false" onAction="#onImageClonePressed" text="Clone" />
|
||||
<Button mnemonicParsing="false" onAction="#onImageExportPressed" text="Export" />
|
||||
@ -35,6 +35,7 @@
|
||||
<MenuItem mnemonicParsing="false" onAction="#imageShift" text="Shift..." />
|
||||
</items>
|
||||
</MenuButton>
|
||||
<Label fx:id="cursorInfo" text="cursorInfo" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
<HBox prefHeight="387.0" prefWidth="677.0" VBox.vgrow="ALWAYS">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<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">
|
||||
<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.0.40" 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>
|
||||
@ -32,6 +32,7 @@
|
||||
<MenuItem mnemonicParsing="false" onAction="#mapTogglePanZoom" text="Toggle pan/zoom controls" />
|
||||
</items>
|
||||
</MenuButton>
|
||||
<Label fx:id="cursorInfo" text="CursorInfo" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
<HBox prefHeight="438.0" prefWidth="677.0" VBox.vgrow="ALWAYS">
|
||||
|
@ -84,21 +84,19 @@ relocate:
|
||||
bit setLcRW+lcBank1 ; only copy bank 1, because bank 2 is PLASMA runtime
|
||||
bit setLcRW+lcBank1 ; write to it
|
||||
; verify that aux mem exists
|
||||
ldx #1
|
||||
inx
|
||||
stx $D000
|
||||
sta setAuxZP
|
||||
inx
|
||||
stx $D000
|
||||
lda $D000
|
||||
cmp #2
|
||||
cpx $D000
|
||||
bne .noaux
|
||||
sta clrAuxZP
|
||||
lda $D000
|
||||
cmp #1
|
||||
dex
|
||||
cpx $D000
|
||||
beq .gotaux
|
||||
.noaux jsr inlineFatal : !text "AuxMemReq",0
|
||||
.gotaux ldy #0
|
||||
ldx #$D0
|
||||
.gotaux ldx #$D0
|
||||
.pglup stx .ld+2
|
||||
stx .st+2
|
||||
.bylup sta clrAuxZP ; get byte from main LC
|
||||
@ -111,30 +109,27 @@ relocate:
|
||||
bne .pglup
|
||||
sta clrAuxZP ; ...back to main LC
|
||||
; patch into the main ProDOS MLI entry point
|
||||
lda #$4C ; jmp
|
||||
sta $BFBB
|
||||
ldx #$4C ; jmp
|
||||
stx $BFBB
|
||||
lda #<enterProDOS1
|
||||
sta $BFBC
|
||||
lda #>enterProDOS1
|
||||
sta $BFBD
|
||||
; patch into the interrupt handler
|
||||
lda #$4C ; jmp
|
||||
sta $BFEB
|
||||
stx $BFEB
|
||||
lda #<enterProDOS2
|
||||
sta $BFEC
|
||||
lda #>enterProDOS2
|
||||
sta $BFED
|
||||
; patch into the shared MLI/IRQ exit routine
|
||||
lda #$4C ; jmp
|
||||
sta $BFA0
|
||||
stx $BFA0
|
||||
lda #<exitProDOS
|
||||
sta $BFA1
|
||||
lda #>exitProDOS
|
||||
sta $BFA2
|
||||
; now blow away the main RAM LC area as a check
|
||||
ldx #$D0
|
||||
lda #0
|
||||
tay
|
||||
tya
|
||||
.clrlup stx .st2+2
|
||||
.st2 sta $D000,Y
|
||||
iny
|
||||
@ -289,7 +284,7 @@ init: !zone
|
||||
stx tSegLink+1
|
||||
inx
|
||||
stx tSegLink+2
|
||||
ldx #4
|
||||
inx
|
||||
stx tSegLink+0
|
||||
inx
|
||||
stx tSegLink+4
|
||||
@ -323,12 +318,10 @@ init: !zone
|
||||
; Finally, form a long list of the remaining unused segments.
|
||||
ldx #10
|
||||
stx unusedSeg ; that's the first unused seg
|
||||
ldy #11
|
||||
.loop: tya
|
||||
sta tSegLink,x
|
||||
inx
|
||||
iny
|
||||
cpy #MAX_SEGS ; did all segments yet?
|
||||
.loop: inx
|
||||
txa
|
||||
sta tSegLink-1,x
|
||||
cpx #MAX_SEGS-1 ; did all segments yet?
|
||||
bne .loop ; no, loop again
|
||||
; Allocate space for the PLASMA frame stack
|
||||
!if SANITY_CHECK {
|
||||
@ -636,19 +629,21 @@ __asmPlasm_bank2:
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
__asmPlasm: !zone
|
||||
pla ; save address of calling routine, so we can call it
|
||||
clc
|
||||
adc #1
|
||||
sta .jsr+1
|
||||
pla
|
||||
adc #0
|
||||
sta .jsr+2
|
||||
cpx #$11
|
||||
bcs .badx ; X must be in range 0..$10
|
||||
; adjust PLASMA stack pointer to skip over params
|
||||
dey ; leave 1 slot for ret value
|
||||
sty tmp
|
||||
pla ; save address of calling routine, so we can call it
|
||||
tay
|
||||
pla
|
||||
iny
|
||||
sty .jsr+1
|
||||
bne .noadd
|
||||
adc #1
|
||||
.noadd
|
||||
sta .jsr+2
|
||||
txa
|
||||
cpx #$11
|
||||
bcs .badx ; X must be in range 0..$10
|
||||
.add adc tmp ; carry cleared by cpx above
|
||||
pha ; and save that
|
||||
cmp #$11 ; again, X must be in range 0..$10
|
||||
@ -1002,8 +997,8 @@ gcHash_chk: !zone
|
||||
sta gcHash_link,y
|
||||
tya
|
||||
sta gcHash_first,x
|
||||
.ret clc
|
||||
rts
|
||||
clc
|
||||
.ret rts
|
||||
.found sec
|
||||
rts
|
||||
.corrup jmp heapCorrupt
|
||||
@ -1621,7 +1616,7 @@ reset: !zone
|
||||
.next: lda tSegLink,x ; get link to next seg
|
||||
tax ; to X reg, and test if end of chain (x=0)
|
||||
bne .inactivate ; no, not end of chain, so loop again
|
||||
lda #0 ; default to putting fixups at $8000, to avoid fragmentation
|
||||
;; lda #0 ; default to putting fixups at $8000, to avoid fragmentation
|
||||
sta fixupHint
|
||||
lda #$80
|
||||
sta fixupHint+1
|
||||
|
@ -182,10 +182,10 @@ GA_Lp2 LDY zTmp3 ;Get index into stored addresses
|
||||
AND #$07 ;check if it crosses the 'n'* 7th line
|
||||
BEQ GA_Lp1 ;if so, use ROM to recalc new addrs, else,
|
||||
LDA GBasH ;get HiByt of adrs wrd |pppFGHcd|eABABxxx|
|
||||
CLC ;(line position is ABCDEFGH bit pattern)
|
||||
;; CLC ;(line position is ABCDEFGH bit pattern)
|
||||
ADC #$04 ;increment the FGH bit pattern
|
||||
STA GBasH ;and save the result. This is faster
|
||||
JMP GA_Lp2 ;than using the GetBase routine every time.
|
||||
BNE GA_Lp2 ;than using the GetBase routine every time.
|
||||
GA_Done PLA ;restore vertical position
|
||||
STA CursRow
|
||||
RTS
|
||||
@ -241,7 +241,6 @@ GetWdth LDA #0
|
||||
TAY
|
||||
STA ChrX10H ;clear HI byte of x10 multiplier
|
||||
LDA PltChar ;load the font char {0..110}
|
||||
CLC
|
||||
ASL
|
||||
STA ChrX10L ;multiply it by 10 to get an index value
|
||||
ASL ;into the array of bytes that make-up the
|
||||
@ -250,10 +249,9 @@ GetWdth LDA #0
|
||||
ROL ChrX10H
|
||||
ADC ChrX10L
|
||||
STA ChrX10L
|
||||
LDA ChrX10H
|
||||
ADC #0
|
||||
STA ChrX10H ;save index value {0..990}
|
||||
|
||||
BCC +
|
||||
INC ChrX10H ;save index value {0..990}
|
||||
+
|
||||
CLC
|
||||
LDA Font0 ;get base address of Font bitmap table
|
||||
ADC ChrX10L ;and add the PlotChar x10 offset to it
|
||||
@ -350,7 +348,7 @@ LpLBmp ASL ;into the CGA_Ary flag. That CGA_Ary value is
|
||||
; now shift the pixel pattrn back 1 positn
|
||||
LSR ;so all pixels are visible [8th bit not
|
||||
STA zTmp3 ;visible]. Save the pixel pattern.
|
||||
CPY #1
|
||||
DEY
|
||||
BNE LpLMskp ;Only shift mask bits on 1st loop
|
||||
|
||||
LDX H_Bit ;Do the same shifting for the mask bits.
|
||||
@ -394,50 +392,43 @@ DoAgn PHA
|
||||
STA (zTmp1),Y ;write to HGR. Use indrct, indxd adrssing
|
||||
LDA Flg2nd ;check if pixel pattern crosses 2-bytes
|
||||
BEQ Chk8xcp ;if not, then skip to next line of bitmap
|
||||
LDA #0
|
||||
STA Flg2nd ;else, first, clear the flag
|
||||
STY Flg2nd ;else, first, clear the flag
|
||||
LDA Byt2nd ;get the 2nd byte
|
||||
STA zTmp3 ;store it in pixel pattern to be plotted
|
||||
LDA MskBytH
|
||||
INY ;increment the byte offset index
|
||||
JMP DoAgn ;go plot the 2nd half of the pixel pattern
|
||||
Chk8xcp LDA Flg8xcp
|
||||
BNE DoAgn ;go plot the 2nd half of the pixel pattern
|
||||
Chk8xcp CMP InvTx_Flg ;save carry for later
|
||||
LDA Flg8xcp
|
||||
BEQ SkpLine
|
||||
INY
|
||||
LDA InvTx_Flg
|
||||
BNE Chk8xcI
|
||||
LDA (zTmp1),Y
|
||||
BCC Chk8xcI ;CMP was non-zero
|
||||
AND #$FE
|
||||
STA (zTmp1),Y
|
||||
JMP SkpLine
|
||||
Chk8xcI LDA (zTmp1),Y
|
||||
ORA #1
|
||||
BCS SkpLine
|
||||
Chk8xcI ORA #1
|
||||
STA (zTmp1),Y
|
||||
JMP SkpLine
|
||||
BNE SkpLine
|
||||
|
||||
NoMask LDY #0 ;clear the byte offset index
|
||||
DoAgnNM LDA (zTmp1),Y ;get HGR pixels
|
||||
PHA
|
||||
LDA FlgBchr
|
||||
NoMask ;;LDY #0 ;clear the byte offset index
|
||||
DoAgnNM LDA FlgBchr
|
||||
BEQ NoBchrP
|
||||
LDA zTmp3
|
||||
EOR #$FF
|
||||
AND (zTmp1),Y ;get HGR pixels
|
||||
STA zTmp3
|
||||
PLA
|
||||
AND zTmp3
|
||||
JMP NoBchrQ
|
||||
NoBchrP PLA
|
||||
NoBchrP LDA (zTmp1),Y ;get HGR pixels
|
||||
ORA zTmp3 ;add the char BMP bits into the pixels
|
||||
NoBchrQ ORA #$80 ; (set high bit for the demo)
|
||||
ORA #$80 ; (set high bit for the demo)
|
||||
STA (zTmp1),Y ;write to HGR. Use indrct, indxd adrssing
|
||||
LDA Flg2nd ;check if pixel pattern crosses 2-bytes
|
||||
BEQ SkpLine ;if not, then skip to next line of bitmap
|
||||
LDA #0
|
||||
STA Flg2nd ;else, first, clear the flag
|
||||
STY Flg2nd ;else, first, clear the flag
|
||||
LDA Byt2nd ;get the 2nd byte
|
||||
STA zTmp3 ;store it in pixel pattern to be plotted
|
||||
INY ;increment the byte offset index
|
||||
JMP DoAgnNM ;go plot the 2nd half of the pixel pattern
|
||||
BNE DoAgnNM ;go plot the 2nd half of the pixel pattern
|
||||
|
||||
SkpLine INX ;increment the array index
|
||||
STX MlpIdx
|
||||
@ -496,16 +487,14 @@ Adv210 STA CursColL ;position to 154
|
||||
STA WrdWdth ;and, clear Word Width total
|
||||
STA TtlScrl ;and ticker scroll total
|
||||
LDA CursRow ;Get vertical {0..191}
|
||||
CLC
|
||||
ADC #9 ;increment by 9 lines, down
|
||||
CMP CursYb ;check if it's past 130
|
||||
BCC DoneLin ;if not then done
|
||||
JSR ScrlTxt ;else scroll the text up 1 line
|
||||
RTS
|
||||
JMP ScrlTxt ;else scroll the text up 1 line
|
||||
DoneLin STA CursRow ;save vertical position
|
||||
DoneCurs LDA CharRate ;get character rate / delay time
|
||||
BEQ Wait_skp ;skip if no wait
|
||||
JSR WtL_Wait ;delay before plotting next char
|
||||
JMP WtL_Wait ;delay before plotting next char
|
||||
Wait_skp RTS
|
||||
|
||||
;Wait that can be interrupted by a key or button press.
|
||||
@ -557,14 +546,14 @@ SW_TOP = 3
|
||||
SetWnd LDA evalStkL+SW_TOP,X ;get top coord
|
||||
STA CursY ;save the top Y coord
|
||||
STA CursRow ;also as current cursor vertical pos
|
||||
SEC
|
||||
SBC #1 ;adjust by 1
|
||||
STA TpMrgn ; for scrolling margin
|
||||
TAY
|
||||
DEY ;adjust by 1
|
||||
STY TpMrgn ; for scrolling margin
|
||||
LDA evalStkL+SW_BTM,X ;get bottom coord
|
||||
STA CursYb ;save the bottom Y coord
|
||||
SEC
|
||||
SBC #1 ;adjust by 1
|
||||
STA BtMrgn ; for scrolling margin
|
||||
TAY
|
||||
DEY ;adjust by 1
|
||||
STY BtMrgn ; for scrolling margin
|
||||
LDA evalStkL+SW_LT,X ;lo byte of left X
|
||||
STA CursXl
|
||||
LDA evalStkH+SW_LT,X ;hi byte of left X
|
||||
@ -696,12 +685,10 @@ ClrSlp4 STA (GBasL),Y
|
||||
RTS
|
||||
|
||||
ClrChkF LDA BkgColor
|
||||
TAY
|
||||
AND #$7F
|
||||
EOR #$7F
|
||||
BEQ ClrChk1
|
||||
TYA
|
||||
AND #$7F
|
||||
EOR #$7F
|
||||
ClrChk1 STA ClrFlpF
|
||||
RTS
|
||||
|
||||
@ -743,8 +730,7 @@ Pa_Lp1 STY Pa_iSv
|
||||
STA AscChar
|
||||
CPY Pa_Len ;reached end of string?
|
||||
BCC Pa_Go
|
||||
BEQ Pa_Go
|
||||
JMP Pa_Spc
|
||||
BNE Pa_Spc
|
||||
Pa_Go ORA #$80 ;set hi bit for consistent tests
|
||||
STA AscChar
|
||||
CMP #$8D
|
||||
@ -767,7 +753,7 @@ Pa_Tskp LDA AscChar
|
||||
BPL Pa_ToFr ;too far! force CR/LF
|
||||
LDY Pa_iSv
|
||||
INY
|
||||
JMP Pa_Lp1
|
||||
BNE Pa_Lp1
|
||||
Pa_ToFr !if DEBUG { +prChr '+' }
|
||||
;MH: I added this, but it doesn't actually work. Skips first char on line sometimes.
|
||||
;LDY Pa_iSv ;if word too big
|
||||
@ -777,10 +763,10 @@ Pa_ToFr !if DEBUG { +prChr '+' }
|
||||
STA AscChar
|
||||
!if DEBUG { +prChr '!' : ora #$80 : jsr cout }
|
||||
JSR TestChr
|
||||
LDY #0
|
||||
STY TtlWdth
|
||||
LDY Pa_iBgn
|
||||
JMP Pa_Lp0
|
||||
LDA #0
|
||||
STA TtlWdth
|
||||
BEQ Pa_Lp1
|
||||
;
|
||||
Pa_Spc LDY Pa_iSv
|
||||
STY Pa_iEnd
|
||||
@ -799,8 +785,7 @@ Pa_Lp2 STY Pa_iSv
|
||||
Pa_Dn2 STY Pa_iSv
|
||||
CPY Pa_Len ;end of the message?
|
||||
BCC Pa_Dn2b
|
||||
BEQ Pa_Dn2b
|
||||
JMP ParsDn ;if so, stop here
|
||||
BNE ParsDn ;if so, stop here
|
||||
Pa_Dn2b LDA TtlWdth
|
||||
CMP LinWdth
|
||||
BPL Pa_Dn3
|
||||
@ -907,10 +892,9 @@ CtrSLps STA LpNScrl ;Save # of scroll loops
|
||||
SEC ;(CLC is intentional, here)
|
||||
SBC LpNScrl ;bump it back
|
||||
STA CursColL ;save lo-byte
|
||||
LDA CursColH ;get hi-byte of {0..279}
|
||||
SBC #0
|
||||
STA CursColH
|
||||
LDA LpNScrl ;Get # of scroll loops
|
||||
BCS +
|
||||
DEC CursColH ;get hi-byte of {0..279}
|
||||
+ LDA LpNScrl ;Get # of scroll loops
|
||||
CtrLp1 JSR Sc1_Bgn
|
||||
DEC LpNScrl
|
||||
BNE CtrLp1
|
||||
@ -1040,7 +1024,7 @@ Get_Ext CMP #$85
|
||||
BNE Get_Ch3 ;Ctrl-E (extended char)
|
||||
LDA #3
|
||||
STA WaitStat ;if pressed, wait for val
|
||||
JMP Get_Lp1
|
||||
BNE Get_Lp1
|
||||
Get_Ch3 LDX InBfrX ;else normal char pressed
|
||||
STA InBufr,X ;store ASCII char w/hi-bit
|
||||
AND #$7F ;strip off hi-bit
|
||||
@ -1112,7 +1096,7 @@ In_cTst CMP #$85
|
||||
BNE In_cTs2 ;Ctrl-E (extended char)
|
||||
LDA #3 ;set wait state for extended char
|
||||
STA WaitStat
|
||||
JMP In_Key
|
||||
BNE In_Key
|
||||
In_cTs2 CMP #$9B ;check for ESC key
|
||||
BNE In_cTs3 ;if ESC then exit app
|
||||
PLA
|
||||
@ -1156,9 +1140,8 @@ In_Plt LDX #1
|
||||
STA CursColH
|
||||
CMP CursXrh ;if so, ignore it, sound ERR,
|
||||
BMI In_Bchk ;wait for different key press
|
||||
CLC
|
||||
LDA CursColL ;allow 2 more pixels for cursor
|
||||
ADC #2
|
||||
ADC #1
|
||||
CMP CursXrl
|
||||
BPL In_Err
|
||||
In_Bchk LDX InBfrMx
|
||||
@ -1176,8 +1159,7 @@ In_Bfr LDX InBfrX
|
||||
STX InBfrX
|
||||
LDX #0
|
||||
STX ChBflip ;reset cursor s=ence
|
||||
JSR CurBplt ;erase cursor
|
||||
RTS
|
||||
JMP CurBplt ;erase cursor
|
||||
In_SvCh JSR In_Bfr
|
||||
LDA NwPChar ;restore new plot char
|
||||
STA PltChar
|
||||
@ -1221,10 +1203,9 @@ In_DEL LDX InBfrX ;get buffer index
|
||||
LDA CursColL ;subtract char width from
|
||||
SBC ChrWdth ;cursor position, to reposition
|
||||
STA CursColL ;cursor one char to the left
|
||||
LDA CursColH
|
||||
SBC #0
|
||||
STA CursColH
|
||||
JSR In_sCur ;save new cursor position
|
||||
BCS +
|
||||
DEC CursColH
|
||||
+ JSR In_sCur ;save new cursor position
|
||||
LDA ChBufr,X ;get char from buffer
|
||||
STA PltChar ;save it
|
||||
LDX #$80
|
||||
@ -1403,13 +1384,10 @@ TCl_15 CMP #$08 ;Ctrl-H left arrow
|
||||
RTS
|
||||
TCl_15a LDA Tikr_Flg
|
||||
BNE TCl_15t ;if not using ticker
|
||||
SEC ;then move cursor left one dot
|
||||
LDA CursColL
|
||||
SBC #1
|
||||
STA CursColL
|
||||
LDA CursColH
|
||||
SBC #0
|
||||
STA CursColH
|
||||
LDA CursColL ;then move cursor left one dot
|
||||
BNE +
|
||||
DEC CursColH
|
||||
+ DEC CursColL
|
||||
SEC
|
||||
LDA CursXl
|
||||
SBC CursColL
|
||||
@ -1474,7 +1452,6 @@ TCl_20 CMP #$0E ;Ctrl-N normal txt mode
|
||||
STA UndTx_Flg
|
||||
STA CtrJs_Flg
|
||||
STA CharRate
|
||||
LDA #0
|
||||
STA BkgColor
|
||||
TCl_XX RTS
|
||||
|
||||
@ -1530,17 +1507,11 @@ Wp_StClr TXA ;restore the alpha char
|
||||
SEC
|
||||
SBC #$30 ;change Chr"#" to Val#
|
||||
AND #$1F ;mask off most letters/chars
|
||||
TAX ;save 'dirty' Val#
|
||||
CMP #$10 ;check of 'dirty' Val#
|
||||
AND #$0F ;strip off low nibble
|
||||
TAY ;save color
|
||||
TXA ;restore Acc
|
||||
AND #$10 ;mask to check of letter
|
||||
BNE Wp_Ashft ;alpha shift to #
|
||||
TYA ;restore color
|
||||
JMP WpClrOk
|
||||
Wp_Ashft TYA ;restor masked 'dirty' val
|
||||
CLC ;which is 'A..F'
|
||||
ADC #9 ;shift to numeric =ivalent
|
||||
BCC WpClrOk ;shift to #
|
||||
Wp_Ashft ;;CLC ;which is 'A..F'
|
||||
ADC #8 ;shift to numeric =ivalent
|
||||
AND #$07 ;mask it to be safe
|
||||
WpClrOk TAX
|
||||
LDA HclrTbl,X
|
||||
@ -1578,6 +1549,7 @@ Wp_CFnt TXA ;restore alpha char
|
||||
SEC
|
||||
SBC #$30 ;change Chr"#" to Val#
|
||||
AND #$03 ;mask off digit
|
||||
;;pf: this CMP is broken
|
||||
CMP #4
|
||||
BEQ Wp_CfDn
|
||||
; STA Slct_Fnt ;store the font selection
|
||||
@ -1597,19 +1569,17 @@ Wp_CfDn RTS ;JMP Wpr_Clr
|
||||
Flg_PsC !byte 0 ;flag: plot separator char
|
||||
;
|
||||
Wp_Tab TXA ;restore alpha char
|
||||
CMP #$30 ;is alpha char < '0'?
|
||||
BMI Wp_CkPrm2 ;if so then ## delimited
|
||||
CMP #$3A ;is alpha char > '9'?
|
||||
SEC
|
||||
SBC #$30 ;attempt to change Chr"#" to Val#
|
||||
BCC Wp_CkPrm2 ;alpha char < '0', so ## delimited
|
||||
CMP #$0A ;is alpha char > '9'?
|
||||
BPL Wp_CkPrm2 ;if so then ## delimited
|
||||
SEC ;else get tab ##
|
||||
SBC #$30 ;change Chr"#" to Val#
|
||||
AND #$0F ;mask off digit
|
||||
LDX Flg_Prm2
|
||||
BNE Wp_Tdg2 ;is 1st of 3 digits?
|
||||
STA Wp_Dig1 ;if so, save in Dig1
|
||||
INC Flg_Prm2 ;inc index of parm digit #
|
||||
RTS
|
||||
Wp_Tdg2 CPX #1
|
||||
Wp_Tdg2 DEX
|
||||
BNE Wp_Tdg3 ;is 2nd of 3 digits?
|
||||
STA Wp_Dig2 ;if so, save in Dig2
|
||||
INC Flg_Prm2 ;inc index of parm digit #
|
||||
@ -1620,12 +1590,12 @@ Wp_CkPrm2 LDX Flg_Prm2 ;check index value
|
||||
BNE Wp_CmbNz ;non-zero number of digits
|
||||
JMP Wp_LdHtVt ;when no digits, load margin
|
||||
;combine the parm digits - from none, up to 3 digits
|
||||
Wp_CmbNz CPX #1
|
||||
Wp_CmbNz DEX
|
||||
BNE Wp_CmbN2 ;is parm single digit?
|
||||
LDA Wp_Dig1
|
||||
STA T1_vLo ;if so, then use it as low byte
|
||||
JMP Wp_CkHtVt ;check hTab/vTab value
|
||||
Wp_CmbN2 CPX #2
|
||||
Wp_CmbN2 DEX
|
||||
BNE Wp_CmbN3 ;is parm 2-digit?
|
||||
LDA Wp_Dig1
|
||||
JSR Wp_Tmx10 ;multiply 1st digit by 10
|
||||
@ -1670,7 +1640,7 @@ Wp_CfHtVt STA Flg_PsC ;set Plot Separator flag
|
||||
BNE Wp_VtVal ;no - then go do vTab
|
||||
LDA T1_vLo ;yes - then hTab
|
||||
;
|
||||
CLC ;hTAB: get param add it to
|
||||
;; CLC ;hTAB: get param add it to
|
||||
ADC CursXl ;left window margin {0..278}
|
||||
STA CursColL ;move plot cursor from the
|
||||
LDA T1_vHi ;left margin to the tab value
|
||||
@ -1715,13 +1685,11 @@ Wp_cRate TXA ;restore alpha char
|
||||
SEC
|
||||
SBC #$30 ;change Chr"#" to Val#
|
||||
AND #$1F ;mask off digit
|
||||
TAX
|
||||
CMP #10 ;digit >9
|
||||
BMI Wp_RvOk ;no - ok
|
||||
SEC
|
||||
SBC #7 ;make A..F be 11..15
|
||||
TAX
|
||||
Wp_RvOk LDA Flg_Prm2 ;is 2nd of 2 digits?
|
||||
Wp_RvOk TAX
|
||||
LDA Flg_Prm2 ;is 2nd of 2 digits?
|
||||
BNE Wp_rCmb ;yes - combine
|
||||
TXA ;no - clamp to {0..F}
|
||||
AND #$0F
|
||||
|
@ -147,7 +147,7 @@ log2_w_w: !zone
|
||||
|
||||
; Same as above but with with 8-bit input instead of 16. Same output though.
|
||||
log2_b_w: !zone
|
||||
cmp #0 ; special case: log(0) we call zero.
|
||||
tax ; special case: log(0) we call zero.
|
||||
beq .zero
|
||||
.low: ; we know high byte is zero
|
||||
ldx #7 ; start with exponent=7
|
||||
@ -159,9 +159,8 @@ log2_b_w: !zone
|
||||
.gotMant: ; mantissa now in A, exponent in X. Translate mantissa to log using table, and we're done
|
||||
tay
|
||||
lda tbl_log2_w_w,y
|
||||
rts
|
||||
.zero: tax
|
||||
rts
|
||||
.zero: rts
|
||||
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; Calculate 2^n for a fixed-point n
|
||||
@ -326,11 +325,11 @@ castRay: !zone
|
||||
sta dist ; is fractional byte of dist.
|
||||
lda mapX ; map X is the integer byte
|
||||
sbc playerX+1
|
||||
tax
|
||||
bit stepX
|
||||
bpl +
|
||||
clc ; if stepping backward, add one to dist
|
||||
adc #1
|
||||
+ sta dist+1
|
||||
inx ; if stepping backward, add one to dist
|
||||
+ stx dist+1
|
||||
ldx rayDirX ; parameters for wall calculation
|
||||
ldy rayDirY
|
||||
lda stepY
|
||||
@ -383,11 +382,11 @@ castRay: !zone
|
||||
sta dist ; is fractional byte of dist.
|
||||
lda mapY ; map X is the integer byte
|
||||
sbc playerY+1
|
||||
tax
|
||||
bit stepY
|
||||
bpl +
|
||||
clc ; if stepping backward, add one to dist
|
||||
adc #1
|
||||
+ sta dist+1
|
||||
inx ; if stepping backward, add one to dist
|
||||
+ stx dist+1
|
||||
ldx rayDirY ; parameters for wall calculation
|
||||
ldy rayDirX
|
||||
lda stepX
|
||||
@ -541,11 +540,11 @@ castRay: !zone
|
||||
ror
|
||||
pha ; stash it on stack (we don't have X reg free yet for indexed store)
|
||||
jsr pow2_w_w ; calculate 2 ^ (log(64) - diff) =~ 64.0 / dist
|
||||
cpx #0
|
||||
tay ; save the height in Y reg
|
||||
txa
|
||||
beq +
|
||||
lda #$FF ; clamp large line heights to 255
|
||||
+ tay ; save the height in Y reg
|
||||
pla ; get the depth back
|
||||
ldy #$FF ; clamp large line heights to 255
|
||||
+ pla ; get the depth back
|
||||
jmp saveLink ; save final column data to link buffer
|
||||
|
||||
!if DEBUG >= 2 {
|
||||
@ -846,14 +845,13 @@ spriteCalc: !zone
|
||||
stx wSize+1
|
||||
|
||||
; Clamp wSize to form lineCt (height of final drawn sprite)
|
||||
cpx #0
|
||||
beq +
|
||||
lda #$FF
|
||||
+ sta lineCt
|
||||
|
||||
; Calculate wSpriteTop = 32 - (wSize >> 1);
|
||||
tay ; stash lo byte of wSize
|
||||
txa ; work on hi byte
|
||||
beq +
|
||||
ldy #$FF
|
||||
+ sty lineCt
|
||||
|
||||
; Calculate wSpriteTop = 32 - (wSize >> 1);
|
||||
lsr ; shift right 1 bit
|
||||
tax ; save hi byte to X
|
||||
tya ; work on lo byte
|
||||
@ -1366,10 +1364,9 @@ makeClrBlit: !zone
|
||||
clc
|
||||
adc #29*2
|
||||
sta pDst
|
||||
lda pDst+1
|
||||
adc #0
|
||||
sta pDst+1
|
||||
iny
|
||||
bcc +
|
||||
inc pDst+1
|
||||
+ iny
|
||||
iny
|
||||
cpy #64
|
||||
bne .noSwitch
|
||||
@ -1443,14 +1440,10 @@ makeDecodeTbls: !zone
|
||||
sta tmp+1
|
||||
; extract only bits 1 and 3 for the pixel data
|
||||
txa
|
||||
and #8 ; bit 3
|
||||
and #$0a ; bits 3 and 1
|
||||
lsr
|
||||
lsr
|
||||
sta tmp
|
||||
txa
|
||||
and #2 ; bit 1
|
||||
lsr
|
||||
ora tmp
|
||||
lsr ; bit 1 -> carry
|
||||
adc #0
|
||||
.decodeTo01:
|
||||
ora tmp+1
|
||||
sta decodeTo01,x
|
||||
@ -1643,11 +1636,11 @@ loadTextures: !zone
|
||||
;-------------------------------------------------------------------------------
|
||||
; Plasma interface to texture control: 1 to load textures, 0 to unload
|
||||
pl_texControl: !zone {
|
||||
cmp #0
|
||||
tax
|
||||
beq .unload
|
||||
lda #0 ; don't re-init scripts
|
||||
jmp loadTextures
|
||||
.unload ldx #0
|
||||
.unload
|
||||
- txa
|
||||
pha
|
||||
ldy texAddrHi,x
|
||||
@ -1966,14 +1959,14 @@ copyScreen: !zone
|
||||
; Parameters: @x, @y
|
||||
; Returns: Nothing (but stores into the addressed variables)
|
||||
pl_getPos: !zone {
|
||||
lda playerY+1
|
||||
sec
|
||||
sbc #1 ; adjust for border guards
|
||||
ldy playerY+1
|
||||
dey ; adjust for border guards
|
||||
tya
|
||||
jsr .sto
|
||||
inx
|
||||
lda playerX+1
|
||||
sec
|
||||
sbc #1 ; adjust for border guards
|
||||
ldy playerX+1
|
||||
dey ; adjust for border guards
|
||||
tya
|
||||
; Now fall thru, and exit with X incremented once (2 params - 1 return slot = 1)
|
||||
.sto ldy evalStkL,x
|
||||
sty pTmp
|
||||
|
@ -304,7 +304,7 @@ LOAD_SCRIPTS_NO_CALC:
|
||||
LDY #5
|
||||
LDA (AVATAR_SECTION),Y ; check script module ID
|
||||
BNE .got ; if any, go load it
|
||||
.none LDA #0 ; else, no scripts
|
||||
.none ;;LDA #0 ; else, no scripts
|
||||
STA SCRIPTS_LOC
|
||||
STA SCRIPTS_LOC+1
|
||||
RTS
|
||||
|
Loading…
x
Reference in New Issue
Block a user