fix: light/shadebox would get tilewise size of 2 when their hitbox size is set to 16

This commit is contained in:
minjaesong
2023-05-28 00:31:13 +09:00
parent 34fb046968
commit 065f80224f
3 changed files with 7 additions and 12 deletions

View File

@@ -26,7 +26,7 @@ class UIScreenZoom : UICanvas(
override var width = App.fontGame.getWidth(zoomText) override var width = App.fontGame.getWidth(zoomText)
override var height = App.fontGame.lineHeight.toInt() override var height = App.fontGame.lineHeight.toInt()
override var openCloseTime = COMMON_OPEN_CLOSE override var openCloseTime = 0.25f
override val mouseUp = false override val mouseUp = false

View File

@@ -25,11 +25,6 @@ class UIWorldPortal : UICanvas() {
val gradStartCol = Color(0x404040_60)
val gradEndCol = Color(0x000000_70)
val gradHeight = 48f
val controlHelpHeight = App.fontGame.lineHeight val controlHelpHeight = App.fontGame.lineHeight
private var panelTransitionLocked = false private var panelTransitionLocked = false

View File

@@ -349,12 +349,12 @@ object LightmapRenderer {
val shadeBoxCopy = it.shadeBoxList.subList(0, it.shadeBoxList.size) // make copy to prevent ConcurrentModificationException val shadeBoxCopy = it.shadeBoxList.subList(0, it.shadeBoxList.size) // make copy to prevent ConcurrentModificationException
val scale = it.scale val scale = it.scale
// put lanterns to the area the luminantBox is occupying // put lanterns to the area the lightBox is occupying
lightBoxCopy.forEach { (lightBox, colour) -> lightBoxCopy.forEach { (lightBox, colour) ->
val lightBoxX = it.hitbox.startX + (lightBox.startX * scale) val lightBoxX = it.hitbox.startX + (lightBox.startX * scale)
val lightBoxY = it.hitbox.startY + (lightBox.startY * scale) val lightBoxY = it.hitbox.startY + (lightBox.startY * scale)
val lightBoxW = lightBox.width * scale val lightBoxW = lightBox.width * scale - 1
val lightBoxH = lightBox.height * scale val lightBoxH = lightBox.height * scale - 1
for (y in lightBoxY.div(TILE_SIZE).floorInt() for (y in lightBoxY.div(TILE_SIZE).floorInt()
..lightBoxY.plus(lightBoxH).div(TILE_SIZE).floorInt()) { ..lightBoxY.plus(lightBoxH).div(TILE_SIZE).floorInt()) {
for (x in lightBoxX.div(TILE_SIZE).floorInt() for (x in lightBoxX.div(TILE_SIZE).floorInt()
@@ -368,12 +368,12 @@ object LightmapRenderer {
} }
} }
// put shades to the area the luminantBox is occupying // put shades to the area the shadeBox is occupying
shadeBoxCopy.forEach { (shadeBox, colour) -> shadeBoxCopy.forEach { (shadeBox, colour) ->
val lightBoxX = it.hitbox.startX + (shadeBox.startX * scale) val lightBoxX = it.hitbox.startX + (shadeBox.startX * scale)
val lightBoxY = it.hitbox.startY + (shadeBox.startY * scale) val lightBoxY = it.hitbox.startY + (shadeBox.startY * scale)
val lightBoxW = shadeBox.width * scale val lightBoxW = shadeBox.width * scale - 1
val lightBoxH = shadeBox.height * scale val lightBoxH = shadeBox.height * scale - 1
for (y in lightBoxY.div(TILE_SIZE).floorInt() for (y in lightBoxY.div(TILE_SIZE).floorInt()
..lightBoxY.plus(lightBoxH).div(TILE_SIZE).floorInt()) { ..lightBoxY.plus(lightBoxH).div(TILE_SIZE).floorInt()) {
for (x in lightBoxX.div(TILE_SIZE).floorInt() for (x in lightBoxX.div(TILE_SIZE).floorInt()