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();
|
||||
}
|
||||
|
||||
public void clearBookMarks() {
|
||||
if (bookmark != null)
|
||||
bookmark.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,7 @@ public class SaveLoadScene extends UIScene {
|
||||
break;
|
||||
case Load:
|
||||
try {
|
||||
MapViewScene.instance().clearBookMarks();
|
||||
Forge.setTransitionScreen(new TransitionScreen(() -> {
|
||||
loaded = false;
|
||||
if (WorldSave.load(currentSlot)) {
|
||||
@@ -253,6 +254,7 @@ public class SaveLoadScene extends UIScene {
|
||||
Current.player().resetQuestFlags();
|
||||
Current.player().setCharacterFlag("newGamePlus", 1);
|
||||
AdventurePlayer.current().addQuest("28");
|
||||
WorldSave.getCurrentSave().clearBookmarks();
|
||||
WorldStage.getInstance().enterSpawnPOI();
|
||||
SoundSystem.instance.changeBackgroundTrack();
|
||||
Forge.switchScene(GameScene.instance());
|
||||
|
||||
@@ -110,7 +110,7 @@ public class BiomeStructure {
|
||||
}
|
||||
|
||||
public ColorMap sourceImage() {
|
||||
return new ColorMap(Config.instance().getFile(data.sourcePath));
|
||||
return new ColorMap(Config.instance().getFile(data.sourcePath), data.sourcePath);
|
||||
}
|
||||
|
||||
public String sourceImagePath() {
|
||||
@@ -118,8 +118,7 @@ public class BiomeStructure {
|
||||
}
|
||||
|
||||
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.Pixmap;
|
||||
|
||||
public class ColorMap
|
||||
{
|
||||
public class ColorMap {
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final Color[] data;
|
||||
public ColorMap(int w,int h)
|
||||
{
|
||||
width=w;
|
||||
height=h;
|
||||
data=new Color[w*h];
|
||||
for(int i=0;i<w*h;i++)
|
||||
data[i]=new Color();
|
||||
|
||||
public ColorMap(int w, int h) {
|
||||
width = w;
|
||||
height = h;
|
||||
data = new Color[w * h];
|
||||
for (int i = 0; i < w * h; i++)
|
||||
data[i] = new Color();
|
||||
}
|
||||
|
||||
public ColorMap(FileHandle file) {
|
||||
if (file.exists()) {
|
||||
Pixmap pdata=new Pixmap(file);
|
||||
width=pdata.getWidth();
|
||||
height=pdata.getHeight();
|
||||
data=new Color[width*height];
|
||||
for(int y=0;y<height;y++)
|
||||
for(int x=0;x<width;x++)
|
||||
{
|
||||
data[x+y*width]=new Color(pdata.getPixel(x,y));
|
||||
public ColorMap(FileHandle file, String path) {
|
||||
if (file != null && file.exists()) {
|
||||
Pixmap pdata = new Pixmap(file);
|
||||
width = pdata.getWidth();
|
||||
height = pdata.getHeight();
|
||||
data = new Color[width * height];
|
||||
for (int y = 0; y < height; y++)
|
||||
for (int x = 0; x < width; x++) {
|
||||
data[x + y * width] = new Color(pdata.getPixel(x, y));
|
||||
}
|
||||
pdata.dispose();
|
||||
} else {
|
||||
width = 0;
|
||||
height = 0;
|
||||
data = new Color[0];
|
||||
System.err.println("Cannot find file for ColorMap: " + file.path());
|
||||
width = 1;
|
||||
height = 1;
|
||||
data = new Color[1];
|
||||
for (int i = 0; i < width * height; i++)
|
||||
data[i] = new Color();
|
||||
System.err.println("Cannot find file for ColorMap: " + path);
|
||||
}
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
public int getHeight()
|
||||
{
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
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) {
|
||||
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.player.AdventurePlayer;
|
||||
import forge.adventure.pointofintrest.PointOfInterest;
|
||||
import forge.adventure.pointofintrest.PointOfInterestChanges;
|
||||
import forge.adventure.scene.MapViewScene;
|
||||
import forge.adventure.scene.SaveLoadScene;
|
||||
import forge.adventure.stage.PointOfInterestMapSprite;
|
||||
import forge.adventure.stage.WorldStage;
|
||||
import forge.adventure.util.AdventureModes;
|
||||
import forge.adventure.util.Config;
|
||||
@@ -183,4 +186,20 @@ public class WorldSave {
|
||||
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