diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/graphic/PixelArray.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/graphic/PixelArray.kt index a9db9488..bc8693da 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/graphic/PixelArray.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/graphic/PixelArray.kt @@ -55,7 +55,7 @@ class PixelArray(val width: Pixel, val height: Pixel, val pixelFormat: Int = Pix assert(x in 0 until width) { "x ($x) has to be between 0 and $width (excluded)" } assert(y in 0 until height) { "y ($y) has to be between 0 and $height (excluded)" } val position = (x + y * width) * pixelFormat - tmp.forEachIndexed { index, _ -> + (0 until pixelFormat).forEach { index -> tmp[index] = pixels[position + index] } return tmp diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/MapLib.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/MapLib.kt index ec7a1ca9..43bcc338 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/MapLib.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/MapLib.kt @@ -128,7 +128,7 @@ class MapLib(private val resourceAccess: GameResourceAccess, private val spriteS arg1.checkint() to arg2.checkint() } - return LuaTable().apply { + return LuaTable(2, 2).apply { set("x", valueOf(cx * spriteSize.first.toDouble())) set("y", valueOf(cy * spriteSize.second.toDouble())) } @@ -152,7 +152,7 @@ class MapLib(private val resourceAccess: GameResourceAccess, private val spriteS arg1.checkint() to arg2.checkint() } - return LuaTable().apply { + return LuaTable(2, 2).apply { set("cx", valueOf(floor(x / spriteSize.first.toDouble()))) set("cy", valueOf(floor(y / spriteSize.second.toDouble()))) } diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/ShapeLib.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/ShapeLib.kt index 4ed562d8..e614e413 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/ShapeLib.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/ShapeLib.kt @@ -658,7 +658,7 @@ class ShapeLib(private val resourceAccess: GameResourceAccess) : TwoArgFunction( } dither.call(previous) - return NONE + return NIL } } }