mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
moved things a lot just so that splash screen shows up WHILE things load
This commit is contained in:
@@ -130,7 +130,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
|
||||
if (false && Terrarum.getConfigBoolean("multithread")) { // NO MULTITHREADING: camera don't like concurrent modification (jittery actor movements)
|
||||
if (false && AppLoader.getConfigBoolean("multithread")) { // NO MULTITHREADING: camera don't like concurrent modification (jittery actor movements)
|
||||
// else, NOP;
|
||||
}
|
||||
else {
|
||||
@@ -138,7 +138,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
while (updateDeltaCounter >= updateRate) {
|
||||
|
||||
//updateGame(delta)
|
||||
Terrarum.debugTimers["Ingame.update"] = measureNanoTime { updateGame(delta) }
|
||||
AppLoader.debugTimers["Ingame.update"] = measureNanoTime { updateGame(delta) }
|
||||
|
||||
updateDeltaCounter -= updateRate
|
||||
updateTries++
|
||||
@@ -153,7 +153,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
/** RENDER CODE GOES HERE */
|
||||
//renderGame(batch)
|
||||
Terrarum.debugTimers["Ingame.render"] = measureNanoTime { renderGame() }
|
||||
AppLoader.debugTimers["Ingame.render"] = measureNanoTime { renderGame() }
|
||||
}
|
||||
|
||||
private fun updateGame(delta: Float) {
|
||||
|
||||
@@ -54,7 +54,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
* list of Actors that is sorted by Actors' referenceID
|
||||
*/
|
||||
//val ACTORCONTAINER_INITIAL_SIZE = 64
|
||||
val PARTICLES_MAX = Terrarum.getConfigInt("maxparticles")
|
||||
val PARTICLES_MAX = AppLoader.getConfigInt("maxparticles")
|
||||
//val actorContainer = ArrayList<Actor>(ACTORCONTAINER_INITIAL_SIZE)
|
||||
//val actorContainerInactive = ArrayList<Actor>(ACTORCONTAINER_INITIAL_SIZE)
|
||||
val particlesContainer = CircularArray<ParticleBase>(PARTICLES_MAX)
|
||||
@@ -305,14 +305,14 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
width = 900,
|
||||
height = Terrarum.HEIGHT - 160,
|
||||
categoryWidth = 210,
|
||||
toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
|
||||
toggleKeyLiteral = AppLoader.getConfigInt("keyinventory")
|
||||
)*/
|
||||
/*uiInventoryPlayer.setPosition(
|
||||
-uiInventoryPlayer.width,
|
||||
70
|
||||
)*/
|
||||
uiInventoryPlayer = UIInventoryFull(actorNowPlaying,
|
||||
toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
|
||||
toggleKeyLiteral = AppLoader.getConfigInt("keyinventory")
|
||||
)
|
||||
uiInventoryPlayer.setPosition(0, 0)
|
||||
|
||||
@@ -470,7 +470,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
|
||||
if (false && Terrarum.getConfigBoolean("multithread")) { // NO MULTITHREADING: camera don't like concurrent modification (jittery actor movements)
|
||||
if (false && AppLoader.getConfigBoolean("multithread")) { // NO MULTITHREADING: camera don't like concurrent modification (jittery actor movements)
|
||||
if (firstTimeRun || updateThreadWrapper.state == Thread.State.TERMINATED) {
|
||||
updateThreadWrapper = Thread(ingameUpdateThread, "Terrarum UpdateThread")
|
||||
updateThreadWrapper.start()
|
||||
@@ -485,7 +485,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
while (updateDeltaCounter >= renderRate) {
|
||||
|
||||
//updateGame(delta)
|
||||
Terrarum.debugTimers["Ingame.update"] = measureNanoTime { updateGame(delta) }
|
||||
AppLoader.debugTimers["Ingame.update"] = measureNanoTime { updateGame(delta) }
|
||||
|
||||
updateDeltaCounter -= renderRate
|
||||
updateTries++
|
||||
@@ -501,7 +501,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
/** RENDER CODE GOES HERE */
|
||||
//renderGame(batch)
|
||||
Terrarum.debugTimers["Ingame.render"] = measureNanoTime { renderGame() }
|
||||
AppLoader.debugTimers["Ingame.render"] = measureNanoTime { renderGame() }
|
||||
}
|
||||
|
||||
protected fun updateGame(delta: Float) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.utils.JsonWriter
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
@@ -20,7 +21,7 @@ internal object ExportAV : ConsoleCommand {
|
||||
|
||||
JsonWriter.writeToFile(
|
||||
player.actorValue,
|
||||
Terrarum.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
AppLoader.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
|
||||
Echo("ExportAV: exported to " + args[1] + ".json")
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.colourutil.Col4096
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.utils.RasterWriter
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
@@ -78,7 +79,7 @@ internal object ExportMap : ConsoleCommand {
|
||||
mapDataPointer += 3
|
||||
}
|
||||
|
||||
val dir = Terrarum.defaultDir + "/Exports/"
|
||||
val dir = AppLoader.defaultDir + "/Exports/"
|
||||
val dirAsFile = File(dir)
|
||||
if (!dirAsFile.exists()) {
|
||||
dirAsFile.mkdir()
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import com.google.gson.Gson
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
@@ -23,7 +24,7 @@ internal object GsonTest : ConsoleCommand {
|
||||
val bufferedWriter: BufferedWriter
|
||||
val writer: FileWriter
|
||||
try {
|
||||
writer = FileWriter(Terrarum.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
writer = FileWriter(AppLoader.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
bufferedWriter = BufferedWriter(writer)
|
||||
|
||||
bufferedWriter.write(jsonString)
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.gameactors
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.bipolarClamp
|
||||
import net.torvald.terrarum.gameactors.*
|
||||
@@ -214,17 +215,17 @@ open class ActorHumanoid(
|
||||
|
||||
private fun updateGamerControlBox() {
|
||||
if (isGamer) {
|
||||
isUpDown = Gdx.input.isKeyPressed(Terrarum.getConfigInt("keyup"))
|
||||
isLeftDown = Gdx.input.isKeyPressed(Terrarum.getConfigInt("keyleft"))
|
||||
isDownDown = Gdx.input.isKeyPressed(Terrarum.getConfigInt("keydown"))
|
||||
isRightDown = Gdx.input.isKeyPressed(Terrarum.getConfigInt("keyright"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(Terrarum.getConfigInt("keyjump"))
|
||||
isUpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyup"))
|
||||
isLeftDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyleft"))
|
||||
isDownDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keydown"))
|
||||
isRightDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyright"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump"))
|
||||
|
||||
if (Terrarum.controller != null) {
|
||||
axisX = Terrarum.controller!!.getAxisValue(Terrarum.getConfigInt("joypadlstickx"))
|
||||
axisY = Terrarum.controller!!.getAxisValue(Terrarum.getConfigInt("joypadlsticky"))
|
||||
axisRX = Terrarum.controller!!.getAxisValue(Terrarum.getConfigInt("joypadrstickx"))
|
||||
axisRY = Terrarum.controller!!.getAxisValue(Terrarum.getConfigInt("joypadrsticky"))
|
||||
axisX = Terrarum.controller!!.getAxisValue(AppLoader.getConfigInt("joypadlstickx"))
|
||||
axisY = Terrarum.controller!!.getAxisValue(AppLoader.getConfigInt("joypadlsticky"))
|
||||
axisRX = Terrarum.controller!!.getAxisValue(AppLoader.getConfigInt("joypadrstickx"))
|
||||
axisRY = Terrarum.controller!!.getAxisValue(AppLoader.getConfigInt("joypadrsticky"))
|
||||
|
||||
// deadzonning
|
||||
if (Math.abs(axisX) < Terrarum.CONTROLLER_DEADZONE) axisX = 0f
|
||||
@@ -232,7 +233,7 @@ open class ActorHumanoid(
|
||||
if (Math.abs(axisRX) < Terrarum.CONTROLLER_DEADZONE) axisRX = 0f
|
||||
if (Math.abs(axisRY) < Terrarum.CONTROLLER_DEADZONE) axisRY = 0f
|
||||
|
||||
isJumpDown = Gdx.input.isKeyPressed(Terrarum.getConfigInt("keyjump")) ||
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump")) ||
|
||||
Terrarum.controller!!.isButtonPressed(GAMEPAD_JUMP)
|
||||
}
|
||||
}
|
||||
@@ -290,11 +291,11 @@ open class ActorHumanoid(
|
||||
// ↑F, ↓S
|
||||
if (isRightDown && !isLeftDown) {
|
||||
walkHorizontal(false, AXIS_KEYBOARD)
|
||||
prevHMoveKey = Terrarum.getConfigInt("keyright")
|
||||
prevHMoveKey = AppLoader.getConfigInt("keyright")
|
||||
} // ↓F, ↑S
|
||||
else if (isLeftDown && !isRightDown) {
|
||||
walkHorizontal(true, AXIS_KEYBOARD)
|
||||
prevHMoveKey = Terrarum.getConfigInt("keyleft")
|
||||
prevHMoveKey = AppLoader.getConfigInt("keyleft")
|
||||
} // ↓F, ↓S
|
||||
/*else if (isLeftDown && isRightDown) {
|
||||
if (prevHMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_LEFT)) {
|
||||
@@ -318,11 +319,11 @@ open class ActorHumanoid(
|
||||
// ↑E, ↓D
|
||||
if (isDownDown && !isUpDown) {
|
||||
walkVertical(false, AXIS_KEYBOARD)
|
||||
prevVMoveKey = Terrarum.getConfigInt("keydown")
|
||||
prevVMoveKey = AppLoader.getConfigInt("keydown")
|
||||
} // ↓E, ↑D
|
||||
else if (isUpDown && !isDownDown) {
|
||||
walkVertical(true, AXIS_KEYBOARD)
|
||||
prevVMoveKey = Terrarum.getConfigInt("keyup")
|
||||
prevVMoveKey = AppLoader.getConfigInt("keyup")
|
||||
} // ↓E, ↓D
|
||||
/*else if (isUpDown && isDownDown) {
|
||||
if (prevVMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_UP)) {
|
||||
@@ -360,7 +361,7 @@ open class ActorHumanoid(
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
// quickslot (quickbar)
|
||||
val quickbarKeys = Terrarum.getConfigIntArray("keyquickbars")
|
||||
val quickbarKeys = AppLoader.getConfigIntArray("keyquickbars")
|
||||
if (keycode in quickbarKeys) {
|
||||
actorValue[AVKey.__PLAYER_QUICKSLOTSEL] = quickbarKeys.indexOf(keycode)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
|
||||
@@ -19,7 +19,7 @@ class Notification : UICanvas() {
|
||||
|
||||
override var height: Int = msgUI.height
|
||||
private val visibleTime = Math.min(
|
||||
Terrarum.getConfigInt("notificationshowuptime"),
|
||||
AppLoader.getConfigInt("notificationshowuptime"),
|
||||
SHOWUP_MAX
|
||||
)
|
||||
private var displayTimer = 0f
|
||||
|
||||
@@ -40,7 +40,7 @@ class UIBasicNotifier(private val player: ActorHumanoid?) : UICanvas() {
|
||||
ELuptimer += delta
|
||||
}
|
||||
|
||||
if (mouseUp || Gdx.input.isKeyPressed(Terrarum.getConfigInt("keyinteract"))) {
|
||||
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyinteract"))) {
|
||||
ELuptimer = 0f
|
||||
ELon = true
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class UIBasicNotifier(private val player: ActorHumanoid?) : UICanvas() {
|
||||
val playerTilePos = player.hIntTilewiseHitbox
|
||||
val tempCelsius = -273f + ((Terrarum.ingame as? Ingame)?.world?.getTemperature(playerTilePos.centeredX.toInt(), playerTilePos.centeredY.toInt()) ?: 288f)
|
||||
|
||||
return when (Terrarum.getConfigInt("temperatureunit")) {
|
||||
return when (AppLoader.getConfigInt("temperatureunit")) {
|
||||
TEMP_KELVIN -> tempCelsius.times(1.8f).plus(32f).roundInt()
|
||||
TEMP_CELCIUS -> tempCelsius.roundInt()
|
||||
else -> tempCelsius.plus(273.15f).roundInt()
|
||||
@@ -86,10 +86,10 @@ class UIBasicNotifier(private val player: ActorHumanoid?) : UICanvas() {
|
||||
|
||||
sb.append(temperature.abs())
|
||||
|
||||
if (Terrarum.getConfigInt("temperatureunit") == 1) {
|
||||
if (AppLoader.getConfigInt("temperatureunit") == 1) {
|
||||
sb.append('"') // celsius superscript
|
||||
}
|
||||
else if (Terrarum.getConfigInt("temperatureunit") == -1) {
|
||||
else if (AppLoader.getConfigInt("temperatureunit") == -1) {
|
||||
sb.append('#') // fahrenheit subscript
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -157,10 +157,10 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
private var isEncumbered = false
|
||||
|
||||
|
||||
private val seekLeft: Int; get() = Terrarum.getConfigInt("keyleft") // getter used to support in-game keybind changing
|
||||
private val seekRight: Int; get() = Terrarum.getConfigInt("keyright") // getter used to support in-game keybind changing
|
||||
private val seekUp: Int; get() = Terrarum.getConfigInt("keyup") // getter used to support in-game keybind changing
|
||||
private val seekDown: Int; get() = Terrarum.getConfigInt("keydown") // getter used to support in-game keybind changing
|
||||
private val seekLeft: Int; get() = AppLoader.getConfigInt("keyleft") // getter used to support in-game keybind changing
|
||||
private val seekRight: Int; get() = AppLoader.getConfigInt("keyright") // getter used to support in-game keybind changing
|
||||
private val seekUp: Int; get() = AppLoader.getConfigInt("keyup") // getter used to support in-game keybind changing
|
||||
private val seekDown: Int; get() = AppLoader.getConfigInt("keydown") // getter used to support in-game keybind changing
|
||||
|
||||
|
||||
init {
|
||||
|
||||
@@ -8,11 +8,10 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory.Companion.CAPACITY_MODE_NO_ENCUMBER
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory.Companion.CAPACITY_MODE_NO_ENCUMBER
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
@@ -43,7 +42,7 @@ class UIInventoryFull(
|
||||
|
||||
private val SP = "${0x3000.toChar()}${0x3000.toChar()}"
|
||||
val listControlHelp: String
|
||||
get() = if (Terrarum.environment == RunningEnvironment.PC)
|
||||
get() = if (AppLoader.environment == RunningEnvironment.PC)
|
||||
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||
"${0xe006.toChar()} ${Lang["GAME_INVENTORY_USE"]}$SP" +
|
||||
"${0xe011.toChar()}..${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
|
||||
|
||||
@@ -49,7 +49,7 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
||||
ELuptimer += delta
|
||||
}
|
||||
|
||||
if (mouseUp || Gdx.input.isKeyPressed(Terrarum.getConfigInt("keyinteract"))) {
|
||||
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyinteract"))) {
|
||||
ELuptimer = 0f
|
||||
ELon = true
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.torvald.terrarum.ui.UIItemTextButtonList
|
||||
)
|
||||
|
||||
init {
|
||||
if (Terrarum.getConfigBoolean("__debug")) {
|
||||
if (AppLoader.getConfigBoolean("__debug")) {
|
||||
menuLabels.addAll(arrayOf(
|
||||
" Development Tools $",
|
||||
"Building Maker"
|
||||
@@ -117,7 +117,7 @@ import net.torvald.terrarum.ui.UIItemTextButtonList
|
||||
menubar.buttons[menuLabels.indexOf("MENU_LABEL_QUIT")].clickOnceListener = { _, _, _ -> Thread.sleep(50); System.exit(0) }
|
||||
|
||||
|
||||
if (Terrarum.getConfigBoolean("__debug")) {
|
||||
if (AppLoader.getConfigBoolean("__debug")) {
|
||||
|
||||
menubar.buttons[menuLabels.indexOf("Building Maker")].clickOnceListener = { _, _, _ ->
|
||||
this.setAsClose()
|
||||
|
||||
Reference in New Issue
Block a user