mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 10:34:06 +09:00
intbox debugger is back
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
@@ -291,6 +291,7 @@ public class AppLoader implements ApplicationListener {
|
|||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
resourcePool = CommonResourcePool.INSTANCE;
|
resourcePool = CommonResourcePool.INSTANCE;
|
||||||
|
resourcePool.addToLoadingList("blockmarkings_common", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16, 0, 0, 0, 0, false));
|
||||||
|
|
||||||
newTempFile("wenquanyi.tga"); // temp file required by the font
|
newTempFile("wenquanyi.tga"); // temp file required by the font
|
||||||
|
|
||||||
@@ -622,7 +623,7 @@ public class AppLoader implements ApplicationListener {
|
|||||||
|
|
||||||
|
|
||||||
private void setCameraPosition(float newX, float newY) {
|
private void setCameraPosition(float newX, float newY) {
|
||||||
camera.position.set((-newX + appConfig.width / 2), (-newY + appConfig.height / 2), 0f);
|
camera.position.set((-newX + appConfig.width / 2), (-newY + appConfig.height / 2), 0f); // deliberate integer division
|
||||||
camera.update();
|
camera.update();
|
||||||
logoBatch.setProjectionMatrix(camera.combined);
|
logoBatch.setProjectionMatrix(camera.combined);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package net.torvald.terrarum.gameactors
|
package net.torvald.terrarum.gameactors
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Input
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.spriteanimation.SpriteAnimation
|
import net.torvald.spriteanimation.SpriteAnimation
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
@@ -7,6 +9,7 @@ import net.torvald.terrarum.AppLoader.printdbg
|
|||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||||
import net.torvald.terrarum.blockproperties.BlockProp
|
import net.torvald.terrarum.blockproperties.BlockProp
|
||||||
|
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||||
import net.torvald.terrarum.gameworld.BlockAddress
|
import net.torvald.terrarum.gameworld.BlockAddress
|
||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||||
@@ -1354,25 +1357,33 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
|
|||||||
|
|
||||||
override fun drawBody(batch: SpriteBatch) {
|
override fun drawBody(batch: SpriteBatch) {
|
||||||
if (isVisible && sprite != null) {
|
if (isVisible && sprite != null) {
|
||||||
//if (!KeyToggler.isOn(Input.Keys.F12)) {
|
BlendMode.resolve(drawMode, batch)
|
||||||
BlendMode.resolve(drawMode, batch)
|
drawSpriteInGoodPosition(sprite!!, batch)
|
||||||
drawSpriteInGoodPosition(sprite!!, batch)
|
}
|
||||||
/*}
|
|
||||||
// ye olde tilewiseposition debugger, we don't use it anymore.
|
|
||||||
else {
|
|
||||||
batch.color = Color.NAVY
|
|
||||||
val hb = intTilewiseHitbox
|
|
||||||
|
|
||||||
batch.fillRect(
|
// debug display of hIntTilewiseHitbox
|
||||||
hb.startX.toFloat() * TILE_SIZE,
|
if (KeyToggler.isOn(Input.Keys.F9)) {
|
||||||
hb.startY.toFloat() * TILE_SIZE,
|
val blockMark = AppLoader.resourcePool.getAsTextureRegionPack("blockmarkings_common").get(0, 0)
|
||||||
hb.width.toFloat() * TILE_SIZE,
|
|
||||||
hb.height.toFloat() * TILE_SIZE
|
|
||||||
)
|
|
||||||
|
|
||||||
batch.color = Color.VIOLET
|
batch.color = Color.MAGENTA
|
||||||
batch.fillRect(hitbox.startX.toFloat(), hitbox.startY.toFloat(), hitbox.width.toFloat(), hitbox.height.toFloat())
|
for (y in 0 until intTilewiseHitbox.height.toInt()) {
|
||||||
}*/
|
for (x in 0 until intTilewiseHitbox.width.toInt()) {
|
||||||
|
batch.draw(blockMark,
|
||||||
|
(intTilewiseHitbox.startX.toFloat() + x) * TILE_SIZEF,
|
||||||
|
(intTilewiseHitbox.startY.toFloat() * y) * TILE_SIZEF
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
batch.color = Color.YELLOW
|
||||||
|
for (y in 0 until hIntTilewiseHitbox.height.toInt()) {
|
||||||
|
for (x in 0 until hIntTilewiseHitbox.width.toInt()) {
|
||||||
|
batch.draw(blockMark,
|
||||||
|
(hIntTilewiseHitbox.startX.toFloat() + x) * TILE_SIZEF,
|
||||||
|
(hIntTilewiseHitbox.startY.toFloat() * y) * TILE_SIZEF
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ open class BlockLayer(val width: Int, val height: Int) : Disposable {
|
|||||||
* TL;DR: LITTLE ENDIAN PLEASE
|
* TL;DR: LITTLE ENDIAN PLEASE
|
||||||
*/
|
*/
|
||||||
constructor(width: Int, height: Int, data: ByteArray) : this(width, height) {
|
constructor(width: Int, height: Int, data: ByteArray) : this(width, height) {
|
||||||
unsafe.allocateMemory(width * height * BYTES_PER_BLOCK.toLong())
|
|
||||||
data.forEachIndexed { index, byte -> unsafe.putByte(layerPtr + index, byte) }
|
data.forEachIndexed { index, byte -> unsafe.putByte(layerPtr + index, byte) }
|
||||||
unsafeArrayInitialised = true
|
unsafeArrayInitialised = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import net.torvald.terrarum.ui.UINSMenu
|
|||||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas.TILE_SIZE
|
import net.torvald.terrarum.worlddrawer.CreateTileAtlas.TILE_SIZE
|
||||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
|
|
||||||
@@ -134,7 +133,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
val selection = ArrayList<Point2i>()
|
val selection = ArrayList<Point2i>()
|
||||||
|
|
||||||
val blockMarkings = TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16)
|
val blockMarkings = AppLoader.resourcePool.getAsTextureRegionPack("blockmarkings_common")
|
||||||
internal var showSelection = true
|
internal var showSelection = true
|
||||||
val blockPointingCursor = object : ActorWithBody(Actor.RenderOrder.OVERLAY) {
|
val blockPointingCursor = object : ActorWithBody(Actor.RenderOrder.OVERLAY) {
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ object BlockBase {
|
|||||||
|
|
||||||
// check for collision with actors (BLOCK only)
|
// check for collision with actors (BLOCK only)
|
||||||
// FIXME properly fix the collision detection: it OVERRIDES the tiki-torches which should not happen AT ALL
|
// FIXME properly fix the collision detection: it OVERRIDES the tiki-torches which should not happen AT ALL
|
||||||
|
// FIXME (h)IntTilewiseHitbox is badly defined
|
||||||
if (gameItem.inventoryCategory == GameItem.Category.BLOCK) {
|
if (gameItem.inventoryCategory == GameItem.Category.BLOCK) {
|
||||||
var ret1 = true
|
var ret1 = true
|
||||||
ingame.actorContainerActive.forEach {
|
ingame.actorContainerActive.forEach {
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user