Merge gold

Merge branch 'master' of https://github.com/badvision/lawless-legends
This commit is contained in:
David Schmenk 2016-07-04 09:33:43 -07:00
commit 0df15626d0
8 changed files with 212 additions and 9 deletions

3
.gitignore vendored
View File

@ -45,4 +45,5 @@ mg
# Packer sometimes produces an error text file.
error_stack.txt
/OutlawEditor/OutlawPluginExample/target/
/OutlawEditor/OutlawPluginExample/target/
/Platform/Apple/tools/A2Pack/target/

View File

@ -481,6 +481,10 @@ public class UIAction {
ft.setOnFinished(callback);
ft.play();
}
public static File getCurrentSaveFile() {
return currentSaveFile;
}
private UIAction() {
}

View File

@ -0,0 +1,71 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.badvision</groupId>
<artifactId>A2Pack</artifactId>
<version>0.1</version>
<packaging>bundle</packaging>
<name>A2Pack</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>org.badvision.outlaw.plugin.a2pack</Export-Package>
<Bundle-Activator>org.badvision.outlaw.plugin.a2pack.Activator</Bundle-Activator>
<Export-Service>*</Export-Service>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.22.0</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
<configuration>
<properties>
<service.vendor>8-Bit Bunch</service.vendor>
</properties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.badvision</groupId>
<artifactId>OutlawEditor</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.main</artifactId>
<version>5.4.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,76 @@
package org.badvision.outlaw.plugin.a2pack;
import java.io.File;
import javafx.event.ActionEvent;
import javax.xml.bind.JAXB;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.badvision.outlaweditor.api.ApplicationState;
import org.badvision.outlaweditor.api.MenuAction;
import org.badvision.outlaweditor.ui.UIAction;
import org.osgi.framework.BundleContext;
/**
* This registers a plugin which creates Apple II disk images.
* @author mhaye
*/
@Component(immediate = true)
@Service(MenuAction.class)
public class A2PackPlugin implements MenuAction {
// Note: Because ApplicationState is already a defined service, this will automatically be bound.
// Hence, it is not necessary to worry about passing it it.
@Reference
ApplicationState app;
// This is called when our plugin is starting
@Activate
public void activate() throws Exception {
System.out.println("Hello, menu!");
checkReferences();
}
// This is called when our plugin is stopping
@Deactivate
public void stop(BundleContext bc) throws Exception {
System.out.println("Goodbye, menu!");
}
// This identifies the menu item label
@Override
public String getName() {
return "Build Apple II disk";
}
// This method is called when the user selects the menu item
@Override
public void handle(ActionEvent event)
{
File currentSaveFile = UIAction.getCurrentSaveFile();
if (currentSaveFile == null || !currentSaveFile.exists()) {
UIAction.alert("You must open a world file\nbefore building a disk.");
return;
}
System.out.println("Clicked X!");
JAXB.marshal(ApplicationState.getInstance().getGameData(), System.out);
checkReferences();
UIAction.alert("A2_4evr!");
}
private void checkReferences() {
// app = ApplicationState.getInstance();
if (app == null) {
System.out.println("App is null?!?!");
} else {
if (app.getCurrentPlatform() == null) {
System.out.println("Current platform is null?");
} else {
System.out.println("Current platform is "+app.getCurrentPlatform());
}
}
}
}

View File

@ -0,0 +1,41 @@
package org.badvision.outlaw.plugin.a2pack;
import org.badvision.outlaweditor.api.ApplicationState;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
/**
* This is the activator for the A2Pack plugin, in charge of starting and stopping.
*
* @author mhaye
*/
public class Activator implements BundleActivator {
@Override
public void start(BundleContext bc) throws Exception {
System.out.println("Hello, Apple II packer!");
checkReferences();
}
@Override
public void stop(BundleContext bc) throws Exception {
System.out.println("Goodbye, Apple II packer!");
}
private void checkReferences() {
// Note that our activator is not a component, so we can't use the @Reference
// annotation to inject app automatically. ApplicationState has a convenience
// method to get around this in just such events, but it's a hack.
// Ultimately it's not a good idea to rely on this too much as it follows
// some bad practices behind the scene that leave unclosed references, etc.
// I'll have to come up with a safer way to inject dependencies without
// causing housekeeping issues for OSGi.
ApplicationState app = ApplicationState.getInstance();
if (app == null) {
System.out.println("App is null?!?!");
} else if (app.getCurrentPlatform() == null) {
System.out.println("Current platform is null?");
} else {
System.out.println("Current platform is " + app.getCurrentPlatform());
}
}
}

View File

@ -292,16 +292,21 @@ def _newOrLoadGame()
^$c053
^$25 = 20
puts("\n N)ew game, or L)oad last game? ")
while TRUE
key = rdkey() & $7F
home()
^$c052
if key > $60; key = key - $20; fin
if key > $60; key = key - $20; fin // convert to upper-case
if key == 'N'
newGame(); return 1
elsif key == 'L' and loadInternal()
return 0
^$c052
newGame()
return 1
elsif key == 'L'
^$c052
if loadInternal()
return 0
fin
fin
^$c053
beep()
loop
end

View File

@ -1304,7 +1304,9 @@ def moveForward()
val = advance()
// If not blocked, render at the new position.
if val > 0
if val == 0
beep()
else
if !mapIs3D
doRender()
else

View File

@ -1642,7 +1642,10 @@ loadTextures: !zone
pl_texControl: !zone {
tax
beq .unload
lda #0 ; don't re-init scripts
lda #START_LOAD
ldx #2 ; textures are on disk 2
jsr mainLoader
lda #0 ; don't re-init scripts
jmp loadTextures
.unload
- txa