[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / input / handler / mouse / CursorMouseInputHandler.kt
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CursorMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CursorMouseInputHandler.kt
index 6a4b5a4eb968101d134eeeefa7aa9b9e290b51bd..585a5ab09d181a62cb0ff1767664118282c4047c 100644 (file)
private fun GameWorld.isCurrentBlockAutoselectable() =
getForeMap(player.cursorX, player.cursorY).isAutoselectable
- private fun checkCursorBounds() {
- if (player.gameMode == 0) {
- val minCursorX = player.mapX - SURVIVAL_CURSOR_RANGE
- val maxCursorX = player.mapX + SURVIVAL_CURSOR_RANGE
- val minCursorY = player.middleMapY - SURVIVAL_CURSOR_RANGE
- val maxCursorY = player.middleMapY + SURVIVAL_CURSOR_RANGE
-
- player.cursorX = MathUtils.clamp(player.cursorX, minCursorX, maxCursorX)
- player.cursorY = MathUtils.clamp(player.cursorY, minCursorY, maxCursorY)
- }
-
- player.cursorY = MathUtils.clamp(player.cursorY, 0, gameWorld.height - 1)
- }
-
private fun setPlayerDirectionToCursor() {
if (player.controlMode != Player.ControlMode.CURSOR) {
return
private fun handleWalkTouch() {
player.cursorX = player.mapX + player.direction.basis
player.cursorY = player.upperMapY
+ player.headRotation = 0f
for (i in 1..2) {
if (gameWorld.isCurrentBlockAutoselectable()) {
!mainConfig.isTouch -> handleMouse(action)
}
- checkCursorBounds()
+ player.checkCursorBounds(gameWorld)
setPlayerDirectionToCursor()
if (player.cursorX != pastCursorX || player.cursorY != pastCursorY) {