diff --git a/gameOfProd.iml b/gameOfProd.iml index 6e66935..efb2c86 100644 --- a/gameOfProd.iml +++ b/gameOfProd.iml @@ -11,19 +11,6 @@ - - - - - - - - - - - - - @@ -45,5 +32,6 @@ + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4689245..511a879 100644 --- a/pom.xml +++ b/pom.xml @@ -38,5 +38,11 @@ 2.0.6 test + + commons-io + commons-io + 2.5 + test + \ No newline at end of file diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/ChestCell.java b/src/main/java/ruscz/game/gameOfProd/Cells/ChestCell.java index ec870ae..a48592e 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/ChestCell.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/ChestCell.java @@ -10,7 +10,6 @@ import java.awt.*; import java.io.File; import java.io.FileNotFoundException; import java.util.LinkedList; -import java.util.Objects; import java.util.Scanner; public class ChestCell extends InteractionCell { @@ -137,17 +136,6 @@ public class ChestCell extends InteractionCell { } } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - ChestCell cell = (ChestCell) o; - return showItem == cell.showItem && - isActive == cell.isActive && - Objects.equals(chestInventory, cell.chestInventory); - } - public boolean isActive() { return isActive; } diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/DoorCell.java b/src/main/java/ruscz/game/gameOfProd/Cells/DoorCell.java index eedda3e..a78068c 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/DoorCell.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/DoorCell.java @@ -63,16 +63,6 @@ public class DoorCell extends InteractionCell { } } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - DoorCell doorCell = (DoorCell) o; - return isLocked == doorCell.isLocked && - directionVert == doorCell.directionVert; - } - public boolean isOpen() { return isOpen; } diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/EventMoveToCell.java b/src/main/java/ruscz/game/gameOfProd/Cells/EventMoveToCell.java index d287bf5..a9574d2 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/EventMoveToCell.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/EventMoveToCell.java @@ -53,16 +53,4 @@ public class EventMoveToCell extends Cell { getY() * getSize(), getSize(), getSize(), null); // g.drawString(Integer.toString(getId()), getX()* WindowOfFreeMove.CELL_SIZE, getY()* WindowOfFreeMove.CELL_SIZE); } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - EventMoveToCell that = (EventMoveToCell) o; - return id == that.id && - directionOut == that.directionOut && - paint == that.paint && - map.getName().equals(that.getMap().getName()); - } } diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/Npc.java b/src/main/java/ruscz/game/gameOfProd/Cells/Npc.java index e5ee78e..630b152 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/Npc.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/Npc.java @@ -12,7 +12,6 @@ import java.awt.image.BufferedImage; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.util.Objects; import java.util.Scanner; public class Npc extends Person { @@ -115,23 +114,6 @@ public class Npc extends Person { } } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - Npc npc = (Npc) o; - return direction == npc.direction && - width == npc.width && - height == npc.height && - offsetX == npc.offsetX && - offsetY == npc.offsetY && - widthCoef == npc.widthCoef && - heightCoef == npc.heightCoef && - Objects.equals(name, npc.name) && - Objects.equals(imageNpc, npc.imageNpc); - } - public void setDirection(int direction) { this.direction = direction; } diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/RandomEncounterCell.java b/src/main/java/ruscz/game/gameOfProd/Cells/RandomEncounterCell.java index bf3db18..4d143bb 100644 --- a/src/main/java/ruscz/game/gameOfProd/Cells/RandomEncounterCell.java +++ b/src/main/java/ruscz/game/gameOfProd/Cells/RandomEncounterCell.java @@ -14,13 +14,4 @@ public class RandomEncounterCell extends Cell { this.level = lvl; this.game = game; } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - RandomEncounterCell that = (RandomEncounterCell) o; - return level == that.level; - } } diff --git a/src/main/java/ruscz/game/gameOfProd/Image/ImageCell.java b/src/main/java/ruscz/game/gameOfProd/Image/ImageCell.java index 00f6463..4629638 100644 --- a/src/main/java/ruscz/game/gameOfProd/Image/ImageCell.java +++ b/src/main/java/ruscz/game/gameOfProd/Image/ImageCell.java @@ -37,11 +37,11 @@ public class ImageCell { String data = scanner.nextLine(); if (data.contains("")) { String[] mapInfo = data.split(" "); - imageTileset(mapInfo); + imageTileset(mapInfo[1]); } else if (data.contains("")) { String[] mapInfo = data.split(" "); - imageItem(mapInfo); + imageItem(mapInfo[1]); } else if (data.contains("")) { String[] mapInfo = data.split(" "); @@ -62,16 +62,16 @@ public class ImageCell { } } - private void imageTileset(String[] mapInfo) { + public void imageTileset(String tilesetInfo) { try { - image = ImageIO.read(new File("src/main/resources/tilesets/" + mapInfo[1])); + image = ImageIO.read(new File("src/main/resources/tilesets/" + tilesetInfo)); } catch (IOException e) { e.printStackTrace(); } - int width = Integer.parseInt(mapInfo[2]); - int height = Integer.parseInt(mapInfo[3]); - int tileSize = Integer.parseInt(mapInfo[4]); + int width = image.getWidth(); + int height = image.getHeight(); + int tileSize = 32; int Xtiles = width / tileSize; int Ytiles = height / tileSize; @@ -131,15 +131,15 @@ public class ImageCell { cellMap.put(cellInfo[1], Integer.parseInt(cellInfo[2])); } - public void imageItem(String[] itemInfo) { + public void imageItem(String itemInfo) { int imageWidth = 0; int imageHeight = 0; int size = 0; try { - image = ImageIO.read(new File("src/main/resources/items/" + itemInfo[1])); - imageWidth = Integer.parseInt(itemInfo[2]); - imageHeight = Integer.parseInt(itemInfo[3]); - size = Integer.parseInt(itemInfo[4]); + image = ImageIO.read(new File("src/main/resources/items/" + itemInfo)); + imageWidth = image.getWidth(); + imageHeight = image.getHeight(); + size = 32; } catch (IOException e) { e.printStackTrace(); } @@ -177,6 +177,14 @@ public class ImageCell { public int[][] getMapBackground() { return mapBackground; } + public void setMapBackground(int[][] mapBackground) { + this.mapBackground = mapBackground; + } + + public void setMapForeground(int[][] mapForeground) { + this.mapForeground = mapForeground; + } + public void paintBackground(Graphics g, int x, int y) { g.drawImage(imagesOfTiles.get(mapBackground[x][y]), x * WindowOfFreeMove.CELL_SIZE, y * WindowOfFreeMove.CELL_SIZE, WindowOfFreeMove.CELL_SIZE, WindowOfFreeMove.CELL_SIZE, null); diff --git a/src/main/java/ruscz/game/gameOfProd/LevelEditor/EditorSaveManager.java b/src/main/java/ruscz/game/gameOfProd/LevelEditor/EditorSaveManager.java index eecb584..11aae4b 100644 --- a/src/main/java/ruscz/game/gameOfProd/LevelEditor/EditorSaveManager.java +++ b/src/main/java/ruscz/game/gameOfProd/LevelEditor/EditorSaveManager.java @@ -1,8 +1,5 @@ package ruscz.game.gameOfProd.LevelEditor; -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -60,8 +57,8 @@ public class EditorSaveManager { 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 (set[i][j].split(",")[0].contains("door")) info += "EMPTY"; + else info += set[i][j]; if (j == editor.getMapWidth() - 1 && i != editor.getMapHeight() - 1) info += System.lineSeparator(); } } @@ -78,8 +75,7 @@ public class EditorSaveManager { int[][] set = editor.getMap().getImageCell().getMapBackground(); String info = ""; for (String tileset : editor.getOverview().getActiveTilesets()) { - BufferedImage image = ImageIO.read(new File("src/main/resources/tilesets/" + tileset)); - info += " " + tileset + " " + image.getWidth() + " " + image.getHeight() + " 32" + System.lineSeparator(); + info += " " + tileset + System.lineSeparator(); } for (String key : editor.getCellMap().keySet()) { info += " " + key + " " + editor.getCellMap().get(key) + System.lineSeparator(); diff --git a/src/main/java/ruscz/game/gameOfProd/LevelEditor/LevelEditor.java b/src/main/java/ruscz/game/gameOfProd/LevelEditor/LevelEditor.java index ec27f8c..f025fdc 100644 --- a/src/main/java/ruscz/game/gameOfProd/LevelEditor/LevelEditor.java +++ b/src/main/java/ruscz/game/gameOfProd/LevelEditor/LevelEditor.java @@ -116,7 +116,7 @@ public class LevelEditor extends JFrame { setResizable(false); } - private void createNewMap(String name, int width, int height) { + public void createNewMap(String name, int width, int height) { TypeOfCell[][] mapArray = new TypeOfCell[width][height]; for (int i = 0; i < width; i++) { Arrays.fill(mapArray[i], TypeOfCell.EMPTY); @@ -136,7 +136,7 @@ public class LevelEditor extends JFrame { startMapEditor(); } - private void startMapEditor() { + public void startMapEditor() { JPanel menu = new JPanel(); menu.setBounds(0, 0, 1300, 1000); @@ -263,7 +263,7 @@ public class LevelEditor extends JFrame { private void initializeCellMap() { cellMap.put("BLOCK", 0); - cellMap.put("INTER", 0); + cellMap.put("EVENT", 0); cellMap.put("TRIGGER", 0); cellMap.put("MOVETO", 0); cellMap.put("DOOR/DOORTO", 0); @@ -306,6 +306,10 @@ public class LevelEditor extends JFrame { return imagesOfTiles; } + public void setImagesOfTiles(LinkedList imagesOfTiles) { + this.imagesOfTiles = imagesOfTiles; + } + public InfoManager getInfoManager() { return infoManager; } @@ -316,8 +320,14 @@ public class LevelEditor extends JFrame { public HashMap getCellMap() { return cellMap; } + public void setCellMap(HashMap cellMap) { + this.cellMap = cellMap; + } + public String[][] getCellArray() { return cellArray; } + public void setCellArray(String[][] cellArray) { this.cellArray = cellArray; } + public void setOverview(TilesetOverview overview) { this.overview = overview; } diff --git a/src/main/java/ruscz/game/gameOfProd/LevelEditor/TilesetOverview.java b/src/main/java/ruscz/game/gameOfProd/LevelEditor/TilesetOverview.java index 9703ae6..1d6239c 100644 --- a/src/main/java/ruscz/game/gameOfProd/LevelEditor/TilesetOverview.java +++ b/src/main/java/ruscz/game/gameOfProd/LevelEditor/TilesetOverview.java @@ -82,7 +82,7 @@ public class TilesetOverview extends JFrame { offset += 70; } - private void generateOverview() { + public void generateOverview() { tilesetOffset = 0; imagesOfTiles = new LinkedList<>(); tilesetPanel.removeAll(); @@ -151,5 +151,7 @@ public class TilesetOverview extends JFrame { public LinkedList getActiveTilesets() { return activeTilesets; } + public void setActiveTilesets(LinkedList activeTilesets) { this.activeTilesets = activeTilesets; } + public JLabel getInfo() { return info; } } diff --git a/src/main/resources/maps/0/boss-tileset.txt b/src/main/resources/maps/0/boss-tileset.txt index 32732cf..ff49f34 100644 --- a/src/main/resources/maps/0/boss-tileset.txt +++ b/src/main/resources/maps/0/boss-tileset.txt @@ -1,7 +1,7 @@ - A5_Tiles.png 256 512 32 - Openspace1.png 512 512 32 - Openspace2.png 512 512 32 - D_Inside_House.png 512 512 32 + A5_Tiles.png + Openspace1.png + Openspace2.png + D_Inside_House.png BLOCK 2 MOVETO 1 EVENT 0 diff --git a/src/main/resources/maps/0/office-tileset.txt b/src/main/resources/maps/0/office-tileset.txt index e2882ae..cd52491 100644 --- a/src/main/resources/maps/0/office-tileset.txt +++ b/src/main/resources/maps/0/office-tileset.txt @@ -1,7 +1,7 @@ - A5_Tiles.png 256 512 32 - Openspace1.png 512 512 32 - Openspace2.png 512 512 32 - D_Inside_House.png 512 512 32 + A5_Tiles.png + Openspace1.png + Openspace2.png + D_Inside_House.png BLOCK 2 MOVETO 1 EVENT 3 diff --git a/src/main/resources/maps/0/openspace-tileset.txt b/src/main/resources/maps/0/openspace-tileset.txt index 2b4058e..8ebe1d8 100644 --- a/src/main/resources/maps/0/openspace-tileset.txt +++ b/src/main/resources/maps/0/openspace-tileset.txt @@ -1,8 +1,8 @@ - A5_Tiles.png 256 512 32 - Openspace1.png 512 512 32 - Openspace2.png 512 512 32 - D_Inside_House.png 512 512 32 - TransparentIcons.png 512 640 32 + A5_Tiles.png + Openspace1.png + Openspace2.png + D_Inside_House.png + TransparentIcons.png BLOCK 2 MOVETO 1 EVENT 0 diff --git a/src/main/resources/maps/0/treasure-tileset.txt b/src/main/resources/maps/0/treasure-tileset.txt index c53908b..faaa2ad 100644 --- a/src/main/resources/maps/0/treasure-tileset.txt +++ b/src/main/resources/maps/0/treasure-tileset.txt @@ -1,4 +1,4 @@ - CertificateOfShame.png 650 500 50 + CertificateOfShame.png BLOCK 0 MOVETO 0 EVENT 0 diff --git a/src/main/resources/maps/0/tutorial-tileset.txt b/src/main/resources/maps/0/tutorial-tileset.txt index 38dd70e..ab1ac7d 100644 --- a/src/main/resources/maps/0/tutorial-tileset.txt +++ b/src/main/resources/maps/0/tutorial-tileset.txt @@ -1,6 +1,6 @@ - A2_Ground.png 512 384 32 192 - D_OutDoor.png 512 512 32 256 - tutorialtiles.png 288 96 32 448 + A2_Ground.png + D_OutDoor.png + tutorialtiles.png BLOCK 120 MOVETO 277 EVENT 334 diff --git a/src/main/resources/maps/999/m6-objectset.txt b/src/main/resources/maps/999/m6-objectset.txt index ca48cd3..feceb86 100644 --- a/src/main/resources/maps/999/m6-objectset.txt +++ b/src/main/resources/maps/999/m6-objectset.txt @@ -1,10 +1,36 @@ -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 \ No newline at end of file +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \ No newline at end of file diff --git a/src/main/resources/maps/999/m6-tileset.txt b/src/main/resources/maps/999/m6-tileset.txt index d6917cb..603a851 100644 --- a/src/main/resources/maps/999/m6-tileset.txt +++ b/src/main/resources/maps/999/m6-tileset.txt @@ -1,10 +1,12 @@ - A2_Ground.png 512 384 32 - D_OutDoor.png 512 512 32 + A2_Ground.png + D_OutDoor.png + CHEST 0 + TRIGGER 147 BLOCK 120 MOVETO 277 EVENT 334 - TRIGGER 147 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + DOOR/DOORTO 0 + DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 @@ -40,3 +42,4 @@ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \ No newline at end of file diff --git a/src/main/resources/maps/custom/test-objectset.txt b/src/main/resources/maps/custom/test-objectset.txt new file mode 100644 index 0000000..feceb86 --- /dev/null +++ b/src/main/resources/maps/custom/test-objectset.txt @@ -0,0 +1,36 @@ +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0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test-tileset.txt b/src/main/resources/maps/custom/test-tileset.txt new file mode 100644 index 0000000..603a851 --- /dev/null +++ b/src/main/resources/maps/custom/test-tileset.txt @@ -0,0 +1,45 @@ + A2_Ground.png + D_OutDoor.png + CHEST 0 + TRIGGER 147 + BLOCK 120 + MOVETO 277 + EVENT 334 + DOOR/DOORTO 0 + DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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+1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \ No newline at end of file diff --git a/src/main/resources/maps/custom/test.txt b/src/main/resources/maps/custom/test.txt new file mode 100644 index 0000000..3e9f63e --- /dev/null +++ b/src/main/resources/maps/custom/test.txt @@ -0,0 +1,37 @@ +36 36 +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY TRIGGER,roses-are-red EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK +EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY SPAWN EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY +BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK +BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK +BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK +BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK +BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK BLOCK EMPTY BLOCK BLOCK EMPTY EMPTY BLOCK +BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK +BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK BLOCK EMPTY BLOCK BLOCK EMPTY EMPTY BLOCK +BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK BLOCK BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK +BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK +BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY BLOCK EMPTY BLOCK EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY BLOCK +BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK EMPTY BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK \ No newline at end of file diff --git a/src/test/java/ruscz/game/gameOfProd/LevelEditor/LevelEditorTest.java b/src/test/java/ruscz/game/gameOfProd/LevelEditor/LevelEditorTest.java new file mode 100644 index 0000000..abdd8a8 --- /dev/null +++ b/src/test/java/ruscz/game/gameOfProd/LevelEditor/LevelEditorTest.java @@ -0,0 +1,199 @@ +package ruscz.game.gameOfProd.LevelEditor; + +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import ruscz.game.gameOfProd.Cells.TypeOfCell; +import ruscz.game.gameOfProd.Image.ImageCell; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Scanner; +import java.util.stream.Stream; + +public class LevelEditorTest { + + public static Stream argumentsStream() { + return Stream.of( + Arguments.of((Object) new String[]{"A2_Ground.png"}), + Arguments.of((Object) new String[]{"A2_Ground.png", "A5_Tiles.png"}), + Arguments.of((Object) new String[]{"Openspace1.png", "Openspace2.png", "CertificateOfShame.png"}), + Arguments.of((Object) new String[]{"D_Inside_House.png", "D_OutDoor.png", "dark-door.png", "tutorialtiles.png"}) + ); + } + + @ParameterizedTest + @MethodSource("argumentsStream") + public void generateOverview_generateTilesetsFromImages_CorrectlyGeneratedTilesets(String[] tilesets) { + //Arrange + TilesetOverview tilesetOverview; + LinkedList activeTilesets; + ImageCell imageCell; + + //Act + tilesetOverview = new TilesetOverview(); + tilesetOverview.setVisible(false); + activeTilesets = new LinkedList<>(); + imageCell = new ImageCell(); + for (String tileset : tilesets) { + activeTilesets.add(tileset); + imageCell.imageTileset(tileset); + } + tilesetOverview.setActiveTilesets(activeTilesets); + tilesetOverview.generateOverview(); + + //Assert + for (int i = 0; i < tilesetOverview.getImagesOfTiles().size(); i++) { + Assertions.assertTrue(compareImages(tilesetOverview.getImagesOfTiles().get(i), imageCell.getImagesOfTiles().get(i))); + } + } + + public static Stream argumentsStream2() { + return Stream.of( + Arguments.of("test", 10, 10) + ); + } + + @ParameterizedTest + @MethodSource("argumentsStream2") + public void createMap_createNewMapForLevelEditor_CorrectlyCreatedMap(String name, int width, int height) { + //Arrange + LevelEditor levelEditor; + TypeOfCell[][] mapArray; + + //Act + levelEditor = new LevelEditor(); + levelEditor.setVisible(false); + levelEditor.createNewMap(name, width, height); + mapArray = new TypeOfCell[width][height]; + for (int i = 0; i < width; i++) { + Arrays.fill(mapArray[i], TypeOfCell.EMPTY); + } + + //Assert + Assertions.assertEquals(width, levelEditor.getMapWidth()); + Assertions.assertEquals(height, levelEditor.getMapHeight()); + Assertions.assertEquals(name, levelEditor.getMap().getName()); + for (int i = 0; i < mapArray.length; i++) { + for (int j = 0; j < mapArray[0].length; j++) { + Assertions.assertEquals(mapArray[i][j], levelEditor.getMap().getMapArray()[i][j]); + } + } + } + + @Test + public void saveMap_saveMapToFiles_CorrectlySavedMap() throws IOException { + //Arrange + LevelEditor levelEditor; + TilesetOverview tilesetOverview; + EditorSaveManager editorSaveManager; + String[][] cellArray; + int[][] mapForeground; + int[][] mapBackground; + Scanner scanner; + File file; + + //Act + levelEditor = new LevelEditor(); + levelEditor.setVisible(false); + levelEditor.createNewMap("test", 36, 36); + levelEditor.startMapEditor(); + + cellArray = new String[36][36]; + file = new File("src/main/resources/maps/999/m6.txt"); + scanner = new Scanner(file); + scanner.nextLine(); + int i = 0; + while (scanner.hasNextLine()) { + cellArray[i] = scanner.nextLine().split(" "); + i++; + } + levelEditor.setCellArray(cellArray); + + mapBackground = new int[36][36]; + file = new File("src/main/resources/maps/999/m6-tileset.txt"); + scanner = new Scanner(file); + i = 0; + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + if (!line.contains("") && !line.contains("") && !line.contains("") && !line.contains("")) { + String[] values = line.split(" "); + for (int j = 0; j < values.length; j++) { + mapBackground[j][i] = Integer.parseInt(values[j]); + } + i++; + } + } + levelEditor.getMap().getImageCell().setMapBackground(mapBackground); + + mapForeground = new int[36][36]; + file = new File("src/main/resources/maps/999/m6-objectset.txt"); + scanner = new Scanner(file); + i = 0; + while (scanner.hasNextLine()) { + String[] values = scanner.nextLine().split(" "); + for (int j = 0; j < values.length; j++) { + mapForeground[j][i] = Integer.parseInt(values[j]); + } + i++; + } + levelEditor.getMap().getImageCell().setMapForeground(mapForeground); + + levelEditor.setOverview(new TilesetOverview()); + tilesetOverview = levelEditor.getOverview(); + tilesetOverview.setVisible(false); + LinkedList activeTilesets = new LinkedList<>(); + activeTilesets.add("A2_Ground.png"); + activeTilesets.add("D_OutDoor.png"); + tilesetOverview.setActiveTilesets(activeTilesets); + tilesetOverview.generateOverview(); + levelEditor.setImagesOfTiles(tilesetOverview.getImagesOfTiles()); + + HashMap cellMap = new HashMap<>(); + cellMap.put("BLOCK", 120); + cellMap.put("EVENT", 334); + cellMap.put("TRIGGER", 147); + cellMap.put("MOVETO", 277); + cellMap.put("DOOR/DOORTO", 0); + cellMap.put("CHEST", 0); + levelEditor.setCellMap(cellMap); + + + editorSaveManager = new EditorSaveManager(levelEditor); + editorSaveManager.saveMap(); + + //Assert + File file1 = new File("src/main/resources/maps/999/m6.txt"); + File file2 = new File("src/main/resources/maps/custom/test.txt"); + File file1Tileset = new File("src/main/resources/maps/999/m6-tileset.txt"); + File file2Tileset = new File("src/main/resources/maps/custom/test-tileset.txt"); + File file1Objectset = new File("src/main/resources/maps/999/m6-objectset.txt"); + File file2Objectset = new File("src/main/resources/maps/custom/test-objectset.txt"); + Assertions.assertTrue(FileUtils.contentEquals(file1, file2)); + Assertions.assertTrue(FileUtils.contentEquals(file1Tileset, file2Tileset)); + Assertions.assertTrue(FileUtils.contentEquals(file1Objectset, file2Objectset)); + } + + public static boolean compareImages(BufferedImage imgA, BufferedImage imgB) { + if (imgA.getWidth() != imgB.getWidth() || imgA.getHeight() != imgB.getHeight()) { + return false; + } + int width = imgA.getWidth(); + int height = imgA.getHeight(); + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + if (imgA.getRGB(x, y) != imgB.getRGB(x, y)) { + return false; + } + } + } + return true; + } +}