diff --git a/assets/modules/basegame/gui/basic_meter_atlas.tga b/assets/modules/basegame/gui/basic_meter_atlas.tga index 294700da8..1eed99584 100644 --- a/assets/modules/basegame/gui/basic_meter_atlas.tga +++ b/assets/modules/basegame/gui/basic_meter_atlas.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8622d7e1e2f86c8cb12332b40e3a40b6557a2587a35d11d2064d9d6e99148222 +oid sha256:4a50f9d0f80b87256cdccc12f398cb9cd37fe2851608b5a2ece054cd6904c3f9 size 44588 diff --git a/assets/modules/basegame/gui/watchface_atlas.tga b/assets/modules/basegame/gui/watchface_atlas.tga index 16fcb98fd..f8df668fe 100644 --- a/assets/modules/basegame/gui/watchface_atlas.tga +++ b/assets/modules/basegame/gui/watchface_atlas.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa70303f654232229eb06c21d2545fd6f05aab9f9b295096c992ba1772530143 +oid sha256:b389c17a1d6ae5bd9b9bccfbd6ef3dd351113bc92264ded60c2bb6e8b622ecc3 size 70764 diff --git a/src/net/torvald/terrarum/gameactors/ActorWithPhysics.kt b/src/net/torvald/terrarum/gameactors/ActorWithPhysics.kt index 6f65bd75b..7b328faf0 100644 --- a/src/net/torvald/terrarum/gameactors/ActorWithPhysics.kt +++ b/src/net/torvald/terrarum/gameactors/ActorWithPhysics.kt @@ -62,18 +62,18 @@ open class ActorWithPhysics(val world: GameWorld, renderOrder: RenderOrder, val /** half integer tilewise hitbox */ // got the idea from gl_FragCoord val hIntTilewiseHitbox: Hitbox get() = Hitbox.fromTwoPoints( - hitbox.startX.div(TILE_SIZE).floor() + 0.5f, - hitbox.startY.div(TILE_SIZE).floor() + 0.5f, - hitbox.endX.div(TILE_SIZE).floor() + 0.5f, - hitbox.endY.div(TILE_SIZE).floor() + 0.5f + hitbox.startX.plus(0.0001f).div(TILE_SIZE).floor() + 0.5f, + hitbox.startY.plus(0.0001f).div(TILE_SIZE).floor() + 0.5f, + hitbox.endX.plus(0.0001f).div(TILE_SIZE).floor() + 0.5f, + hitbox.endY.plus(0.0001f).div(TILE_SIZE).floor() + 0.5f ) val intTilewiseHitbox: Hitbox get() = Hitbox.fromTwoPoints( - hitbox.startX.div(TILE_SIZE).floor(), - hitbox.startY.div(TILE_SIZE).floor(), - hitbox.endX.div(TILE_SIZE).floor(), - hitbox.endY.div(TILE_SIZE).floor() + hitbox.startX.plus(0.0001f).div(TILE_SIZE).floor(), + hitbox.startY.plus(0.0001f).div(TILE_SIZE).floor(), + hitbox.endX.plus(0.0001f).div(TILE_SIZE).floor(), + hitbox.endY.plus(0.0001f).div(TILE_SIZE).floor() ) /** @@ -1149,6 +1149,7 @@ open class ActorWithPhysics(val world: GameWorld, renderOrder: RenderOrder, val // DEAR FUTURE ME, // // this code potentially caused a collision bug which only happens near the "edge" of the world. + // (x_tile: 2400..2433 with world_width = 2400) // // -- Signed, 2017-09-17 @@ -1171,73 +1172,48 @@ open class ActorWithPhysics(val world: GameWorld, renderOrder: RenderOrder, val override fun drawGlow(batch: SpriteBatch) { if (isVisible && spriteGlow != null) { - blendNormal() - - val offsetX = hitboxTranslateX * scale - val offsetY = spriteGlow!!.cellHeight * scale - hitbox.height - hitboxTranslateY * scale - 1 - - if (WorldCamera.xCentre > leftsidePadding && centrePosPoint.x <= rightsidePadding) { - // camera center neg, actor center pos - spriteGlow!!.render(batch, - (hitbox.startX - offsetX).toFloat() + world.width * TILE_SIZE, - (hitbox.startY - offsetY).toFloat(), - (scale).toFloat() - ) - } - else if (WorldCamera.xCentre < rightsidePadding && centrePosPoint.x >= leftsidePadding) { - // camera center pos, actor center neg - spriteGlow!!.render(batch, - (hitbox.startX - offsetX).toFloat() - world.width * TILE_SIZE, - (hitbox.startY - offsetY).toFloat(), - (scale).toFloat() - ) - } - else { - spriteGlow!!.render(batch, - (hitbox.startX - offsetX).toFloat(), - (hitbox.startY - offsetY).toFloat(), - (scale).toFloat() - ) - } + drawSpriteInGoodPosition(spriteGlow!!, batch) } } - val leftsidePadding = world.width.times(TILE_SIZE) - WorldCamera.width.ushr(1) - val rightsidePadding = WorldCamera.width.ushr(1) - override fun drawBody(batch: SpriteBatch) { if (isVisible && sprite != null) { - BlendMode.resolve(drawMode) + drawSpriteInGoodPosition(sprite!!, batch) + } + } - val offsetX = hitboxTranslateX * scale - val offsetY = sprite!!.cellHeight * scale - hitbox.height - hitboxTranslateY * scale - 1 + private fun drawSpriteInGoodPosition(sprite: SpriteAnimation, batch: SpriteBatch) { + val leftsidePadding = world.width.times(TILE_SIZE) - WorldCamera.width.ushr(1) + val rightsidePadding = WorldCamera.width.ushr(1) - if (WorldCamera.xCentre > leftsidePadding && centrePosPoint.x <= rightsidePadding) { - // camera center neg, actor center pos - sprite!!.render(batch, - (hitbox.startX - offsetX).toFloat() + world.width * TILE_SIZE, - (hitbox.startY - offsetY).toFloat(), - (scale).toFloat() - ) - } - else if (WorldCamera.xCentre < rightsidePadding && centrePosPoint.x >= leftsidePadding) { - // camera center pos, actor center neg - sprite!!.render(batch, - (hitbox.startX - offsetX).toFloat() - world.width * TILE_SIZE, - (hitbox.startY - offsetY).toFloat(), - (scale).toFloat() - ) - } - else { - sprite!!.render(batch, - (hitbox.startX - offsetX).toFloat(), - (hitbox.startY - offsetY).toFloat(), - (scale).toFloat() - ) - } + val offsetX = hitboxTranslateX * scale + val offsetY = sprite.cellHeight * scale - hitbox.height - hitboxTranslateY * scale - 1 + + if (WorldCamera.xCentre > leftsidePadding && centrePosPoint.x <= rightsidePadding) { + // camera center neg, actor center pos + sprite.render(batch, + (hitbox.startX - offsetX + hitbox.width).toFloat() + world.width * TILE_SIZE, + (hitbox.startY - offsetY).toFloat(), + (scale).toFloat() + ) + } + else if (WorldCamera.xCentre < rightsidePadding && centrePosPoint.x >= leftsidePadding) { + // camera center pos, actor center neg + sprite.render(batch, + (hitbox.startX - offsetX + hitbox.width).toFloat() - world.width * TILE_SIZE, + (hitbox.startY - offsetY).toFloat(), + (scale).toFloat() + ) + } + else { + sprite.render(batch, + (hitbox.startX - offsetX + hitbox.width).toFloat(), + (hitbox.startY - offsetY).toFloat(), + (scale).toFloat() + ) } } diff --git a/src/net/torvald/terrarum/worlddrawer/WorldCamera.kt b/src/net/torvald/terrarum/worlddrawer/WorldCamera.kt index 1ddb918df..74115a748 100644 --- a/src/net/torvald/terrarum/worlddrawer/WorldCamera.kt +++ b/src/net/torvald/terrarum/worlddrawer/WorldCamera.kt @@ -4,7 +4,6 @@ import com.jme3.math.FastMath import net.torvald.terrarum.Terrarum import net.torvald.terrarum.gameactors.* import net.torvald.terrarum.gameworld.GameWorld -import net.torvald.terrarum.round /** * Created by minjaesong on 2016-12-30. @@ -31,24 +30,22 @@ object WorldCamera { fun update(world: GameWorld, player: ActorWithPhysics) { - - - // FIXME player is stucked to the left (titlescreen AND ingame) - - - width = FastMath.ceil(Terrarum.WIDTH / (Terrarum.ingame?.screenZoom ?: 1f)) // div, not mul height = FastMath.ceil(Terrarum.HEIGHT / (Terrarum.ingame?.screenZoom ?: 1f)) // TOP-LEFT position of camera border - x = player.hitbox.centeredX.toFloat().minus(width / 2).floorInt() // X only: ROUNDWORLD implementation + + // some hacky equation to position player at the dead centre + // NOT tested for WorldDrawer sampling negative coord for its drawing (which causes some fucking artefacts) + x = ((player.hitbox.centeredX + player.hitbox.width).toFloat() - (width / 2)).floorInt() // X only: ROUNDWORLD implementation + + y = (FastMath.clamp( player.hitbox.centeredY.toFloat() - height / 2, TILE_SIZE.toFloat(), world.height * TILE_SIZE - height - TILE_SIZE.toFloat() )).floorInt().clampCameraY(world) - } private fun Int.clampCameraY(world: GameWorld): Int { diff --git a/work_files/graphics/fonts/newrunes.psd b/work_files/graphics/fonts/newrunes.psd index 106b22891..bfcc2a73a 100644 --- a/work_files/graphics/fonts/newrunes.psd +++ b/work_files/graphics/fonts/newrunes.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3dc0357697a89f39b1d449671191e7ed334ae23e78e2cd5ed316c7b831a97da3 -size 77546 +oid sha256:0fc6afbc2ea95e6e849d1a2eb80b8d0a8e9322181e4c07b2f87b9590b2617d32 +size 77753 diff --git a/work_files/graphics/fonts/newrunes_colloquial_CHB.psd b/work_files/graphics/fonts/newrunes_colloquial_CHB.psd new file mode 100644 index 000000000..855ef1cb8 --- /dev/null +++ b/work_files/graphics/fonts/newrunes_colloquial_CHB.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c649d4234567cb8aefa6b2cb99184d1509a1c8ac5d36f683b31576991c40fa5b +size 245894 diff --git a/work_files/graphics/fonts/telegraph/5x5_ibm_bcd.psd b/work_files/graphics/fonts/telegraph/5x5_ibm_bcd.psd index 8ed002752..d4560dcae 100644 --- a/work_files/graphics/fonts/telegraph/5x5_ibm_bcd.psd +++ b/work_files/graphics/fonts/telegraph/5x5_ibm_bcd.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:67434445ff340769355af1e786547751ef78d9e3d28c31f1508eb774d6870d23 -size 37625 +oid sha256:ee67066a5755ccc2d9a32f9d861f9880c65b3e4e1e14827882d48458f03ee043 +size 37510 diff --git a/work_files/graphics/fonts/telegraph/5x5_kana.psd b/work_files/graphics/fonts/telegraph/5x5_kana.psd index 2fb5c6161..699d8c7f6 100644 --- a/work_files/graphics/fonts/telegraph/5x5_kana.psd +++ b/work_files/graphics/fonts/telegraph/5x5_kana.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4043fc85b243912f317863dd8f7d5db7ab3743c3bfe5f9db423dc10c36120f54 -size 25737 +oid sha256:b8bb8565ae736e75a342a24e51387651e5d9e535086141b4ab036a048de6335f +size 25739