forked from woofmeow/straywild
fix: repair gameplay controller input handling
This commit is contained in:
parent
ce733818e2
commit
908cf2733a
7 changed files with 77 additions and 24 deletions
|
|
@ -20,7 +20,8 @@ func _init() -> void:
|
|||
assert(_has_joypad_button(&"jump", JOY_BUTTON_A))
|
||||
assert(_has_joypad_button(&"ui_accept", JOY_BUTTON_A))
|
||||
assert(_has_joypad_button(&"ui_cancel", JOY_BUTTON_B))
|
||||
assert(_has_joypad_button(&"interact", JOY_BUTTON_Y))
|
||||
assert(not _has_joypad_button(&"interact", JOY_BUTTON_Y))
|
||||
assert(_has_joypad_button(&"character_call", JOY_BUTTON_Y))
|
||||
assert(_has_joypad_button(&"fish_primary", JOY_BUTTON_RIGHT_SHOULDER))
|
||||
assert(not _has_joypad_motion(
|
||||
&"fish_primary", JOY_AXIS_TRIGGER_LEFT, 1.0
|
||||
|
|
|
|||
|
|
@ -684,7 +684,26 @@ func _validate_pause_browser_transition(
|
|||
) == Input.MOUSE_MODE_VISIBLE
|
||||
)
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
player.call("_set_camera_dragging", true)
|
||||
var drag_press := InputEventMouseButton.new()
|
||||
drag_press.button_index = MOUSE_BUTTON_RIGHT
|
||||
drag_press.button_mask = MOUSE_BUTTON_MASK_RIGHT
|
||||
drag_press.pressed = true
|
||||
player.call("_input", drag_press)
|
||||
assert(bool(player.get("_camera_dragging")))
|
||||
var camera_yaw := player.get_node("%CameraYaw") as Node3D
|
||||
var yaw_before_drag: float = camera_yaw.rotation.y
|
||||
var drag_motion := InputEventMouseMotion.new()
|
||||
drag_motion.button_mask = MOUSE_BUTTON_MASK_RIGHT
|
||||
drag_motion.relative = Vector2(24.0, -8.0)
|
||||
player.call("_input", drag_motion)
|
||||
assert(not is_equal_approx(camera_yaw.rotation.y, yaw_before_drag))
|
||||
var drag_release := InputEventMouseButton.new()
|
||||
drag_release.button_index = MOUSE_BUTTON_RIGHT
|
||||
drag_release.button_mask = 0
|
||||
drag_release.pressed = false
|
||||
player.call("_input", drag_release)
|
||||
assert(not bool(player.get("_camera_dragging")))
|
||||
player.call("_input", drag_press)
|
||||
assert(bool(player.get("_camera_dragging")))
|
||||
pause_menu.open_menu()
|
||||
while bool(pause_menu.get("_root_transition_active")):
|
||||
|
|
|
|||
|
|
@ -102,6 +102,20 @@ func _validate_manager(manager: ControllerMappingManagerType) -> String:
|
|||
&"sneak", &""
|
||||
) != ControllerMappingManagerType.ROLE_RIGHT_STICK_CLICK:
|
||||
return "right-stick click is not assigned to the sneak action"
|
||||
if ControllerMappingManagerType.ROLE_LABELS.get(
|
||||
ControllerMappingManagerType.ROLE_Y, ""
|
||||
) != "character call":
|
||||
return "Y is not presented as the character-call button"
|
||||
if ControllerMappingManagerType.BUTTON_ACTION_ROLES.get(
|
||||
&"character_call", &""
|
||||
) != ControllerMappingManagerType.ROLE_Y:
|
||||
return "Y is not assigned to the character-call action"
|
||||
if ControllerMappingManagerType.BUTTON_ACTION_ROLES.has(&"interact"):
|
||||
return "Y still exposes the obsolete controller interact binding"
|
||||
if not _has_joy_button(&"character_call", JOY_BUTTON_Y):
|
||||
return "character call does not default to Y"
|
||||
if _has_joy_button(&"interact", JOY_BUTTON_Y):
|
||||
return "Y still defaults to interact"
|
||||
if not _has_joy_button(&"sneak", JOY_BUTTON_RIGHT_STICK):
|
||||
return "sneak does not default to right-stick click"
|
||||
var trigger_button := InputEventJoypadButton.new()
|
||||
|
|
@ -221,17 +235,32 @@ func _validate_portmaster_launcher() -> String:
|
|||
"leftstick:b9",
|
||||
"rightstick:b12",
|
||||
"netfishing_controllerconfig=\"$GODOT_MUOS_MAPPING\"",
|
||||
"$GPTOKEYB \"NETfishing.aarch64\" &",
|
||||
"GPTOKEYB_CONFIG=\"$GAMEDIR/netfishing.gptk\"",
|
||||
"$GPTOKEYB \"NETfishing.aarch64\" -c \"$GPTOKEYB_CONFIG\" &",
|
||||
"pm_platform_helper \"$GAME_EXECUTABLE\"",
|
||||
"SDL_GAMECONTROLLERCONFIG=\"$netfishing_controllerconfig\" \\",
|
||||
"\"$GAME_LAUNCHER\"",
|
||||
"\"$CONTROLLER_MAPPING_FILE\"",
|
||||
"pm_finish",
|
||||
]:
|
||||
if expected_fragment not in launcher:
|
||||
return "PortMaster launcher omitted " + expected_fragment
|
||||
if "$'\\n'" in launcher:
|
||||
return "PortMaster launcher appends mappings across a Weston-unsafe newline"
|
||||
if "$GPTOKEYB \"NETfishing.aarch64\" -c" in launcher:
|
||||
return "PortMaster launcher injects duplicate GPTOKEYB gameplay mappings"
|
||||
const game_launcher_path: String = (
|
||||
"res://scripts/portmaster/launch-netfishing.sh"
|
||||
)
|
||||
if not FileAccess.file_exists(game_launcher_path):
|
||||
return "PortMaster game launcher wrapper is missing"
|
||||
var game_launcher: String = FileAccess.get_file_as_string(
|
||||
game_launcher_path
|
||||
)
|
||||
for expected_fragment: String in [
|
||||
"SDL_GAMECONTROLLERCONFIG=\"$(<\"$CONTROLLER_MAPPING_FILE\")\"",
|
||||
"export SDL_GAMECONTROLLERCONFIG",
|
||||
"exec \"$@\"",
|
||||
]:
|
||||
if expected_fragment not in game_launcher:
|
||||
return "PortMaster game launcher omitted " + expected_fragment
|
||||
return ""
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue