From 0d53b974aad747a81143525f2e879211cafd07d7 Mon Sep 17 00:00:00 2001 From: NoSloppy <53964195+NoSloppy@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:53:55 -0500 Subject: [PATCH 1/5] add swng, spin, slsh to serial commands --- props/prop_base.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/props/prop_base.h b/props/prop_base.h index 4f6216388..c62abf8f4 100644 --- a/props/prop_base.h +++ b/props/prop_base.h @@ -1376,6 +1376,18 @@ class PropBase : CommandParser, Looper, protected SaberBase, public ModeInterfac } return true; } + if (!strcmp(cmd, "swing")) { + hybrid_font.PlayPolyphonic(&SFX_swng); + return true; + } + if (!strcmp(cmd, "slash")) { + hybrid_font.PlayPolyphonic(&SFX_slsh); + return true; + } + if (!strcmp(cmd, "spin")) { + hybrid_font.PlayPolyphonic(&SFX_spin); + return true; + } #ifdef ENABLE_AUDIO From c961ad997c458efb4c51deeca7007ac6574f89d2 Mon Sep 17 00:00:00 2001 From: NoSloppy <53964195+NoSloppy@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:30:54 -0500 Subject: [PATCH 2/5] call effects, not just sounds --- props/prop_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/props/prop_base.h b/props/prop_base.h index c62abf8f4..e439e8ce9 100644 --- a/props/prop_base.h +++ b/props/prop_base.h @@ -1377,11 +1377,11 @@ class PropBase : CommandParser, Looper, protected SaberBase, public ModeInterfac return true; } if (!strcmp(cmd, "swing")) { - hybrid_font.PlayPolyphonic(&SFX_swng); + SaberBase::DoEffect(EFFECT_ACCENT_SWING, 0); return true; } if (!strcmp(cmd, "slash")) { - hybrid_font.PlayPolyphonic(&SFX_slsh); + SaberBase::DoEffect(EFFECT_ACCENT_SLASH, 0); return true; } if (!strcmp(cmd, "spin")) { From f2982cc104a543642d2d16c313c3fd0757e40818 Mon Sep 17 00:00:00 2001 From: NoSloppy <53964195+NoSloppy@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:31:46 -0500 Subject: [PATCH 3/5] add accent swing and slash --- common/saber_base.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/saber_base.h b/common/saber_base.h index 5562d7630..d9318e7d3 100644 --- a/common/saber_base.h +++ b/common/saber_base.h @@ -39,6 +39,8 @@ extern SaberBase* saberbases; DEFINE_EFFECT(POWERSAVE) \ DEFINE_EFFECT(BATTERY_LEVEL) \ DEFINE_EFFECT(VOLUME_LEVEL) \ + DEFINE_EFFECT(ACCENT_SWING) \ + DEFINE_EFFECT(ACCENT_SLASH) \ /* Allows style to turn blade ON for interactive effects if prop/style support, FAST_ON skips PREON. */ \ DEFINE_EFFECT(ON) \ DEFINE_EFFECT(FAST_ON) \ From 0c1fd9ab6b2b6b06776ccbb8cf623a8a6c858d2c Mon Sep 17 00:00:00 2001 From: NoSloppy <53964195+NoSloppy@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:33:05 -0500 Subject: [PATCH 4/5] ifdef ENABLE_SPINS added to cmd --- props/prop_base.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/props/prop_base.h b/props/prop_base.h index e439e8ce9..809f0f562 100644 --- a/props/prop_base.h +++ b/props/prop_base.h @@ -1384,10 +1384,12 @@ class PropBase : CommandParser, Looper, protected SaberBase, public ModeInterfac SaberBase::DoEffect(EFFECT_ACCENT_SLASH, 0); return true; } +#ifdef ENABLE_SPINS if (!strcmp(cmd, "spin")) { hybrid_font.PlayPolyphonic(&SFX_spin); return true; } +#endif #ifdef ENABLE_AUDIO From faca11393146998fb8915cd5978bdb33152f4738 Mon Sep 17 00:00:00 2001 From: NoSloppy <53964195+NoSloppy@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:35:37 -0500 Subject: [PATCH 5/5] Give accent swings and slashes EFFECT events --- sound/hybrid_font.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sound/hybrid_font.h b/sound/hybrid_font.h index 53a6ef2a7..52059d581 100644 --- a/sound/hybrid_font.h +++ b/sound/hybrid_font.h @@ -320,9 +320,15 @@ class HybridFont : public SaberBase, public Looper { float s = (rss - font_config.ProffieOSMinSwingAcceleration) / font_config.ProffieOSMaxSwingAcceleration; effect->SelectFloat(s); } - swing_player_ = PlayPolyphonic(effect); + current_swing_effect_ = effect; + if (current_swing_effect_ == &SFX_slsh) { + SaberBase::DoEffect(EFFECT_ACCENT_SLASH, 0); + } else { + SaberBase::DoEffect(EFFECT_ACCENT_SWING, 0); + } swinging_ = true; } else { + // Already swinging #ifdef ENABLE_SPINS if (angle_ > font_config.ProffieOSSpinDegrees) { if (SFX_spin) { @@ -553,6 +559,24 @@ class HybridFont : public SaberBase, public Looper { return; case EFFECT_PREON: SB_Preon(location); return; case EFFECT_POSTOFF: SB_Postoff(); return; + case EFFECT_ACCENT_SWING: + if (current_swing_effect_) { + swing_player_ = PlayPolyphonic(current_swing_effect_); + current_swing_effect_ = nullptr; + return; + } else { + Play(&SFX_swing, &SFX_swng); + return; + } + case EFFECT_ACCENT_SLASH: + if (current_swing_effect_) { + swing_player_ = PlayPolyphonic(current_swing_effect_); + current_swing_effect_ = nullptr; + return; + } else { + PlayPolyphonic(&SFX_slsh); + return; + } case EFFECT_STAB: if (SFX_stab) { PlayCommon(&SFX_stab); return; } // If no stab sounds are found, fall through to clash