fixed some stuff in level editor
This commit is contained in:
parent
7fb1ea5d34
commit
107a57b710
@ -352,7 +352,6 @@ public class DetailedCellInfo extends JPanel {
|
|||||||
|
|
||||||
private void setInfo() {
|
private void setInfo() {
|
||||||
String[] info = editor.getCellArray()[i][j].split(",");
|
String[] info = editor.getCellArray()[i][j].split(",");
|
||||||
System.out.println(editor.getCellArray()[i][j]);
|
|
||||||
String type = info[0];
|
String type = info[0];
|
||||||
if (type.equals("BLOCK") || type.equals("block")) {
|
if (type.equals("BLOCK") || type.equals("block")) {
|
||||||
setTrueFalseInfo(type);
|
setTrueFalseInfo(type);
|
||||||
|
|||||||
@ -38,12 +38,12 @@ public class EditorSaveManager {
|
|||||||
FileWriter writer = new FileWriter("src/main/resources/maps/custom/" + editor.getMap().getName() + "-objectset.txt");
|
FileWriter writer = new FileWriter("src/main/resources/maps/custom/" + editor.getMap().getName() + "-objectset.txt");
|
||||||
int[][] set = editor.getMap().getImageCell().getMapForeground();
|
int[][] set = editor.getMap().getImageCell().getMapForeground();
|
||||||
String info = "";
|
String info = "";
|
||||||
for (int i = 0; i < editor.getMapWidth(); i++) {
|
for (int i = 0; i < editor.getMapHeight(); i++) {
|
||||||
for (int j = 0; j < editor.getMapHeight(); j++) {
|
for (int j = 0; j < editor.getMapWidth(); j++) {
|
||||||
if (j != 0) info += " ";
|
if (j != 0) info += " ";
|
||||||
info += set[i][j];
|
info += set[j][i];
|
||||||
|
if (j == editor.getMapWidth() - 1 && i != editor.getMapHeight() - 1) info += System.lineSeparator();
|
||||||
}
|
}
|
||||||
if (i != editor.getMapWidth() -1) info += System.lineSeparator();
|
|
||||||
}
|
}
|
||||||
writer.write(info);
|
writer.write(info);
|
||||||
writer.close();
|
writer.close();
|
||||||
@ -57,13 +57,13 @@ public class EditorSaveManager {
|
|||||||
FileWriter writer = new FileWriter("src/main/resources/maps/custom/" + editor.getMap().getName() + ".txt");
|
FileWriter writer = new FileWriter("src/main/resources/maps/custom/" + editor.getMap().getName() + ".txt");
|
||||||
String[][] set = editor.getCellArray();
|
String[][] set = editor.getCellArray();
|
||||||
String info = editor.getMapWidth() + " " + editor.getMapHeight() + System.lineSeparator();
|
String info = editor.getMapWidth() + " " + editor.getMapHeight() + System.lineSeparator();
|
||||||
for (int i = 0; i < editor.getMapWidth(); i++) {
|
for (int i = 0; i < editor.getMapHeight(); i++) {
|
||||||
for (int j = 0; j < editor.getMapHeight(); j++) {
|
for (int j = 0; j < editor.getMapWidth(); j++) {
|
||||||
if (j != 0) info += " ";
|
if (j != 0) info += " ";
|
||||||
if (set[j][i].split(",")[0].contains("door")) info += "EMPTY";
|
if (set[j][i].split(",")[0].contains("door")) info += "EMPTY";
|
||||||
else info += set[j][i];
|
else info += set[j][i];
|
||||||
|
if (j == editor.getMapWidth() - 1 && i != editor.getMapHeight() - 1) info += System.lineSeparator();
|
||||||
}
|
}
|
||||||
if (i != editor.getMapWidth() -1) info += System.lineSeparator();
|
|
||||||
}
|
}
|
||||||
writer.write(info);
|
writer.write(info);
|
||||||
writer.close();
|
writer.close();
|
||||||
@ -84,13 +84,13 @@ public class EditorSaveManager {
|
|||||||
for (String key : editor.getCellMap().keySet()) {
|
for (String key : editor.getCellMap().keySet()) {
|
||||||
info += "<cellmap> " + key + " " + editor.getCellMap().get(key) + System.lineSeparator();
|
info += "<cellmap> " + key + " " + editor.getCellMap().get(key) + System.lineSeparator();
|
||||||
}
|
}
|
||||||
info += "<soundmap> DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav";
|
info += "<soundmap> DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav" + System.lineSeparator();
|
||||||
for (int i = 0; i < editor.getMapWidth(); i++) {
|
for (int i = 0; i < editor.getMapHeight(); i++) {
|
||||||
for (int j = 0; j < editor.getMapHeight(); j++) {
|
for (int j = 0; j < editor.getMapWidth(); j++) {
|
||||||
if (j != 0) info += " ";
|
if (j != 0) info += " ";
|
||||||
info += set[i][j];
|
info += set[j][i];
|
||||||
|
if (j == editor.getMapWidth() - 1 && i != editor.getMapHeight() - 1) info += System.lineSeparator();
|
||||||
}
|
}
|
||||||
if (i != editor.getMapWidth() -1) info += System.lineSeparator();
|
|
||||||
}
|
}
|
||||||
writer.write(info);
|
writer.write(info);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|||||||
@ -245,7 +245,6 @@ public class InfoManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveDoor(String value, int x, int y) {
|
private void saveDoor(String value, int x, int y) {
|
||||||
System.out.println(value + y);
|
|
||||||
if (value.split(",")[0].contains("DOOR") && y == 0) {
|
if (value.split(",")[0].contains("DOOR") && y == 0) {
|
||||||
value = value.substring(0, value.indexOf(",")).toLowerCase() + value.substring(value.indexOf(","));
|
value = value.substring(0, value.indexOf(",")).toLowerCase() + value.substring(value.indexOf(","));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,8 +77,8 @@ public class LevelEditor extends JFrame {
|
|||||||
String name = nameVal.getText();
|
String name = nameVal.getText();
|
||||||
int width = Integer.parseInt(widthVal.getText());
|
int width = Integer.parseInt(widthVal.getText());
|
||||||
int height = Integer.parseInt(heightVal.getText());
|
int height = Integer.parseInt(heightVal.getText());
|
||||||
if (height < 0 || height > WindowOfFreeMove.CANVAS_HEIGHT || width < 0 || width > WindowOfFreeMove.CANVAS_WIDTH) {
|
if (height < 1 || height > WindowOfFreeMove.CANVAS_HEIGHT || width < 1 || width > WindowOfFreeMove.CANVAS_WIDTH) {
|
||||||
error.setText("<html><div style='text-align: center; width: 1300; color: red'>One or more values is out of bounds (from 0 to 50).</div></html>");
|
error.setText("<html><div style='text-align: center; width: 1300; color: red'>One or more values is out of bounds (from 1 to 50).</div></html>");
|
||||||
error.setVisible(true);
|
error.setVisible(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ public class LevelEditor extends JFrame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
displayMessage("Proceeding will overwrite any previous data for map with this name. To proceed click 'Save Current Map' again.");
|
displayMessage("Proceeding will overwrite any previous data for map with this name.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -179,7 +179,7 @@ public class MapLayersManager {
|
|||||||
else {
|
else {
|
||||||
value = info[0].toUpperCase();
|
value = info[0].toUpperCase();
|
||||||
}
|
}
|
||||||
if(info.length > 1) {
|
if(info.length > 1 && value.equals("BLOCK")) {
|
||||||
if (info[1].equals("u")) {
|
if (info[1].equals("u")) {
|
||||||
BufferedImage img = toBufferedImage(imagesOfTiles.get(editor.getCellMap().get(value)).getScaledInstance(50, 50, Image.SCALE_DEFAULT));
|
BufferedImage img = toBufferedImage(imagesOfTiles.get(editor.getCellMap().get(value)).getScaledInstance(50, 50, Image.SCALE_DEFAULT));
|
||||||
img = img.getSubimage(0, 0, 50, 25);
|
img = img.getSubimage(0, 0, 50, 25);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user