Run haxe-formatter on every file in source/

This commit is contained in:
AbnormalPoof
2026-02-15 21:01:26 -07:00
committed by Hundrec
parent 32ef5404d8
commit 6026e0b908
277 changed files with 5227 additions and 4842 deletions
+1 -1
Submodule assets updated: 594af74e60...b10576a917
+2 -1
View File
@@ -136,7 +136,8 @@ class Main extends Sprite
#if hxvlc
// Initialize hxvlc's Handle here so the videos are loading faster.
Handle.initAsync(function(success:Bool):Void {
Handle.initAsync(function(success:Bool):Void
{
if (success)
{
trace(' HXVLC '.bold().bg_orange() + ' LibVLC instance initialized!');
+1 -6
View File
@@ -36,12 +36,7 @@ class Postbuild
static function format(time:Float, decimals:Int = 1):String
{
var units = [
{name: "day", secs: 86400},
{name: "hour", secs: 3600},
{name: "minute", secs: 60},
{name: "second", secs: 1}
];
var units = [{name: "day", secs: 86400}, {name: "hour", secs: 3600}, {name: "minute", secs: 60}, {name: "second", secs: 1}];
var parts:Array<String> = [];
var remaining:Float = time;
+11 -20
View File
@@ -89,44 +89,35 @@ extern class Native_TracyProfiler
class Cppia_TracyProfiler
{
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.frameMark)
public static function frameMark()
Native_TracyProfiler.frameMark();
public static function frameMark() Native_TracyProfiler.frameMark();
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.frameMarkNamed)
public static function frameMarkNamed(_name:String)
Native_TracyProfiler.frameMarkNamed(_name);
public static function frameMarkNamed(_name:String) Native_TracyProfiler.frameMarkNamed(_name);
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.frameMarkStart)
public static function frameMarkStart(_name:String)
Native_TracyProfiler.frameMarkStart(_name);
public static function frameMarkStart(_name:String) Native_TracyProfiler.frameMarkStart(_name);
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.frameMarkEnd)
public static function frameMarkEnd(_name:String)
Native_TracyProfiler.frameMarkEnd(_name);
public static function frameMarkEnd(_name:String) Native_TracyProfiler.frameMarkEnd(_name);
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.message)
public static function message(_msg:String, ?_color:Int = 0x000000)
Native_TracyProfiler.message(_msg, _color);
public static function message(_msg:String, ?_color:Int = 0x000000) Native_TracyProfiler.message(_msg, _color);
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.messageAppInfo)
public static function messageAppInfo(_info:String)
Native_TracyProfiler.messageAppInfo(_info);
public static function messageAppInfo(_info:String) Native_TracyProfiler.messageAppInfo(_info);
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.plot)
public static function plot(_name:String, _val:Float)
Native_TracyProfiler.plot(_name, _val);
public static function plot(_name:String, _val:Float) Native_TracyProfiler.plot(_name, _val);
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.plotConfig)
public static function plotConfig(_name:String, _format:PlotFormatType, ?_step:Bool = false, ?_fill:Bool = false, ?_color:Int = 0x000000)
Native_TracyProfiler.plotConfig(_name, _format, _step, _fill, _color);
public static function plotConfig(_name:String, _format:PlotFormatType, ?_step:Bool = false, ?_fill:Bool = false,
?_color:Int = 0x000000) Native_TracyProfiler.plotConfig(_name, _format, _step, _fill, _color);
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.setThreadName)
public static function setThreadName(_name:String, ?_groupHint:Int = 1)
Native_TracyProfiler.setThreadName(_name, _groupHint);
public static function setThreadName(_name:String, ?_groupHint:Int = 1) Native_TracyProfiler.setThreadName(_name, _groupHint);
@:inheritDoc(cpp.vm.tracy.Native_TracyProfiler.zoneScoped)
public static function zoneScoped(_name:String)
Native_TracyProfiler.zoneScoped(_name);
public static function zoneScoped(_name:String) Native_TracyProfiler.zoneScoped(_name);
}
typedef TracyProfiler = Cppia_TracyProfiler;
+3 -1
View File
@@ -381,7 +381,9 @@ class Conductor
/**
* The constructor.
*/
public function new() {}
public function new()
{
}
/**
* Forcibly defines the current BPM of the song.
+1 -2
View File
@@ -49,8 +49,7 @@ abstract Tallies(RawTallies)
{
public function new()
{
this =
{
this = {
combo: 0,
missed: 0,
shit: 0,
+23 -22
View File
@@ -188,7 +188,8 @@ class InitState extends FlxState
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1), tileData,
new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
FlxG.signals.gameResized.add(function(width:Int, height:Int) {
FlxG.signals.gameResized.add(function(width:Int, height:Int)
{
FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), tileData,
new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1), tileData,
@@ -199,10 +200,12 @@ class InitState extends FlxState
// Since we don't really need VSync on Android we're gonna forcefully disable it on these signals for now
// This is fixed on SDL3 from what I've heared but that doodoo isn't working poperly for Android
#if android
FlxG.signals.focusLost.add(function() {
FlxG.signals.focusLost.add(function()
{
WindowUtil.setVSyncMode(lime.ui.WindowVSyncMode.OFF);
});
FlxG.signals.focusGained.add(function() {
FlxG.signals.focusGained.add(function()
{
WindowUtil.setVSyncMode(lime.ui.WindowVSyncMode.OFF);
});
#end
@@ -220,7 +223,8 @@ class InitState extends FlxState
#if FEATURE_DISCORD_RPC
DiscordClient.instance.init();
lime.app.Application.current.onExit.add(function(exitCode) {
lime.app.Application.current.onExit.add(function(exitCode)
{
DiscordClient.instance.shutdown();
});
#end
@@ -362,19 +366,16 @@ class InitState extends FlxState
FlxG.switchState(() -> new funkin.ui.debug.stage.StageBuilderState());
#elseif RESULTS
// -DRESULTS
FlxG.switchState(() -> new funkin.play.ResultState(
{
FlxG.switchState(() -> new funkin.play.ResultState({
storyMode: true,
title: "Cum Song Erect by Kawai Sprite",
songId: "cum",
characterId: "pico",
difficultyId: "hard",
isNewHighscore: true,
scoreData:
{
scoreData: {
score: 1_234_567,
tallies:
{
tallies: {
sick: 130,
good: 60,
bad: 69,
@@ -415,8 +416,7 @@ class InitState extends FlxState
if (params.chart.shouldLoadChart)
{
#if FEATURE_CHART_EDITOR
FlxG.switchState(() -> new ChartEditorState(
{
FlxG.switchState(() -> new ChartEditorState({
fnfcTargetPath: params.chart.chartPath,
}));
#else
@@ -426,8 +426,7 @@ class InitState extends FlxState
else if (params.stage.shouldLoadStage)
{
#if FEATURE_STAGE_EDITOR
FlxG.switchState(() -> new StageEditorState(
{
FlxG.switchState(() -> new StageEditorState({
fnfsTargetPath: params.stage.stagePath,
}));
#else
@@ -446,7 +445,8 @@ class InitState extends FlxState
{
// FlxG.sound.cache(Paths.music('freakyMenu/freakyMenu'));
#if mobile
funkin.mobile.util.FNFCUtil.onFNFCOpen.add(function(fnfcFile:String) {
funkin.mobile.util.FNFCUtil.onFNFCOpen.add(function(fnfcFile:String)
{
flixel.tweens.FlxTween.globalManager.clear();
flixel.util.FlxTimer.globalManager.clear();
@:nullSafety(Off)
@@ -520,8 +520,7 @@ class InitState extends FlxState
}
@:nullSafety(Off) // Cannot unify?
LoadingState.loadPlayState(
{
LoadingState.loadPlayState({
targetSong: songData,
targetDifficulty: difficultyId,
});
@@ -563,8 +562,7 @@ class InitState extends FlxState
}
@:nullSafety(Off)
LoadingState.loadPlayState(
{
LoadingState.loadPlayState({
targetSong: targetSong,
targetDifficulty: difficultyId,
});
@@ -595,7 +593,8 @@ class InitState extends FlxState
// Adds a red button to the debugger.
// This pauses the game AND the music! This ensures the Conductor stops.
FlxG.debugger.addButton(CENTER, new BitmapData(20, 20, true, 0xFFCC2233), function() {
FlxG.debugger.addButton(CENTER, new BitmapData(20, 20, true, 0xFFCC2233), function()
{
if (FlxG.vcr.paused)
{
FlxG.vcr.resume();
@@ -622,7 +621,8 @@ class InitState extends FlxState
// Adds a blue button to the debugger.
// This skips forward in the song.
FlxG.debugger.addButton(CENTER, new BitmapData(20, 20, true, 0xFF2222CC), function() {
FlxG.debugger.addButton(CENTER, new BitmapData(20, 20, true, 0xFF2222CC), function()
{
FlxG.game.debugger.vcr.onStep();
for (snd in FlxG.sound.list)
@@ -639,7 +639,8 @@ class InitState extends FlxState
// This big obnoxious white button is for MOBILE, so that you can press it
// easily with your finger when debug bullshit pops up during testing lol!
#if mobile
FlxG.debugger.addButton(LEFT, new BitmapData(200, 200), function() {
FlxG.debugger.addButton(LEFT, new BitmapData(200, 200), function()
{
FlxG.debugger.visible = false;
// Make errors and warnings less annoying.
+1 -2
View File
@@ -193,8 +193,7 @@ class Paths implements ConsoleClass
graphicKey = Paths.animateAtlas(key);
}
var validatedSettings:AtlasSpriteSettings =
{
var validatedSettings:AtlasSpriteSettings = {
swfMode: settings?.swfMode ?? false,
cacheOnLoad: settings?.cacheOnLoad ?? false,
filterQuality: settings?.filterQuality ?? MEDIUM,
+2 -1
View File
@@ -384,7 +384,8 @@ class Preferences
{
var currTime = Date.now().getTime();
var timeToCall = 0;
var id = js.Browser.window.setTimeout(function() {
var id = js.Browser.window.setTimeout(function()
{
callback(currTime + timeToCall);
}, timeToCall);
return id;
+4 -2
View File
@@ -51,7 +51,8 @@ class Leaderboards
var leaderboardData:Null<LeaderboardData> = listLeaderboardData().get(leaderboard.getId());
if (leaderboardData != null)
{
leaderboardData.postScore(score, function(outcome:Outcome<CallError>):Void {
leaderboardData.postScore(score, function(outcome:Outcome<CallError>):Void
{
switch (outcome)
{
case SUCCESS:
@@ -82,7 +83,8 @@ class Leaderboards
if ((params?.useCurrentUser ?? false) && NewgroundsClient.instance.isLoggedIn()) user = NewgroundsClient.instance.user;
leaderboardData.requestScores(params?.limit ?? 10, params?.skip ?? 0, params?.period ?? ALL, params?.social ?? false, params?.tag, user,
function(outcome:Outcome<CallError>):Void {
function(outcome:Outcome<CallError>):Void
{
switch (outcome)
{
case SUCCESS:
+6 -24
View File
@@ -58,7 +58,8 @@ class Medals
// Play the medal unlock animation, but only if the user has not already unlocked it.
#if html5
// Web builds support parsing the bitmap data from the URL directly.
BitmapData.loadFromFile("https:" + medalData.icon).onComplete(function(bmp:BitmapData) {
BitmapData.loadFromFile("https:" + medalData.icon).onComplete(function(bmp:BitmapData)
{
var medalGraphic = FlxGraphic.fromBitmapData(bmp);
medalGraphic.persist = true;
NewgroundsMedalPlugin.play(medalData.value, medalData.name, medalGraphic);
@@ -68,7 +69,8 @@ class Medals
// We have to use a medal image from the game files. We use a Base64 encoded image that NG spits out.
// TODO: Wait, don't they give us the medal icon?
var localMedalData:Null<MedalJSON> = medalJSON.filter(function(jsonMedal) {
var localMedalData:Null<MedalJSON> = medalJSON.filter(function(jsonMedal)
{
#if FEATURE_NEWGROUNDS_TESTING_MEDALS
return medal == jsonMedal.idTest;
#else
@@ -436,27 +438,7 @@ enum abstract Medal(Int) from Int to Int
*/
public static function getAllMedals():Array<Medal>
{
return [
StartGame,
StoryTutorial,
StoryWeek1,
StoryWeek2,
StoryWeek3,
StoryWeek4,
StoryWeek5,
StoryWeek6,
StoryWeek7,
StoryWeekend1,
CharSelect,
FreeplayPicoMix,
FreeplayStressPico,
LossRating,
PerfectRatingHard,
GoldPerfectRatingHard,
ErectDifficulty,
GoldPerfectRatingNightmare,
FridayNight,
Nice
];
return
[StartGame, StoryTutorial, StoryWeek1, StoryWeek2, StoryWeek3, StoryWeek4, StoryWeek5, StoryWeek6, StoryWeek7, StoryWeekend1, CharSelect, FreeplayPicoMix, FreeplayStressPico, LossRating, PerfectRatingHard, GoldPerfectRatingHard, ErectDifficulty, GoldPerfectRatingNightmare, FridayNight, Nice];
}
}
+6 -3
View File
@@ -58,7 +58,8 @@ class NGSaveSlot
try
{
ngSaveSlot?.save(encodedData, function(outcome:Outcome<CallError>) {
ngSaveSlot?.save(encodedData, function(outcome:Outcome<CallError>)
{
switch (outcome)
{
case SUCCESS:
@@ -80,7 +81,8 @@ class NGSaveSlot
{
try
{
ngSaveSlot?.load(function(outcome:SaveSlotOutcome):Void {
ngSaveSlot?.load(function(outcome:SaveSlotOutcome):Void
{
switch (outcome)
{
case SUCCESS(value):
@@ -122,7 +124,8 @@ class NGSaveSlot
{
try
{
ngSaveSlot?.clear(function(outcome:Outcome<CallError>) {
ngSaveSlot?.clear(function(outcome:Outcome<CallError>)
{
switch (outcome)
{
case SUCCESS:
@@ -113,14 +113,16 @@ class NewgroundsClient
return;
}
var passportHandler:String->Void = function(passportUrl:String) {
var passportHandler:String->Void = function(passportUrl:String)
{
// This exists so we can create a popup on mobile but with a WebView instead.
#if FEATURE_MOBILE_WEBVIEW
if (passportUrl != null)
{
NG.core.logVerbose('Loading passport from WebView: ${passportUrl}');
WebViewUtil.openURL(passportUrl, function():Void {
WebViewUtil.openURL(passportUrl, function():Void
{
NG.core.cancelLoginRequest();
});
@@ -151,7 +153,8 @@ class NewgroundsClient
return;
}
var dummyPassport:String->Void = function(_) {
var dummyPassport:String->Void = function(_)
{
// just a dummy passport, so we don't create a popup
// otherwise `NG.core.requestLogin()` will automatically attempt to open a tab at the beginning of the game
// users should go to the Options Menu to login to NG
+2 -1
View File
@@ -23,7 +23,8 @@ class Referral
{
NG.core?.calls.loader.loadReferral(false)
.addComponentParameter("referral_name", referralName)
.addResponseHandler(response -> {
.addResponseHandler(response ->
{
trace(response);
if (response.success)
{
+8 -4
View File
@@ -42,7 +42,8 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
if (_onVolumeChanged == null)
{
_onVolumeChanged = new FlxTypedSignal<Float->Void>();
FlxG.sound.onVolumeChange.add(function(volume:Float) {
FlxG.sound.onVolumeChange.add(function(volume:Float)
{
_onVolumeChanged.dispatch(volume);
});
}
@@ -350,7 +351,8 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
partialQueue.push(music);
@:nullSafety(Off)
music.future.onComplete(function(partialMusic:Null<FunkinSound>) {
music.future.onComplete(function(partialMusic:Null<FunkinSound>)
{
FlxG.sound.music = partialMusic;
FlxG.sound.list.remove(FlxG.sound.music);
@@ -496,11 +498,13 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
}
else
{
promise.future.onError(function(e) {
promise.future.onError(function(e)
{
soundRequest.error("Sound loading was errored or cancelled");
});
soundRequest.future.onComplete(function(partialSound) {
soundRequest.future.onComplete(function(partialSound)
{
var snd = FunkinSound.load(partialSound, volume, looped, autoDestroy, autoPlay, false, onComplete, onLoad);
promise.complete(snd);
});
+27 -13
View File
@@ -58,7 +58,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
{
var error:Float = 0;
forEachAlive(function(snd) {
forEachAlive(function(snd)
{
if (targetTime == null) targetTime = snd.time;
else
{
@@ -85,7 +86,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
// result.pause();
result.time = this.time;
result.onComplete = function() {
result.onComplete = function()
{
this.onComplete();
}
@@ -96,14 +98,17 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
return result;
}
public dynamic function onComplete():Void {}
public dynamic function onComplete():Void
{
}
/**
* Pause all the sounds in the group.
*/
public function pause()
{
forEachAlive(function(sound:FunkinSound) {
forEachAlive(function(sound:FunkinSound)
{
sound.pause();
});
}
@@ -113,7 +118,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
*/
public function play(forceRestart:Bool = false, startTime:Float = 0.0, ?endTime:Float)
{
forEachAlive(function(sound:FunkinSound) {
forEachAlive(function(sound:FunkinSound)
{
if (sound.length < startTime)
{
// trace('Queuing sound (${sound.toString()} past its length! Skipping...)');
@@ -128,7 +134,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
*/
public function resume()
{
forEachAlive(function(sound:FunkinSound) {
forEachAlive(function(sound:FunkinSound)
{
sound.resume();
});
}
@@ -139,7 +146,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
@:nullSafety(Off)
public function fadeIn(duration:Float, ?from:Float = 0.0, ?to:Float = 1.0, ?onComplete:FlxTween->Void):Void
{
forEachAlive(function(sound:FunkinSound) {
forEachAlive(function(sound:FunkinSound)
{
sound.fadeIn(duration, from, to, onComplete);
});
}
@@ -150,7 +158,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
@:nullSafety(Off)
public function fadeOut(duration:Float, ?to:Float = 0.0, ?onComplete:FlxTween->Void):Void
{
forEachAlive(function(sound:FunkinSound) {
forEachAlive(function(sound:FunkinSound)
{
sound.fadeOut(duration, to, onComplete);
});
}
@@ -162,7 +171,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
{
if (members != null)
{
forEachAlive(function(sound:FunkinSound) {
forEachAlive(function(sound:FunkinSound)
{
sound.stop();
});
}
@@ -198,7 +208,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
function set_time(time:Float):Float
{
forEachAlive(function(snd:FunkinSound) {
forEachAlive(function(snd:FunkinSound)
{
// account for different offsets per sound?
snd.time = time;
});
@@ -233,7 +244,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
// in PlayState, adjust the code so that it only mutes the player1 vocal tracks?
function set_volume(volume:Float):Float
{
forEachAlive(function(snd:FunkinSound) {
forEachAlive(function(snd:FunkinSound)
{
snd.volume = volume;
});
@@ -249,7 +261,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
function set_muted(muted:Bool):Bool
{
forEachAlive(function(snd:FunkinSound) {
forEachAlive(function(snd:FunkinSound)
{
snd.muted = muted;
});
@@ -269,7 +282,8 @@ class SoundGroup extends FlxTypedGroup<FunkinSound>
{
#if FLX_PITCH
trace('Setting audio pitch to ' + val);
forEachAlive(function(snd:FunkinSound) {
forEachAlive(function(snd:FunkinSound)
{
snd.pitch = val;
});
#end
+14 -7
View File
@@ -47,7 +47,8 @@ class VoicesGroup extends SoundGroup
function set_playerVolume(volume:Float):Float
{
playerVoices?.forEachAlive(function(voice:FunkinSound) {
playerVoices?.forEachAlive(function(voice:FunkinSound)
{
voice.volume = volume;
});
return playerVolume = volume;
@@ -55,15 +56,18 @@ class VoicesGroup extends SoundGroup
override function set_time(time:Float):Float
{
forEachAlive(function(snd) {
forEachAlive(function(snd)
{
// account for different offsets per sound?
snd.time = time;
});
playerVoices?.forEachAlive(function(voice:FunkinSound) {
playerVoices?.forEachAlive(function(voice:FunkinSound)
{
voice.time -= playerVoicesOffset;
});
opponentVoices?.forEachAlive(function(voice:FunkinSound) {
opponentVoices?.forEachAlive(function(voice:FunkinSound)
{
voice.time -= opponentVoicesOffset;
});
@@ -72,7 +76,8 @@ class VoicesGroup extends SoundGroup
function set_playerVoicesOffset(offset:Float):Float
{
playerVoices?.forEachAlive(function(voice:FunkinSound) {
playerVoices?.forEachAlive(function(voice:FunkinSound)
{
voice.time += playerVoicesOffset;
voice.time -= offset;
});
@@ -81,7 +86,8 @@ class VoicesGroup extends SoundGroup
function set_opponentVoicesOffset(offset:Float):Float
{
opponentVoices?.forEachAlive(function(voice:FunkinSound) {
opponentVoices?.forEachAlive(function(voice:FunkinSound)
{
voice.time += opponentVoicesOffset;
voice.time -= offset;
});
@@ -99,7 +105,8 @@ class VoicesGroup extends SoundGroup
function set_opponentVolume(volume:Float):Float
{
opponentVoices?.forEachAlive(function(voice:FunkinSound) {
opponentVoices?.forEachAlive(function(voice:FunkinSound)
{
voice.volume = volume;
});
return opponentVolume = volume;
@@ -69,7 +69,8 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
default:
}
forEach(spr -> {
forEach(spr ->
{
spr.visible = spr.ID % wavOptimiz == 0;
});
+5 -6
View File
@@ -40,7 +40,8 @@ class VisShit
// helpers, note that spectrum indexes suppose non-negative frequencies
final binSize = fs / fftN;
final indexToFreq = function(k:Int) {
final indexToFreq = function(k:Int)
{
var powShit:Float = FlxMath.remapToRange(k, 0, halfN, 0, MathUtil.logBase(10, halfN)); // 4.3 is almost the log of 20Khz or so. Close enuf lol
return 1.0 * (Math.pow(10, powShit)); // we need the `1.0` to avoid overflows
@@ -49,7 +50,8 @@ class VisShit
// "melodic" band-pass filter
final minFreq = 20.70;
final maxFreq = 4000.01;
final melodicBandPass = function(k:Int, s:Float) {
final melodicBandPass = function(k:Int, s:Float)
{
final freq = indexToFreq(k);
final filter = freq > minFreq - binSize && freq < maxFreq + binSize ? 1 : 0;
return s;
@@ -62,10 +64,7 @@ class VisShit
while (c < samples.length)
{
// take a chunk (zero-padded if needed) and apply the window
final chunk = [
for (n in 0...fftN)
(c + n < samples.length ? samples[c + n] : 0.0) * window(n)
];
final chunk = [for (n in 0...fftN) (c + n < samples.length ? samples[c + n] : 0.0) * window(n)];
// compute positive spectrum with sampling correction and BP filter
final freqs = FFT.rfft(chunk).map(z -> z.scale(1 / fftN).magnitude).mapi(melodicBandPass);
+11 -22
View File
@@ -10,58 +10,48 @@ abstract Complex({
final imag:Float;
})
{
public inline function new(real:Float, imag:Float)
this = {real: real, imag: imag};
public inline function new(real:Float, imag:Float) this = {real: real, imag: imag};
/**
Makes a Complex number with the given Float as its real part and a zero imag part.
**/
@:from
public static inline function fromReal(r:Float)
return new Complex(r, 0);
public static inline function fromReal(r:Float) return new Complex(r, 0);
/**
Complex argument, in radians.
**/
public var angle(get, never):Float;
inline function get_angle()
return Math.atan2(this.imag, this.real);
inline function get_angle() return Math.atan2(this.imag, this.real);
/**
Complex module.
**/
public var magnitude(get, never):Float;
inline function get_magnitude()
return Math.sqrt(this.real * this.real + this.imag * this.imag);
inline function get_magnitude() return Math.sqrt(this.real * this.real + this.imag * this.imag);
@:op(A + B)
public inline function add(rhs:Complex):Complex
return new Complex(this.real + rhs.real, this.imag + rhs.imag);
public inline function add(rhs:Complex):Complex return new Complex(this.real + rhs.real, this.imag + rhs.imag);
@:op(A - B)
public inline function sub(rhs:Complex):Complex
return new Complex(this.real - rhs.real, this.imag - rhs.imag);
public inline function sub(rhs:Complex):Complex return new Complex(this.real - rhs.real, this.imag - rhs.imag);
@:op(A * B)
public inline function mult(rhs:Complex):Complex
return new Complex(this.real * rhs.real - this.imag * rhs.imag, this.real * rhs.imag + this.imag * rhs.real);
public inline function mult(rhs:Complex):Complex return new Complex(this.real * rhs.real - this.imag * rhs.imag, this.real * rhs.imag + this.imag * rhs.real);
/**
Returns the complex conjugate, does not modify this object.
**/
public inline function conj():Complex
return new Complex(this.real, -this.imag);
public inline function conj():Complex return new Complex(this.real, -this.imag);
/**
Multiplication by a real factor, does not modify this object.
**/
public inline function scale(k:Float):Complex
return new Complex(this.real * k, this.imag * k);
public inline function scale(k:Float):Complex return new Complex(this.real * k, this.imag * k);
public inline function copy():Complex
return new Complex(this.real, this.imag);
public inline function copy():Complex return new Complex(this.real, this.imag);
/**
The imaginary unit.
@@ -76,6 +66,5 @@ abstract Complex({
/**
Computes the complex exponential `e^(iw)`.
**/
public static inline function exp(w:Float)
return new Complex(Math.cos(w), Math.sin(w));
public static inline function exp(w:Float) return new Complex(Math.cos(w), Math.sin(w));
}
+2 -4
View File
@@ -19,8 +19,7 @@ class FFT
samples from the Discrete-Time Fourier Transform (DTFT) - which is Fs-periodic -
with a spacing of Fs/N Hz between them and a scaling factor of Fs.
**/
public static function fft(input:Array<Complex>):Array<Complex>
return do_fft(input, false);
public static function fft(input:Array<Complex>):Array<Complex> return do_fft(input, false);
/**
Like `fft`, but for a real (Float) sequence input.
@@ -41,8 +40,7 @@ class FFT
from each other, the result will consist of N data points as sampled
from a time signal at intervals of 1/Fs with a scaling factor of 1/Fs.
**/
public static function ifft(input:Array<Complex>):Array<Complex>
return do_fft(input, true);
public static function ifft(input:Array<Complex>):Array<Complex> return do_fft(input, true);
// Handles padding and scaling for forwards and inverse FFTs.
static function do_fft(input:Array<Complex>, inverse:Bool):Array<Complex>
@@ -12,35 +12,28 @@ abstract OffsetArray<T>({
final offset:Int;
})
{
public inline function new(array:Array<T>, offset:Int)
this = {array: array, offset: offset};
public inline function new(array:Array<T>, offset:Int) this = {array: array, offset: offset};
public var length(get, never):Int;
inline function get_length()
return this.array.length;
inline function get_length() return this.array.length;
@:arrayAccess
public inline function get(index:Int):T
return this.array[index - this.offset];
public inline function get(index:Int):T return this.array[index - this.offset];
@:arrayAccess
public inline function set(index:Int, value:T):Void
this.array[index - this.offset] = value;
public inline function set(index:Int, value:T):Void this.array[index - this.offset] = value;
/**
Iterates through items in their original order while providing the altered indexes as keys.
**/
public inline function keyValueIterator():KeyValueIterator<Int, T>
return new OffsetArrayIterator(this.array, this.offset);
public inline function keyValueIterator():KeyValueIterator<Int, T> return new OffsetArrayIterator(this.array, this.offset);
@:from
static inline function fromArray<T>(array:Array<T>)
return new OffsetArray(array, 0);
static inline function fromArray<T>(array:Array<T>) return new OffsetArray(array, 0);
@:to
inline function toArray()
return this.array;
inline function toArray() return this.array;
/**
Makes a shifted version of the given `array`, where elements are in the
@@ -76,12 +69,12 @@ private class OffsetArrayIterator<T>
this.enumeration = 0;
}
public inline function next():{key:Int, value:T}
public inline function next():
{key:Int, value:T}
{
final i = this.enumeration++;
return {key: i + this.offset, value: this.array[i]};
}
public inline function hasNext():Bool
return this.enumeration < this.array.length;
public inline function hasNext():Bool return this.enumeration < this.array.length;
}
+5 -10
View File
@@ -86,30 +86,25 @@ class Signal
/**
Returns the average value of an array.
**/
public static function mean(y:Array<Float>):Float
return sum(y) / y.length;
public static function mean(y:Array<Float>):Float return sum(y) / y.length;
/**
Returns the global maximum.
**/
public static function max(y:Array<Float>):Float
return y.fold(Math.max, y[0]);
public static function max(y:Array<Float>):Float return y.fold(Math.max, y[0]);
/**
Returns the global maximum's index.
**/
public static function maxi(y:Array<Float>):Int
return y.foldi((yi, m, i) -> yi > y[m] ? i : m, 0);
public static function maxi(y:Array<Float>):Int return y.foldi((yi, m, i) -> yi > y[m] ? i : m, 0);
/**
Returns the global minimum.
**/
public static function min(y:Array<Float>):Float
return y.fold(Math.min, y[0]);
public static function min(y:Array<Float>):Float return y.fold(Math.min, y[0]);
/**
Returns the global minimum's index.
**/
public static function mini(y:Array<Float>):Int
return y.foldi((yi, m, i) -> yi < y[m] ? i : m, 0);
public static function mini(y:Array<Float>):Int return y.foldi((yi, m, i) -> yi < y[m] ? i : m, 0);
}
+2 -1
View File
@@ -109,7 +109,8 @@ abstract class BaseRegistry<T:(IRegistryEntry<J> & Constructible<EntryConstructo
// UNSCRIPTED ENTRIES
//
var entryIdList:Array<String> = DataAssets.listDataFilesInPath('${dataFilePath}/');
var unscriptedEntryIds:Array<String> = entryIdList.filter(function(entryId:String):Bool {
var unscriptedEntryIds:Array<String> = entryIdList.filter(function(entryId:String):Bool
{
return !entries.exists(entryId);
});
log(' INFO '.info() + 'Parsing ${unscriptedEntryIds.length} unscripted entries...');
+1 -2
View File
@@ -243,8 +243,7 @@ class DataParse
switch (json.value)
{
case JObject(fields):
var result:LegacyNoteSection =
{
var result:LegacyNoteSection = {
mustHitSection: false,
sectionNotes: [],
};
+3 -1
View File
@@ -6,4 +6,6 @@ package funkin.data;
* @see `funkin.data.BaseRegistry`
*/
@:autoBuild(funkin.util.macro.RegistryMacro.buildRegistry())
interface DefaultRegistryImpl {}
interface DefaultRegistryImpl
{
}
@@ -57,7 +57,8 @@ class CharacterDataParser
// UNSCRIPTED CHARACTERS
//
var charIdList:Array<String> = DataAssets.listDataFilesInPath('characters/');
var unscriptedCharIds:Array<String> = charIdList.filter(function(charId:String):Bool {
var unscriptedCharIds:Array<String> = charIdList.filter(function(charId:String):Bool
{
return !characterCache.exists(charId);
});
log('Fetching data for ${unscriptedCharIds.length} characters...');
@@ -188,7 +189,8 @@ class CharacterDataParser
// NOTE: Only instantiate the ones not populated above.
// ScriptedBaseCharacter.listScriptClasses() will pick up scripts extending the other classes.
var scriptedCharClassNames:Array<String> = ScriptedBaseCharacter.listScriptClasses();
scriptedCharClassNames = scriptedCharClassNames.filter(function(charCls:String):Bool {
scriptedCharClassNames = scriptedCharClassNames.filter(function(charCls:String):Bool
{
return !(scriptedCharClassNames1.contains(charCls)
|| scriptedCharClassNames2.contains(charCls)
|| scriptedCharClassNames3.contains(charCls)
@@ -353,7 +355,8 @@ class CharacterDataParser
{
var frames = Paths.getSparrowAtlas(charPath);
var idleFrame:Null<FlxFrame> = frames.frames.find(function(frame:FlxFrame):Bool {
var idleFrame:Null<FlxFrame> = frames.frames.find(function(frame:FlxFrame):Bool
{
return frame.name.startsWith('idle');
});
@@ -463,8 +466,7 @@ class CharacterDataParser
public static final DEFAULT_STARTINGANIM:String = 'idle';
public static final DEFAULT_APPLYSTAGEMATRIX:Bool = false;
public static final DEFAULT_ANIMTYPE:String = "framelabel";
public static final DEFAULT_ATLASSETTINGS:funkin.data.stage.StageData.TextureAtlasData =
{
public static final DEFAULT_ATLASSETTINGS:funkin.data.stage.StageData.TextureAtlasData = {
swfMode: true,
cacheOnLoad: false,
filterQuality: 1,
@@ -528,8 +530,7 @@ class CharacterDataParser
if (input.healthIcon == null)
{
input.healthIcon =
{
input.healthIcon = {
id: null,
scale: null,
flipX: null,
@@ -23,4 +23,6 @@ class SpeakerRegistry extends BaseRegistry<Speaker, SpeakerData, SpeakerEntryPar
}
}
typedef SpeakerEntryParams = {}
typedef SpeakerEntryParams =
{
}
@@ -139,7 +139,8 @@ class SongEventRegistry
*/
public static function queryEvents(events:Array<SongEventData>, currentTime:Float):Array<SongEventData>
{
var result:Array<SongEventData> = events.filter(function(event:SongEventData):Bool {
var result:Array<SongEventData> = events.filter(function(event:SongEventData):Bool
{
// If the event is already activated, don't activate it again.
if (event.activated) return false;
@@ -24,4 +24,6 @@ class AlbumRegistry extends BaseRegistry<Album, AlbumData, AlbumEntryParams> imp
}
}
typedef AlbumEntryParams = {}
typedef AlbumEntryParams =
{
}
@@ -169,11 +169,9 @@ class PlayerFreeplayDJData
}
}
public inline function getAssetPath():String
return assetPath; // return assetPath;
public inline function getAssetPath():String return assetPath; // return assetPath;
public inline function getAnimationsList():Array<AnimationData>
return animations;
public inline function getAnimationsList():Array<AnimationData> return animations;
public function useApplyStageMatrix():Bool
{
@@ -148,4 +148,6 @@ class PlayerRegistry extends BaseRegistry<PlayableCharacter, PlayerData, PlayerE
}
}
typedef PlayerEntryParams = {}
typedef PlayerEntryParams =
{
}
@@ -25,4 +25,6 @@ class FreeplayStyleRegistry extends BaseRegistry<FreeplayStyle, FreeplayStyleDat
}
}
typedef FreeplayStyleEntryParams = {}
typedef FreeplayStyleEntryParams =
{
}
+11 -3
View File
@@ -219,9 +219,17 @@ typedef NoteStyleData_Countdown =
var audioPath:String;
}
typedef NoteStyleData_HoldNote = {}
typedef NoteStyleData_Judgement = {}
typedef NoteStyleData_ComboNum = {}
typedef NoteStyleData_HoldNote =
{
}
typedef NoteStyleData_Judgement =
{
}
typedef NoteStyleData_ComboNum =
{
}
/**
* Data on animations for each direction of the strumline.
@@ -31,4 +31,6 @@ class NoteStyleRegistry extends BaseRegistry<NoteStyle, NoteStyleData, NoteStyle
}
}
typedef NoteStyleEntryParams = {}
typedef NoteStyleEntryParams =
{
}
+3 -1
View File
@@ -780,7 +780,9 @@ class SongEventDataRaw implements ICloneable<SongEventDataRaw>
public function valueAsStruct(?defaultKey:String = "key"):Dynamic
{
if (this.value == null) return {};
if (this.value == null) return
{
};
if (Std.isOfType(this.value, Array))
{
var result:haxe.DynamicAccess<Dynamic> = {};
+32 -17
View File
@@ -24,7 +24,8 @@ class SongDataUtils
*/
public static function offsetSongNoteData(notes:Array<SongNoteData>, offset:Float):Array<SongNoteData>
{
var offsetNote = function(note:SongNoteData):SongNoteData {
var offsetNote = function(note:SongNoteData):SongNoteData
{
var time:Float = note.time + offset;
var data:Int = note.data;
var length:Float = note.length;
@@ -46,7 +47,8 @@ class SongDataUtils
*/
public static function offsetSongEventData(events:Array<SongEventData>, offset:Float):Array<SongEventData>
{
return events.map(function(event:SongEventData):SongEventData {
return events.map(function(event:SongEventData):SongEventData
{
return new SongEventData(event.time + offset, event.eventKind, event.value);
});
}
@@ -61,7 +63,8 @@ class SongDataUtils
*/
public static function clampSongNoteData(notes:Array<SongNoteData>, startTime:Float, endTime:Float):Array<SongNoteData>
{
return notes.filter(function(note:SongNoteData):Bool {
return notes.filter(function(note:SongNoteData):Bool
{
return note.time >= startTime && note.time <= endTime;
});
}
@@ -76,7 +79,8 @@ class SongDataUtils
*/
public static function clampSongEventData(events:Array<SongEventData>, startTime:Float, endTime:Float):Array<SongEventData>
{
return events.filter(function(event:SongEventData):Bool {
return events.filter(function(event:SongEventData):Bool
{
return event.time >= startTime && event.time <= endTime;
});
}
@@ -92,7 +96,8 @@ class SongDataUtils
{
if (notes.length == 0 || subtrahend.length == 0) return notes;
var result = notes.filter(function(note:SongNoteData):Bool {
var result = notes.filter(function(note:SongNoteData):Bool
{
for (x in subtrahend)
{
// The currently iterated note is in the subtrahend array.
@@ -117,7 +122,8 @@ class SongDataUtils
{
if (events.length == 0 || subtrahend.length == 0) return events;
return events.filter(function(event:SongEventData):Bool {
return events.filter(function(event:SongEventData):Bool
{
for (x in subtrahend)
{
// The currently iterated event is in the subtrahend array.
@@ -134,7 +140,8 @@ class SongDataUtils
*/
public static function flipNotes(notes:Array<SongNoteData>, strumlineSize:Int = 4):Array<SongNoteData>
{
return notes.map(function(note:SongNoteData):SongNoteData {
return notes.map(function(note:SongNoteData):SongNoteData
{
var newData = note.data;
if (newData < strumlineSize) newData += strumlineSize;
@@ -156,7 +163,6 @@ class SongDataUtils
public static function mirrorNotes(notes:Array<SongNoteData>, strumlineSize:Int = 4, flip:Bool = false, mirrorX:Bool = true,
mirrorY:Bool = true):Array<SongNoteData>
{
var minTime = notes[0].time;
var maxTime = notes[0].time;
var minStrumline = notes[0].data;
@@ -182,7 +188,8 @@ class SongDataUtils
notes = flipNotes(notes);
}
return notes.map(function(note:SongNoteData):SongNoteData {
return notes.map(function(note:SongNoteData):SongNoteData
{
var newData = note.data;
var newTime = note.time;
@@ -232,7 +239,8 @@ class SongDataUtils
public static function sortNotes(notes:Array<SongNoteData>, desc:Bool = false):Array<SongNoteData>
{
// TODO: Modifies the array in place. Is this okay?
notes.sort(function(a:SongNoteData, b:SongNoteData):Int {
notes.sort(function(a:SongNoteData, b:SongNoteData):Int
{
return FlxSort.byValues(desc ? FlxSort.DESCENDING : FlxSort.ASCENDING, a.time, b.time);
});
return notes;
@@ -244,7 +252,8 @@ class SongDataUtils
public static function sortEvents(events:Array<SongEventData>, desc:Bool = false):Array<SongEventData>
{
// TODO: Modifies the array in place. Is this okay?
events.sort(function(a:SongEventData, b:SongEventData):Int {
events.sort(function(a:SongEventData, b:SongEventData):Int
{
return FlxSort.byValues(desc ? FlxSort.DESCENDING : FlxSort.ASCENDING, a.time, b.time);
});
return events;
@@ -256,7 +265,8 @@ class SongDataUtils
public static function sortTimeChanges(timeChanges:Array<SongTimeChange>, desc:Bool = false):Array<SongTimeChange>
{
// TODO: Modifies the array in place. Is this okay?
timeChanges.sort(function(a:SongTimeChange, b:SongTimeChange):Int {
timeChanges.sort(function(a:SongTimeChange, b:SongTimeChange):Int
{
return FlxSort.byValues(desc ? FlxSort.DESCENDING : FlxSort.ASCENDING, a.timeStamp, b.timeStamp);
});
return timeChanges;
@@ -313,7 +323,8 @@ class SongDataUtils
*/
public static function getNotesInTimeRange(notes:Array<SongNoteData>, start:Float, end:Float):Array<SongNoteData>
{
return notes.filter(function(note:SongNoteData):Bool {
return notes.filter(function(note:SongNoteData):Bool
{
return note.time >= start && note.time <= end;
});
}
@@ -323,7 +334,8 @@ class SongDataUtils
*/
public static function getEventsInTimeRange(events:Array<SongEventData>, start:Float, end:Float):Array<SongEventData>
{
return events.filter(function(event:SongEventData):Bool {
return events.filter(function(event:SongEventData):Bool
{
return event.time >= start && event.time <= end;
});
}
@@ -333,7 +345,8 @@ class SongDataUtils
*/
public static function getNotesInDataRange(notes:Array<SongNoteData>, start:Int, end:Int):Array<SongNoteData>
{
return notes.filter(function(note:SongNoteData):Bool {
return notes.filter(function(note:SongNoteData):Bool
{
return note.data >= start && note.data <= end;
});
}
@@ -343,7 +356,8 @@ class SongDataUtils
*/
public static function getNotesWithData(notes:Array<SongNoteData>, data:Array<Int>):Array<SongNoteData>
{
return notes.filter(function(note:SongNoteData):Bool {
return notes.filter(function(note:SongNoteData):Bool
{
return data.indexOf(note.data) != -1;
});
}
@@ -353,7 +367,8 @@ class SongDataUtils
*/
public static function getEventsWithKind(events:Array<SongEventData>, kinds:Array<String>):Array<SongEventData>
{
return events.filter(function(event:SongEventData):Bool {
return events.filter(function(event:SongEventData):Bool
{
return kinds.indexOf(event.eventKind) != -1;
});
}
+4 -2
View File
@@ -85,10 +85,12 @@ using funkin.data.song.migrator.SongDataMigrator;
//
// UNSCRIPTED ENTRIES
//
var entryIdList:Array<String> = DataAssets.listDataFilesInPath('songs/', '-metadata.json').map(function(songDataPath:String):String {
var entryIdList:Array<String> = DataAssets.listDataFilesInPath('songs/', '-metadata.json').map(function(songDataPath:String):String
{
return songDataPath.split('/')[0];
});
var unscriptedEntryIds:Array<String> = entryIdList.filter(function(entryId:String):Bool {
var unscriptedEntryIds:Array<String> = entryIdList.filter(function(entryId:String):Bool
{
return !entries.exists(entryId);
});
log('Parsing ${unscriptedEntryIds.length} unscripted entries...');
@@ -27,7 +27,9 @@ class LegacySongData
public var notes:Either<Array<LegacyNoteSection>, LegacyNoteData>;
public var song:String; // Song name
public function new() {}
public function new()
{
}
public function toString():String
{
@@ -31,7 +31,8 @@ class OsuManiaImporter
currentSection = sectionRegex.matched(1);
if (nonCSVLikeSections.contains(currentSection))
{
Reflect.setField(result, currentSection, {});
Reflect.setField(result, currentSection, {
});
}
else
{
@@ -46,7 +47,8 @@ class OsuManiaImporter
var parts:Array<String> = line.split(":");
var key:String = StringTools.trim(parts.shift());
var value:String = StringTools.trim(parts.join(":"));
if (Reflect.field(result, currentSection) == null) Reflect.setField(result, currentSection, {});
if (Reflect.field(result, currentSection) == null) Reflect.setField(result, currentSection, {
});
Reflect.setField(Reflect.field(result, currentSection), key, value);
}
// For CSV-like sections
@@ -163,7 +165,8 @@ class OsuManiaImporter
static function parseTimingPoints(timingLines:Array<String>):Array<TimingPoint>
{
return timingLines.map(function(line:String):TimingPoint {
return timingLines.map(function(line:String):TimingPoint
{
var parts = line.split(",");
var time = Std.parseFloat(parts[0]);
var beatLength = Std.parseFloat(parts[1]);
@@ -180,7 +183,8 @@ class OsuManiaImporter
static function parseManiaHitObjects(hitObjectsLines:Array<String>, ?columns:Int = 4):Array<ManiaHitObject>
{
return hitObjectsLines.map(function(line:String):ManiaHitObject {
return hitObjectsLines.map(function(line:String):ManiaHitObject
{
var parts = line.split(",");
var x:Int = Std.parseInt(parts[0]);
@@ -10,7 +10,6 @@ typedef StepManiaData =
var Credit:String;
var Banner:String;
var Background:String;
var Offset:Float;
var SampleStart:Float;
};
@@ -19,13 +18,15 @@ typedef StepManiaData =
var Difficulties:Array<StepDifficulty>;
}
enum StepManiaChartType {
enum StepManiaChartType
{
DanceSingle;
DanceDouble;
Unknown;
}
enum StepManiaNoteType {
enum StepManiaNoteType
{
Tap;
Head;
Tail;
@@ -44,7 +45,8 @@ class StepNote
{
this.beat = beat;
this.column = column;
switch (t) {
switch (t)
{
case "2":
this.type = StepManiaNoteType.Head;
case "3":
@@ -72,7 +74,8 @@ class StepDifficulty
public function parseChartType(chartTypeStr:String):StepManiaChartType
{
switch (chartTypeStr) {
switch (chartTypeStr)
{
case "dance-single":
return StepManiaChartType.DanceSingle;
case "dance-double":
@@ -5,7 +5,6 @@ import funkin.data.song.SongData.SongChartData;
import funkin.data.song.SongData.SongCharacterData;
import funkin.data.song.SongData.SongNoteData;
import funkin.data.song.SongData.SongTimeChange;
import funkin.data.song.importer.StepManiaData.StepTimingPoint;
import funkin.data.song.importer.StepManiaData.StepDifficulty;
import funkin.data.song.importer.StepManiaData.StepManiaChartType;
@@ -223,7 +222,6 @@ class StepManiaImporter
tp.endTimestamp = tp.startTimestamp;
tpIndex++;
}
}
}
else
@@ -430,7 +428,6 @@ class StepManiaImporter
measure.push(line);
}
}
}
if (workingDiff != null && workingDiff.notes.length > 0)
@@ -484,8 +481,8 @@ class StepManiaImporter
return (time * 1000) - (offset * 1000); // convert to ms
}
static function convertStepNotes(offset:Float, type:StepManiaChartType, stepNotes:Array<StepNote>,
stepTimingPoints:Array<StepTimingPoint>, stepStops:Array<StepStop>):Array<SongNoteData>
static function convertStepNotes(offset:Float, type:StepManiaChartType, stepNotes:Array<StepNote>, stepTimingPoints:Array<StepTimingPoint>,
stepStops:Array<StepStop>):Array<SongNoteData>
{
var result:Array<SongNoteData> = [];
var holdArray:Array<Float> = [];
@@ -539,7 +536,6 @@ class StepManiaImporter
result.push(snd);
}
return result;
}
/**
@@ -592,7 +588,8 @@ class StepManiaImporter
* @param songData The StepManiaData to migrate.
* @return SongChartData The migrated SongChartData.
*/
public static function migrateChartData(songData:StepManiaData):SongChartData {
public static function migrateChartData(songData:StepManiaData):SongChartData
{
var scrollsMap:Map<String, Float> = new Map<String, Float>();
var stepNoteMap:Map<String, Array<SongNoteData>> = new Map<String, Array<SongNoteData>>();
@@ -49,7 +49,9 @@ class SongMetadata_v2_0_0
public var timeChanges:Array<SongData.SongTimeChange>;
public function new() {}
public function new()
{
}
/**
* Produces a string representation suitable for debugging.
@@ -88,7 +90,9 @@ class SongPlayData_v2_0_0
public var stage:String;
public function new() {}
public function new()
{
}
/**
* Produces a string representation suitable for debugging.
@@ -100,7 +100,9 @@ class SongPlayData_v2_1_0
public var characters:SongData.SongCharacterData;
public var stage:String;
public function new() {}
public function new()
{
}
/**
* Produces a string representation suitable for debugging.
+3 -6
View File
@@ -33,22 +33,19 @@ class StageData
function makeDefaultCharacters():StageDataCharacters
{
return {
bf:
{
bf: {
zIndex: 0,
scale: 1,
position: [0, 0],
cameraOffsets: [-100, -100]
},
dad:
{
dad: {
zIndex: 0,
scale: 1,
position: [0, 0],
cameraOffsets: [100, -100]
},
gf:
{
gf: {
zIndex: 0,
scale: 1,
position: [0, 0],
+3 -1
View File
@@ -23,4 +23,6 @@ class StageRegistry extends BaseRegistry<Stage, StageData, StageEntryParams> imp
}
}
typedef StageEntryParams = {}
typedef StageEntryParams =
{
}
@@ -91,4 +91,6 @@ class StickerRegistry extends BaseRegistry<StickerPack, StickerData, StickerEntr
}
}
typedef StickerEntryParams = {}
typedef StickerEntryParams =
{
}
@@ -31,18 +31,7 @@ class LevelRegistry extends BaseRegistry<Level, LevelData, LevelEntryParams> imp
{
// This MUST be hard-coded (overriding the auto-generated method)
// because the auto-generated method spits out values in alphabetical order.
return [
'tutorial',
'week1',
'week2',
'week3',
'week4',
'week5',
'week6',
'week7',
'weekend1',
'sserafim'
];
return ['tutorial', 'week1', 'week2', 'week3', 'week4', 'week5', 'week6', 'week7', 'weekend1', 'sserafim'];
}
/**
@@ -58,4 +47,6 @@ class LevelRegistry extends BaseRegistry<Level, LevelData, LevelEntryParams> imp
}
}
typedef LevelEntryParams = {}
typedef LevelEntryParams =
{
}
+3 -1
View File
@@ -236,5 +236,7 @@ class IntervalShake implements IFlxDestroyable
* Internal constructor. Use static methods.
*/
@:keep
function new() {}
function new()
{
}
}
+8 -4
View File
@@ -14,7 +14,8 @@ class RetroCameraFade
var steps:Int = 0;
var stepsTotal:Int = camSteps;
new FlxTimer().start(time / stepsTotal, _ -> {
new FlxTimer().start(time / stepsTotal, _ ->
{
var V:Float = (1 / stepsTotal) * steps;
if (steps == stepsTotal) V = 1;
@@ -42,7 +43,8 @@ class RetroCameraFade
];
camera.filters = [new ColorMatrixFilter(matrixDerp)];
new FlxTimer().start(time / stepsTotal, _ -> {
new FlxTimer().start(time / stepsTotal, _ ->
{
var V:Float = (1 / stepsTotal) * steps;
if (steps == stepsTotal) V = 1;
@@ -62,7 +64,8 @@ class RetroCameraFade
var steps:Int = 0;
var stepsTotal:Int = camSteps;
new FlxTimer().start(time / stepsTotal, _ -> {
new FlxTimer().start(time / stepsTotal, _ ->
{
var V:Float = (1 / stepsTotal) * steps;
if (steps == stepsTotal) V = 1;
@@ -90,7 +93,8 @@ class RetroCameraFade
];
camera.filters = [new ColorMatrixFilter(matrixDerp)];
new FlxTimer().start(time / stepsTotal, _ -> {
new FlxTimer().start(time / stepsTotal, _ ->
{
var V:Float = (1 / stepsTotal) * steps;
if (steps == stepsTotal) V = 1;
+3 -1
View File
@@ -66,7 +66,9 @@ class CallbackUtil #if (lime >= "8.0.0") implements JNISafety #end
}
@:noCompletion
private function new() {}
private function new()
{
}
@:noCompletion
@:keep
+5 -17
View File
@@ -72,21 +72,7 @@ class FunkinCamera extends FlxCamera
* - `LIGHTEN` is supported natively on desktop, but not other platforms.
* - While `DARKEN` is supported natively on desktop, it causes issues with transparency.
*/
static final KHR_BLEND_MODES:Array<BlendMode> = [
DARKEN,
HARDLIGHT,
#if !desktop LIGHTEN, #end
OVERLAY,
DIFFERENCE,
COLORDODGE,
COLORBURN,
SOFTLIGHT,
EXCLUSION,
HUE,
SATURATION,
COLOR,
LUMINOSITY
];
static final KHR_BLEND_MODES:Array<BlendMode> = [DARKEN, HARDLIGHT, #if !desktop LIGHTEN, #end OVERLAY, DIFFERENCE, COLORDODGE, COLORBURN, SOFTLIGHT, EXCLUSION, HUE, SATURATION, COLOR, LUMINOSITY];
/**
* A list of blend modes that require the shader no matter what.
@@ -179,7 +165,8 @@ class FunkinCamera extends FlxCamera
this.canvas.graphics.clear();
_blendRenderTexture.init(this.width, this.height);
_blendRenderTexture.drawToCamera((camera, frameMatrix) -> {
_blendRenderTexture.drawToCamera((camera, frameMatrix) ->
{
var pivotX:Float = width / 2;
var pivotY:Float = height / 2;
@@ -200,7 +187,8 @@ class FunkinCamera extends FlxCamera
_backgroundFrame.parent.bitmap = _blendRenderTexture.graphic.bitmap;
_backgroundRenderTexture.init(Std.int(this.width * Lib.current.stage.window.scale), Std.int(this.height * Lib.current.stage.window.scale));
_backgroundRenderTexture.drawToCamera((camera, matrix) -> {
_backgroundRenderTexture.drawToCamera((camera, matrix) ->
{
camera.zoom = this.zoom;
matrix.scale(Lib.current.stage.window.scale, Lib.current.stage.window.scale);
camera.drawPixels(_backgroundFrame, null, matrix, canvas.transform.colorTransform, null, false, _blendShader);
+10 -5
View File
@@ -256,7 +256,8 @@ class FunkinSprite extends FlxAnimate
trace('[ASYNC] Start loading image (${key})');
graphic.persist = true;
openfl.Assets.loadBitmapData(key)
.onComplete(function(bitmapData:openfl.display.BitmapData) {
.onComplete(function(bitmapData:openfl.display.BitmapData)
{
trace('[ASYNC] Finished loading image');
var cache:Bool = false;
loadBitmapData(bitmapData, cache);
@@ -267,7 +268,8 @@ class FunkinSprite extends FlxAnimate
FlxTween.tween(this, {alpha: 1.0}, 0.25);
}
})
.onError(function(error:Dynamic) {
.onError(function(error:Dynamic)
{
trace('[ASYNC] Failed to load image: ${error}');
if (fadeTween != null)
{
@@ -275,7 +277,8 @@ class FunkinSprite extends FlxAnimate
this.alpha = 1.0;
}
})
.onProgress(function(progress:Int, total:Int) {
.onProgress(function(progress:Int, total:Int)
{
trace('[ASYNC] Loading image progress: ${progress}/${total}');
});
}
@@ -462,8 +465,10 @@ class FunkinSprite extends FlxAnimate
for (symbolItem in symbolItems)
{
symbolItem.timeline.forEachLayer((layer) -> {
layer.forEachFrame((frame) -> {
symbolItem.timeline.forEachLayer((layer) ->
{
layer.forEachFrame((frame) ->
{
frames.push(frame);
});
});
@@ -5,4 +5,6 @@ package funkin.graphics;
* Create a scripted class that extends FunkinSprite to use this.
*/
@:hscriptClass
class ScriptedFunkinSprite extends funkin.graphics.FunkinSprite implements polymod.hscript.HScriptedClass {}
class ScriptedFunkinSprite extends funkin.graphics.FunkinSprite implements polymod.hscript.HScriptedClass
{
}
@@ -217,7 +217,8 @@ class DropShadowShader extends FlxShader
public function loadAltMask(path:String):Void
{
#if html5
BitmapData.loadFromFile(path).onComplete(function(bmp:BitmapData) {
BitmapData.loadFromFile(path).onComplete(function(bmp:BitmapData)
{
altMaskImage = bmp;
});
#else
@@ -133,14 +133,12 @@ class RuntimeRainShader extends RuntimePostEffectShader
super.__processGLData(source, storageType);
if (storageType == 'uniform')
{
lights = [
for (i in 0...MAX_LIGHTS)
lights = [for (i in 0...MAX_LIGHTS)
{
position: addFloatUniform('lights[$i].position', 2),
color: addFloatUniform('lights[$i].color', 3),
radius: addFloatUniform('lights[$i].radius', 1),
}
];
}];
}
}
@@ -11,7 +11,8 @@ class TextureSwap extends FlxShader
public function loadSwapImage(path:String)
{
#if html5
BitmapData.loadFromFile(path).onComplete(function(bmp:BitmapData) {
BitmapData.loadFromFile(path).onComplete(function(bmp:BitmapData)
{
swappedImage = bmp;
});
#else
@@ -16,7 +16,8 @@ class FunkinVideoSprite extends FlxVideoSprite
if (bitmap != null)
{
bitmap.onOpening.add(function():Void {
bitmap.onOpening.add(function():Void
{
if (bitmap != null)
{
if (PlayState.instance != null)
@@ -6,5 +6,7 @@ package funkin.graphics.video;
*/
#if hxvlc
@:hscriptClass
class ScriptedFunkinVideoSprite extends funkin.graphics.video.FunkinVideoSprite implements polymod.hscript.HScriptedClass {}
class ScriptedFunkinVideoSprite extends funkin.graphics.video.FunkinVideoSprite implements polymod.hscript.HScriptedClass
{
}
#end
+56 -143
View File
@@ -69,271 +69,219 @@ class Controls extends FlxActionSet
public var UI_UP(get, never):Bool;
inline function get_UI_UP()
return _ui_up.checkPressed();
inline function get_UI_UP() return _ui_up.checkPressed();
public var UI_LEFT(get, never):Bool;
inline function get_UI_LEFT()
return _ui_left.checkPressed();
inline function get_UI_LEFT() return _ui_left.checkPressed();
public var UI_RIGHT(get, never):Bool;
inline function get_UI_RIGHT()
return _ui_right.checkPressed();
inline function get_UI_RIGHT() return _ui_right.checkPressed();
public var UI_DOWN(get, never):Bool;
inline function get_UI_DOWN()
return _ui_down.checkPressed();
inline function get_UI_DOWN() return _ui_down.checkPressed();
public var UI_UP_P(get, never):Bool;
inline function get_UI_UP_P()
return _ui_up.checkJustPressed();
inline function get_UI_UP_P() return _ui_up.checkJustPressed();
public var UI_LEFT_P(get, never):Bool;
inline function get_UI_LEFT_P()
return _ui_left.checkJustPressed();
inline function get_UI_LEFT_P() return _ui_left.checkJustPressed();
public var UI_RIGHT_P(get, never):Bool;
inline function get_UI_RIGHT_P()
return _ui_right.checkJustPressed();
inline function get_UI_RIGHT_P() return _ui_right.checkJustPressed();
public var UI_DOWN_P(get, never):Bool;
inline function get_UI_DOWN_P()
return _ui_down.checkJustPressed();
inline function get_UI_DOWN_P() return _ui_down.checkJustPressed();
public var UI_UP_R(get, never):Bool;
inline function get_UI_UP_R()
return _ui_up.checkJustReleased();
inline function get_UI_UP_R() return _ui_up.checkJustReleased();
public var UI_LEFT_R(get, never):Bool;
inline function get_UI_LEFT_R()
return _ui_left.checkJustReleased();
inline function get_UI_LEFT_R() return _ui_left.checkJustReleased();
public var UI_RIGHT_R(get, never):Bool;
inline function get_UI_RIGHT_R()
return _ui_right.checkJustReleased();
inline function get_UI_RIGHT_R() return _ui_right.checkJustReleased();
public var UI_DOWN_R(get, never):Bool;
inline function get_UI_DOWN_R()
return _ui_down.checkJustReleased();
inline function get_UI_DOWN_R() return _ui_down.checkJustReleased();
public var NOTE_UP(get, never):Bool;
inline function get_NOTE_UP()
return _note_up.checkPressed();
inline function get_NOTE_UP() return _note_up.checkPressed();
public var NOTE_LEFT(get, never):Bool;
inline function get_NOTE_LEFT()
return _note_left.checkPressed();
inline function get_NOTE_LEFT() return _note_left.checkPressed();
public var NOTE_RIGHT(get, never):Bool;
inline function get_NOTE_RIGHT()
return _note_right.checkPressed();
inline function get_NOTE_RIGHT() return _note_right.checkPressed();
public var NOTE_DOWN(get, never):Bool;
inline function get_NOTE_DOWN()
return _note_down.checkPressed();
inline function get_NOTE_DOWN() return _note_down.checkPressed();
public var NOTE_UP_P(get, never):Bool;
inline function get_NOTE_UP_P()
return _note_up.checkJustPressed();
inline function get_NOTE_UP_P() return _note_up.checkJustPressed();
public var NOTE_LEFT_P(get, never):Bool;
inline function get_NOTE_LEFT_P()
return _note_left.checkJustPressed();
inline function get_NOTE_LEFT_P() return _note_left.checkJustPressed();
public var NOTE_RIGHT_P(get, never):Bool;
inline function get_NOTE_RIGHT_P()
return _note_right.checkJustPressed();
inline function get_NOTE_RIGHT_P() return _note_right.checkJustPressed();
public var NOTE_DOWN_P(get, never):Bool;
inline function get_NOTE_DOWN_P()
return _note_down.checkJustPressed();
inline function get_NOTE_DOWN_P() return _note_down.checkJustPressed();
public var NOTE_UP_R(get, never):Bool;
inline function get_NOTE_UP_R()
return _note_up.checkJustReleased();
inline function get_NOTE_UP_R() return _note_up.checkJustReleased();
public var NOTE_LEFT_R(get, never):Bool;
inline function get_NOTE_LEFT_R()
return _note_left.checkJustReleased();
inline function get_NOTE_LEFT_R() return _note_left.checkJustReleased();
public var NOTE_RIGHT_R(get, never):Bool;
inline function get_NOTE_RIGHT_R()
return _note_right.checkJustReleased();
inline function get_NOTE_RIGHT_R() return _note_right.checkJustReleased();
public var NOTE_DOWN_R(get, never):Bool;
inline function get_NOTE_DOWN_R()
return _note_down.checkJustReleased();
inline function get_NOTE_DOWN_R() return _note_down.checkJustReleased();
public var ACCEPT(get, never):Bool;
inline function get_ACCEPT()
return _accept.checkPressed();
inline function get_ACCEPT() return _accept.checkPressed();
public var ACCEPT_P(get, never):Bool;
inline function get_ACCEPT_P()
return _accept.checkJustPressed();
inline function get_ACCEPT_P() return _accept.checkJustPressed();
public var ACCEPT_R(get, never):Bool;
inline function get_ACCEPT_R()
return _accept.checkJustReleased();
inline function get_ACCEPT_R() return _accept.checkJustReleased();
public var BACK(get, never):Bool;
inline function get_BACK()
return _back.checkPressed();
inline function get_BACK() return _back.checkPressed();
public var BACK_P(get, never):Bool;
inline function get_BACK_P()
return _back.checkJustPressed();
inline function get_BACK_P() return _back.checkJustPressed();
public var BACK_R(get, never):Bool;
inline function get_BACK_R()
return _back.checkJustReleased();
inline function get_BACK_R() return _back.checkJustReleased();
public var PAUSE(get, never):Bool;
inline function get_PAUSE()
return _pause.checkPressed();
inline function get_PAUSE() return _pause.checkPressed();
public var PAUSE_P(get, never):Bool;
inline function get_PAUSE_P()
return _pause.checkJustPressed();
inline function get_PAUSE_P() return _pause.checkJustPressed();
public var PAUSE_R(get, never):Bool;
inline function get_PAUSE_R()
return _pause.checkJustReleased();
inline function get_PAUSE_R() return _pause.checkJustReleased();
public var RESET(get, never):Bool;
inline function get_RESET()
return _reset.checkPressed();
inline function get_RESET() return _reset.checkPressed();
public var RESET_P(get, never):Bool;
inline function get_RESET_P()
return _reset.checkJustPressed();
inline function get_RESET_P() return _reset.checkJustPressed();
public var RESET_R(get, never):Bool;
inline function get_RESET_R()
return _reset.checkJustReleased();
inline function get_RESET_R() return _reset.checkJustReleased();
public var WINDOW_FULLSCREEN(get, never):Bool;
inline function get_WINDOW_FULLSCREEN()
return _window_fullscreen.check();
inline function get_WINDOW_FULLSCREEN() return _window_fullscreen.check();
#if FEATURE_SCREENSHOTS
public var WINDOW_SCREENSHOT(get, never):Bool;
inline function get_WINDOW_SCREENSHOT()
return _window_screenshot.check();
inline function get_WINDOW_SCREENSHOT() return _window_screenshot.check();
#end
public var FREEPLAY_FAVORITE(get, never):Bool;
inline function get_FREEPLAY_FAVORITE()
return _freeplay_favorite.check();
inline function get_FREEPLAY_FAVORITE() return _freeplay_favorite.check();
public var FREEPLAY_LEFT(get, never):Bool;
inline function get_FREEPLAY_LEFT()
return _freeplay_left.check();
inline function get_FREEPLAY_LEFT() return _freeplay_left.check();
public var FREEPLAY_RIGHT(get, never):Bool;
inline function get_FREEPLAY_RIGHT()
return _freeplay_right.check();
inline function get_FREEPLAY_RIGHT() return _freeplay_right.check();
public var FREEPLAY_CHAR_SELECT(get, never):Bool;
inline function get_FREEPLAY_CHAR_SELECT()
return _freeplay_char_select.check();
inline function get_FREEPLAY_CHAR_SELECT() return _freeplay_char_select.check();
public var FREEPLAY_JUMP_TO_TOP(get, never):Bool;
inline function get_FREEPLAY_JUMP_TO_TOP()
return _freeplay_jump_to_top.check();
inline function get_FREEPLAY_JUMP_TO_TOP() return _freeplay_jump_to_top.check();
public var FREEPLAY_JUMP_TO_BOTTOM(get, never):Bool;
inline function get_FREEPLAY_JUMP_TO_BOTTOM()
return _freeplay_jump_to_bottom.check();
inline function get_FREEPLAY_JUMP_TO_BOTTOM() return _freeplay_jump_to_bottom.check();
public var CUTSCENE_ADVANCE(get, never):Bool;
inline function get_CUTSCENE_ADVANCE()
return _cutscene_advance.check();
inline function get_CUTSCENE_ADVANCE() return _cutscene_advance.check();
#if FEATURE_DEBUG_MENU
public var DEBUG_MENU(get, never):Bool;
inline function get_DEBUG_MENU()
return _debug_menu.check();
inline function get_DEBUG_MENU() return _debug_menu.check();
#end
#if FEATURE_CHART_EDITOR
public var DEBUG_CHART(get, never):Bool;
inline function get_DEBUG_CHART()
return _debug_chart.check();
inline function get_DEBUG_CHART() return _debug_chart.check();
#end
#if FEATURE_STAGE_EDITOR
public var DEBUG_STAGE(get, never):Bool;
inline function get_DEBUG_STAGE()
return _debug_stage.check();
inline function get_DEBUG_STAGE() return _debug_stage.check();
#end
public var DEBUG_DISPLAY(get, never):Bool;
inline function get_DEBUG_DISPLAY()
return _debug_display.check();
inline function get_DEBUG_DISPLAY() return _debug_display.check();
public var VOLUME_UP(get, never):Bool;
inline function get_VOLUME_UP()
return _volume_up.check();
inline function get_VOLUME_UP() return _volume_up.check();
public var VOLUME_DOWN(get, never):Bool;
inline function get_VOLUME_DOWN()
return _volume_down.check();
inline function get_VOLUME_DOWN() return _volume_down.check();
public var VOLUME_MUTE(get, never):Bool;
inline function get_VOLUME_MUTE()
return _volume_mute.check();
inline function get_VOLUME_MUTE() return _volume_mute.check();
public function new(name, ?scheme:KeyboardScheme)
{
@@ -976,44 +924,8 @@ class Controls extends FlxActionSet
public function addDefaultGamepad(id:Int):Void
{
addGamepadLiteral(id, [
Control.ACCEPT => getDefaultGamepadBinds(Control.ACCEPT),
Control.BACK => getDefaultGamepadBinds(Control.BACK),
Control.UI_UP => getDefaultGamepadBinds(Control.UI_UP),
Control.UI_DOWN => getDefaultGamepadBinds(Control.UI_DOWN),
Control.UI_LEFT => getDefaultGamepadBinds(Control.UI_LEFT),
Control.UI_RIGHT => getDefaultGamepadBinds(Control.UI_RIGHT),
Control.NOTE_UP => getDefaultGamepadBinds(Control.NOTE_UP),
Control.NOTE_DOWN => getDefaultGamepadBinds(Control.NOTE_DOWN),
Control.NOTE_LEFT => getDefaultGamepadBinds(Control.NOTE_LEFT),
Control.NOTE_RIGHT => getDefaultGamepadBinds(Control.NOTE_RIGHT),
Control.PAUSE => getDefaultGamepadBinds(Control.PAUSE),
Control.RESET => getDefaultGamepadBinds(Control.RESET),
Control.WINDOW_FULLSCREEN => getDefaultGamepadBinds(Control.WINDOW_FULLSCREEN),
#if FEATURE_SCREENSHOTS
Control.WINDOW_SCREENSHOT => getDefaultGamepadBinds(Control.WINDOW_SCREENSHOT),
#end
Control.CUTSCENE_ADVANCE => getDefaultGamepadBinds(Control.CUTSCENE_ADVANCE),
Control.FREEPLAY_FAVORITE => getDefaultGamepadBinds(Control.FREEPLAY_FAVORITE),
Control.FREEPLAY_LEFT => getDefaultGamepadBinds(Control.FREEPLAY_LEFT),
Control.FREEPLAY_RIGHT => getDefaultGamepadBinds(Control.FREEPLAY_RIGHT),
Control.FREEPLAY_CHAR_SELECT => getDefaultGamepadBinds(Control.FREEPLAY_CHAR_SELECT),
Control.FREEPLAY_JUMP_TO_TOP => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_TOP),
Control.FREEPLAY_JUMP_TO_BOTTOM => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_BOTTOM),
Control.VOLUME_UP => getDefaultGamepadBinds(Control.VOLUME_UP),
Control.VOLUME_DOWN => getDefaultGamepadBinds(Control.VOLUME_DOWN),
Control.VOLUME_MUTE => getDefaultGamepadBinds(Control.VOLUME_MUTE),
#if FEATURE_DEBUG_MENU
Control.DEBUG_MENU => getDefaultGamepadBinds(Control.DEBUG_MENU),
#end
#if FEATURE_CHART_EDITOR
Control.DEBUG_CHART => getDefaultGamepadBinds(Control.DEBUG_CHART),
#end
#if FEATURE_STAGE_EDITOR
Control.DEBUG_STAGE => getDefaultGamepadBinds(Control.DEBUG_STAGE),
#end
Control.DEBUG_DISPLAY => getDefaultGamepadBinds(Control.DEBUG_DISPLAY),
]);
addGamepadLiteral(id,
[Control.ACCEPT => getDefaultGamepadBinds(Control.ACCEPT), Control.BACK => getDefaultGamepadBinds(Control.BACK), Control.UI_UP => getDefaultGamepadBinds(Control.UI_UP), Control.UI_DOWN => getDefaultGamepadBinds(Control.UI_DOWN), Control.UI_LEFT => getDefaultGamepadBinds(Control.UI_LEFT), Control.UI_RIGHT => getDefaultGamepadBinds(Control.UI_RIGHT), Control.NOTE_UP => getDefaultGamepadBinds(Control.NOTE_UP), Control.NOTE_DOWN => getDefaultGamepadBinds(Control.NOTE_DOWN), Control.NOTE_LEFT => getDefaultGamepadBinds(Control.NOTE_LEFT), Control.NOTE_RIGHT => getDefaultGamepadBinds(Control.NOTE_RIGHT), Control.PAUSE => getDefaultGamepadBinds(Control.PAUSE), Control.RESET => getDefaultGamepadBinds(Control.RESET), Control.WINDOW_FULLSCREEN => getDefaultGamepadBinds(Control.WINDOW_FULLSCREEN), #if FEATURE_SCREENSHOTS Control.WINDOW_SCREENSHOT => getDefaultGamepadBinds(Control.WINDOW_SCREENSHOT), #end Control.CUTSCENE_ADVANCE => getDefaultGamepadBinds(Control.CUTSCENE_ADVANCE), Control.FREEPLAY_FAVORITE => getDefaultGamepadBinds(Control.FREEPLAY_FAVORITE), Control.FREEPLAY_LEFT => getDefaultGamepadBinds(Control.FREEPLAY_LEFT), Control.FREEPLAY_RIGHT => getDefaultGamepadBinds(Control.FREEPLAY_RIGHT), Control.FREEPLAY_CHAR_SELECT => getDefaultGamepadBinds(Control.FREEPLAY_CHAR_SELECT), Control.FREEPLAY_JUMP_TO_TOP => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_TOP), Control.FREEPLAY_JUMP_TO_BOTTOM => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_BOTTOM), Control.VOLUME_UP => getDefaultGamepadBinds(Control.VOLUME_UP), Control.VOLUME_DOWN => getDefaultGamepadBinds(Control.VOLUME_DOWN), Control.VOLUME_MUTE => getDefaultGamepadBinds(Control.VOLUME_MUTE), #if FEATURE_DEBUG_MENU Control.DEBUG_MENU => getDefaultGamepadBinds(Control.DEBUG_MENU), #end#if FEATURE_CHART_EDITOR Control.DEBUG_CHART => getDefaultGamepadBinds(Control.DEBUG_CHART), #end#if FEATURE_STAGE_EDITOR Control.DEBUG_STAGE => getDefaultGamepadBinds(Control.DEBUG_STAGE), #end Control.DEBUG_DISPLAY => getDefaultGamepadBinds(Control.DEBUG_DISPLAY),]);
}
function getDefaultGamepadBinds(control:Control):Array<FlxGamepadInputID>
@@ -1267,7 +1179,8 @@ class FunkinAction extends FlxActionDigital
public var namePressed(default, null):Null<String>;
public var nameReleased(default, null):Null<String>;
var cache:Map<String, {timestamp:Int, value:Bool}> = [];
var cache:Map<String,
{timestamp:Int, value:Bool}> = [];
public function new(?name:String = "", ?namePressed:String, ?nameReleased:String)
{
+37 -38
View File
@@ -47,8 +47,7 @@ class Cursor
}
}
public static final CURSOR_DEFAULT_PARAMS:CursorParams =
{
public static final CURSOR_DEFAULT_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-default.png",
scale: 1.0,
offsetX: 0,
@@ -56,8 +55,7 @@ class Cursor
};
static var assetCursorDefault:Null<BitmapData> = null;
public static final CURSOR_CROSS_PARAMS:CursorParams =
{
public static final CURSOR_CROSS_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-cross.png",
scale: 1.0,
offsetX: 0,
@@ -65,8 +63,7 @@ class Cursor
};
static var assetCursorCross:Null<BitmapData> = null;
public static final CURSOR_ERASER_PARAMS:CursorParams =
{
public static final CURSOR_ERASER_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-eraser.png",
scale: 1.0,
offsetX: 0,
@@ -74,8 +71,7 @@ class Cursor
};
static var assetCursorEraser:Null<BitmapData> = null;
public static final CURSOR_GRABBING_PARAMS:CursorParams =
{
public static final CURSOR_GRABBING_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-grabbing.png",
scale: 1.0,
offsetX: -8,
@@ -83,8 +79,7 @@ class Cursor
};
static var assetCursorGrabbing:Null<BitmapData> = null;
public static final CURSOR_HOURGLASS_PARAMS:CursorParams =
{
public static final CURSOR_HOURGLASS_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-hourglass.png",
scale: 1.0,
offsetX: 0,
@@ -92,8 +87,7 @@ class Cursor
};
static var assetCursorHourglass:Null<BitmapData> = null;
public static final CURSOR_POINTER_PARAMS:CursorParams =
{
public static final CURSOR_POINTER_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-pointer.png",
scale: 1.0,
offsetX: -8,
@@ -101,8 +95,7 @@ class Cursor
};
static var assetCursorPointer:Null<BitmapData> = null;
public static final CURSOR_TEXT_PARAMS:CursorParams =
{
public static final CURSOR_TEXT_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-text.png",
scale: 0.2,
offsetX: 0,
@@ -110,8 +103,7 @@ class Cursor
};
static var assetCursorText:Null<BitmapData> = null;
public static final CURSOR_TEXT_VERTICAL_PARAMS:CursorParams =
{
public static final CURSOR_TEXT_VERTICAL_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-text-vertical.png",
scale: 0.2,
offsetX: 0,
@@ -119,8 +111,7 @@ class Cursor
};
static var assetCursorTextVertical:Null<BitmapData> = null;
public static final CURSOR_ZOOM_IN_PARAMS:CursorParams =
{
public static final CURSOR_ZOOM_IN_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-zoom-in.png",
scale: 1.0,
offsetX: 0,
@@ -128,8 +119,7 @@ class Cursor
};
static var assetCursorZoomIn:Null<BitmapData> = null;
public static final CURSOR_ZOOM_OUT_PARAMS:CursorParams =
{
public static final CURSOR_ZOOM_OUT_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-zoom-out.png",
scale: 1.0,
offsetX: 0,
@@ -137,8 +127,7 @@ class Cursor
};
static var assetCursorZoomOut:Null<BitmapData> = null;
public static final CURSOR_CROSSHAIR_PARAMS:CursorParams =
{
public static final CURSOR_CROSSHAIR_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-crosshair.png",
scale: 1.0,
offsetX: -16,
@@ -146,8 +135,7 @@ class Cursor
};
static var assetCursorCrosshair:Null<BitmapData> = null;
public static final CURSOR_CELL_PARAMS:CursorParams =
{
public static final CURSOR_CELL_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-cell.png",
scale: 1.0,
offsetX: -16,
@@ -155,8 +143,7 @@ class Cursor
};
static var assetCursorCell:Null<BitmapData> = null;
public static final CURSOR_SCROLL_PARAMS:CursorParams =
{
public static final CURSOR_SCROLL_PARAMS:CursorParams = {
graphic: "assets/images/cursor/cursor-scroll.png",
scale: 0.2,
offsetX: -15,
@@ -353,7 +340,8 @@ class Cursor
if (assetCursorDefault == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_DEFAULT_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorDefault = bitmapData;
applyCursorParams(assetCursorDefault, CURSOR_DEFAULT_PARAMS);
});
@@ -368,7 +356,8 @@ class Cursor
if (assetCursorCross == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_CROSS_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorCross = bitmapData;
applyCursorParams(assetCursorCross, CURSOR_CROSS_PARAMS);
});
@@ -383,7 +372,8 @@ class Cursor
if (assetCursorEraser == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_ERASER_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorEraser = bitmapData;
applyCursorParams(assetCursorEraser, CURSOR_ERASER_PARAMS);
});
@@ -398,7 +388,8 @@ class Cursor
if (assetCursorGrabbing == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_GRABBING_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorGrabbing = bitmapData;
applyCursorParams(assetCursorGrabbing, CURSOR_GRABBING_PARAMS);
});
@@ -413,7 +404,8 @@ class Cursor
if (assetCursorHourglass == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_HOURGLASS_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorHourglass = bitmapData;
applyCursorParams(assetCursorHourglass, CURSOR_HOURGLASS_PARAMS);
});
@@ -428,7 +420,8 @@ class Cursor
if (assetCursorPointer == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_POINTER_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorPointer = bitmapData;
applyCursorParams(assetCursorPointer, CURSOR_POINTER_PARAMS);
});
@@ -443,7 +436,8 @@ class Cursor
if (assetCursorText == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_TEXT_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorText = bitmapData;
applyCursorParams(assetCursorText, CURSOR_TEXT_PARAMS);
});
@@ -458,7 +452,8 @@ class Cursor
if (assetCursorZoomIn == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_ZOOM_IN_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorZoomIn = bitmapData;
applyCursorParams(assetCursorZoomIn, CURSOR_ZOOM_IN_PARAMS);
});
@@ -473,7 +468,8 @@ class Cursor
if (assetCursorZoomOut == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_ZOOM_OUT_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorZoomOut = bitmapData;
applyCursorParams(assetCursorZoomOut, CURSOR_ZOOM_OUT_PARAMS);
});
@@ -488,7 +484,8 @@ class Cursor
if (assetCursorCrosshair == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_CROSSHAIR_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorCrosshair = bitmapData;
applyCursorParams(assetCursorCrosshair, CURSOR_CROSSHAIR_PARAMS);
});
@@ -503,7 +500,8 @@ class Cursor
if (assetCursorCell == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_CELL_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorCell = bitmapData;
applyCursorParams(assetCursorCell, CURSOR_CELL_PARAMS);
});
@@ -518,7 +516,8 @@ class Cursor
if (assetCursorScroll == null)
{
var future:Future<BitmapData> = Assets.loadBitmapData(CURSOR_SCROLL_PARAMS.graphic);
future.onComplete(function(bitmapData:BitmapData) {
future.onComplete(function(bitmapData:BitmapData)
{
assetCursorScroll = bitmapData;
applyCursorParams(assetCursorScroll, CURSOR_SCROLL_PARAMS);
});
+9 -18
View File
@@ -192,8 +192,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
clearButtons();
var limeGamepad = FlxGamepadUtil.getLimeGamepad(gamepad);
var callbacks =
{
var callbacks = {
onButtonDown: handleButtonDown.bind(gamepad),
onButtonUp: handleButtonUp.bind(gamepad)
};
@@ -300,8 +299,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
if (getInputByKey(key)?.justPressed ?? false)
{
onInputPressed.dispatch(
{
onInputPressed.dispatch({
noteDirection: getDirectionForKey(key),
timestamp: timestamp,
keyCode: keyCode
@@ -323,8 +321,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
if (getInputByKey(key)?.justReleased ?? false)
{
onInputReleased.dispatch(
{
onInputReleased.dispatch({
noteDirection: getDirectionForKey(key),
timestamp: timestamp,
keyCode: keyCode
@@ -348,8 +345,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
if (getInputByButton(gamepad, buttonId)?.justPressed ?? false)
{
onInputPressed.dispatch(
{
onInputPressed.dispatch({
noteDirection: getDirectionForButton(gamepad, buttonId),
timestamp: timestamp,
keyCode: button // implicit cast to int
@@ -373,8 +369,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
if (getInputByButton(gamepad, buttonId)?.justReleased ?? false)
{
onInputReleased.dispatch(
{
onInputReleased.dispatch({
noteDirection: getDirectionForButton(gamepad, buttonId),
timestamp: timestamp,
keyCode: button // implicit cast to int
@@ -465,23 +460,19 @@ class PreciseInputList extends FlxKeyList
public var NOTE_LEFT(get, never):Bool;
function get_NOTE_LEFT():Bool
return checkDir(NoteDirection.LEFT);
function get_NOTE_LEFT():Bool return checkDir(NoteDirection.LEFT);
public var NOTE_DOWN(get, never):Bool;
function get_NOTE_DOWN():Bool
return checkDir(NoteDirection.DOWN);
function get_NOTE_DOWN():Bool return checkDir(NoteDirection.DOWN);
public var NOTE_UP(get, never):Bool;
function get_NOTE_UP():Bool
return checkDir(NoteDirection.UP);
function get_NOTE_UP():Bool return checkDir(NoteDirection.UP);
public var NOTE_RIGHT(get, never):Bool;
function get_NOTE_RIGHT():Bool
return checkDir(NoteDirection.RIGHT);
function get_NOTE_RIGHT():Bool return checkDir(NoteDirection.RIGHT);
}
typedef PreciseInputEvent =
+11 -5
View File
@@ -78,19 +78,23 @@ class ControlsHandler
switch (hint.noteDirection)
{
case NoteDirection.LEFT:
controls.forEachBound(Control.NOTE_LEFT, function(action:FlxActionDigital, state:FlxInputState):Void {
controls.forEachBound(Control.NOTE_LEFT, function(action:FlxActionDigital, state:FlxInputState):Void
{
addButton(action, hint, state, cachedInput);
});
case NoteDirection.DOWN:
controls.forEachBound(Control.NOTE_DOWN, function(action:FlxActionDigital, state:FlxInputState):Void {
controls.forEachBound(Control.NOTE_DOWN, function(action:FlxActionDigital, state:FlxInputState):Void
{
addButton(action, hint, state, cachedInput);
});
case NoteDirection.UP:
controls.forEachBound(Control.NOTE_UP, function(action:FlxActionDigital, state:FlxInputState):Void {
controls.forEachBound(Control.NOTE_UP, function(action:FlxActionDigital, state:FlxInputState):Void
{
addButton(action, hint, state, cachedInput);
});
case NoteDirection.RIGHT:
controls.forEachBound(Control.NOTE_RIGHT, function(action:FlxActionDigital, state:FlxInputState):Void {
controls.forEachBound(Control.NOTE_RIGHT, function(action:FlxActionDigital, state:FlxInputState):Void
{
addButton(action, hint, state, cachedInput);
});
}
@@ -128,7 +132,9 @@ class ControlsHandler
@:noCompletion
private static function get_hasExternalInputDevice():Bool
{
return FlxG.gamepads.numActiveGamepads > 0 #if android || KeyboardUtil.keyboardConnected || extension.androidtools.Tools.isChromebook() #end;
return FlxG.gamepads.numActiveGamepads > 0 #if android
|| KeyboardUtil.keyboardConnected
|| extension.androidtools.Tools.isChromebook() #end;
}
@:noCompletion
+5 -4
View File
@@ -103,7 +103,8 @@ class FunkinBackButton extends FunkinButton
onConfirmStart.dispatch();
animation.onFinish.addOnce(function(name:String) {
animation.onFinish.addOnce(function(name:String)
{
if (name != 'confirm') return;
_confirming = false;
held = false;
@@ -119,10 +120,10 @@ class FunkinBackButton extends FunkinButton
HapticUtil.vibrate(0, 0.01, 0.2);
animation.play('idle');
FlxTween.tween(this, {alpha: restingOpacity}, 0.5,
{
FlxTween.tween(this, {alpha: restingOpacity}, 0.5, {
ease: FlxEase.expoOut,
onComplete: function(tween:FlxTween):Void {
onComplete: function(tween:FlxTween):Void
{
held = false;
}
});
+12 -9
View File
@@ -43,10 +43,8 @@ class FunkinHint extends FunkinButton
* - The second value corresponds to the alpha when the hint is not pressed.
* - The third value corresponds to the duratuon it'll take to tween between the two values.
*/
static final HINT_ALPHA_STYLE:Map<FunkinHintAlphaStyle, Array<Float>> = [
INVISIBLE_TILL_PRESS => [0.3, 0.00001, 0.01],
VISIBLE_TILL_PRESS => [0.4, 0.2, 0.08]
];
static final HINT_ALPHA_STYLE:Map<FunkinHintAlphaStyle,
Array<Float>> = [INVISIBLE_TILL_PRESS => [0.3, 0.00001, 0.01], VISIBLE_TILL_PRESS => [0.4, 0.2, 0.08]];
/**
* Indicates whether the hint is pixel.
@@ -388,7 +386,8 @@ class FunkinHitbox extends FlxTypedSpriteGroup<FunkinHint>
public function getFirstHintByDirection(direction:NoteDirection):Null<FunkinHint>
{
var result:Null<FunkinHint> = null;
forEachOfType(FunkinHint, function(hint:FunkinHint):Void {
forEachOfType(FunkinHint, function(hint:FunkinHint):Void
{
@:privateAccess
if (hint.noteDirection == direction) result = hint;
});
@@ -497,19 +496,22 @@ class FunkinHitbox extends FlxTypedSpriteGroup<FunkinHint>
hint.animation.play('static', true);
hint.onDown.add(() -> {
hint.onDown.add(() ->
{
hint.animation.play('press', true);
hint.centerOrigin();
hint.centerOffsets();
});
hint.onUp.add(() -> {
hint.onUp.add(() ->
{
hint.animation.play('static', true);
hint.centerOrigin();
hint.centerOffsets();
});
hint.onOut.add(() -> {
hint.onOut.add(() ->
{
hint.animation.play('static', true);
hint.centerOrigin();
hint.centerOffsets();
@@ -675,7 +677,8 @@ class FunkinHitbox extends FlxTypedSpriteGroup<FunkinHint>
function set_isPixel(value:Bool):Bool
{
isPixel = value;
forEachOfType(FunkinHint, function(hint:FunkinHint):Void {
forEachOfType(FunkinHint, function(hint:FunkinHint):Void
{
hint.isPixel = value;
});
return value;
@@ -87,13 +87,15 @@ class FunkinOptionsButton extends FunkinButton
FunkinSound.playOnce(Paths.sound('confirmMenu'));
new FlxTimer().start(0.05, function(_) {
new FlxTimer().start(0.05, function(_)
{
HapticUtil.vibrate(0, 0.01, 0.2);
}, 4);
onConfirmStart.dispatch();
animation.onFinish.addOnce(function(name:String) {
animation.onFinish.addOnce(function(name:String)
{
if (name != 'confirm') return;
_confirming = false;
held = false;
@@ -64,13 +64,7 @@ class ControlsSchemeMenu extends MusicBeatSubState
/**
* An array of every single scheme.
*/
final availableSchemes:Array<String> = [
FunkinHitbox.FunkinHitboxControlSchemes.Arrows,
FunkinHitbox.FunkinHitboxControlSchemes.FourLanes,
FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbTriangle,
FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbSquare,
FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbDPad
];
final availableSchemes:Array<String> = [FunkinHitbox.FunkinHitboxControlSchemes.Arrows, FunkinHitbox.FunkinHitboxControlSchemes.FourLanes, FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbTriangle, FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbSquare, FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbDPad];
/**
* Current selected index
@@ -227,7 +221,8 @@ class ControlsSchemeMenu extends MusicBeatSubState
FlxTween.tween(hsv, {hue: 0, saturation: 0, value: 0.5}, 0.5);
hitboxShowcases.forEach(function(hitboxShowcase:HitboxShowcase) {
hitboxShowcases.forEach(function(hitboxShowcase:HitboxShowcase)
{
hitboxShowcase.visible = false;
});
@@ -237,7 +232,8 @@ class ControlsSchemeMenu extends MusicBeatSubState
addHitbox(true, false, availableSchemes[currentIndex]);
hitbox.forEachAlive(function(hint:FunkinHint) {
hitbox.forEachAlive(function(hint:FunkinHint)
{
if (availableSchemes[currentIndex] == FunkinHitboxControlSchemes.Arrows) hint.alpha = 1;
if (!hint.deadZones.contains(cast(currentButton.body, FunkinSprite))) hint.deadZones.push(cast(currentButton.body, FunkinSprite));
@@ -253,7 +249,8 @@ class ControlsSchemeMenu extends MusicBeatSubState
FlxTween.tween(hsv, {hue: -0.6, saturation: 0.9, value: 3.6}, 0.5);
hitboxShowcases.forEach(function(hitboxShowcase:HitboxShowcase) {
hitboxShowcases.forEach(function(hitboxShowcase:HitboxShowcase)
{
hitboxShowcase.visible = true;
});
@@ -285,7 +282,8 @@ class ControlsSchemeMenu extends MusicBeatSubState
schemeNameText.text = availableSchemes[currentIndex];
hitboxShowcases.forEach(function(hitboxShowcase:HitboxShowcase) {
hitboxShowcases.forEach(function(hitboxShowcase:HitboxShowcase)
{
hitboxShowcase.selectionIndex = currentIndex;
});
}
@@ -81,7 +81,8 @@ class HitboxShowcase extends FlxSpriteGroup
add(bg);
final hitbox:FunkinHitbox = new FunkinHitbox(controlsScheme, false);
hitbox.forEachAlive(function(hint:FunkinHint):Void {
hitbox.forEachAlive(function(hint:FunkinHint):Void
{
if (controlsScheme != FunkinHitbox.FunkinHitboxControlSchemes.FourLanes) hint.alpha = 0.3;
});
hitbox.active = false;
@@ -99,7 +100,8 @@ class HitboxShowcase extends FlxSpriteGroup
FunkinSound.playOnce(Paths.sound('confirmMenu'));
FlxFlicker.flicker(this, 1, 0.06, true, false, function(_) {
FlxFlicker.flicker(this, 1, 0.06, true, false, function(_)
{
busy = false;
onSelect.dispatch();
});
@@ -69,7 +69,8 @@ class SchemeMenuButton extends FlxSpriteGroup
FunkinSound.playOnce(Paths.sound('confirmMenu'));
FlxFlicker.flicker(this, 1, 0.06, true, false, function(_) {
FlxFlicker.flicker(this, 1, 0.06, true, false, function(_)
{
busy = false;
onSelect.dispatch();
});
+2 -1
View File
@@ -72,7 +72,8 @@ class AdMobUtil
*/
public static function init():Void
{
Admob.onEvent.add(function(event:AdmobEvent):Void {
Admob.onEvent.add(function(event:AdmobEvent):Void
{
switch (event.name)
{
case AdmobEvent.INIT_OK:
+2 -1
View File
@@ -22,7 +22,8 @@ class FNFCUtil
onFNFCOpen = new FlxTypedSignal<String->Void>();
#if ios
FlxG.stage.window.onDropFile.add(function(_) {
FlxG.stage.window.onDropFile.add(function(_)
{
final url = queryFNFC();
if (url != null) getFNFCFromURL(url);
});
+20 -10
View File
@@ -46,11 +46,13 @@ class InAppPurchasesUtil
public static function init():Void
{
#if android
IAPAndroid.onLog.add(function(message:String):Void {
IAPAndroid.onLog.add(function(message:String):Void
{
trace(message);
});
IAPAndroid.onBillingSetupFinished.add(function(result:IAPResult):Void {
IAPAndroid.onBillingSetupFinished.add(function(result:IAPResult):Void
{
if (result.getResponseCode() != IAPResponseCode.OK)
{
trace('Billing setup failed "$result"!');
@@ -62,11 +64,13 @@ class InAppPurchasesUtil
IAPAndroid.queryProductDetails([UPGRADE_PRODUCT_ID]);
});
IAPAndroid.onBillingServiceDisconnected.add(function():Void {
IAPAndroid.onBillingServiceDisconnected.add(function():Void
{
trace("Billing service disconnected!");
});
IAPAndroid.onProductDetailsResponse.add(function(result:IAPResult, productDetails:Array<IAPProductDetails>):Void {
IAPAndroid.onProductDetailsResponse.add(function(result:IAPResult, productDetails:Array<IAPProductDetails>):Void
{
if (result.getResponseCode() == IAPResponseCode.OK)
{
hasInitialized = true;
@@ -79,7 +83,8 @@ class InAppPurchasesUtil
}
});
IAPAndroid.onQueryPurchasesResponse.add(function(result:IAPResult, purchases:Array<IAPPurchase>):Void {
IAPAndroid.onQueryPurchasesResponse.add(function(result:IAPResult, purchases:Array<IAPPurchase>):Void
{
if (result.getResponseCode() == IAPResponseCode.OK) handlePurchases(purchases);
else
{
@@ -87,7 +92,8 @@ class InAppPurchasesUtil
}
});
IAPAndroid.onPurchasesUpdated.add(function(result:IAPResult, purchases:Array<IAPPurchase>):Void {
IAPAndroid.onPurchasesUpdated.add(function(result:IAPResult, purchases:Array<IAPPurchase>):Void
{
if (result.getResponseCode() == IAPResponseCode.OK) handlePurchases(purchases);
else
{
@@ -95,7 +101,8 @@ class InAppPurchasesUtil
}
});
IAPAndroid.onAcknowledgePurchaseResponse.add(function(result:IAPResult):Void {
IAPAndroid.onAcknowledgePurchaseResponse.add(function(result:IAPResult):Void
{
if (result.getResponseCode() == IAPResponseCode.OK) trace('Purchase acknowledged successfully!');
else
{
@@ -107,18 +114,21 @@ class InAppPurchasesUtil
IAPAndroid.startConnection();
#else
IAPIOS.onProductDetailsReceived.add(function(productDetails:Array<IAPProductDetails>):Void {
IAPIOS.onProductDetailsReceived.add(function(productDetails:Array<IAPProductDetails>):Void
{
if (productDetails != null)
{
currentProductDetails = productDetails;
}
});
IAPIOS.onProductDetailsFailed.add(function(error:IAPError):Void {
IAPIOS.onProductDetailsFailed.add(function(error:IAPError):Void
{
hasInitialized = false;
});
IAPIOS.onPurchasesUpdated.add(function(purchases:Array<IAPPurchase>):Void {
IAPIOS.onPurchasesUpdated.add(function(purchases:Array<IAPPurchase>):Void
{
handlePurchases(purchases);
trace("iOS purchases updated: " + purchases.length);
hasInitialized = true;
+6 -3
View File
@@ -29,13 +29,16 @@ class InAppReviewUtil
#if android
trace('[IAR] Initializing callbacks...');
IAR.onLog.add(function(message:String):Void {
IAR.onLog.add(function(message:String):Void
{
trace('[IAR] Error occurred: "$message"');
});
IAR.onReviewCompleted.add(function(success:Bool):Void {
IAR.onReviewCompleted.add(function(success:Bool):Void
{
trace('[IAR] Review completed: "${success ? 'Success' : 'Failure'}"');
});
IAR.onReviewError.add(function(message:String):Void {
IAR.onReviewError.add(function(message:String):Void
{
trace('[IAR] Review failed: "$message"');
});
#end
+2 -1
View File
@@ -24,7 +24,8 @@ class ModStore
public static function register(id:String, ?data:Dynamic):Dynamic
{
if (stores.exists(id)) return stores.get(id);
stores.set(id, data ??= {});
stores.set(id, data ??= {
});
return data;
}
+8 -32
View File
@@ -141,8 +141,7 @@ class PolymodHandler
if (modFileSystem == null) modFileSystem = buildFileSystem();
var loadedModList:Array<ModMetadata> = polymod.Polymod.init(
{
var loadedModList:Array<ModMetadata> = polymod.Polymod.init({
// Root directory for all mods.
modRoot: MOD_FOLDER,
// The directories for one or more mods to load.
@@ -239,8 +238,7 @@ class PolymodHandler
static function buildFileSystem():polymod.fs.ZipFileSystem
{
polymod.Polymod.onError = PolymodErrorHandler.onPolymodError;
return new ZipFileSystem(
{
return new ZipFileSystem({
modRoot: MOD_FOLDER,
autoScan: true
});
@@ -410,16 +408,10 @@ class PolymodHandler
// `funkin.save.Save`
// Direct access to save data is important for scripts (like checking unlocks),
// but we don't want scripts to be able to perform operations like writing scores.
Polymod.blacklistInstanceFields(funkin.save.Save, [
// No direct field access
'data',
// LMFAO definitely not
'clearData',
// No score manipulation please
'setLevelScore',
'setSongScore',
'applySongRank'
]);
Polymod.blacklistInstanceFields(funkin.save.Save, [ // No direct field access
'data', // LMFAO definitely not
'clearData', // No score manipulation please
'setLevelScore', 'setSongScore', 'applySongRank']);
// `funkin.api.*`
// Contains functions which may allow for cheating and such.
@@ -528,22 +520,7 @@ class PolymodHandler
static inline function buildFrameworkParams():polymod.Polymod.FrameworkParams
{
return {
assetLibraryPaths: [
'default' => 'preload',
'shared' => 'shared',
'songs' => 'songs',
'videos' => 'videos',
'tutorial' => 'tutorial',
'week1' => 'week1',
'week2' => 'week2',
'week3' => 'week3',
'week4' => 'week4',
'week5' => 'week5',
'week6' => 'week6',
'week7' => 'week7',
'weekend1' => 'weekend1',
'sserafim' => 'sserafim'
],
assetLibraryPaths: ['default' => 'preload', 'shared' => 'shared', 'songs' => 'songs', 'videos' => 'videos', 'tutorial' => 'tutorial', 'week1' => 'week1', 'week2' => 'week2', 'week3' => 'week3', 'week4' => 'week4', 'week5' => 'week5', 'week6' => 'week6', 'week7' => 'week7', 'weekend1' => 'weekend1', 'sserafim' => 'sserafim'],
coreAssetRedirect: CORE_FOLDER,
}
}
@@ -558,8 +535,7 @@ class PolymodHandler
if (modFileSystem == null) modFileSystem = buildFileSystem();
var modMetadata:Array<ModMetadata> = Polymod.scan(
{
var modMetadata:Array<ModMetadata> = Polymod.scan({
modRoot: MOD_FOLDER,
apiVersionRule: API_VERSION_RULE,
fileSystem: modFileSystem,
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxBasic to use this.
*/
@:hscriptClass
class ScriptedFlxBasic extends flixel.FlxBasic implements HScriptedClass {}
class ScriptedFlxBasic extends flixel.FlxBasic implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxObject to use this.
*/
@:hscriptClass
class ScriptedFlxObject extends flixel.FlxObject implements HScriptedClass {}
class ScriptedFlxObject extends flixel.FlxObject implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxRuntimeShader to use this.
*/
@:hscriptClass
class ScriptedFlxRuntimeShader extends flixel.addons.display.FlxRuntimeShader implements HScriptedClass {}
class ScriptedFlxRuntimeShader extends flixel.addons.display.FlxRuntimeShader implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxSprite to use this.
*/
@:hscriptClass
class ScriptedFlxSprite extends flixel.FlxSprite implements HScriptedClass {}
class ScriptedFlxSprite extends flixel.FlxSprite implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxSpriteGroup to use this.
*/
@:hscriptClass
class ScriptedFlxSpriteGroup extends flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup<flixel.FlxSprite> implements HScriptedClass {}
class ScriptedFlxSpriteGroup extends flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup<flixel.FlxSprite> implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxState to use this.
*/
@:hscriptClass
class ScriptedFlxState extends flixel.FlxState implements HScriptedClass {}
class ScriptedFlxState extends flixel.FlxState implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxStrip to use this.
*/
@:hscriptClass
class ScriptedFlxStrip extends flixel.FlxStrip implements HScriptedClass {}
class ScriptedFlxStrip extends flixel.FlxStrip implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxSubState to use this.
*/
@:hscriptClass
class ScriptedFlxSubState extends flixel.FlxSubState implements HScriptedClass {}
class ScriptedFlxSubState extends flixel.FlxSubState implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxTransitionableState to use this.
*/
@:hscriptClass
class ScriptedFlxTransitionableState extends flixel.addons.transition.FlxTransitionableState implements HScriptedClass {}
class ScriptedFlxTransitionableState extends flixel.addons.transition.FlxTransitionableState implements HScriptedClass
{
}
@@ -5,4 +5,6 @@ package funkin.modding.base;
* Create a scripted class that extends FlxTypedGroup to use this.
*/
@:hscriptClass
class ScriptedFlxTypedGroup extends flixel.group.FlxGroup.FlxTypedGroup<Dynamic> implements HScriptedClass {}
class ScriptedFlxTypedGroup extends flixel.group.FlxGroup.FlxTypedGroup<Dynamic> implements HScriptedClass
{
}
@@ -92,13 +92,8 @@ class ScriptEventDispatcher
else
{
// If the target doesn't support the event, stop trying to dispatch.
if ([
ScriptEventType.DIALOGUE_START,
ScriptEventType.DIALOGUE_LINE,
ScriptEventType.DIALOGUE_COMPLETE_LINE,
ScriptEventType.DIALOGUE_SKIP,
ScriptEventType.DIALOGUE_END
].contains(event.type)) return;
if ([ScriptEventType.DIALOGUE_START, ScriptEventType.DIALOGUE_LINE, ScriptEventType.DIALOGUE_COMPLETE_LINE, ScriptEventType.DIALOGUE_SKIP, ScriptEventType.DIALOGUE_END].contains(event.type))
return;
}
if (Std.isOfType(target, INoteScriptedClass))
@@ -124,12 +119,7 @@ class ScriptEventDispatcher
else
{
// If the target doesn't support the event, stop trying to dispatch.
if ([
ScriptEventType.NOTE_INCOMING,
ScriptEventType.NOTE_HIT,
ScriptEventType.NOTE_MISS,
ScriptEventType.NOTE_HOLD_DROP
].contains(event.type)) return;
if ([ScriptEventType.NOTE_INCOMING, ScriptEventType.NOTE_HIT, ScriptEventType.NOTE_MISS, ScriptEventType.NOTE_HOLD_DROP].contains(event.type)) return;
}
if (Std.isOfType(target, IBPMSyncedScriptedClass))
@@ -199,20 +189,8 @@ class ScriptEventDispatcher
else
{
// If the target doesn't support the event, stop trying to dispatch.
if ([
ScriptEventType.NOTE_GHOST_MISS,
ScriptEventType.SONG_START,
ScriptEventType.SONG_END,
ScriptEventType.SONG_RETRY,
ScriptEventType.GAME_OVER,
ScriptEventType.PAUSE,
ScriptEventType.RESUME,
ScriptEventType.SONG_EVENT,
ScriptEventType.COUNTDOWN_START,
ScriptEventType.COUNTDOWN_STEP,
ScriptEventType.COUNTDOWN_END,
ScriptEventType.SONG_LOADED
].contains(event.type)) return;
if ([ScriptEventType.NOTE_GHOST_MISS, ScriptEventType.SONG_START, ScriptEventType.SONG_END, ScriptEventType.SONG_RETRY, ScriptEventType.GAME_OVER, ScriptEventType.PAUSE, ScriptEventType.RESUME, ScriptEventType.SONG_EVENT, ScriptEventType.COUNTDOWN_START, ScriptEventType.COUNTDOWN_STEP, ScriptEventType.COUNTDOWN_END, ScriptEventType.SONG_LOADED].contains(event.type))
return;
}
if (Std.isOfType(target, IStateChangingScriptedClass))
@@ -250,16 +228,8 @@ class ScriptEventDispatcher
else
{
// If the target doesn't support the event, stop trying to dispatch.
if ([
ScriptEventType.STATE_CHANGE_BEGIN,
ScriptEventType.STATE_CHANGE_END,
ScriptEventType.SUBSTATE_OPEN_BEGIN,
ScriptEventType.SUBSTATE_OPEN_END,
ScriptEventType.SUBSTATE_CLOSE_BEGIN,
ScriptEventType.SUBSTATE_CLOSE_END,
ScriptEventType.FOCUS_LOST,
ScriptEventType.FOCUS_GAINED
].contains(event.type)) return;
if ([ScriptEventType.STATE_CHANGE_BEGIN, ScriptEventType.STATE_CHANGE_END, ScriptEventType.SUBSTATE_OPEN_BEGIN, ScriptEventType.SUBSTATE_OPEN_END, ScriptEventType.SUBSTATE_CLOSE_BEGIN, ScriptEventType.SUBSTATE_CLOSE_END, ScriptEventType.FOCUS_LOST, ScriptEventType.FOCUS_GAINED].contains(event.type))
return;
}
if (Std.isOfType(target, IFreeplayScriptedClass))
@@ -291,14 +261,8 @@ class ScriptEventDispatcher
else
{
// If the target doesn't support the event, stop trying to dispatch.
if ([
ScriptEventType.CAPSULE_SELECTED,
ScriptEventType.DIFFICULTY_SWITCH,
ScriptEventType.SONG_SELECTED,
ScriptEventType.FREEPLAY_INTRO,
ScriptEventType.FREEPLAY_OUTRO,
ScriptEventType.FREEPLAY_CLOSE
].contains(event.type)) return;
if ([ScriptEventType.CAPSULE_SELECTED, ScriptEventType.DIFFICULTY_SWITCH, ScriptEventType.SONG_SELECTED, ScriptEventType.FREEPLAY_INTRO, ScriptEventType.FREEPLAY_OUTRO, ScriptEventType.FREEPLAY_CLOSE].contains(event.type))
return;
}
if (Std.isOfType(target, ICharacterSelectScriptedClass))
@@ -321,11 +285,7 @@ class ScriptEventDispatcher
else
{
// If the target doesn't support the event, stop trying to dispatch.
if ([
ScriptEventType.CHARACTER_SELECTED,
ScriptEventType.CHARACTER_DESELECTED,
ScriptEventType.CHARACTER_CONFIRMED
].contains(event.type)) return;
if ([ScriptEventType.CHARACTER_SELECTED, ScriptEventType.CHARACTER_DESELECTED, ScriptEventType.CHARACTER_CONFIRMED].contains(event.type)) return;
}
// If we reach this line, it means a script event was dispatched while not being properly handled.
+120 -40
View File
@@ -87,204 +87,284 @@ class Module implements IPlayStateScriptedClass implements IStateChangingScripte
/**
* Called when ANY script event is dispatched.
*/
public function onScriptEvent(event:ScriptEvent) {}
public function onScriptEvent(event:ScriptEvent)
{
}
/**
* Called when the module is first created.
* This happens before the title screen appears!
*/
public function onCreate(event:ScriptEvent) {}
public function onCreate(event:ScriptEvent)
{
}
/**
* Called when a module is destroyed.
* This currently only happens when reloading modules with F5.
*/
public function onDestroy(event:ScriptEvent) {}
public function onDestroy(event:ScriptEvent)
{
}
/**
* Called every frame.
*/
public function onUpdate(event:UpdateScriptEvent) {}
public function onUpdate(event:UpdateScriptEvent)
{
}
/**
* Called when the game is paused.
*/
public function onPause(event:PauseScriptEvent) {}
public function onPause(event:PauseScriptEvent)
{
}
/**
* Called when the game is resumed.
*/
public function onResume(event:ScriptEvent) {}
public function onResume(event:ScriptEvent)
{
}
/**
* Called when the song begins.
*/
public function onSongStart(event:ScriptEvent) {}
public function onSongStart(event:ScriptEvent)
{
}
/**
* Called when the song ends.
*/
public function onSongEnd(event:ScriptEvent) {}
public function onSongEnd(event:ScriptEvent)
{
}
/**
* Called when the player dies.
*/
public function onGameOver(event:ScriptEvent) {}
public function onGameOver(event:ScriptEvent)
{
}
/**
* Called when a note on the strumline has been rendered and is now onscreen.
* This gets dispatched for both the player and opponent strumlines.
*/
public function onNoteIncoming(event:NoteScriptEvent) {}
public function onNoteIncoming(event:NoteScriptEvent)
{
}
/**
* Called when a note has been hit.
* This gets dispatched for both the player and opponent strumlines.
*/
public function onNoteHit(event:HitNoteScriptEvent) {}
public function onNoteHit(event:HitNoteScriptEvent)
{
}
/**
* Called when a note has been missed.
* This gets dispatched for both the player and opponent strumlines.
*/
public function onNoteMiss(event:NoteScriptEvent) {}
public function onNoteMiss(event:NoteScriptEvent)
{
}
public function onNoteHoldDrop(event:HoldNoteScriptEvent) {}
public function onNoteHoldDrop(event:HoldNoteScriptEvent)
{
}
/**
* Called when the player presses a key without any notes present.
*/
public function onNoteGhostMiss(event:GhostMissNoteScriptEvent) {}
public function onNoteGhostMiss(event:GhostMissNoteScriptEvent)
{
}
/**
* Called when a step is hit in the song.
*/
public function onStepHit(event:SongTimeScriptEvent) {}
public function onStepHit(event:SongTimeScriptEvent)
{
}
/**
* Called when a beat is hit in the song.
*/
public function onBeatHit(event:SongTimeScriptEvent) {}
public function onBeatHit(event:SongTimeScriptEvent)
{
}
/**
* Called when a song event is triggered.
*/
public function onSongEvent(event:SongEventScriptEvent) {}
public function onSongEvent(event:SongEventScriptEvent)
{
}
/**
* Called when the countdown begins.
*/
public function onCountdownStart(event:CountdownScriptEvent) {}
public function onCountdownStart(event:CountdownScriptEvent)
{
}
/**
* Called for every step in the countdown.
*/
public function onCountdownStep(event:CountdownScriptEvent) {}
public function onCountdownStep(event:CountdownScriptEvent)
{
}
/**
* Called when the countdown ends, but BEFORE the song starts.
*/
public function onCountdownEnd(event:CountdownScriptEvent) {}
public function onCountdownEnd(event:CountdownScriptEvent)
{
}
/**
* Called when the song's chart has been parsed and loaded.
*/
public function onSongLoaded(event:SongLoadScriptEvent) {}
public function onSongLoaded(event:SongLoadScriptEvent)
{
}
/**
* Called when the game is about to switch to a new state.
*/
public function onStateChangeBegin(event:StateChangeScriptEvent) {}
public function onStateChangeBegin(event:StateChangeScriptEvent)
{
}
/**
* Called after the game has switched to a new state.
*/
public function onStateChangeEnd(event:StateChangeScriptEvent) {}
public function onStateChangeEnd(event:StateChangeScriptEvent)
{
}
/**
* Called when the game regains focus.
* This does not get called if "Pause on Unfocus" is disabled.
*/
public function onFocusGained(event:FocusScriptEvent) {}
public function onFocusGained(event:FocusScriptEvent)
{
}
/**
* Called when the game loses focus.
* This does not get called if "Pause on Unfocus" is disabled.
*/
public function onFocusLost(event:FocusScriptEvent) {}
public function onFocusLost(event:FocusScriptEvent)
{
}
/**
* Called when the game is about to open a substate.
*/
public function onSubStateOpenBegin(event:SubStateScriptEvent) {}
public function onSubStateOpenBegin(event:SubStateScriptEvent)
{
}
/**
* Called when a substate has been opened.
*/
public function onSubStateOpenEnd(event:SubStateScriptEvent) {}
public function onSubStateOpenEnd(event:SubStateScriptEvent)
{
}
/**
* Called when the game is about to close a substate.
*/
public function onSubStateCloseBegin(event:SubStateScriptEvent) {}
public function onSubStateCloseBegin(event:SubStateScriptEvent)
{
}
/**
* Called when a substate has been closed.
*/
public function onSubStateCloseEnd(event:SubStateScriptEvent) {}
public function onSubStateCloseEnd(event:SubStateScriptEvent)
{
}
/**
* Called when the song has been restarted.
*/
public function onSongRetry(event:SongRetryEvent) {}
public function onSongRetry(event:SongRetryEvent)
{
}
/**
* Called when any state is created.
*/
public function onStateCreate(event:ScriptEvent) {}
public function onStateCreate(event:ScriptEvent)
{
}
/**
* Called when a capsule is selected.
*/
public function onCapsuleSelected(event:CapsuleScriptEvent):Void {}
public function onCapsuleSelected(event:CapsuleScriptEvent):Void
{
}
/**
* Called when the current difficulty is changed.
*/
public function onDifficultySwitch(event:CapsuleScriptEvent):Void {}
public function onDifficultySwitch(event:CapsuleScriptEvent):Void
{
}
/**
* Called when a song is selected.
*/
public function onSongSelected(event:CapsuleScriptEvent):Void {}
public function onSongSelected(event:CapsuleScriptEvent):Void
{
}
/**
* Called when the intro for Freeplay finishes.
*/
public function onFreeplayIntroDone(event:FreeplayScriptEvent):Void {}
public function onFreeplayIntroDone(event:FreeplayScriptEvent):Void
{
}
/**
* Called when the Freeplay outro begins.
*/
public function onFreeplayOutro(event:FreeplayScriptEvent):Void {}
public function onFreeplayOutro(event:FreeplayScriptEvent):Void
{
}
/**
* Called when Freeplay is closed.
*/
public function onFreeplayClose(event:FreeplayScriptEvent):Void {}
public function onFreeplayClose(event:FreeplayScriptEvent):Void
{
}
/**
* Called when a character is selected.
*/
public function onCharacterSelect(event:CharacterSelectScriptEvent):Void {}
public function onCharacterSelect(event:CharacterSelectScriptEvent):Void
{
}
/**
* Called when the user presses BACK after confirming a character.
*/
public function onCharacterDeselect(event:CharacterSelectScriptEvent):Void {}
public function onCharacterDeselect(event:CharacterSelectScriptEvent):Void
{
}
/**
* Called when a character has been confirmed.
*/
public function onCharacterConfirm(event:CharacterSelectScriptEvent):Void {}
public function onCharacterConfirm(event:CharacterSelectScriptEvent):Void
{
}
}
@@ -7,4 +7,6 @@ import polymod.hscript.HScriptedClass;
* Create a scripted class that extends Module to use this.
*/
@:hscriptClass
class ScriptedModule extends Module implements HScriptedClass {}
class ScriptedModule extends Module implements HScriptedClass
{
}
+5 -4
View File
@@ -67,7 +67,8 @@ class Countdown
// The timer function gets called based on the beat of the song.
countdownTimer = new FlxTimer();
countdownTimer.start(Conductor.instance.beatLengthMs / 1000, function(tmr:FlxTimer) {
countdownTimer.start(Conductor.instance.beatLengthMs / 1000, function(tmr:FlxTimer)
{
if (PlayState.instance == null)
{
tmr.cancel();
@@ -229,10 +230,10 @@ class Countdown
if (noteStyle.isCountdownSpritePixel(index)) fadeEase = EaseUtil.stepped(8);
// Fade sprite in, then out, then destroy it.
FlxTween.tween(countdownSprite, {alpha: 0}, Conductor.instance.beatLengthMs / 1000,
{
FlxTween.tween(countdownSprite, {alpha: 0}, Conductor.instance.beatLengthMs / 1000, {
ease: fadeEase,
onComplete: function(twn:FlxTween) {
onComplete: function(twn:FlxTween)
{
countdownSprite.destroy();
}
});
+27 -12
View File
@@ -159,7 +159,9 @@ class GameOverSubState extends MusicBeatSubState
// Pluck Boyfriend from the PlayState and place him (in the same position) in the GameOverSubState.
// We can then play the character's `firstDeath` animation.
if ((parentPlayState?.isMinimalMode ?? true)) {}
if ((parentPlayState?.isMinimalMode ?? true))
{
}
else
{
boyfriend = parentPlayState?.currentStage?.getBoyfriend(true);
@@ -188,7 +190,8 @@ class GameOverSubState extends MusicBeatSubState
HapticUtil.vibrate(0, Constants.DEFAULT_VIBRATION_DURATION);
// Allow input a second later to prevent accidental gameover skips.
new FlxTimer().start(1, function(tmr:FlxTimer) {
new FlxTimer().start(1, function(tmr:FlxTimer)
{
canInput = true;
});
}
@@ -339,7 +342,8 @@ class GameOverSubState extends MusicBeatSubState
// Start music at lower volume
startDeathMusic(0.2, false);
boyfriend.playAnimation('deathLoop' + animationSuffix);
deathQuoteSound = FunkinSound.playOnce(deathQuote, function() {
deathQuoteSound = FunkinSound.playOnce(deathQuote, function()
{
// Once the quote ends, fade in the game over music.
if (!isEnding && gameOverMusic != null)
{
@@ -367,7 +371,9 @@ class GameOverSubState extends MusicBeatSubState
startDeathMusic(1.0, true); // isEnding changes this function's behavior.
if ((parentPlayState?.isMinimalMode ?? true) || boyfriend == null) {}
if ((parentPlayState?.isMinimalMode ?? true) || boyfriend == null)
{
}
else
{
boyfriend.playAnimation('deathConfirm' + animationSuffix, true);
@@ -378,17 +384,21 @@ class GameOverSubState extends MusicBeatSubState
final FADE_TIMER:Float = (gameOverMusic?.length ?? 0) / 7000;
// After the animation finishes...
new FlxTimer().start(FADE_TIMER, function(tmr:FlxTimer) {
new FlxTimer().start(FADE_TIMER, function(tmr:FlxTimer)
{
// ...fade out the graphics. Then after that happens...
var resetPlaying = function(pixel:Bool = false) {
var resetPlaying = function(pixel:Bool = false)
{
// ...close the GameOverSubState.
if (pixel) RetroCameraFade.fadeBlack(FlxG.camera, 10, 1);
else
FlxG.camera.fade(FlxColor.BLACK, 1, true, null, true);
if (parentPlayState != null) parentPlayState.needsReset = true;
if ((parentPlayState?.isMinimalMode ?? true) || boyfriend == null) {}
if ((parentPlayState?.isMinimalMode ?? true) || boyfriend == null)
{
}
else
{
// Readd Boyfriend to the stage.
@@ -407,12 +417,14 @@ class GameOverSubState extends MusicBeatSubState
if (musicSuffix.contains('-pixel'))
{
RetroCameraFade.fadeToBlack(FlxG.camera, 10, 2);
new FlxTimer().start(2, _ -> {
new FlxTimer().start(2, _ ->
{
FlxG.camera.filters = [];
#if FEATURE_MOBILE_ADVERTISEMENTS
if (AdMobUtil.PLAYING_COUNTER >= AdMobUtil.MAX_BEFORE_AD)
{
AdMobUtil.loadInterstitial(function():Void {
AdMobUtil.loadInterstitial(function():Void
{
AdMobUtil.PLAYING_COUNTER = 0;
resetPlaying(true);
});
@@ -426,11 +438,13 @@ class GameOverSubState extends MusicBeatSubState
}
else
{
FlxG.camera.fade(FlxColor.BLACK, 2, false, function() {
FlxG.camera.fade(FlxColor.BLACK, 2, false, function()
{
#if FEATURE_MOBILE_ADVERTISEMENTS
if (AdMobUtil.PLAYING_COUNTER >= AdMobUtil.MAX_BEFORE_AD)
{
AdMobUtil.loadInterstitial(function():Void {
AdMobUtil.loadInterstitial(function():Void
{
AdMobUtil.PLAYING_COUNTER = 0;
resetPlaying();
});
@@ -494,7 +508,8 @@ class GameOverSubState extends MusicBeatSubState
}
else
{
onComplete = function() {
onComplete = function()
{
isStarting = false;
// We need to force to ensure that the non-starting music plays.
startDeathMusic(1.0, true);
+34 -46
View File
@@ -56,50 +56,35 @@ class PauseSubState extends MusicBeatSubState
/**
* Pause menu entries for when the game is paused during a song.
*/
static final PAUSE_MENU_ENTRIES_STANDARD:Array<PauseMenuEntry> = [
{text: 'Resume', callback: resume},
{text: 'Restart Song', callback: restartPlayState},
{text: 'Change Difficulty', callback: switchMode.bind(_, Difficulty)},
{text: 'Enable Practice Mode', callback: enablePracticeMode, filter: () -> !(PlayState.instance?.isPracticeMode ?? false)},
{text: 'Exit to Menu', callback: quitToMenu},
];
static final PAUSE_MENU_ENTRIES_STANDARD:Array<PauseMenuEntry> = [{text: 'Resume', callback: resume}, {text: 'Restart Song',
callback: restartPlayState}, {text: 'Change Difficulty', callback: switchMode.bind(_,
Difficulty)}, {text: 'Enable Practice Mode', callback: enablePracticeMode, filter: () ->
!(PlayState.instance?.isPracticeMode ?? false)}, {text: 'Exit to Menu', callback: quitToMenu},];
/**
* Pause menu entries for when the game is paused in the Chart Editor preview.
*/
static final PAUSE_MENU_ENTRIES_CHARTING:Array<PauseMenuEntry> = [
{text: 'Resume', callback: resume},
{text: 'Restart Song', callback: restartPlayState},
{text: 'Return to Chart Editor', callback: quitToChartEditor},
];
static final PAUSE_MENU_ENTRIES_CHARTING:Array<PauseMenuEntry> = [{text: 'Resume', callback: resume}, {text: 'Restart Song',
callback: restartPlayState}, {text: 'Return to Chart Editor', callback: quitToChartEditor},];
/**
* Pause menu entries for when the user selects "Change Difficulty".
*/
static final PAUSE_MENU_ENTRIES_DIFFICULTY:Array<PauseMenuEntry> = [
{text: 'Back', callback: switchMode.bind(_, Standard)}
// Other entries are added dynamically.
static final PAUSE_MENU_ENTRIES_DIFFICULTY:Array<PauseMenuEntry> = [{text: 'Back', callback: switchMode.bind(_,
Standard)} // Other entries are added dynamically.
];
/**
* Pause menu entries for when the game is paused during a video cutscene.
*/
static final PAUSE_MENU_ENTRIES_VIDEO_CUTSCENE:Array<PauseMenuEntry> = [
{text: 'Resume', callback: resume},
{text: 'Skip Cutscene', callback: skipVideoCutscene},
{text: 'Restart Cutscene', callback: restartVideoCutscene},
{text: 'Exit to Menu', callback: quitToMenu},
];
static final PAUSE_MENU_ENTRIES_VIDEO_CUTSCENE:Array<PauseMenuEntry> = [{text: 'Resume', callback: resume}, {text: 'Skip Cutscene',
callback: skipVideoCutscene}, {text: 'Restart Cutscene', callback: restartVideoCutscene}, {text: 'Exit to Menu', callback: quitToMenu},];
/**
* Pause menu entries for when the game is paused during a conversation.
*/
static final PAUSE_MENU_ENTRIES_CONVERSATION:Array<PauseMenuEntry> = [
{text: 'Resume', callback: resume},
{text: 'Skip Dialogue', callback: skipConversation},
{text: 'Restart Dialogue', callback: restartConversation},
{text: 'Exit to Menu', callback: quitToMenu},
];
static final PAUSE_MENU_ENTRIES_CONVERSATION:Array<PauseMenuEntry> = [{text: 'Resume', callback: resume}, {text: 'Skip Dialogue',
callback: skipConversation}, {text: 'Restart Dialogue', callback: restartConversation}, {text: 'Exit to Menu', callback: quitToMenu},];
/**
* Duration for the music to fade in when the pause menu is opened.
@@ -398,9 +383,8 @@ class PauseSubState extends MusicBeatSubState
pauseButton = FunkinSprite.createSparrow(0, 0, "pauseButton");
pauseButton.animation.addByIndices('idle', 'pause', [0], "", 24, false);
pauseButton.animation.addByIndices('hold', 'pause', [5], "", 24, false);
pauseButton.animation.addByIndices('confirm', 'pause', [
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
], "", 24, false);
pauseButton.animation.addByIndices('confirm', 'pause',
[6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "", 24, false);
pauseButton.scale.set(0.8, 0.8);
pauseButton.updateHitbox();
pauseButton.animation.play("confirm");
@@ -504,11 +488,11 @@ class PauseSubState extends MusicBeatSubState
function startCharterTimer():Void
{
charterFadeTween = FlxTween.tween(metadataArtist, {alpha: 0.0}, CHARTER_FADE_DURATION,
{
charterFadeTween = FlxTween.tween(metadataArtist, {alpha: 0.0}, CHARTER_FADE_DURATION, {
startDelay: CHARTER_FADE_DELAY,
ease: FlxEase.quartOut,
onComplete: (_) -> {
onComplete: (_) ->
{
if (PlayState.instance?.currentChart != null)
{
metadataArtist.text = 'Charter: ${PlayState.instance.currentChart.charter ?? 'Unknown'}';
@@ -518,10 +502,10 @@ class PauseSubState extends MusicBeatSubState
metadataArtist.text = 'Charter: ${Constants.DEFAULT_CHARTER}';
}
FlxTween.tween(metadataArtist, {alpha: 1.0}, CHARTER_FADE_DURATION,
{
FlxTween.tween(metadataArtist, {alpha: 1.0}, CHARTER_FADE_DURATION, {
ease: FlxEase.quartOut,
onComplete: (_) -> {
onComplete: (_) ->
{
startArtistTimer();
}
});
@@ -531,11 +515,11 @@ class PauseSubState extends MusicBeatSubState
function startArtistTimer():Void
{
charterFadeTween = FlxTween.tween(metadataArtist, {alpha: 0.0}, CHARTER_FADE_DURATION,
{
charterFadeTween = FlxTween.tween(metadataArtist, {alpha: 0.0}, CHARTER_FADE_DURATION, {
startDelay: CHARTER_FADE_DELAY,
ease: FlxEase.quartOut,
onComplete: (_) -> {
onComplete: (_) ->
{
if (PlayState.instance?.currentChart != null)
{
metadataArtist.text = 'Artist: ${PlayState.instance.currentChart.songArtist}';
@@ -545,10 +529,10 @@ class PauseSubState extends MusicBeatSubState
metadataArtist.text = 'Artist: ${Constants.DEFAULT_ARTIST}';
}
FlxTween.tween(metadataArtist, {alpha: 1.0}, CHARTER_FADE_DURATION,
{
FlxTween.tween(metadataArtist, {alpha: 1.0}, CHARTER_FADE_DURATION, {
ease: FlxEase.quartOut,
onComplete: (_) -> {
onComplete: (_) ->
{
startCharterTimer();
}
});
@@ -575,11 +559,13 @@ class PauseSubState extends MusicBeatSubState
FlxTween.tween(pauseCircle.scale, {x: 0.84 * 0.8, y: 0.8 * 0.8}, 0.4, {ease: FlxEase.backInOut});
FlxTween.tween(pauseCircle, {alpha: 0}, 0.6, {ease: FlxEase.quartOut});
hapticTimer.start(0.2, function(_) {
hapticTimer.start(0.2, function(_)
{
HapticUtil.vibrate(0, 0.01, 0.5);
});
dataFadeTimer.start(0.3, function(_) {
dataFadeTimer.start(0.3, function(_)
{
transitionMetadataIn();
FlxTween.tween(pauseButton, {alpha: 0}, 0.6, {ease: FlxEase.quartOut});
});
@@ -1016,7 +1002,8 @@ class PauseSubState extends MusicBeatSubState
{
state.allowInput = false;
AdMobUtil.loadInterstitial(function():Void {
AdMobUtil.loadInterstitial(function():Void
{
AdMobUtil.PLAYING_COUNTER = 0;
AdMobUtil.removeBanner();
@@ -1052,7 +1039,8 @@ class PauseSubState extends MusicBeatSubState
{
state.allowInput = false;
AdMobUtil.loadInterstitial(function():Void {
AdMobUtil.loadInterstitial(function():Void
{
AdMobUtil.PLAYING_COUNTER = 0;
AdMobUtil.removeBanner();
+66 -94
View File
@@ -744,8 +744,7 @@ class PlayState extends MusicBeatSubState
super();
// Validate parameters.
var params:PlayStateParams = params ??
{
var params:PlayStateParams = params ?? {
trace('WARNING: PlayState constructor called with no parameters. Reusing previous parameters.');
lastParams ?? throw 'PlayState constructor called with no available parameters.';
}
@@ -1127,7 +1126,8 @@ class PlayState extends MusicBeatSubState
Conductor.instance.update(-vwooshDelay * 1000 + startTimestamp + Conductor.instance.beatLengthMs * -5);
// timer for vwoosh
vwooshTimer.start(vwooshDelay, function(_) {
vwooshTimer.start(vwooshDelay, function(_)
{
if (playerStrumline.notes.length == 0) playerStrumline.updateNotes();
if (opponentStrumline.notes.length == 0) opponentStrumline.updateNotes();
playerStrumline.vwooshInNotes();
@@ -1303,7 +1303,8 @@ class PlayState extends MusicBeatSubState
var deathPreTransitionDelay = currentStage?.getBoyfriend()?.getDeathPreTransitionDelay() ?? 0.0;
if (deathPreTransitionDelay > 0)
{
new FlxTimer().start(deathPreTransitionDelay, function(_) {
new FlxTimer().start(deathPreTransitionDelay, function(_)
{
moveToGameOver();
});
}
@@ -1314,8 +1315,7 @@ class PlayState extends MusicBeatSubState
}
#if FEATURE_DISCORD_RPC
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
details: 'Game Over - ${buildDiscordRPCDetails()}',
state: buildDiscordRPCState(),
@@ -1403,8 +1403,7 @@ class PlayState extends MusicBeatSubState
}
#if FEATURE_DISCORD_RPC
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
details: 'Paused - ${buildDiscordRPCDetails()}',
state: buildDiscordRPCState(),
largeImageKey: discordRPCAlbum,
@@ -1462,8 +1461,7 @@ class PlayState extends MusicBeatSubState
isGameOverState = true;
shouldSubstatePause = true;
// Transition to the game over substate.
var gameOverSubState = new GameOverSubState(
{
var gameOverSubState = new GameOverSubState({
isChartingMode: isChartingMode,
transparent: persistentDraw
});
@@ -1556,7 +1554,8 @@ class PlayState extends MusicBeatSubState
// Vocals are also paused here but are not included as they are handled separately.
if (Std.isOfType(subState, PauseSubState))
{
FlxG.sound.list.forEachAlive(function(sound:FlxSound) {
FlxG.sound.list.forEachAlive(function(sound:FlxSound)
{
if (!sound.active || sound == FlxG.sound.music) return;
// In case it's a scheduled sound
if (Std.isOfType(sound, FunkinSound))
@@ -1569,7 +1568,8 @@ class PlayState extends MusicBeatSubState
soundsPausedBySubState.add(sound);
});
vocals?.forEach(function(voice:FunkinSound) {
vocals?.forEach(function(voice:FunkinSound)
{
soundsPausedBySubState.remove(voice);
});
}
@@ -1633,7 +1633,8 @@ class PlayState extends MusicBeatSubState
// Vocals are also paused here but are not included as they are handled separately.
if (!isGameOverState)
{
FlxG.sound.list.forEachAlive(function(sound:FlxSound) {
FlxG.sound.list.forEachAlive(function(sound:FlxSound)
{
if (!sound.active || sound == FlxG.sound.music) return;
// In case it's a scheduled sound
if (Std.isOfType(sound, FunkinSound))
@@ -1646,7 +1647,8 @@ class PlayState extends MusicBeatSubState
soundsPausedBySubState.add(sound);
});
vocals?.forEach(function(voice:FunkinSound) {
vocals?.forEach(function(voice:FunkinSound)
{
soundsPausedBySubState.remove(voice);
});
}
@@ -1698,8 +1700,7 @@ class PlayState extends MusicBeatSubState
{
// DiscordClient.changePresence(detailsText, '${currentChart.songName} ($discordRPCDifficulty)', discordRPCIcon, true,
// currentSongLengthMs - Conductor.instance.songPosition);
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
state: buildDiscordRPCState(),
details: buildDiscordRPCDetails(),
@@ -1709,8 +1710,7 @@ class PlayState extends MusicBeatSubState
}
else
{
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
state: buildDiscordRPCState(),
details: buildDiscordRPCDetails(),
@@ -1742,8 +1742,7 @@ class PlayState extends MusicBeatSubState
{
if (Conductor.instance.songPosition > 0.0)
{
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
state: buildDiscordRPCState(),
details: buildDiscordRPCDetails(),
@@ -1753,8 +1752,7 @@ class PlayState extends MusicBeatSubState
}
else
{
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
state: buildDiscordRPCState(),
details: buildDiscordRPCDetails(),
@@ -1782,8 +1780,7 @@ class PlayState extends MusicBeatSubState
#if FEATURE_DISCORD_RPC
if (health > Constants.HEALTH_MIN && !isGamePaused && Preferences.autoPause)
{
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
state: buildDiscordRPCState(),
details: buildDiscordRPCDetails(),
@@ -1889,12 +1886,14 @@ class PlayState extends MusicBeatSubState
@:nullSafety(Off)
@:privateAccess // todo: maybe make the groups public :thinking:
{
vocals.playerVoices?.forEachAlive(function(voice:FunkinSound) {
vocals.playerVoices?.forEachAlive(function(voice:FunkinSound)
{
var currentRawVoiceTime:Float = voice.time + vocals.playerVoicesOffset;
if (Math.abs(currentRawVoiceTime - correctSync) > Math.abs(playerVoicesError)) playerVoicesError = currentRawVoiceTime - correctSync;
});
vocals.opponentVoices?.forEachAlive(function(voice:FunkinSound) {
vocals.opponentVoices?.forEachAlive(function(voice:FunkinSound)
{
var currentRawVoiceTime:Float = voice.time + vocals.opponentVoicesOffset;
if (Math.abs(currentRawVoiceTime - correctSync) > Math.abs(opponentVoicesError)) opponentVoicesError = currentRawVoiceTime - correctSync;
});
@@ -1942,7 +1941,8 @@ class PlayState extends MusicBeatSubState
public override function initConsoleHelpers():Void
{
FlxG.console.registerFunction("debugUnbindCameraZoom", () -> {
FlxG.console.registerFunction("debugUnbindCameraZoom", () ->
{
debugUnbindCameraZoom = !debugUnbindCameraZoom;
});
};
@@ -2290,9 +2290,8 @@ class PlayState extends MusicBeatSubState
{
pauseButton.animation.addByIndices('idle', 'back', [0], "", 24, false);
pauseButton.animation.addByIndices('hold', 'back', [5], "", 24, false);
pauseButton.animation.addByIndices('confirm', 'back', [
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
], "", 24, false);
pauseButton.animation.addByIndices('confirm', 'back',
[6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "", 24, false);
pauseButton.scale.set(0.8, 0.8);
pauseButton.updateHitbox();
pauseButton.animation.play("idle");
@@ -2308,7 +2307,8 @@ class PlayState extends MusicBeatSubState
add(pauseCircle);
add(pauseButton);
hitbox?.forEachAlive(function(hint:FunkinHint) {
hitbox?.forEachAlive(function(hint:FunkinHint)
{
hint.deadZones.push(pauseButton);
});
@@ -2347,8 +2347,7 @@ class PlayState extends MusicBeatSubState
// Determine the details strings once and reuse them.
// Updating Discord Rich Presence.
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
state: buildDiscordRPCState(),
details: buildDiscordRPCDetails(),
@@ -2359,8 +2358,7 @@ class PlayState extends MusicBeatSubState
#if FEATURE_DISCORD_RPC
// Updating Discord Rich Presence.
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
state: buildDiscordRPCState(),
details: buildDiscordRPCDetails(),
largeImageKey: discordRPCAlbum,
@@ -2594,7 +2592,8 @@ class PlayState extends MusicBeatSubState
return;
}
FlxG.sound.music.onComplete = function() {
FlxG.sound.music.onComplete = function()
{
if (mayPauseGame) endSong(skipEndingTransition);
};
@@ -2637,8 +2636,7 @@ class PlayState extends MusicBeatSubState
#if FEATURE_DISCORD_RPC
// Updating Discord Rich Presence (with Time Left)
DiscordClient.instance.setPresence(
{
DiscordClient.instance.setPresence({
state: buildDiscordRPCState(),
details: buildDiscordRPCDetails(),
@@ -3114,12 +3112,7 @@ class PlayState extends MusicBeatSubState
if (!isPracticeMode)
{
// messy copy paste rn lol
var pressArray:Array<Bool> = [
controls.NOTE_LEFT_P,
controls.NOTE_DOWN_P,
controls.NOTE_UP_P,
controls.NOTE_RIGHT_P
];
var pressArray:Array<Bool> = [controls.NOTE_LEFT_P, controls.NOTE_DOWN_P, controls.NOTE_UP_P, controls.NOTE_RIGHT_P];
var indices:Array<Int> = [];
for (i in 0...pressArray.length)
@@ -3162,12 +3155,7 @@ class PlayState extends MusicBeatSubState
if (!isPracticeMode)
{
var pressArray:Array<Bool> = [
controls.NOTE_LEFT_P,
controls.NOTE_DOWN_P,
controls.NOTE_UP_P,
controls.NOTE_RIGHT_P
];
var pressArray:Array<Bool> = [controls.NOTE_LEFT_P, controls.NOTE_DOWN_P, controls.NOTE_UP_P, controls.NOTE_RIGHT_P];
var indices:Array<Int> = [];
for (i in 0...pressArray.length)
@@ -3200,8 +3188,7 @@ class PlayState extends MusicBeatSubState
var bf:String = currentStage?.getBoyfriend()?.characterId ?? '';
var gf:String = currentStage?.getGirlfriend()?.characterId ?? '';
var dad:String = currentStage?.getDad()?.characterId ?? '';
FlxG.switchState(() -> new StageEditorState(
{
FlxG.switchState(() -> new StageEditorState({
targetStageId: currentStageId,
targetBfChar: bf,
targetGfChar: gf,
@@ -3225,8 +3212,7 @@ class PlayState extends MusicBeatSubState
else
{
if (currentStage != null) this.remove(currentStage);
FlxG.switchState(() -> new ChartEditorState(
{
FlxG.switchState(() -> new ChartEditorState({
targetSongId: currentSong.id,
targetSongDifficulty: currentDifficulty,
targetSongVariation: currentVariation,
@@ -3326,12 +3312,7 @@ class PlayState extends MusicBeatSubState
if (!isPracticeMode)
{
// TODO: Input splitter uses old input system, make it pull from the precise input queue directly.
var pressArray:Array<Bool> = [
controls.NOTE_LEFT_P,
controls.NOTE_DOWN_P,
controls.NOTE_UP_P,
controls.NOTE_RIGHT_P
];
var pressArray:Array<Bool> = [controls.NOTE_LEFT_P, controls.NOTE_DOWN_P, controls.NOTE_UP_P, controls.NOTE_RIGHT_P];
var indices:Array<Int> = [];
for (i in 0...pressArray.length)
@@ -3437,11 +3418,9 @@ class PlayState extends MusicBeatSubState
if (currentSong != null && currentSong.validScore)
{
// crackhead double thingie, sets whether was new highscore, AND saves the song!
var data =
{
var data = {
score: songScore,
tallies:
{
tallies: {
sick: Highscore.tallies.sick,
good: Highscore.tallies.good,
bad: Highscore.tallies.bad,
@@ -3474,7 +3453,9 @@ class PlayState extends MusicBeatSubState
// If neither are higher, nothing will change.
Save.instance.applySongRank(currentSong.id, suffixedDifficulty, data);
if (isNewHighscore) {}
if (isNewHighscore)
{
}
}
}
@@ -3486,11 +3467,9 @@ class PlayState extends MusicBeatSubState
if (Date.now().getDay() == 5) Medals.award(FridayNight);
// Determine the score rank for this song we just finished.
var scoreRank:Null<ScoringRank> = Scoring.calculateRank(
{
var scoreRank:Null<ScoringRank> = Scoring.calculateRank({
score: songScore,
tallies:
{
tallies: {
sick: Highscore.tallies.sick,
good: Highscore.tallies.good,
bad: Highscore.tallies.bad,
@@ -3534,11 +3513,9 @@ class PlayState extends MusicBeatSubState
{
if (currentSong.validScore)
{
var data =
{
var data = {
score: PlayStatePlaylist.campaignScore,
tallies:
{
tallies: {
// TODO: Sum up the values for the whole week!
sick: 0,
good: 0,
@@ -3610,7 +3587,8 @@ class PlayState extends MusicBeatSubState
camHUD.visible = false;
isInCutscene = true;
FunkinSound.playOnce(Paths.sound('Lights_Shut_off'), function() {
FunkinSound.playOnce(Paths.sound('Lights_Shut_off'), function()
{
// no camFollow so it centers on horror tree
var targetSong:Song = SongRegistry.instance.fetchEntry(targetSongId) ?? throw 'Could not find a song with the ID $targetSongId';
var targetVariation:String = currentVariation;
@@ -3619,8 +3597,7 @@ class PlayState extends MusicBeatSubState
targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION;
}
if (currentStage != null) this.remove(currentStage);
LoadingState.loadPlayState(
{
LoadingState.loadPlayState({
targetSong: targetSong,
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
targetVariation: targetVariation,
@@ -3637,8 +3614,7 @@ class PlayState extends MusicBeatSubState
targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION;
}
if (currentStage != null) this.remove(currentStage);
LoadingState.loadPlayState(
{
LoadingState.loadPlayState({
targetSong: targetSong,
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
targetVariation: targetVariation,
@@ -3795,15 +3771,16 @@ class PlayState extends MusicBeatSubState
// Replace zoom animation with a fade out for now.
FlxG.camera.fade(FlxColor.BLACK, 0.6);
FlxTween.tween(camHUD, {alpha: 0}, 0.6,
FlxTween.tween(camHUD, {alpha: 0}, 0.6, {
onComplete: function(_)
{
onComplete: function(_) {
moveToResultsScreen(isNewHighscore, prevScoreData);
}
});
// Zoom in on Girlfriend (or BF if no GF)
new FlxTimer().start(0.8, function(_) {
new FlxTimer().start(0.8, function(_)
{
if (targetBF)
{
boyfriend?.animation.play('hey');
@@ -3833,8 +3810,7 @@ class PlayState extends MusicBeatSubState
*/
function moveToResultsScreen(isNewHighscore:Bool, ?prevScoreData:SaveScoreData):Void
{
var currentChart:SongDifficulty = currentChart ??
{
var currentChart:SongDifficulty = currentChart ?? {
trace('ERROR: Cannot move to results screen with a null chart.');
return;
}
@@ -3844,8 +3820,7 @@ class PlayState extends MusicBeatSubState
camHUD.alpha = 1;
var talliesToUse:Tallies = PlayStatePlaylist.isStoryMode ? Highscore.talliesLevel : Highscore.tallies;
var res:ResultState = new ResultState(
{
var res:ResultState = new ResultState({
storyMode: PlayStatePlaylist.isStoryMode,
songId: currentChart.song.id,
difficultyId: currentDifficulty,
@@ -3853,11 +3828,9 @@ class PlayState extends MusicBeatSubState
characterId: currentChart.characters.player,
title: PlayStatePlaylist.isStoryMode ? ('${PlayStatePlaylist.campaignTitle}') : ('${currentChart.songName} by ${currentChart.songArtist}'),
prevScoreData: prevScoreData,
scoreData:
{
scoreData: {
score: PlayStatePlaylist.isStoryMode ? PlayStatePlaylist.campaignScore : songScore,
tallies:
{
tallies: {
sick: talliesToUse.sick,
good: talliesToUse.good,
bad: talliesToUse.bad,
@@ -3939,10 +3912,10 @@ class PlayState extends MusicBeatSubState
// Follow tween! Caching it so we can cancel/pause it later if needed.
var followPos:FlxPoint = cameraFollowPoint.getPosition() - FlxPoint.weak(FlxG.camera.width * 0.5, FlxG.camera.height * 0.5);
cameraFollowTween = FlxTween.tween(FlxG.camera.scroll, {x: followPos.x, y: followPos.y}, duration,
{
cameraFollowTween = FlxTween.tween(FlxG.camera.scroll, {x: followPos.x, y: followPos.y}, duration, {
ease: ease,
onComplete: function(_) {
onComplete: function(_)
{
resetCamera(false, false); // Re-enable camera following when the tween is complete.
}
});
@@ -4030,8 +4003,7 @@ class PlayState extends MusicBeatSubState
}
else
{
scrollSpeedTweens.push(FlxTween.tween(strum,
{
scrollSpeedTweens.push(FlxTween.tween(strum, {
'scrollSpeed': value
}, duration, {ease: ease}));
}
+10 -9
View File
@@ -56,7 +56,8 @@ class ResultScore extends FlxTypedSpriteGroup<ScoreNum>
{
// if(i.finalDigit == 10) continue;
new FlxTimer().start((i - 1) / 24, _ -> {
new FlxTimer().start((i - 1) / 24, _ ->
{
group.members[i].finalDelay = scoreStart - (i - 1);
group.members[i].playAnim();
group.members[i].shuffle();
@@ -145,23 +146,23 @@ class ScoreNum extends FlxSprite
public var baseY:Float = 0;
public var baseX:Float = 0;
var numToString:Array<String> = [
"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "DISABLED"
];
var numToString:Array<String> = ["ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "DISABLED"];
function finishShuffleTween():Void
{
var tweenFunction = function(x) {
var tweenFunction = function(x)
{
var digitRounded = Math.floor(x);
// if(digitRounded == finalDigit) glow = true;
digit = digitRounded;
};
finalTween = FlxTween.num(0.0, finalDigit, 23 / 24,
{
finalTween = FlxTween.num(0.0, finalDigit, 23 / 24, {
ease: FlxEase.quadOut,
onComplete: function(input) {
new FlxTimer().start((finalDelay) / 24, _ -> {
onComplete: function(input)
{
new FlxTimer().start((finalDelay) / 24, _ ->
{
animation.play(animation.curAnim.name, true, false, 0);
});
// fuck
+81 -62
View File
@@ -200,7 +200,8 @@ class ResultState extends MusicBeatSubState
var soundSystem:FlxSprite = FunkinSprite.createSparrow(-15 + FullScreenScaleMode.gameNotchSize.x, -180, 'resultScreen/soundSystem');
soundSystem.animation.addByPrefix("idle", "sound system", 24, false);
soundSystem.visible = false;
new FlxTimer().start(8 / 24, _ -> {
new FlxTimer().start(8 / 24, _ ->
{
soundSystem.animation.play("idle");
soundSystem.visible = true;
});
@@ -260,7 +261,8 @@ class ResultState extends MusicBeatSubState
if (!(animData.looped ?? true))
{
// Animation is not looped.
animation.anim.onFinish.add((_name:String) -> {
animation.anim.onFinish.add((_name:String) ->
{
if (animation != null)
{
animation.anim.pause();
@@ -269,7 +271,8 @@ class ResultState extends MusicBeatSubState
}
else if (animData.loopFrameLabel != null)
{
animation.anim.onFinish.add((_name:String) -> {
animation.anim.onFinish.add((_name:String) ->
{
if (animation != null)
{
animation.anim.play(animData.loopFrameLabel ?? '', true); // unpauses this anim, since it's on PlayOnce!
@@ -279,7 +282,8 @@ class ResultState extends MusicBeatSubState
}
else if (animData.loopFrame != null)
{
animation.anim.onFinish.add((_name:String) -> {
animation.anim.onFinish.add((_name:String) ->
{
if (animation != null)
{
animation.anim.play("", true, false, animData.loopFrame ?? 0); // unpauses this anim, since it's on PlayOnce!
@@ -290,8 +294,7 @@ class ResultState extends MusicBeatSubState
// Hide until ready to play.
animation.visible = false;
// Queue to play.
characterAtlasAnimations.push(
{
characterAtlasAnimations.push({
sprite: animation,
delay: animData.delay ?? 0.0,
forceLoop: (animData.loopFrame ?? -1) == 0,
@@ -315,7 +318,8 @@ class ResultState extends MusicBeatSubState
if (animData.loopFrame != null)
{
animation.animation.onFinish.add((_name:String) -> {
animation.animation.onFinish.add((_name:String) ->
{
if (animation != null)
{
animation.animation.play('idle', true, false, animData.loopFrame ?? 0);
@@ -326,8 +330,7 @@ class ResultState extends MusicBeatSubState
// Hide until ready to play.
animation.visible = false;
// Queue to play.
characterSparrowAnimations.push(
{
characterSparrowAnimations.push({
sprite: animation,
delay: animData.delay ?? 0.0
});
@@ -367,7 +370,8 @@ class ResultState extends MusicBeatSubState
resultsAnim.visible = false;
resultsAnim.zIndex = 1200;
add(resultsAnim);
new FlxTimer().start(6 / 24, _ -> {
new FlxTimer().start(6 / 24, _ ->
{
resultsAnim.visible = true;
resultsAnim.animation.play("result");
});
@@ -376,7 +380,8 @@ class ResultState extends MusicBeatSubState
ratingsPopin.visible = false;
ratingsPopin.zIndex = 1200;
add(ratingsPopin);
new FlxTimer().start(21 / 24, _ -> {
new FlxTimer().start(21 / 24, _ ->
{
ratingsPopin.visible = true;
ratingsPopin.animation.play("idle");
});
@@ -385,23 +390,28 @@ class ResultState extends MusicBeatSubState
scorePopin.visible = false;
scorePopin.zIndex = 1200;
add(scorePopin);
new FlxTimer().start(36 / 24, _ -> {
new FlxTimer().start(36 / 24, _ ->
{
scorePopin.visible = true;
scorePopin.animation.play("score");
scorePopin.animation.onFinish.add(anim -> {});
scorePopin.animation.onFinish.add(anim -> {
});
});
new FlxTimer().start(37 / 24, _ -> {
new FlxTimer().start(37 / 24, _ ->
{
score.visible = true;
score.animateNumbers();
startRankTallySequence();
});
new FlxTimer().start(rank.getBFDelay(), _ -> {
new FlxTimer().start(rank.getBFDelay(), _ ->
{
afterRankTallySequence();
});
new FlxTimer().start(rank.getFlashDelay(), _ -> {
new FlxTimer().start(rank.getFlashDelay(), _ ->
{
displayRankText();
});
@@ -413,7 +423,8 @@ class ResultState extends MusicBeatSubState
highscoreNew.zIndex = 1200;
add(highscoreNew);
new FlxTimer().start(rank.getHighscoreDelay(), _ -> {
new FlxTimer().start(rank.getHighscoreDelay(), _ ->
{
if (params.isNewHighscore ?? false)
{
highscoreNew.visible = true;
@@ -480,7 +491,8 @@ class ResultState extends MusicBeatSubState
for (ind => rating in ratingGrp.members)
{
rating.visible = false;
new FlxTimer().start((0.3 * ind) + 1.20, _ -> {
new FlxTimer().start((0.3 * ind) + 1.20, _ ->
{
rating.visible = true;
FlxTween.tween(rating, {curNumber: rating.neededNumber}, 0.5, {ease: FlxEase.quartOut});
});
@@ -497,7 +509,8 @@ class ResultState extends MusicBeatSubState
// highscoreNew.visible = false;
// }
new FlxTimer().start(rank.getMusicDelay(), _ -> {
new FlxTimer().start(rank.getMusicDelay(), _ ->
{
var musicPath = getMusicPath(playerCharacter, rank);
var introMusic:String = Paths.music('$musicPath/$musicPath-intro');
@@ -510,7 +523,8 @@ class ResultState extends MusicBeatSubState
var musicLoop:FunkinSound = FunkinSound.load(mainMusic, 1.0, true, true, false, false, null, null, true);
// Play the intro music.
introMusicAudio = FunkinSound.load(introMusic, 1.0, false, true, true, () -> {
introMusicAudio = FunkinSound.load(introMusic, 1.0, false, true, true, () ->
{
introMusicAudio = null;
musicLoop.play();
if (!isChartingMode) // Don't override the music and cause problems on the chart editor
@@ -524,8 +538,7 @@ class ResultState extends MusicBeatSubState
}
else
{
if (!isChartingMode) FunkinSound.playMusic(musicPath,
{
if (!isChartingMode) FunkinSound.playMusic(musicPath, {
startingVolume: 1.0,
overrideExisting: true,
restartTrack: true
@@ -572,10 +585,10 @@ class ResultState extends MusicBeatSubState
var clearPercentCounter:ClearPercentCounter = new ClearPercentCounter((FlxG.width / 2 + 190) + (FullScreenScaleMode.gameCutoutSize.x / 2),
FlxG.height / 2 - 70, clearPercentLerp);
FlxTween.tween(clearPercentCounter, {curNumber: clearPercentTarget}, 58 / 24,
{
FlxTween.tween(clearPercentCounter, {curNumber: clearPercentTarget}, 58 / 24, {
ease: FlxEase.quartOut,
onUpdate: _ -> {
onUpdate: _ ->
{
clearPercentLerp = Math.round(clearPercentLerp);
clearPercentCounter.curNumber = Math.round(clearPercentCounter.curNumber);
// Only play the tick sound if the number increased.
@@ -589,7 +602,8 @@ class ResultState extends MusicBeatSubState
HapticUtil.vibrate(0, 0.01);
}
},
onComplete: _ -> {
onComplete: _ ->
{
// Strong vibration when rank number tween ends.
HapticUtil.vibrate(Constants.DEFAULT_VIBRATION_PERIOD, Constants.DEFAULT_VIBRATION_DURATION * 5, Constants.MAX_VIBRATION_AMPLITUDE);
@@ -606,19 +620,21 @@ class ResultState extends MusicBeatSubState
#end
clearPercentCounter.flash(true);
new FlxTimer().start(0.4, _ -> {
new FlxTimer().start(0.4, _ ->
{
clearPercentCounter.flash(false);
});
// displayRankText();
// previously 2.0 seconds
new FlxTimer().start(0.25, _ -> {
FlxTween.tween(clearPercentCounter, {alpha: 0}, 0.5,
new FlxTimer().start(0.25, _ ->
{
FlxTween.tween(clearPercentCounter, {alpha: 0}, 0.5, {
startDelay: 0.5,
ease: FlxEase.quartOut,
onComplete: _ -> {
onComplete: _ ->
{
remove(clearPercentCounter);
}
});
@@ -639,8 +655,7 @@ class ResultState extends MusicBeatSubState
// ratingsPopin.animation.play("idle");
// ratingsPopin.visible = true;
ratingsPopin.animation.onFinish.add(anim ->
{
ratingsPopin.animation.onFinish.add(anim -> {
// scorePopin.animation.play("score");
// scorePopin.visible = true;
@@ -665,7 +680,8 @@ class ResultState extends MusicBeatSubState
FlxFlicker.flicker(rankTextVert, 2 / 24 * 3, 2 / 24, true);
// Scrolling.
new FlxTimer().start(30 / 24, _ -> {
new FlxTimer().start(30 / 24, _ ->
{
rankTextVert.velocity.y = -80;
});
@@ -692,7 +708,8 @@ class ResultState extends MusicBeatSubState
for (atlas in characterAtlasAnimations)
{
new FlxTimer().start(atlas.delay, _ -> {
new FlxTimer().start(atlas.delay, _ ->
{
if (atlas.sprite == null) return;
atlas.sprite.visible = true;
atlas.sprite.anim.play(atlas.startFrameLabel);
@@ -708,7 +725,8 @@ class ResultState extends MusicBeatSubState
for (sprite in characterSparrowAnimations)
{
new FlxTimer().start(sprite.delay, _ -> {
new FlxTimer().start(sprite.delay, _ ->
{
if (sprite.sprite == null) return;
sprite.sprite.visible = true;
sprite.sprite.animation.play('idle', true);
@@ -739,7 +757,8 @@ class ResultState extends MusicBeatSubState
FlxTween.tween(songName, {y: (diffYTween - 25 - fuckedupnumber) + ((blackTopBar.height - 148) / 1)}, 0.5, {ease: FlxEase.expoOut, startDelay: 0.9});
songName.x = clearPercentSmall.x + 94;
new FlxTimer().start(timerLength, _ -> {
new FlxTimer().start(timerLength, _ ->
{
var tempSpeed = FlxPoint.get(speedOfTween.x, speedOfTween.y);
speedOfTween.set(0, 0);
@@ -756,7 +775,8 @@ class ResultState extends MusicBeatSubState
add(clearPercentSmall);
clearPercentSmall.visible = true;
clearPercentSmall.flash(true);
new FlxTimer().start(0.4, _ -> {
new FlxTimer().start(0.4, _ ->
{
clearPercentSmall.flash(false);
});
@@ -765,7 +785,8 @@ class ResultState extends MusicBeatSubState
refresh();
}
new FlxTimer().start(2.5, _ -> {
new FlxTimer().start(2.5, _ ->
{
movingSongStuff = true;
});
}
@@ -826,10 +847,10 @@ class ResultState extends MusicBeatSubState
@:nullSafety(Off)
introMusicAudio.onComplete = null;
FlxTween.tween(introMusicAudio, {volume: 0}, 0.8,
FlxTween.tween(introMusicAudio, {volume: 0}, 0.8, {
onComplete: _ ->
{
onComplete: _ -> {
if (introMusicAudio != null)
{
introMusicAudio.stop();
@@ -838,25 +859,25 @@ class ResultState extends MusicBeatSubState
}
}
});
FlxTween.tween(introMusicAudio, {pitch: 3}, 0.1,
FlxTween.tween(introMusicAudio, {pitch: 3}, 0.1, {
onComplete: _ ->
{
onComplete: _ -> {
FlxTween.tween(introMusicAudio, {pitch: 0.5}, 0.4);
}
});
}
else if (FlxG.sound.music != null)
{
FlxTween.tween(FlxG.sound.music, {volume: 0}, 0.8,
FlxTween.tween(FlxG.sound.music, {volume: 0}, 0.8, {
onComplete: _ ->
{
onComplete: _ -> {
FlxG.sound.music.stop();
FlxG.sound.music.destroy();
}
});
FlxTween.tween(FlxG.sound.music, {pitch: 3}, 0.1,
FlxTween.tween(FlxG.sound.music, {pitch: 3}, 0.1, {
onComplete: _ ->
{
onComplete: _ -> {
FlxTween.tween(FlxG.sound.music, {pitch: 0.5}, 0.4);
}
});
@@ -871,8 +892,7 @@ class ResultState extends MusicBeatSubState
var stickerPackId:Null<String> = null;
var song:Null<Song> = params.songId == null ? null : SongRegistry.instance.fetchEntry(params.songId,
{
var song:Null<Song> = params.songId == null ? null : SongRegistry.instance.fetchEntry(params.songId, {
variation: params?.variationId
});
@@ -911,8 +931,7 @@ class ResultState extends MusicBeatSubState
// targetState: (sticker) -> new StoryMenuState(sticker),
// stickerPack: stickerPackId
// });
targetStateFactory = () -> new StickerSubState(
{
targetStateFactory = () -> new StickerSubState({
targetState: (sticker) -> new StoryMenuState(sticker),
stickerPack: stickerPackId
});
@@ -938,12 +957,10 @@ class ResultState extends MusicBeatSubState
this.close();
return;
}
targetState = FreeplayState.build(
{
targetState = FreeplayState.build({
{
character: playerCharacterId ?? "bf",
fromResults:
{
fromResults: {
oldRank: Scoring.calculateRank(params?.prevScoreData),
newRank: rank,
songId: params.songId,
@@ -967,8 +984,7 @@ class ResultState extends MusicBeatSubState
}
shouldTween = false;
shouldUseSubstate = true;
targetStateFactory = () -> new StickerSubState(
{
targetStateFactory = () -> new StickerSubState({
targetState: (sticker) -> FreeplayState.build(null, sticker),
stickerPack: stickerPackId
});
@@ -981,7 +997,8 @@ class ResultState extends MusicBeatSubState
{
busy = true;
AdMobUtil.loadInterstitial(function():Void {
AdMobUtil.loadInterstitial(function():Void
{
AdMobUtil.PLAYING_COUNTER = 0;
busy = false;
@@ -1005,10 +1022,10 @@ class ResultState extends MusicBeatSubState
{
if (shouldTween)
{
FlxTween.tween(rankBg, {alpha: 1}, 0.5,
{
FlxTween.tween(rankBg, {alpha: 1}, 0.5, {
ease: FlxEase.expoOut,
onComplete: function(_) {
onComplete: function(_)
{
requestReview();
if (targetStateFactory != null)
@@ -1022,7 +1039,8 @@ class ResultState extends MusicBeatSubState
}
else
{
FlxG.signals.preStateSwitch.addOnce(function() {
FlxG.signals.preStateSwitch.addOnce(function()
{
#if ios
trace(DeviceUtil.iPhoneNumber);
if (DeviceUtil.iPhoneNumber > 12) funkin.FunkinMemory.purgeCache(true);
@@ -1052,7 +1070,8 @@ class ResultState extends MusicBeatSubState
}
else
{
FlxG.signals.preStateSwitch.addOnce(function() {
FlxG.signals.preStateSwitch.addOnce(function()
{
#if ios
trace(DeviceUtil.iPhoneNumber);
if (DeviceUtil.iPhoneNumber > 12) funkin.FunkinMemory.purgeCache(true);
@@ -8,7 +8,9 @@ package funkin.play.character;
* and can't use one of the built-in render modes.
*/
@:hscriptClass
class ScriptedBaseCharacter extends BaseCharacter implements polymod.hscript.HScriptedClass {}
class ScriptedBaseCharacter extends BaseCharacter implements polymod.hscript.HScriptedClass
{
}
/**
* A script that can be tied to a SparrowCharacter, which persists across states.
@@ -16,7 +18,9 @@ class ScriptedBaseCharacter extends BaseCharacter implements polymod.hscript.HSc
* then call `super('charId')` in the constructor to use this.
*/
@:hscriptClass
class ScriptedSparrowCharacter extends SparrowCharacter implements polymod.hscript.HScriptedClass {}
class ScriptedSparrowCharacter extends SparrowCharacter implements polymod.hscript.HScriptedClass
{
}
/**
* A script that can be tied to a MultiSparrowCharacter, which persists across states.
@@ -24,7 +28,9 @@ class ScriptedSparrowCharacter extends SparrowCharacter implements polymod.hscri
* then call `super('charId')` in the constructor to use this.
*/
@:hscriptClass
class ScriptedMultiSparrowCharacter extends MultiSparrowCharacter implements polymod.hscript.HScriptedClass {}
class ScriptedMultiSparrowCharacter extends MultiSparrowCharacter implements polymod.hscript.HScriptedClass
{
}
/**
* A script that can be tied to a MultiAnimateAtlasCharacter, which persists across states.
@@ -32,7 +38,9 @@ class ScriptedMultiSparrowCharacter extends MultiSparrowCharacter implements pol
* then call `super('charId')` in the constructor to use this.
*/
@:hscriptClass
class ScriptedMultiAnimateAtlasCharacter extends MultiAnimateAtlasCharacter implements polymod.hscript.HScriptedClass {}
class ScriptedMultiAnimateAtlasCharacter extends MultiAnimateAtlasCharacter implements polymod.hscript.HScriptedClass
{
}
/**
* A script that can be tied to a PackerCharacter, which persists across states.
@@ -40,7 +48,9 @@ class ScriptedMultiAnimateAtlasCharacter extends MultiAnimateAtlasCharacter impl
* then call `super('charId')` in the constructor to use this.
*/
@:hscriptClass
class ScriptedPackerCharacter extends PackerCharacter implements polymod.hscript.HScriptedClass {}
class ScriptedPackerCharacter extends PackerCharacter implements polymod.hscript.HScriptedClass
{
}
/**
* A script that can be tied to an AnimateAtlasCharacter, which persists across states.
@@ -48,4 +58,6 @@ class ScriptedPackerCharacter extends PackerCharacter implements polymod.hscript
* then call `super('charId')` in the constructor to use this.
*/
@:hscriptClass
class ScriptedAnimateAtlasCharacter extends AnimateAtlasCharacter implements polymod.hscript.HScriptedClass {}
class ScriptedAnimateAtlasCharacter extends AnimateAtlasCharacter implements polymod.hscript.HScriptedClass
{
}
+4 -1
View File
@@ -299,7 +299,10 @@ class HealthIcon extends FunkinSprite
bopTween?.cancel();
setGraphicSize(Std.int(this.width + (HEALTH_ICON_SIZE * this.size.x * BOP_SCALE)), 0);
bopTween = FlxTween.num(this.width + (HEALTH_ICON_SIZE * this.size.x * BOP_SCALE), HEALTH_ICON_SIZE * this.size.x,
Math.min(Conductor.instance.stepLengthMs * 0.002, .175), {onComplete: _ -> bopTween = null}, value -> {
Math.min(Conductor.instance.stepLengthMs * 0.002, .175), {
onComplete: _ -> bopTween = null
}, value ->
{
setGraphicSize(Std.int(value), 0);
// Ensure the icon is positioned correctly after updating the hitbox, while its changing size.
this.updateHitbox();
+4 -4
View File
@@ -56,9 +56,9 @@ class PopUpStuff extends FlxTypedGroup<FunkinSprite>
var fadeEase = noteStyle.isJudgementSpritePixel(daRating) ? EaseUtil.stepped(2) : null;
FlxTween.tween(rating, {alpha: 0}, 0.2,
FlxTween.tween(rating, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
{
onComplete: function(tween:FlxTween) {
remove(rating, true);
rating.destroy();
},
@@ -105,9 +105,9 @@ class PopUpStuff extends FlxTypedGroup<FunkinSprite>
var fadeEase = noteStyle.isComboNumSpritePixel(digit) ? EaseUtil.stepped(2) : null;
FlxTween.tween(numScore, {alpha: 0}, 0.2,
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
{
onComplete: function(tween:FlxTween) {
remove(numScore, true);
numScore.destroy();
},
@@ -32,7 +32,8 @@ class VanillaCutscenes
blackScreen.zIndex = 1000000;
PlayState.instance.add(blackScreen);
new FlxTimer().start(0.1, function(_) {
new FlxTimer().start(0.1, function(_)
{
trace('Playing horrorland cutscene...');
PlayState.instance.remove(blackScreen);
@@ -43,7 +44,8 @@ class VanillaCutscenes
// Play the Sound effect.
HapticUtil.vibrate(0.1, 0.5, 1, 1);
FunkinSound.playOnce(Paths.sound('Lights_Turn_On'), function() {
FunkinSound.playOnce(Paths.sound('Lights_Turn_On'), function()
{
// Fade in the HUD.
trace('SFX done...');
PlayState.instance.camHUD.visible = true;
+10 -8
View File
@@ -157,7 +157,8 @@ class VideoCutscene
vid.active = false;
vid.bitmap.onFormatSetup.add(function():Void {
vid.bitmap.onFormatSetup.add(function():Void
{
if (vid.bitmap != null && vid.bitmap.bitmapData != null)
{
final scale:Float = Math.min(FlxG.width / vid.bitmap.bitmapData.width, FlxG.height / vid.bitmap.bitmapData.height);
@@ -168,7 +169,8 @@ class VideoCutscene
}
});
vid.bitmap.onEncounteredError.add(function(msg:String):Void {
vid.bitmap.onEncounteredError.add(function(msg:String):Void
{
finishVideo(0.5);
});
@@ -337,18 +339,18 @@ class VideoCutscene
PlayState.instance.camHUD.visible = true;
FlxTween.tween(blackScreen, {alpha: 0}, transitionTime,
{
FlxTween.tween(blackScreen, {alpha: 0}, transitionTime, {
ease: FlxEase.quadInOut,
onComplete: function(twn:FlxTween) {
onComplete: function(twn:FlxTween)
{
PlayState.instance.remove(blackScreen);
blackScreen = null;
}
});
FlxTween.tween(FlxG.camera, {zoom: PlayState.instance.stageZoom}, transitionTime,
{
FlxTween.tween(FlxG.camera, {zoom: PlayState.instance.stageZoom}, transitionTime, {
ease: FlxEase.quadInOut,
onComplete: function(twn:FlxTween) {
onComplete: function(twn:FlxTween)
{
onVideoEnded.dispatch();
onCutsceneFinish(cutsceneType);
}
@@ -407,8 +407,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl
switch (_data?.outro)
{
case FADE(outroData):
outroTween = FlxTween.tween(this, {alpha: 0.0}, outroData.fadeTime,
{
outroTween = FlxTween.tween(this, {alpha: 0.0}, outroData.fadeTime, {
type: ONESHOT, // holy shit like the game no way
startDelay: 0,
onComplete: (_) -> endOutro(),

Some files were not shown because too many files have changed in this diff Show More