From 830e9de56b72793f3d527fd7d9dac2db2d417eaa Mon Sep 17 00:00:00 2001 From: Zukero Date: Mon, 18 Jul 2016 18:55:16 +0200 Subject: [PATCH] v0.4.5 to cope with changes to spawnareas definition in game code. replaced gcode references by github repo. --- .../gpl/rpg/atcontentstudio/ATContentStudio.java | 2 +- .../rpg/atcontentstudio/model/maps/KeyArea.java | 2 +- .../rpg/atcontentstudio/model/maps/SpawnArea.java | 13 +++++++++++-- .../gpl/rpg/atcontentstudio/ui/AboutEditor.java | 2 +- .../rpg/atcontentstudio/ui/WorkspaceActions.java | 8 ++++---- .../rpg/atcontentstudio/ui/map/TMXMapEditor.java | 14 +++++++++++++- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java b/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java index 8e42342..2a56f54 100644 --- a/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java +++ b/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java @@ -18,7 +18,7 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector; public class ATContentStudio { public static final String APP_NAME = "Andor's Trail Content Studio"; - public static final String APP_VERSION = "v0.4.4"; + public static final String APP_VERSION = "v0.4.5"; public static boolean STARTED = false; public static StudioFrame frame = null; diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/KeyArea.java b/src/com/gpl/rpg/atcontentstudio/model/maps/KeyArea.java index 55d839e..58ee1e6 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/maps/KeyArea.java +++ b/src/com/gpl/rpg/atcontentstudio/model/maps/KeyArea.java @@ -35,7 +35,7 @@ public class KeyArea extends MapObject { oldSchoolRequirement = false; } requirement = new Requirement(); - requirement.type = Requirement.RequirementType.valueOf(requireType); + if (requireType != null) requirement.type = Requirement.RequirementType.valueOf(requireType); requirement.required_obj_id = requireId; if (requireValue != null) requirement.required_value = Integer.parseInt(requireValue); requirement.state = GameDataElement.State.parsed; diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/SpawnArea.java b/src/com/gpl/rpg/atcontentstudio/model/maps/SpawnArea.java index cee18b1..e0f8e33 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/maps/SpawnArea.java +++ b/src/com/gpl/rpg/atcontentstudio/model/maps/SpawnArea.java @@ -13,6 +13,7 @@ public class SpawnArea extends MapObject { public int quantity = 1; public int spawnchance = 10; public boolean active = true; + public String spawngroup_id; public List spawnGroup = new ArrayList(); public SpawnArea(tiled.core.MapObject obj) { @@ -25,12 +26,17 @@ public class SpawnArea extends MapObject { if (obj.getProperties().getProperty("active") != null) { this.active = Boolean.parseBoolean(obj.getProperties().getProperty("active")); } + if (obj.getProperties().getProperty("spawngroup") != null) { + this.spawngroup_id = obj.getProperties().getProperty("spawngroup"); + } else if (obj.getName() != null ){ + this.spawngroup_id = obj.getName(); + } } @Override public void link() { - if (name != null) { - spawnGroup = parentMap.getProject().getSpawnGroup(name); + if (spawngroup_id != null) { + spawnGroup = parentMap.getProject().getSpawnGroup(spawngroup_id); } else { spawnGroup = new ArrayList(); } @@ -65,6 +71,9 @@ public class SpawnArea extends MapObject { @Override public void savePropertiesInTmxObject(tiled.core.MapObject tmxObject) { + if (spawngroup_id != null) { + tmxObject.getProperties().setProperty("spawngroup", spawngroup_id); + } if (quantity != 1) { tmxObject.getProperties().setProperty("quantity", Integer.toString(quantity)); } diff --git a/src/com/gpl/rpg/atcontentstudio/ui/AboutEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/AboutEditor.java index 63a94d5..2e644d0 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/AboutEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/AboutEditor.java @@ -36,7 +36,7 @@ public class AboutEditor extends Editor { "
" + "Play Andor's Trail for free on your Android device.
" + "Visit the official forum to give or receive help.
" + - "Open the project's Google Code page to check out the game's source code.
" + + "Open the project's GitHub project page to check out the game's source code.
" + "
" + "For content creation help, make sure to use the following resources:
" + "The contribution guide on the forums
" + diff --git a/src/com/gpl/rpg/atcontentstudio/ui/WorkspaceActions.java b/src/com/gpl/rpg/atcontentstudio/ui/WorkspaceActions.java index eb10efe..035dcbd 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/WorkspaceActions.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/WorkspaceActions.java @@ -370,7 +370,7 @@ public class WorkspaceActions { } @Override - public void putValue(String key, Object value) { + public synchronized void putValue(String key, Object value) { PropertyChangeEvent event = new PropertyChangeEvent(this, key, values.get(key), value); values.put(key, value); for (PropertyChangeListener l : listeners) { @@ -379,7 +379,7 @@ public class WorkspaceActions { } @Override - public void setEnabled(boolean b) { + public synchronized void setEnabled(boolean b) { PropertyChangeEvent event = new PropertyChangeEvent(this, "enabled", isEnabled(), b); enabled = b; for (PropertyChangeListener l : listeners) { @@ -395,12 +395,12 @@ public class WorkspaceActions { private Set listeners = new HashSet(); @Override - public void addPropertyChangeListener(PropertyChangeListener listener) { + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { listeners.add(listener); } @Override - public void removePropertyChangeListener(PropertyChangeListener listener) { + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { listeners.remove(listener); } diff --git a/src/com/gpl/rpg/atcontentstudio/ui/map/TMXMapEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/map/TMXMapEditor.java index bb4d205..5a0b639 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/map/TMXMapEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/map/TMXMapEditor.java @@ -147,6 +147,7 @@ public class TMXMapEditor extends Editor { private JComboBox evaluateTriggerBox; private JSpinner quantityField; private JCheckBox activeForNewGame; + private JTextField spawngroupField; private JList npcList; private SpawnGroupNpcListModel npcListModel; @@ -546,7 +547,8 @@ public class TMXMapEditor extends Editor { } else if (selected instanceof SignArea) { dialogueBox = addDialogueBox(pane, ((TMXMap)target).getProject(), "Message: ", ((SignArea)selected).dialogue, ((TMXMap)target).writable, listener); } else if (selected instanceof SpawnArea) { - areaField = addTextField(pane, "Spawn group ID: ", ((SpawnArea)selected).name, ((TMXMap)target).writable, listener); + areaField = addTextField(pane, "Spawn area ID: ", ((SpawnArea)selected).name, ((TMXMap)target).writable, listener); + spawngroupField = addTextField(pane, "Spawn group ID: ", ((SpawnArea)selected).spawngroup_id, ((TMXMap)target).writable, listener); quantityField = addIntegerField(pane, "Number of spawned NPCs: ", ((SpawnArea)selected).quantity, false, ((TMXMap)target).writable, listener); activeForNewGame = addBooleanBasedCheckBox(pane, "Active in a new game: ", ((SpawnArea)selected).active, ((TMXMap)target).writable, listener); npcListModel = new SpawnGroupNpcListModel((SpawnArea) selected); @@ -1690,6 +1692,16 @@ public class TMXMapEditor extends Editor { tmxViewer.revalidate(); tmxViewer.repaint(); } else if (source == areaField) { + if (selectedMapObject instanceof SpawnArea) { + SpawnArea area = (SpawnArea)selectedMapObject; + area.name = (String) value; + groupObjectsListModel.objectChanged(area); + } else if (selectedMapObject instanceof MapChange) { + MapChange area = (MapChange) selectedMapObject; + area.name = (String) value; + groupObjectsListModel.objectChanged(area); + } + } else if (source == spawngroupField) { if (selectedMapObject instanceof SpawnArea) { SpawnArea area = (SpawnArea)selectedMapObject; if (area.spawnGroup != null && !area.spawnGroup.isEmpty()) {