diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt index 1ec75e9ad..099b143bf 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt @@ -99,9 +99,9 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L * Hitbox(x-offset, y-offset, width, height) * (Use ArrayList for normal circumstances) */ - @Transient override var lightBoxList: ArrayList = arrayListOf(Lightbox(Hitbox(2.0, 2.0, baseHitboxW - 2.0, baseHitboxH - 2.0), Cvec(0))) + @Transient override var lightBoxList: ArrayList = arrayListOf(Lightbox(Hitbox(1.0, 1.0, baseHitboxW - 2.0, baseHitboxH - 2.0), Cvec(0))) // the actual values are update on the update() - @Transient override var shadeBoxList: ArrayList = arrayListOf(Lightbox(Hitbox(2.0, 2.0, baseHitboxW - 2.0, baseHitboxH - 2.0), Cvec(0))) + @Transient override var shadeBoxList: ArrayList = arrayListOf(Lightbox(Hitbox(1.0, 1.0, baseHitboxW - 2.0, baseHitboxH - 2.0), Cvec(0))) // the actual values are update on the update() @Transient val BASE_DENSITY = 980.0 @@ -801,4 +801,14 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L } } } + + override fun reload() { + super.reload() + + lightBoxList = arrayListOf(Lightbox(Hitbox(1.0, 1.0, baseHitboxW - 2.0, baseHitboxH - 2.0), Cvec(0))) + // the actual values are update on the update() + shadeBoxList = arrayListOf(Lightbox(Hitbox(1.0, 1.0, baseHitboxW - 2.0, baseHitboxH - 2.0), Cvec(0))) + // the actual values are update on the update() + + } } \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt index 6874b1aa9..2e1b886c3 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt @@ -12,6 +12,7 @@ import net.torvald.terrarum.gameactors.* import net.torvald.terrarum.gameitems.mouseInInteractableRange import net.torvald.terrarum.langpack.Lang import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack +import java.awt.Color import java.util.* /** diff --git a/src/net/torvald/terrarum/worlddrawer/LightmapRenderer.kt b/src/net/torvald/terrarum/worlddrawer/LightmapRenderer.kt index da21bb78c..bfe0d24d2 100644 --- a/src/net/torvald/terrarum/worlddrawer/LightmapRenderer.kt +++ b/src/net/torvald/terrarum/worlddrawer/LightmapRenderer.kt @@ -368,13 +368,15 @@ object LightmapRenderer { val boxW = box.width * scale val boxH = box.height * scale - val x0 = boxX.div(TILE_SIZE).floorToInt() - val x1 = (boxX + boxW).div(TILE_SIZE).floorToInt().coerceAtLeast(x0+1) - val y0 = boxY.div(TILE_SIZE).floorToInt() - val y1 = (boxY + boxH).div(TILE_SIZE).floorToInt().coerceAtLeast(y0+1) +// println("boxX=$boxX, boxY=$boxY, boxW=$boxW, boxH=$boxH; actor=$it; baseHitboxW=${it.baseHitboxW}; box=$box") - for (y in y0 until y1) { - for (x in x0 until x1) { + val x0 = boxX.div(TILE_SIZE).floorToInt() + val x1 = (boxX + boxW - 1).div(TILE_SIZE).floorToInt() + val y0 = boxY.div(TILE_SIZE).floorToInt() + val y1 = (boxY + boxH - 1).div(TILE_SIZE).floorToInt() + + for (y in y0 .. y1) { + for (x in x0 .. x1) { val oldLight = lanternMap[LandUtil.getBlockAddr(world, x, y)] ?: Cvec(0) // if two or more luminous actors share the same block, mix the light val actorLight = colour @@ -392,12 +394,12 @@ object LightmapRenderer { val boxH = box.height * scale val x0 = boxX.div(TILE_SIZE).floorToInt() - val x1 = (boxX + boxW).div(TILE_SIZE).floorToInt().coerceAtLeast(x0+1) + val x1 = (boxX + boxW - 1).div(TILE_SIZE).floorToInt() val y0 = boxY.div(TILE_SIZE).floorToInt() - val y1 = (boxY + boxH).div(TILE_SIZE).floorToInt().coerceAtLeast(y0+1) + val y1 = (boxY + boxH - 1).div(TILE_SIZE).floorToInt() - for (y in y0 until y1) { - for (x in x0 until x1) { + for (y in y0 .. y1) { + for (x in x0 .. x1) { val oldLight = shadowMap[LandUtil.getBlockAddr(world, x, y)] ?: Cvec(0) // if two or more luminous actors share the same block, mix the light val actorLight = colour