mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
more token ring stuff
This commit is contained in:
@@ -13,6 +13,7 @@ import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.blockproperties.BlockProp
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody.Companion.PHYS_EPSILON_DIST
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.gameparticles.createRandomBlockParticle
|
||||
@@ -1860,6 +1861,11 @@ open class ActorWithBody : Actor {
|
||||
BlendMode.resolve(drawMode, batch)
|
||||
drawSpriteInGoodPosition(frameDelta, sprite!!, batch)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal fun drawBody1(frameDelta: Float, batch: SpriteBatch) {
|
||||
drawBody(frameDelta, batch)
|
||||
|
||||
// debug display of hIntTilewiseHitbox
|
||||
if (KeyToggler.isOn(Input.Keys.F9)) {
|
||||
@@ -1869,8 +1875,8 @@ open class ActorWithBody : Actor {
|
||||
batch.color = if (y == intTilewiseHitbox.height.toInt() + 1) HITBOX_COLOURS1 else HITBOX_COLOURS0
|
||||
for (x in 0..intTilewiseHitbox.width.toInt()) {
|
||||
batch.draw(blockMark,
|
||||
(intTilewiseHitbox.startX.toFloat() + x) * TILE_SIZEF,
|
||||
(intTilewiseHitbox.startY.toFloat() + y) * TILE_SIZEF
|
||||
(intTilewiseHitbox.startX.toFloat() + x) * TILE_SIZEF,
|
||||
(intTilewiseHitbox.startY.toFloat() + y) * TILE_SIZEF
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1910,6 +1916,22 @@ open class ActorWithBody : Actor {
|
||||
}
|
||||
}
|
||||
|
||||
fun drawUsingDrawFunInGoodPosition(frameDelta: Float, drawFun: (x: Float, y: Float) -> Unit) {
|
||||
if (world == null) return
|
||||
|
||||
val offsetX = 0f
|
||||
val offsetY = 0f // for some reason this value must be zero to draw the actor planted to the ground
|
||||
|
||||
val posX = hitbox.startX.plus(PHYS_EPSILON_DIST).toFloat()
|
||||
val posY = hitbox.startY.plus(PHYS_EPSILON_DIST).toFloat()
|
||||
|
||||
drawBodyInGoodPosition(posX, posY) { x, y ->
|
||||
drawFun(posX + offsetX + x, posY + offsetY + y)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun onActorValueChange(key: String, value: Any?) {
|
||||
// do nothing
|
||||
}
|
||||
@@ -2332,4 +2354,4 @@ inline fun drawBodyInGoodPosition(startX: Float, startY: Float, drawFun: (x: Flo
|
||||
// App.batch.color = Color.WHITE
|
||||
drawFun(startX , startY)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,8 +524,8 @@ object IngameRenderer : Disposable {
|
||||
batch.shader = shaderForActors
|
||||
batch.color = Color.WHITE
|
||||
moveCameraToWorldCoord()
|
||||
actorsRenderFarBehind?.forEach { it.drawBody(frameDelta, batch) }
|
||||
actorsRenderBehind?.forEach { it.drawBody(frameDelta, batch) }
|
||||
actorsRenderFarBehind?.forEach { it.drawBody1(frameDelta, batch) }
|
||||
actorsRenderBehind?.forEach { it.drawBody1(frameDelta, batch) }
|
||||
}
|
||||
}
|
||||
BlurMgr.makeBlurSmall(fboRGBactorsBehind, fboRGBactorsBehindShadow, 1f)
|
||||
@@ -539,7 +539,7 @@ object IngameRenderer : Disposable {
|
||||
batch.shader = shaderForActors
|
||||
batch.color = Color.WHITE
|
||||
moveCameraToWorldCoord()
|
||||
actorsRenderMiddle?.forEach { it.drawBody(frameDelta, batch) }
|
||||
actorsRenderMiddle?.forEach { it.drawBody1(frameDelta, batch) }
|
||||
}
|
||||
}
|
||||
BlurMgr.makeBlur(fboRGBactorsMiddle, fboRGBactorsMiddleShadow, 2.5f)
|
||||
@@ -628,9 +628,9 @@ object IngameRenderer : Disposable {
|
||||
batch.drawFlipped(fboRGBactorsMiddle.colorBufferTexture, 0f, 0f)
|
||||
|
||||
moveCameraToWorldCoord()
|
||||
actorsRenderMidTop?.forEach { it.drawBody(frameDelta, batch) }
|
||||
player?.drawBody(frameDelta, batch)
|
||||
actorsRenderFront?.forEach { it.drawBody(frameDelta, batch) }
|
||||
actorsRenderMidTop?.forEach { it.drawBody1(frameDelta, batch) }
|
||||
player?.drawBody1(frameDelta, batch)
|
||||
actorsRenderFront?.forEach { it.drawBody1(frameDelta, batch) }
|
||||
// --> Change of blend mode <-- introduced by children of ActorWithBody //
|
||||
}
|
||||
|
||||
@@ -859,7 +859,7 @@ object IngameRenderer : Disposable {
|
||||
|
||||
moveCameraToWorldCoord()
|
||||
actors?.forEach {
|
||||
it.drawBody(frameDelta, batch)
|
||||
it.drawBody1(frameDelta, batch)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user