mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
nearbyTilesInfo issue has been solved
Former-commit-id: fea5f44cb768a565e3275eb711996758fec5d5d9 Former-commit-id: d24dbd5e87bcd70abf583bcf637d83dfef724e79
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -42,6 +42,8 @@ public class GameMap {
|
|||||||
private char globalLight;
|
private char globalLight;
|
||||||
private WorldTime worldTime;
|
private WorldTime worldTime;
|
||||||
|
|
||||||
|
public static final int TILES_SUPPORTED = MapLayer.RANGE * PairedMapLayer.RANGE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param width
|
* @param width
|
||||||
* @param height
|
* @param height
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class MapLayer implements Iterable<Byte> {
|
|||||||
public int width;
|
public int width;
|
||||||
public int height;
|
public int height;
|
||||||
|
|
||||||
public static final int TILES_SUPPORTED = 256;
|
public static final int RANGE = 256;
|
||||||
|
|
||||||
public MapLayer(int width, int height) {
|
public MapLayer(int width, int height) {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
|
|||||||
@@ -64,7 +64,12 @@ public class MapCamera {
|
|||||||
, TileNameCode.DIRT
|
, TileNameCode.DIRT
|
||||||
, TileNameCode.GRASS
|
, TileNameCode.GRASS
|
||||||
, TileNameCode.SAND
|
, TileNameCode.SAND
|
||||||
|
, TileNameCode.SAND_BEACH
|
||||||
|
, TileNameCode.SAND_RED
|
||||||
|
, TileNameCode.SAND_DESERT
|
||||||
|
, TileNameCode.SAND_BLACK
|
||||||
, TileNameCode.GRAVEL
|
, TileNameCode.GRAVEL
|
||||||
|
, TileNameCode.GRAVEL_GREY
|
||||||
, TileNameCode.SNOW
|
, TileNameCode.SNOW
|
||||||
, TileNameCode.ICE_NATURAL
|
, TileNameCode.ICE_NATURAL
|
||||||
, TileNameCode.WATER
|
, TileNameCode.WATER
|
||||||
@@ -211,7 +216,7 @@ public class MapCamera {
|
|||||||
int thisTileY = thisTile / PairedMapLayer.RANGE;
|
int thisTileY = thisTile / PairedMapLayer.RANGE;
|
||||||
|
|
||||||
if (drawModeTilesBlendMul) {
|
if (drawModeTilesBlendMul) {
|
||||||
if (isBlendMul((byte) thisTile)) {
|
if (isBlendMul(thisTile)) {
|
||||||
drawTile(mode, x, y, thisTileX, thisTileY);
|
drawTile(mode, x, y, thisTileX, thisTileY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -414,15 +419,15 @@ public class MapCamera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isConnectSelf(int b) {
|
private static boolean isConnectSelf(int b) {
|
||||||
return (Arrays.asList(TILES_CONNECT_SELF).contains((byte) b));
|
return Arrays.asList(TILES_CONNECT_SELF).contains(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isDarkenAir(int b) {
|
private static boolean isDarkenAir(int b) {
|
||||||
return (Arrays.asList(TILES_DARKEN_AIR).contains((byte) b));
|
return Arrays.asList(TILES_DARKEN_AIR).contains(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isBlendMul(int b) {
|
private static boolean isBlendMul(int b) {
|
||||||
return (Arrays.asList(TILES_BLEND_MUL).contains((byte) b));
|
return Arrays.asList(TILES_BLEND_MUL).contains(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setBlendModeMul() {
|
private static void setBlendModeMul() {
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ public class TileNameCode {
|
|||||||
public static final int SAND_RED = TilePropCodex.indexDamageToArrayAddr(5, 2);
|
public static final int SAND_RED = TilePropCodex.indexDamageToArrayAddr(5, 2);
|
||||||
public static final int SAND_DESERT = TilePropCodex.indexDamageToArrayAddr(5, 3);
|
public static final int SAND_DESERT = TilePropCodex.indexDamageToArrayAddr(5, 3);
|
||||||
public static final int SAND_BLACK = TilePropCodex.indexDamageToArrayAddr(5, 4);
|
public static final int SAND_BLACK = TilePropCodex.indexDamageToArrayAddr(5, 4);
|
||||||
|
|
||||||
public static final int GRAVEL = TilePropCodex.indexDamageToArrayAddr(6, 0);
|
public static final int GRAVEL = TilePropCodex.indexDamageToArrayAddr(6, 0);
|
||||||
|
public static final int GRAVEL_GREY = TilePropCodex.indexDamageToArrayAddr(6, 1);
|
||||||
|
|
||||||
public static final int ORE_COPPER = TilePropCodex.indexDamageToArrayAddr(7, 0);
|
public static final int ORE_COPPER = TilePropCodex.indexDamageToArrayAddr(7, 0);
|
||||||
public static final int ORE_IRON = TilePropCodex.indexDamageToArrayAddr(7, 1);
|
public static final int ORE_IRON = TilePropCodex.indexDamageToArrayAddr(7, 1);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.Torvald.Terrarum.GameMap.PairedMapLayer;
|
|||||||
import org.apache.commons.csv.CSVRecord;
|
import org.apache.commons.csv.CSVRecord;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Hashtable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +16,7 @@ public class TilePropCodex {
|
|||||||
private static TileProp[] tileProps;
|
private static TileProp[] tileProps;
|
||||||
|
|
||||||
public TilePropCodex() {
|
public TilePropCodex() {
|
||||||
tileProps = new TileProp[MapLayer.TILES_SUPPORTED * (PairedMapLayer.RANGE)];
|
tileProps = new TileProp[MapLayer.RANGE * (PairedMapLayer.RANGE)];
|
||||||
|
|
||||||
for (int i = 0; i < tileProps.length; i++) {
|
for (int i = 0; i < tileProps.length; i++) {
|
||||||
tileProps[i] = new TileProp();
|
tileProps[i] = new TileProp();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import java.util.Arrays;
|
|||||||
*/
|
*/
|
||||||
public class TileStat {
|
public class TileStat {
|
||||||
|
|
||||||
private static short[] tilestat = new short[MapLayer.TILES_SUPPORTED];
|
private static short[] tilestat = new short[GameMap.TILES_SUPPORTED];
|
||||||
|
|
||||||
private static final int TSIZE = MapDrawer.TILE_SIZE;
|
private static final int TSIZE = MapDrawer.TILE_SIZE;
|
||||||
|
|
||||||
@@ -30,8 +30,6 @@ public class TileStat {
|
|||||||
GameMap map = Terrarum.game.map;
|
GameMap map = Terrarum.game.map;
|
||||||
Player player = Terrarum.game.getPlayer();
|
Player player = Terrarum.game.getPlayer();
|
||||||
|
|
||||||
float zoom = Terrarum.game.screenZoom;
|
|
||||||
|
|
||||||
int renderWidth = FastMath.ceil(Terrarum.WIDTH);
|
int renderWidth = FastMath.ceil(Terrarum.WIDTH);
|
||||||
int renderHeight = FastMath.ceil(Terrarum.HEIGHT);
|
int renderHeight = FastMath.ceil(Terrarum.HEIGHT);
|
||||||
|
|
||||||
@@ -82,7 +80,7 @@ public class TileStat {
|
|||||||
* @return copy of the stat data
|
* @return copy of the stat data
|
||||||
*/
|
*/
|
||||||
public static short[] getStatCopy() {
|
public static short[] getStatCopy() {
|
||||||
return Arrays.copyOf(tilestat, MapLayer.TILES_SUPPORTED);
|
return Arrays.copyOf(tilestat, MapLayer.RANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.Torvald.Terrarum.UserInterface;
|
|||||||
|
|
||||||
import com.Torvald.Terrarum.Actors.PlayerDebugger;
|
import com.Torvald.Terrarum.Actors.PlayerDebugger;
|
||||||
import com.Torvald.Terrarum.Actors.Hitbox;
|
import com.Torvald.Terrarum.Actors.Hitbox;
|
||||||
|
import com.Torvald.Terrarum.GameMap.PairedMapLayer;
|
||||||
import com.Torvald.Terrarum.LangPack.Lang;
|
import com.Torvald.Terrarum.LangPack.Lang;
|
||||||
import com.Torvald.Terrarum.MapDrawer.LightmapRenderer;
|
import com.Torvald.Terrarum.MapDrawer.LightmapRenderer;
|
||||||
import com.Torvald.Terrarum.MapDrawer.MapDrawer;
|
import com.Torvald.Terrarum.MapDrawer.MapDrawer;
|
||||||
@@ -92,10 +93,13 @@ public class BasicDebugInfoWindow implements UICanvas {
|
|||||||
|
|
||||||
String tileNo;
|
String tileNo;
|
||||||
try {
|
try {
|
||||||
tileNo = String.valueOf(Terrarum.game.map.getTileFromTerrain(mouseTileX, mouseTileY));
|
int tileNumRaw = Terrarum.game.map.getTileFromTerrain(mouseTileX, mouseTileY);
|
||||||
|
int tilenum = tileNumRaw / PairedMapLayer.RANGE;
|
||||||
|
int tiledmg = tileNumRaw % PairedMapLayer.RANGE;
|
||||||
|
tileNo = tilenum + ":" + tiledmg;
|
||||||
}
|
}
|
||||||
catch (ArrayIndexOutOfBoundsException e) {
|
catch (ArrayIndexOutOfBoundsException e) {
|
||||||
tileNo = "out of bounds";
|
tileNo = "-";
|
||||||
}
|
}
|
||||||
printLine(g, 9, "tile : " + tileNo + " (" + mtX + ", " + mtY + ")");
|
printLine(g, 9, "tile : " + tileNo + " (" + mtX + ", " + mtY + ")");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user