@@ -2804,6 +2804,8 @@ void control_check_indicate()
28042804
28052805int check_control_used (int id, int key)
28062806{
2807+ // Make sure mouse_down() is only called once during any logic path,
2808+ // or the mousewheel may be decayed multiple times!!
28072809 int mask;
28082810 static int last_key = 0 ;
28092811 auto & item = Control_config[id];
@@ -2827,8 +2829,8 @@ int check_control_used(int id, int key)
28272829
28282830 if (item.type == CC_TYPE_CONTINUOUS ) {
28292831
2830- // this is awful, need to make a reverse lookup table to do button -> control instead of this control -> button
2831- // nonsense.
2832+ // this is awful, need to make a reverse lookup table to do
2833+ // button -> control instead of this control -> button nonsense.
28322834 if ((joy_down (item.first ) || joy_down_count (item.first , 1 )) ||
28332835 (joy_down (item.second ) || joy_down_count (item.second , 1 ))) {
28342836 // Joy button bound to this control was pressed, control activated
@@ -2838,7 +2840,7 @@ int check_control_used(int id, int key)
28382840
28392841 if ((mouse_down (item.first ) || mouse_down_count (item.first , 1 )) ||
28402842 (mouse_down (item.second ) || mouse_down_count (item.second , 1 ))) {
2841- // Joy button bound to this control was pressed, control activated
2843+ // Mouse button bound to this control was pressed, control activated
28422844 control_used (id);
28432845 return 1 ;
28442846 }
@@ -2884,6 +2886,22 @@ int check_control_used(int id, int key)
28842886 return 1 ;
28852887 }
28862888
2889+ // special case to allow actual mouse wheel to work with trigger controls --wookieejedi
2890+ if (item.type == CC_TYPE_TRIGGER ) {
2891+
2892+ int first_btn = 1 << item.first .get_btn ();
2893+ int second_btn = 1 << item.second .get_btn ();
2894+
2895+ if ( (first_btn >= LOWEST_MOUSE_WHEEL && first_btn <= HIGHEST_MOUSE_WHEEL ) ||
2896+ (second_btn >= LOWEST_MOUSE_WHEEL && second_btn <= HIGHEST_MOUSE_WHEEL ) ) {
2897+ if ( mouse_down (item.first ) || mouse_down (item.second ) ) {
2898+ // Mouse wheel bound to this trigger control was pressed, control activated
2899+ control_used (id);
2900+ return 1 ;
2901+ }
2902+ }
2903+ }
2904+
28872905 return 0 ;
28882906}
28892907
0 commit comments