Skip to content

Commit

Permalink
Merge pull request #48 from rwhogg/godot-3.3.3
Browse files Browse the repository at this point in the history
Upgrade to Godot 3.3.3-rc1
  • Loading branch information
rwhogg authored Aug 15, 2021
2 parents e31569b + f5072a1 commit da15c49
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 39 deletions.
8 changes: 0 additions & 8 deletions KNOWN_ISSUES.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion project/About.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions project/ControllerMappings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// 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 static class ControllerMappings
{
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 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()
{
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);
}
}
}
2 changes: 1 addition & 1 deletion project/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
30 changes: 6 additions & 24 deletions project/TitleScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,9 @@ public class TitleScreen : Control

private const string StarGroupName = "stars";

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";
private const string TIMEOUT_SIGNAL = "timeout";

// 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
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 bool CanStart;

/**
* Called when this node and all its children enter the scene tree.
Expand All @@ -45,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<Timer>("StarCreateTimer");
Timer starDeleteTimer = GetNode<Timer>("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<AudioStreamPlayer>("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)
{
Expand Down
9 changes: 4 additions & 5 deletions script/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -39,4 +39,3 @@ elif [ -x "$(command -v go)" ]; then
else
echo "Please install Golang"
fi

6 changes: 6 additions & 0 deletions script/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -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/&#34;Wombat&#34;/"Wombat"/g'

../script/format.sh

popd || exit

shellcheck script/bootstrap.sh script/changelog.sh script/gendocs.sh script/lint.sh script/pre-commit.sh

0 comments on commit da15c49

Please sign in to comment.