diff --git a/lib/TerrarumSansBitmap.jar b/lib/TerrarumSansBitmap.jar index 65e6cea29..661fef767 100644 Binary files a/lib/TerrarumSansBitmap.jar and b/lib/TerrarumSansBitmap.jar differ diff --git a/src/net/torvald/terrarum/GdxColorMap.kt b/src/net/torvald/terrarum/GdxColorMap.kt index 4ae4d8042..72d9fa7a0 100644 --- a/src/net/torvald/terrarum/GdxColorMap.kt +++ b/src/net/torvald/terrarum/GdxColorMap.kt @@ -52,13 +52,13 @@ class GdxColorMap { is2D = false } - constructor(gradStart: Color, gradEnd: Color) { - dataRaw = intArrayOf(gradStart.toIntBits(), gradEnd.toIntBits()) + constructor(width: Int, height: Int, vararg colours: Color) { + dataRaw = colours.map { it.toIntBits() }.toIntArray() dataGdxColor = dataRaw.map { Color(it) }.toTypedArray() dataCvec = dataRaw.map { Cvec(it) }.toTypedArray() - width = 1 - height = 2 - is2D = true + this.width = width + this.height = height + is2D = (height > 1) } private val dataRaw: IntArray diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt index dbadc1dd6..4a7102427 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt @@ -503,6 +503,7 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L // TODO do something to the ActorWithBody.platformsToIgnore + } private fun applyAccel(x: Int): Double { @@ -527,6 +528,7 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L private fun walkVStop() { walkCounterY = 0 isWalkingV = false + platformsToIgnore = null } private fun getJumpAcc(pwr: Double, timedJumpCharge: Double): Double { diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryEscMenu.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryEscMenu.kt index d1b7621f6..a8f8a9a53 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryEscMenu.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryEscMenu.kt @@ -31,7 +31,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() { "MENU_LABEL_GRAPHICS", "MENU_OPTIONS_CONTROLS", "MENU_LABEL_MAINMENU", - "MENU_LABEL_QUIT", +// "MENU_LABEL_QUIT", ) private val gameMenuListHeight = DEFAULT_LINE_HEIGHT * gameMenu.size private val gameMenuListWidth = 400 @@ -59,7 +59,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() { inactiveCol = Color.WHITE, defaultSelection = null ) - private val areYouSureQuitButtons = UIItemTextButtonList( + /*private val areYouSureQuitButtons = UIItemTextButtonList( this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_DESKTOP_QUESTION", "MENU_LABEL_DESKTOP", "MENU_LABEL_CANCEL"), (width - gameMenuListWidth) / 2, INVENTORY_CELLS_OFFSET_Y() + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2, @@ -70,7 +70,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() { highlightBackCol = Color(0), inactiveCol = Color.WHITE, defaultSelection = null - ) + )*/ private val savingUI = UIItemSaving(this, (width - UIItemSaving.WIDTH) / 2, (height - UIItemSaving.HEIGHT) / 2) private val keyConfigUI = UIKeyboardControlPanel(null) @@ -122,9 +122,9 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() { 3 -> { screen = 2; gameMenuButtons.deselect() } - 4 -> { + /*4 -> { screen = 1; gameMenuButtons.deselect() - } + }*/ } } areYouSureMainMenuButtons.selectionChangeListener = { _, new -> @@ -138,18 +138,18 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() { } } } - areYouSureQuitButtons.selectionChangeListener = { _, new -> + /*areYouSureQuitButtons.selectionChangeListener = { _, new -> when (new) { - 1 -> Gdx.app.exit() - 2 -> { + 2 -> Gdx.app.exit() + 3 -> { screen = 0; areYouSureQuitButtons.deselect() } } - } + }*/ } private val screens = arrayOf( - gameMenuButtons, areYouSureQuitButtons, areYouSureMainMenuButtons, savingUI, keyConfigUI + gameMenuButtons, null, areYouSureMainMenuButtons, savingUI, keyConfigUI ) @@ -165,7 +165,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() { // control hints App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20) - areYouSureQuitButtons.render(batch, camera) +// areYouSureQuitButtons.render(batch, camera) }, { batch: SpriteBatch, camera: Camera -> // control hints diff --git a/src/net/torvald/terrarum/weather/WeatherMixer.kt b/src/net/torvald/terrarum/weather/WeatherMixer.kt index 9234b29a6..dbb570b09 100644 --- a/src/net/torvald/terrarum/weather/WeatherMixer.kt +++ b/src/net/torvald/terrarum/weather/WeatherMixer.kt @@ -7,6 +7,7 @@ import com.jme3.math.FastMath import net.torvald.gdx.graphics.Cvec import net.torvald.random.HQRNG import net.torvald.terrarum.* +import net.torvald.terrarum.App.printdbg import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF import net.torvald.terrarum.gameactors.ActorWithBody import net.torvald.terrarum.gamecontroller.KeyToggler @@ -18,6 +19,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.ParticleMegaRain import net.torvald.terrarum.utils.JsonFetcher import net.torvald.terrarum.worlddrawer.WorldCamera import java.io.File +import java.io.FileFilter /** * @@ -61,10 +63,13 @@ internal object WeatherMixer : RNGConsumer { // read weather descriptions from assets/weather (modular weather) val weatherRawValidList = ArrayList() - val weatherRaws = ModMgr.getFilesFromEveryMod("weathers") - weatherRaws.forEach { (modname, it) -> - if (!it.isDirectory && it.name.endsWith(".json")) + val weatherRawsDir = ModMgr.getFilesFromEveryMod("weathers") + weatherRawsDir.forEach { (modname, parentdir) -> + printdbg(this, "Scanning dir $parentdir") + parentdir.listFiles(FileFilter { !it.isDirectory && it.name.endsWith(".json") })?.forEach { weatherRawValidList.add(it) + printdbg(this, "Registering weather '$it' from module $modname") + } } // --> read from directory and store file that looks like RAW for (raw in weatherRawValidList) { @@ -85,8 +90,10 @@ internal object WeatherMixer : RNGConsumer { nextWeather = getRandomWeather(WEATHER_GENERIC) } catch (e: NullPointerException) { + e.printStackTrace() + val defaultWeather = BaseModularWeather( - GdxColorMap(Color(0x55aaffff), Color(0xaaffffff.toInt())), + GdxColorMap(1, 3, Color(0x55aaffff), Color(0xaaffffff.toInt()), Color.WHITE), "default", ArrayList() ) @@ -102,7 +109,7 @@ internal object WeatherMixer : RNGConsumer { fun update(delta: Float, player: ActorWithBody?, world: GameWorld) { if (player == null) return - currentWeather = weatherList[WEATHER_GENERIC]!![0] +// currentWeather = weatherList[WEATHER_GENERIC]!![0] // force set weather // test rain toggled by F2 @@ -237,8 +244,8 @@ internal object WeatherMixer : RNGConsumer { val phaseThis: Int = timeInSec / dataPointDistance // x-coord in gradmap val phaseNext: Int = (phaseThis + 1) % colorMap.width - val colourThis = colorMap.get(phaseThis, row) - val colourNext = colorMap.get(phaseNext, row) + val colourThis = colorMap.get(phaseThis % colorMap.width, row) + val colourNext = colorMap.get(phaseNext % colorMap.width, row) // interpolate R, G, B and A val scale = (timeInSec % dataPointDistance).toFloat() / dataPointDistance // [0.0, 1.0]