Skip to content

Commit

Permalink
fix bf dj on freeplay
Browse files Browse the repository at this point in the history
Co-authored-by: gamerbross <[email protected]>
  • Loading branch information
charlesisfeline and gamerbross authored Jul 16, 2024
1 parent 69191df commit 4400df3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 42 deletions.
37 changes: 5 additions & 32 deletions source/funkin/ui/freeplay/DJBoyfriend.hx
Original file line number Diff line number Diff line change
Expand Up @@ -138,34 +138,6 @@ class DJBoyfriend extends FlxAtlasSprite
default:
// I shit myself.
}

if (FlxG.keys.pressed.CONTROL)
{
if (FlxG.keys.justPressed.LEFT)
{
this.offsetX -= FlxG.keys.pressed.ALT ? 0.1 : (FlxG.keys.pressed.SHIFT ? 10.0 : 1.0);
}

if (FlxG.keys.justPressed.RIGHT)
{
this.offsetX += FlxG.keys.pressed.ALT ? 0.1 : (FlxG.keys.pressed.SHIFT ? 10.0 : 1.0);
}

if (FlxG.keys.justPressed.UP)
{
this.offsetY -= FlxG.keys.pressed.ALT ? 0.1 : (FlxG.keys.pressed.SHIFT ? 10.0 : 1.0);
}

if (FlxG.keys.justPressed.DOWN)
{
this.offsetY += FlxG.keys.pressed.ALT ? 0.1 : (FlxG.keys.pressed.SHIFT ? 10.0 : 1.0);
}

if (FlxG.keys.justPressed.SPACE)
{
currentState = (currentState == Idle ? TV : Idle);
}
}
}

function onFinishAnim():Void
Expand Down Expand Up @@ -243,6 +215,9 @@ class DJBoyfriend extends FlxAtlasSprite
{
// tv is OFF, but getting turned on
FunkinSound.playOnce(Paths.sound('tv_on'), 1.0, function() {
// Fade out music to 40% volume over 1 second.
// This helps make the TV a bit more audible.
FlxG.sound.music?.fadeOut(1.0, FlxG.sound.music.volume * 0.4);
loadCartoon();
});
}
Expand All @@ -260,14 +235,12 @@ class DJBoyfriend extends FlxAtlasSprite

function loadCartoon()
{
playingCartoon = true;

cartoonSnd = FunkinSound.load(Paths.sound(getRandomFlashToon()), 1.0, false, true, true, function() {
anim.play("Boyfriend DJ watchin tv OG", true, false, 60);
});

// Fade out music to 40% volume over 1 second.
// This helps make the TV a bit more audible.
FlxG.sound.music.fadeOut(1.0, 0.1);

// Play the cartoon at a random time between the start and 5 seconds from the end.
cartoonSnd.time = FlxG.random.float(0, Math.max(cartoonSnd.length - (5 * Constants.MS_PER_SEC), 0.0));
}
Expand Down
21 changes: 11 additions & 10 deletions source/funkin/ui/freeplay/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1323,9 +1323,7 @@ class FreeplayState extends MusicBeatSubState
{
if (busy) return;

var upP:Bool = controls.UI_UP_P && !FlxG.keys.pressed.CONTROL;
var downP:Bool = controls.UI_DOWN_P && !FlxG.keys.pressed.CONTROL;
var accepted:Bool = controls.ACCEPT && !FlxG.keys.pressed.CONTROL;
var accepted:Bool = controls.ACCEPT;

if (FlxG.onMobile)
{
Expand Down Expand Up @@ -1399,7 +1397,7 @@ class FreeplayState extends MusicBeatSubState
}
#end

if (!FlxG.keys.pressed.CONTROL && (controls.UI_UP || controls.UI_DOWN))
if (controls.UI_UP || controls.UI_DOWN)
{
if (spamming)
{
Expand Down Expand Up @@ -1461,13 +1459,13 @@ class FreeplayState extends MusicBeatSubState
}
#end

if (controls.UI_LEFT_P && !FlxG.keys.pressed.CONTROL)
if (controls.UI_LEFT_P)
{
dj.resetAFKTimer();
changeDiff(-1);
generateSongList(currentFilter, true);
}
if (controls.UI_RIGHT_P && !FlxG.keys.pressed.CONTROL)
if (controls.UI_RIGHT_P)
{
dj.resetAFKTimer();
changeDiff(1);
Expand Down Expand Up @@ -1886,6 +1884,9 @@ class FreeplayState extends MusicBeatSubState

public function playCurSongPreview(daSongCapsule:SongMenuItem):Void
{
var volume:Float = 0.4;
if (dj.playingCartoon) volume *= 0.4; // 40%

if (curSelected == 0)
{
FunkinSound.playMusic('freeplayRandom',
Expand All @@ -1894,7 +1895,7 @@ class FreeplayState extends MusicBeatSubState
overrideExisting: true,
restartTrack: false
});
FlxG.sound.music.fadeIn(2, 0, 0.8);
FlxG.sound.music.fadeIn(2, 0, volume);
}
else
{
Expand All @@ -1913,7 +1914,7 @@ class FreeplayState extends MusicBeatSubState
end: 0.25
},
onLoad: function() {
FlxG.sound.music.fadeIn(2, 0, 0.4);
FlxG.sound.music.fadeIn(2, 0, volume);
}
});
}
Expand Down Expand Up @@ -1964,8 +1965,8 @@ class DifficultySelector extends FlxSprite

override function update(elapsed:Float):Void
{
if (flipX && controls.UI_RIGHT_P && !FlxG.keys.pressed.CONTROL) moveShitDown();
if (!flipX && controls.UI_LEFT_P && !FlxG.keys.pressed.CONTROL) moveShitDown();
if (flipX && controls.UI_RIGHT_P) moveShitDown();
if (!flipX && controls.UI_LEFT_P) moveShitDown();

super.update(elapsed);
}
Expand Down

0 comments on commit 4400df3

Please sign in to comment.