From 44d9ab096d176f8a8dd5fe1a21b69e857624a3e1 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Sun, 7 Apr 2024 00:56:37 -0400 Subject: [PATCH] Nail Carpenter Swing Support (#829) * BurstLinq make BGM resync when changing pitch (to test) * autoswing some game implementations, most games already work fine * more game tweaks * 16th note swing more game fixes make pitch change resync optional in the API * suppress some common warnings * Update Credits.txt * nail carpenter swing support --- Assets/Resources/Games/powerCalligraphy.prefab.meta | 2 +- Assets/Resources/Games/sickBeats.prefab.meta | 2 +- Assets/Scripts/Games/NailCarpenter/LongNail.cs | 3 ++- Assets/Scripts/Games/NailCarpenter/Nail.cs | 3 ++- Assets/Scripts/Games/NailCarpenter/NailCarpenter.cs | 6 +++--- Assets/Scripts/Games/NailCarpenter/Sweet.cs | 3 ++- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Assets/Resources/Games/powerCalligraphy.prefab.meta b/Assets/Resources/Games/powerCalligraphy.prefab.meta index 3c439e21..e4bc5988 100644 --- a/Assets/Resources/Games/powerCalligraphy.prefab.meta +++ b/Assets/Resources/Games/powerCalligraphy.prefab.meta @@ -3,5 +3,5 @@ guid: 3ca4cc3a8f8bda94cb89a0b7ff76e9d7 PrefabImporter: externalObjects: {} userData: - assetBundleName: ctrbear/common + assetBundleName: agbcalligraphy/common assetBundleVariant: diff --git a/Assets/Resources/Games/sickBeats.prefab.meta b/Assets/Resources/Games/sickBeats.prefab.meta index f0bbf21d..1e93fe8f 100644 --- a/Assets/Resources/Games/sickBeats.prefab.meta +++ b/Assets/Resources/Games/sickBeats.prefab.meta @@ -3,5 +3,5 @@ guid: 6d72fff7cc3bd794db624e2bc63f9856 PrefabImporter: externalObjects: {} userData: - assetBundleName: ctrbear/common + assetBundleName: agbsickbeats/common assetBundleVariant: diff --git a/Assets/Scripts/Games/NailCarpenter/LongNail.cs b/Assets/Scripts/Games/NailCarpenter/LongNail.cs index bd949ff4..a97d1e80 100644 --- a/Assets/Scripts/Games/NailCarpenter/LongNail.cs +++ b/Assets/Scripts/Games/NailCarpenter/LongNail.cs @@ -24,6 +24,7 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter { game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_RegPress, WeakHammmerJust, null, null); } + targetBeat = Conductor.instance.GetUnSwungBeat(targetBeat); Update(); } @@ -69,7 +70,7 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter if (cond.isPlaying && !cond.isPaused) { - double beat = cond.songPositionInBeats; + double beat = cond.unswungSongPositionInBeatsAsDouble; Vector3 pos = transform.position; pos.x = targetX + (float)((beat - targetBeat) * metresPerSecond); transform.position = pos; diff --git a/Assets/Scripts/Games/NailCarpenter/Nail.cs b/Assets/Scripts/Games/NailCarpenter/Nail.cs index fbf1f23b..ec889459 100644 --- a/Assets/Scripts/Games/NailCarpenter/Nail.cs +++ b/Assets/Scripts/Games/NailCarpenter/Nail.cs @@ -24,6 +24,7 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter { game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_AltPress, StrongHammmerJust, null, null); } + targetBeat = Conductor.instance.GetUnSwungBeat(targetBeat); Update(); } @@ -67,7 +68,7 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter if (cond.isPlaying && !cond.isPaused) { - double beat = cond.songPositionInBeats; + double beat = cond.unswungSongPositionInBeatsAsDouble; Vector3 pos = transform.position; pos.x = targetX + (float)((beat - targetBeat) * metresPerSecond); transform.position = pos; diff --git a/Assets/Scripts/Games/NailCarpenter/NailCarpenter.cs b/Assets/Scripts/Games/NailCarpenter/NailCarpenter.cs index 7a479941..5689c162 100644 --- a/Assets/Scripts/Games/NailCarpenter/NailCarpenter.cs +++ b/Assets/Scripts/Games/NailCarpenter/NailCarpenter.cs @@ -214,7 +214,7 @@ namespace HeavenStudio.Games void Update() { - var currentBeat = conductor.songPositionInBeatsAsDouble; + double currentBeat = conductor.unswungSongPositionInBeatsAsDouble; if (!conductor.isPlaying) return; @@ -234,8 +234,8 @@ namespace HeavenStudio.Games } // Board scroll. - var boardPos = boardTrans.localPosition; - var newBoardX = currentBeat * scrollMetresPerBeat; + Vector3 boardPos = boardTrans.localPosition; + double newBoardX = currentBeat * scrollMetresPerBeat; newBoardX %= boardWidth; boardTrans.localPosition = new Vector3((float)newBoardX, boardPos.y, boardPos.z); diff --git a/Assets/Scripts/Games/NailCarpenter/Sweet.cs b/Assets/Scripts/Games/NailCarpenter/Sweet.cs index 6eb41c6d..50e5576b 100644 --- a/Assets/Scripts/Games/NailCarpenter/Sweet.cs +++ b/Assets/Scripts/Games/NailCarpenter/Sweet.cs @@ -34,6 +34,7 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter AwakeAnim(); game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_SweetsHit, HammmerJust, null, null); + targetBeat = Conductor.instance.GetUnSwungBeat(targetBeat); Update(); if (sweetType == sweetsType.Pudding) @@ -109,7 +110,7 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter if (cond.isPlaying && !cond.isPaused) { - double beat = cond.songPositionInBeats; + double beat = cond.unswungSongPositionInBeatsAsDouble; Vector3 pos = transform.position; pos.x = targetX + (float)((beat - targetBeat) * metresPerSecond); transform.position = pos;