Skip to content

Commit

Permalink
Finish recording functionality and refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
theKidOfArcrania committed May 27, 2017
1 parent 8920126 commit ee36268
Show file tree
Hide file tree
Showing 41 changed files with 1,331 additions and 962 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
**/.idea/workspace.xml
**/.idea/tasks.xml
**/.idea/libraries
**/.idea/dictionaries
**/*.iws
Mission Turtle.iml
/out/
16 changes: 8 additions & 8 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 43 additions & 43 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions Convertor/src/turtle/editor/TMXToMTP.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* TMXToMTP.java
*
* This utility class includes a interactable prompt to help convert TMX files
* This utility class includes a interactive prompt to help convert TMX files
* from "Tiled" into a binary MTP file for the main program to use.
*
* @author Henry
Expand All @@ -45,13 +45,16 @@ public class TMXToMTP {
* Date: 5/6/17
* Period: 2
*/
@SuppressWarnings("javadoc")
public enum LayerType
{
ACTOR(Actor.class), CELL(Cell.class);

private Class<? extends Component> clazz;
private final Class<? extends Component> clazz;

/**
* Constructs a new LayerType
* @param clazz the class referred to.
*/
LayerType(Class<? extends Component> clazz)
{
this.clazz = clazz;
Expand Down Expand Up @@ -288,10 +291,10 @@ public static void loadLayer(Level lvl, TileLayer lay, LayerType type)

for (String prop : tleProps.stringPropertyNames())
{
String sval = tleProps.getProperty(prop);
if (sval.isEmpty())
String sVal = tleProps.getProperty(prop);
if (sVal.isEmpty())
continue;
Object val = parseValue(tleLoc, prop, sval);
Object val = parseValue(tleLoc, prop, sVal);
if (val != null)
props.put(prop, val);
}
Expand All @@ -309,7 +312,7 @@ public static void loadLayer(Level lvl, TileLayer lay, LayerType type)
* @param loc the location string of this value.
* @param prop the property name of this value.
* @param val the value itself
* @return an demarshalled object represented by the string
* @return an unmarshalled object represented by the string
*/
private static Object parseValue(String loc, String prop, String val)
{
Expand Down
2 changes: 1 addition & 1 deletion src/turtle/attributes/AttributeSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class AttributeSet<A extends Attributable>
private static final String GET_PREFIX = "get";
private static final String IS_PREFIX = "is";
private static final String SET_PREFIX = "set";
private static HashMap<Class<?>, Attribute[]> attributeCache = new
private static final HashMap<Class<?>, Attribute[]> attributeCache = new
HashMap<>();
private final Hashtable<String, Attribute> attrs = new Hashtable<>();
private final A attributable;
Expand Down
16 changes: 8 additions & 8 deletions src/turtle/attributes/PrimitiveReflection.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* @author Henry Wang
*/
public class PrimitiveReflection {
private static boolean DEFAULT_BOOLEAN = false;
private static byte DEFAULT_BYTE = 0;
private static char DEFAULT_CHAR = 0;
private static short DEFAULT_SHORT = 0;
private static int DEFAULT_INT = 0;
private static long DEFAULT_LONG = 0;
private static float DEFAULT_FLOAT = 0;
private static double DEFAULT_DOUBLE = 0;
private static final boolean DEFAULT_BOOLEAN = false;
private static final byte DEFAULT_BYTE = 0;
private static final char DEFAULT_CHAR = 0;
private static final short DEFAULT_SHORT = 0;
private static final int DEFAULT_INT = 0;
private static final long DEFAULT_LONG = 0;
private static final float DEFAULT_FLOAT = 0;
private static final double DEFAULT_DOUBLE = 0;

/**
* Obtains the primitive version of the wrapper class.
Expand Down
1 change: 0 additions & 1 deletion src/turtle/comp/Bucket.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import turtle.attributes.NotAttribute;
import turtle.core.Component;

import java.util.Map;
import java.util.Random;

/**
Expand Down
27 changes: 0 additions & 27 deletions src/turtle/comp/Cannon.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import turtle.core.Grid;
import turtle.core.Location;

import java.util.Map;

/**
* Cannon.java
* <p>
Expand Down Expand Up @@ -79,31 +77,6 @@ private void shoot()
parent.placeActor(p);
}

/**
* Sets a series of parameters for this cannon actor. This
* below specifies the list of parameters:
* <table>
* <tr>
* <th>Name</th>
* <th>Type</th>
* <th>Description</th>
* </tr>
* <tr>
* <td><code>heading</code></td>
* <td><code>int</code></td>
* <td>This sets the facing direction of the actor. </td>
* </tr>
* <tr>
* <td><code>period</code></td>
* <td><code>int</code></td>
* <td>This sets number of big frames to wait in between
* shooting consecutive projectiles</td>
* </tr>
* </table>
*
* @param params the parameter object.
*/

/**
* @return the period of firing one projectile
*/
Expand Down
23 changes: 2 additions & 21 deletions src/turtle/comp/Door.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package turtle.comp;

import java.util.Map;
import java.util.function.Predicate;

import turtle.attributes.NotAttribute;
import turtle.core.Actor;
import turtle.core.Component;
Expand Down Expand Up @@ -122,24 +119,8 @@ public boolean interact(Actor other)
{
if (other instanceof Player)
{
/**
* Searches for a key that matches this color.
*/
Item itm = ((Player) other).useItem(new Predicate<Item>()
{

/**
* Tests whether if this item will be usable to this door.
* @param t the item to test.
* @return true if it works, false if it doesn't.
*/
@Override
public boolean test(Item t)
{
return t instanceof Key && ((Key) t).getColor() ==
getColor();
}
});
Item itm = ((Player) other).useItem(
t -> t instanceof Key && ((Key) t).getColor() == getColor());
return itm != null;
}
return false;
Expand Down
3 changes: 1 addition & 2 deletions src/turtle/comp/Factory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import turtle.core.*;

import java.lang.reflect.Field;
import java.util.Map;

import static turtle.core.Actor.*;

Expand Down Expand Up @@ -55,7 +54,7 @@ public Factory()
clonedImg = new ImageView();
clonedImg.setFitHeight(size);
clonedImg.setFitWidth(size);
clonedImg.setImage(ts.getImageset());
clonedImg.setImage(ts.getImageSet());
clonedImg.setViewport(ts.frameAt(-1));
this.getChildren().add(clonedImg);

Expand Down
2 changes: 0 additions & 2 deletions src/turtle/comp/Hint.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import turtle.core.Component;
import turtle.core.DominanceLevel;

import java.util.Map;

/**
* Hint.java
* <p>
Expand Down
2 changes: 1 addition & 1 deletion src/turtle/comp/ItemSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public boolean addItem(Item itm)
if (items.size() == 0)
{
TileSet ts = itm.getTileSet();
itemRep.setImage(ts.getImageset());
itemRep.setImage(ts.getImageSet());
itemRep.setViewport(ts.frameAt(itm.getItemImage()));
} else if (!items.get(0).identical(itm))
return false;
Expand Down
2 changes: 0 additions & 2 deletions src/turtle/comp/Key.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package turtle.comp;

import java.util.Map;

/**
* Key.java
* <p>
Expand Down
Loading

0 comments on commit ee36268

Please sign in to comment.