mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
Merge branch 'feature/2hot-cutscenes-eric' into bugfix/weekend-1-can-death-freeze
This commit is contained in:
commit
5aba4008ac
5 changed files with 109 additions and 40 deletions
2
art
2
art
|
@ -1 +1 @@
|
||||||
Subproject commit 00463685fa570f0c853d08e250b46ef80f30bc48
|
Subproject commit 03e7c2a2353b184e45955c96d763b7cdf1acbc34
|
|
@ -39,27 +39,39 @@ class Conductor
|
||||||
|
|
||||||
static var _instance:Null<Conductor> = null;
|
static var _instance:Null<Conductor> = null;
|
||||||
|
|
||||||
static function get_instance():Conductor
|
|
||||||
{
|
|
||||||
if (_instance == null) _instance = new Conductor();
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal fired when the current Conductor instance advances to a new measure.
|
* Signal fired when the current static Conductor instance advances to a new measure.
|
||||||
*/
|
*/
|
||||||
public static var measureHit(default, null):FlxSignal = new FlxSignal();
|
public static var measureHit(default, null):FlxSignal = new FlxSignal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal fired when THIS Conductor instance advances to a new measure.
|
||||||
|
* TODO: This naming sucks but we can't make a static and instance field with the same name!
|
||||||
|
*/
|
||||||
|
public var onMeasureHit(default, null):FlxSignal = new FlxSignal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal fired when the current Conductor instance advances to a new beat.
|
* Signal fired when the current Conductor instance advances to a new beat.
|
||||||
*/
|
*/
|
||||||
public static var beatHit(default, null):FlxSignal = new FlxSignal();
|
public static var beatHit(default, null):FlxSignal = new FlxSignal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal fired when THIS Conductor instance advances to a new beat.
|
||||||
|
* TODO: This naming sucks but we can't make a static and instance field with the same name!
|
||||||
|
*/
|
||||||
|
public var onBeatHit(default, null):FlxSignal = new FlxSignal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal fired when the current Conductor instance advances to a new step.
|
* Signal fired when the current Conductor instance advances to a new step.
|
||||||
*/
|
*/
|
||||||
public static var stepHit(default, null):FlxSignal = new FlxSignal();
|
public static var stepHit(default, null):FlxSignal = new FlxSignal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal fired when THIS Conductor instance advances to a new step.
|
||||||
|
* TODO: This naming sucks but we can't make a static and instance field with the same name!
|
||||||
|
*/
|
||||||
|
public var onStepHit(default, null):FlxSignal = new FlxSignal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of time changes in the song.
|
* The list of time changes in the song.
|
||||||
* There should be at least one time change (at the beginning of the song) to define the BPM.
|
* There should be at least one time change (at the beginning of the song) to define the BPM.
|
||||||
|
@ -247,6 +259,69 @@ class Conductor
|
||||||
return Std.int(timeSignatureNumerator / timeSignatureDenominator * Constants.STEPS_PER_BEAT * Constants.STEPS_PER_BEAT);
|
return Std.int(timeSignatureNumerator / timeSignatureDenominator * Constants.STEPS_PER_BEAT * Constants.STEPS_PER_BEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the Conductor, replacing the current instance with a fresh one.
|
||||||
|
*/
|
||||||
|
public static function reset():Void
|
||||||
|
{
|
||||||
|
set_instance(new Conductor());
|
||||||
|
}
|
||||||
|
|
||||||
|
static function dispatchMeasureHit():Void
|
||||||
|
{
|
||||||
|
Conductor.measureHit.dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
static function dispatchBeatHit():Void
|
||||||
|
{
|
||||||
|
Conductor.beatHit.dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
static function dispatchStepHit():Void
|
||||||
|
{
|
||||||
|
Conductor.stepHit.dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
static function setupSingleton(input:Conductor):Void
|
||||||
|
{
|
||||||
|
input.onMeasureHit.add(dispatchMeasureHit);
|
||||||
|
|
||||||
|
input.onBeatHit.add(dispatchBeatHit);
|
||||||
|
|
||||||
|
input.onStepHit.add(dispatchStepHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function clearSingleton(input:Conductor):Void
|
||||||
|
{
|
||||||
|
input.onMeasureHit.remove(dispatchMeasureHit);
|
||||||
|
|
||||||
|
input.onBeatHit.remove(dispatchBeatHit);
|
||||||
|
|
||||||
|
input.onStepHit.remove(dispatchStepHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function get_instance():Conductor
|
||||||
|
{
|
||||||
|
if (Conductor._instance == null) set_instance(new Conductor());
|
||||||
|
if (Conductor._instance == null) throw "Could not initialize singleton Conductor!";
|
||||||
|
return Conductor._instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function set_instance(instance:Conductor):Conductor
|
||||||
|
{
|
||||||
|
// Use _instance in here to avoid recursion
|
||||||
|
if (Conductor._instance != null) clearSingleton(Conductor._instance);
|
||||||
|
|
||||||
|
Conductor._instance = instance;
|
||||||
|
|
||||||
|
if (Conductor._instance != null) setupSingleton(Conductor._instance);
|
||||||
|
|
||||||
|
return Conductor._instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
*/
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -257,6 +332,7 @@ class Conductor
|
||||||
*
|
*
|
||||||
* WARNING: Avoid this for things like setting the BPM of the title screen music,
|
* WARNING: Avoid this for things like setting the BPM of the title screen music,
|
||||||
* you should have a metadata file for it instead.
|
* you should have a metadata file for it instead.
|
||||||
|
* We should probably deprecate this in the future.
|
||||||
*/
|
*/
|
||||||
public function forceBPM(?bpm:Float):Void
|
public function forceBPM(?bpm:Float):Void
|
||||||
{
|
{
|
||||||
|
@ -277,7 +353,7 @@ class Conductor
|
||||||
* BPM, current step, etc. will be re-calculated based on the song position.
|
* BPM, current step, etc. will be re-calculated based on the song position.
|
||||||
*
|
*
|
||||||
* @param songPosition The current position in the song in milliseconds.
|
* @param songPosition The current position in the song in milliseconds.
|
||||||
* Leave blank to use the FlxG.sound.music position.
|
* Leave blank to use the `FlxG.sound.music` position.
|
||||||
*/
|
*/
|
||||||
public function update(?songPos:Float):Void
|
public function update(?songPos:Float):Void
|
||||||
{
|
{
|
||||||
|
@ -330,24 +406,20 @@ class Conductor
|
||||||
this.currentMeasure = Math.floor(currentMeasureTime);
|
this.currentMeasure = Math.floor(currentMeasureTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only fire the signal if we are THE Conductor.
|
|
||||||
if (this == Conductor.instance)
|
|
||||||
{
|
|
||||||
// FlxSignals are really cool.
|
// FlxSignals are really cool.
|
||||||
if (currentStep != oldStep)
|
if (currentStep != oldStep)
|
||||||
{
|
{
|
||||||
Conductor.stepHit.dispatch();
|
this.onStepHit.dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentBeat != oldBeat)
|
if (currentBeat != oldBeat)
|
||||||
{
|
{
|
||||||
Conductor.beatHit.dispatch();
|
this.onBeatHit.dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentMeasure != oldMeasure)
|
if (currentMeasure != oldMeasure)
|
||||||
{
|
{
|
||||||
Conductor.measureHit.dispatch();
|
this.onMeasureHit.dispatch();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,20 +589,14 @@ class Conductor
|
||||||
/**
|
/**
|
||||||
* Add variables of the current Conductor instance to the Flixel debugger.
|
* Add variables of the current Conductor instance to the Flixel debugger.
|
||||||
*/
|
*/
|
||||||
public static function watchQuick():Void
|
public static function watchQuick(?target:Conductor):Void
|
||||||
{
|
{
|
||||||
FlxG.watch.addQuick('songPosition', Conductor.instance.songPosition);
|
if (target == null) target = Conductor.instance;
|
||||||
FlxG.watch.addQuick('bpm', Conductor.instance.bpm);
|
|
||||||
FlxG.watch.addQuick('currentMeasureTime', Conductor.instance.currentMeasureTime);
|
|
||||||
FlxG.watch.addQuick('currentBeatTime', Conductor.instance.currentBeatTime);
|
|
||||||
FlxG.watch.addQuick('currentStepTime', Conductor.instance.currentStepTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
FlxG.watch.addQuick('songPosition', target.songPosition);
|
||||||
* Reset the Conductor, replacing the current instance with a fresh one.
|
FlxG.watch.addQuick('bpm', target.bpm);
|
||||||
*/
|
FlxG.watch.addQuick('currentMeasureTime', target.currentMeasureTime);
|
||||||
public static function reset():Void
|
FlxG.watch.addQuick('currentBeatTime', target.currentBeatTime);
|
||||||
{
|
FlxG.watch.addQuick('currentStepTime', target.currentStepTime);
|
||||||
_instance = new Conductor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -813,6 +813,7 @@ class PlayState extends MusicBeatSubState
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
|
||||||
|
var list = FlxG.sound.list;
|
||||||
updateHealthBar();
|
updateHealthBar();
|
||||||
updateScoreText();
|
updateScoreText();
|
||||||
|
|
||||||
|
@ -969,7 +970,7 @@ class PlayState extends MusicBeatSubState
|
||||||
if (health < Constants.HEALTH_MIN) health = Constants.HEALTH_MIN;
|
if (health < Constants.HEALTH_MIN) health = Constants.HEALTH_MIN;
|
||||||
|
|
||||||
// Apply camera zoom + multipliers.
|
// Apply camera zoom + multipliers.
|
||||||
if (subState == null && cameraZoomRate > 0.0 && !isInCutscene)
|
if (subState == null && cameraZoomRate > 0.0) // && !isInCutscene)
|
||||||
{
|
{
|
||||||
cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x
|
cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x
|
||||||
var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier.
|
var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier.
|
||||||
|
@ -1869,6 +1870,8 @@ class PlayState extends MusicBeatSubState
|
||||||
|
|
||||||
isInCutscene = false;
|
isInCutscene = false;
|
||||||
camCutscene.visible = false;
|
camCutscene.visible = false;
|
||||||
|
|
||||||
|
// TODO: Maybe tween in the camera after any cutscenes.
|
||||||
camHUD.visible = true;
|
camHUD.visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ class FocusCameraSongEvent extends SongEvent
|
||||||
switch (ease)
|
switch (ease)
|
||||||
{
|
{
|
||||||
case 'CLASSIC': // Old-school. No ease. Just set follow point.
|
case 'CLASSIC': // Old-school. No ease. Just set follow point.
|
||||||
PlayState.instance.cancelCameraFollowTween();
|
PlayState.instance.resetCamera();
|
||||||
PlayState.instance.cameraFollowPoint.setPosition(targetX, targetY);
|
PlayState.instance.cameraFollowPoint.setPosition(targetX, targetY);
|
||||||
case 'INSTANT': // Instant ease. Duration is automatically 0.
|
case 'INSTANT': // Instant ease. Duration is automatically 0.
|
||||||
PlayState.instance.tweenCameraToPosition(targetX, targetY, 0);
|
PlayState.instance.tweenCameraToPosition(targetX, targetY, 0);
|
||||||
|
|
|
@ -218,7 +218,7 @@ class Constants
|
||||||
public static final DEFAULT_VARIATION:String = 'default';
|
public static final DEFAULT_VARIATION:String = 'default';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard variations used by the game.
|
* Standardized variations for charts
|
||||||
*/
|
*/
|
||||||
public static final DEFAULT_VARIATION_LIST:Array<String> = ['default', 'erect', 'pico'];
|
public static final DEFAULT_VARIATION_LIST:Array<String> = ['default', 'erect', 'pico'];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue