Merge branch 'main' into new-editors

This commit is contained in:
Ne_Eo
2025-02-28 16:39:06 +01:00
18 changed files with 306 additions and 38 deletions
+5 -3
View File
@@ -200,13 +200,15 @@ class Paths
* @param Unique Whenever the image should be unique in the cache
* @param Key Key to the image in the cache
* @param SkipAtlasCheck Whenever the atlas check should be skipped.
* @param SkipMultiCheck Whenever the multi spritesheet check should be skipped.
* @param Ext Extension of the image.
* @return FlxFramesCollection Frames
*/
static function loadFrames(path:String, Unique:Bool = false, Key:String = null, SkipAtlasCheck:Bool = false, ?Ext:String = null):FlxFramesCollection {
static function loadFrames(path:String, Unique:Bool = false, Key:String = null, SkipAtlasCheck:Bool = false, SkipMultiCheck:Bool = false, ?Ext:String = null):FlxFramesCollection {
var noExt = Path.withoutExtension(path);
var ext = Ext != null ? Ext : Flags.IMAGE_EXT;
if (Assets.exists('$noExt/1.${ext}')) {
if (!SkipMultiCheck && Assets.exists('$noExt/1.${ext}')) {
// MULTIPLE SPRITESHEETS!!
var graphic = FlxG.bitmap.add("flixel/images/logo/default.png", false, '$noExt/mult');
@@ -218,7 +220,7 @@ class Paths
var cur = 1;
var finalFrames = new MultiFramesCollection(graphic);
while(Assets.exists('$noExt/$cur.${ext}')) {
var spr = loadFrames('$noExt/$cur.${ext}');
var spr = loadFrames('$noExt/$cur.${ext}', false, null, false, true);
finalFrames.addFrames(spr);
cur++;
}
@@ -64,8 +64,8 @@ final class CommandLineHandler {
Main.noCwdFix = true;
case "-livereload":
// do nothing
case "-verbose":
// do nothing
case "-v" | "-verbose" | "--verbose":
Main.verbose = true;
default:
Sys.println("Unknown command");
}
+6 -11
View File
@@ -143,25 +143,20 @@ final class Logs {
traceColored(text, level);
}
public inline static function getPrefix(prefix:String) {
public inline static function getPrefix(prefix:String)
return logText('[${prefix}] ', BLUE);
}
public inline static function infos(text:String, color:ConsoleColor = LIGHTGRAY, ?prefix:String) {
public inline static function infos(text:String, color:ConsoleColor = LIGHTGRAY, ?prefix:String)
Logs.trace(text, INFO, color, prefix);
}
public inline static function verbose(text:String, color:ConsoleColor = LIGHTGRAY, ?prefix:String) {
Logs.trace(text, VERBOSE, color, prefix);
}
public inline static function verbose(text:String, color:ConsoleColor = LIGHTGRAY, ?prefix:String)
if (Main.verbose) Logs.trace(text, VERBOSE, color, prefix);
public inline static function warn(text:String, color:ConsoleColor = YELLOW, ?prefix:String) {
public inline static function warn(text:String, color:ConsoleColor = YELLOW, ?prefix:String)
Logs.trace(text, WARNING, color, prefix);
}
public inline static function error(text:String, color:ConsoleColor = RED, ?prefix:String) {
public inline static function error(text:String, color:ConsoleColor = RED, ?prefix:String)
Logs.trace(text, ERROR, color, prefix);
}
}
enum abstract Level(Int) {
+1
View File
@@ -35,6 +35,7 @@ class Main extends Sprite
public static var modToLoad:String = null;
public static var forceGPUOnlyBitmapsOff:Bool = #if desktop false #else true #end;
public static var noTerminalColor:Bool = false;
public static var verbose:Bool = false;
public static var scaleMode:FunkinRatioScaleMode;
#if !mobile
@@ -33,7 +33,7 @@ class FramerateCounter extends Sprite {
if (alpha <= 0.05) return;
super.__enterFrame(t);
lastFPS = CoolUtil.fpsLerp(lastFPS, FlxG.elapsed == 0 ? 0 : (1 / FlxG.elapsed), 0.25);
lastFPS = CoolUtil.fpsLerp(lastFPS, FlxG.rawElapsed == 0 ? 0 : (1 / FlxG.rawElapsed), 0.25);
fpsNum.text = Std.string(Math.floor(lastFPS));
fpsLabel.x = fpsNum.x + fpsNum.width;
fpsLabel.y = (fpsNum.y + fpsNum.height) - fpsLabel.height;
@@ -21,6 +21,7 @@ class Macros {
// OTHER LIBRARIES & STUFF
#if THREE_D_SUPPORT "away3d", "flx3d", #end
#if VIDEO_CUTSCENES "hxvlc.flixel", "hxvlc.openfl", #end
#if NAPE_ENABLED "nape", "flixel.addons.nape", #end
// BASE HAXE
"DateTools", "EReg", "Lambda", "StringBuf", "haxe.crypto", "haxe.display", "haxe.exceptions", "haxe.extern", "scripting"
])
@@ -0,0 +1,31 @@
package funkin.backend.system.modules;
import haxe.io.Path;
/*
* A class that simply points OpenALSoft to a custom configuration file when
* the game starts up.
*
* The config overrides a few global OpenALSoft settings with the aim of
* improving audio quality on desktop targets.
*/
@:keepInit class ALSoftConfig
{
#if desktop
static function __init__():Void
{
var origin:String = #if hl Sys.getCwd() #else Sys.programPath() #end;
var configPath:String = Path.directory(Path.withoutExtension(origin));
#if windows
configPath += "/plugins/alsoft.ini";
#elseif mac
configPath = Path.directory(configPath) + "/Resources/plugins/alsoft.conf";
#else
configPath += "/plugins/alsoft.conf";
#end
Sys.putEnv("ALSOFT_CONF", configPath);
}
#end
}
@@ -60,6 +60,8 @@ class CharacterInfoScreen extends UISubstateWindow {
add(iconColorWheel);
addLabelOn(iconColorWheel, "Icon Color");
if (character.iconColor != null)
iconColorWheel.colorChanged = true;
iconColorPicker.colorWheel = iconColorWheel;
durationStepper = new UINumericStepper(iconColorWheel.x, iconColorWheel.y + 125 + 36, character.holdTime == -1 ? 4 : character.holdTime, 0.001, 2, 0, 9999999, 74);
+1 -1
View File
@@ -1243,7 +1243,7 @@ class Charter extends UIState {
if (note.strumLineID == strumLineID)
selection.remove(note);
else i++;
}
} else i++;
}
}
#end
+6 -3
View File
@@ -946,7 +946,7 @@ class PlayState extends MusicBeatState
var spr = event.spritePath;
if (!Assets.exists(spr)) spr = Paths.image('$spr');
sprite = new FlxSprite().loadAnimatedGraphic(spr);
sprite = new FunkinSprite().loadAnimatedGraphic(spr);
sprite.scrollFactor.set();
sprite.scale.set(event.scale, event.scale);
sprite.updateHitbox();
@@ -1278,8 +1278,11 @@ class PlayState extends MusicBeatState
accFormat.format.color = curRating.color;
accuracyTxt.text = 'Accuracy:${accuracy < 0 ? "-%" : '${CoolUtil.quantize(accuracy * 100, 100)}%'} - ${curRating.rating}';
accuracyTxt._formatRanges[0].range.start = accuracyTxt.text.length - curRating.rating.length;
accuracyTxt._formatRanges[0].range.end = accuracyTxt.text.length;
for (i => frmtRange in accuracyTxt._formatRanges) if (frmtRange.format == accFormat) {
accuracyTxt._formatRanges[i].range.start = accuracyTxt.text.length - curRating.rating.length;
accuracyTxt._formatRanges[i].range.end = accuracyTxt.text.length;
break;
}
}
}
+13 -10
View File
@@ -1,20 +1,20 @@
package funkin.menus;
import flixel.sound.FlxSound;
import flixel.text.FlxText;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import funkin.backend.FunkinText;
import funkin.backend.scripting.Script;
import funkin.backend.scripting.events.NameEvent;
import funkin.backend.scripting.events.menu.MenuChangeEvent;
import funkin.backend.scripting.events.menu.pause.*;
import funkin.backend.scripting.events.NameEvent;
import funkin.backend.system.Conductor;
import funkin.backend.utils.FunkinParentDisabler;
import funkin.editors.charter.Charter;
import funkin.menus.StoryMenuState;
import funkin.options.OptionsMenu;
import funkin.options.keybinds.KeybindsOptions;
import funkin.options.TreeMenu;
import funkin.options.keybinds.KeybindsOptions;
class PauseSubState extends MusicBeatSubstate
{
@@ -22,7 +22,13 @@ class PauseSubState extends MusicBeatSubstate
var grpMenuShit:FlxTypedGroup<Alphabet>;
var levelInfo:FunkinText;
var levelDifficulty:FunkinText;
var deathCounter:FunkinText;
var multiplayerText:FunkinText;
var menuItems:Array<String>;
var curSelected:Int = 0;
var pauseMusic:FlxSound;
@@ -59,7 +65,6 @@ class PauseSubState extends MusicBeatSubstate
menuItems = event.options;
pauseMusic = FlxG.sound.load(Paths.music(event.music), 0, true);
pauseMusic.persist = false;
pauseMusic.group = FlxG.sound.defaultMusicGroup;
@@ -74,15 +79,13 @@ class PauseSubState extends MusicBeatSubstate
bg.scrollFactor.set();
add(bg);
var levelInfo:FlxText = new FlxText(20, 15, 0, PlayState.SONG.meta.displayName, 32);
var levelDifficulty:FlxText = new FlxText(20, 15, 0, PlayState.difficulty.toUpperCase(), 32);
var deathCounter:FlxText = new FlxText(20, 15, 0, "Blue balled: " + PlayState.deathCounter, 32);
var multiplayerText:FlxText = new FlxText(20, 15, 0, PlayState.opponentMode ? 'OPPONENT MODE' : (PlayState.coopMode ? 'CO-OP MODE' : ''), 32);
levelInfo = new FunkinText(20, 15, 0, PlayState.SONG.meta.displayName, 32, false);
levelDifficulty = new FunkinText(20, 15, 0, PlayState.difficulty.toUpperCase(), 32, false);
deathCounter = new FunkinText(20, 15, 0, "Blue balled: " + PlayState.deathCounter, 32, false);
multiplayerText = new FunkinText(20, 15, 0, PlayState.opponentMode ? 'OPPONENT MODE' : (PlayState.coopMode ? 'CO-OP MODE' : ''), 32, false);
for(k=>label in [levelInfo, levelDifficulty, deathCounter, multiplayerText]) {
label.scrollFactor.set();
label.setFormat(Paths.font('vcr.ttf'), 32);
label.updateHitbox();
label.alpha = 0;
label.x = FlxG.width - (label.width + 20);
label.y = 15 + (32 * k);
@@ -92,7 +92,7 @@ class CreditsCodename extends funkin.options.OptionsScreen {
});
Options.contributors = contributors;
}
Logs.trace('[CreditsCodename] Contributors list Updated!', VERBOSE);
Logs.verbose('[CreditsCodename] Contributors list Updated!');
var errorOnMain:Bool = false;
var idk2 = GitHub.getOrganizationMembers(Flags.REPO_OWNER, function(e) {
@@ -103,7 +103,7 @@ class CreditsCodename extends funkin.options.OptionsScreen {
});
if(!errorOnMain) {
Options.mainDevs = [for(m in idk2) m.id];
Logs.trace('[CreditsCodename] Main Devs list Updated!', VERBOSE);
Logs.verbose('[CreditsCodename] Main Devs list Updated!');
}
return true;
+5 -4
View File
@@ -7,6 +7,7 @@ import funkin.backend.FunkinText;
import funkin.editors.ui.UIState;
import funkin.menus.MainMenuState;
import funkin.options.type.OptionType;
import funkin.options.type.TextOption;
import funkin.backend.system.framerate.Framerate;
class TreeMenu extends UIState {
@@ -18,13 +19,13 @@ class TreeMenu extends UIState {
public static var lastState:Class<FlxState> = null; // Static for fixing the softlock bugs when resetting the state - Nex
public function new() {
public function new(scriptsAllowed:Bool = true, ?scriptName:String) {
if(lastState == null) lastState = Type.getClass(FlxG.state);
super();
super(scriptsAllowed, scriptName);
}
public override function createPost() {
if (main == null) throw "\"main\" variable has not been set in extended class!";
if (main == null) main = new OptionsScreen("Fallback Treemenu", "Please set the \"main\" variable in your extended class before createPost", [new TextOption("Oops! No Options", "This doesn't look like it was supposed to happen...", () -> FlxG.resetState() ) ]);
FlxG.camera.scroll.set(-FlxG.width, 0);
@@ -119,4 +120,4 @@ typedef OptionCategory = {
typedef OptionTypeDef = {
var type:Class<OptionType>;
var args:Array<Dynamic>;
}
}