mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
@@ -149,4 +149,8 @@ public class MapViewScene extends UIScene {
|
|||||||
return (posY / (float) WorldSave.getCurrentSave().getWorld().getTileSize() / (float) WorldSave.getCurrentSave().getWorld().getHeightInTiles()) * img.getHeight();
|
return (posY / (float) WorldSave.getCurrentSave().getWorld().getTileSize() / (float) WorldSave.getCurrentSave().getWorld().getHeightInTiles()) * img.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearBookMarks() {
|
||||||
|
if (bookmark != null)
|
||||||
|
bookmark.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ public class SaveLoadScene extends UIScene {
|
|||||||
break;
|
break;
|
||||||
case Load:
|
case Load:
|
||||||
try {
|
try {
|
||||||
|
MapViewScene.instance().clearBookMarks();
|
||||||
Forge.setTransitionScreen(new TransitionScreen(() -> {
|
Forge.setTransitionScreen(new TransitionScreen(() -> {
|
||||||
loaded = false;
|
loaded = false;
|
||||||
if (WorldSave.load(currentSlot)) {
|
if (WorldSave.load(currentSlot)) {
|
||||||
@@ -253,6 +254,7 @@ public class SaveLoadScene extends UIScene {
|
|||||||
Current.player().resetQuestFlags();
|
Current.player().resetQuestFlags();
|
||||||
Current.player().setCharacterFlag("newGamePlus", 1);
|
Current.player().setCharacterFlag("newGamePlus", 1);
|
||||||
AdventurePlayer.current().addQuest("28");
|
AdventurePlayer.current().addQuest("28");
|
||||||
|
WorldSave.getCurrentSave().clearBookmarks();
|
||||||
WorldStage.getInstance().enterSpawnPOI();
|
WorldStage.getInstance().enterSpawnPOI();
|
||||||
SoundSystem.instance.changeBackgroundTrack();
|
SoundSystem.instance.changeBackgroundTrack();
|
||||||
Forge.switchScene(GameScene.instance());
|
Forge.switchScene(GameScene.instance());
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class BiomeStructure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ColorMap sourceImage() {
|
public ColorMap sourceImage() {
|
||||||
return new ColorMap(Config.instance().getFile(data.sourcePath));
|
return new ColorMap(Config.instance().getFile(data.sourcePath), data.sourcePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String sourceImagePath() {
|
public String sourceImagePath() {
|
||||||
@@ -118,8 +118,7 @@ public class BiomeStructure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ColorMap maskImage() {
|
private ColorMap maskImage() {
|
||||||
return new ColorMap(Config.instance().getFile(data.maskPath));
|
return new ColorMap(Config.instance().getFile(data.maskPath), data.maskPath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,53 +4,53 @@ import com.badlogic.gdx.files.FileHandle;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
|
|
||||||
public class ColorMap
|
public class ColorMap {
|
||||||
{
|
|
||||||
private final int width;
|
private final int width;
|
||||||
private final int height;
|
private final int height;
|
||||||
private final Color[] data;
|
private final Color[] data;
|
||||||
public ColorMap(int w,int h)
|
|
||||||
{
|
public ColorMap(int w, int h) {
|
||||||
width=w;
|
width = w;
|
||||||
height=h;
|
height = h;
|
||||||
data=new Color[w*h];
|
data = new Color[w * h];
|
||||||
for(int i=0;i<w*h;i++)
|
for (int i = 0; i < w * h; i++)
|
||||||
data[i]=new Color();
|
data[i] = new Color();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColorMap(FileHandle file) {
|
public ColorMap(FileHandle file, String path) {
|
||||||
if (file.exists()) {
|
if (file != null && file.exists()) {
|
||||||
Pixmap pdata=new Pixmap(file);
|
Pixmap pdata = new Pixmap(file);
|
||||||
width=pdata.getWidth();
|
width = pdata.getWidth();
|
||||||
height=pdata.getHeight();
|
height = pdata.getHeight();
|
||||||
data=new Color[width*height];
|
data = new Color[width * height];
|
||||||
for(int y=0;y<height;y++)
|
for (int y = 0; y < height; y++)
|
||||||
for(int x=0;x<width;x++)
|
for (int x = 0; x < width; x++) {
|
||||||
{
|
data[x + y * width] = new Color(pdata.getPixel(x, y));
|
||||||
data[x+y*width]=new Color(pdata.getPixel(x,y));
|
|
||||||
}
|
}
|
||||||
pdata.dispose();
|
pdata.dispose();
|
||||||
} else {
|
} else {
|
||||||
width = 0;
|
width = 1;
|
||||||
height = 0;
|
height = 1;
|
||||||
data = new Color[0];
|
data = new Color[1];
|
||||||
System.err.println("Cannot find file for ColorMap: " + file.path());
|
for (int i = 0; i < width * height; i++)
|
||||||
|
data[i] = new Color();
|
||||||
|
System.err.println("Cannot find file for ColorMap: " + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
public int getHeight()
|
|
||||||
{
|
public int getHeight() {
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color getColor(int x, int y) {
|
public Color getColor(int x, int y) {
|
||||||
return data[x+y*width];
|
return data[x + y * width];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(int x, int y, Color c) {
|
public void setColor(int x, int y, Color c) {
|
||||||
data[x+y*width].set(c);
|
data[x + y * width].set(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,11 @@ package forge.adventure.world;
|
|||||||
|
|
||||||
import forge.adventure.data.DifficultyData;
|
import forge.adventure.data.DifficultyData;
|
||||||
import forge.adventure.player.AdventurePlayer;
|
import forge.adventure.player.AdventurePlayer;
|
||||||
|
import forge.adventure.pointofintrest.PointOfInterest;
|
||||||
import forge.adventure.pointofintrest.PointOfInterestChanges;
|
import forge.adventure.pointofintrest.PointOfInterestChanges;
|
||||||
|
import forge.adventure.scene.MapViewScene;
|
||||||
import forge.adventure.scene.SaveLoadScene;
|
import forge.adventure.scene.SaveLoadScene;
|
||||||
|
import forge.adventure.stage.PointOfInterestMapSprite;
|
||||||
import forge.adventure.stage.WorldStage;
|
import forge.adventure.stage.WorldStage;
|
||||||
import forge.adventure.util.AdventureModes;
|
import forge.adventure.util.AdventureModes;
|
||||||
import forge.adventure.util.Config;
|
import forge.adventure.util.Config;
|
||||||
@@ -183,4 +186,20 @@ public class WorldSave {
|
|||||||
pointOfInterestChanges.clear();
|
pointOfInterestChanges.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearBookmarks() {
|
||||||
|
for (PointOfInterest poi : currentSave.world.getAllPointOfInterest()) {
|
||||||
|
if (poi == null)
|
||||||
|
continue;
|
||||||
|
PointOfInterestMapSprite mapSprite = WorldStage.getInstance().getMapSprite(poi);
|
||||||
|
if (mapSprite != null)
|
||||||
|
mapSprite.setBookmarked(false, poi);
|
||||||
|
PointOfInterestChanges p = pointOfInterestChanges.get(poi.getID());
|
||||||
|
if (p == null)
|
||||||
|
continue;
|
||||||
|
p.setIsBookmarked(false);
|
||||||
|
p.save();
|
||||||
|
}
|
||||||
|
MapViewScene.instance().clearBookMarks();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user