Compare commits

...

4 Commits

Author SHA1 Message Date
Zukero
49f19abb91 Forgot the necessary cleanup of old jars in windows NSIS version. 2017-04-03 17:57:03 +02:00
Zukero
300b7bbbdd Fixed caching issue with spritesheet chooser. Improved actor condition
management for items.
2017-04-03 17:53:44 +02:00
Zukero
bbee5bef25 Bug fix regarding object groups and spawn areas "active in a new game"
parameter.
2017-03-31 09:29:53 +02:00
Zukero
1fc1cef233 Fixed issue with batch scripts being overly painful to use, and have
horrible quoting and escaping rules.
2017-03-06 18:01:05 +01:00
12 changed files with 274 additions and 58 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc> <jardesc>
<jar path="ATContentStudio/ATCS_v0.5.2.jar"/> <jar path="ATContentStudio/ATCS_v0.5.3.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"/> <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"/> <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/> <selectedProjects/>

View File

@@ -1,20 +1,20 @@
@echo off @echo off
set ATCS_DIR=%~dp0 set "ATCS_DIR=%~dp0"
set MAX_MEM=512M set "MAX_MEM=512M"
set CP=%ATCS_DIR%lib\* set "CP=%ATCS_DIR%lib\*"
set JAVA=javaw.exe set "JAVA=javaw.exe"
set JAVA_OPTS= set "JAVA_OPTS="
set ENV_FILE=%ATCS_DIR%ATCS.env.bat set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"
set MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio set "MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio"
if exist "%ENV_FILE%" ( if exist "%ENV_FILE%" (
call "%ENV_FILE%" call "%ENV_FILE%"
) else ( ) else (
echo REM set MAX_MEM=%MAX_MEM% > "%ENV_FILE%" echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"
echo REM set JAVA=%JAVA% >> "%ENV_FILE%" echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"
echo REM set JAVA_OPTS=%JAVA_OPTS% >> "%ENV_FILE%" echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"
echo. >> "%ENV_FILE%" echo.>>"%ENV_FILE%"
) )
start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -cp "%CP%" %MAIN_CLASS% start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -cp "%CP%" %MAIN_CLASS%

View File

@@ -1,20 +1,20 @@
@echo off @echo off
set ATCS_DIR=%~dp0 set "ATCS_DIR=%~dp0"
set MAX_MEM=512M set "MAX_MEM=512M"
set CP=%ATCS_DIR%lib\* set "CP=%ATCS_DIR%lib\*"
set JAVA=javaw.exe set "JAVA=javaw.exe"
set JAVA_OPTS= set "JAVA_OPTS="
set ENV_FILE=%ATCS_DIR%ATCS.env.bat set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"
set MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio set "MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio"
if exist "%ENV_FILE%" ( if exist "%ENV_FILE%" (
call "%ENV_FILE%" call "%ENV_FILE%"
) else ( ) else (
echo REM set MAX_MEM=%MAX_MEM% > "%ENV_FILE%" echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"
echo REM set JAVA=%JAVA% >> "%ENV_FILE%" echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"
echo REM set JAVA_OPTS=%JAVA_OPTS% >> "%ENV_FILE%" echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"
echo. >> "%ENV_FILE%" echo.>>"%ENV_FILE%"
) )
start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -cp "%CP%" %MAIN_CLASS% start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -cp "%CP%" %MAIN_CLASS%

View File

@@ -1,6 +1,6 @@
!include MUI2.nsh !include MUI2.nsh
!define VERSION "0.5.2" !define VERSION "0.5.3"
!define TRAINER_VERSION "0.1.3" !define TRAINER_VERSION "0.1.3"
!define JAVA_BIN "javaw" !define JAVA_BIN "javaw"
@@ -55,26 +55,28 @@ Section install
SetOutPath $INSTDIR SetOutPath $INSTDIR
file "ATCS.ico" file "ATCS.ico"
Delete "$INSTDIR\lib\*"
Call GetJRE Call GetJRE
Pop $R0 Pop $R0
FileOpen $9 "ATCS.cmd" w FileOpen $9 "ATCS.cmd" w
FileWrite $9 '@echo off$\r$\n' FileWrite $9 '@echo off$\r$\n'
FileWrite $9 '$\r$\n' FileWrite $9 '$\r$\n'
FileWrite $9 'set ATCS_DIR=%~dp0$\r$\n' FileWrite $9 'set "ATCS_DIR=%~dp0"$\r$\n'
FileWrite $9 'set MAX_MEM=512M$\r$\n' FileWrite $9 'set "MAX_MEM=512M"$\r$\n'
FileWrite $9 'set CP=%ATCS_DIR%lib\*$\r$\n' FileWrite $9 'set "CP=%ATCS_DIR%lib\*"$\r$\n'
FileWrite $9 'set JAVA=$R0$\r$\n' FileWrite $9 'set "JAVA=$R0"$\r$\n'
FileWrite $9 'set JAVA_OPTS=$\r$\n' FileWrite $9 'set "JAVA_OPTS="$\r$\n'
FileWrite $9 'set ENV_FILE=%ATCS_DIR%ATCS.env.bat$\r$\n' FileWrite $9 'set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"$\r$\n'
FileWrite $9 'set MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio$\r$\n' FileWrite $9 'set "MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio"$\r$\n'
FileWrite $9 '$\r$\n' FileWrite $9 '$\r$\n'
FileWrite $9 'if exist "%ENV_FILE%" ($\r$\n' FileWrite $9 'if exist "%ENV_FILE%" ($\r$\n'
FileWrite $9 ' call "%ENV_FILE%"$\r$\n' FileWrite $9 ' call "%ENV_FILE%"$\r$\n'
FileWrite $9 ') else ($\r$\n' FileWrite $9 ') else ($\r$\n'
FileWrite $9 ' echo REM set MAX_MEM=%MAX_MEM% > "%ENV_FILE%"$\r$\n' FileWrite $9 ' echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"$\r$\n'
FileWrite $9 ' echo REM set JAVA=%JAVA% >> "%ENV_FILE%"$\r$\n' FileWrite $9 ' echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"$\r$\n'
FileWrite $9 ' echo REM set JAVA_OPTS=%JAVA_OPTS% >> "%ENV_FILE%"$\r$\n' FileWrite $9 ' echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"$\r$\n'
FileWrite $9 ' echo. >> "%ENV_FILE%"$\r$\n' FileWrite $9 ' echo.>>"%ENV_FILE%"$\r$\n'
FileWrite $9 ')$\r$\n' FileWrite $9 ')$\r$\n'
FileWrite $9 '$\r$\n' FileWrite $9 '$\r$\n'
FileWrite $9 'start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -cp "%CP%" %MAIN_CLASS%$\r$\n' FileWrite $9 'start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -cp "%CP%" %MAIN_CLASS%$\r$\n'

View File

@@ -22,7 +22,7 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
public class ATContentStudio { public class ATContentStudio {
public static final String APP_NAME = "Andor's Trail Content Studio"; public static final String APP_NAME = "Andor's Trail Content Studio";
public static final String APP_VERSION = "v0.5.2"; public static final String APP_VERSION = "v0.5.3";
public static boolean STARTED = false; public static boolean STARTED = false;
public static StudioFrame frame = null; public static StudioFrame frame = null;

View File

@@ -665,6 +665,26 @@ public class Project implements ProjectTreeNode, Serializable {
return sheet; return sheet;
} }
public int getSpritesheetCount() {
return createdContent.gameSprites.spritesheets.size() + baseContent.gameSprites.spritesheets.size();
}
public Spritesheet getSpritesheet(int index) {
if (index < createdContent.gameSprites.spritesheets.size()) {
return createdContent.gameSprites.spritesheets.get(index);
} else if (index < getQuestCount()){
return getSpritesheet(baseContent.gameSprites.spritesheets.get(index - createdContent.gameSprites.spritesheets.size()).id);
}
return null;
}
public int getSpritesheetIndex(Spritesheet spritesheet) {
if (spritesheet.getDataType() == GameSource.Type.created) {
return createdContent.gameSprites.spritesheets.indexOf(spritesheet);
} else {
return createdContent.gameSprites.spritesheets.size() + baseContent.gameSprites.spritesheets.indexOf(baseContent.gameSprites.getSpritesheet(spritesheet.id));
}
}
public TMXMap getMap(String id) { public TMXMap getMap(String id) {
TMXMap map = createdContent.gameMaps.getMap(id); TMXMap map = createdContent.gameMaps.getMap(id);

View File

@@ -110,7 +110,7 @@ public class WorkspaceSettings {
return; return;
} }
json.put(VERSION_KEY, ATContentStudio.APP_VERSION); json.put(VERSION_KEY, SETTINGS_VERSION);
StringWriter writer = new JsonPrettyWriter(); StringWriter writer = new JsonPrettyWriter();
try { try {
JSONObject.writeJSONString(json, writer); JSONObject.writeJSONString(json, writer);

View File

@@ -21,6 +21,8 @@ public class ActorCondition extends JSONElement {
private static final long serialVersionUID = -3969824899972048507L; private static final long serialVersionUID = -3969824899972048507L;
public static final Integer CLEAR_AC_MAGNITUDE = -99;
// Available from init state // Available from init state
//public String id; inherited. //public String id; inherited.
public String icon_id; public String icon_id;

View File

@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import javax.swing.ButtonGroup;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JButton; import javax.swing.JButton;
@@ -15,6 +16,7 @@ import javax.swing.JComponent;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JSpinner; import javax.swing.JSpinner;
import javax.swing.JTextField; import javax.swing.JTextField;
@@ -98,6 +100,8 @@ public class ItemEditor extends JSONElementEditor {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private JList hitSourceConditionsList; private JList hitSourceConditionsList;
private MyComboBox hitSourceConditionBox; private MyComboBox hitSourceConditionBox;
private JRadioButton hitSourceConditionClear;
private JRadioButton hitSourceConditionApply;
private JSpinner hitSourceConditionMagnitude; private JSpinner hitSourceConditionMagnitude;
private JSpinner hitSourceConditionDuration; private JSpinner hitSourceConditionDuration;
private JSpinner hitSourceConditionChance; private JSpinner hitSourceConditionChance;
@@ -105,6 +109,8 @@ public class ItemEditor extends JSONElementEditor {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private JList hitTargetConditionsList; private JList hitTargetConditionsList;
private MyComboBox hitTargetConditionBox; private MyComboBox hitTargetConditionBox;
private JRadioButton hitTargetConditionClear;
private JRadioButton hitTargetConditionApply;
private JSpinner hitTargetConditionMagnitude; private JSpinner hitTargetConditionMagnitude;
private JSpinner hitTargetConditionDuration; private JSpinner hitTargetConditionDuration;
private JSpinner hitTargetConditionChance; private JSpinner hitTargetConditionChance;
@@ -119,6 +125,8 @@ public class ItemEditor extends JSONElementEditor {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private JList killSourceConditionsList; private JList killSourceConditionsList;
private MyComboBox killSourceConditionBox; private MyComboBox killSourceConditionBox;
private JRadioButton killSourceConditionClear;
private JRadioButton killSourceConditionApply;
private JSpinner killSourceConditionMagnitude; private JSpinner killSourceConditionMagnitude;
private JSpinner killSourceConditionDuration; private JSpinner killSourceConditionDuration;
private JSpinner killSourceConditionChance; private JSpinner killSourceConditionChance;
@@ -461,55 +469,169 @@ public class ItemEditor extends JSONElementEditor {
} }
public void updateHitSourceTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, FieldUpdateListener listener) { public void updateHitSourceTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, final FieldUpdateListener listener) {
pane.removeAll(); pane.removeAll();
if (hitSourceConditionBox != null) { if (hitSourceConditionBox != null) {
removeElementListener(hitSourceConditionBox); removeElementListener(hitSourceConditionBox);
} }
if (condition == null) {
pane.revalidate();
pane.repaint();
return;
}
boolean writable = ((Item)target).writable; boolean writable = ((Item)target).writable;
Project proj = ((Item)target).getProject(); Project proj = ((Item)target).getProject();
hitSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener); hitSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
hitSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener);
hitSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
hitSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener); hitSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
hitSourceConditionApply = new JRadioButton("Apply new condition");
pane.add(hitSourceConditionApply, JideBoxLayout.FIX);
hitSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener);
hitSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
hitSourceConditionClear = new JRadioButton("Clear active condition");
pane.add(hitSourceConditionClear, JideBoxLayout.FIX);
ButtonGroup radioGroup = new ButtonGroup();
radioGroup.add(hitSourceConditionApply);
radioGroup.add(hitSourceConditionClear);
if (condition != null && condition.magnitude != null && condition.magnitude == ActorCondition.CLEAR_AC_MAGNITUDE) {
hitSourceConditionClear.setSelected(true);
hitSourceConditionApply.setSelected(false);
hitSourceConditionMagnitude.setEnabled(false);
hitSourceConditionDuration.setEnabled(false);
} else {
hitSourceConditionClear.setSelected(false);
hitSourceConditionApply.setSelected(true);
hitSourceConditionMagnitude.setEnabled(true);
hitSourceConditionDuration.setEnabled(true);
}
hitSourceConditionClear.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
listener.valueChanged(hitSourceConditionClear, new Boolean(hitSourceConditionClear.isSelected()));
}
});
hitSourceConditionApply.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
listener.valueChanged(hitSourceConditionApply, new Boolean(hitSourceConditionApply.isSelected()));
}
});
pane.revalidate(); pane.revalidate();
pane.repaint(); pane.repaint();
} }
public void updateHitTargetTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, FieldUpdateListener listener) { public void updateHitTargetTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, final FieldUpdateListener listener) {
pane.removeAll(); pane.removeAll();
if (hitTargetConditionBox != null) { if (hitTargetConditionBox != null) {
removeElementListener(hitTargetConditionBox); removeElementListener(hitTargetConditionBox);
} }
if (condition == null) {
pane.revalidate();
pane.repaint();
return;
}
boolean writable = ((Item)target).writable; boolean writable = ((Item)target).writable;
Project proj = ((Item)target).getProject(); Project proj = ((Item)target).getProject();
hitTargetConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener); hitTargetConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
hitTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener);
hitTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
hitTargetConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener); hitTargetConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
hitTargetConditionApply = new JRadioButton("Apply new condition");
pane.add(hitTargetConditionApply, JideBoxLayout.FIX);
hitTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener);
hitTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
hitTargetConditionClear = new JRadioButton("Clear active condition");
pane.add(hitTargetConditionClear, JideBoxLayout.FIX);
ButtonGroup radioGroup = new ButtonGroup();
radioGroup.add(hitTargetConditionApply);
radioGroup.add(hitTargetConditionClear);
if (condition != null && condition.magnitude != null && condition.magnitude == ActorCondition.CLEAR_AC_MAGNITUDE) {
hitTargetConditionClear.setSelected(true);
hitTargetConditionApply.setSelected(false);
hitTargetConditionMagnitude.setEnabled(false);
hitTargetConditionDuration.setEnabled(false);
} else {
hitTargetConditionClear.setSelected(false);
hitTargetConditionApply.setSelected(true);
hitTargetConditionMagnitude.setEnabled(true);
hitTargetConditionDuration.setEnabled(true);
}
hitTargetConditionClear.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
listener.valueChanged(hitTargetConditionClear, new Boolean(hitTargetConditionClear.isSelected()));
}
});
hitTargetConditionApply.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
listener.valueChanged(hitTargetConditionApply, new Boolean(hitTargetConditionApply.isSelected()));
}
});
pane.revalidate(); pane.revalidate();
pane.repaint(); pane.repaint();
} }
public void updateKillSourceTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, FieldUpdateListener listener) { public void updateKillSourceTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, final FieldUpdateListener listener) {
pane.removeAll(); pane.removeAll();
if (killSourceConditionBox != null) { if (killSourceConditionBox != null) {
removeElementListener(killSourceConditionBox); removeElementListener(killSourceConditionBox);
} }
if (condition == null) {
pane.revalidate();
pane.repaint();
return;
}
boolean writable = ((Item)target).writable; boolean writable = ((Item)target).writable;
Project proj = ((Item)target).getProject(); Project proj = ((Item)target).getProject();
killSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener); killSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
killSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener);
killSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
killSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener); killSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
killSourceConditionApply = new JRadioButton("Apply new condition");
pane.add(killSourceConditionApply, JideBoxLayout.FIX);
killSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener);
killSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
killSourceConditionClear = new JRadioButton("Clear active condition");
pane.add(killSourceConditionClear, JideBoxLayout.FIX);
ButtonGroup radioGroup = new ButtonGroup();
radioGroup.add(killSourceConditionApply);
radioGroup.add(killSourceConditionClear);
if (condition != null && condition.magnitude != null && condition.magnitude == ActorCondition.CLEAR_AC_MAGNITUDE) {
killSourceConditionClear.setSelected(true);
killSourceConditionApply.setSelected(false);
killSourceConditionMagnitude.setEnabled(false);
killSourceConditionDuration.setEnabled(false);
} else {
killSourceConditionClear.setSelected(false);
killSourceConditionApply.setSelected(true);
killSourceConditionMagnitude.setEnabled(true);
killSourceConditionDuration.setEnabled(true);
}
killSourceConditionClear.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
listener.valueChanged(killSourceConditionClear, new Boolean(killSourceConditionClear.isSelected()));
}
});
killSourceConditionApply.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
listener.valueChanged(killSourceConditionApply, new Boolean(killSourceConditionApply.isSelected()));
}
});
pane.revalidate(); pane.revalidate();
pane.repaint(); pane.repaint();
} }
@@ -519,6 +641,11 @@ public class ItemEditor extends JSONElementEditor {
if (equipConditionBox != null) { if (equipConditionBox != null) {
removeElementListener(equipConditionBox); removeElementListener(equipConditionBox);
} }
if (condition == null) {
pane.revalidate();
pane.repaint();
return;
}
boolean writable = ((Item)target).writable; boolean writable = ((Item)target).writable;
Project proj = ((Item)target).getProject(); Project proj = ((Item)target).getProject();
@@ -666,7 +793,11 @@ public class ItemEditor extends JSONElementEditor {
if (effect.condition != null) { if (effect.condition != null) {
label.setIcon(new ImageIcon(effect.condition.getIcon())); label.setIcon(new ImageIcon(effect.condition.getIcon()));
label.setText(effect.chance+"% chances to give "+effect.duration+" rounds of "+effect.condition.getDesc()+" x"+effect.magnitude); if (effect.magnitude == ActorCondition.CLEAR_AC_MAGNITUDE) {
label.setText(effect.chance+"% chances to clear "+effect.condition.getDesc());
} else {
label.setText(effect.chance+"% chances to give "+effect.duration+" rounds of "+effect.condition.getDesc()+" x"+effect.magnitude);
}
} else { } else {
label.setText("New, undefined actor condition effect."); label.setText("New, undefined actor condition effect.");
} }
@@ -984,6 +1115,20 @@ public class ItemEditor extends JSONElementEditor {
} }
hitSourceConditionsModel.itemChanged(selectedHitEffectSourceCondition); hitSourceConditionsModel.itemChanged(selectedHitEffectSourceCondition);
updateHit = true; updateHit = true;
} else if (source == hitSourceConditionClear) {
selectedHitEffectSourceCondition.magnitude = ActorCondition.CLEAR_AC_MAGNITUDE;
selectedHitEffectSourceCondition.duration = null;
hitSourceConditionMagnitude.setEnabled(false);
hitSourceConditionDuration.setEnabled(false);
hitSourceConditionsModel.itemChanged(selectedHitEffectSourceCondition);
updateHit = true;
} else if (source == hitSourceConditionApply) {
selectedHitEffectSourceCondition.magnitude = 0;
selectedHitEffectSourceCondition.duration = 0;
hitSourceConditionMagnitude.setEnabled(true);
hitSourceConditionDuration.setEnabled(true);
hitSourceConditionsModel.itemChanged(selectedHitEffectSourceCondition);
updateHit = true;
} else if (source == hitSourceConditionMagnitude) { } else if (source == hitSourceConditionMagnitude) {
selectedHitEffectSourceCondition.magnitude = (Integer) value; selectedHitEffectSourceCondition.magnitude = (Integer) value;
hitSourceConditionsModel.itemChanged(selectedHitEffectSourceCondition); hitSourceConditionsModel.itemChanged(selectedHitEffectSourceCondition);
@@ -1011,6 +1156,20 @@ public class ItemEditor extends JSONElementEditor {
} }
hitTargetConditionsModel.itemChanged(selectedHitEffectTargetCondition); hitTargetConditionsModel.itemChanged(selectedHitEffectTargetCondition);
updateHit = true; updateHit = true;
} else if (source == hitTargetConditionClear) {
selectedHitEffectTargetCondition.magnitude = ActorCondition.CLEAR_AC_MAGNITUDE;
selectedHitEffectTargetCondition.duration = null;
hitTargetConditionMagnitude.setEnabled(false);
hitTargetConditionDuration.setEnabled(false);
hitTargetConditionsModel.itemChanged(selectedHitEffectTargetCondition);
updateHit = true;
} else if (source == hitTargetConditionApply) {
selectedHitEffectTargetCondition.magnitude = 0;
selectedHitEffectTargetCondition.duration = 0;
hitTargetConditionMagnitude.setEnabled(true);
hitTargetConditionDuration.setEnabled(true);
hitTargetConditionsModel.itemChanged(selectedHitEffectTargetCondition);
updateHit = true;
} else if (source == hitTargetConditionMagnitude) { } else if (source == hitTargetConditionMagnitude) {
selectedHitEffectTargetCondition.magnitude = (Integer) value; selectedHitEffectTargetCondition.magnitude = (Integer) value;
hitTargetConditionsModel.itemChanged(selectedHitEffectTargetCondition); hitTargetConditionsModel.itemChanged(selectedHitEffectTargetCondition);
@@ -1054,6 +1213,20 @@ public class ItemEditor extends JSONElementEditor {
} }
killSourceConditionsModel.itemChanged(selectedKillEffectCondition); killSourceConditionsModel.itemChanged(selectedKillEffectCondition);
updateKill = true; updateKill = true;
} else if (source == killSourceConditionClear) {
selectedKillEffectCondition.magnitude = ActorCondition.CLEAR_AC_MAGNITUDE;
selectedKillEffectCondition.duration = null;
killSourceConditionMagnitude.setEnabled(false);
killSourceConditionDuration.setEnabled(false);
killSourceConditionsModel.itemChanged(selectedKillEffectCondition);
updateKill = true;
} else if (source == killSourceConditionApply) {
selectedKillEffectCondition.magnitude = 0;
selectedKillEffectCondition.duration = 0;
killSourceConditionMagnitude.setEnabled(true);
killSourceConditionDuration.setEnabled(true);
killSourceConditionsModel.itemChanged(selectedKillEffectCondition);
updateKill = true;
} else if (source == killSourceConditionMagnitude) { } else if (source == killSourceConditionMagnitude) {
selectedKillEffectCondition.magnitude = (Integer) value; selectedKillEffectCondition.magnitude = (Integer) value;
killSourceConditionsModel.itemChanged(selectedKillEffectCondition); killSourceConditionsModel.itemChanged(selectedKillEffectCondition);

View File

@@ -131,7 +131,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
private JPanel layerDetailsPane; private JPanel layerDetailsPane;
private BooleanBasedCheckBox layerVisibleBox; private BooleanBasedCheckBox layerVisibleBox;
//private BooleanBasedCheckBox activeLayerBox; private JCheckBox groupActiveForNewGame;
private JTextField layerNameField; private JTextField layerNameField;
private MapObjectsListModel groupObjectsListModel; private MapObjectsListModel groupObjectsListModel;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@@ -160,7 +160,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private JComboBox evaluateTriggerBox; private JComboBox evaluateTriggerBox;
private JSpinner quantityField; private JSpinner quantityField;
private JCheckBox activeForNewGame; private JCheckBox spawnActiveForNewGame;
private JTextField spawngroupField; private JTextField spawngroupField;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private JList npcList; private JList npcList;
@@ -332,7 +332,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
break; break;
} }
} }
activeForNewGame = addBooleanBasedCheckBox(groupDetailPane, "Active for new game", objGroup.active, map.writable, listener); groupActiveForNewGame = addBooleanBasedCheckBox(groupDetailPane, "Active for new game", objGroup.active, map.writable, listener);
groupObjectsListModel = new MapObjectsListModel(objGroup); groupObjectsListModel = new MapObjectsListModel(objGroup);
groupObjectsList = new JList(groupObjectsListModel); groupObjectsList = new JList(groupObjectsListModel);
groupObjectsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); groupObjectsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -576,7 +576,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
areaField = addTextField(pane, "Spawn area 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); 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); 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); spawnActiveForNewGame = addBooleanBasedCheckBox(pane, "Active in a new game: ", ((SpawnArea)selected).active, ((TMXMap)target).writable, listener);
npcListModel = new SpawnGroupNpcListModel((SpawnArea) selected); npcListModel = new SpawnGroupNpcListModel((SpawnArea) selected);
npcList = new JList(npcListModel); npcList = new JList(npcListModel);
npcList.setCellRenderer(new GDERenderer(true, ((TMXMap)target).writable)); npcList.setCellRenderer(new GDERenderer(true, ((TMXMap)target).writable));
@@ -1775,9 +1775,9 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
modified = false; modified = false;
tmxViewer.revalidate(); tmxViewer.revalidate();
tmxViewer.repaint(); tmxViewer.repaint();
} else if (source == activeForNewGame) { } else if (source == groupActiveForNewGame) {
if (selectedLayer instanceof tiled.core.ObjectGroup) { if (selectedLayer instanceof tiled.core.ObjectGroup) {
map.getGroup((tiled.core.ObjectGroup) selectedLayer).active = activeForNewGame.isSelected(); map.getGroup((tiled.core.ObjectGroup) selectedLayer).active = groupActiveForNewGame.isSelected();
} }
modified = true; modified = true;
} else if (source == layerList) { } else if (source == layerList) {
@@ -1904,7 +1904,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
SpawnArea area = (SpawnArea) selectedMapObject; SpawnArea area = (SpawnArea) selectedMapObject;
area.quantity = (Integer) value; area.quantity = (Integer) value;
} }
} else if (source == activeForNewGame) { } else if (source == spawnActiveForNewGame) {
if (selectedMapObject instanceof SpawnArea) { if (selectedMapObject instanceof SpawnArea) {
SpawnArea area = (SpawnArea) selectedMapObject; SpawnArea area = (SpawnArea) selectedMapObject;
area.active = (Boolean) value; area.active = (Boolean) value;

View File

@@ -35,6 +35,8 @@ public class SpriteChooser extends JDialog {
private static final int MAX_PER_ROW = 10; private static final int MAX_PER_ROW = 10;
public static Map<Project, Map<Spritesheet.Category, SpriteChooser>> cache = new LinkedHashMap<Project, Map<Spritesheet.Category,SpriteChooser>>(); public static Map<Project, Map<Spritesheet.Category, SpriteChooser>> cache = new LinkedHashMap<Project, Map<Spritesheet.Category,SpriteChooser>>();
public static Map<Project, Map<Spritesheet.Category, List<Spritesheet>>> cacheValidator = new LinkedHashMap<Project, Map<Category,List<Spritesheet>>>();
public static SpriteChooser getChooser(Project proj, Spritesheet.Category category) { public static SpriteChooser getChooser(Project proj, Spritesheet.Category category) {
if (cache.get(proj) == null) { if (cache.get(proj) == null) {
@@ -42,6 +44,17 @@ public class SpriteChooser extends JDialog {
} }
if (cache.get(proj).get(category) == null) { if (cache.get(proj).get(category) == null) {
cache.get(proj).put(category, new SpriteChooser(proj, category)); cache.get(proj).put(category, new SpriteChooser(proj, category));
} else {
List<Spritesheet> spritesheets = new ArrayList<Spritesheet>();
for (int i=0; i<proj.getSpritesheetCount(); i++) {
Spritesheet sheet = proj.getSpritesheet(i);
if (sheet.category == category) {
spritesheets.add(sheet);
}
}
if ( !spritesheets.equals(cacheValidator.get(proj).get(category)) ) {
cache.get(proj).put(category, new SpriteChooser(proj, category));
}
} }
SpriteChooser wanted = cache.get(proj).get(category); SpriteChooser wanted = cache.get(proj).get(category);
wanted.group.clearSelection(); wanted.group.clearSelection();
@@ -65,11 +78,16 @@ public class SpriteChooser extends JDialog {
setTitle("Select a sprite"); setTitle("Select a sprite");
setModalityType(ModalityType.APPLICATION_MODAL); setModalityType(ModalityType.APPLICATION_MODAL);
List<Spritesheet> spritesheets = new ArrayList<Spritesheet>(); List<Spritesheet> spritesheets = new ArrayList<Spritesheet>();
for (Spritesheet sheet : proj.baseContent.gameSprites.spritesheets) { for (int i=0; i<proj.getSpritesheetCount(); i++) {
Spritesheet sheet = proj.getSpritesheet(i);
if (sheet.category == category) { if (sheet.category == category) {
spritesheets.add(sheet); spritesheets.add(sheet);
} }
} }
if (cacheValidator.get(proj) == null) {
cacheValidator.put(proj, new LinkedHashMap<Spritesheet.Category, List<Spritesheet>>());
}
cacheValidator.get(proj).put(category, spritesheets);
JPanel pane = new JPanel(); JPanel pane = new JPanel();

View File

@@ -445,6 +445,7 @@ public class SpritesheetEditor extends Editor {
} else if (source == categoryBox) { } else if (source == categoryBox) {
sheet.category = (Spritesheet.Category) value; sheet.category = (Spritesheet.Category) value;
} }
sheet.save();
} }
} }