From 37cae2e0098301c5b507f72db10659563099e2fc Mon Sep 17 00:00:00 2001 From: "Bob \"Wombat\" Hogg" Date: Sun, 15 Aug 2021 18:25:11 -0400 Subject: [PATCH 1/6] Update to Godot 3.3.3-rc1 (should be stable enough) --- project/About.tscn | 2 +- script/bootstrap.sh | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/project/About.tscn b/project/About.tscn index 9f41ef6..e4bfcb9 100644 --- a/project/About.tscn +++ b/project/About.tscn @@ -53,7 +53,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -Godot Version: 3.3.2 +Godot Version: 3.3.3-rc1 Dopefish Lives!" readonly = true caret_block_mode = true diff --git a/script/bootstrap.sh b/script/bootstrap.sh index 2eeda0b..64f1200 100644 --- a/script/bootstrap.sh +++ b/script/bootstrap.sh @@ -6,10 +6,10 @@ if [ -z "$GODOT" ]; then echo "Set the environment variable GODOT" -elif [ "$($GODOT --version | tr -d '[:space:]')" = "3.3.2.stable.mono.official" ]; then +elif [ "$($GODOT --version | tr -d '[:space:]')" = "3.3.3.rc1.mono.official.dec840452" ]; then echo "Godot Mono is available!" else - echo "Please install Godot Mono edition 3.3.2 if you have not done so already" + echo "Please install Godot Mono edition 3.3.3-rc1 if you have not done so already" fi if [ -x "$(command -v brew)" ]; then @@ -39,4 +39,3 @@ elif [ -x "$(command -v go)" ]; then else echo "Please install Golang" fi - From b04227f1891c7ea00315a11efec0f1d761a071a9 Mon Sep 17 00:00:00 2001 From: "Bob \"Wombat\" Hogg" Date: Sun, 15 Aug 2021 18:26:03 -0400 Subject: [PATCH 2/6] Tweak dotnet install --- script/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/bootstrap.sh b/script/bootstrap.sh index 64f1200..19c95e2 100644 --- a/script/bootstrap.sh +++ b/script/bootstrap.sh @@ -18,8 +18,8 @@ fi if [ -x "$(command -v dotnet-format)" ]; then echo "dotnet-format is available!" -elif [ -x "$(command -v dotnet)" ]; then - dotnet tool install -g dotnet-format +elif [ -x "$(command -v dotnet.exe)" ]; then + dotnet.exe tool install -g dotnet-format else echo "Please install .NET" fi From fa19b72047684b64d2e631c81d6adf49cdc066be Mon Sep 17 00:00:00 2001 From: "Bob \"Wombat\" Hogg" Date: Sun, 15 Aug 2021 18:27:57 -0400 Subject: [PATCH 3/6] Add notice about the game engine and controllers --- project/TitleScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/TitleScreen.cs b/project/TitleScreen.cs index e9e54b5..f51e545 100644 --- a/project/TitleScreen.cs +++ b/project/TitleScreen.cs @@ -29,13 +29,13 @@ public class TitleScreen : Control private bool CanStart; - // FIXME: test this on Android and update KNOWN_ISSUES.md if necessary private readonly string N64_REPLICA_MAPPING_WINDOWS = "03000000632500007505000000000000,N64 Replica,a:b1,b:b2,start:b12,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,righttrigger:b6,platform:Windows"; private readonly string SN30_PRO_MAPPING_WINDOWS = "03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b4,x:b3,start:b11,back:b10,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a2,rightx:a5,righty:a5,lefttrigger:b8,righttrigger:b9,platform:Windows"; private readonly string WIRED_FIGHT_PAD_MAPPING_WINDOWS = "030000006f0e00008501000000000000,Wired Fight Pad Pro for Nintendo Switch,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows"; // FIXME: for some reason, the remapping tool didn't really work as I expected here? dpright is excluded from here because it was acting on the left trigger... // so instead, just accept for now that the left trigger doesn't work on this one controller + // FIXME test if https://github.com/godotengine/godot/pull/48934 allows us to truly fix this mapping (available in 3.3.3-rc1) private readonly string SN30_PRO_MAPPING_ANDROID = "38426974446f20534e33302050726f20,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b3,x:b2,start:b6,back:b4,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b112,dpleft:b14,dpdown:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b9,righttrigger:a4,platform:Android"; /** From 4ddf8d91b738f64ff316bbbbb3155ecd71452ad9 Mon Sep 17 00:00:00 2001 From: "Bob \"Wombat\" Hogg" Date: Sun, 15 Aug 2021 19:34:58 -0400 Subject: [PATCH 4/6] Fix Android controller woes --- KNOWN_ISSUES.md | 8 -------- project/TitleScreen.cs | 5 +---- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/KNOWN_ISSUES.md b/KNOWN_ISSUES.md index 9e7684d..2f2372a 100644 --- a/KNOWN_ISSUES.md +++ b/KNOWN_ISSUES.md @@ -1,9 +1 @@ # Known Issues - -## Android - -* When using the SN30 Pro XBox Controller on Android, the left trigger does nothing. - -This is a strange controller mapping issue. - -I've tried fixing it, but I don't know why it's behaving like this. diff --git a/project/TitleScreen.cs b/project/TitleScreen.cs index f51e545..426bffd 100644 --- a/project/TitleScreen.cs +++ b/project/TitleScreen.cs @@ -33,10 +33,7 @@ public class TitleScreen : Control private readonly string SN30_PRO_MAPPING_WINDOWS = "03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b4,x:b3,start:b11,back:b10,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a2,rightx:a5,righty:a5,lefttrigger:b8,righttrigger:b9,platform:Windows"; private readonly string WIRED_FIGHT_PAD_MAPPING_WINDOWS = "030000006f0e00008501000000000000,Wired Fight Pad Pro for Nintendo Switch,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows"; - // FIXME: for some reason, the remapping tool didn't really work as I expected here? dpright is excluded from here because it was acting on the left trigger... - // so instead, just accept for now that the left trigger doesn't work on this one controller - // FIXME test if https://github.com/godotengine/godot/pull/48934 allows us to truly fix this mapping (available in 3.3.3-rc1) - private readonly string SN30_PRO_MAPPING_ANDROID = "38426974446f20534e33302050726f20,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b3,x:b2,start:b6,back:b4,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b112,dpleft:b14,dpdown:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b9,righttrigger:a4,platform:Android"; + private readonly string SN30_PRO_MAPPING_ANDROID = "38426974446f20534e33302050726f20,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b3,x:b2,start:b6,back:b4,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpright:b11,dpup:b12,dpleft:b14,dpdown:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Android"; /** * Called when this node and all its children enter the scene tree. From 7c84e339f56d1414bdd0be41231c31f00a0e8e98 Mon Sep 17 00:00:00 2001 From: "Bob \"Wombat\" Hogg" Date: Sun, 15 Aug 2021 19:37:53 -0400 Subject: [PATCH 5/6] Cleanup --- project/ControllerMappings.cs | 26 ++++++++++++++++++++++++++ project/TitleScreen.cs | 27 ++++++--------------------- 2 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 project/ControllerMappings.cs diff --git a/project/ControllerMappings.cs b/project/ControllerMappings.cs new file mode 100644 index 0000000..b0f6d05 --- /dev/null +++ b/project/ControllerMappings.cs @@ -0,0 +1,26 @@ +using Godot; + +public class ControllerMappings +{ + private readonly static string N64_REPLICA_MAPPING_WINDOWS = "03000000632500007505000000000000,N64 Replica,a:b1,b:b2,start:b12,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,righttrigger:b6,platform:Windows"; + private readonly static string SN30_PRO_MAPPING_WINDOWS = "03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b4,x:b3,start:b11,back:b10,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a2,rightx:a5,righty:a5,lefttrigger:b8,righttrigger:b9,platform:Windows"; + private readonly static string WIRED_FIGHT_PAD_MAPPING_WINDOWS = "030000006f0e00008501000000000000,Wired Fight Pad Pro for Nintendo Switch,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows"; + + private readonly static string SN30_PRO_MAPPING_ANDROID = "38426974446f20534e33302050726f20,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b3,x:b2,start:b6,back:b4,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpright:b11,dpup:b12,dpleft:b14,dpdown:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Android"; + + + public static void SetUpMappings() + { + string osName = OS.GetName(); + if(osName == "Windows") + { + Input.AddJoyMapping(SN30_PRO_MAPPING_WINDOWS, true); + Input.AddJoyMapping(WIRED_FIGHT_PAD_MAPPING_WINDOWS, true); + Input.AddJoyMapping(N64_REPLICA_MAPPING_WINDOWS, true); + } + else if(osName == "Android") + { + Input.AddJoyMapping(SN30_PRO_MAPPING_ANDROID, true); + } + } +} diff --git a/project/TitleScreen.cs b/project/TitleScreen.cs index 426bffd..51642a9 100644 --- a/project/TitleScreen.cs +++ b/project/TitleScreen.cs @@ -27,13 +27,9 @@ public class TitleScreen : Control private const string StarGroupName = "stars"; - private bool CanStart; - - private readonly string N64_REPLICA_MAPPING_WINDOWS = "03000000632500007505000000000000,N64 Replica,a:b1,b:b2,start:b12,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,righttrigger:b6,platform:Windows"; - private readonly string SN30_PRO_MAPPING_WINDOWS = "03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b4,x:b3,start:b11,back:b10,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a2,rightx:a5,righty:a5,lefttrigger:b8,righttrigger:b9,platform:Windows"; - private readonly string WIRED_FIGHT_PAD_MAPPING_WINDOWS = "030000006f0e00008501000000000000,Wired Fight Pad Pro for Nintendo Switch,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows"; + private const string TIMEOUT_SIGNAL = "timeout"; - private readonly string SN30_PRO_MAPPING_ANDROID = "38426974446f20534e33302050726f20,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b3,x:b2,start:b6,back:b4,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpright:b11,dpup:b12,dpleft:b14,dpdown:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Android"; + private bool CanStart; /** * Called when this node and all its children enter the scene tree. @@ -42,29 +38,18 @@ public override void _Ready() { try { - string osName = OS.GetName(); - if(osName == "Windows") - { - Input.AddJoyMapping(SN30_PRO_MAPPING_WINDOWS, true); - Input.AddJoyMapping(WIRED_FIGHT_PAD_MAPPING_WINDOWS, true); - Input.AddJoyMapping(N64_REPLICA_MAPPING_WINDOWS, true); - } - else if(osName == "Android") - { - Input.AddJoyMapping(SN30_PRO_MAPPING_ANDROID, true); - } - + ControllerMappings.SetUpMappings(); OS.SetWindowTitle(Tr("GAME_TITLE_CLEAN")); Timer starCreateTimer = GetNode("StarCreateTimer"); Timer starDeleteTimer = GetNode("StarDeleteTimer"); - starCreateTimer.Connect("timeout", this, nameof(GenerateStars)); - starDeleteTimer.Connect("timeout", this, nameof(RemoveStars)); + starCreateTimer.Connect(TIMEOUT_SIGNAL, this, nameof(GenerateStars)); + starDeleteTimer.Connect(TIMEOUT_SIGNAL, this, nameof(RemoveStars)); GetNode("TitleTextAudio").Connect("finished", this, nameof(StartStarTimers)); // When you go back to the title screen from the menu, it's sucking up input events from the menu // which immediately dumps you back in the menu... SceneTreeTimer startTimer = GetTree().CreateTimer(1.0f); - startTimer.Connect("timeout", this, nameof(AllowStart)); + startTimer.Connect(TIMEOUT_SIGNAL, this, nameof(AllowStart)); } catch(IOException) { From f5072a10ae8d96ec2fb238056742f57f3a8544f0 Mon Sep 17 00:00:00 2001 From: "Bob \"Wombat\" Hogg" Date: Sun, 15 Aug 2021 19:42:06 -0400 Subject: [PATCH 6/6] Fix the formatting --- project/ControllerMappings.cs | 24 +++++++++++++++++++----- project/Grid.cs | 2 +- script/pre-commit.sh | 6 ++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/project/ControllerMappings.cs b/project/ControllerMappings.cs index b0f6d05..129e092 100644 --- a/project/ControllerMappings.cs +++ b/project/ControllerMappings.cs @@ -1,12 +1,26 @@ +// Copyright 2021 Bob "Wombat" Hogg +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + using Godot; -public class ControllerMappings +public static class ControllerMappings { - private readonly static string N64_REPLICA_MAPPING_WINDOWS = "03000000632500007505000000000000,N64 Replica,a:b1,b:b2,start:b12,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,righttrigger:b6,platform:Windows"; - private readonly static string SN30_PRO_MAPPING_WINDOWS = "03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b4,x:b3,start:b11,back:b10,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a2,rightx:a5,righty:a5,lefttrigger:b8,righttrigger:b9,platform:Windows"; - private readonly static string WIRED_FIGHT_PAD_MAPPING_WINDOWS = "030000006f0e00008501000000000000,Wired Fight Pad Pro for Nintendo Switch,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows"; + private const string N64_REPLICA_MAPPING_WINDOWS = "03000000632500007505000000000000,N64 Replica,a:b1,b:b2,start:b12,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,righttrigger:b6,platform:Windows"; + private const string SN30_PRO_MAPPING_WINDOWS = "03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b4,x:b3,start:b11,back:b10,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a2,rightx:a5,righty:a5,lefttrigger:b8,righttrigger:b9,platform:Windows"; + private const string WIRED_FIGHT_PAD_MAPPING_WINDOWS = "030000006f0e00008501000000000000,Wired Fight Pad Pro for Nintendo Switch,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows"; - private readonly static string SN30_PRO_MAPPING_ANDROID = "38426974446f20534e33302050726f20,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b3,x:b2,start:b6,back:b4,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpright:b11,dpup:b12,dpleft:b14,dpdown:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Android"; + private const string SN30_PRO_MAPPING_ANDROID = "38426974446f20534e33302050726f20,8BitDo SN30 Pro for Android,a:b0,b:b1,y:b3,x:b2,start:b6,back:b4,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpright:b11,dpup:b12,dpleft:b14,dpdown:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Android"; public static void SetUpMappings() diff --git a/project/Grid.cs b/project/Grid.cs index 35fcc83..bada3ad 100644 --- a/project/Grid.cs +++ b/project/Grid.cs @@ -166,7 +166,7 @@ private void Pause() private void HandleMouseClick(InputEventMouseButton eventMouseButton) { // ensure we don't double-rotate from a single click and that we don't accidentally trigger from the mouse wheel - if(eventMouseButton.IsPressed() || eventMouseButton.ButtonIndex >= (int) ButtonList.Middle) + if(eventMouseButton.IsPressed() || eventMouseButton.ButtonIndex >= (int)ButtonList.Middle) { return; } diff --git a/script/pre-commit.sh b/script/pre-commit.sh index 00ef33e..9594b24 100644 --- a/script/pre-commit.sh +++ b/script/pre-commit.sh @@ -1,9 +1,15 @@ #!/usr/bin/env bash pushd project || exit + dotnet.exe format --fix-style info --fix-whitespace --fix-analyzers info "WhatTheHex.csproj" + +# Add license and address overzealous HTML-escaping of my name addlicense -c 'Bob "Wombat" Hogg' -l apache ./*.cs +git status | grep modified | awk '{print $2}' | xargs sed -i 's/"Wombat"/"Wombat"/g' + ../script/format.sh + popd || exit shellcheck script/bootstrap.sh script/changelog.sh script/gendocs.sh script/lint.sh script/pre-commit.sh