Merge branch 'new-editors' of https://github.com/FNF-CNE-Devs/CodenameEngine-Dev into new-editors
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
//
|
||||
import flixel.addons.util.FlxSimplex;
|
||||
|
||||
var self = this;
|
||||
__script__.setParent(PlayState.instance);
|
||||
|
||||
var scream:FlxSound;
|
||||
var red:FlxSprite;
|
||||
var senpaiEvil:FlxSprite;
|
||||
var timers:Array<FlxTimers> = [];
|
||||
var dfx = 0;
|
||||
var dfy = 0;
|
||||
|
||||
function create() {
|
||||
camHUD.visible = false;
|
||||
|
||||
var red:FlxSprite = new FlxSprite().makeSolid(FlxG.width + 100, FlxG.height + 100, 0xFFff1b31);
|
||||
red = new FlxSprite().makeSolid(FlxG.width + 100, FlxG.height + 100, 0xFFff1b31);
|
||||
red.screenCenter();
|
||||
red.scrollFactor.set();
|
||||
add(red);
|
||||
@@ -28,7 +32,7 @@ function create() {
|
||||
dfy = senpaiEvil.y;
|
||||
add(senpaiEvil);
|
||||
|
||||
new FlxTimer().start(3.2, function(deadTime:FlxTimer)
|
||||
timers.push(new FlxTimer().start(3.2, function(deadTime:FlxTimer)
|
||||
{
|
||||
FlxG.camera.fade(FlxColor.WHITE, 1.6, false, function() {
|
||||
remove(senpaiEvil, true);
|
||||
@@ -38,18 +42,20 @@ function create() {
|
||||
|
||||
FlxG.camera._fxFadeAlpha = 1;
|
||||
});
|
||||
});
|
||||
timers.remove(deadTime);
|
||||
}));
|
||||
scream = FlxG.sound.play(Paths.sound('cutscenes/weeb/Senpai_Dies'), 1, false, null, true, function()
|
||||
{
|
||||
new FlxTimer().start(0.4, function(swagTimer:FlxTimer) {
|
||||
timers.push(new FlxTimer().start(0.4, function(swagTimer:FlxTimer) {
|
||||
FlxG.camera._fxFadeAlpha -= 0.15;
|
||||
|
||||
if(FlxG.camera._fxFadeAlpha > 0.3) swagTimer.reset();
|
||||
if (FlxG.camera._fxFadeAlpha > 0.3) swagTimer.reset();
|
||||
else {
|
||||
timers.remove(swagTimer);
|
||||
camHUD.visible = true;
|
||||
self.startDialogue("assets/songs/" + PlayState.instance.SONG.meta.name.toLowerCase() + "/creepyDialogue.xml", self.close);
|
||||
}
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,4 +73,13 @@ function update(elapsed:Float) {
|
||||
|
||||
senpaiEvil.setPosition(dfx + vx, dfy + vy);
|
||||
}
|
||||
}
|
||||
|
||||
function destroy() { // Since you can skip the cutscene - Nex
|
||||
for (timer in timers) timer.cancel();
|
||||
senpaiEvil?.destroy();
|
||||
red?.destroy();
|
||||
FlxG.camera.stopFade();
|
||||
scream?.destroy();
|
||||
camHUD.visible = true;
|
||||
}
|
||||
@@ -81,7 +81,8 @@ class GlobalScript {
|
||||
call("update", [FlxG.elapsed]);
|
||||
});
|
||||
|
||||
onModSwitch(#if MOD_SUPPORT ModsFolder.currentModFolder #else null #end);
|
||||
// Commented this out, because it might be the cause why global runs twice - Neo
|
||||
//onModSwitch(#if MOD_SUPPORT ModsFolder.currentModFolder #else null #end);
|
||||
}
|
||||
|
||||
public static function event<T:CancellableEvent>(name:String, event:T):T {
|
||||
|
||||
@@ -151,7 +151,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
public static function getDefaultPreprocessors():Map<String, Dynamic> {
|
||||
var defines = funkin.backend.system.macros.DefinesMacro.defines;
|
||||
defines.set("CODENAME_ENGINE", true);
|
||||
defines.set("CODENAME_VER", Application.current.meta.get('version'));
|
||||
defines.set("CODENAME_VER", Flags.VERSION);
|
||||
defines.set("CODENAME_BUILD", 2675); // 2675 being the last build num before it was removed
|
||||
defines.set("CODENAME_COMMIT", Flags.COMMIT_NUMBER);
|
||||
return defines;
|
||||
|
||||
@@ -19,7 +19,8 @@ class CustomShader extends FunkinShader {
|
||||
* @param name Name of the frag and vert files.
|
||||
* @param glslVersion GLSL version to use. Defaults to `120`.
|
||||
*/
|
||||
public function new(name:String, glslVersion:String = "120") {
|
||||
public function new(name:String, glslVersion:String = null) {
|
||||
if (glslVersion == null) glslVersion = Flags.DEFAULT_GLSL_VERSION;
|
||||
var fragShaderPath = Paths.fragShader(name);
|
||||
var vertShaderPath = Paths.vertShader(name);
|
||||
var fragCode = Assets.exists(fragShaderPath) ? Assets.getText(fragShaderPath) : null;
|
||||
|
||||
@@ -26,7 +26,7 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
|
||||
public var onGLUpdate:FlxTypedSignal<Void->Void> = new FlxTypedSignal<Void->Void>();
|
||||
public var onProcessGLData:FlxTypedSignal<(String, String)->Void> = new FlxTypedSignal<(String, String)->Void>();
|
||||
|
||||
public var glslVer:String = "120";
|
||||
public var glslVer:String = Flags.DEFAULT_GLSL_VERSION;
|
||||
public var fileName:String = "FunkinShader";
|
||||
public var fragFileName:String = "FunkinShader";
|
||||
public var vertFileName:String = "FunkinShader";
|
||||
@@ -42,7 +42,8 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
|
||||
* @param vert Vertex source (pass `null` to use default)
|
||||
* @param glslVer Version of GLSL to use (defaults to 120)
|
||||
*/
|
||||
public override function new(frag:String, vert:String, glslVer:String = "120") {
|
||||
public override function new(frag:String, vert:String, glslVer:String = null) {
|
||||
if (glslVer == null) glslVer = Flags.DEFAULT_GLSL_VERSION;
|
||||
if (frag == null) frag = ShaderTemplates.defaultFragmentSource;
|
||||
if (vert == null) vert = ShaderTemplates.defaultVertexSource;
|
||||
this.glFragmentSource = frag;
|
||||
|
||||
@@ -64,6 +64,8 @@ final class CommandLineHandler {
|
||||
Main.noCwdFix = true;
|
||||
case "-livereload":
|
||||
// do nothing
|
||||
case "-verbose":
|
||||
// do nothing
|
||||
default:
|
||||
Sys.println("Unknown command");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package funkin.backend.system;
|
||||
|
||||
import lime.utils.AssetLibrary;
|
||||
import lime.utils.AssetLibrary as LimeAssetLibrary;
|
||||
import lime.utils.AssetType;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
@@ -18,7 +18,11 @@ class Flags {
|
||||
public static var COMMIT_NUMBER:Int = GitCommitMacro.commitNumber;
|
||||
public static var COMMIT_HASH:String = GitCommitMacro.commitHash;
|
||||
public static var COMMIT_MESSAGE:String = 'Commit $COMMIT_NUMBER ($COMMIT_HASH)';
|
||||
@:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v${Application.current.meta.get('version')}';
|
||||
|
||||
@:lazy public static var TITLE:String = Application.current.meta.get('name');
|
||||
@:lazy public static var VERSION:String = Application.current.meta.get('version');
|
||||
|
||||
@:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v$VERSION';
|
||||
|
||||
public static var REPO_NAME:String = "CodenameEngine";
|
||||
public static var REPO_OWNER:String = "CodenameCrew";
|
||||
@@ -142,6 +146,14 @@ class Flags {
|
||||
public static var DEFAULT_PAUSE_SCRIPT:String = "";
|
||||
@:also(funkin.game.GameOverSubstate.script)
|
||||
public static var DEFAULT_GAMEOVER_SCRIPT:String = "";
|
||||
|
||||
public static var URL_WIKI:String = "https://codename-engine.com/";
|
||||
public static var URL_EDITOR_FALLBACK:String = "https://www.youtube.com/watch?v=9Youam7GYdQ";
|
||||
public static var URL_FNF_ITCH:String = "https://ninja-muffin24.itch.io/funkin";
|
||||
|
||||
public static var DEFAULT_GLSL_VERSION:String = "120";
|
||||
@:also(funkin.backend.utils.HttpUtil.userAgent)
|
||||
public static var USER_AGENT:String = 'request';
|
||||
// -- End of Codename's Default Flags --
|
||||
|
||||
/**
|
||||
@@ -149,45 +161,64 @@ class Flags {
|
||||
*/
|
||||
@:bypass public static var customFlags:Map<String, String> = [];
|
||||
|
||||
public static function load() {
|
||||
var flags:Map<String, String> = [];
|
||||
public static function loadFromData(flags:Map<String, String>, data:String) {
|
||||
var trimmed:String;
|
||||
var splitContent = [for(e in data.split("\n")) if ((trimmed = e.trim()) != "") trimmed];
|
||||
|
||||
final flagsPath = Paths.getPath("flags.ini");
|
||||
for(line in splitContent) {
|
||||
if(line.startsWith(";")) continue;
|
||||
if(line.startsWith("#")) continue;
|
||||
if(line.startsWith("//")) continue;
|
||||
if(line.length == 0) continue;
|
||||
if(line.charAt(0) == "[" && line.charAt(line.length-1) == "]") continue;
|
||||
|
||||
for(lib in Paths.assetsTree.libraries) {
|
||||
if(lib.exists(flagsPath, AssetType.TEXT)) {
|
||||
var data:String = lib.getAsset(flagsPath, AssetType.TEXT);
|
||||
var trimmed:String;
|
||||
var splitContent = [for(e in data.split("\n")) if ((trimmed = e.trim()) != "") trimmed];
|
||||
var index = line.indexOf("=");
|
||||
if(index == -1) continue;
|
||||
var name = line.substr(0, index).trim();
|
||||
var value = line.substr(index+1).trim();
|
||||
|
||||
for(line in splitContent) {
|
||||
if(line.startsWith(";")) continue;
|
||||
if(line.startsWith("#")) continue;
|
||||
if(line.startsWith("//")) continue;
|
||||
if(line.length == 0) continue;
|
||||
if(line.charAt(0) == "[" && line.charAt(line.length-1) == "]") continue;
|
||||
var wasQuoted = value.length > 1 && value.charCodeAt(0) == '"'.code && value.charCodeAt(value.length-1) == '"'.code;
|
||||
if(wasQuoted) value = value.substr(1, value.length - 2);
|
||||
if((!wasQuoted && value.length == 0) || name.length == 0)
|
||||
continue;
|
||||
|
||||
var index = line.indexOf("=");
|
||||
if(index == -1) continue;
|
||||
var name = line.substr(0, index).trim();
|
||||
var value = line.substr(index+1).trim();
|
||||
|
||||
var wasQuoted = value.length > 1 && value.charCodeAt(0) == '"'.code && value.charCodeAt(value.length-1) == '"'.code;
|
||||
if(wasQuoted) value = value.substr(1, value.length - 2);
|
||||
if((!wasQuoted && value.length == 0) || name.length == 0)
|
||||
continue;
|
||||
|
||||
if(!flags.exists(name))
|
||||
flags[name] = value;
|
||||
}
|
||||
}
|
||||
if(!flags.exists(name))
|
||||
flags[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static function loadFromDatas(files:Array<String>) {
|
||||
var flags:Map<String, String> = [];
|
||||
for(file in files) {
|
||||
var data:String = Assets.getText(file);
|
||||
if(data != null)
|
||||
loadFromData(flags, data);
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
public static function parseFlags(flags:Map<String, String>) {
|
||||
customFlags = [];
|
||||
reset();
|
||||
for(name=>value in flags)
|
||||
if(!parse(name, value)) {
|
||||
if(!parse(name, value))
|
||||
customFlags.set(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the flags from the assets.
|
||||
**/
|
||||
public static function load(?libs:Array<LimeAssetLibrary> = null) {
|
||||
if (libs == null)
|
||||
libs = Paths.assetsTree.libraries;
|
||||
final flagsPath = Paths.getPath("flags.ini");
|
||||
var datas:Array<String> = [
|
||||
for(lib in libs)
|
||||
if(lib.exists(flagsPath, AssetType.TEXT))
|
||||
lib.getAsset(flagsPath, AssetType.TEXT)
|
||||
];
|
||||
|
||||
var flags:Map<String, String> = loadFromDatas(datas);
|
||||
parseFlags(flags);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ final class Logs {
|
||||
);
|
||||
}
|
||||
}
|
||||
__showInConsole(prepareColoredTrace(data, TRACE));
|
||||
traceColored(data, TRACE);
|
||||
};
|
||||
|
||||
LogFrontEnd.onLogs = function(data, style, fireOnce) {
|
||||
@@ -134,16 +134,33 @@ final class Logs {
|
||||
#end
|
||||
}
|
||||
|
||||
public static function traceColored(text:Array<LogText>, level:Level = INFO)
|
||||
public inline static function traceColored(text:Array<LogText>, level:Level = INFO)
|
||||
__showInConsole(prepareColoredTrace(text, level));
|
||||
|
||||
public static function trace(text:String, level:Level = INFO, color:ConsoleColor = LIGHTGRAY) {
|
||||
traceColored([
|
||||
{
|
||||
text: text,
|
||||
color: color
|
||||
}
|
||||
], level);
|
||||
public static function trace(text:String, level:Level = INFO, color:ConsoleColor = LIGHTGRAY, ?prefix:String) {
|
||||
var text = [logText(text, color)];
|
||||
if(prefix != null) text.insert(0, getPrefix(prefix));
|
||||
traceColored(text, level);
|
||||
}
|
||||
|
||||
public inline static function getPrefix(prefix:String) {
|
||||
return logText('[${prefix}] ', BLUE);
|
||||
}
|
||||
|
||||
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 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) {
|
||||
Logs.trace(text, ERROR, color, prefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -179,8 +179,6 @@ class Main extends Sprite
|
||||
}
|
||||
|
||||
public static function refreshAssets() @:privateAccess {
|
||||
WindowUtils.resetTitle();
|
||||
|
||||
var game = FlxG.game;
|
||||
var daSndTray = Type.createInstance(game._customSoundTray = funkin.menus.ui.FunkinSoundTray, []);
|
||||
var index:Int = game.numChildren - 1;
|
||||
|
||||
@@ -60,6 +60,7 @@ class MainState extends FlxState {
|
||||
Flags.load();
|
||||
ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder); // Loads global.hx
|
||||
MusicBeatTransition.script = Flags.DEFAULT_TRANSITION_SCRIPT;
|
||||
WindowUtils.resetTitle();
|
||||
Main.refreshAssets();
|
||||
DiscordUtil.init();
|
||||
EventsData.reloadEvents();
|
||||
|
||||
@@ -21,7 +21,7 @@ class MemoryCounter extends Sprite {
|
||||
label.autoSize = LEFT;
|
||||
label.x = 0;
|
||||
label.y = 0;
|
||||
label.text = "FPS";
|
||||
label.text = "MEM";
|
||||
label.multiline = label.wordWrap = false;
|
||||
label.defaultTextFormat = new TextFormat(Framerate.fontName, 12, -1);
|
||||
label.selectable = false;
|
||||
|
||||
@@ -92,10 +92,7 @@ class FlagMacro {
|
||||
case macro: Array<Float>:
|
||||
parser = macro value.split(",").map((e) -> Std.parseFloat(e));
|
||||
case macro: Array<Bool>:
|
||||
parser = macro value.split(",").map((e) -> {
|
||||
e = e.trim();
|
||||
e == "true" || e == "t" || e == "1";
|
||||
});
|
||||
parser = macro value.split(",").map(parseBool);
|
||||
case macro: TrimmedString:
|
||||
field.kind = FVar(macro: String, expr);
|
||||
parser = macro value.trim();
|
||||
@@ -106,7 +103,7 @@ class FlagMacro {
|
||||
case macro: Float:
|
||||
parser = macro Std.parseFloat(value);
|
||||
case macro: Bool:
|
||||
parser = macro value == "true" || value == "t" || value == "1";
|
||||
parser = macro parseBool(value);
|
||||
case TPath({name: "Allow", pack: [], params: params}):
|
||||
final NONE = 0;
|
||||
final STRING = 1;
|
||||
@@ -276,6 +273,22 @@ class FlagMacro {
|
||||
meta: []
|
||||
});
|
||||
|
||||
fields.push({
|
||||
name: "parseBool",
|
||||
access: [APrivate, AStatic],
|
||||
kind: FFun({
|
||||
args: [{name: "e", type: macro: String}],
|
||||
expr: macro {
|
||||
e = e.trim();
|
||||
return e == "true" || e == "t" || e == "1";
|
||||
},
|
||||
ret: macro: Bool
|
||||
}),
|
||||
pos: Context.currentPos(),
|
||||
doc: null,
|
||||
meta: []
|
||||
});
|
||||
|
||||
//var printer = new haxe.macro.Printer();
|
||||
//for(field in fields) {
|
||||
// trace(printer.printField(field));
|
||||
|
||||
@@ -29,6 +29,14 @@ class GitCommitMacro {
|
||||
* Returns the current commit date + time
|
||||
**/
|
||||
public static var commitDate(get, never):Date;
|
||||
/**
|
||||
* Returns the current branch name
|
||||
**/
|
||||
public static var currentBranch(get, never):String;
|
||||
/**
|
||||
* Returns if there are uncommitted changes
|
||||
**/
|
||||
public static var hasUncommittedChanges(get, never):Bool;
|
||||
|
||||
// GETTERS
|
||||
#if REGION
|
||||
@@ -46,6 +54,11 @@ class GitCommitMacro {
|
||||
return __getCommitAuthor();
|
||||
private static inline function get_commitDate()
|
||||
return __getCommitDate();
|
||||
|
||||
private static inline function get_currentBranch()
|
||||
return __getCurrentBranch();
|
||||
private static inline function get_hasUncommittedChanges()
|
||||
return __getHasUncommittedChanges();
|
||||
#end
|
||||
|
||||
// INTERNAL MACROS
|
||||
@@ -149,5 +162,35 @@ class GitCommitMacro {
|
||||
return macro Date.fromString("1970-01-01T00:00:00"); // failed to parse date
|
||||
#end
|
||||
}
|
||||
|
||||
private static macro function __getCurrentBranch() {
|
||||
#if display
|
||||
return macro $v{"-"};
|
||||
#else
|
||||
try {
|
||||
var process = new Process("git", ["rev-parse", "--abbrev-ref", "HEAD"], false);
|
||||
if (process.exitCode() != 0)
|
||||
throw 'Could not fetch current branch';
|
||||
|
||||
return macro $v{process.stdout.readLine().toString()};
|
||||
} catch(e) {}
|
||||
return macro $v{"-"}
|
||||
#end
|
||||
}
|
||||
|
||||
private static macro function __getHasUncommittedChanges() {
|
||||
#if display
|
||||
return macro $v{false};
|
||||
#else
|
||||
try {
|
||||
var process = new Process("git", ["status", "--porcelain"], false);
|
||||
if (process.exitCode() != 0)
|
||||
throw 'Could not fetch current branch';
|
||||
|
||||
return macro $v{process.stdout.readLine().toString() != ""};
|
||||
} catch(e) {}
|
||||
return macro $v{false}
|
||||
#end
|
||||
}
|
||||
#end
|
||||
}
|
||||
@@ -151,7 +151,4 @@ class HashLinkFixer {
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
#else
|
||||
class HashLinkFixer {
|
||||
}
|
||||
#end
|
||||
@@ -9,9 +9,6 @@ import sys.FileSystem;
|
||||
using funkin.backend.system.github.GitHub;
|
||||
|
||||
class UpdateUtil {
|
||||
public static final repoOwner:String = "YoshiCrafter29";
|
||||
public static final repoName:String = "CodenameTestRepo";
|
||||
|
||||
public static function init() {
|
||||
// deletes old bak file if it exists
|
||||
#if sys
|
||||
@@ -22,12 +19,12 @@ class UpdateUtil {
|
||||
}
|
||||
|
||||
public static function checkForUpdates():UpdateCheckCallback {
|
||||
var curTag = 'v${Application.current.meta.get('version')}';
|
||||
var curTag = 'v${Flags.VERSION}';
|
||||
trace(curTag);
|
||||
|
||||
var error = false;
|
||||
|
||||
var newUpdates = __doReleaseFiltering(GitHub.getReleases(repoOwner, repoName, function(e) {
|
||||
var newUpdates = __doReleaseFiltering(GitHub.getReleases(Flags.REPO_NAME, Flags.REPO_OWNER, function(e) {
|
||||
error = true;
|
||||
}), curTag);
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ final class DiscordUtil
|
||||
user = DUser.initRaw(request);
|
||||
|
||||
Logs.traceColored([
|
||||
Logs.logText("[Discord] ", BLUE),
|
||||
Logs.getPrefix("Discord"),
|
||||
Logs.logText("Connected to User " + user.globalName + " ("),
|
||||
Logs.logText(user.handle, GRAY),
|
||||
Logs.logText(")")
|
||||
@@ -321,7 +321,7 @@ final class DiscordUtil
|
||||
var finalMsg:String = cast(message, String);
|
||||
|
||||
Logs.traceColored([
|
||||
Logs.logText("[Discord] ", BLUE),
|
||||
Logs.getPrefix("Discord"),
|
||||
Logs.logText("Disconnected ("),
|
||||
Logs.logText('$errorCode: $finalMsg', RED),
|
||||
Logs.logText(")")
|
||||
@@ -335,7 +335,7 @@ final class DiscordUtil
|
||||
var finalMsg:String = cast(message, String);
|
||||
|
||||
Logs.traceColored([
|
||||
Logs.logText("[Discord] ", BLUE),
|
||||
Logs.getPrefix("Discord"),
|
||||
Logs.logText('Error ($errorCode: $finalMsg)', RED)
|
||||
], ERROR);
|
||||
|
||||
@@ -344,7 +344,7 @@ final class DiscordUtil
|
||||
|
||||
private static function onJoin(joinSecret:cpp.ConstCharStar):Void
|
||||
{
|
||||
Logs.traceColored([Logs.logText("[Discord] ", BLUE), Logs.logText("Someone has just joined", GREEN)], INFO);
|
||||
Logs.traceColored([Logs.getPrefix("Discord"), Logs.logText("Someone has just joined", GREEN)], INFO);
|
||||
|
||||
call("onJoinGame", [cast(joinSecret, String)]);
|
||||
}
|
||||
@@ -352,7 +352,7 @@ final class DiscordUtil
|
||||
private static function onSpectate(spectateSecret:cpp.ConstCharStar):Void
|
||||
{
|
||||
Logs.traceColored([
|
||||
Logs.logText("[Discord] ", BLUE),
|
||||
Logs.getPrefix("Discord"),
|
||||
Logs.logText("Someone started spectating your game", YELLOW)
|
||||
], INFO);
|
||||
|
||||
@@ -362,7 +362,7 @@ final class DiscordUtil
|
||||
private static function onJoinReq(request:cpp.RawConstPointer<DiscordUser>):Void
|
||||
{
|
||||
Logs.traceColored([
|
||||
Logs.logText("[Discord] ", BLUE),
|
||||
Logs.getPrefix("Discord"),
|
||||
Logs.logText("Someone has just requested to join", YELLOW)
|
||||
], WARNING);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import haxe.Http;
|
||||
|
||||
final class HttpUtil
|
||||
{
|
||||
public static var userAgent:String = "request";
|
||||
public static var userAgent:String = Flags.USER_AGENT;
|
||||
public static function requestText(url:String)
|
||||
{
|
||||
var r = null;
|
||||
|
||||
@@ -45,7 +45,7 @@ final class WindowUtils {
|
||||
* Resets the window title to the application name and resets the prefix and suffix.
|
||||
**/
|
||||
public static inline function resetTitle() {
|
||||
title = Lib.application.meta["name"];
|
||||
title = Flags.TITLE == null ? Lib.application.meta.get('name') : Flags.TITLE;
|
||||
resetAffixes();
|
||||
}
|
||||
|
||||
@@ -65,18 +65,18 @@ final class WindowUtils {
|
||||
|
||||
// backwards compat
|
||||
@:noCompletion public static var endfix(get, set):String;
|
||||
@:noCompletion private static function set_endfix(value:String):String {
|
||||
@:noCompletion private inline static function set_endfix(value:String):String {
|
||||
return suffix = value;
|
||||
}
|
||||
@:noCompletion private static function get_endfix():String {
|
||||
@:noCompletion private inline static function get_endfix():String {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
@:noCompletion public static var winTitle(get, set):String;
|
||||
@:noCompletion private static function get_winTitle():String {
|
||||
@:noCompletion private inline static function get_winTitle():String {
|
||||
return title;
|
||||
}
|
||||
@:noCompletion private static function set_winTitle(value:String):String {
|
||||
@:noCompletion private inline static function set_winTitle(value:String):String {
|
||||
return title = value;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class EditorPicker extends MusicBeatSubstate {
|
||||
id: "wiki",
|
||||
state: null,
|
||||
onClick: function() {
|
||||
CoolUtil.openURL("https://codename-engine.com/");
|
||||
CoolUtil.openURL(Flags.URL_WIKI);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -124,7 +124,7 @@ class EditorPicker extends MusicBeatSubstate {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
CoolUtil.openURL("https://www.youtube.com/watch?v=9Youam7GYdQ");
|
||||
CoolUtil.openURL(Flags.URL_EDITOR_FALLBACK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -726,6 +726,7 @@ class Charter extends UIState {
|
||||
public var dragStartPos:FlxPoint = new FlxPoint();
|
||||
public var mousePos:FlxPoint = new FlxPoint();
|
||||
public var selectionDragging:Bool = false;
|
||||
public var isSelecting:Bool = false;
|
||||
|
||||
public function updateSelectionLogic() {
|
||||
function select(s:ICharterSelectable) {
|
||||
@@ -794,11 +795,12 @@ class Charter extends UIState {
|
||||
case BOX_SELECTION:
|
||||
if (gridBackdropDummy.hoveredByChild) {
|
||||
selectionBox.visible = true;
|
||||
if (FlxG.mouse.pressed) {
|
||||
if (isSelecting) {
|
||||
selectionBox.x = Math.min(mousePos.x, dragStartPos.x);
|
||||
selectionBox.y = Math.min(mousePos.y, dragStartPos.y);
|
||||
selectionBox.bWidth = Std.int(Math.abs(mousePos.x - dragStartPos.x));
|
||||
selectionBox.bHeight = Std.int(Math.abs(mousePos.y - dragStartPos.y));
|
||||
if (FlxG.mouse.justReleased) isSelecting = false;
|
||||
} else {
|
||||
if (FlxG.keys.pressed.SHIFT) {
|
||||
for (group in [notesGroup, localEventsGroup, globalEventsGroup]) {
|
||||
@@ -900,7 +902,7 @@ class Charter extends UIState {
|
||||
currentCursor = ARROW;
|
||||
}
|
||||
case NONE:
|
||||
if (FlxG.mouse.justPressed)
|
||||
if (FlxG.mouse.justPressed)
|
||||
FlxG.mouse.getWorldPosition(charterCamera, dragStartPos);
|
||||
else if (FlxG.mouse.justPressedRight) {
|
||||
closeCurrentContextMenu();
|
||||
@@ -909,27 +911,30 @@ class Charter extends UIState {
|
||||
|
||||
if (gridBackdropDummy.hovered) {
|
||||
// AUTO DETECT
|
||||
if (FlxG.mouse.pressed && (Math.abs(mousePos.x - dragStartPos.x) > 20 || Math.abs(mousePos.y - dragStartPos.y) > 20))
|
||||
if (FlxG.mouse.justPressed) isSelecting = true;
|
||||
if (isSelecting && (Math.abs(mousePos.x - dragStartPos.x) > 20 || Math.abs(mousePos.y - dragStartPos.y) > 20)) {
|
||||
gridActionType = BOX_SELECTION;
|
||||
}
|
||||
|
||||
var id = Math.floor(mousePos.x / 40);
|
||||
var mouseOnGrid = id >= 0 && id < strumLines.totalKeyCount && mousePos.y >= 0;
|
||||
|
||||
if (FlxG.mouse.justReleased) {
|
||||
for (n in selection) n.selected = false;
|
||||
selection = [];
|
||||
for (n in selection) n.selected = false;
|
||||
selection = [];
|
||||
|
||||
if (mouseOnGrid && mousePos.y > 0 && mousePos.y < (__endStep)*40) {
|
||||
var note = new CharterNote();
|
||||
var targetStrumline = strumLines.getStrumlineFromID(id);
|
||||
note.updatePos(
|
||||
CoolUtil.bound(FlxG.keys.pressed.SHIFT ? ((mousePos.y-20) / 40) : quantStep(mousePos.y/40), 0, __endStep-1),
|
||||
(id-targetStrumline.startingID) % targetStrumline.keyCount, 0, noteType, targetStrumline
|
||||
);
|
||||
notesGroup.add(note);
|
||||
selection = [note];
|
||||
undos.addToUndo(CCreateSelection([note]));
|
||||
}
|
||||
if (mouseOnGrid && mousePos.y > 0 && mousePos.y < (__endStep)*40) {
|
||||
var note = new CharterNote();
|
||||
var targetStrumline = strumLines.getStrumlineFromID(id);
|
||||
note.updatePos(
|
||||
CoolUtil.bound(FlxG.keys.pressed.SHIFT ? ((mousePos.y-20) / 40) : quantStep(mousePos.y/40), 0, __endStep-1),
|
||||
(id-targetStrumline.startingID) % targetStrumline.keyCount, 0, noteType, targetStrumline
|
||||
);
|
||||
notesGroup.add(note);
|
||||
selection = [note];
|
||||
undos.addToUndo(CCreateSelection([note]));
|
||||
}
|
||||
isSelecting = false;
|
||||
}
|
||||
} else if (gridBackdropDummy.hoveredByChild) {
|
||||
if (FlxG.mouse.pressed) {
|
||||
@@ -1306,18 +1311,16 @@ class Charter extends UIState {
|
||||
UIUtil.processShortcuts(topMenu);
|
||||
|
||||
if (!topMenuSpr.anyMenuOpened) {
|
||||
if (FlxG.keys.pressed.CONTROL) {
|
||||
if (FlxG.mouse.wheel != 0) {
|
||||
if (FlxG.mouse.wheel != 0) {
|
||||
if (FlxG.keys.pressed.CONTROL) {
|
||||
zoom += 0.25 * FlxG.mouse.wheel;
|
||||
__camZoom = Math.pow(2, zoom);
|
||||
}
|
||||
} else if (FlxG.keys.pressed.SHIFT) {
|
||||
if (FlxG.mouse.wheel != 0) {
|
||||
} else if (FlxG.keys.pressed.SHIFT) {
|
||||
sideScroll -= 40 * FlxG.mouse.wheel;
|
||||
}
|
||||
} else {
|
||||
if (!FlxG.sound.music.playing) {
|
||||
Conductor.songPosition -= (__crochet * FlxG.mouse.wheel) - Conductor.songOffset;
|
||||
} else {
|
||||
if (!FlxG.sound.music.playing) {
|
||||
Conductor.songPosition -= (__crochet * FlxG.mouse.wheel) - Conductor.songOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class UIScrollBar extends UISprite {
|
||||
members.push(thumbIcon);
|
||||
}
|
||||
|
||||
public var isScrolling:Bool = false;
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
var lastHovered = hovered;
|
||||
@@ -42,7 +43,9 @@ class UIScrollBar extends UISprite {
|
||||
thumbIcon.follow(thumb, 0, Std.int((thumb.bHeight - thumbIcon.height) / 2));
|
||||
thumbIcon.alpha = thumb.bHeight > 30 ? 1 : 0;
|
||||
|
||||
if ((lastHovered || lastHoveredThumb) && FlxG.mouse.pressed) {
|
||||
if ((lastHovered || lastHoveredThumb) && FlxG.mouse.justPressed) isScrolling = true;
|
||||
|
||||
if (isScrolling) {
|
||||
thumb.framesOffset = 18;
|
||||
var mousePos = FlxG.mouse.getScreenPosition(__lastDrawCameras[0], FlxPoint.get());
|
||||
var yPos = CoolUtil.bound(FlxMath.remapToRange(mousePos.y, y, y+height, -(size/2), length + size), 0, length);
|
||||
@@ -52,7 +55,10 @@ class UIScrollBar extends UISprite {
|
||||
onChange(value);
|
||||
}
|
||||
mousePos.put();
|
||||
} else
|
||||
}
|
||||
if (FlxG.mouse.justReleased && isScrolling) {
|
||||
isScrolling = false;
|
||||
thumb.framesOffset = lastHoveredThumb ? 9 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,6 +94,8 @@ class UISlider extends UISprite {
|
||||
|
||||
var __stepperWidth = 25;
|
||||
|
||||
public var isSliding:Bool = false;
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
selectableHitbox.follow(this, 0, (height-selectableHitbox.height)/2);
|
||||
|
||||
@@ -105,10 +107,12 @@ class UISlider extends UISprite {
|
||||
|
||||
var lastBarProgress:Float = __barProgress;
|
||||
|
||||
if (selectableHitbox.hovered && FlxG.mouse.pressed) {
|
||||
if (selectableHitbox.hovered && FlxG.mouse.justPressed) isSliding = true;
|
||||
if (isSliding) {
|
||||
var mousePos = FlxG.mouse.getScreenPosition(__lastDrawCameras[0], FlxPoint.get());
|
||||
__barProgress = CoolUtil.bound(mousePos.x-x, 0, barWidth)/barWidth;
|
||||
mousePos.put();
|
||||
if (FlxG.mouse.justReleased) isSliding = false;
|
||||
}
|
||||
|
||||
if (__barProgress != lastBarProgress) {
|
||||
|
||||
@@ -642,7 +642,7 @@ class PlayState extends MusicBeatState
|
||||
for(folder in scriptsFolders) {
|
||||
for(file in Paths.getFolderContent(folder, true, fromMods ? MODS : BOTH)) {
|
||||
if (folder == 'data/charts/')
|
||||
Logs.trace('[PlayState] data/charts/ is deprecated and will be removed in the future. Please move script $file to songs/', WARNING, DARKYELLOW);
|
||||
Logs.warn('data/charts/ is deprecated and will be removed in the future. Please move script $file to songs/', DARKYELLOW, "PlayState");
|
||||
|
||||
addScript(file);
|
||||
}
|
||||
@@ -861,8 +861,9 @@ class PlayState extends MusicBeatState
|
||||
* @param cutsceneScriptPath Optional: Custom script path.
|
||||
* @param callback Callback called after the cutscene ended. If equals to `null`, `startCountdown` will be called.
|
||||
* @param checkSeen Bool that by default is false, if true and `seenCutscene` is also true, it won't play the cutscene but directly call `callback` (PS: `seenCutscene` becomes true if the cutscene gets played and `checkSeen` was true)
|
||||
* @param canSkipTransIn Bool that by default is true makes the in transition skip on certain types of cutscenes like dialogues.
|
||||
*/
|
||||
public function startCutscene(prefix:String = "", ?cutsceneScriptPath:String, ?callback:Void->Void, checkSeen:Bool = false) {
|
||||
public function startCutscene(prefix:String = "", ?cutsceneScriptPath:String, ?callback:Void->Void, checkSeen:Bool = false, canSkipTransIn:Bool = true) {
|
||||
if (callback == null) callback = startCountdown;
|
||||
if ((checkSeen && seenCutscene) || !playCutscenes) {
|
||||
callback();
|
||||
@@ -887,15 +888,15 @@ class PlayState extends MusicBeatState
|
||||
if (cutsceneScriptPath != null && Assets.exists(cutsceneScriptPath)) {
|
||||
openSubState(new ScriptedCutscene(cutsceneScriptPath, toCall));
|
||||
} else if (Assets.exists(dialogue)) {
|
||||
MusicBeatState.skipTransIn = true;
|
||||
if (canSkipTransIn) MusicBeatState.skipTransIn = true;
|
||||
openSubState(new DialogueCutscene(dialogue, toCall));
|
||||
} else if (Assets.exists(videoCutsceneAlt)) {
|
||||
MusicBeatState.skipTransIn = true;
|
||||
if (canSkipTransIn) MusicBeatState.skipTransIn = true;
|
||||
persistentUpdate = false;
|
||||
openSubState(new VideoCutscene(videoCutsceneAlt, toCall));
|
||||
persistentDraw = false;
|
||||
} else if (Assets.exists(videoCutscene)) {
|
||||
MusicBeatState.skipTransIn = true;
|
||||
if (canSkipTransIn) MusicBeatState.skipTransIn = true;
|
||||
persistentUpdate = false;
|
||||
openSubState(new VideoCutscene(videoCutscene, toCall));
|
||||
persistentDraw = false;
|
||||
@@ -1304,9 +1305,9 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
#if EXPERMENTAL_SCRIPT_RELOADING
|
||||
if (FlxG.keys.justPressed.F5) {
|
||||
Logs.trace('[PlayState] Reloading scripts...', WARNING, YELLOW);
|
||||
Logs.warn('Reloading scripts...', "PlayState");
|
||||
scripts.reload();
|
||||
Logs.trace('[PlayState] Song scripts successfully reloaded.', WARNING, GREEN);
|
||||
Logs.warn('Song scripts successfully reloaded.', GREEN, "PlayState");
|
||||
}
|
||||
#end
|
||||
}
|
||||
@@ -1529,8 +1530,7 @@ class PlayState extends MusicBeatState
|
||||
#end
|
||||
}
|
||||
|
||||
startCutscene("end-", endCutscene, nextSong);
|
||||
resetSongInfos();
|
||||
startCutscene("end-", endCutscene, nextSong, false, false);
|
||||
}
|
||||
|
||||
private static inline function getSongChanges():Array<HighscoreChange> {
|
||||
@@ -1546,6 +1546,8 @@ class PlayState extends MusicBeatState
|
||||
* Immediately switches to the next song, or goes back to the Story/Freeplay menu.
|
||||
*/
|
||||
public function nextSong() {
|
||||
resetSongInfos();
|
||||
|
||||
if (isStoryMode)
|
||||
{
|
||||
campaignScore += songScore;
|
||||
@@ -1573,8 +1575,7 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: make this colored
|
||||
Logs.trace('[PlayState] Loading next song (${storyPlaylist[0].toLowerCase()}/$difficulty)', VERBOSE);
|
||||
Logs.infos('Loading next song (${storyPlaylist[0].toLowerCase()}/$difficulty)', "PlayState");
|
||||
|
||||
registerSmoothTransition();
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ class Cutscene extends MusicBeatSubstate {
|
||||
}
|
||||
|
||||
public override function close() {
|
||||
canOpenCustomTransition = false;
|
||||
__callback();
|
||||
super.close();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class DialogueCutscene extends ScriptedCutscene {
|
||||
}
|
||||
|
||||
public override function onErrorScriptLoading() {
|
||||
Logs.trace('Could not find script for dialogue cutscene at "${scriptPath}"', WARNING, YELLOW);
|
||||
//Logs.trace('Could not find script for dialogue cutscene at "${scriptPath}"', WARNING, YELLOW); // Too many warnings honestly, stawp - Nex
|
||||
}
|
||||
|
||||
var parentDisabler:FunkinParentDisabler;
|
||||
@@ -62,26 +62,26 @@ class DialogueCutscene extends ScriptedCutscene {
|
||||
var event = EventManager.get(DialogueStructureEvent).recycle(dialogueData);
|
||||
event.dialogueData = new Access(Xml.parse(Assets.getText(dialoguePath)).firstElement());
|
||||
dialogueScript.call('structureLoaded', [event]);
|
||||
if(event.cancelled) return;
|
||||
if (event.cancelled) return;
|
||||
dialogueData = event.dialogueData;
|
||||
|
||||
// Add characters
|
||||
for(char in dialogueData.nodes.char) {
|
||||
for (char in dialogueData.nodes.char) {
|
||||
if (!char.has.name) continue;
|
||||
if (charMap.exists(char.att.name))
|
||||
Logs.trace('2 dialogue characters share the same name (${char.att.name}, ${char.att.name}). The old character has been replaced.');
|
||||
|
||||
var leChar:DialogueCharacter = new DialogueCharacter(char.att.name, char.getAtt('position').getDefault('default'));
|
||||
if(char.has.defaultAnim) leChar.defaultAnim = char.att.defaultAnim;
|
||||
if (char.has.defaultAnim) leChar.defaultAnim = char.att.defaultAnim;
|
||||
add(charMap[char.att.name] = leChar);
|
||||
}
|
||||
|
||||
var useDef:Bool = false;
|
||||
if(dialogueData.has.forceBoxDefaultTxtSound && dialogueData.att.forceBoxDefaultTxtSound == "true")
|
||||
if (dialogueData.has.forceBoxDefaultTxtSound && dialogueData.att.forceBoxDefaultTxtSound == "true")
|
||||
useDef = true;
|
||||
|
||||
// Add lines
|
||||
for(node in dialogueData.nodes.line) {
|
||||
for (node in dialogueData.nodes.line) {
|
||||
var formats = XMLUtil.getTextFormats(XMLUtil.fixSpacingInNode(node));
|
||||
var volume:Null<Float> = 0.8;
|
||||
var line:DialogueLine = {
|
||||
@@ -99,8 +99,8 @@ class DialogueCutscene extends ScriptedCutscene {
|
||||
textSound: null
|
||||
};
|
||||
|
||||
if(node.has.textSound) line.textSound = FlxG.sound.load(Paths.sound(node.att.textSound));
|
||||
else if(!useDef) {
|
||||
if (node.has.textSound) line.textSound = FlxG.sound.load(Paths.sound(node.att.textSound));
|
||||
else if (!useDef) {
|
||||
var char:DialogueCharacter = charMap[line.char];
|
||||
if(char != null && char.charData != null && char.charData.has.textSound)
|
||||
line.textSound = FlxG.sound.load(Paths.sound(char.charData.att.textSound));
|
||||
@@ -188,16 +188,16 @@ class DialogueCutscene extends ScriptedCutscene {
|
||||
|
||||
public override function close() {
|
||||
var event = new CancellableEvent();
|
||||
for(c in charMap) c.dialogueCharScript.call("close", [event]);
|
||||
dialogueBox.dialogueBoxScript.call("close", [event]);
|
||||
for (c in charMap) c.dialogueCharScript.call("close", [event]);
|
||||
if (dialogueBox != null) dialogueBox.dialogueBoxScript.call("close", [event]);
|
||||
dialogueScript.call("close", [event]);
|
||||
if(event.cancelled) return;
|
||||
if (event.cancelled) return;
|
||||
|
||||
super.close();
|
||||
}
|
||||
|
||||
public override function destroy() {
|
||||
if(curMusic != null && !curMusic.persist) curMusic.destroy();
|
||||
if (curMusic != null && !curMusic.persist) curMusic.destroy();
|
||||
|
||||
super.destroy();
|
||||
cutscene = null;
|
||||
|
||||
@@ -40,7 +40,7 @@ class CreditsMain extends TreeMenu {
|
||||
optionsTree.add(Type.createInstance(CreditsCodename, []));
|
||||
}));
|
||||
items.push(new TextOption("Friday Night Funkin'", "Select this to open the itch.io page of the original game to donate!", function() {
|
||||
CoolUtil.openURL("https://ninja-muffin24.itch.io/funkin");
|
||||
CoolUtil.openURL(Flags.URL_FNF_ITCH);
|
||||
}));
|
||||
|
||||
main = new OptionsScreen('Credits', 'The people who made this possible!', items);
|
||||
|
||||
Reference in New Issue
Block a user