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() {
|
||||
String[] info = editor.getCellArray()[i][j].split(",");
|
||||
System.out.println(editor.getCellArray()[i][j]);
|
||||
String type = info[0];
|
||||
if (type.equals("BLOCK") || type.equals("block")) {
|
||||
setTrueFalseInfo(type);
|
||||
|
||||
@ -38,12 +38,12 @@ public class EditorSaveManager {
|
||||
FileWriter writer = new FileWriter("src/main/resources/maps/custom/" + editor.getMap().getName() + "-objectset.txt");
|
||||
int[][] set = editor.getMap().getImageCell().getMapForeground();
|
||||
String info = "";
|
||||
for (int i = 0; i < editor.getMapWidth(); i++) {
|
||||
for (int j = 0; j < editor.getMapHeight(); j++) {
|
||||
for (int i = 0; i < editor.getMapHeight(); i++) {
|
||||
for (int j = 0; j < editor.getMapWidth(); j++) {
|
||||
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.close();
|
||||
@ -57,13 +57,13 @@ public class EditorSaveManager {
|
||||
FileWriter writer = new FileWriter("src/main/resources/maps/custom/" + editor.getMap().getName() + ".txt");
|
||||
String[][] set = editor.getCellArray();
|
||||
String info = editor.getMapWidth() + " " + editor.getMapHeight() + System.lineSeparator();
|
||||
for (int i = 0; i < editor.getMapWidth(); i++) {
|
||||
for (int j = 0; j < editor.getMapHeight(); j++) {
|
||||
for (int i = 0; i < editor.getMapHeight(); i++) {
|
||||
for (int j = 0; j < editor.getMapWidth(); j++) {
|
||||
if (j != 0) info += " ";
|
||||
if (set[j][i].split(",")[0].contains("door")) info += "EMPTY";
|
||||
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.close();
|
||||
@ -84,13 +84,13 @@ public class EditorSaveManager {
|
||||
for (String key : editor.getCellMap().keySet()) {
|
||||
info += "<cellmap> " + key + " " + editor.getCellMap().get(key) + System.lineSeparator();
|
||||
}
|
||||
info += "<soundmap> DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav";
|
||||
for (int i = 0; i < editor.getMapWidth(); i++) {
|
||||
for (int j = 0; j < editor.getMapHeight(); j++) {
|
||||
info += "<soundmap> DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav" + System.lineSeparator();
|
||||
for (int i = 0; i < editor.getMapHeight(); i++) {
|
||||
for (int j = 0; j < editor.getMapWidth(); j++) {
|
||||
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.close();
|
||||
|
||||
@ -245,7 +245,6 @@ public class InfoManager {
|
||||
}
|
||||
|
||||
private void saveDoor(String value, int x, int y) {
|
||||
System.out.println(value + y);
|
||||
if (value.split(",")[0].contains("DOOR") && y == 0) {
|
||||
value = value.substring(0, value.indexOf(",")).toLowerCase() + value.substring(value.indexOf(","));
|
||||
}
|
||||
|
||||
@ -77,8 +77,8 @@ public class LevelEditor extends JFrame {
|
||||
String name = nameVal.getText();
|
||||
int width = Integer.parseInt(widthVal.getText());
|
||||
int height = Integer.parseInt(heightVal.getText());
|
||||
if (height < 0 || height > WindowOfFreeMove.CANVAS_HEIGHT || width < 0 || 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>");
|
||||
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 1 to 50).</div></html>");
|
||||
error.setVisible(true);
|
||||
return;
|
||||
}
|
||||
@ -233,7 +233,7 @@ public class LevelEditor extends JFrame {
|
||||
|
||||
@Override
|
||||
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
|
||||
|
||||
@ -179,7 +179,7 @@ public class MapLayersManager {
|
||||
else {
|
||||
value = info[0].toUpperCase();
|
||||
}
|
||||
if(info.length > 1) {
|
||||
if(info.length > 1 && value.equals("BLOCK")) {
|
||||
if (info[1].equals("u")) {
|
||||
BufferedImage img = toBufferedImage(imagesOfTiles.get(editor.getCellMap().get(value)).getScaledInstance(50, 50, Image.SCALE_DEFAULT));
|
||||
img = img.getSubimage(0, 0, 50, 25);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user