mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
fixture ghost image repositioning
This commit is contained in:
@@ -19,15 +19,16 @@ object ReferencingRanges {
|
||||
val ACTORS_MIDTOP = 0x5000_0000..0x5FFE_FFFF // Special (e.g. weapon swung, bullets, dropped item, particles)
|
||||
val ACTORS_FRONT = 0x6000_0000..0x6FFE_FFFF // Rendered front (e.g. fake tile)
|
||||
|
||||
val ACTORS_OVERLAY = 0x7001_0000..0x7FFE_FFFF // Rendered as screen overlay, not affected by light nor environment overlays
|
||||
|
||||
// IDs doesn't effect the render order at all, but we're kinda enforcing these ID ranging.
|
||||
// However, these two wire-related actor will break the rule. But as we want them to render on top of others
|
||||
// in the same render orders, we're giveng them relatively high IDs for them.
|
||||
val ACTORS_WIRES = 0x7FFF_C000..0x7FFF_EFFF // Rendered front--wires
|
||||
val ACTORS_WIRES_HELPER = 0x7FFF_F000..0x7FFF_FF00 // Rendered overlay--wiring port icons and logic gates
|
||||
val ACTORS_WIRES_HELPER = 0x7FFF_F000..0x7FFF_FEFF // Rendered overlay--wiring port icons and logic gates
|
||||
|
||||
val ACTORS_OVERLAY = 0x7001_0000..0x7FFE_FFFF // Rendered as screen overlay, not affected by light nor environment overlays
|
||||
val ACTORS_INTERNAL_USE = 0x7FFF_FF00..0x7FFF_FFFF // Actor ID 0x7FFF_FFFF is pre-assigned to the block cursor!
|
||||
|
||||
// Actor ID 0x7FFF_FFFF is pre-assigned to the block cursor!
|
||||
|
||||
val PREFIX_DYNAMICITEM = "dyn"
|
||||
val PREFIX_ACTORITEM = "actor"
|
||||
|
||||
@@ -5,16 +5,17 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import kotlin.math.floor
|
||||
|
||||
class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = PhysProperties.MOBILE_OBJECT) {
|
||||
|
||||
private val defaultSize = 16.0
|
||||
|
||||
override var referenceID: ActorID = ReferencingRanges.ACTORS_OVERLAY.last // custom refID
|
||||
override val hitbox = Hitbox(0.0, 0.0, 16.0, 16.0)
|
||||
override var referenceID: ActorID = 2147483647 // custom refID
|
||||
override val hitbox = Hitbox(0.0, 0.0, TILE_SIZED, TILE_SIZED)
|
||||
|
||||
var markerColour = Color.YELLOW
|
||||
var markerShape = 0
|
||||
@@ -63,8 +64,8 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
|
||||
override fun update(delta: Float) {
|
||||
if (isVisible) {
|
||||
hitbox.setPosition(
|
||||
Terrarum.mouseTileX * 16.0,
|
||||
Terrarum.mouseTileY * 16.0
|
||||
Terrarum.mouseTileX * TILE_SIZED,
|
||||
(Terrarum.mouseTileY - floor((hitbox.height - 0.5) / TILE_SIZED)) * TILE_SIZED
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -75,12 +76,14 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
|
||||
fun setGhost(actor: ActorWithBody) {
|
||||
ghost = actor.sprite
|
||||
hasGhost = true
|
||||
hitbox.setDimension(actor.baseHitboxW.toDouble(), actor.baseHitboxH.toDouble())
|
||||
}
|
||||
|
||||
fun unsetGhost() {
|
||||
ghost = null
|
||||
hasGhost = false
|
||||
setGhostColourNone()
|
||||
hitbox.setDimension(TILE_SIZED, TILE_SIZED)
|
||||
}
|
||||
|
||||
fun setGhostColourNone() { ghostColour = Color.WHITE }
|
||||
|
||||
@@ -89,7 +89,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
MinimapComposer.renderToBackground()
|
||||
|
||||
minimapFBO.inAction(minimapCamera, batch) {
|
||||
minimapFBO.inActionF(minimapCamera, batch) {
|
||||
// whatever.
|
||||
MinimapComposer.tempTex.dispose()
|
||||
MinimapComposer.tempTex = Texture(MinimapComposer.minimap)
|
||||
@@ -111,7 +111,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
Toolkit.fillArea(batch, 0f, 0f, MINIMAP_WIDTH, MINIMAP_HEIGHT)
|
||||
// the actual image
|
||||
batch.color = Color.WHITE
|
||||
batch.draw(MinimapComposer.tempTex, tx, ty + MinimapComposer.totalHeight * minimapZoom, MinimapComposer.totalWidth * minimapZoom, -MinimapComposer.totalHeight * minimapZoom)
|
||||
batch.draw(MinimapComposer.tempTex, tx, ty, MinimapComposer.totalWidth * minimapZoom, MinimapComposer.totalHeight * minimapZoom)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user