mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-04 13:54:22 +00:00
Merge remote-tracking branch 'origin/rewrite/master' into feature/credits
This commit is contained in:
commit
6ab6458e2a
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit 289810289d66cbaf5d55494e396e71bdf9085b1e
|
Subproject commit b2144938c899e4a5d2d05466f710aa75ff4e1d1c
|
|
@ -1,17 +1,18 @@
|
||||||
package funkin.audio;
|
package funkin.audio;
|
||||||
|
|
||||||
import flixel.sound.FlxSound;
|
|
||||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
import flixel.util.FlxSignal.FlxTypedSignal;
|
import flixel.math.FlxMath;
|
||||||
|
import flixel.sound.FlxSound;
|
||||||
import flixel.system.FlxAssets.FlxSoundAsset;
|
import flixel.system.FlxAssets.FlxSoundAsset;
|
||||||
import funkin.util.tools.ICloneable;
|
import flixel.tweens.FlxTween;
|
||||||
|
import flixel.util.FlxSignal.FlxTypedSignal;
|
||||||
|
import funkin.audio.waveform.WaveformData;
|
||||||
|
import funkin.audio.waveform.WaveformDataParser;
|
||||||
import funkin.data.song.SongData.SongMusicData;
|
import funkin.data.song.SongData.SongMusicData;
|
||||||
import funkin.data.song.SongRegistry;
|
import funkin.data.song.SongRegistry;
|
||||||
import funkin.audio.waveform.WaveformData;
|
import funkin.util.tools.ICloneable;
|
||||||
import openfl.media.SoundMixer;
|
|
||||||
import funkin.audio.waveform.WaveformDataParser;
|
|
||||||
import flixel.math.FlxMath;
|
|
||||||
import openfl.Assets;
|
import openfl.Assets;
|
||||||
|
import openfl.media.SoundMixer;
|
||||||
#if (openfl >= "8.0.0")
|
#if (openfl >= "8.0.0")
|
||||||
import openfl.utils.AssetType;
|
import openfl.utils.AssetType;
|
||||||
#end
|
#end
|
||||||
|
@ -50,6 +51,11 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
||||||
*/
|
*/
|
||||||
static var pool(default, null):FlxTypedGroup<FunkinSound> = new FlxTypedGroup<FunkinSound>();
|
static var pool(default, null):FlxTypedGroup<FunkinSound> = new FlxTypedGroup<FunkinSound>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the current time of the sound.
|
||||||
|
* NOTE: You need to `add()` the sound to the scene for `update()` to increment the time.
|
||||||
|
*/
|
||||||
|
//
|
||||||
public var muted(default, set):Bool = false;
|
public var muted(default, set):Bool = false;
|
||||||
|
|
||||||
function set_muted(value:Bool):Bool
|
function set_muted(value:Bool):Bool
|
||||||
|
@ -325,6 +331,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
||||||
|
|
||||||
if (FlxG.sound.music != null)
|
if (FlxG.sound.music != null)
|
||||||
{
|
{
|
||||||
|
FlxG.sound.music.fadeTween?.cancel();
|
||||||
FlxG.sound.music.stop();
|
FlxG.sound.music.stop();
|
||||||
FlxG.sound.music.kill();
|
FlxG.sound.music.kill();
|
||||||
}
|
}
|
||||||
|
@ -392,8 +399,6 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
||||||
// Call onLoad() because the sound already loaded
|
// Call onLoad() because the sound already loaded
|
||||||
if (onLoad != null && sound._sound != null) onLoad();
|
if (onLoad != null && sound._sound != null) onLoad();
|
||||||
|
|
||||||
FlxG.sound.list.remove(FlxG.sound.music);
|
|
||||||
|
|
||||||
return sound;
|
return sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,6 +406,8 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
||||||
{
|
{
|
||||||
// trace('[FunkinSound] Destroying sound "${this._label}"');
|
// trace('[FunkinSound] Destroying sound "${this._label}"');
|
||||||
super.destroy();
|
super.destroy();
|
||||||
|
FlxTween.cancelTweensOf(this);
|
||||||
|
this._label = 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -152,9 +152,12 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
|
||||||
*/
|
*/
|
||||||
public function stop()
|
public function stop()
|
||||||
{
|
{
|
||||||
forEachAlive(function(sound:FunkinSound) {
|
if (members != null)
|
||||||
sound.stop();
|
{
|
||||||
});
|
forEachAlive(function(sound:FunkinSound) {
|
||||||
|
sound.stop();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function destroy()
|
public override function destroy()
|
||||||
|
|
|
@ -160,7 +160,9 @@ class VoicesGroup extends SoundGroup
|
||||||
public override function destroy():Void
|
public override function destroy():Void
|
||||||
{
|
{
|
||||||
playerVoices.destroy();
|
playerVoices.destroy();
|
||||||
|
playerVoices = null;
|
||||||
opponentVoices.destroy();
|
opponentVoices.destroy();
|
||||||
|
opponentVoices = null;
|
||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,7 +431,11 @@ class SongRegistry extends BaseRegistry<Song, SongMetadata>
|
||||||
{
|
{
|
||||||
variation = variation == null ? Constants.DEFAULT_VARIATION : variation;
|
variation = variation == null ? Constants.DEFAULT_VARIATION : variation;
|
||||||
var entryFilePath:String = Paths.json('$dataFilePath/$id/$id-metadata${variation == Constants.DEFAULT_VARIATION ? '' : '-$variation'}');
|
var entryFilePath:String = Paths.json('$dataFilePath/$id/$id-metadata${variation == Constants.DEFAULT_VARIATION ? '' : '-$variation'}');
|
||||||
if (!openfl.Assets.exists(entryFilePath)) return null;
|
if (!openfl.Assets.exists(entryFilePath))
|
||||||
|
{
|
||||||
|
trace(' [WARN] Could not locate file $entryFilePath');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
var rawJson:Null<String> = openfl.Assets.getText(entryFilePath);
|
var rawJson:Null<String> = openfl.Assets.getText(entryFilePath);
|
||||||
if (rawJson == null) return null;
|
if (rawJson == null) return null;
|
||||||
rawJson = rawJson.trim();
|
rawJson = rawJson.trim();
|
||||||
|
|
|
@ -79,6 +79,23 @@ class FlxAtlasSprite extends FlxAnimate
|
||||||
return this.currentAnimation;
|
return this.currentAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `anim.finished` always returns false on looping animations,
|
||||||
|
* but this function will return true if we are on the last frame of the looping animation.
|
||||||
|
*/
|
||||||
|
public function isLoopFinished():Bool
|
||||||
|
{
|
||||||
|
if (this.anim == null) return false;
|
||||||
|
if (!this.anim.isPlaying) return false;
|
||||||
|
|
||||||
|
// Reverse animation finished.
|
||||||
|
if (this.anim.reversed && this.anim.curFrame == 0) return true;
|
||||||
|
// Forward animation finished.
|
||||||
|
if (!this.anim.reversed && this.anim.curFrame >= (this.anim.length - 1)) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays an animation.
|
* Plays an animation.
|
||||||
* @param id A string ID of the animation to play.
|
* @param id A string ID of the animation to play.
|
||||||
|
|
|
@ -1925,14 +1925,14 @@ class PlayState extends MusicBeatSubState
|
||||||
FlxG.sound.music.play(true, startTimestamp - Conductor.instance.instrumentalOffset);
|
FlxG.sound.music.play(true, startTimestamp - Conductor.instance.instrumentalOffset);
|
||||||
FlxG.sound.music.pitch = playbackRate;
|
FlxG.sound.music.pitch = playbackRate;
|
||||||
|
|
||||||
// I am going insane.
|
// Prevent the volume from being wrong.
|
||||||
FlxG.sound.music.volume = 1.0;
|
FlxG.sound.music.volume = 1.0;
|
||||||
|
|
||||||
FlxG.sound.music.fadeTween?.cancel();
|
FlxG.sound.music.fadeTween?.cancel();
|
||||||
|
|
||||||
trace('Playing vocals...');
|
trace('Playing vocals...');
|
||||||
add(vocals);
|
add(vocals);
|
||||||
vocals.play();
|
vocals.play();
|
||||||
|
vocals.volume = 1.0;
|
||||||
vocals.pitch = playbackRate;
|
vocals.pitch = playbackRate;
|
||||||
resyncVocals();
|
resyncVocals();
|
||||||
|
|
||||||
|
@ -2927,6 +2927,9 @@ class PlayState extends MusicBeatSubState
|
||||||
// If the camera is being tweened, stop it.
|
// If the camera is being tweened, stop it.
|
||||||
cancelAllCameraTweens();
|
cancelAllCameraTweens();
|
||||||
|
|
||||||
|
// Dispatch the destroy event.
|
||||||
|
dispatchEvent(new ScriptEvent(DESTROY, false));
|
||||||
|
|
||||||
if (currentConversation != null)
|
if (currentConversation != null)
|
||||||
{
|
{
|
||||||
remove(currentConversation);
|
remove(currentConversation);
|
||||||
|
@ -2941,10 +2944,7 @@ class PlayState extends MusicBeatSubState
|
||||||
if (overrideMusic)
|
if (overrideMusic)
|
||||||
{
|
{
|
||||||
// Stop the music. Do NOT destroy it, something still references it!
|
// Stop the music. Do NOT destroy it, something still references it!
|
||||||
if (FlxG.sound.music != null)
|
if (FlxG.sound.music != null) FlxG.sound.music.pause();
|
||||||
{
|
|
||||||
FlxG.sound.music.pause();
|
|
||||||
}
|
|
||||||
if (vocals != null)
|
if (vocals != null)
|
||||||
{
|
{
|
||||||
vocals.pause();
|
vocals.pause();
|
||||||
|
@ -2954,10 +2954,7 @@ class PlayState extends MusicBeatSubState
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Stop and destroy the music.
|
// Stop and destroy the music.
|
||||||
if (FlxG.sound.music != null)
|
if (FlxG.sound.music != null) FlxG.sound.music.pause();
|
||||||
{
|
|
||||||
FlxG.sound.music.pause();
|
|
||||||
}
|
|
||||||
if (vocals != null)
|
if (vocals != null)
|
||||||
{
|
{
|
||||||
vocals.destroy();
|
vocals.destroy();
|
||||||
|
@ -2970,7 +2967,6 @@ class PlayState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
remove(currentStage);
|
remove(currentStage);
|
||||||
currentStage.kill();
|
currentStage.kill();
|
||||||
dispatchEvent(new ScriptEvent(DESTROY, false));
|
|
||||||
currentStage = null;
|
currentStage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Scoring
|
||||||
case WEEK7: scoreNoteWEEK7(msTiming);
|
case WEEK7: scoreNoteWEEK7(msTiming);
|
||||||
case PBOT1: scoreNotePBOT1(msTiming);
|
case PBOT1: scoreNotePBOT1(msTiming);
|
||||||
default:
|
default:
|
||||||
trace('ERROR: Unknown scoring system: ' + scoringSystem);
|
FlxG.log.error('Unknown scoring system: ${scoringSystem}');
|
||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class Scoring
|
||||||
case WEEK7: judgeNoteWEEK7(msTiming);
|
case WEEK7: judgeNoteWEEK7(msTiming);
|
||||||
case PBOT1: judgeNotePBOT1(msTiming);
|
case PBOT1: judgeNotePBOT1(msTiming);
|
||||||
default:
|
default:
|
||||||
trace('ERROR: Unknown scoring system: ' + scoringSystem);
|
FlxG.log.error('Unknown scoring system: ${scoringSystem}');
|
||||||
'miss';
|
'miss';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,9 @@ class Scoring
|
||||||
case(_ < PBOT1_PERFECT_THRESHOLD) => true:
|
case(_ < PBOT1_PERFECT_THRESHOLD) => true:
|
||||||
PBOT1_MAX_SCORE;
|
PBOT1_MAX_SCORE;
|
||||||
default:
|
default:
|
||||||
|
// Fancy equation.
|
||||||
var factor:Float = 1.0 - (1.0 / (1.0 + Math.exp(-PBOT1_SCORING_SLOPE * (absTiming - PBOT1_SCORING_OFFSET))));
|
var factor:Float = 1.0 - (1.0 / (1.0 + Math.exp(-PBOT1_SCORING_SLOPE * (absTiming - PBOT1_SCORING_OFFSET))));
|
||||||
|
|
||||||
var score:Int = Std.int(PBOT1_MAX_SCORE * factor + PBOT1_MIN_SCORE);
|
var score:Int = Std.int(PBOT1_MAX_SCORE * factor + PBOT1_MIN_SCORE);
|
||||||
|
|
||||||
score;
|
score;
|
||||||
|
@ -169,6 +171,7 @@ class Scoring
|
||||||
case(_ < PBOT1_SHIT_THRESHOLD) => true:
|
case(_ < PBOT1_SHIT_THRESHOLD) => true:
|
||||||
'shit';
|
'shit';
|
||||||
default:
|
default:
|
||||||
|
FlxG.log.warn('Missed note: Bad timing ($absTiming < $PBOT1_SHIT_THRESHOLD)');
|
||||||
'miss';
|
'miss';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,6 +260,7 @@ class Scoring
|
||||||
case(_ < LEGACY_HIT_WINDOW * LEGACY_SHIT_THRESHOLD) => true:
|
case(_ < LEGACY_HIT_WINDOW * LEGACY_SHIT_THRESHOLD) => true:
|
||||||
'shit';
|
'shit';
|
||||||
default:
|
default:
|
||||||
|
FlxG.log.warn('Missed note: Bad timing ($absTiming < $LEGACY_SHIT_THRESHOLD)');
|
||||||
'miss';
|
'miss';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,6 +340,7 @@ class Scoring
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
FlxG.log.warn('Missed note: Bad timing ($absTiming < $WEEK7_HIT_WINDOW)');
|
||||||
return 'miss';
|
return 'miss';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import flixel.FlxSprite;
|
||||||
import flixel.util.FlxSignal;
|
import flixel.util.FlxSignal;
|
||||||
import funkin.util.assets.FlxAnimationUtil;
|
import funkin.util.assets.FlxAnimationUtil;
|
||||||
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
||||||
|
import funkin.audio.FunkinSound;
|
||||||
import flixel.util.FlxTimer;
|
import flixel.util.FlxTimer;
|
||||||
import funkin.audio.FunkinSound;
|
import funkin.audio.FunkinSound;
|
||||||
import funkin.audio.FlxStreamSound;
|
import funkin.audio.FlxStreamSound;
|
||||||
|
@ -26,8 +27,8 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
|
|
||||||
var gotSpooked:Bool = false;
|
var gotSpooked:Bool = false;
|
||||||
|
|
||||||
static final SPOOK_PERIOD:Float = 120.0;
|
static final SPOOK_PERIOD:Float = 10.0;
|
||||||
static final TV_PERIOD:Float = 180.0;
|
static final TV_PERIOD:Float = 10.0;
|
||||||
|
|
||||||
// Time since dad last SPOOKED you.
|
// Time since dad last SPOOKED you.
|
||||||
var timeSinceSpook:Float = 0;
|
var timeSinceSpook:Float = 0;
|
||||||
|
@ -48,7 +49,6 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
};
|
};
|
||||||
|
|
||||||
setupAnimations();
|
setupAnimations();
|
||||||
trace(listAnimations());
|
|
||||||
|
|
||||||
FlxG.debugger.track(this);
|
FlxG.debugger.track(this);
|
||||||
FlxG.console.registerObject("dj", this);
|
FlxG.console.registerObject("dj", this);
|
||||||
|
@ -87,20 +87,21 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
timeSinceSpook = 0;
|
timeSinceSpook = 0;
|
||||||
case Idle:
|
case Idle:
|
||||||
// We are in this state the majority of the time.
|
// We are in this state the majority of the time.
|
||||||
if (getCurrentAnimation() != 'Boyfriend DJ' || anim.finished)
|
if (getCurrentAnimation() != 'Boyfriend DJ')
|
||||||
{
|
{
|
||||||
if (timeSinceSpook > SPOOK_PERIOD && !gotSpooked)
|
playFlashAnimation('Boyfriend DJ', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getCurrentAnimation() == 'Boyfriend DJ' && this.isLoopFinished())
|
||||||
|
{
|
||||||
|
if (timeSinceSpook >= SPOOK_PERIOD && !gotSpooked)
|
||||||
{
|
{
|
||||||
currentState = Spook;
|
currentState = Spook;
|
||||||
}
|
}
|
||||||
else if (timeSinceSpook > TV_PERIOD)
|
else if (timeSinceSpook >= TV_PERIOD)
|
||||||
{
|
{
|
||||||
currentState = TV;
|
currentState = TV;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
playFlashAnimation('Boyfriend DJ', false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
timeSinceSpook += elapsed;
|
timeSinceSpook += elapsed;
|
||||||
case Confirm:
|
case Confirm:
|
||||||
|
@ -111,6 +112,7 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
{
|
{
|
||||||
onSpook.dispatch();
|
onSpook.dispatch();
|
||||||
playFlashAnimation('bf dj afk', false);
|
playFlashAnimation('bf dj afk', false);
|
||||||
|
gotSpooked = true;
|
||||||
}
|
}
|
||||||
timeSinceSpook = 0;
|
timeSinceSpook = 0;
|
||||||
case TV:
|
case TV:
|
||||||
|
@ -119,6 +121,34 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
default:
|
default:
|
||||||
// I shit myself.
|
// 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
|
function onFinishAnim():Void
|
||||||
|
@ -139,11 +169,15 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
|
|
||||||
case "Boyfriend DJ watchin tv OG":
|
case "Boyfriend DJ watchin tv OG":
|
||||||
var frame:Int = FlxG.random.bool(33) ? 112 : 166;
|
var frame:Int = FlxG.random.bool(33) ? 112 : 166;
|
||||||
if (FlxG.random.bool(10))
|
|
||||||
|
// BF switches channels when the video ends, or at a 10% chance each time his idle loops.
|
||||||
|
if (FlxG.random.bool(5))
|
||||||
{
|
{
|
||||||
frame = 60;
|
frame = 60;
|
||||||
// boyfriend switches channel code?
|
// boyfriend switches channel code?
|
||||||
|
// runTvLogic();
|
||||||
}
|
}
|
||||||
|
trace('Replay idle: ${frame}');
|
||||||
anim.play("Boyfriend DJ watchin tv OG", true, false, frame);
|
anim.play("Boyfriend DJ watchin tv OG", true, false, frame);
|
||||||
// trace('Finished confirm');
|
// trace('Finished confirm');
|
||||||
}
|
}
|
||||||
|
@ -152,24 +186,31 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
public function resetAFKTimer():Void
|
public function resetAFKTimer():Void
|
||||||
{
|
{
|
||||||
timeSinceSpook = 0;
|
timeSinceSpook = 0;
|
||||||
|
gotSpooked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var offsetX:Float = 0.0;
|
||||||
|
var offsetY:Float = 0.0;
|
||||||
|
|
||||||
function setupAnimations():Void
|
function setupAnimations():Void
|
||||||
{
|
{
|
||||||
// animation.addByPrefix('intro', "boyfriend dj intro", 24, false);
|
// Intro
|
||||||
addOffset('boyfriend dj intro', 8, 3);
|
addOffset('boyfriend dj intro', 8.0 - 1.3, 3.0 - 0.4);
|
||||||
|
|
||||||
// animation.addByPrefix('idle', "Boyfriend DJ0", 24, false);
|
// Idle
|
||||||
addOffset('Boyfriend DJ', 0, 0);
|
addOffset('Boyfriend DJ', 0, 0);
|
||||||
|
|
||||||
// animation.addByPrefix('confirm', "Boyfriend DJ confirm", 24, false);
|
// Confirm
|
||||||
addOffset('Boyfriend DJ confirm', 0, 0);
|
addOffset('Boyfriend DJ confirm', 0, 0);
|
||||||
|
|
||||||
// animation.addByPrefix('spook', "bf dj afk0", 24, false);
|
// AFK: Spook
|
||||||
addOffset('bf dj afk', 0, 0);
|
addOffset('bf dj afk', 649.5, 58.5);
|
||||||
|
|
||||||
|
// AFK: TV
|
||||||
|
addOffset('Boyfriend DJ watchin tv OG', 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var cartoonSnd:FlxStreamSound;
|
var cartoonSnd:Null<FunkinSound> = null;
|
||||||
|
|
||||||
public var playingCartoon:Bool = false;
|
public var playingCartoon:Bool = false;
|
||||||
|
|
||||||
|
@ -178,39 +219,47 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
if (cartoonSnd == null)
|
if (cartoonSnd == null)
|
||||||
{
|
{
|
||||||
// tv is OFF, but getting turned on
|
// tv is OFF, but getting turned on
|
||||||
FunkinSound.playOnce(Paths.sound('tv_on'));
|
// Eric got FUCKING TROLLED there is no `tv_on` or `channel_switch` sound!
|
||||||
|
// FunkinSound.playOnce(Paths.sound('tv_on'), 1.0, function() {
|
||||||
cartoonSnd = new FlxStreamSound();
|
// });
|
||||||
FlxG.sound.defaultSoundGroup.add(cartoonSnd);
|
loadCartoon();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// plays it smidge after the click
|
// plays it smidge after the click
|
||||||
new FlxTimer().start(0.1, function(_) {
|
// new FlxTimer().start(0.1, function(_) {
|
||||||
FunkinSound.playOnce(Paths.sound('channel_switch'));
|
// // FunkinSound.playOnce(Paths.sound('channel_switch'));
|
||||||
});
|
// });
|
||||||
|
cartoonSnd.destroy();
|
||||||
|
loadCartoon();
|
||||||
}
|
}
|
||||||
// cartoonSnd.loadEmbedded(Paths.sound("cartoons/peck"));
|
|
||||||
// cartoonSnd.play();
|
|
||||||
|
|
||||||
loadCartoon();
|
// loadCartoon();
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadCartoon()
|
function loadCartoon()
|
||||||
{
|
{
|
||||||
cartoonSnd.loadEmbedded(Paths.sound(getRandomFlashToon()), false, false, function() {
|
cartoonSnd = FunkinSound.load(Paths.sound(getRandomFlashToon()), 1.0, false, true, true, function() {
|
||||||
anim.play("Boyfriend DJ watchin tv OG", true, false, 60);
|
anim.play("Boyfriend DJ watchin tv OG", true, false, 60);
|
||||||
});
|
});
|
||||||
cartoonSnd.play(true, FlxG.random.float(0, cartoonSnd.length));
|
|
||||||
|
// 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.4);
|
||||||
|
|
||||||
|
// 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
var cartoonList:Array<String> = openfl.utils.Assets.list().filter(function(path) return path.startsWith("assets/sounds/cartoons/"));
|
final cartoonList:Array<String> = openfl.utils.Assets.list().filter(function(path) return path.startsWith("assets/sounds/cartoons/"));
|
||||||
|
|
||||||
function getRandomFlashToon():String
|
function getRandomFlashToon():String
|
||||||
{
|
{
|
||||||
var randomFile = FlxG.random.getObject(cartoonList);
|
var randomFile = FlxG.random.getObject(cartoonList);
|
||||||
|
|
||||||
|
// Strip folder prefix
|
||||||
randomFile = randomFile.replace("assets/sounds/", "");
|
randomFile = randomFile.replace("assets/sounds/", "");
|
||||||
|
// Strip file extension
|
||||||
randomFile = randomFile.substring(0, randomFile.length - 4);
|
randomFile = randomFile.substring(0, randomFile.length - 4);
|
||||||
|
|
||||||
return randomFile;
|
return randomFile;
|
||||||
|
@ -244,10 +293,31 @@ class DJBoyfriend extends FlxAtlasSprite
|
||||||
var daOffset = animOffsets.get(AnimName);
|
var daOffset = animOffsets.get(AnimName);
|
||||||
if (animOffsets.exists(AnimName))
|
if (animOffsets.exists(AnimName))
|
||||||
{
|
{
|
||||||
offset.set(daOffset[0], daOffset[1]);
|
var xValue = daOffset[0];
|
||||||
|
var yValue = daOffset[1];
|
||||||
|
if (AnimName == "Boyfriend DJ watchin tv OG")
|
||||||
|
{
|
||||||
|
xValue += offsetX;
|
||||||
|
yValue += offsetY;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset.set(xValue, yValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
offset.set(0, 0);
|
offset.set(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override function destroy():Void
|
||||||
|
{
|
||||||
|
super.destroy();
|
||||||
|
|
||||||
|
if (cartoonSnd != null)
|
||||||
|
{
|
||||||
|
cartoonSnd.destroy();
|
||||||
|
cartoonSnd = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -688,14 +688,6 @@ class FreeplayState extends MusicBeatSubState
|
||||||
|
|
||||||
if (FlxG.keys.justPressed.T) typing.hasFocus = true;
|
if (FlxG.keys.justPressed.T) typing.hasFocus = true;
|
||||||
|
|
||||||
if (FlxG.sound.music != null)
|
|
||||||
{
|
|
||||||
if (FlxG.sound.music.volume < 0.7)
|
|
||||||
{
|
|
||||||
FlxG.sound.music.volume += 0.5 * elapsed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lerpScore = MathUtil.coolLerp(lerpScore, intendedScore, 0.2);
|
lerpScore = MathUtil.coolLerp(lerpScore, intendedScore, 0.2);
|
||||||
lerpCompletion = MathUtil.coolLerp(lerpCompletion, intendedCompletion, 0.9);
|
lerpCompletion = MathUtil.coolLerp(lerpCompletion, intendedCompletion, 0.9);
|
||||||
|
|
||||||
|
@ -733,9 +725,9 @@ class FreeplayState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
if (busy) return;
|
if (busy) return;
|
||||||
|
|
||||||
var upP:Bool = controls.UI_UP_P;
|
var upP:Bool = controls.UI_UP_P && !FlxG.keys.pressed.CONTROL;
|
||||||
var downP:Bool = controls.UI_DOWN_P;
|
var downP:Bool = controls.UI_DOWN_P && !FlxG.keys.pressed.CONTROL;
|
||||||
var accepted:Bool = controls.ACCEPT;
|
var accepted:Bool = controls.ACCEPT && !FlxG.keys.pressed.CONTROL;
|
||||||
|
|
||||||
if (FlxG.onMobile)
|
if (FlxG.onMobile)
|
||||||
{
|
{
|
||||||
|
@ -809,10 +801,8 @@ class FreeplayState extends MusicBeatSubState
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
if (controls.UI_UP || controls.UI_DOWN)
|
if (!FlxG.keys.pressed.CONTROL && (controls.UI_UP || controls.UI_DOWN))
|
||||||
{
|
{
|
||||||
spamTimer += elapsed;
|
|
||||||
|
|
||||||
if (spamming)
|
if (spamming)
|
||||||
{
|
{
|
||||||
if (spamTimer >= 0.07)
|
if (spamTimer >= 0.07)
|
||||||
|
@ -829,7 +819,24 @@ class FreeplayState extends MusicBeatSubState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (spamTimer >= 0.9) spamming = true;
|
else if (spamTimer >= 0.9)
|
||||||
|
{
|
||||||
|
spamming = true;
|
||||||
|
}
|
||||||
|
else if (spamTimer <= 0)
|
||||||
|
{
|
||||||
|
if (controls.UI_UP)
|
||||||
|
{
|
||||||
|
changeSelection(-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
changeSelection(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spamTimer += elapsed;
|
||||||
|
dj.resetAFKTimer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -837,29 +844,18 @@ class FreeplayState extends MusicBeatSubState
|
||||||
spamTimer = 0;
|
spamTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upP)
|
|
||||||
{
|
|
||||||
dj.resetAFKTimer();
|
|
||||||
changeSelection(-1);
|
|
||||||
}
|
|
||||||
if (downP)
|
|
||||||
{
|
|
||||||
dj.resetAFKTimer();
|
|
||||||
changeSelection(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FlxG.mouse.wheel != 0)
|
if (FlxG.mouse.wheel != 0)
|
||||||
{
|
{
|
||||||
dj.resetAFKTimer();
|
dj.resetAFKTimer();
|
||||||
changeSelection(-Math.round(FlxG.mouse.wheel / 4));
|
changeSelection(-Math.round(FlxG.mouse.wheel / 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controls.UI_LEFT_P)
|
if (controls.UI_LEFT_P && !FlxG.keys.pressed.CONTROL)
|
||||||
{
|
{
|
||||||
dj.resetAFKTimer();
|
dj.resetAFKTimer();
|
||||||
changeDiff(-1);
|
changeDiff(-1);
|
||||||
}
|
}
|
||||||
if (controls.UI_RIGHT_P)
|
if (controls.UI_RIGHT_P && !FlxG.keys.pressed.CONTROL)
|
||||||
{
|
{
|
||||||
dj.resetAFKTimer();
|
dj.resetAFKTimer();
|
||||||
changeDiff(1);
|
changeDiff(1);
|
||||||
|
@ -1234,8 +1230,8 @@ class DifficultySelector extends FlxSprite
|
||||||
|
|
||||||
override function update(elapsed:Float):Void
|
override function update(elapsed:Float):Void
|
||||||
{
|
{
|
||||||
if (flipX && controls.UI_RIGHT_P) moveShitDown();
|
if (flipX && controls.UI_RIGHT_P && !FlxG.keys.pressed.CONTROL) moveShitDown();
|
||||||
if (!flipX && controls.UI_LEFT_P) moveShitDown();
|
if (!flipX && controls.UI_LEFT_P && !FlxG.keys.pressed.CONTROL) moveShitDown();
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,8 +182,6 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
{
|
{
|
||||||
var charPath:String = "freeplay/icons/";
|
var charPath:String = "freeplay/icons/";
|
||||||
|
|
||||||
trace(char);
|
|
||||||
|
|
||||||
// TODO: Put this in the character metadata where it belongs.
|
// TODO: Put this in the character metadata where it belongs.
|
||||||
// TODO: Also, can use CharacterDataParser.getCharPixelIconAsset()
|
// TODO: Also, can use CharacterDataParser.getCharPixelIconAsset()
|
||||||
switch (char)
|
switch (char)
|
||||||
|
|
|
@ -438,6 +438,8 @@ class StoryMenuState extends MusicBeatState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
||||||
|
|
||||||
updateText();
|
updateText();
|
||||||
updateBackground(previousLevelId);
|
updateBackground(previousLevelId);
|
||||||
updateProps();
|
updateProps();
|
||||||
|
@ -481,6 +483,7 @@ class StoryMenuState extends MusicBeatState
|
||||||
if (hasChanged)
|
if (hasChanged)
|
||||||
{
|
{
|
||||||
buildDifficultySprite();
|
buildDifficultySprite();
|
||||||
|
FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
||||||
// Disable the funny music thing for now.
|
// Disable the funny music thing for now.
|
||||||
// funnyMusicThing();
|
// funnyMusicThing();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue