Compare commits

..

14 Commits

Author SHA1 Message Date
Zukero
84e46ffd20 v0.6.12 released 2018-07-13 19:06:12 +02:00
Zukero
9f5666ea6d Fixed bugs affecting Dialogue's replies, Key Areas and Replace areas
where requirements' negation where lost upon alteration or loading.
2018-07-13 19:03:08 +02:00
Zukero
ae5822703a Fixed harmless NPE in Dialogue editor. 2018-03-26 17:41:42 +02:00
Zukero
9b68ef6679 Added missing "Faction" field to the NPC UI. 2018-03-26 17:14:10 +02:00
Zukero
75d6f8e98f v0.6.11 released. 2018-03-04 15:43:45 +01:00
Zukero
38c206cbaf TMX Maps editor's "Replacement" tab is now called "Testing" and has more
tools.
2018-03-04 15:39:30 +01:00
Zukero
b12ed1802f Added hero sprite rendering to help debug layering issues in
"Replacements" tab of TMX Map editor.
2018-03-04 12:19:56 +01:00
Zukero
0b8bc8448a Fixed memory leaks.
Closed projects were held in memory because the Map folder watcher
threads were still alive.
2018-02-28 16:25:28 +01:00
Zukero
221a031c2b Added support for new spawn area property: ignoreAreas. 2018-02-22 16:25:38 +01:00
Zukero
f2e4767eb0 Fixed export bug multiplying the data. 2018-02-18 11:28:03 +01:00
Zukero
78ceacb0ce Warnings hunt. 2018-02-13 15:26:13 +01:00
Zukero
1604373e6c Fixed icons alignment. 2018-02-13 14:11:42 +01:00
Zukero
6e2ee13da7 Fixed issue where worldmap.xml was unduely included in the generated
loadresources.xml
2018-02-12 14:18:02 +01:00
Zukero
ea28b7475a Fixed non-critical NPE. 2018-02-12 11:40:36 +01:00
26 changed files with 171 additions and 72 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="ATContentStudio/ATCS_v0.6.10.jar"/>
<jar path="ATContentStudio/ATCS_v0.6.12.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/ATContentStudio/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>

View File

@@ -1 +1 @@
v0.6.10
v0.6.11

View File

@@ -1,6 +1,6 @@
!include MUI2.nsh
!define VERSION "0.6.10"
!define VERSION "0.6.12"
!define TRAINER_VERSION "0.1.4"
!define JAVA_BIN "javaw"

View File

@@ -1,6 +1,11 @@
package com.zackehh.siphash;
import static com.zackehh.siphash.SipHashConstants.*;
import static com.zackehh.siphash.SipHashConstants.DEFAULT_C;
import static com.zackehh.siphash.SipHashConstants.DEFAULT_D;
import static com.zackehh.siphash.SipHashConstants.INITIAL_V0;
import static com.zackehh.siphash.SipHashConstants.INITIAL_V1;
import static com.zackehh.siphash.SipHashConstants.INITIAL_V2;
import static com.zackehh.siphash.SipHashConstants.INITIAL_V3;
/**
* Main entry point for SipHash, providing a basic hash

View File

@@ -32,18 +32,18 @@ import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.plaf.FontUIResource;
import prefuse.data.expression.parser.ExpressionParser;
import com.gpl.rpg.atcontentstudio.model.Workspace;
import com.gpl.rpg.atcontentstudio.ui.StudioFrame;
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
import prefuse.data.expression.parser.ExpressionParser;
public class ATContentStudio {
public static final String APP_NAME = "Andor's Trail Content Studio";
public static final String APP_VERSION = "v0.6.10";
public static final String APP_VERSION = "v0.6.12";
public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest";
public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -1,6 +1,7 @@
package com.gpl.rpg.atcontentstudio.model;
import java.awt.Image;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -8,7 +9,6 @@ import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Serializable;
import java.io.StringBufferInputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
@@ -16,12 +16,10 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.swing.tree.TreeNode;
import javax.xml.parsers.DocumentBuilder;
@@ -1129,10 +1127,12 @@ public class Project implements ProjectTreeNode, Serializable {
tmpMapDir.mkdirs();
writtenFiles = new LinkedList<String>();
for (File createdMapFile : createdContent.gameMaps.mapFolder.listFiles()) {
if (createdMapFile.getName().equalsIgnoreCase("worldmap.xml")) continue;
FileUtils.copyFile(createdMapFile, new File(tmpMapDir, createdMapFile.getName()));
writtenFiles.add(createdMapFile.getName());
}
for (File alteredMapFile : alteredContent.gameMaps.mapFolder.listFiles()) {
if (alteredMapFile.getName().equalsIgnoreCase("worldmap.xml")) continue;
FileUtils.copyFile(alteredMapFile, new File(tmpMapDir, alteredMapFile.getName()));
writtenFiles.add(alteredMapFile.getName());
}
@@ -1171,7 +1171,9 @@ public class Project implements ProjectTreeNode, Serializable {
List<String> filenamesToWrite = new LinkedList<String>();
Map<String, List<Map>> dataToWritePerFilename = new LinkedHashMap<String, List<Map>>();
for (JSONElement gde : altered) {
filenamesToWrite.add(gde.jsonFile.getName());
if (!filenamesToWrite.contains(gde.jsonFile.getName())) {
filenamesToWrite.add(gde.jsonFile.getName());
}
}
for (JSONElement gde : created) {
if (!filenamesToWrite.contains(gde.jsonFile.getName())) {
@@ -1311,7 +1313,7 @@ public class Project implements ProjectTreeNode, Serializable {
transformer.transform(input, output);
String tempString = temp.toString();
doc = builder.parse(new StringBufferInputStream(tempString));
doc = builder.parse(new ByteArrayInputStream(tempString.getBytes("UTF-8")));
input = new DOMSource(doc);
transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(
"<?xml version=\"1.0\"?>\r\n" +

View File

@@ -158,7 +158,7 @@ public class WorkspaceSettings {
value = defaultValue;
}
public abstract void readFromJson(Map json);
public abstract void readFromJson(@SuppressWarnings("rawtypes") Map json);
@SuppressWarnings({ "rawtypes", "unchecked" })
public void saveToJson(Map json) {
@@ -188,6 +188,7 @@ public class WorkspaceSettings {
super(id, null);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void saveToJson(Map json) {
if (value != null) json.put(id, value);
@@ -201,6 +202,7 @@ public class WorkspaceSettings {
this.value = this.defaultValue = defaultValue;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void readFromJson(Map json) {
value = new ArrayList<X>();

View File

@@ -172,6 +172,7 @@ public class Requirement extends JSONElement {
case skillLevel:
case spentGold:
case timerElapsed:
case factionScore:
break;
}
if (this.required_obj != null) this.required_obj.addBacklink((GameDataElement) this.parent);
@@ -190,6 +191,7 @@ public class Requirement extends JSONElement {
clone.state = this.state;
clone.required_obj_id = this.required_obj_id;
clone.required_value = this.required_value;
clone.negated = this.negated;
clone.required_obj = this.required_obj;
clone.type = this.type;
if (clone.required_obj != null && parent != null) {

View File

@@ -19,6 +19,7 @@ public class KeyArea extends MapObject {
String requireType = obj.getProperties().getProperty("requireType");
String requireId = obj.getProperties().getProperty("requireId");
String requireValue = obj.getProperties().getProperty("requireValue");
String requireNegation = obj.getProperties().getProperty("requireNegation");
oldSchoolRequirement = false;
if (requireType == null) {
String[] fields = obj.getName().split(":");
@@ -38,7 +39,9 @@ public class KeyArea extends MapObject {
if (requireType != null) requirement.type = Requirement.RequirementType.valueOf(requireType);
requirement.required_obj_id = requireId;
if (requireValue != null) requirement.required_value = Integer.parseInt(requireValue);
if (requireNegation != null) requirement.negated = Boolean.parseBoolean(requireNegation);
requirement.state = GameDataElement.State.parsed;
}
@Override
@@ -98,7 +101,7 @@ public class KeyArea extends MapObject {
public void updateNameFromRequirementChange() {
if (oldSchoolRequirement && Requirement.RequirementType.questProgress.equals(requirement.type) && (requirement.negated == null || !requirement.negated)) {
name = requirement.required_obj_id+":"+((requirement.required_value == null) ? "" : Integer.toString(requirement.required_value));
name = (requirement.negated != null && requirement.negated) ? "NOT " : "" + requirement.required_obj_id+":"+((requirement.required_value == null) ? "" : Integer.toString(requirement.required_value));
} else if (oldSchoolRequirement) {
int i = 0;
String futureName = requirement.type.toString() + "#" + Integer.toString(i);

View File

@@ -20,6 +20,7 @@ public class ReplaceArea extends MapObject {
String requireType = obj.getProperties().getProperty("requireType");
String requireId = obj.getProperties().getProperty("requireId");
String requireValue = obj.getProperties().getProperty("requireValue");
String requireNegation = obj.getProperties().getProperty("requireNegation");
if (requireType == null) {
String[] fields = obj.getName().split(":");
if (fields.length == 2) {
@@ -37,6 +38,7 @@ public class ReplaceArea extends MapObject {
if (requireType != null) requirement.type = Requirement.RequirementType.valueOf(requireType);
requirement.required_obj_id = requireId;
if (requireValue != null) requirement.required_value = Integer.parseInt(requireValue);
if (requireNegation != null) requirement.negated = Boolean.parseBoolean(requireNegation);
requirement.state = GameDataElement.State.parsed;
@@ -112,7 +114,7 @@ public class ReplaceArea extends MapObject {
//Don't use yet !
public void updateNameFromRequirementChange() {
if (oldSchoolRequirement && Requirement.RequirementType.questProgress.equals(requirement.type) && (requirement.negated == null || !requirement.negated)) {
name = requirement.required_obj_id+":"+((requirement.required_value == null) ? "" : Integer.toString(requirement.required_value));
name = (requirement.negated != null && requirement.negated) ? "NOT " : "" + requirement.required_obj_id+":"+((requirement.required_value == null) ? "" : Integer.toString(requirement.required_value));
} else if (oldSchoolRequirement) {
int i = 0;
String futureName = requirement.type.toString() + "#" + Integer.toString(i);

View File

@@ -13,6 +13,7 @@ public class SpawnArea extends MapObject {
public int quantity = 1;
public int spawnchance = 10;
public boolean active = true;
public boolean ignoreAreas = false;
public String spawngroup_id;
public List<NPC> spawnGroup = new ArrayList<NPC>();
@@ -26,6 +27,9 @@ public class SpawnArea extends MapObject {
if (obj.getProperties().getProperty("active") != null) {
this.active = Boolean.parseBoolean(obj.getProperties().getProperty("active"));
}
if (obj.getProperties().getProperty("ignoreAreas") != null) {
this.ignoreAreas = Boolean.parseBoolean(obj.getProperties().getProperty("ignoreAreas"));
}
if (obj.getProperties().getProperty("spawngroup") != null) {
this.spawngroup_id = obj.getProperties().getProperty("spawngroup");
} else if (obj.getName() != null ){
@@ -84,6 +88,9 @@ public class SpawnArea extends MapObject {
if (!this.active) {
tmxObject.getProperties().setProperty("active", Boolean.toString(active));
}
if (this.ignoreAreas) {
tmxObject.getProperties().setProperty("ignoreAreas", Boolean.toString(ignoreAreas));
}
}
}

View File

@@ -38,6 +38,7 @@ public class TMXMap extends GameDataElement {
public static final String GROUND_LAYER_NAME = "Ground";
public static final String OBJECTS_LAYER_NAME = "Objects";
public static final String ABOVE_LAYER_NAME = "Above";
public static final String TOP_LAYER_NAME = "Top";
public static final String WALKABLE_LAYER_NAME = "Walkable";
public enum ColorFilter {
@@ -398,6 +399,7 @@ public class TMXMap extends GameDataElement {
return GROUND_LAYER_NAME.equalsIgnoreCase(name) ||
OBJECTS_LAYER_NAME.equalsIgnoreCase(name) ||
ABOVE_LAYER_NAME.equalsIgnoreCase(name) ||
TOP_LAYER_NAME.equalsIgnoreCase(name) ||
WALKABLE_LAYER_NAME.equalsIgnoreCase(name);
}

View File

@@ -15,6 +15,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.swing.tree.TreeNode;
@@ -99,22 +100,24 @@ public class TMXMapSet implements ProjectTreeNode {
while(getProject().open) {
try {
watchService = FileSystems.getDefault().newWatchService();
WatchKey watchKey = folderPath.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY);
/*WatchKey watchKey = */folderPath.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY);
WatchKey wk;
validService: while(getProject().open) {
wk = watchService.take();
for (WatchEvent<?> event : wk.pollEvents()) {
Path changed = (Path) event.context();
String name = changed.getFileName().toString();
String id = name.substring(0, name.length() - 4);
TMXMap map = getMap(id);
if (map != null) {
map.mapChangedOnDisk();
wk = watchService.poll(10, TimeUnit.SECONDS);
if (wk != null) {
for (WatchEvent<?> event : wk.pollEvents()) {
Path changed = (Path) event.context();
String name = changed.getFileName().toString();
String id = name.substring(0, name.length() - 4);
TMXMap map = getMap(id);
if (map != null) {
map.mapChangedOnDisk();
}
}
if(!wk.reset()) {
watchService.close();
break validService;
}
}
if(!wk.reset()) {
watchService.close();
break validService;
}
}
} catch (IOException e) {

View File

@@ -652,7 +652,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
return gdeBox;
}
public JComboBox<QuestStage> addQuestStageBox(JPanel pane, Project proj, String label, Integer initialValue, boolean writable, final FieldUpdateListener listener, Quest quest, final JComboBox questSelectionBox) {
public JComboBox<QuestStage> addQuestStageBox(JPanel pane, Project proj, String label, Integer initialValue, boolean writable, final FieldUpdateListener listener, Quest quest, @SuppressWarnings("rawtypes") final JComboBox questSelectionBox) {
JPanel gdePane = new JPanel();
gdePane.setLayout(new JideBoxLayout(gdePane, JideBoxLayout.LINE_AXIS, 6));
JLabel gdeLabel = new JLabel(label);
@@ -702,7 +702,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes"})
public JList addBacklinksList(JPanel pane, GameDataElement gde) {
return addBacklinksList(pane, gde, "Elements linking to this one");
}
@@ -866,7 +866,6 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
return currentQuest.stages.get(index - 1);
}
@SuppressWarnings("unchecked")
@Override
public void setSelectedItem(Object anItem) {
selected = (QuestStage) anItem;

View File

@@ -59,6 +59,7 @@ public class WorkspaceActions {
public void actionPerformed(ActionEvent e) {
if (!(selectedNode instanceof Project)) return;
Workspace.closeProject((Project) selectedNode);
selectedNode = null;
};
public void selectionChanged(ProjectTreeNode selectedNode, TreePath[] selectedPaths) {
setEnabled(selectedNode instanceof Project);

View File

@@ -36,6 +36,7 @@ public class ActorConditionEditor extends JSONElementEditor {
private IntegerBasedCheckBox stackingBox;
//private JTextField roundVisualField;
@SuppressWarnings("rawtypes")
private JComboBox roundVisualField;
private JSpinner roundHpMinField;
private JSpinner roundHpMaxField;
@@ -43,6 +44,7 @@ public class ActorConditionEditor extends JSONElementEditor {
private JSpinner roundApMaxField;
//private JTextField fullRoundVisualField;
@SuppressWarnings("rawtypes")
private JComboBox fullRoundVisualField;
private JSpinner fullRoundHpMinField;
private JSpinner fullRoundHpMaxField;

View File

@@ -96,6 +96,7 @@ public class DialogueEditor extends JSONElementEditor {
private JPanel rewardsParamsPane;
private MyComboBox rewardMap;
private JTextField rewardObjId;
@SuppressWarnings("rawtypes")
private JComboBox rewardObjIdCombo;
private MyComboBox rewardObj;
private JComponent rewardValue;
@@ -120,6 +121,7 @@ public class DialogueEditor extends JSONElementEditor {
private JComboBox requirementTypeCombo;
private JPanel requirementParamsPane;
private MyComboBox requirementObj;
@SuppressWarnings("rawtypes")
private JComboBox requirementSkill;
private JTextField requirementObjId;
private JComponent requirementValue;
@@ -695,7 +697,7 @@ public class DialogueEditor extends JSONElementEditor {
removeElementListener(requirementObj);
}
requirementTypeCombo = addEnumValueBox(pane, "Requirement type: ", Requirement.RequirementType.values(), requirement.type, writable, listener);
requirementTypeCombo = addEnumValueBox(pane, "Requirement type: ", Requirement.RequirementType.values(), requirement == null ? null : requirement.type, writable, listener);
requirementParamsPane = new JPanel();
requirementParamsPane.setLayout(new JideBoxLayout(requirementParamsPane, JideBoxLayout.PAGE_AXIS));
updateRequirementParamsEditorPane(requirementParamsPane, requirement, listener);
@@ -712,7 +714,7 @@ public class DialogueEditor extends JSONElementEditor {
removeElementListener(requirementObj);
}
if (requirement.type != null) {
if (requirement != null && requirement.type != null) {
switch (requirement.type) {
case consumedBonemeals:
case spentGold:

View File

@@ -44,7 +44,6 @@ import com.gpl.rpg.atcontentstudio.ui.ScrollablePanel;
import com.gpl.rpg.atcontentstudio.ui.ScrollablePanel.ScrollableSizeHint;
import com.gpl.rpg.atcontentstudio.ui.sprites.SpriteChooser;
import com.jidesoft.swing.JideBoxLayout;
import com.jidesoft.swing.JideScrollPane;
import com.jidesoft.swing.JideTabbedPane;
public abstract class JSONElementEditor extends Editor {
@@ -303,6 +302,7 @@ public abstract class JSONElementEditor extends Editor {
}
@SuppressWarnings("unchecked")
public boolean idChanging() {
JSONElement node = (JSONElement) target;
List<GameDataElement> toModify = new LinkedList<GameDataElement>();

View File

@@ -63,6 +63,7 @@ public class NPCEditor extends JSONElementEditor {
private JTextField idField;
private JTextField nameField;
private JTextField spawnGroupField;
private JTextField factionField;
private JSpinner experienceField;
private MyComboBox dialogueBox;
private MyComboBox droplistBox;
@@ -246,6 +247,7 @@ public class NPCEditor extends JSONElementEditor {
idField = addTextField(pane, "Internal ID: ", npc.id, npc.writable, listener);
nameField = addTranslatableTextField(pane, "Display name: ", npc.name, npc.writable, listener);
spawnGroupField = addTextField(pane, "Spawn group ID: ", npc.spawngroup_id, npc.writable, listener);
factionField = addTextField(pane, "Faction ID: ", npc.faction_id, npc.writable, listener);
experienceField = addIntegerField(pane, "Experience reward: ", npc.getMonsterExperience(), false, false, listener);
dialogueBox = addDialogueBox(pane, npc.getProject(), "Initial phrase: ", npc.dialogue, npc.writable, listener);
droplistBox = addDroplistBox(pane, npc.getProject(), "Droplist / Shop inventory: ", npc.droplist, npc.writable, listener);
@@ -1256,6 +1258,8 @@ public class NPCEditor extends JSONElementEditor {
npcIcon.repaint();
} else if (source == spawnGroupField) {
npc.spawngroup_id = (String) value;
} else if (source == factionField) {
npc.faction_id = (String) value;
} else if (source == dialogueBox) {
if (npc.dialogue != null) {
npc.dialogue.removeBacklink(npc);

View File

@@ -40,8 +40,6 @@ public class QuestEditor extends JSONElementEditor {
private static final long serialVersionUID = 5701667955210615366L;
private static final Integer one = 1;
private static final String form_view_id = "Form";
private static final String json_view_id = "JSON";

View File

@@ -162,6 +162,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
private JComboBox evaluateTriggerBox;
private JSpinner quantityField;
private JCheckBox spawnActiveForNewGame;
private JCheckBox spawnIgnoreAreas;
private JTextField spawngroupField;
@SuppressWarnings("rawtypes")
private JList npcList;
@@ -211,7 +212,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
editorTabsHolder.add("TMX", tmxScroller);
editorTabsHolder.add("XML", xmlScroller);
//editorTabsHolder.add("Replacements", replScroller);
editorTabsHolder.add("Replacements", getReplacementSimulatorPane());
editorTabsHolder.add("Testing", getReplacementSimulatorPane());
}
@@ -629,6 +630,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
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);
spawnActiveForNewGame = addBooleanBasedCheckBox(pane, "Active in a new game: ", ((SpawnArea)selected).active, ((TMXMap)target).writable, listener);
spawnIgnoreAreas = addBooleanBasedCheckBox(pane, "Monsters can walk on other game objects: ", ((SpawnArea)selected).ignoreAreas, ((TMXMap)target).writable, listener);
npcListModel = new SpawnGroupNpcListModel((SpawnArea) selected);
npcList = new JList(npcListModel);
npcList.setCellRenderer(new GDERenderer(true, ((TMXMap)target).writable));
@@ -780,7 +782,11 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
public JPanel getReplacementSimulatorPane() {
JPanel replacementSimulator = new JPanel();
replacementSimulator.setLayout(new JideBoxLayout(replacementSimulator, JideBoxLayout.PAGE_AXIS));
JPanel toolsPane = new JPanel();
toolsPane.setLayout(new JideBoxLayout(toolsPane, JideBoxLayout.LINE_AXIS));
final JCheckBox walkableVisibleBox = new JCheckBox("Show \""+TMXMap.WALKABLE_LAYER_NAME+"\" layer.");
final JCheckBox showHeroBox = new JCheckBox("Show hero on walkable tiles under the mouse pointer.");
final JCheckBox showTooltipBox = new JCheckBox("Show tooltip with stack of tiles.");
JPanel areasActivationPane = new JPanel();
areasActivationPane.setLayout(new JideBoxLayout(areasActivationPane, JideBoxLayout.PAGE_AXIS));
TreeModel areasTreeModel = new ReplaceAreasActivationTreeModel();
@@ -798,10 +804,15 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
activateAndViewPane.add(areasActivationPane, JideBoxLayout.FIX);
activateAndViewPane.add(new JScrollPane(viewer), JideBoxLayout.VARY);
replacementSimulator.add(walkableVisibleBox, JideBoxLayout.FIX);
toolsPane.add(walkableVisibleBox, JideBoxLayout.FIX);
toolsPane.add(showTooltipBox, JideBoxLayout.FIX);
toolsPane.add(showHeroBox, JideBoxLayout.FIX);
toolsPane.add(new JPanel(), JideBoxLayout.VARY);
replacementSimulator.add(toolsPane, JideBoxLayout.FIX);
replacementSimulator.add(activateAndViewPane, JideBoxLayout.VARY);
walkableVisibleBox.setSelected(true);
walkableVisibleBox.setSelected(viewer.showWalkable);
walkableVisibleBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -810,6 +821,21 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
viewer.repaint();
}
});
showHeroBox.setSelected(viewer.showHeroWithMouse);
showHeroBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
viewer.showHeroWithMouse = showHeroBox.isSelected();
}
});
showTooltipBox.setSelected(viewer.showTooltip);
showTooltipBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
viewer.showTooltip = showTooltipBox.isSelected();
}
});
activate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -1993,6 +2019,11 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
SpawnArea area = (SpawnArea) selectedMapObject;
area.active = (Boolean) value;
}
} else if (source == spawnIgnoreAreas) {
if (selectedMapObject instanceof SpawnArea) {
SpawnArea area = (SpawnArea) selectedMapObject;
area.ignoreAreas = (Boolean) value;
}
} else if (source == requirementTypeCombo) {
if (selectedMapObject instanceof KeyArea) {
KeyArea area = (KeyArea) selectedMapObject;
@@ -2176,11 +2207,13 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
private TMXMap map;
public ReplaceArea highlighted = null;
public boolean showWalkable = true;
public boolean showHeroWithMouse = true;
public boolean showTooltip = true;
private OrthogonalRenderer renderer;
private String groundName, objectsName, aboveName, walkableName;
private String groundName, objectsName, aboveName, topName, walkableName;
private Map<String, tiled.core.TileLayer> layersByName = new LinkedHashMap<String, tiled.core.TileLayer>();
private tiled.core.TileLayer ground, objects, above, walkable;
private tiled.core.TileLayer ground, objects, above, top, walkable;
private Map<String, List<ReplaceArea>> replacementsForLayer = new LinkedHashMap<String, List<ReplaceArea>>();
public Map<ReplaceArea, Boolean> activeReplacements = new LinkedHashMap<ReplaceArea, Boolean>();
@@ -2199,8 +2232,9 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
Point oldTooltippedTile = new Point(tooltippedTile);
tooltippedTile.setLocation(e.getX() / 32, e.getY() / 32);
if (!((TMXMap)target).tmxMap.contains(tooltippedTile.x, tooltippedTile.y)) {
if (!showTooltip || !((TMXMap)target).tmxMap.contains(tooltippedTile.x, tooltippedTile.y)) {
if (tooltipActivated) {
//Hides the tooltip...
ToolTipManager.sharedInstance().setEnabled(false);
@@ -2208,12 +2242,16 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
tooltipActivated = false;
}
} else {
if (!tooltipActivated) {
if (showTooltip && !tooltipActivated) {
ToolTipManager.sharedInstance().registerComponent(TMXReplacementViewer.this);
ToolTipManager.sharedInstance().setEnabled(true);
tooltipActivated = true;
}
}
if (showHeroWithMouse && (oldTooltippedTile.x != tooltippedTile.x || oldTooltippedTile.y != tooltippedTile.y) ) {
TMXReplacementViewer.this.revalidate();
TMXReplacementViewer.this.repaint();
}
}
});
@@ -2223,9 +2261,9 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
}
public void init() {
groundName = objectsName = aboveName = walkableName = null;
groundName = objectsName = aboveName = walkableName = topName = null;
layersByName.clear();
ground = objects = above = walkable = null;
ground = objects = above = walkable = top = null;
replacementsForLayer.clear();
for (tiled.core.MapLayer layer : map.tmxMap.getLayers()) {
@@ -2237,6 +2275,8 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
objectsName = layer.getName();
} else if (TMXMap.ABOVE_LAYER_NAME.equalsIgnoreCase(layer.getName())) {
aboveName = layer.getName();
} else if (TMXMap.TOP_LAYER_NAME.equalsIgnoreCase(layer.getName())) {
topName = layer.getName();
} else if (TMXMap.WALKABLE_LAYER_NAME.equalsIgnoreCase(layer.getName())) {
walkableName = layer.getName();
}
@@ -2266,6 +2306,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
ground = mergeReplacements(groundName);
objects = mergeReplacements(objectsName);
above = mergeReplacements(aboveName);
top = mergeReplacements(topName);
walkable = mergeReplacements(walkableName);
}
@@ -2321,10 +2362,18 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
renderer.paintTileLayer(g2d, objects);
}
if (showHeroWithMouse && tooltippedTile != null && ((TMXMap)target).tmxMap.contains(tooltippedTile.x, tooltippedTile.y) &&
walkable != null && walkable.getTileAt(tooltippedTile.x, tooltippedTile.y) == null) {
g2d.drawImage(DefaultIcons.getHeroImage(), tooltippedTile.x * 32, tooltippedTile.y * 32, 32, 32, null);
}
if (above != null) {
renderer.paintTileLayer(g2d, above);
}
if (top != null) {
renderer.paintTileLayer(g2d, top);
}
if (walkable != null && showWalkable) {
renderer.paintTileLayer(g2d, walkable);
}
@@ -2381,10 +2430,12 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
JLabel noTileGround = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
JLabel noTileObjects = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
JLabel noTileAbove = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
JLabel noTileTop = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
{
noTileGround.setPreferredSize(new Dimension(32, 32));
noTileObjects.setPreferredSize(new Dimension(32, 32));
noTileAbove.setPreferredSize(new Dimension(32, 32));
noTileTop.setPreferredSize(new Dimension(32, 32));
}
Point tooltippedTile = new Point();
JToolTip tt = null;
@@ -2406,6 +2457,20 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
if (tooltippedTile != null) {
Image tile;
JLabel label;
if (top != null && top.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) {
tile = top.getTileAt(tooltippedTile.x, tooltippedTile.y).getImage();
} else {
tile = null;
}
if (tile != null) {
label = new JLabel(new ImageIcon(tile));
label.setPreferredSize(new Dimension(32,32));
content.add(label, JideBoxLayout.FIX);
//Fix when (if?) Top is advertised publicly.
// } else {
// content.add(noTileTop, JideBoxLayout.FIX);
}
if (above != null && above.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) {
tile = above.getTileAt(tooltippedTile.x, tooltippedTile.y).getImage();

View File

@@ -316,7 +316,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
@Override
public void mouseClicked(MouseEvent e) {
String selectedMap = null;
boolean update = false;
// boolean update = false;
int x = (int) (e.getX() / mapView.zoomLevel);
int y = (int) (e.getY() / mapView.zoomLevel);
for (String s : mapView.mapLocations.keySet()) {
@@ -333,19 +333,19 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
if (mapView.getSelectedMapsIDs().size() > 1) {
removeFromSelection(selectedMap);
// mapView.selected.remove(selectedMap);
update = true;
// update = true;
}
} else {
addToSelection(selectedMap);
// mapView.selected.add(selectedMap);
update = true;
// update = true;
}
} else {
clearSelection();
// mapView.selected.clear();
addToSelection(selectedMap);
// mapView.selected.add(selectedMap);
update = true;
// update = true;
}
}
} else if (editMode == EditMode.addMap && mapBeingAddedID != null) {
@@ -354,7 +354,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
pushToModel();
}
mapView.updateFromModel();
update = true;
// update = true;
mapBeingAddedID = null;
}
// if (update) {

View File

@@ -85,7 +85,7 @@ public class WorldMapView extends JComponent implements Scrollable {
@Override
public void mouseClicked(MouseEvent e) {
String selectedMap = null;
boolean update = false;
// boolean update = false;
int x = (int) (e.getX() / zoomLevel);
int y = (int) (e.getY() / zoomLevel);
for (String s : mapLocations.keySet()) {

View File

@@ -341,12 +341,12 @@ public class WriterModeEditor extends Editor {
}
Node rNode;
int i = 1;
// int i = 1;
for (WriterModeData.WriterReply reply : dialogue.replies) {
if (reply instanceof EmptyReply && reply.next_dialogue != null) {
if (cells.get(reply.next_dialogue) == null) {
rNode = addDialogueNode(reply.next_dialogue);
Edge e = graph.addEdge(dNode, rNode);
/*Edge e = */graph.addEdge(dNode, rNode);
} else {
rNode = cells.get(reply.next_dialogue);
Edge e = graph.addEdge(dNode, rNode);
@@ -355,7 +355,7 @@ public class WriterModeEditor extends Editor {
} else {
if (cells.get(reply) == null) {
rNode = addReplyNode(reply);
Edge e = graph.addEdge(dNode, rNode);
/*Edge e = */graph.addEdge(dNode, rNode);
// e.setString(LABEL, "#"+i++);
} else {
rNode = cells.get(reply);
@@ -380,7 +380,7 @@ public class WriterModeEditor extends Editor {
if (reply.next_dialogue != null) {
if (cells.get(reply.next_dialogue) == null) {
Node dNode = addDialogueNode(reply.next_dialogue);
Edge e = graph.addEdge(rNode, dNode);
/*Edge e = */graph.addEdge(rNode, dNode);
} else {
Node dNode = cells.get(reply.next_dialogue);
Edge e = graph.addEdge(rNode, dNode);
@@ -665,7 +665,7 @@ public class WriterModeEditor extends Editor {
cells.get(selected).set(LABEL, selected.text);
}
static final String createNextDefaultNodeString = "createNextDefaultNode";
// static final String createNextDefaultNodeString = "createNextDefaultNode";
final AbstractAction createNextDefaultNode = new AbstractAction("Create next default") {
private static final long serialVersionUID = 1658086056088672748L;
@@ -689,7 +689,7 @@ public class WriterModeEditor extends Editor {
}
}
if (newNode!= null) {
Edge edge = graph.addEdge(cells.get(selected), newNode);
/*Edge edge = */graph.addEdge(cells.get(selected), newNode);
setSelected(newWrNode);
m_vis.run("colors");
@@ -732,7 +732,7 @@ public class WriterModeEditor extends Editor {
temp.next_dialogue = newWrNode;
newNode = addDialogueNode(newWrNode);
Edge edge = graph.addEdge(cells.get(selected), newNode);
/*Edge edge = */graph.addEdge(cells.get(selected), newNode);
setSelected(newWrNode);
m_vis.run("colors");
@@ -758,7 +758,7 @@ public class WriterModeEditor extends Editor {
if (selected instanceof WriterReply) {
newWrNode = data.new WriterReply(((WriterReply) selected).parent);
newNode = addReplyNode(newWrNode);
Edge edge = graph.addEdge(cells.get(((WriterReply) selected).parent), newNode);
/*Edge edge = */graph.addEdge(cells.get(((WriterReply) selected).parent), newNode);
setSelected(newWrNode);
m_vis.run("colors");
@@ -903,18 +903,18 @@ public class WriterModeEditor extends Editor {
}
}
public void selectScrollAndEdit(WriterNode node) {
if (node != null) {
setSelected(node);
m_vis.run("colors");
m_vis.run("layout");
m_vis.run("scrollToSelectedAndEdit");
revalidate();
repaint();
}
}
// public void selectScrollAndEdit(WriterNode node) {
// if (node != null) {
// setSelected(node);
//
// m_vis.run("colors");
// m_vis.run("layout");
// m_vis.run("scrollToSelectedAndEdit");
//
// revalidate();
// repaint();
// }
// }