mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
commit res
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package forge.adventure.editor;
|
||||
|
||||
import forge.adventure.util.Config;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -40,7 +40,7 @@ public class SwingAtlasPreview extends Box {
|
||||
JLabel image=new JLabel(element.getValue().get(0));
|
||||
add(new JLabel(element.getKey()));
|
||||
add(image);
|
||||
labels.add(new Pair<>(image, element.getValue()));
|
||||
labels.add(Pair.of(image, element.getValue()));
|
||||
}
|
||||
timer.restart();
|
||||
repaint();
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import forge.adventure.data.BiomSpriteData;
|
||||
import forge.adventure.world.PointOfInterest;
|
||||
import forge.adventure.world.WorldSave;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package forge.adventure.stage;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import forge.adventure.AdventureApplicationAdapter;
|
||||
import forge.adventure.character.CharacterSprite;
|
||||
import forge.adventure.character.MobSprite;
|
||||
@@ -13,7 +12,7 @@ import forge.adventure.scene.*;
|
||||
import forge.adventure.util.Current;
|
||||
import forge.adventure.world.World;
|
||||
import forge.adventure.world.WorldSave;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -22,7 +21,7 @@ import java.util.Random;
|
||||
|
||||
public class WorldStage extends GameStage {
|
||||
|
||||
private static WorldStage instance;
|
||||
private static WorldStage instance=null;
|
||||
protected MobSprite currentMob;
|
||||
protected Random rand = new Random();
|
||||
WorldBackground background;
|
||||
@@ -177,7 +176,7 @@ public class WorldStage extends GameStage {
|
||||
|
||||
if (data == null)
|
||||
return;
|
||||
Array<EnemyData> list = data.GetEnemyList();
|
||||
ArrayList<EnemyData> list = data.getEnemyList();
|
||||
if (list == null)
|
||||
return;
|
||||
spawnDelay -= delta;
|
||||
@@ -195,7 +194,7 @@ public class WorldStage extends GameStage {
|
||||
spawnPos.setAngleDeg(360 * rand.nextFloat());
|
||||
sprite.setX(player.getX() + spawnPos.x);
|
||||
sprite.setY(player.getY() + spawnPos.y);
|
||||
enemies.add(new Pair<>(globalTimer,sprite));
|
||||
enemies.add(Pair.of(globalTimer,sprite));
|
||||
foregroundSprites.addActor(sprite);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package forge.adventure.world;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import forge.adventure.data.BiomSpriteData;
|
||||
import forge.adventure.data.BiomSprites;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@@ -27,7 +27,7 @@ public class SpritesDataMap implements Serializable {
|
||||
mapObjects = new List[numberOfChunks][numberOfChunks];
|
||||
for (int x = 0; x < numberOfChunks; x++) {
|
||||
for (int y = 0; y < numberOfChunks; y++) {
|
||||
mapObjects[x][y] = new ArrayList();
|
||||
mapObjects[x][y] = new ArrayList<Pair<Vector2, Integer>>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class SpritesDataMap implements Serializable {
|
||||
int chunkY = (int) ((vector2.y / tileSize) / chunkSize);
|
||||
if (chunkX >= numberOfChunks || chunkY >= numberOfChunks || chunkX < 0 || chunkY < 0)
|
||||
return;
|
||||
mapObjects[chunkX][chunkY].add(new Pair<>(vector2, key));
|
||||
mapObjects[chunkX][chunkY].add(Pair.of(vector2, key));
|
||||
}
|
||||
|
||||
public List<Pair<Vector2, Integer>> positions(int chunkX, int chunkY) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
import com.badlogic.gdx.utils.Json;
|
||||
import forge.adventure.data.*;
|
||||
@@ -15,7 +14,7 @@ import forge.adventure.util.Config;
|
||||
import forge.adventure.util.Paths;
|
||||
import forge.adventure.util.SaveFileContent;
|
||||
import forge.adventure.util.Serializer;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -117,9 +116,9 @@ public class World implements Disposable, SaveFileContent {
|
||||
long biomIndex = getBiom(x, y);
|
||||
int terrain = getTerrainIndex(x, y);
|
||||
Pixmap drawingPixmap = new Pixmap(data.tileSize, data.tileSize, Pixmap.Format.RGBA8888);
|
||||
Array<DrawingInformation> information=new Array<>();
|
||||
ArrayList<DrawingInformation> information=new ArrayList<>();
|
||||
for (int i = 0; i < biomTexture.length; i++) {
|
||||
if ((biomIndex & 1 << i) == 0) {
|
||||
if ((biomIndex & 1L << i) == 0) {
|
||||
continue;
|
||||
}
|
||||
BiomTexture regions = biomTexture[i];
|
||||
@@ -139,7 +138,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
int otherTerrain = getTerrainIndex(x + nx, y + ny);
|
||||
|
||||
|
||||
if ((otherBiom & 1 << i) != 0 && biomTerrain <= otherTerrain)
|
||||
if ((otherBiom & 1L << i) != 0 && biomTerrain <= otherTerrain)
|
||||
neighbors |= (1 << bitIndex);
|
||||
|
||||
bitIndex--;
|
||||
@@ -151,7 +150,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
int baseneighbors=0;
|
||||
for (int ny = 1; ny > -2; ny--) {
|
||||
for (int nx = -1; nx < 2; nx++) {
|
||||
if ((getBiom(x + nx, y + ny) & (1 << i)) != 0 )
|
||||
if ((getBiom(x + nx, y + ny) & (1L << i)) != 0 )
|
||||
baseneighbors |= (1 << bitIndex);
|
||||
bitIndex--;
|
||||
}
|
||||
@@ -171,7 +170,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
|
||||
}
|
||||
counter=0;
|
||||
if(lastFullNeighbour<0&&information.size!=0)
|
||||
if(lastFullNeighbour<0&&information.size()!=0)
|
||||
information.get(0).neighbors=0b111_111_111;
|
||||
for(DrawingInformation info:information)
|
||||
{
|
||||
@@ -211,7 +210,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
random.setSeed(seed);
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(seed);
|
||||
|
||||
double noiseZoom = data.noiseZoomBiom;
|
||||
float noiseZoom = data.noiseZoomBiom;
|
||||
width = data.width;
|
||||
height = data.height;
|
||||
//save at all data
|
||||
@@ -253,10 +252,10 @@ public class World implements Disposable, SaveFileContent {
|
||||
for (int x = beginx; x < endx; x++) {
|
||||
for (int y = beginy; y < endy; y++) {
|
||||
//value 0-1 based on noise
|
||||
double noiseValue = (noise.eval(x / (double) width * noiseZoom, y / (double) height * noiseZoom) + 1) / 2;
|
||||
float noiseValue = ((float)noise.eval(x / (float) width * noiseZoom, y / (float) height * noiseZoom) + 1) / 2f;
|
||||
noiseValue *= biom.noiseWeight;
|
||||
//value 0-1 based on dist to origin
|
||||
double distanceValue = (Math.sqrt((x - biomXStart) * (x - biomXStart) + (y - biomYStart) * (y - biomYStart))) / (Math.max(biomWidth, biomHeight) / 2);
|
||||
float distanceValue = ((float)Math.sqrt((x - biomXStart) * (x - biomXStart) + (y - biomYStart) * (y - biomYStart))) / (Math.max(biomWidth, biomHeight) / 2f);
|
||||
distanceValue *= biom.distWeight;
|
||||
if (noiseValue + distanceValue < 1.0 || biom.invertHeight && (1 - noiseValue) + distanceValue < 1.0) {
|
||||
Color color = biom.GetColor();
|
||||
@@ -267,13 +266,13 @@ public class World implements Disposable, SaveFileContent {
|
||||
color.fromHsv(hsv);
|
||||
pix.setColor(color.r, color.g, color.b, 1);
|
||||
pix.drawPixel(x, y);
|
||||
biomMap[x][y] |= (1 << biomIndex);
|
||||
biomMap[x][y] |= (1L << biomIndex);
|
||||
int terrainCounter=1;
|
||||
if(biom.terrain==null)
|
||||
continue;
|
||||
for(BiomTerrainData terrain:biom.terrain)
|
||||
{
|
||||
double terrainNoise = (noise.eval(x / (double) width * (noiseZoom*terrain.resolution), y / (double) height * (noiseZoom*terrain.resolution)) + 1) / 2;
|
||||
float terrainNoise = ((float)noise.eval(x / (float) width * (noiseZoom*terrain.resolution), y / (float) height * (noiseZoom*terrain.resolution)) + 1) / 2;
|
||||
if(terrainNoise>=terrain.min&&terrainNoise<=terrain.max)
|
||||
{
|
||||
terrainMap[x][y]=terrainCounter;
|
||||
@@ -380,7 +379,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
continue;
|
||||
usedEdges.add((long)i|((long)smallestIndex<<32));
|
||||
usedEdges.add((long)i<<32|((long)smallestIndex));
|
||||
allSortedTowns.add(new Pair<>(current, towns.get(smallestIndex)));
|
||||
allSortedTowns.add(Pair.of(current, towns.get(smallestIndex)));
|
||||
}
|
||||
|
||||
biomIndex++;
|
||||
@@ -393,7 +392,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
for (int x = (int) currentPoint.x - 1; x < currentPoint.x + 2; x++) {
|
||||
for (int y = (int) currentPoint.y - 1; y < currentPoint.y + 2; y++) {
|
||||
if(x<0||y<=0||x>=width||y>height)continue;
|
||||
biomMap[x][height - y] |= (1 << biomIndex);
|
||||
biomMap[x][height - y] |= (1L << biomIndex);
|
||||
pix.drawPixel(x, height-y);
|
||||
}
|
||||
}
|
||||
@@ -426,7 +425,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
}
|
||||
|
||||
if( (int)currentPoint.x<0|| (int)currentPoint.y<=0|| (int)currentPoint.x>=width|| (int)currentPoint.y>height)continue;
|
||||
biomMap[(int) currentPoint.x][height - (int) currentPoint.y] |= (1 << biomIndex);
|
||||
biomMap[(int) currentPoint.x][height - (int) currentPoint.y] |= (1L << biomIndex);
|
||||
pix.drawPixel((int) currentPoint.x, height - (int) currentPoint.y);
|
||||
}
|
||||
|
||||
@@ -446,7 +445,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
if (spriteNoise >= sprite.startArea && spriteNoise <= sprite.endArea) {
|
||||
if (random.nextFloat() <= sprite.density) {
|
||||
String spriteKey = sprite.key();
|
||||
int key = -1;
|
||||
int key;
|
||||
if (!mapObjectIds.containsKey(spriteKey)) {
|
||||
|
||||
key = mapObjectIds.put(sprite.key(), sprite, data.GetBiomSprites());
|
||||
@@ -454,7 +453,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
key = mapObjectIds.intKey(spriteKey);
|
||||
}
|
||||
mapObjectIds.putPosition(key, new Vector2((float) x * data.tileSize + (random.nextFloat() * data.tileSize), (float) y * data.tileSize + (random.nextFloat() * data.tileSize)));
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user