Skip to content

Commit be8ca4d

Browse files
Add EFFECT_USERx functionality to Sabersense prop... (#837)
* Add EFFECT_USERx functionality... ...for specific blade style requirements. * Typo fix. * Edit to user guide notes. * #endif comment added
1 parent 0bc975f commit be8ca4d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

props/saber_sabersense_buttons.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@ COLOUR CHANGE FUNCTIONS WITH BLADE ON
323323
Applicable to two-button mode only, reverts to lockup
324324
being triggered by clash while holding aux.
325325
326+
#define SABERSENSE_F263_CUSTOM_USER_EFFECT
327+
Based on Fett263 'Special Abilities', this define
328+
enables interaction with EFFECT_USERx in standard
329+
(non-Fett) blade styles for custom effects like
330+
swing colour changing.
331+
326332
GESTURE CONTROLS
327333
There are four gesture types: Twist, Stab, Swing and Thrust.
328334
Gesture controls bypass all preon effects.
@@ -858,6 +864,41 @@ bool Event2(enum BUTTON button, EVENT event, uint32_t modifiers) override {
858864
return true;
859865
#endif
860866

867+
// Based on Fett263 'Special Abilities'.
868+
#ifdef SABERSENSE_F263_CUSTOM_USER_EFFECT
869+
#if NUM_BUTTONS >= 1
870+
case EVENTID(BUTTON_NONE, EVENT_TWIST_RIGHT, MODE_ON | BUTTON_POWER):
871+
SaberBase::DoEffect(EFFECT_USER5, 0);
872+
return true;
873+
874+
case EVENTID(BUTTON_NONE, EVENT_TWIST_LEFT, MODE_ON | BUTTON_POWER):
875+
SaberBase::DoEffect(EFFECT_USER6, 0);
876+
return true;
877+
878+
case EVENTID(BUTTON_NONE, EVENT_SWING, MODE_OFF | BUTTON_POWER):
879+
SaberBase::DoEffect(EFFECT_USER7, 0);
880+
return true;
881+
#endif
882+
883+
#if NUM_BUTTONS == 2
884+
case EVENTID(BUTTON_NONE, EVENT_TWIST_RIGHT, MODE_ON | BUTTON_AUX):
885+
SaberBase::DoEffect(EFFECT_USER3, 0);
886+
return true;
887+
888+
case EVENTID(BUTTON_NONE, EVENT_TWIST_LEFT, MODE_ON | BUTTON_AUX):
889+
SaberBase::DoEffect(EFFECT_USER4, 0);
890+
return true;
891+
892+
case EVENTID(BUTTON_NONE, EVENT_SWING, MODE_ON | BUTTON_AUX):
893+
SaberBase::DoEffect(EFFECT_USER1, 0);
894+
return true;
895+
896+
case EVENTID(BUTTON_NONE, EVENT_SWING, MODE_OFF | BUTTON_AUX):
897+
SaberBase::DoEffect(EFFECT_USER2, 0);
898+
return true;
899+
#endif
900+
#endif // SABERSENSE_F263_CUSTOM_USER_EFFECT
901+
861902
// MAIN ACTIVATION
862903
// Saber ON AND Volume Adjust, 1 and 2 Button.
863904
case EVENTID(BUTTON_POWER, EVENT_FIRST_SAVED_CLICK_SHORT, MODE_OFF):

0 commit comments

Comments
 (0)