diff --git a/pom.xml b/pom.xml
index 511a879..18a3cc0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,5 +44,11 @@
2.5
test
+
+ org.junit.jupiter
+ junit-jupiter
+ RELEASE
+ test
+
\ No newline at end of file
diff --git a/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java b/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java
index 05bae83..4ba3182 100644
--- a/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java
+++ b/src/main/java/ruscz/game/gameOfProd/Cells/InteractionCell.java
@@ -205,7 +205,9 @@ public class InteractionCell extends Cell {
}
}
else {
- dialog.skipShowText();
+ if (!message.contains("cutscene")){
+ dialog.skipShowText();
+ }
}
}
diff --git a/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java b/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java
index 404b6a2..39b0084 100644
--- a/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java
+++ b/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java
@@ -198,7 +198,7 @@ public class WindowOfFreeMove extends JLayeredPane {
mapManager.createMap();
isReadyToPaint = true;
- Timer timer = new Timer(10, actionEvent -> {
+ Timer timer = new Timer(20, actionEvent -> {
mapManager.getActualMap().getPerson().move();
camera.moveCamera();
canvas.repaint();
@@ -240,37 +240,49 @@ public class WindowOfFreeMove extends JLayeredPane {
mapManager.getActualMap().getImageCell().paintBackground(g2D, j, i);
}
for (Cell cell : mapManager.getActualMap().getMoveToCells()) {
- if (cell.getY() == i) cell.paint(g2D);
+ if (cell.getY() == i && isinView(cell)) cell.paint(g2D);
}
for (Block cell : mapManager.getActualMap().getBlocks()) {
- if (cell.getY() == i && !cell.isPartial()) cell.paint(g2D);
+ if (cell.getY() == i && !cell.isPartial() && isinView(cell)) cell.paint(g2D);
}
if (mapManager.getActualMap().getPerson().getY() == i && mapManager.getActualMap().getPerson().getDirectionMoveLast() != KEY_UP) mapManager.getActualMap().getPerson().paint(g2D);
for (Cell cell : mapManager.getActualMap().getInteractionEventCells()) {
- if (cell.getY() == i) cell.paint(g2D);
+ if (cell.getY() == i && isinView(cell)) cell.paint(g2D);
}
for (ChestCell cell : mapManager.getActualMap().getChestCells()) {
- if (cell.getY() == i && cell.getPaint()) cell.paint(g2D);
+ if (cell.getY() == i && cell.getPaint() && isinView(cell)) cell.paint(g2D);
}
if (mapManager.getActualMap().getPerson().getY() == (i-1) && mapManager.getActualMap().getPerson().getDirectionMoveLast() == KEY_UP) mapManager.getActualMap().getPerson().paint(g2D);
for (Block cell : mapManager.getActualMap().getBlocks()) {
- if (cell.getY() == i && cell.isPartial()) cell.paint(g2D);
+ if (cell.getY() == i && cell.isPartial() && isinView(cell)) cell.paint(g2D);
}
for (DoorCell cell : mapManager.getActualMap().getDoorCells()) {
- if (cell.getY() == i) cell.paint(g2D);
+ if (cell.getY() == i && isinView(cell)) cell.paint(g2D);
}
for (Person person : mapManager.getActualMap().getNpcs()) {
- if (person.getY() == i) person.paint(g2D);
+ if (person.getY() == i && isinView(person)) person.paint(g2D);
}
for (int j = 0; j < mapManager.getActualMap().getCanvasSize()[0]; j++) {
- mapManager.getActualMap().getImageCell().paintForeground(g2D, j, i);
+ if (isinView(j, i)) mapManager.getActualMap().getImageCell().paintForeground(g2D, j, i);
}
for (ChestCell cell : mapManager.getActualMap().getChestCells()) {
- if (cell.getY() == i && cell.getShowItem()) cell.paint(g2D);
+ if (cell.getY() == i && cell.getShowItem() && isinView(cell)) cell.paint(g2D);
}
}
}
}
+
+ private boolean isinView(Cell cell) {
+ Boolean xValue = (CELL_SIZE * (cell.getX()+1) > -canvas.getLocation().x) && (CELL_SIZE * (cell.getX()-1) < (-canvas.getLocation().x + CELL_SIZE * WINDOW_WIDTH));
+ Boolean yValue = (CELL_SIZE * (cell.getY()+1) > -canvas.getLocation().y) && (CELL_SIZE * (cell.getY()-1) < (-canvas.getLocation().y + CELL_SIZE * WINDOW_HEIGHT));
+ return xValue && yValue;
+ }
+
+ private boolean isinView(int x, int y) {
+ Boolean xValue = (CELL_SIZE * (x+1) > -canvas.getLocation().x) && (CELL_SIZE * (x-1) < (-canvas.getLocation().x + CELL_SIZE * WINDOW_WIDTH));
+ Boolean yValue = (CELL_SIZE * (y+1) > -canvas.getLocation().y) && (CELL_SIZE * (y-1) < (-canvas.getLocation().y + CELL_SIZE * WINDOW_HEIGHT));
+ return xValue && yValue;
+ }
}
public class Foreground extends JPanel {
diff --git a/src/main/resources/save/savedGame/events.txt b/src/main/resources/save/savedGame/events.txt
index 1d47108..868b0a6 100644
--- a/src/main/resources/save/savedGame/events.txt
+++ b/src/main/resources/save/savedGame/events.txt
@@ -14,12 +14,12 @@
6
4
- true
+ false
14
16
- false
+ true
1
@@ -52,14 +52,14 @@
16
10
- false
+ true
false
8
13
false
- true
+ false
@@ -74,7 +74,7 @@
1
9
- false
+ true
12
@@ -104,13 +104,13 @@
4
1
false
- false
+ true
2
12
false
- false
+ true
17
@@ -126,13 +126,13 @@
4
18
- true
+ false
4
19
false
- false
+ true
@@ -152,13 +152,13 @@
6
2
- true
+ false
6
1
false
- false
+ true