mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 23:57:25 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce908f0033 | ||
|
|
1a70f87897 | ||
|
|
c07fb4ddf3 | ||
|
|
1458fb0aaa | ||
|
|
57b8209b26 | ||
|
|
a7224755ff |
@@ -29,6 +29,7 @@
|
||||
package tiled.core;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
@@ -36,7 +37,7 @@ import java.util.Properties;
|
||||
*/
|
||||
public class Tile
|
||||
{
|
||||
private Image image;
|
||||
private BufferedImage image;
|
||||
private int id = -1;
|
||||
private Properties properties;
|
||||
private TileSet tileset;
|
||||
@@ -76,7 +77,7 @@ public class Tile
|
||||
*
|
||||
* @param i the new image of the tile
|
||||
*/
|
||||
public void setImage(Image i) {
|
||||
public void setImage(BufferedImage i) {
|
||||
image = i;
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ public class Tile
|
||||
*
|
||||
* @return Image
|
||||
*/
|
||||
public Image getImage() {
|
||||
public BufferedImage getImage() {
|
||||
if (tileset != null && tileset.sheet != null) return tileset.sheet.getImage(getId());
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class TileSet implements Iterable<Tile>
|
||||
tilesPerRow = basicTileCutter.getTilesPerRow();
|
||||
}
|
||||
|
||||
Image tileImage = cutter.getNextTile();
|
||||
BufferedImage tileImage = cutter.getNextTile();
|
||||
while (tileImage != null) {
|
||||
Tile tile = new Tile();
|
||||
tile.setImage(tileImage);
|
||||
@@ -220,7 +220,7 @@ public class TileSet implements Iterable<Tile>
|
||||
tileDimensions = new Rectangle(tileCutter.getTileDimensions());
|
||||
|
||||
int id = 0;
|
||||
Image tileImage = tileCutter.getNextTile();
|
||||
BufferedImage tileImage = tileCutter.getNextTile();
|
||||
while (tileImage != null) {
|
||||
Tile tile = getTile(id);
|
||||
tile.setImage(tileImage);
|
||||
|
||||
@@ -31,6 +31,7 @@ package tiled.io;
|
||||
import java.awt.Color;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -223,9 +224,9 @@ public class TMXMapReader
|
||||
return o;
|
||||
}
|
||||
|
||||
private Image unmarshalImage(Node t, String baseDir) throws IOException
|
||||
private BufferedImage unmarshalImage(Node t, String baseDir) throws IOException
|
||||
{
|
||||
Image img = null;
|
||||
BufferedImage img = null;
|
||||
|
||||
String source = getAttributeValue(t, "source");
|
||||
|
||||
@@ -253,7 +254,7 @@ public class TMXMapReader
|
||||
// size, somehow makes drawing of the tiles a lot
|
||||
// faster on various systems (seen on Linux, Windows
|
||||
// and MacOS X).
|
||||
img = img.getScaledInstance(
|
||||
img = (BufferedImage) img.getScaledInstance(
|
||||
img.getWidth(null), img.getHeight(null),
|
||||
Image.SCALE_FAST);
|
||||
}
|
||||
@@ -534,7 +535,7 @@ public class TMXMapReader
|
||||
Node child = children.item(i);
|
||||
if ("image".equalsIgnoreCase(child.getNodeName())) {
|
||||
int id = getAttribute(child, "id", -1);
|
||||
Image img = unmarshalImage(child, baseDir);
|
||||
BufferedImage img = unmarshalImage(child, baseDir);
|
||||
tile.setImage(img);
|
||||
} else if ("animation".equalsIgnoreCase(child.getNodeName())) {
|
||||
// TODO: fill this in once TMXMapWriter is complete
|
||||
|
||||
@@ -64,7 +64,7 @@ public class BasicTileCutter implements TileCutter
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public Image getNextTile() {
|
||||
public BufferedImage getNextTile() {
|
||||
if (nextY + tileHeight + tileMargin <= image.getHeight()) {
|
||||
BufferedImage tile =
|
||||
image.getSubimage(nextX, nextY, tileWidth, tileHeight);
|
||||
|
||||
@@ -48,7 +48,7 @@ public interface TileCutter
|
||||
* @return the next tile image, or <code>null</code> when no more tile
|
||||
* images are available
|
||||
*/
|
||||
public Image getNextTile();
|
||||
public BufferedImage getNextTile();
|
||||
|
||||
/**
|
||||
* Resets the tile cutter so that the next call to <code>getNextTile</code>
|
||||
|
||||
@@ -30,6 +30,7 @@ package tiled.view;
|
||||
import tiled.core.TileLayer;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImageOp;
|
||||
|
||||
/**
|
||||
* An interface defining methods to render a map.
|
||||
|
||||
@@ -32,6 +32,8 @@ import tiled.core.Tile;
|
||||
import tiled.core.TileLayer;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.BufferedImageOp;
|
||||
|
||||
/**
|
||||
* The orthogonal map renderer. This is the most basic map renderer, dealing
|
||||
@@ -74,10 +76,12 @@ public class OrthogonalRenderer implements MapRenderer
|
||||
final Tile tile = layer.getTileAt(x, y);
|
||||
if (tile == null)
|
||||
continue;
|
||||
final Image image = tile.getImage();
|
||||
final BufferedImage image = tile.getImage();
|
||||
if (image == null)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
g.drawImage(
|
||||
image,
|
||||
x * tileWidth,
|
||||
|
||||
@@ -1 +1 @@
|
||||
start "" "javaw.exe" -Xmx512M -cp "lib\ATCS_v0.4.5.jar;lib\jide-oss.jar;lib\ui.jar;lib\junit-4.10.jar;lib\json_simple-1.1.jar;lib\rsyntaxtextarea.jar;lib\prefuse.jar;lib\AndorsTrainer_v0.1.2.jar;lib\bsh-2.0b4.jar" com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||
start "" "javaw.exe" -Xmx512M -cp "lib\ATCS_v0.4.8.jar;lib\jide-oss.jar;lib\ui.jar;lib\junit-4.10.jar;lib\json_simple-1.1.jar;lib\rsyntaxtextarea.jar;lib\prefuse.jar;lib\AndorsTrainer_v0.1.2.jar;lib\bsh-2.0b4.jar" com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
java -Xmx512M -cp lib/AndorsTrainer_v0.1.2.jar:lib/ATCS_v0.4.5.jar:lib/prefuse.jar:lib/json_simple-1.1.jar:lib/jide-oss.jar:lib/ui.jar:lib/junit-4.10.jar:lib/rsyntaxtextarea.jar:lib/bsh-2.0b4.jar com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||
java -Xmx512M -cp lib/AndorsTrainer_v0.1.2.jar:lib/ATCS_v0.4.8.jar:lib/prefuse.jar:lib/json_simple-1.1.jar:lib/jide-oss.jar:lib/ui.jar:lib/junit-4.10.jar:lib/rsyntaxtextarea.jar:lib/bsh-2.0b4.jar com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||
|
||||
@@ -1 +1 @@
|
||||
start "" "javaw.exe" -Xmx512M -cp "lib\jide-oss.jar;lib\ui.jar;lib\junit-4.10.jar;lib\json_simple-1.1.jar;lib\rsyntaxtextarea.jar;lib\prefuse.jar;lib\ATCS_v0.4.5.jar;lib\AndorsTrainer_v0.1.2.jar;lib\bsh-2.0b4.jar" com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||
start "" "javaw.exe" -Xmx512M -cp "lib\ATCS_v0.4.6.jar;lib\jide-oss.jar;lib\ui.jar;lib\junit-4.10.jar;lib\json_simple-1.1.jar;lib\rsyntaxtextarea.jar;lib\prefuse.jar;lib\AndorsTrainer_v0.1.2.jar;lib\bsh-2.0b4.jar" com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!include MUI2.nsh
|
||||
|
||||
!define VERSION "0.4.5"
|
||||
!define VERSION "0.4.8"
|
||||
!define JAVA_BIN "java"
|
||||
|
||||
Name "Andor's Trail Content Studio v${VERSION}"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
atcs.spritesheet.actorconditions_1.category=actorcondition
|
||||
atcs.spritesheet.actorconditions_2.category=actorcondition
|
||||
atcs.spritesheet.actorconditions_japozero.category=actorcondition
|
||||
atcs.spritesheet.items_armours.category=item
|
||||
atcs.spritesheet.items_armours_2.category=item
|
||||
atcs.spritesheet.items_armours_3.category=item
|
||||
@@ -10,6 +11,7 @@ atcs.spritesheet.items_jewelry.category=item
|
||||
atcs.spritesheet.items_rings_1.category=item
|
||||
atcs.spritesheet.items_necklaces_1.category=item
|
||||
atcs.spritesheet.items_consumables.category=item
|
||||
atcs.spritesheet.items_japozero.category=item
|
||||
atcs.spritesheet.items_books.category=item
|
||||
atcs.spritesheet.items_misc.category=item
|
||||
atcs.spritesheet.items_misc_2.category=item
|
||||
|
||||
@@ -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.5";
|
||||
public static final String APP_VERSION = "v0.4.8";
|
||||
|
||||
public static boolean STARTED = false;
|
||||
public static StudioFrame frame = null;
|
||||
|
||||
@@ -219,14 +219,12 @@ public class Project implements ProjectTreeNode, Serializable {
|
||||
public void refreshTransients(Workspace w) {
|
||||
this.parent = w;
|
||||
|
||||
if (knownSpritesheetsProperties == null) {
|
||||
try {
|
||||
knownSpritesheetsProperties = new Properties();
|
||||
knownSpritesheetsProperties.load(Project.class.getResourceAsStream("/spritesheets.properties"));
|
||||
} catch (IOException e) {
|
||||
Notification.addWarn("Unable to load default spritesheets properties.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
knownSpritesheetsProperties = new Properties();
|
||||
knownSpritesheetsProperties.load(Project.class.getResourceAsStream("/spritesheets.properties"));
|
||||
} catch (IOException e) {
|
||||
Notification.addWarn("Unable to load default spritesheets properties.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (sourceSetToUse == null) {
|
||||
|
||||
@@ -154,7 +154,7 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
||||
dataToSave.add(element.toJson());
|
||||
}
|
||||
}
|
||||
if (dataToSave.isEmpty()) {
|
||||
if (dataToSave.isEmpty() && jsonFile.exists()) {
|
||||
if (jsonFile.delete()) {
|
||||
Notification.addSuccess("File "+jsonFile.getAbsolutePath()+" deleted.");
|
||||
} else {
|
||||
|
||||
@@ -496,6 +496,8 @@ public class Item extends JSONElement {
|
||||
itemJson.put("id", this.id);
|
||||
if (this.icon_id != null) itemJson.put("iconID", this.icon_id);
|
||||
if (this.name != null) itemJson.put("name", this.name);
|
||||
if(this.display_type != null) itemJson.put("displaytype", this.display_type.toString());
|
||||
|
||||
if (this.has_manual_price != null) itemJson.put("hasManualPrice", this.has_manual_price);
|
||||
if (this.base_market_cost != null) itemJson.put("baseMarketCost", this.base_market_cost);
|
||||
if (this.category != null) {
|
||||
|
||||
@@ -77,7 +77,9 @@ public class KeyArea extends MapObject {
|
||||
if (oldSchoolRequirement && Requirement.RequirementType.questProgress.equals(requirement.type) && (requirement.negated == null || !requirement.negated)) {
|
||||
tmxObject.setName(requirement.required_obj_id+":"+Integer.toString(requirement.required_value));
|
||||
} else {
|
||||
tmxObject.getProperties().setProperty("requireType", requirement.type.toString());
|
||||
if (requirement.type != null) {
|
||||
tmxObject.getProperties().setProperty("requireType", requirement.type.toString());
|
||||
}
|
||||
if (requirement.required_obj != null) {
|
||||
tmxObject.getProperties().setProperty("requireId", requirement.required_obj.id);
|
||||
} else if (requirement.required_obj_id != null) {
|
||||
|
||||
@@ -38,6 +38,17 @@ public class TMXMap extends GameDataElement {
|
||||
public static final String ABOVE_LAYER_NAME = "Above";
|
||||
public static final String WALKABLE_LAYER_NAME = "Walkable";
|
||||
|
||||
public enum ColorFilter {
|
||||
black20,
|
||||
black40,
|
||||
black60,
|
||||
black80,
|
||||
invert,
|
||||
bw,
|
||||
redtint,
|
||||
greentint,
|
||||
bluetint
|
||||
}
|
||||
|
||||
public File tmxFile = null;
|
||||
public tiled.core.Map tmxMap = null;
|
||||
@@ -46,6 +57,7 @@ public class TMXMap extends GameDataElement {
|
||||
|
||||
public ProjectTreeNode parent;
|
||||
public Integer outside = null;
|
||||
public ColorFilter colorFilter = null;
|
||||
|
||||
public boolean writable = false;
|
||||
|
||||
@@ -62,8 +74,11 @@ public class TMXMap extends GameDataElement {
|
||||
usedSpritesheets = new HashSet<Spritesheet>();
|
||||
try {
|
||||
tmxMap = new TMXMapReader().readMap(tmxFile.getAbsolutePath(), this);
|
||||
if (tmxMap.getProperties().get("outside") != null) {
|
||||
outside = new Integer(((String) tmxMap.getProperties().get("outside")));
|
||||
if (tmxMap.getProperties().get("outdoors") != null) {
|
||||
outside = new Integer(((String) tmxMap.getProperties().get("outdoors")));
|
||||
}
|
||||
if (tmxMap.getProperties().get("colorfilter") != null) {
|
||||
colorFilter = ColorFilter.valueOf(((String) tmxMap.getProperties().get("colorfilter")));
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
Notification.addError("Impossible to load TMX map file "+tmxFile.getAbsolutePath());
|
||||
@@ -97,8 +112,11 @@ public class TMXMap extends GameDataElement {
|
||||
try {
|
||||
clone.usedSpritesheets = new HashSet<Spritesheet>();
|
||||
clone.tmxMap = new TMXMapReader().readMap(new StringReader(this.toXml()), clone);
|
||||
if (clone.tmxMap.getProperties().get("outside") != null) {
|
||||
clone.outside = new Integer(((String) clone.tmxMap.getProperties().get("outside")));
|
||||
if (clone.tmxMap.getProperties().get("outdoors") != null) {
|
||||
clone.outside = new Integer(((String) clone.tmxMap.getProperties().get("outdoors")));
|
||||
}
|
||||
if (clone.tmxMap.getProperties().get("colorfilter") != null) {
|
||||
clone.colorFilter = ColorFilter.valueOf(((String) tmxMap.getProperties().get("colorfilter")));
|
||||
}
|
||||
for (tiled.core.MapLayer layer : clone.tmxMap.getLayers()) {
|
||||
if (layer instanceof tiled.core.ObjectGroup) {
|
||||
@@ -210,6 +228,17 @@ public class TMXMap extends GameDataElement {
|
||||
}
|
||||
|
||||
public String toXml() {
|
||||
if (outside != null && outside == 1) {
|
||||
tmxMap.getProperties().put("outdoors", Integer.toString(outside));
|
||||
} else {
|
||||
tmxMap.getProperties().remove("outdoors");
|
||||
}
|
||||
if (colorFilter != null) {
|
||||
tmxMap.getProperties().put("colorfilter", colorFilter.toString());
|
||||
} else {
|
||||
tmxMap.getProperties().remove("colorfilter");
|
||||
}
|
||||
|
||||
for (MapObjectGroup group : groups) {
|
||||
group.pushBackToTiledProperties();
|
||||
if (!tmxMap.containsLayer(group.tmxGroup)) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import javax.swing.AbstractListModel;
|
||||
import javax.swing.ComboBoxModel;
|
||||
@@ -29,6 +30,7 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSpinner;
|
||||
import javax.swing.JSpinner.NumberEditor;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListModel;
|
||||
import javax.swing.SpinnerNumberModel;
|
||||
@@ -147,6 +149,51 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
});
|
||||
return tfField;
|
||||
}
|
||||
|
||||
public static JTextArea addTextArea(JPanel pane, String label, String initialValue, boolean editable, final FieldUpdateListener listener) {
|
||||
String text= initialValue == null ? "" : initialValue.replaceAll("\\n", "\n");
|
||||
|
||||
JPanel tfPane = new JPanel();
|
||||
tfPane.setLayout(new JideBoxLayout(tfPane, JideBoxLayout.LINE_AXIS, 6));
|
||||
JLabel tfLabel = new JLabel(label);
|
||||
tfPane.add(tfLabel, JideBoxLayout.FIX);
|
||||
final JTextArea tfArea = new JTextArea(text);
|
||||
tfArea.setEditable(editable);
|
||||
tfPane.add(new JScrollPane(tfArea), JideBoxLayout.VARY);
|
||||
JButton nullify = new JButton(new ImageIcon(DefaultIcons.getNullifyIcon()));
|
||||
tfPane.add(nullify, JideBoxLayout.FIX);
|
||||
nullify.setEnabled(editable);
|
||||
pane.add(tfPane, JideBoxLayout.FIX);
|
||||
|
||||
nullify.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
tfArea.setText("");
|
||||
listener.valueChanged(tfArea, null);
|
||||
}
|
||||
});
|
||||
tfArea.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
listener.valueChanged(tfArea, tfArea.getText().replaceAll("\n", Matcher.quoteReplacement("\n")));
|
||||
}
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
listener.valueChanged(tfArea, tfArea.getText().replaceAll("\n", Matcher.quoteReplacement("\n")));
|
||||
}
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
listener.valueChanged(tfArea, tfArea.getText().replaceAll("\n", Matcher.quoteReplacement("\n")));
|
||||
}
|
||||
});
|
||||
// tfArea.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// listener.valueChanged(tfArea, tfArea.getText().replaceAll("\n", "\\n"));
|
||||
// }
|
||||
// });
|
||||
return tfArea;
|
||||
}
|
||||
|
||||
// public static JSpinner addIntegerField(JPanel pane, String label, Integer initialValue, boolean allowNegatives, boolean editable) {
|
||||
// return addIntegerField(pane, label, initialValue, allowNegatives, editable, nullListener);
|
||||
|
||||
@@ -27,6 +27,7 @@ import javax.swing.event.ListDataListener;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.ATContentStudio;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement.State;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameSource;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.ActorCondition;
|
||||
@@ -293,6 +294,7 @@ public class JSONCreationWizard extends JDialog {
|
||||
creation.id = idField.getText();
|
||||
JSONCreationWizard.this.setVisible(false);
|
||||
JSONCreationWizard.this.dispose();
|
||||
creation.state = State.created;
|
||||
proj.createElement(creation);
|
||||
notifyCreated();
|
||||
ATContentStudio.frame.selectInTree(creation);
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSpinner;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListModel;
|
||||
import javax.swing.ListSelectionModel;
|
||||
@@ -79,7 +80,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private static final int SHOP_INDEX = 5;
|
||||
|
||||
private JTextField idField;
|
||||
private JTextField messageField;
|
||||
private JTextArea messageField;
|
||||
private MyComboBox switchToNpcBox;
|
||||
|
||||
private RewardsListModel rewardsListModel;
|
||||
@@ -127,7 +128,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
createButtonPane(pane, dialogue.getProject(), dialogue, Dialogue.class, dialogue.getImage(), null, listener);
|
||||
|
||||
idField = addTextField(pane, "Internal ID: ", dialogue.id, dialogue.writable, listener);
|
||||
messageField = addTextField(pane, "Message: ", dialogue.message, dialogue.writable, listener);
|
||||
messageField = addTextArea(pane, "Message: ", dialogue.message, dialogue.writable, listener);
|
||||
switchToNpcBox = addNPCBox(pane, dialogue.getProject(), "Switch active NPC to: ", dialogue.switch_to_npc, dialogue.writable, listener);
|
||||
|
||||
CollapsiblePanel rewards = new CollapsiblePanel("Reaching this phrase gives the following rewards: ");
|
||||
|
||||
@@ -1,24 +1,32 @@
|
||||
package com.gpl.rpg.atcontentstudio.ui.gamedataeditors;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import org.fife.ui.rtextarea.ColorBackgroundPainterStrategy;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.ATContentStudio;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
|
||||
@@ -79,6 +87,7 @@ public class QuestEditor extends JSONElementEditor {
|
||||
stagesTable.getColumnModel().getColumn(3).setMinWidth(130);
|
||||
stagesTable.getColumnModel().getColumn(3).setMaxWidth(130);
|
||||
stagesTable.setCellSelectionEnabled(true);
|
||||
stagesTable.getColumnModel().getColumn(1).setCellRenderer(new MultilineCellRenderer());
|
||||
stagesPane.add(new JScrollPane(stagesTable), BorderLayout.CENTER);
|
||||
if (quest.writable) {
|
||||
JPanel buttonPane = new JPanel();
|
||||
@@ -330,6 +339,48 @@ public class QuestEditor extends JSONElementEditor {
|
||||
updateJsonViewText(quest.toJsonString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class MultilineCellRenderer extends JTextArea implements TableCellRenderer {
|
||||
private static final long serialVersionUID = 6539816623608859506L;
|
||||
|
||||
public MultilineCellRenderer() {
|
||||
setLineWrap(true);
|
||||
setWrapStyleWord(true);
|
||||
//setOpaque(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table,
|
||||
Object value, boolean isSelected, boolean hasFocus,
|
||||
int row, int column) {
|
||||
if (isSelected) {
|
||||
setForeground(stagesTable.getSelectionForeground());
|
||||
setBackground(stagesTable.getSelectionBackground());
|
||||
} else {
|
||||
setForeground(stagesTable.getForeground());
|
||||
setBackground(stagesTable.getBackground());
|
||||
}
|
||||
setFont(stagesTable.getFont());
|
||||
if (hasFocus) {
|
||||
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
|
||||
if (stagesTable.isCellEditable(row, column)) {
|
||||
setForeground(UIManager.getColor("Table.focusCellForeground"));
|
||||
setBackground(UIManager.getColor("Table.focusCellBackground"));
|
||||
}
|
||||
} else {
|
||||
setBorder(BorderFactory.createLineBorder(getBackground(), 1));
|
||||
}
|
||||
setText((value == null ? "" : value.toString()));
|
||||
|
||||
int fh = getFontMetrics(getFont()).getHeight();
|
||||
// int tl = getText().length();
|
||||
setSize(stagesTable.getWidth(), fh);
|
||||
stagesTable.setRowHeight(row, getPreferredSize().height);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
107
src/com/gpl/rpg/atcontentstudio/ui/map/MapColorFilters.java
Normal file
107
src/com/gpl/rpg/atcontentstudio/ui/map/MapColorFilters.java
Normal file
@@ -0,0 +1,107 @@
|
||||
package com.gpl.rpg.atcontentstudio.ui.map;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
|
||||
import com.gpl.rpg.atcontentstudio.ui.tools.MatrixComposite;
|
||||
|
||||
public class MapColorFilters {
|
||||
|
||||
public static void applyColorfilter(TMXMap.ColorFilter colorFilter, Graphics2D g2d) {
|
||||
Composite oldComp = g2d.getComposite();
|
||||
Rectangle clip = g2d.getClipBounds();
|
||||
MatrixComposite newComp = null;
|
||||
float f=0.0f;
|
||||
switch(colorFilter) {
|
||||
case black20:
|
||||
f=0.8f;
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
f, 0.00f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
case black40:
|
||||
f=0.6f;
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
f, 0.00f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
case black60:
|
||||
f=0.4f;
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
f, 0.00f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
case black80:
|
||||
f=0.2f;
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
f, 0.00f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
case bw:
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
0.33f, 0.59f, 0.11f, 0.0f, 0.0f,
|
||||
0.33f, 0.59f, 0.11f, 0.0f, 0.0f,
|
||||
0.33f, 0.59f, 0.11f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
case invert:
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
-1.00f, 0.00f, 0.00f, 0.0f, 255.0f,
|
||||
0.00f, -1.00f, 0.00f, 0.0f, 255.0f,
|
||||
0.00f, 0.00f, -1.00f, 0.0f, 255.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
case redtint:
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
1.20f, 0.20f, 0.20f, 0.0f, 25.0f,
|
||||
0.00f, 0.80f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, 0.80f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
case greentint:
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
0.85f, 0.00f, 0.00f, 0.0f, 0.0f,
|
||||
0.15f, 1.15f, 0.15f, 0.0f, 15.0f,
|
||||
0.00f, 0.00f, 0.85f, 0.0f, 0.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
case bluetint:
|
||||
newComp = new MatrixComposite(new float[]{
|
||||
0.70f, 0.00f, 0.00f, 0.0f, 0.0f,
|
||||
0.00f, 0.70f, 0.00f, 0.0f, 0.0f,
|
||||
0.30f, 0.30f, 1.30f, 0.0f, 40.0f,
|
||||
0.00f, 0.00f, 0.00f, 1.0f, 0.0f
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
if (newComp != null) {
|
||||
g2d.setComposite(newComp);
|
||||
g2d.setPaint(new Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
g2d.fill(clip);
|
||||
g2d.setComposite(oldComp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,8 +18,8 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.awt.image.BufferedImageOp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
@@ -115,6 +115,7 @@ public class TMXMapEditor extends Editor {
|
||||
private RSyntaxTextArea editorPane;
|
||||
|
||||
private IntegerBasedCheckBox outsideBox;
|
||||
private JComboBox colorFilterBox;
|
||||
private LayerListModel layerListModel;
|
||||
private JList layerList;
|
||||
private tiled.core.MapLayer selectedLayer;
|
||||
@@ -206,6 +207,7 @@ public class TMXMapEditor extends Editor {
|
||||
addLabelField(pane, "TMX File: ", ((TMXMap)target).tmxFile.getAbsolutePath());
|
||||
createButtonPane(pane, map.getProject(), map, listener);
|
||||
outsideBox = addIntegerBasedCheckBox(pane, "Map is outdoors", map.outside, map.writable, listener);
|
||||
colorFilterBox = addEnumValueBox(pane, "Color Filter", TMXMap.ColorFilter.values(), map.colorFilter, map.writable, listener);
|
||||
|
||||
JSplitPane layersViewSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||||
layerListModel = new LayerListModel(map);
|
||||
@@ -542,7 +544,7 @@ public class TMXMapEditor extends Editor {
|
||||
|
||||
|
||||
} else if (selected instanceof RestArea) {
|
||||
pane.add(new JLabel("Rest areas have no parameters"), JideBoxLayout.FIX);
|
||||
areaField = addTextField(pane, "Area ID: ", ((RestArea)selected).name, ((TMXMap)target).writable, listener);
|
||||
} else if (selected instanceof ScriptArea) {
|
||||
evaluateTriggerBox = addEnumValueBox(pane, "Evaluate on every: ", ScriptArea.EvaluationTrigger.values(), ((ScriptArea)selected).trigger_type, ((TMXMap)target).writable, listener);
|
||||
dialogueBox = addDialogueBox(pane, ((TMXMap)target).getProject(), "Script: ", ((ScriptArea)selected).dialogue, ((TMXMap)target).writable, listener);
|
||||
@@ -1242,12 +1244,52 @@ public class TMXMapEditor extends Editor {
|
||||
|
||||
}
|
||||
|
||||
private static final BufferedImageOp colorFilterBlack20 = null;
|
||||
private static final BufferedImageOp colorFilterBlack40 = null;
|
||||
private static final BufferedImageOp colorFilterBlack60 = null;
|
||||
private static final BufferedImageOp colorFilterBlack80 = null;
|
||||
private static final BufferedImageOp colorFilterInvert = null;
|
||||
private static final BufferedImageOp colorFilterBW = null;
|
||||
|
||||
|
||||
// private static final BufferedImageOp colorFilterBlack20 = createGrayScaleColorFilter(0.8f);
|
||||
// private static final BufferedImageOp colorFilterBlack40 = createGrayScaleColorFilter(0.6f);
|
||||
// private static final BufferedImageOp colorFilterBlack60 = createGrayScaleColorFilter(0.4f);
|
||||
// private static final BufferedImageOp colorFilterBlack80 = createGrayScaleColorFilter(0.2f);
|
||||
// private static final BufferedImageOp colorFilterInvert = createInvertColorFilter();
|
||||
// private static final BufferedImageOp colorFilterBW = createBWColorFilter();
|
||||
//
|
||||
// private static BufferedImageOp createGrayScaleColorFilter(float f) {
|
||||
// byte[] gs = new byte[256];
|
||||
// for (int i=0; i < 256; i++) {
|
||||
// gs[i] = (byte)( i * f);
|
||||
// }
|
||||
// return new LookupOp(new ByteLookupTable(0, gs), null);
|
||||
// }
|
||||
//
|
||||
// private static BufferedImageOp createInvertColorFilter() {
|
||||
// byte[] invert = new byte[256];
|
||||
// for (int i=0; i < 256; i++) {
|
||||
// invert[i] = (byte) (255 - i);
|
||||
// }
|
||||
// return new LookupOp(new ByteLookupTable(0, invert), null);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private static BufferedImageOp createBWColorFilter() {
|
||||
// return new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
|
||||
// }
|
||||
|
||||
|
||||
public class TMXViewer extends JPanel implements Scrollable {
|
||||
|
||||
private static final long serialVersionUID = 2845032142029325865L;
|
||||
|
||||
|
||||
public tiled.core.MapObject highlighted = null;
|
||||
private MapRenderer renderer;
|
||||
private FieldUpdateListener listener;
|
||||
private TMXMap map;
|
||||
|
||||
public boolean resizing = false;
|
||||
public boolean moving = false;
|
||||
@@ -1257,7 +1299,8 @@ public class TMXMapEditor extends Editor {
|
||||
return new Rectangle(selectedMapObject.x + selectedMapObject.w - 16, selectedMapObject.y + selectedMapObject.h - 16, 16, 16);
|
||||
}
|
||||
|
||||
public Rectangle getMoveHitArea() {
|
||||
|
||||
public Rectangle getMoveHitArea() {
|
||||
//16x16 px square in the upper left corner of area
|
||||
return new Rectangle(selectedMapObject.x, selectedMapObject.y, 16, 16);
|
||||
}
|
||||
@@ -1270,6 +1313,7 @@ public class TMXMapEditor extends Editor {
|
||||
public TMXViewer(final TMXMap map, FieldUpdateListener listener) {
|
||||
this.listener = listener;
|
||||
renderer = createRenderer(map.tmxMap);
|
||||
this.map = map;
|
||||
|
||||
setPreferredSize(renderer.getMapSize());
|
||||
setOpaque(true);
|
||||
@@ -1383,20 +1427,34 @@ public class TMXMapEditor extends Editor {
|
||||
public void paintComponent(Graphics g) {
|
||||
final Graphics2D g2d = (Graphics2D) g.create();
|
||||
final Rectangle clip = g2d.getClipBounds();
|
||||
|
||||
|
||||
// Draw a gray background
|
||||
g2d.setPaint(new Color(100, 100, 100));
|
||||
g2d.fill(clip);
|
||||
|
||||
// Draw each tile map layer
|
||||
boolean paintSelected = false;
|
||||
for (tiled.core.MapLayer layer : ((TMXMap)target).tmxMap) {
|
||||
if (layer instanceof tiled.core.TileLayer && layer.isVisible()) {
|
||||
renderer.paintTileLayer(g2d, (tiled.core.TileLayer) layer);
|
||||
} else if (layer instanceof tiled.core.ObjectGroup && layer.isVisible()) {
|
||||
}
|
||||
}
|
||||
|
||||
if (map.colorFilter != null) {
|
||||
MapColorFilters.applyColorfilter(map.colorFilter, g2d);
|
||||
}
|
||||
|
||||
|
||||
// Draw each map object layer
|
||||
boolean paintSelected = false;
|
||||
for (tiled.core.MapLayer layer : ((TMXMap)target).tmxMap) {
|
||||
if (layer instanceof tiled.core.ObjectGroup && layer.isVisible()) {
|
||||
paintSelected |= paintObjectGroup(g2d, (tiled.core.ObjectGroup) layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (paintSelected) {
|
||||
//TODO make this less ugly..... visually speaking.
|
||||
g2d.setColor(new Color(190, 20, 20));
|
||||
@@ -1725,6 +1783,10 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
} else if (source == outsideBox) {
|
||||
map.outside = (Integer)value;
|
||||
} else if (source == colorFilterBox) {
|
||||
map.colorFilter = (TMXMap.ColorFilter) value;
|
||||
tmxViewer.revalidate();
|
||||
tmxViewer.repaint();
|
||||
} else if (source == droplistBox) {
|
||||
if (selectedMapObject instanceof ContainerArea) {
|
||||
ContainerArea area = (ContainerArea)selectedMapObject;
|
||||
@@ -2049,7 +2111,7 @@ public class TMXMapEditor extends Editor {
|
||||
public void paintComponent(Graphics g) {
|
||||
final Graphics2D g2d = (Graphics2D) g.create();
|
||||
final Rectangle clip = g2d.getClipBounds();
|
||||
|
||||
|
||||
// Draw a gray background
|
||||
g2d.setPaint(new Color(100, 100, 100));
|
||||
g2d.fill(clip);
|
||||
@@ -2072,6 +2134,11 @@ public class TMXMapEditor extends Editor {
|
||||
renderer.paintTileLayer(g2d, walkable);
|
||||
}
|
||||
|
||||
if (map.colorFilter != null) {
|
||||
MapColorFilters.applyColorfilter(map.colorFilter, g2d);
|
||||
}
|
||||
|
||||
|
||||
if (highlighted != null) {
|
||||
drawObject(highlighted, g2d, new Color(190, 20, 20));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Shape;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.GlyphVector;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
@@ -86,6 +87,12 @@ public class WorldMapView extends JComponent implements Scrollable {
|
||||
// paintObjectGroup(g2, map, (tiled.core.ObjectGroup) layer);
|
||||
}
|
||||
}
|
||||
if (map.colorFilter != null) {
|
||||
Shape oldClip = g2.getClip();
|
||||
g2.setClip(0, 0, map.tmxMap.getWidth() * TILE_SIZE, map.tmxMap.getHeight() * TILE_SIZE);
|
||||
MapColorFilters.applyColorfilter(map.colorFilter, g2);
|
||||
g2.setClip(oldClip);
|
||||
}
|
||||
if (selected.contains(s)) {
|
||||
g2.drawRect(0, 0, map.tmxMap.getWidth() * TILE_SIZE, map.tmxMap.getHeight() * TILE_SIZE);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ItemsTableView extends ElementTableView {
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 32;
|
||||
return 33;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,32 +49,33 @@ public class ItemsTableView extends ElementTableView {
|
||||
case 3: return "Folder type"; //Source type (created, altered, source)
|
||||
case 4: return "Use type"; //Use type ("none", "use", or equip slot name).
|
||||
case 5: return "Category"; //Category id.
|
||||
case 6: return "Manually set price ?"; //Has manual price
|
||||
case 7: return "Price"; //Price
|
||||
case 8: return "On use/hit - HP min";
|
||||
case 9: return "On use/hit - HP max";
|
||||
case 10: return "On use/hit - AP min";
|
||||
case 11: return "On use/hit - AP max";
|
||||
case 12: return "On use/hit - # conditions";
|
||||
case 13: return "On kill - HP min";
|
||||
case 14: return "On kill - HP max";
|
||||
case 15: return "On kill - AP min";
|
||||
case 16: return "On kill - AP max";
|
||||
case 17: return "On kill - # conditions";
|
||||
case 18: return "AD min";
|
||||
case 19: return "AD max";
|
||||
case 20: return "Max HP";
|
||||
case 21: return "Max AP";
|
||||
case 22: return "Attack cost";
|
||||
case 23: return "AC";
|
||||
case 24: return "BC";
|
||||
case 25: return "DR";
|
||||
case 26: return "CS";
|
||||
case 27: return "CM";
|
||||
case 28: return "Move cost";
|
||||
case 29: return "Use cost";
|
||||
case 30: return "Reequip cost";
|
||||
case 31: return "# conditions";
|
||||
case 6: return "DisplayType"; //Display type (ordinary, rare, extraordinary...)
|
||||
case 7: return "Manually set price ?"; //Has manual price
|
||||
case 8: return "Price"; //Price
|
||||
case 9: return "On use/hit - HP min";
|
||||
case 10: return "On use/hit - HP max";
|
||||
case 11: return "On use/hit - AP min";
|
||||
case 12: return "On use/hit - AP max";
|
||||
case 13: return "On use/hit - # conditions";
|
||||
case 14: return "On kill - HP min";
|
||||
case 15: return "On kill - HP max";
|
||||
case 16: return "On kill - AP min";
|
||||
case 17: return "On kill - AP max";
|
||||
case 18: return "On kill - # conditions";
|
||||
case 19: return "AD min";
|
||||
case 20: return "AD max";
|
||||
case 21: return "Max HP";
|
||||
case 22: return "Max AP";
|
||||
case 23: return "Attack cost";
|
||||
case 24: return "AC";
|
||||
case 25: return "BC";
|
||||
case 26: return "DR";
|
||||
case 27: return "CS";
|
||||
case 28: return "CM";
|
||||
case 29: return "Move cost";
|
||||
case 30: return "Use cost";
|
||||
case 31: return "Reequip cost";
|
||||
case 32: return "# conditions";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -89,32 +90,33 @@ public class ItemsTableView extends ElementTableView {
|
||||
case 3: return String.class; //Source type (created, altered, source)
|
||||
case 4: return String.class; //Use type ("none", "use", or equip slot name).
|
||||
case 5: return String.class; //Category id.
|
||||
case 6: return Boolean.class; //Has manual price
|
||||
case 7: return Integer.class; //Price
|
||||
case 8: return Integer.class;//"On use/hit - HP min";
|
||||
case 9: return Integer.class;//"On use/hit - HP max";
|
||||
case 10: return Integer.class;//"On use/hit - AP min";
|
||||
case 11: return Integer.class;//"On use/hit - AP max";
|
||||
case 12: return Integer.class;//"On use/hit - # conditions";
|
||||
case 13: return Integer.class;//"On kill - HP min";
|
||||
case 14: return Integer.class;//"On kill - HP max";
|
||||
case 15: return Integer.class;//"On kill - AP min";
|
||||
case 16: return Integer.class;//"On kill - AP max";
|
||||
case 17: return Integer.class;//"On kill - # conditions";
|
||||
case 18: return Integer.class;//"AD min";
|
||||
case 19: return Integer.class;//"AD max";
|
||||
case 20: return Integer.class;//"Max HP";
|
||||
case 21: return Integer.class;//"Max AP";
|
||||
case 22: return Integer.class;//"Attack cost";
|
||||
case 23: return Integer.class;//"AC";
|
||||
case 24: return Integer.class;//"BC";
|
||||
case 25: return Integer.class;//"DR";
|
||||
case 26: return Integer.class;//"CS";
|
||||
case 27: return Double.class;//"CM";
|
||||
case 28: return Integer.class;//"Move cost";
|
||||
case 29: return Integer.class;//"Use cost";
|
||||
case 30: return Integer.class;//"Reequip cost";
|
||||
case 31: return Integer.class;//"# conditions";
|
||||
case 6: return String.class; //Display type (ordinary, rare, extraordinary...)
|
||||
case 7: return Boolean.class; //Has manual price
|
||||
case 8: return Integer.class; //Price
|
||||
case 9: return Integer.class;//"On use/hit - HP min";
|
||||
case 10: return Integer.class;//"On use/hit - HP max";
|
||||
case 11: return Integer.class;//"On use/hit - AP min";
|
||||
case 12: return Integer.class;//"On use/hit - AP max";
|
||||
case 13: return Integer.class;//"On use/hit - # conditions";
|
||||
case 14: return Integer.class;//"On kill - HP min";
|
||||
case 15: return Integer.class;//"On kill - HP max";
|
||||
case 16: return Integer.class;//"On kill - AP min";
|
||||
case 17: return Integer.class;//"On kill - AP max";
|
||||
case 18: return Integer.class;//"On kill - # conditions";
|
||||
case 19: return Integer.class;//"AD min";
|
||||
case 20: return Integer.class;//"AD max";
|
||||
case 21: return Integer.class;//"Max HP";
|
||||
case 22: return Integer.class;//"Max AP";
|
||||
case 23: return Integer.class;//"Attack cost";
|
||||
case 24: return Integer.class;//"AC";
|
||||
case 25: return Integer.class;//"BC";
|
||||
case 26: return Integer.class;//"DR";
|
||||
case 27: return Integer.class;//"CS";
|
||||
case 28: return Double.class;//"CM";
|
||||
case 29: return Integer.class;//"Move cost";
|
||||
case 30: return Integer.class;//"Use cost";
|
||||
case 31: return Integer.class;//"Reequip cost";
|
||||
case 32: return Integer.class;//"# conditions";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -144,15 +146,16 @@ public class ItemsTableView extends ElementTableView {
|
||||
if (item.category.action_type != ItemCategory.ActionType.equip) return item.category.action_type.toString();
|
||||
return item.category.slot.toString();
|
||||
case 5: return item.category != null ? item.category.id : (item.category_id != null ? item.category_id : null ); //Category id.
|
||||
case 6: return item.has_manual_price == null ? false : (item.has_manual_price == 1); //Has manual price
|
||||
case 7: //Price
|
||||
case 6: return item.display_type != null ? item.display_type.toString() : null; //Category id.
|
||||
case 7: return item.has_manual_price == null ? false : (item.has_manual_price == 1); //Has manual price
|
||||
case 8: //Price
|
||||
if (item.has_manual_price == null || item.has_manual_price != 1) return item.computePrice();
|
||||
return item.base_market_cost;
|
||||
case 8: return canUse ? (item.kill_effect != null ? item.kill_effect.hp_boost_min : null) : (item.hit_effect != null ? item.hit_effect.hp_boost_min : null);//"On use/hit - HP min";
|
||||
case 9: return canUse ? (item.kill_effect != null ? item.kill_effect.hp_boost_max : null) : (item.hit_effect != null ? item.hit_effect.hp_boost_max : null);//"On use/hit - HP max";
|
||||
case 10: return canUse ? (item.kill_effect != null ? item.kill_effect.ap_boost_min : null) : (item.hit_effect != null ? item.hit_effect.ap_boost_min : null);//"On use/hit - AP min";
|
||||
case 11: return canUse ? (item.kill_effect != null ? item.kill_effect.ap_boost_max : null) : (item.hit_effect != null ? item.hit_effect.ap_boost_max : null);//"On use/hit - AP max";
|
||||
case 12: //"On use/hit - # conditions";
|
||||
case 9: return canUse ? (item.kill_effect != null ? item.kill_effect.hp_boost_min : null) : (item.hit_effect != null ? item.hit_effect.hp_boost_min : null);//"On use/hit - HP min";
|
||||
case 10: return canUse ? (item.kill_effect != null ? item.kill_effect.hp_boost_max : null) : (item.hit_effect != null ? item.hit_effect.hp_boost_max : null);//"On use/hit - HP max";
|
||||
case 11: return canUse ? (item.kill_effect != null ? item.kill_effect.ap_boost_min : null) : (item.hit_effect != null ? item.hit_effect.ap_boost_min : null);//"On use/hit - AP min";
|
||||
case 12: return canUse ? (item.kill_effect != null ? item.kill_effect.ap_boost_max : null) : (item.hit_effect != null ? item.hit_effect.ap_boost_max : null);//"On use/hit - AP max";
|
||||
case 13: //"On use/hit - # conditions";
|
||||
if (canUse) {
|
||||
if (item.kill_effect != null && item.kill_effect.conditions_source != null) {
|
||||
return item.kill_effect.conditions_source.size();
|
||||
@@ -169,25 +172,25 @@ public class ItemsTableView extends ElementTableView {
|
||||
return val;
|
||||
}
|
||||
return null;
|
||||
case 13: return (!canUse && item.kill_effect != null) ? item.kill_effect.hp_boost_min : null;//"On kill - HP min";
|
||||
case 14: return (!canUse && item.kill_effect != null) ? item.kill_effect.hp_boost_max : null;//"On kill - HP max";
|
||||
case 15: return (!canUse && item.kill_effect != null) ? item.kill_effect.ap_boost_min : null;//"On kill - AP min";
|
||||
case 16: return (!canUse && item.kill_effect != null) ? item.kill_effect.ap_boost_max : null;//"On kill - AP max";
|
||||
case 17: return (!canUse && item.kill_effect != null && item.kill_effect.conditions_source != null) ? item.kill_effect.conditions_source.size() : null;//"On kill - # conditions";
|
||||
case 18: return (canEquip && item.equip_effect != null) ? item.equip_effect.damage_boost_min : null;//"AD min";
|
||||
case 19: return (canEquip && item.equip_effect != null) ? item.equip_effect.damage_boost_max : null;//"AD max";
|
||||
case 20: return (canEquip && item.equip_effect != null) ? item.equip_effect.max_hp_boost : null;//"Max HP";
|
||||
case 21: return (canEquip && item.equip_effect != null) ? item.equip_effect.max_ap_boost : null;//"Max AP";
|
||||
case 22: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_attack_cost : null;//"Attack cost";
|
||||
case 23: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_attack_chance : null;//"AC";
|
||||
case 24: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_block_chance : null;//"BC";
|
||||
case 25: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_damage_resistance : null;//"DR";
|
||||
case 26: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_critical_skill : null;//"CS";
|
||||
case 27: return (canEquip && item.equip_effect != null) ? item.equip_effect.critical_multiplier : null;//"CM";
|
||||
case 28: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_move_cost : null;//"Move cost";
|
||||
case 29: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_use_item_cost : null;//"Use cost";
|
||||
case 30: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_reequip_cost : null;//"Reequip cost";
|
||||
case 31: return (canEquip && item.equip_effect != null && item.equip_effect.conditions != null) ? item.equip_effect.conditions.size() : null;//"# conditions";
|
||||
case 14: return (!canUse && item.kill_effect != null) ? item.kill_effect.hp_boost_min : null;//"On kill - HP min";
|
||||
case 15: return (!canUse && item.kill_effect != null) ? item.kill_effect.hp_boost_max : null;//"On kill - HP max";
|
||||
case 16: return (!canUse && item.kill_effect != null) ? item.kill_effect.ap_boost_min : null;//"On kill - AP min";
|
||||
case 17: return (!canUse && item.kill_effect != null) ? item.kill_effect.ap_boost_max : null;//"On kill - AP max";
|
||||
case 18: return (!canUse && item.kill_effect != null && item.kill_effect.conditions_source != null) ? item.kill_effect.conditions_source.size() : null;//"On kill - # conditions";
|
||||
case 19: return (canEquip && item.equip_effect != null) ? item.equip_effect.damage_boost_min : null;//"AD min";
|
||||
case 20: return (canEquip && item.equip_effect != null) ? item.equip_effect.damage_boost_max : null;//"AD max";
|
||||
case 21: return (canEquip && item.equip_effect != null) ? item.equip_effect.max_hp_boost : null;//"Max HP";
|
||||
case 22: return (canEquip && item.equip_effect != null) ? item.equip_effect.max_ap_boost : null;//"Max AP";
|
||||
case 23: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_attack_cost : null;//"Attack cost";
|
||||
case 24: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_attack_chance : null;//"AC";
|
||||
case 25: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_block_chance : null;//"BC";
|
||||
case 26: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_damage_resistance : null;//"DR";
|
||||
case 27: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_critical_skill : null;//"CS";
|
||||
case 28: return (canEquip && item.equip_effect != null) ? item.equip_effect.critical_multiplier : null;//"CM";
|
||||
case 29: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_move_cost : null;//"Move cost";
|
||||
case 30: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_use_item_cost : null;//"Use cost";
|
||||
case 31: return (canEquip && item.equip_effect != null) ? item.equip_effect.increase_reequip_cost : null;//"Reequip cost";
|
||||
case 32: return (canEquip && item.equip_effect != null && item.equip_effect.conditions != null) ? item.equip_effect.conditions.size() : null;//"# conditions";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
124
src/com/gpl/rpg/atcontentstudio/ui/tools/MatrixComposite.java
Normal file
124
src/com/gpl/rpg/atcontentstudio/ui/tools/MatrixComposite.java
Normal file
@@ -0,0 +1,124 @@
|
||||
package com.gpl.rpg.atcontentstudio.ui.tools;
|
||||
|
||||
import java.awt.Composite;
|
||||
import java.awt.CompositeContext;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
|
||||
/**
|
||||
* This Composite emulates the behaviour of Android's ColorMatrixColorFilter,
|
||||
* except that you have to use this one a posteriori instead of a filtering paint.
|
||||
*
|
||||
* It applies a ColorMatrix to the destination pixels, regardless of potential "source" pixels.
|
||||
* Once created and activated through Graphics2D.setComposite(), just paint anything over the pixels you want "filtered".
|
||||
*
|
||||
* Works on a per-pixel basis, no sampling of surrounding pixels, or anything.
|
||||
*
|
||||
* @author pochat
|
||||
*
|
||||
*/
|
||||
public class MatrixComposite implements Composite {
|
||||
|
||||
|
||||
final float[] matrix = new float[20];
|
||||
|
||||
|
||||
/**
|
||||
* Dismisses the source pixels. Just paint it black, or white, it only affects the dest RGB with the following formulae.
|
||||
*
|
||||
* R' = a*R + b*G + c*B + d*A + e;
|
||||
* G' = f*R + g*G + h*B + i*A + j;
|
||||
* B' = k*R + l*G + m*B + n*A + o;
|
||||
* A' = p*R + q*G + r*B + s*A + t;
|
||||
*
|
||||
* @param matrix a flat float[20] array, giving the a..t values;
|
||||
*/
|
||||
public MatrixComposite(float[] matrix) {
|
||||
if (matrix.length != this.matrix.length) {
|
||||
throw new Error("MatrixComposite matrix must be of length "+this.matrix.length);
|
||||
}
|
||||
System.arraycopy(matrix, 0, this.matrix, 0, this.matrix.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompositeContext createContext(ColorModel srcColorModel,
|
||||
ColorModel dstColorModel, RenderingHints hints) {
|
||||
return new MatrixCompositeContext(this);
|
||||
}
|
||||
|
||||
class MatrixCompositeContext implements CompositeContext {
|
||||
|
||||
MatrixComposite composite;
|
||||
|
||||
public MatrixCompositeContext(MatrixComposite composite) {
|
||||
this.composite = composite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
|
||||
if (src.getSampleModel().getDataType() != DataBuffer.TYPE_INT ||
|
||||
dstIn.getSampleModel().getDataType() != DataBuffer.TYPE_INT ||
|
||||
dstOut.getSampleModel().getDataType() != DataBuffer.TYPE_INT) {
|
||||
throw new IllegalStateException(
|
||||
"Source and destination must store pixels as INT.");
|
||||
}
|
||||
|
||||
int width = Math.min(src.getWidth(), dstIn.getWidth());
|
||||
int height = Math.min(src.getHeight(), dstIn.getHeight());
|
||||
|
||||
float alpha = 1.0f;
|
||||
|
||||
int[] srcPixel = new int[4];
|
||||
int[] dstPixel = new int[4];
|
||||
int[] srcPixels = new int[width];
|
||||
int[] dstPixels = new int[width];
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
src.getDataElements(0, y, width, 1, srcPixels);
|
||||
dstIn.getDataElements(0, y, width, 1, dstPixels);
|
||||
for (int x = 0; x < width; x++) {
|
||||
// pixels are stored as INT_ARGB
|
||||
// our arrays are [R, G, B, A]
|
||||
int pixel = srcPixels[x];
|
||||
srcPixel[0] = (pixel >> 16) & 0xFF;
|
||||
srcPixel[1] = (pixel >> 8) & 0xFF;
|
||||
srcPixel[2] = (pixel ) & 0xFF;
|
||||
srcPixel[3] = (pixel >> 24) & 0xFF;
|
||||
|
||||
pixel = dstPixels[x];
|
||||
dstPixel[0] = (pixel >> 16) & 0xFF;
|
||||
dstPixel[1] = (pixel >> 8) & 0xFF;
|
||||
dstPixel[2] = (pixel ) & 0xFF;
|
||||
dstPixel[3] = (pixel >> 24) & 0xFF;
|
||||
|
||||
int[] result = applyMatrix(matrix, dstPixel);
|
||||
|
||||
// mixes the result with the opacity
|
||||
dstPixels[x] = ((int) (dstPixel[3] + (result[3] - dstPixel[3]) * alpha) & 0xFF) << 24 |
|
||||
((int) (dstPixel[0] + (result[0] - dstPixel[0]) * alpha) & 0xFF) << 16 |
|
||||
((int) (dstPixel[1] + (result[1] - dstPixel[1]) * alpha) & 0xFF) << 8 |
|
||||
(int) (dstPixel[2] + (result[2] - dstPixel[2]) * alpha) & 0xFF;
|
||||
}
|
||||
dstOut.setDataElements(0, y, width, 1, dstPixels);
|
||||
}
|
||||
}
|
||||
|
||||
private int[] applyMatrix(float[] matrix, int[] dstPixel) {
|
||||
int[] result = new int[4];
|
||||
result[0] = Math.max(0, Math.min(255, (int) (matrix[ 0] * dstPixel[0] + matrix[ 1] * dstPixel[1] + matrix[ 2] * dstPixel[2] + matrix[ 3] * dstPixel[3] + matrix[ 4]) ));
|
||||
result[1] = Math.max(0, Math.min(255, (int) (matrix[ 5] * dstPixel[0] + matrix[ 6] * dstPixel[1] + matrix[ 7] * dstPixel[2] + matrix[ 8] * dstPixel[3] + matrix[ 9]) ));
|
||||
result[2] = Math.max(0, Math.min(255, (int) (matrix[10] * dstPixel[0] + matrix[11] * dstPixel[1] + matrix[12] * dstPixel[2] + matrix[13] * dstPixel[3] + matrix[14]) ));
|
||||
result[3] = Math.max(0, Math.min(255, (int) (matrix[15] * dstPixel[0] + matrix[16] * dstPixel[1] + matrix[17] * dstPixel[2] + matrix[18] * dstPixel[3] + matrix[19]) ));
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user