Skip to content

Commit f671055

Browse files
allow me to use my mouse scroll wheel in the mod menu (+ more menus) (#450)
* Update ModSwitchMenu.hx * fixed * adding wheel to more menus * forgor pixel --------- Co-authored-by: ⍚~Nex <[email protected]>
1 parent 0afbbbf commit f671055

File tree

6 files changed

+18
-24
lines changed

6 files changed

+18
-24
lines changed

assets/data/scripts/week6-pause.hx

+4-8
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,11 @@ function update(elapsed) {
9292

9393
if (!canDoShit) return;
9494
var oldSec = curSelected;
95-
if (controls.DOWN_P)
96-
changeSelection(1, false);
97-
if (controls.UP_P)
98-
changeSelection(-1);
9995

100-
if (oldSec != curSelected) {
101-
FlxG.sound.play(Paths.sound(isThorns ? 'pixel/type' : 'pixel/pixelText'));
102-
}
96+
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - FlxG.mouse.wheel);
10397

98+
if (oldSec != curSelected)
99+
FlxG.sound.play(Paths.sound(isThorns ? 'pixel/type' : 'pixel/pixelText'));
104100

105101
if (controls.ACCEPT) {
106102
FlxG.sound.play(Paths.sound(isThorns ? 'pixel/ANGRY' : 'pixel/clickText'));
@@ -118,7 +114,7 @@ function update(elapsed) {
118114
}
119115
}
120116

121-
function changeSelection(change) {
117+
function changeSelection(change) { // this overrides the function inside of the normal pause btw, so no event gets called - Nex
122118
curSelected += change;
123119

124120
if (curSelected < 0)

source/funkin/menus/FreeplayState.hx

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class FreeplayState extends MusicBeatState
216216
lerpScore = intendedScore;
217217

218218
if (canSelect) {
219-
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0));
219+
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - FlxG.mouse.wheel);
220220
changeDiff((controls.LEFT_P ? -1 : 0) + (controls.RIGHT_P ? 1 : 0));
221221
changeCoopMode((FlxG.keys.justPressed.TAB ? 1 : 0));
222222
// putting it before so that its actually smooth

source/funkin/menus/MainMenuState.hx

+5-6
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,12 @@ class MainMenuState extends MusicBeatState
109109
*/
110110
}
111111

112-
if (controls.UP_P)
113-
changeItem(-1);
112+
var upP = controls.UP_P;
113+
var downP = controls.DOWN_P;
114+
var scroll = FlxG.mouse.wheel;
114115

115-
if (controls.DOWN_P)
116-
changeItem(1);
116+
if (upP || downP || scroll != 0) // like this we wont break mods that expect a 0 change event when calling sometimes - Nex
117+
changeItem((upP ? -1 : 0) + (downP ? 1 : 0) - scroll);
117118

118119
if (controls.BACK)
119120
FlxG.switchState(new TitleState());
@@ -127,9 +128,7 @@ class MainMenuState extends MusicBeatState
127128
#end
128129

129130
if (controls.ACCEPT)
130-
{
131131
selectItem();
132-
}
133132
}
134133

135134
super.update(elapsed);

source/funkin/menus/ModSwitchMenu.hx

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ModSwitchMenu extends MusicBeatSubstate {
3939
public override function update(elapsed:Float) {
4040
super.update(elapsed);
4141

42-
changeSelection((controls.DOWN_P ? 1 : 0) + (controls.UP_P ? -1 : 0));
42+
changeSelection((controls.DOWN_P ? 1 : 0) + (controls.UP_P ? -1 : 0) - FlxG.mouse.wheel);
4343

4444
if (controls.ACCEPT) {
4545
ModsFolder.switchMod(mods[curSelected]);
@@ -64,4 +64,4 @@ class ModSwitchMenu extends MusicBeatSubstate {
6464
alphabets.members[curSelected].alpha = 1;
6565
}
6666
}
67-
#end
67+
#end

source/funkin/menus/PauseSubState.hx

+5-6
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,12 @@ class PauseSubState extends MusicBeatSubstate
124124

125125
var upP = controls.UP_P;
126126
var downP = controls.DOWN_P;
127-
var accepted = controls.ACCEPT;
127+
var scroll = FlxG.mouse.wheel;
128128

129-
if (upP)
130-
changeSelection(-1);
131-
if (downP)
132-
changeSelection(1);
133-
if (accepted)
129+
if (upP || downP || scroll != 0) // like this we wont break mods that expect a 0 change event when calling sometimes - Nex
130+
changeSelection((upP ? -1 : 0) + (downP ? 1 : 0) - scroll);
131+
132+
if (controls.ACCEPT)
134133
selectOption();
135134
}
136135

source/funkin/menus/StoryMenuState.hx

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class StoryMenuState extends MusicBeatState {
142142
}
143143

144144
changeDifficulty((controls.LEFT_P ? -1 : 0) + (controls.RIGHT_P ? 1 : 0));
145-
changeWeek((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0));
145+
changeWeek((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - FlxG.mouse.wheel);
146146

147147
if (controls.ACCEPT)
148148
selectWeek();

0 commit comments

Comments
 (0)