Skip to content

Commit a941bd6

Browse files
committed
oh my god
1 parent 1a2e576 commit a941bd6

File tree

8 files changed

+146
-68
lines changed

8 files changed

+146
-68
lines changed

source/backend/Constants.hx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,35 @@ class Constants {
66

77
public static function playMenuMusic(?volume:Float, ?daSong:String, ?BPM:Float) { //It's a float because custom songs can be weird
88
if (daSong != null) {
9-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/$daSong')));
9+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/$daSong')), volume);
1010
if (BPM != null) Conductor.bpm = BPM;
1111
} else {
12-
changeMenuMusic(ClientPrefs.data.menuSong);
12+
changeMenuMusic(ClientPrefs.data.menuSong, null, volume);
1313
}
1414
}
1515

16-
public static function changeMenuMusic(daSong:String, ?BPM:Float) { //It's a float because custom songs can be weird
16+
public static function changeMenuMusic(daSong:String, ?BPM:Null<Float>, ?volume:Float) { //It's a float because custom songs can be weird
1717
switch (daSong) {
1818
case "None":
19-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/empty')));
19+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/empty')), volume);
2020
Conductor.bpm = 0;
2121
case "Panix Press":
22-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/panixPress')));
22+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/panixPress')), volume);
2323
Conductor.bpm = 150;
2424
case "TitleMania":
25-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/titlemania')));
25+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/titlemania')), volume);
2626
Conductor.bpm = 100;
2727
case "Base Game":
28-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/freakyMenu')));
28+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/freakyMenu')), volume);
2929
Conductor.bpm = 102;
3030
case "Freeplay Random":
31-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/freeplayRandom')));
31+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/freeplayRandom')), volume);
3232
Conductor.bpm = 145;
3333
case "Pause Menu":
34-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('pauseMusic/${ClientPrefs.data.pauseMusic}')));
34+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('pauseMusic/${ClientPrefs.data.pauseMusic}')), volume);
3535
switch (ClientPrefs.data.pauseMusic)
3636
{
37+
//dont question it
3738
case 'None':
3839
Conductor.bpm = 0;
3940
case 'Breakfast':
@@ -58,7 +59,7 @@ class Constants {
5859
Conductor.bpm = MixtapeSettingsSubState.curBPMList[10];
5960
}
6061
default:
61-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/$daSong')));
62+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/$daSong')), volume);
6263
Conductor.bpm = BPM;
6364
}
6465

source/psychlua/LegacyFunkinLua.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ class LegacyFunkinLua {
16061606

16071607
#if DISCORD_ALLOWED DiscordClient.resetClientID(); #end
16081608

1609-
FlxG.sound.playMusic(Paths.music('panixPress'));
1609+
Constants.playMenuMusic();
16101610
PlayState.changedDifficulty = false;
16111611
PlayState.chartingMode = false;
16121612
PlayState.instance.transitioning = true;

source/states/FreeplayState.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ class FreeplayState extends MusicBeatState
17231723
instance = null;
17241724
FlxG.autoPause = ClientPrefs.data.autoPause;
17251725
if (!FlxG.sound.music.playing && !stopMusicPlay)
1726-
FlxG.sound.playMusic(Paths.music('panixPress'));
1726+
Constants.playMenuMusic(0);
17271727
}
17281728

17291729
// public static function addInternetModSource(url:String):Void {

source/states/PlayState.hx

Lines changed: 125 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ import crowplexus.hscript.Expr.Error as IrisError;
6868
import crowplexus.hscript.Printer;
6969
#end
7070

71+
import yutautil.AprilFools;
72+
7173
/**
7274
* This is where all the Gameplay stuff happens and is managed
7375
*
@@ -5715,69 +5717,77 @@ class PlayState extends MusicBeatState
57155717
public var strumsBlocked:Array<Bool> = [];
57165718
var closestNotes:Array<Note> = [];
57175719
var pressed:Array<FlxKey> = [];
5720+
var reverseNoteRules:Bool = FlxG.random.bool(50);
57185721
private function onKeyPress(event:KeyboardEvent):Void
57195722
{
57205723
var eventKey:FlxKey = event.keyCode;
57215724
var key:Int = getKeyFromEvent(eventKey);
57225725

5723-
#if debug
5724-
//Prevents crash specifically on debug without needing to try catch shit
5725-
@:privateAccess if (!FlxG.keys._keyListMap.exists(eventKey)) return;
5726-
#end
5727-
if (ClientPrefs.data.inputSystem == "Native-old") {
5728-
if (!controls.controllerMode)
5729-
{
5726+
if (AprilFools.allowAF && reverseNoteRules) {
5727+
if (pressed.contains(eventKey))
5728+
pressed.remove(eventKey);
5729+
5730+
if (key != -1) strumKeyUp(key);
5731+
} else {
5732+
#if debug
5733+
//Prevents crash specifically on debug without needing to try catch shit
5734+
@:privateAccess if (!FlxG.keys._keyListMap.exists(eventKey)) return;
5735+
#end
5736+
if (ClientPrefs.data.inputSystem == "Native-old") {
5737+
if (!controls.controllerMode)
5738+
{
5739+
if (paused || !startedCountdown || inCutscene) return;
5740+
if (pressed.contains(eventKey)) return;
5741+
pressed.push(eventKey);
5742+
if (key != -1) strumKeyDown(key);
5743+
}
5744+
}
5745+
else {
57305746
if (paused || !startedCountdown || inCutscene) return;
57315747
if (pressed.contains(eventKey)) return;
57325748
pressed.push(eventKey);
5733-
if (key != -1) strumKeyDown(key);
5734-
}
5735-
}
5736-
else {
5737-
if (paused || !startedCountdown || inCutscene) return;
5738-
if (pressed.contains(eventKey)) return;
5739-
pressed.push(eventKey);
5740-
if (callOnScripts("onKeyDown", [event]) == LuaUtils.Function_Stop) return;
5741-
5742-
if (key > -1)
5743-
{
5744-
var hitNotes:Array<Note> = [];
5745-
var controlledFields:Array<PlayField> = [];
5746-
5747-
if (strumsBlocked[key]) return;
5748-
if (callOnScripts("onKeyPress", [key]) == LuaUtils.Function_Stop) return;
5749-
for (field in playfields.members)
5749+
if (callOnScripts("onKeyDown", [event]) == LuaUtils.Function_Stop) return;
5750+
5751+
if (key > -1)
57505752
{
5751-
if (!field.autoPlayed && field.isPlayer && field.inControl)
5753+
var hitNotes:Array<Note> = [];
5754+
var controlledFields:Array<PlayField> = [];
5755+
5756+
if (strumsBlocked[key]) return;
5757+
if (callOnScripts("onKeyPress", [key]) == LuaUtils.Function_Stop) return;
5758+
for (field in playfields.members)
57525759
{
5753-
controlledFields.push(field);
5754-
field.keysPressed[key] = true;
5755-
if (generatedMusic && !endingSong)
5760+
if (!field.autoPlayed && field.isPlayer && field.inControl)
57565761
{
5757-
var note:Note = null;
5758-
var ret:Dynamic = callOnScripts("onFieldInput", [field, key, hitNotes]);
5759-
if (ret == LuaUtils.Function_Stop) continue;
5760-
else if ((ret.objType == NOTE)) note = ret;
5761-
else note = field.input(key);
5762-
5763-
if (note == null)
5762+
controlledFields.push(field);
5763+
field.keysPressed[key] = true;
5764+
if (generatedMusic && !endingSong)
57645765
{
5765-
var spr:StrumNote = field.strumNotes[key];
5766-
if (spr != null && spr.animation.curAnim.name != 'confirm')
5766+
var note:Note = null;
5767+
var ret:Dynamic = callOnScripts("onFieldInput", [field, key, hitNotes]);
5768+
if (ret == LuaUtils.Function_Stop) continue;
5769+
else if ((ret.objType == NOTE)) note = ret;
5770+
else note = field.input(key);
5771+
5772+
if (note == null)
57675773
{
5768-
spr.playAnim('pressed');
5769-
spr.resetAnim = 0;
5774+
var spr:StrumNote = field.strumNotes[key];
5775+
if (spr != null && spr.animation.curAnim.name != 'confirm')
5776+
{
5777+
spr.playAnim('pressed');
5778+
spr.resetAnim = 0;
5779+
}
57705780
}
5781+
else hitNotes.push(note);
57715782
}
5772-
else hitNotes.push(note);
57735783
}
5774-
}
5775-
if (hitNotes.length == 0 && controlledFields.length > 0)
5776-
{
5777-
callOnScripts('onGhostTap', [key]);
5778-
5779-
if (!ClientPrefs.data.ghostTapping)
5780-
noteMissPress(key, field);
5784+
if (hitNotes.length == 0 && controlledFields.length > 0)
5785+
{
5786+
callOnScripts('onGhostTap', [key]);
5787+
5788+
if (!ClientPrefs.data.ghostTapping)
5789+
noteMissPress(key, field);
5790+
}
57815791
}
57825792
}
57835793
}
@@ -5860,10 +5870,75 @@ class PlayState extends MusicBeatState
58605870
var eventKey:FlxKey = event.keyCode;
58615871
var key:Int = getKeyFromEvent(eventKey);
58625872
//if(!controls.controllerMode && key > -1) keyReleased(key);
5863-
if (pressed.contains(eventKey))
5864-
pressed.remove(eventKey);
5873+
if (AprilFools.allowAF && reverseNoteRules) {
5874+
#if debug
5875+
//Prevents crash specifically on debug without needing to try catch shit
5876+
@:privateAccess if (!FlxG.keys._keyListMap.exists(eventKey)) return;
5877+
#end
5878+
if (ClientPrefs.data.inputSystem == "Native-old") {
5879+
if (!controls.controllerMode)
5880+
{
5881+
if (paused || !startedCountdown || inCutscene) return;
5882+
if (pressed.contains(eventKey)) return;
5883+
pressed.push(eventKey);
5884+
if (key != -1) strumKeyDown(key);
5885+
}
5886+
}
5887+
else {
5888+
if (paused || !startedCountdown || inCutscene) return;
5889+
if (pressed.contains(eventKey)) return;
5890+
pressed.push(eventKey);
5891+
if (callOnScripts("onKeyDown", [event]) == LuaUtils.Function_Stop) return;
5892+
5893+
if (key > -1)
5894+
{
5895+
var hitNotes:Array<Note> = [];
5896+
var controlledFields:Array<PlayField> = [];
5897+
5898+
if (strumsBlocked[key]) return;
5899+
if (callOnScripts("onKeyPress", [key]) == LuaUtils.Function_Stop) return;
5900+
for (field in playfields.members)
5901+
{
5902+
if (!field.autoPlayed && field.isPlayer && field.inControl)
5903+
{
5904+
controlledFields.push(field);
5905+
field.keysPressed[key] = true;
5906+
if (generatedMusic && !endingSong)
5907+
{
5908+
var note:Note = null;
5909+
var ret:Dynamic = callOnScripts("onFieldInput", [field, key, hitNotes]);
5910+
if (ret == LuaUtils.Function_Stop) continue;
5911+
else if ((ret.objType == NOTE)) note = ret;
5912+
else note = field.input(key);
5913+
5914+
if (note == null)
5915+
{
5916+
var spr:StrumNote = field.strumNotes[key];
5917+
if (spr != null && spr.animation.curAnim.name != 'confirm')
5918+
{
5919+
spr.playAnim('pressed');
5920+
spr.resetAnim = 0;
5921+
}
5922+
}
5923+
else hitNotes.push(note);
5924+
}
5925+
}
5926+
if (hitNotes.length == 0 && controlledFields.length > 0)
5927+
{
5928+
callOnScripts('onGhostTap', [key]);
5929+
5930+
if (!ClientPrefs.data.ghostTapping)
5931+
noteMissPress(key, field);
5932+
}
5933+
}
5934+
}
5935+
}
5936+
} else {
5937+
if (pressed.contains(eventKey))
5938+
pressed.remove(eventKey);
58655939

5866-
if (key != -1) strumKeyUp(key);
5940+
if (key != -1) strumKeyUp(key);
5941+
}
58675942
}
58685943

58695944
private function keyReleased(key:Int, ?player:Int = -1)

source/states/TitleState.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class TitleState extends MusicBeatState
117117
if (Main.cmdArgs.indexOf("GameJoltBug") != -1 && !GJBug)
118118
{
119119
GJBug = true;
120-
FlxG.sound.playMusic(Paths.music('panixPress'), 0);
120+
Constants.playMenuMusic(0);
121121
FlxG.switchState(new options.OptionsState());
122122
}
123123

source/substates/PauseSubState.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class PauseSubState extends MusicBeatSubstate
155155
function getPauseSong()
156156
{
157157
var formattedSongName:String = (songName != null ? Paths.formatToSongPath(songName) : '');
158-
var formattedPauseMusic:String = Paths.formatToSongPath(ClientPrefs.data.pauseMusic);
158+
var formattedPauseMusic:String = Paths.formatToSongPath('pauseMusic/${ClientPrefs.data.pauseMusic}');
159159
if(formattedSongName == 'none' || (formattedSongName != 'none' && formattedPauseMusic == 'none')) return null;
160160

161161
return (formattedSongName != '') ? formattedSongName : formattedPauseMusic;
@@ -318,7 +318,7 @@ class PauseSubState extends MusicBeatSubstate
318318
MusicBeatState.switchState(new OptionsState());
319319
if(ClientPrefs.data.pauseMusic != 'None')
320320
{
321-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath(ClientPrefs.data.pauseMusic)), pauseMusic.volume);
321+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('pauseMusic/${ClientPrefs.data.pauseMusic}')), pauseMusic.volume);
322322
FlxTween.tween(FlxG.sound.music, {volume: 1}, 0.8);
323323
FlxG.sound.music.time = pauseMusic.time;
324324
}

source/substates/RankingSubstate.hx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ class RankingSubstate extends MusicBeatSubstate
179179
switch (PlayState.gameplayArea)
180180
{
181181
case "Story":
182-
FlxG.sound.playMusic(Paths.music('panixPress'));
182+
Constants.playMenuMusic();
183183
TransitionState.transitionState(states.StoryMenuState, {transitionType: "stickers"});
184184
case "Freeplay":
185185
trace('WENT BACK TO FREEPLAY??');
186-
FlxG.sound.playMusic(Paths.music('panixPress'));
186+
Constants.playMenuMusic();
187187
TransitionState.transitionState(states.FreeplayState, {transitionType: "stickers"});
188188
case "APFreeplay":
189189
trace('WENT BACK TO ARCHIPELAGO FREEPLAY??');
190-
FlxG.sound.playMusic(Paths.music('panixPress'));
190+
Constants.playMenuMusic();
191191
TransitionState.transitionState(states.FreeplayState, {transitionType: "stickers"});
192192
var locationId = (PlayState.SONG.song);
193193
trace('Combo Gotten:' + comboRankLimit + " Combo Required: " + comboRankSetLimit);

source/yutautil/AprilFools.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import yutautil.ExtendedDate;
44

55
// Simply manage if it's allowed.
66

7+
// TODO: Adjust this class to work with every holiday
8+
79
class AprilFools {
810
private var _allowAF:Bool = false;
911

0 commit comments

Comments
 (0)