randomised tiling fixes

This commit is contained in:
minjaesong
2023-11-04 18:44:10 +09:00
parent 46234d3d9d
commit cada008fca
3 changed files with 21 additions and 4 deletions

Binary file not shown.

View File

@@ -65,7 +65,7 @@
"192";"176";"176";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"800";"FXTR";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,UNLIT,INTERNAL"
#"193";"177";"177";"BLOCK_TORCH_FROST";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1100";"FXTR";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,UNLIT,INTERNAL"
"208";"208";"208";"BLOCK_ILLUMINATOR_WHITE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"1";"N/A";"0";"0";"16";"0.9270";"0.9414";"0.8519";"0.0000";"N/A";"N/A";"0.0";"LIGHT,NORANDTILE"
"209";"209";"209";"BLOCK_ILLUMINATOR_YELLOW";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"1";"N/A";"0";"0";"16";"1.0000";"0.8408";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT"
"209";"209";"209";"BLOCK_ILLUMINATOR_YELLOW";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"1";"N/A";"0";"0";"16";"1.0000";"0.8408";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,NORANDTILE"
"210";"210";"210";"BLOCK_ILLUMINATOR_ORANGE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"1";"N/A";"0";"0";"16";"1.0000";"0.5294";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,NORANDTILE"
"211";"211";"211";"BLOCK_ILLUMINATOR_RED";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"1";"N/A";"0";"0";"16";"0.9188";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,NORANDTILE"
"212";"212";"212";"BLOCK_ILLUMINATOR_FUCHSIA";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"1";"N/A";"0";"0";"16";"0.9188";"0.0000";"0.7156";"0.0000";"N/A";"N/A";"0.0";"LIGHT,NORANDTILE"
Can't render this file because it contains an unexpected character in line 13 and column 2.

View File

@@ -307,7 +307,13 @@ internal object BlocksDrawer {
private fun getHashCoord(x: Int, y: Int, mod: Int) =
(XXHash64.hash((y.toLong().shl(32) or x.toLong().and(0xFFFFFFFF)).toBig64(), mod.toLong()).and(0x7FFFFFFFFFFFFFFFL) % mod).toInt()
(XXHash64.hash(
(
y.fmod(world.height).toLong().shl(32) or
x.fmod(world.width).toLong().and(0xFFFFFFFF)
).toBig64(), mod.toLong()
).and(0x7FFFFFFFFFFFFFFFL) % mod
).toInt()
/**
@@ -374,9 +380,10 @@ internal object BlocksDrawer {
}
else if (platformTiles.binarySearch(thisTile) >= 0) {
hash %= 2
getNearbyTilesInfoPlatform(x, y)//.swizzleH2(thisTile, hash)
getNearbyTilesInfoPlatform(x, y).swizzleH2(thisTile, hash)
}
else if (wallStickerTiles.binarySearch(thisTile) >= 0) {
hash = 0
getNearbyTilesInfoWallSticker(x, y)
}
else if (connectMutualTiles.binarySearch(thisTile) >= 0) {
@@ -456,6 +463,16 @@ internal object BlocksDrawer {
return ret
}
private val h2lut = arrayOf(
arrayOf(0,1,2,3,4,5,6,7),
arrayOf(0,2,1,5,6,3,4,7),
)
private fun Int.swizzleH2(tile: Int, hash: Int): Int {
return h2lut[hash][this]
}
private fun getNearbyTilesPos(x: Int, y: Int): Array<Point2i> {
return arrayOf(
Point2i(x + 1, y),