diff --git a/src/net/torvald/terrarum/mapdrawer/LightmapRenderer.kt b/src/net/torvald/terrarum/mapdrawer/LightmapRenderer.kt index 3cc47b3e8..88ed6fa5e 100644 --- a/src/net/torvald/terrarum/mapdrawer/LightmapRenderer.kt +++ b/src/net/torvald/terrarum/mapdrawer/LightmapRenderer.kt @@ -326,8 +326,7 @@ object LightmapRenderer { var x = this_x_start while (x < this_x_end) { // smoothing enabled - if (Terrarum.ingame.screenZoom >= 1 - && Terrarum.gameConfig.getAsBoolean("smoothlighting") ?: false) { + if (Terrarum.gameConfig.getAsBoolean("smoothlighting") ?: false) { val thisLightLevel = getLight(x, y) ?: 0 @@ -344,10 +343,10 @@ object LightmapRenderer { g.color = Color(0) g.fillRect( - (x.toFloat() * TILE_SIZE.toFloat() * Terrarum.ingame.screenZoom).round().toFloat(), - (y.toFloat() * TILE_SIZE.toFloat() * Terrarum.ingame.screenZoom).round().toFloat(), - ((TILE_SIZE * Terrarum.ingame.screenZoom).ceil() * zeroLevelCounter).toFloat(), - (TILE_SIZE * Terrarum.ingame.screenZoom).ceil().toFloat() + (x.toFloat() * TILE_SIZE).round().toFloat(), + (y.toFloat() * TILE_SIZE).round().toFloat(), + (TILE_SIZE * zeroLevelCounter).toFloat(), + (TILE_SIZE).toFloat() ) x += zeroLevelCounter - 1 @@ -385,12 +384,12 @@ object LightmapRenderer { g.color = colourMapItoL[iy * 2 + ix].normaliseToColour() g.fillRect( - (x.toFloat() * TILE_SIZE.toFloat() * Terrarum.ingame.screenZoom).round() - + ix * TILE_SIZE / 2 * Terrarum.ingame.screenZoom, - (y.toFloat() * TILE_SIZE.toFloat() * Terrarum.ingame.screenZoom).round() - + iy * TILE_SIZE / 2 * Terrarum.ingame.screenZoom, - (TILE_SIZE * Terrarum.ingame.screenZoom / 2).ceil().toFloat(), - (TILE_SIZE * Terrarum.ingame.screenZoom / 2).ceil().toFloat() + (x.toFloat() * TILE_SIZE).round() + + ix * TILE_SIZE / 2f, + (y.toFloat() * TILE_SIZE).round() + + iy * TILE_SIZE / 2f, + (TILE_SIZE / 2f).ceil().toFloat(), + (TILE_SIZE / 2f).ceil().toFloat() ) } } @@ -411,10 +410,10 @@ object LightmapRenderer { g.color = (getLight(x, y) ?: 0).normaliseToColour() g.fillRect( - (x.toFloat() * TILE_SIZE.toFloat() * Terrarum.ingame.screenZoom).round().toFloat(), - (y.toFloat() * TILE_SIZE.toFloat() * Terrarum.ingame.screenZoom).round().toFloat(), - ((TILE_SIZE * Terrarum.ingame.screenZoom).ceil() * sameLevelCounter).toFloat(), - (TILE_SIZE * Terrarum.ingame.screenZoom).ceil().toFloat() + (x.toFloat() * TILE_SIZE).round().toFloat(), + (y.toFloat() * TILE_SIZE).round().toFloat(), + (TILE_SIZE.toFloat().ceil() * sameLevelCounter).toFloat(), + TILE_SIZE.toFloat().ceil().toFloat() ) x += sameLevelCounter - 1 diff --git a/src/net/torvald/terrarum/mapdrawer/MapCamera.kt b/src/net/torvald/terrarum/mapdrawer/MapCamera.kt index 3674c4761..4a4359aae 100644 --- a/src/net/torvald/terrarum/mapdrawer/MapCamera.kt +++ b/src/net/torvald/terrarum/mapdrawer/MapCamera.kt @@ -246,7 +246,8 @@ object MapCamera { cameraX = Math.round( // X only: ROUNDWORLD implementation player.hitbox.centeredX.toFloat() - renderWidth / 2) cameraY = Math.round(FastMath.clamp( - player.hitbox.centeredY.toFloat() - renderHeight / 2, TILE_SIZE.toFloat(), world.height * TILE_SIZE - renderHeight - TILE_SIZE.toFloat())) + player.hitbox.centeredY.toFloat() - renderHeight / 2, + TILE_SIZE.toFloat(), world.height * TILE_SIZE - renderHeight - TILE_SIZE.toFloat())) } @@ -270,7 +271,7 @@ object MapCamera { val for_y_end = MapCamera.clampHTile(for_y_start + (MapCamera.renderHeight / TILE_SIZE) + 2) val for_x_start = MapCamera.cameraX / TILE_SIZE - 1 - val for_x_end = for_x_start + (MapCamera.renderWidth / TILE_SIZE) + 2 + val for_x_end = for_x_start + (MapCamera.renderWidth / TILE_SIZE) + 3 // initialise MapCamera.tilesetBook[mode].startUse() @@ -435,14 +436,11 @@ object MapCamera { } private fun drawTile(mode: Int, tilewisePosX: Int, tilewisePosY: Int, sheetX: Int, sheetY: Int) { - if (Terrarum.ingame.screenZoom == 1f) { - tilesetBook[mode].renderInUse( - FastMath.floor((tilewisePosX * TILE_SIZE).toFloat()), FastMath.floor((tilewisePosY * TILE_SIZE).toFloat()), sheetX, sheetY) - } else { - tilesetBook[mode].getSprite( - sheetX, sheetY).drawEmbedded( - Math.round(tilewisePosX.toFloat() * TILE_SIZE.toFloat() * Terrarum.ingame.screenZoom).toFloat(), Math.round(tilewisePosY.toFloat() * TILE_SIZE.toFloat() * Terrarum.ingame.screenZoom).toFloat(), FastMath.ceil(TILE_SIZE * Terrarum.ingame.screenZoom).toFloat(), FastMath.ceil(TILE_SIZE * Terrarum.ingame.screenZoom).toFloat()) - } + tilesetBook[mode].renderInUse( + FastMath.floor((tilewisePosX * TILE_SIZE).toFloat()), + FastMath.floor((tilewisePosY * TILE_SIZE).toFloat()), + sheetX, sheetY + ) } fun clampH(x: Int): Int {