lightsource randomiser hash will be same even when x < 0

This commit is contained in:
minjaesong
2020-02-24 14:46:37 +09:00
parent 0d8d6ca9fa
commit ad903952cc
4 changed files with 16 additions and 8 deletions

View File

@@ -170,7 +170,7 @@ open class GameWorld : Disposable {
//val wireArray: ByteArray
// get() = layerWire.data
private fun coerceXY(x: Int, y: Int) = (x fmod width) to (y.coerceIn(0, height - 1))
fun coerceXY(x: Int, y: Int) = (x fmod width) to (y.coerceIn(0, height - 1))
fun getTileFromWall(rawX: Int, rawY: Int): Int {
val (x, y) = coerceXY(rawX, rawY)
@@ -182,6 +182,9 @@ open class GameWorld : Disposable {
return layerTerrain.unsafeGetTile(x, y)
}
fun getTileFromWallRaw(coercedX: Int, coercedY: Int) = layerWall.unsafeGetTile(coercedX, coercedY)
fun getTileFromTerrainRaw(coercedX: Int, coercedY: Int) = layerTerrain.unsafeGetTile(coercedX, coercedY)
/**
* Set the tile of wall as specified, with damage value of zero.
* @param x