diff --git a/README b/README index 98a848e..c471cce 100644 --- a/README +++ b/README @@ -33,7 +33,7 @@ players are created by default, which have assigned the corresponding gamepad to their player number. The default controls are: -- Up/Down: left joystick +- Up/Down: left joystick or directional pad - Guns: Y button - Bombs: B button - Roll: X button diff --git a/src/io/joystick.cpp b/src/io/joystick.cpp index ca40bc3..b7ab4cd 100644 --- a/src/io/joystick.cpp +++ b/src/io/joystick.cpp @@ -149,7 +149,27 @@ static int is_joystick_action_active(int t, const joystick_action * a) { if (a->type == 1) { return SDL_GameControllerGetButton(joydev[t], (SDL_GameControllerButton)a->n); } else if (a->type == 2) { - Sint16 v = SDL_GameControllerGetAxis(joydev[t], (SDL_GameControllerAxis)a->n); + + SDL_GameControllerAxis axis = (SDL_GameControllerAxis)a->n; + + if (axis == SDL_CONTROLLER_AXIS_LEFTY) { + if (a->threshold_dir == 0 && SDL_GameControllerGetButton(joydev[t], SDL_CONTROLLER_BUTTON_DPAD_DOWN)) { + return 1; + } + else if (a->threshold_dir == 1 && SDL_GameControllerGetButton(joydev[t], SDL_CONTROLLER_BUTTON_DPAD_UP)) { + return 1; + } + } + else if (axis == SDL_CONTROLLER_AXIS_LEFTX) { + if (a->threshold_dir == 0 && SDL_GameControllerGetButton(joydev[t], SDL_CONTROLLER_BUTTON_DPAD_RIGHT)) { + return 1; + } + else if (a->threshold_dir == 1 && SDL_GameControllerGetButton(joydev[t], SDL_CONTROLLER_BUTTON_DPAD_LEFT)) { + return 1; + } + } + + Sint16 v = SDL_GameControllerGetAxis(joydev[t], axis); if (a->threshold_dir == 1) /* upper bound */ return (v < a->threshold); else diff --git a/switch/appstore-info.json b/switch/appstore-info.json index 791fcf5..a2378ec 100644 --- a/switch/appstore-info.json +++ b/switch/appstore-info.json @@ -6,6 +6,6 @@ "url": "https://github.com/sergiou87/triplane-turmoil/", "license": "GPLv3", "description": "Sidescrolling dogfighting flying game", - "details": "Triplane Turmoil is a sidescrolling dogfighting flying game originally written for MS-DOS by Finnish developer Dodekaedron Software.\\n\\nThe game features four nations: Finland, England, Germany and Japan. Each nation has a single player campaign. There are also multiplayer levels which can be played with human or computer controlled pilots. The countries' planes differ from each other in terms of speed, maneuverability, bomb load capacity, endurance, ammunition capacity and fuel capacity.\\n\\nPlay against the computer or against other human opponents via a split-screen display. Do well and receive medals, ribbons, and promotions. Form alliances with other players or go it alone. Attack other planes in the air or drop bombs on enemy forces on the ground. Your objective is to destroy as much of the enemy as possible, and to defend your own forces!\\n\\nControls:\\n- Up/Down: left joystick\\n- Guns: Y button\\n- Bombs: B button\\n- Roll: X button\\n- Power: R button\\n- Exit/back: - button\\n- Help: + button\\n", + "details": "Triplane Turmoil is a sidescrolling dogfighting flying game originally written for MS-DOS by Finnish developer Dodekaedron Software.\\n\\nThe game features four nations: Finland, England, Germany and Japan. Each nation has a single player campaign. There are also multiplayer levels which can be played with human or computer controlled pilots. The countries' planes differ from each other in terms of speed, maneuverability, bomb load capacity, endurance, ammunition capacity and fuel capacity.\\n\\nPlay against the computer or against other human opponents via a split-screen display. Do well and receive medals, ribbons, and promotions. Form alliances with other players or go it alone. Attack other planes in the air or drop bombs on enemy forces on the ground. Your objective is to destroy as much of the enemy as possible, and to defend your own forces!\\n\\nControls:\\n- Up/Down: left joystick or directional pad\\n- Guns: Y button\\n- Bombs: B button\\n- Roll: X button\\n- Power: R button\\n- Exit/back: - button\\n- Help: + button\\n", "changelog": "" } \ No newline at end of file