From b6fe91ad19c9777858af788ff2e842b9329da306 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sun, 6 Oct 2019 14:50:16 +0900 Subject: [PATCH] var jump just pressed --- config_colemak.json | 84 +++++++++++++++++++ .../gameactors/ActorHumanoid.kt | 13 ++- .../terrarum/ui/BasicDebugInfoWindow.kt | 3 +- 3 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 config_colemak.json diff --git a/config_colemak.json b/config_colemak.json new file mode 100644 index 000000000..3ff4ea4f3 --- /dev/null +++ b/config_colemak.json @@ -0,0 +1,84 @@ +{ + "displayfps": 0, + "usevsync": false, + "screenwidth": 1110, + "screenheight": 740, + "language": "enUS", + "notificationshowuptime": 4000, + "multithread": true, + "multithreadedlight": false, + "showhealthmessageonstartup": true, + "usexinput": true, + "gamepadkeyn": 3, + "gamepadkeyw": 2, + "gamepadkeys": 0, + "gamepadkeye": 1, + "gamepadlup": 4, + "gamepadrup": 5, + "gamepadselect": 6, + "gamepadstart": 7, + "gamepadltrigger": 8, + "gamepadrtrigger": 9, + "gamepadlthumb": 10, + "gamepadrthumb": 11, + "gamepadaxislx": 1, + "gamepadaxisly": 0, + "gamepadaxisrx": 3, + "gamepadaxisry": 2, + "gamepadtriggeraxis": 4, + "gamepadtriggeraxis2": 5, + "gamepadaxiszeropoints": [ + -0.011, + -0.022, + -0.033, + -0.044 + ], + "gamepadlabelstyle": "msxbone", + "keyup":34, + "keyleft":46, + "keydown":47, + "keyright":48, + "keyinventory":45, + "keyinteract":44, + "keymovementaux": 29, + "keyclose": 31, + "keyzoom": 54, + "keygamemenu": 61, + "keyquicksel": 59, + "keyquickselalt": [ + 67, + 129, + 73 + ], + "keyjump": 62, + "keyquickslots": [ + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 7 + ], + "mouseprimary": 0, + "mousesecondary": 1, + "pcgamepadenv": "console", + "maxparticles": 768, + "temperatureunit": 1, + "fxretro": false, + "buildingmakerfavs": [ + 148, + 48, + 50, + 17, + 19, + 18, + 176, + 4144, + 4146, + 4244 + ] +} diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt index bf133d44e..da0d6d70b 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt @@ -166,6 +166,7 @@ open class ActorHumanoid( protected inline val isGamer: Boolean get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.actorNowPlaying + private var jumpJustPressedLatched = false @Transient private val nullItem = object : GameItem(0) { override val isUnique: Boolean = false @@ -248,7 +249,17 @@ open class ActorHumanoid( gamepad.getButton(AppLoader.getConfigInt("gamepadltrigger")) } - TODO("isJumpJustDown") + if (isJumpJustDown && jumpJustPressedLatched) { + isJumpJustDown = false + } + else if (isJumpDown && !jumpJustPressedLatched) { + isJumpJustDown = true + jumpJustPressedLatched = true + } + else if (!isJumpDown) { + jumpJustPressedLatched = false + } + } else { isUpDown = axisY < 0f diff --git a/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt b/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt index d2a512f4a..392c543d6 100644 --- a/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt +++ b/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt @@ -133,7 +133,8 @@ class BasicDebugInfoWindow : UICanvas() { "${if (player.walledRight) "$ccR" else "$ccG"}R" + "${if (player.colliding) "$ccR" else "$ccG"}${0x08.toChar()} " + "${if (player.jumping) "$ccG" else "$ccK"}JMP" + - "${if (player.isJumpDown) "$ccG" else "$ccK"}KEY" + "${if (player.isJumpDown) "$ccG" else "$ccK"}KEY" + + "${if (player.isJumpJustDown) "$ccO" else "$ccK"}${0x0F.toChar()}" ) }