mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 18:14:06 +09:00
asset archiving wip, font update
This commit is contained in:
@@ -161,10 +161,10 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
try {
|
||||
val file = ModMgr.getFile("basegame", "demoworld")
|
||||
val reader = java.io.FileReader(file)
|
||||
val fileHandle = ModMgr.getGdxFile("basegame", "demoworld")
|
||||
val reader = fileHandle.reader("UTF-8")
|
||||
//ReadWorld.readWorldAndSetNewWorld(Terrarum.ingame!! as TerrarumIngame, reader)
|
||||
val world = ReadSimpleWorld(reader, file)
|
||||
val world = ReadSimpleWorld(reader, fileHandle.file())
|
||||
demoWorld = world
|
||||
demoWorld.worldTime.timeDelta = 30
|
||||
printdbg(this, "Demo world loaded")
|
||||
|
||||
@@ -46,7 +46,7 @@ object InstrumentLoader {
|
||||
CommonResourcePool.getAs<Pair<FloatArray, FloatArray>>("${baseResourceName}_$it")
|
||||
}
|
||||
|
||||
val masterFile = MusicContainer("${idBase}_${initialNote}", ModMgr.getFile(module, path))
|
||||
val masterFile = MusicContainer("${idBase}_${initialNote}", ModMgr.getGdxFile(module, path))
|
||||
val masterSamplesL = FloatArray(masterFile.totalSizeInSamples.toInt())
|
||||
val masterSamplesR = FloatArray(masterFile.totalSizeInSamples.toInt())
|
||||
masterFile.readSamples(masterSamplesL, masterSamplesR)
|
||||
|
||||
@@ -23,7 +23,7 @@ open class ActorLobbed(throwPitch: Float) : ActorWithBody() {
|
||||
|
||||
@Transient private val pitch = throwPitch.coerceIn(0.5f, 2f)
|
||||
@Transient private val whooshSound = MusicContainer(
|
||||
"throw_low_short", ModMgr.getFile("basegame", "audio/effects/throwing/throw_low_short.wav"),
|
||||
"throw_low_short", ModMgr.getGdxFile("basegame", "audio/effects/throwing/throw_low_short.wav"),
|
||||
toRAM = true,
|
||||
samplingRateOverride = 48000f * pitch
|
||||
)
|
||||
@@ -63,17 +63,17 @@ open class ActorPrimedBomb(
|
||||
private var explosionCalled = false
|
||||
|
||||
@Transient private val boomSound = MusicContainer(
|
||||
"boom", ModMgr.getFile("basegame", "audio/effects/explosion/bang_bomb.wav"), toRAM = true
|
||||
"boom", ModMgr.getGdxFile("basegame", "audio/effects/explosion/bang_bomb.wav"), toRAM = true
|
||||
) {
|
||||
this.flagDespawn()
|
||||
}
|
||||
@Transient private val fuseSound = MusicContainer(
|
||||
"fuse", ModMgr.getFile("basegame", "audio/effects/explosion/fuse.wav"), toRAM = true
|
||||
"fuse", ModMgr.getGdxFile("basegame", "audio/effects/explosion/fuse.wav"), toRAM = true
|
||||
) {
|
||||
this.flagDespawn()
|
||||
}
|
||||
@Transient private val fuseSoundCont = MusicContainer(
|
||||
"fuse_continue", ModMgr.getFile("basegame", "audio/effects/explosion/fuse_continue.wav"), toRAM = true
|
||||
"fuse_continue", ModMgr.getGdxFile("basegame", "audio/effects/explosion/fuse_continue.wav"), toRAM = true
|
||||
) {
|
||||
this.flagDespawn()
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ class FixtureAlloyingFurnace : FixtureBase {
|
||||
}
|
||||
|
||||
|
||||
@Transient val static = MusicContainer("bonfire", ModMgr.getFile("basegame", "audio/effects/static/bonfire.ogg"), true)
|
||||
@Transient val static = MusicContainer("bonfire", ModMgr.getGdxFile("basegame", "audio/effects/static/bonfire.ogg"), true)
|
||||
@Transient val light = Cvec(0.5f, 0.18f, 0f, 0f)
|
||||
|
||||
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(0.0, 0.0, TILE_SIZED * 2, TILE_SIZED * 2), light))
|
||||
|
||||
@@ -57,7 +57,7 @@ class FixtureFurnaceAndAnvil : FixtureBase, CraftingStation {
|
||||
}
|
||||
}
|
||||
|
||||
@Transient val static = MusicContainer("bonfire", ModMgr.getFile("basegame", "audio/effects/static/bonfire.ogg"), true)
|
||||
@Transient val static = MusicContainer("bonfire", ModMgr.getGdxFile("basegame", "audio/effects/static/bonfire.ogg"), true)
|
||||
|
||||
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(0.0, 0.0, TerrarumAppConfiguration.TILE_SIZED * 2, TerrarumAppConfiguration.TILE_SIZED * 2), Cvec(0.5f, 0.18f, 0f, 0f)))
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class FixtureSmelterBasic : FixtureBase {
|
||||
this.mainUI = UISmelterBasic(this)
|
||||
}
|
||||
|
||||
@Transient val static = MusicContainer("bonfire", ModMgr.getFile("basegame", "audio/effects/static/bonfire.ogg"), true)
|
||||
@Transient val static = MusicContainer("bonfire", ModMgr.getGdxFile("basegame", "audio/effects/static/bonfire.ogg"), true)
|
||||
@Transient val light = Cvec(0.5f, 0.18f, 0f, 0f)
|
||||
|
||||
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(0.0, 2*TILE_SIZED, TILE_SIZED * 2, TILE_SIZED * 2), light))
|
||||
|
||||
@@ -98,7 +98,7 @@ class FixtureTypewriter : FixtureBase {
|
||||
|
||||
internal class TestLeafletPrimaryUseHandler : FileRefItemPrimaryUseHandler {
|
||||
override fun use(item: ItemFileRef): Long {
|
||||
println(item.getAsFile().readText(Common.CHARSET))
|
||||
println(item.getAsGdxFile().readString(Common.CHARSET.displayName()))
|
||||
return 0L
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ object InjectCreatureRaw {
|
||||
* @param jsonFileName with extension
|
||||
*/
|
||||
operator fun invoke(actorValueRef: ActorValue, module: String, jsonFileName: String) {
|
||||
val jsonObj = JsonFetcher(ModMgr.getFile(module, "creatures/$jsonFileName"))
|
||||
val jsonObj = JsonFetcher(ModMgr.getGdxFile(module, "creatures/$jsonFileName"))
|
||||
|
||||
|
||||
JsonFetcher.forEachSiblings(jsonObj) { key, value -> if (!key.startsWith("_")) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import com.badlogic.gdx.files.FileHandle
|
||||
import java.io.File
|
||||
import java.util.UUID
|
||||
|
||||
@@ -42,7 +43,7 @@ open class ItemFileRef(originalID: ItemID) : GameItem(originalID) {
|
||||
*/
|
||||
open var refIsShared: Boolean = false
|
||||
|
||||
@Transient open lateinit var ref: File
|
||||
@Transient open lateinit var ref: FileHandle
|
||||
|
||||
/**
|
||||
* Application-defined.
|
||||
@@ -101,10 +102,10 @@ open class ItemFileRef(originalID: ItemID) : GameItem(originalID) {
|
||||
else
|
||||
ModMgr.getGdxFile(refModuleName, refPath)
|
||||
|
||||
fun getAsFile() = if (refIsShared)
|
||||
/*fun getAsFile() = if (refIsShared)
|
||||
File(App.saveSharedDir + "/$refPath")
|
||||
else
|
||||
ModMgr.getFile(refModuleName, refPath)
|
||||
ModMgr.getFile(refModuleName, refPath)*/
|
||||
|
||||
@Transient private var classCache: FileRefItemPrimaryUseHandler? = null
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ data class MusicDiscMetadata(val title: String, val author: String, val album: S
|
||||
object MusicDiscHelper {
|
||||
fun getMetadata(musicFile: FileHandle): MusicDiscMetadata {
|
||||
val musicdbFile = musicFile.sibling("_musicdb.json")
|
||||
val musicdb = JsonFetcher.invoke(musicdbFile.file())
|
||||
val musicdb = JsonFetcher.invoke(musicdbFile)
|
||||
val propForThisFile = musicdb.get(musicFile.name())
|
||||
|
||||
val artist = propForThisFile.get("artist").asString()
|
||||
@@ -37,7 +37,7 @@ open class MusicDiscPrototype(originalID: ItemID, module: String, path: String)
|
||||
override var refPath = path
|
||||
override var refModuleName = module
|
||||
override val canBeDynamic = false
|
||||
@Transient override var ref = ModMgr.getFile(refModuleName, refPath)
|
||||
@Transient override var ref = ModMgr.getGdxFile(refModuleName, refPath)
|
||||
override var mediumIdentifier = "music_disc"
|
||||
|
||||
init {
|
||||
|
||||
@@ -273,7 +273,7 @@ object PickaxeCore : TooltipListener() {
|
||||
|
||||
private val soundCue = MusicContainer(
|
||||
"pickaxe_sound_cue",
|
||||
ModMgr.getFile("basegame", "audio/effects/accessibility/pickaxe_valuable.ogg"),
|
||||
ModMgr.getGdxFile("basegame", "audio/effects/accessibility/pickaxe_valuable.ogg"),
|
||||
toRAM = false
|
||||
).also {
|
||||
App.disposables.add(it)
|
||||
|
||||
Reference in New Issue
Block a user