Cleaned up Warning And Error Code

This commit is contained in:
NeeEoo
2024-04-10 16:37:19 +02:00
parent a8f35ad81c
commit d955e00ece
33 changed files with 106 additions and 93 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ class ModsFolder {
public static function init() {
if(!getModsList().contains(Options.lastLoadedMod)) {
Options.lastLoadedMod = null;
Logs.trace("Mod not found in mods list, switching to base game!", WARNING, YELLOW);
Logs.warn("Mod not found in mods list, switching to base game!");
}
}
+4 -4
View File
@@ -26,7 +26,7 @@ class Chart {
try {
data = Json.parse(Assets.getText(path)).events;
} catch(e) {
Logs.trace('Failed to load song event data for ${songName} ($path): ${Std.string(e)}', ERROR);
Logs.error('Failed to load song event data for ${songName} ($path): ${Std.string(e)}');
}
}
return data;
@@ -44,7 +44,7 @@ class Chart {
try {
data = Json.parse(Assets.getText(path));
} catch(e) {
Logs.trace('Failed to load song metadata for ${songName} ($path): ${Std.string(e)}', ERROR);
Logs.error('Failed to load song metadata for ${songName} ($path): ${Std.string(e)}');
}
if (data != null) break;
}
@@ -105,7 +105,7 @@ class Chart {
var valid:Bool = true;
if (!Assets.exists(chartPath)) {
Logs.trace('Chart for song ${songName} ($difficulty) at "$chartPath" was not found.', ERROR, RED);
Logs.error('Chart for song ${songName} ($difficulty) at "$chartPath" was not found.');
valid = false;
}
var data:Dynamic = null;
@@ -113,7 +113,7 @@ class Chart {
if (valid)
data = Json.parse(Assets.getText(chartPath));
} catch(e) {
Logs.trace('Could not parse chart for song ${songName} ($difficulty): ${Std.string(e)}', ERROR, RED);
Logs.error('Could not parse chart for song ${songName} ($difficulty): ${Std.string(e)}');
}
if (data != null) {
@@ -132,10 +132,10 @@ class FNFLegacyParser {
if ((swagSection.mustHitSection && strumLine.type == OPPONENT) ||
(!swagSection.mustHitSection && strumLine.type == PLAYER))
sectionNote[1] += 4;
swagSection.sectionNotes.push(note);
swagSection.sectionNotes.push(note);
}
}
return {song: base};
}
+5 -5
View File
@@ -32,7 +32,7 @@ class PsychParser {
for (note in strumLine.notes) {
var section:Int = Math.floor(Conductor.getStepForTime(note.time) / Conductor.getMeasureLength());
var swagSection:SwagSection = base.notes[section];
if (section >= 0 && section < base.notes.length) {
var sectionNote:Array<Dynamic> = [
note.time, // TIME
@@ -44,10 +44,10 @@ class PsychParser {
if ((swagSection.mustHitSection && strumLine.type == OPPONENT) ||
(!swagSection.mustHitSection && strumLine.type == PLAYER))
sectionNote[1] += 4;
swagSection.sectionNotes.push(sectionNote);
swagSection.sectionNotes.push(sectionNote);
}
}
var groupedEvents:Array<Array<ChartEvent>> = [];
var __last:Array<ChartEvent> = null;
var __lastTime:Float = Math.NaN;
@@ -91,7 +91,7 @@ class PsychParser {
FlxMath.roundDecimal(event.params[1]/chart.scrollSpeed, 2), // SCROLL SPEED MULTIPLER
FlxMath.roundDecimal( // TIME
event.params[0] ? // IS TWEENED?
(Conductor.getTimeForStep(eventStep+event.params[2]) - Conductor.getTimeForStep(eventStep))/1000
(Conductor.getTimeForStep(eventStep+event.params[2]) - Conductor.getTimeForStep(eventStep))/1000
: 0, 2)
]);
default:
@@ -106,7 +106,7 @@ class PsychParser {
for (psychEvent in psychEvents)
for (i in 1...3) // Turn both vals into strings
if (!(psychEvent[i] is String))
if (!(psychEvent[i] is String))
psychEvent[i] = Std.string(psychEvent[i]);
base.events.push([events[0].time, psychEvents]);
+1 -1
View File
@@ -28,7 +28,7 @@ class HScript extends Script {
try {
if(Assets.exists(rawPath)) code = Assets.getText(rawPath);
} catch(e) Logs.trace('Error while reading $path: ${Std.string(e)}', ERROR);
} catch(e) Logs.error('Error while reading $path: ${Std.string(e)}');
parser = initParser();
//folderlessPath = Path.directory(path);
+2 -2
View File
@@ -153,7 +153,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
var arr = Assets.getText(path).split("________PACKSEP________");
fromString(arr[1], arr[0]);
case "lua":
Logs.trace("Lua is not supported in this engine. Use HScript instead.", ERROR);
Logs.error("Lua is not supported in this engine. Use HScript instead.");
new DummyScript(path);
default:
new DummyScript(path);
@@ -172,7 +172,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
case "hx" | "hscript" | "hsc" | "hxs":
new HScript(path).loadFromString(code);
case "lua":
Logs.trace("Lua is not supported in this engine. Use HScript instead.", ERROR);
Logs.error("Lua is not supported in this engine. Use HScript instead.");
new DummyScript(path).loadFromString(code);
default:
new DummyScript(path).loadFromString(code);
@@ -30,7 +30,7 @@ class CustomShader extends FunkinShader {
path = fragShaderPath+vertShaderPath;
if (fragCode == null && vertCode == null)
Logs.trace('Shader "$name" couldn\'t be found.', ERROR);
Logs.error('Shader "$name" couldn\'t be found.');
super(fragCode, vertCode, glslVersion);
}
+12
View File
@@ -104,6 +104,18 @@ class Logs {
color: color
}], level);
}
public inline static function verbose(text:String, level:Level = VERBOSE, color:ConsoleColor = LIGHTGRAY) {
Logs.trace(text, level, color);
}
public inline static function warn(text:String, level:Level = WARNING, color:ConsoleColor = YELLOW) {
Logs.trace(text, level, color);
}
public inline static function error(text:String, level:Level = ERROR, color:ConsoleColor = RED) {
Logs.trace(text, level, color);
}
}
enum abstract Level(Int) {
+1 -1
View File
@@ -71,7 +71,7 @@ class MainState extends FlxState {
sys.FileSystem.createDirectory('./.temp/');
#if windows
try new funkin.backend.utils.native.HiddenProcess("attrib +h .temp")
catch(e) Logs.trace('Failed to set hidden attribute on .temp folder', WARNING);
catch(e) Logs.warn('Failed to set hidden attribute on .temp folder');
#end #end
}
}
@@ -20,7 +20,7 @@ class SystemInfo extends FramerateCategory {
public static inline function init() {
#if linux
var process = new HiddenProcess("cat", ["/etc/os-release"]);
if (process.exitCode() != 0) Logs.trace('Unable to grab OS Label', ERROR, RED);
if (process.exitCode() != 0) Logs.error('Unable to grab OS Label');
else {
var osName = "";
var osVersion = "";
@@ -53,7 +53,7 @@ class SystemInfo extends FramerateCategory {
if (lime.system.System.platformLabel != null && lime.system.System.platformLabel != "" && lime.system.System.platformVersion != null && lime.system.System.platformVersion != "")
osInfo = '${lime.system.System.platformLabel.replace(lime.system.System.platformVersion, "").trim()} ${lime.system.System.platformVersion}';
else
Logs.trace('Unable to grab OS Label', ERROR, RED);
Logs.error('Unable to grab OS Label');
#end
try {
@@ -79,7 +79,7 @@ class SystemInfo extends FramerateCategory {
}
#end
} catch (e) {
Logs.trace('Unable to grab CPU Name: $e', ERROR, RED);
Logs.error('Unable to grab CPU Name: $e');
}
@:privateAccess {
@@ -93,24 +93,24 @@ class SystemInfo extends FramerateCategory {
if(openfl.display3D.Context3D.__glMemoryTotalAvailable != -1) {
var vRAMBytes:UInt = cast(flixel.FlxG.stage.context3D.gl.getParameter(openfl.display3D.Context3D.__glMemoryTotalAvailable), UInt);
if (vRAMBytes == 1000 || vRAMBytes == 1 || vRAMBytes <= 0)
Logs.trace('Unable to grab GPU VRAM', ERROR, RED);
Logs.error('Unable to grab GPU VRAM');
else
vRAM = CoolUtil.getSizeString(vRAMBytes * 1000);
}
} else
Logs.trace('Unable to grab GPU Info', ERROR, RED);
Logs.error('Unable to grab GPU Info');
}
#if cpp
totalMem = Std.string(MemoryUtil.getTotalMem() / 1024) + " GB";
#else
Logs.trace('Unable to grab RAM Amount', ERROR, RED);
Logs.error('Unable to grab RAM Amount');
#end
try {
memType = MemoryUtil.getMemType();
} catch (e) {
Logs.trace('Unable to grab RAM Type: $e', ERROR, RED);
Logs.error('Unable to grab RAM Type: $e');
}
formatSysInfo();
}
+2 -2
View File
@@ -72,7 +72,7 @@ class CoolUtil
try {
sys.FileSystem.deleteFile(delete + "/" + file);
} catch(e) {
Logs.trace("Could not delete " + delete + "/" + file, WARNING);
Logs.warn("Could not delete " + delete + "/" + file);
}
}
}
@@ -92,7 +92,7 @@ class CoolUtil
else sys.io.File.saveContent(path, content);
} catch(e) {
var errMsg:String = 'Error while trying to save the file: ${Std.string(e).replace('\n', ' ')}';
Logs.traceColored([Logs.logText(errMsg, RED)], ERROR);
Logs.error(errMsg);
if(showErrorBox) funkin.backend.utils.NativeAPI.showMessageBox("Codename Engine Warning", errMsg, MSG_WARNING);
}
#end
+2 -2
View File
@@ -79,7 +79,7 @@ class DiscordUtil
try
config = Json.parse(Assets.getText(jsonPath))
catch (e)
Logs.trace('Couldn\'t load Discord RPC configuration: ${e.toString()}', ERROR);
Logs.error('Couldn\'t load Discord RPC configuration: ${e.toString()}');
}
if (config == null)
@@ -344,7 +344,7 @@ class DiscordUtil
Logs.traceColored([
Logs.logText("[Discord] ", BLUE),
Logs.logText("Someone has just requested to join", YELLOW)
], WARNING);
], INFO);
var req:DUser = DUser.initRaw(request);
call("onJoinRequest", [req]);
+5 -5
View File
@@ -43,7 +43,7 @@ class NdllUtil {
//return Reflect.callMethod(null, func, a); // wouldnt work for some reason, maybe cause like c++ functions doesnt have reflection enabled
});
#else
Logs.trace('NDLLs are not supported on this platform.', WARNING);
Logs.warn('NDLLs are not supported on this platform.');
return noop;
#end
}
@@ -58,20 +58,20 @@ class NdllUtil {
public static function getFunctionFromPath(ndll:String, name:String, args:Int):Dynamic {
#if NDLLS_SUPPORTED
if (!Assets.exists(ndll)) {
Logs.trace('Couldn\'t find ndll at ${ndll}.', WARNING);
Logs.warn('Couldn\'t find ndll at ${ndll}.');
return noop;
}
var func = lime.system.CFFI.load(Assets.getPath(ndll), name, args);
if (func == null) {
Logs.trace('Method ${name} in ndll ${ndll} with ${args} args was not found.', ERROR);
Logs.error('Method ${name} in ndll ${ndll} with ${args} args was not found.');
return noop;
}
return func;
#else
Logs.trace('NDLLs are not supported on this platform.', WARNING);
#end
Logs.warn('NDLLs are not supported on this platform.');
return noop;
#end
}
@:dox(hide) @:noCompletion static function noop() {}
@@ -123,13 +123,12 @@ class TranslationUtil
var xml:Access = null;
try xml = new Access(Xml.parse(Assets.getText('$mainPath/$file')))
catch(e) {
var msg:String = 'Error while parsing $file: ${Std.string(e)}';
FlxG.log.error(msg);
throw new Exception(msg);
Logs.error('Error while parsing $file: ${Std.string(e)}');
return [];
}
if (xml == null) return [];
if (!xml.hasNode.translations) {
Logs.trace("A translation xml file requires a translations root element.", WARNING, YELLOW);
Logs.warn("A translation xml file requires a translations root element.");
return [];
}
@@ -138,7 +137,7 @@ class TranslationUtil
switch(node.name) {
case "trans":
if (!node.has.id) {
FlxG.log.warn("A translation node requires an ID attribute.");
Logs.warn("A translation node requires an ID attribute.");
continue;
}
+2 -2
View File
@@ -24,7 +24,7 @@ class XMLUtil {
*/
public static function applyXMLProperty(object:Dynamic, property:Access):ErrorCode {
if (!property.has.name || !property.has.type || !property.has.value) {
Logs.trace('Failed to apply XML property: XML Element is missing name, type, or value attributes.', WARNING);
Logs.warn('Failed to apply XML property: XML Element is missing name, type, or value attributes.');
return MISSING_PROPERTY;
}
@@ -57,7 +57,7 @@ class XMLUtil {
if(isPath) {
str += ' (Path: ${property.att.name})';
}
Logs.trace(str, WARNING);
Logs.warn(str);
return REFLECT_ERROR;
}
return OK;
+13 -13
View File
@@ -409,7 +409,7 @@ class Charter extends UIState {
noteHoverer = new CharterNoteHoverer();
noteDeleteAnims = new CharterDeleteAnim();
selectionBox.cameras = notesGroup.cameras = gridBackdrops.cameras =
selectionBox.cameras = notesGroup.cameras = gridBackdrops.cameras =
noteHoverer.cameras = noteDeleteAnims.cameras = [charterCamera];
topMenuSpr = new UITopMenu(topMenu);
@@ -590,8 +590,8 @@ class Charter extends UIState {
// Just for now until i add event stacking -lunar
try {__relinkUndos();}
catch (e) {Logs.trace('Failed to relink undos: ${Std.string(e)}', ERROR);}
catch (e) {Logs.error('Failed to relink undos: ${Std.string(e)}');}
__applyPlaytestInfo();
}
@@ -611,13 +611,13 @@ class Charter extends UIState {
var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [
{name: "Inst.ogg", sound: FlxG.sound.music},
];
if (PlayState.SONG.meta.needsVoices != false)
if (PlayState.SONG.meta.needsVoices != false)
wavesToGenerate.push({name: "Voices.ogg", sound: vocals});
for (strumLine in strumLines)
if (strumLine.vocals != null && strumLine.strumLine.vocalsSuffix != null && strumLine.strumLine.vocalsSuffix != "")
wavesToGenerate.push({
name: 'Voices${strumLine.strumLine.vocalsSuffix}.ogg',
name: 'Voices${strumLine.strumLine.vocalsSuffix}.ogg',
sound: strumLine.vocals
});
@@ -699,20 +699,20 @@ class Charter extends UIState {
if (autoSaveTimer < Options.charterAutoSaveWarningTime && !autoSaveNotif.cancelled && !autoSaveNotif.showedAnimation) {
if (Options.charterAutoSavesSeperateFolder)
__autoSaveLocation = __diff.toLowerCase() + DateTools.format(Date.now(), "%m-%d_%H-%M");
autoSaveNotif.startAutoSave(autoSaveTimer,
!Options.charterAutoSavesSeperateFolder ? 'Saved chart at ${__diff.toLowerCase()}.json!' :
autoSaveNotif.startAutoSave(autoSaveTimer,
!Options.charterAutoSavesSeperateFolder ? 'Saved chart at ${__diff.toLowerCase()}.json!' :
'Saved chart at $__autoSaveLocation.json!'
);
}
if (autoSaveTimer <= 0) {
autoSaveTimer = Options.charterAutoSaveTime;
if (!autoSaveNotif.cancelled) {
buildChart();
buildChart();
var songPath:String = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}';
if (Options.charterAutoSavesSeperateFolder)
Chart.save(songPath, PlayState.SONG, __autoSaveLocation, {saveMetaInChart: false, folder: "autosaves", prettyPrint: Options.editorPrettyPrint});
else
else
Chart.save(songPath, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: false, prettyPrint: Options.editorPrettyPrint});
undos.save();
}
@@ -1331,7 +1331,7 @@ class Charter extends UIState {
defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == "normal" ? "" : '-${__diff.toLowerCase()}'}.json',
}));
}
function _file_saveas_psych(_) {
openSubState(new SaveSubstate(Json.stringify(PsychParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? "\t" : null), {
defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == "normal" ? "" : '-${__diff.toLowerCase()}'}.json',
@@ -1604,7 +1604,7 @@ class Charter extends UIState {
t.icon = (Options.charterLowDetailWaveforms = !Options.charterLowDetailWaveforms) ? 1 : 0;
for (shader in waveformHandler.waveShaders) shader.data.lowDetail.value = [Options.charterLowDetailWaveforms];
}
inline function _snap_increasesnap(_) changequant(1);
inline function _snap_decreasesnap(_) changequant(-1);
inline function _snap_resetsnap(_) setquant(16);
@@ -1885,7 +1885,7 @@ class Charter extends UIState {
}
@:noCompletion public function __clearStatics() {
selection = null; undos = null; clipboard = null; playtestInfo = null;
selection = null; undos = null; clipboard = null; playtestInfo = null;
waveformHandler.destroy(); Charter.waveformHandler = null; autoSaveTimer = 0;
}
@@ -133,7 +133,7 @@ class CharterBackdrop extends FlxTypedGroup<Dynamic> {
waveformSprite = new FlxSprite().makeSolid(1, 1, 0xFF000000);
waveformSprite.scale.set(160, 1);
waveformSprite.updateHitbox();
waveformSprite.updateHitbox();
add(waveformSprite);
sectionSeparator = new FlxBackdrop(null, Y, 0, 0);
@@ -200,7 +200,7 @@ class CharterBackdrop extends FlxTypedGroup<Dynamic> {
alpha = strumLine.strumLine.visible ? 0.9 : 0.4;
} else alpha = 0.9;
for (spr in [gridBackDrop, sectionSeparator, beatSeparator, topLimit, bottomLimit,
for (spr in [gridBackDrop, sectionSeparator, beatSeparator, topLimit, bottomLimit,
topSeparator, bottomSeparator, conductorFollowerSpr, waveformSprite]) {
spr.x = x; if (spr != waveformSprite) spr.alpha = alpha;
spr.cameras = this.cameras;
@@ -11,7 +11,7 @@ class CharterDeleteAnim extends CharterNote {
super();
sustainSpr.color = 0xFF630000; color = 0xFF605A5A;
snappedToStrumline = selectable = autoAlpha = false;
snappedToStrumline = selectable = autoAlpha = false;
@:privateAccess __animSpeed = 1.25;
garbageIcon = new FlxSprite().loadGraphic(Paths.image("editors/deleter"));
@@ -40,12 +40,12 @@ class CharterDeleteAnim extends CharterNote {
FlxG.mouse.getWorldPosition(Charter.instance.uiCamera, __mousePos);
if (FlxG.mouse.pressedRight && __deletionTimer <= 0) {
garbageIcon.setPosition(
__mousePos.x + garbageIcon.width/2 + (.65*FlxG.random.float(-1, 1)) + 2,
__mousePos.x + garbageIcon.width/2 + (.65*FlxG.random.float(-1, 1)) + 2,
__mousePos.y - garbageIcon.height + (.65*FlxG.random.float(-1, 1)) - 8
);
garbageCircle.setPosition(
__mousePos.x - garbageCircle.width/2,
__mousePos.x - garbageCircle.width/2,
(__mousePos.y - garbageCircle.height/2) + 2
);
}
@@ -56,7 +56,7 @@ class CharterDeleteAnim extends CharterNote {
public override function draw() @:privateAccess {
for (deleteData in deleteNotes) {
y = deleteData.note.y + (deleteData.time>deleteTime*.5 ? (deleteData.time/deleteTime)*FlxG.random.float(-1.1, 1.1) : 0); // lunar when no shake :((
y = deleteData.note.y + (deleteData.time>deleteTime*.5 ? (deleteData.time/deleteTime)*FlxG.random.float(-1.1, 1.1) : 0); // lunar when no shake :((
x = deleteData.note.x + (deleteData.time>deleteTime*.5 ? (deleteData.time/deleteTime)*FlxG.random.float(-1.1, 1.1) : 0); // lunar when no shake :((
angle = deleteData.note.angle; alpha = 1;
animation.curAnim.curFrame = 3;
@@ -69,7 +69,7 @@ class CharterDeleteAnim extends CharterNote {
typeText.exists = deleteData.note.type != 0; typeText.alpha = .4;
typeText.follow(this, 20 - (typeText.frameWidth/2), 20 - (typeText.frameHeight/2));
for (member in [this, sustainSpr, typeText])
for (member in [this, sustainSpr, typeText])
member.alpha *= FlxEase.quadInOut(deleteData.time/deleteTime);
super.draw();
@@ -32,7 +32,7 @@ class CharterStrumline extends UISprite {
}
return selectedWaveform = value;
}
public var waveformShader:CustomShader;
public var waveformShader:CustomShader;
public function new(strumLine:ChartStrumLine) {
super();
@@ -28,7 +28,7 @@ class CharterWaveformHandler extends FlxBasic {
public function generateData(name:String, sound:FlxSound):BitmapData {
if (!sounds.exists(name)) sounds.set(name, sound);
if (!analyzers.exists(name))
if (!analyzers.exists(name))
analyzers.set(name, new AudioAnalyzer(sound));
var analyzer:AudioAnalyzer = analyzers.get(name);
+2 -2
View File
@@ -106,7 +106,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
if (charXML == null) throw new Exception("Missing \"character\" node in XML.");
xml = new Access(charXML);
} catch (e) {
Logs.trace('Error while loading character ${curCharacter}: ${e}', ERROR);
Logs.error('Error while loading character ${curCharacter}: ${e}');
curCharacter = "bf";
continue;
}
@@ -521,7 +521,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
if (charXML == null) throw new Exception("Missing \"character\" node in XML.");
xml = new Access(charXML);
} catch(e) {
Logs.trace('Error while loading character ${curCharacter}: ${e}', ERROR);
Logs.error('Error while loading character ${curCharacter}: ${e}');
curCharacter = "bf";
continue;
}
+1 -1
View File
@@ -39,7 +39,7 @@ class SplashGroup extends FlxTypedGroup<FunkinSprite> {
// TODO: change to graphics cache
splash.drawComplex(FlxG.camera);
} catch(e:Dynamic) {
Logs.trace('Couldn\'t parse splash data for "${path}": ${e.toString()}', ERROR);
Logs.error('Couldn\'t parse splash data for "${path}": ${e.toString()}');
valid = false;
}
maxSize = 8;
+1 -1
View File
@@ -36,7 +36,7 @@ class Stage extends FlxBasic implements IBeatReceiver {
try {
if (Assets.exists(stagePath)) stageXML = new Access(Xml.parse(Assets.getText(stagePath)).firstElement());
} catch(e) {
Logs.trace('Couldn\'t load stage "$stage": ${e.message}', ERROR);
Logs.error('Couldn\'t load stage "$stage": ${e.message}');
}
if (PlayState.instance != null) {
@@ -62,8 +62,10 @@ class DialogueCutscene extends Cutscene {
// Add characters
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.');
if (charMap.exists(char.att.name)) {
Logs.warn('2 dialogue characters share the same name (${char.att.name}, ${char.att.name}). The old character has been replaced.');
remove(charMap[char.att.name], true);
}
var leChar:DialogueCharacter = new DialogueCharacter(char.att.name, char.getAtt('position').getDefault('default'));
if(char.has.defaultAnim) leChar.defaultAnim = char.att.defaultAnim;
@@ -110,7 +112,7 @@ class DialogueCutscene extends Cutscene {
next(true);
} catch(e) {
Logs.trace('Error while loading dialogue at ${dialoguePath}: ${e.toString()}', ERROR);
Logs.error('Error while loading dialogue at ${dialoguePath}: ${e.toString()}');
trace(CoolUtil.getLastExceptionStack());
close();
}
@@ -26,7 +26,7 @@ class ScriptedCutscene extends Cutscene {
trace("fuck you");
script.call("create");
if (Std.isOfType(script, DummyScript)) {
Logs.trace('Could not find script for scripted cutscene at ${scriptPath}', ERROR, RED);
Logs.error('Could not find script for scripted cutscene at ${scriptPath}');
close();
}
}
@@ -90,7 +90,7 @@ class DialogueBox extends FunkinSprite {
}
} catch(e) {
active = false;
Logs.trace('Couldn\'t load dialogue box "$name": ${e.toString()}', ERROR);
Logs.error('Couldn\'t load dialogue box "$name": ${e.toString()}');
}
defaultTextTypeSFX = [FlxG.sound.load(textTypeSFX)];
FlxG.sound.cache(nextSFX);
@@ -54,7 +54,7 @@ class DialogueCharacter extends FunkinSprite {
x = 0; y = 0;
} catch(e) {
var message:String = e.toString();
Logs.trace('Failed to load dialogue character $name: ${message}', ERROR);
Logs.error('Failed to load dialogue character $name: ${message}');
dialogueCharScript.call("loadingError", [message]);
}
visible = false;
+6 -6
View File
@@ -213,13 +213,13 @@ class StoryMenuState extends MusicBeatState {
try {
week = new Access(Xml.parse(Assets.getText(Paths.xml('weeks/weeks/$weekName'))).firstElement());
} catch(e) {
Logs.trace('Cannot parse week "$weekName.xml": ${Std.string(e)}`', ERROR);
Logs.error('Cannot parse week "$weekName.xml": ${Std.string(e)}');
}
if (week == null) continue;
if (!week.has.name) {
Logs.trace('Story Menu: Week at index ${k} has no name. Skipping...', WARNING);
Logs.warn('Story Menu: Week at index ${k} has no name. Skipping...');
continue;
}
var weekObj:WeekData = {
@@ -255,7 +255,7 @@ class StoryMenuState extends MusicBeatState {
try {
var name = song.innerData.trim();
if (name == "") {
Logs.trace('Story Menu: Song at index ${k2} in week ${weekObj.name} has no name. Skipping...', WARNING);
Logs.warn('Story Menu: Song at index ${k2} in week ${weekObj.name} has no name. Skipping...');
continue;
}
weekObj.songs.push({
@@ -263,12 +263,12 @@ class StoryMenuState extends MusicBeatState {
hide: song.getAtt('hide').getDefault('false') == "true"
});
} catch(e) {
Logs.trace('Story Menu: Song at index ${k2} in week ${weekObj.name} cannot contain any other XML nodes in its name.', WARNING);
Logs.warn('Story Menu: Song at index ${k2} in week ${weekObj.name} cannot contain any other XML nodes in its name.');
continue;
}
}
if (weekObj.songs.length <= 0) {
Logs.trace('Story Menu: Week ${weekObj.name} has no songs. Skipping...', WARNING);
Logs.warn('Story Menu: Week ${weekObj.name} has no songs. Skipping...');
continue;
}
this.weeks.push(weekObj);
@@ -280,7 +280,7 @@ class StoryMenuState extends MusicBeatState {
try {
char = new Access(Xml.parse(Assets.getText(Paths.xml('weeks/characters/$charName'))).firstElement());
} catch(e) {
Logs.trace('Story Menu: Cannot parse character "$charName.xml": ${Std.string(e)}`', ERROR);
Logs.error('Story Menu: Cannot parse character "$charName.xml": ${Std.string(e)}');
}
if (char == null) return;
+1 -1
View File
@@ -317,7 +317,7 @@ class TitleState extends MusicBeatState
}
}
} catch(e) {
Logs.trace('Failed to load titlescreen XML: $e', ERROR);
Logs.error('Failed to load titlescreen XML: $e');
}
}
#end
@@ -73,7 +73,7 @@ class CreditsCodename extends funkin.options.OptionsScreen {
var idk = GitHub.getContributors(author, "CodenameEngine", function(e) {
error = true;
var errMsg:String = 'Error while trying to download contributors list:\n${CoolUtil.removeIP(e.message)}';
Logs.traceColored([Logs.logText(errMsg.replace('\n', ' '), RED)], ERROR);
Logs.error(errMsg.replace('\n', ' '));
funkin.backend.utils.NativeAPI.showMessageBox("Codename Engine Warning", errMsg, MSG_WARNING);
});
if(error) return false;
@@ -84,7 +84,7 @@ class CreditsCodename extends funkin.options.OptionsScreen {
var idk2 = GitHub.getOrganizationMembers(author, function(e) {
errorOnMain = true;
var errMsg:String = 'Error while trying to download $author members list:\n${CoolUtil.removeIP(e.message)}';
Logs.traceColored([Logs.logText(errMsg.replace('\n', ' '), RED)], ERROR);
Logs.error(errMsg.replace('\n', ' '));
funkin.backend.utils.NativeAPI.showMessageBox("Codename Engine Warning", errMsg, MSG_WARNING);
});
if(!errorOnMain) {
+3 -3
View File
@@ -27,7 +27,7 @@ class CreditsMain extends TreeMenu {
try {
access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT", source)));
} catch(e) {
Logs.trace('Error while parsing credits.xml: ${Std.string(e)}', ERROR);
Logs.error('Error while parsing credits.xml: ${Std.string(e)}');
}
if (access != null)
@@ -59,7 +59,7 @@ class CreditsMain extends TreeMenu {
if (node.name == "github") {
if (!node.has.user) {
Logs.trace("A github node requires a user attribute.", WARNING);
Logs.warn("A github node requires a user attribute.");
continue;
}
@@ -76,7 +76,7 @@ class CreditsMain extends TreeMenu {
));
} else {
if (!node.has.name) {
Logs.trace("A credit node requires a name attribute.", WARNING);
Logs.warn("A credit node requires a name attribute.");
continue;
}
var name = node.getAtt("name");
+5 -5
View File
@@ -75,7 +75,7 @@ class OptionsMenu extends TreeMenu {
try {
access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT", source)));
} catch(e) {
Logs.trace('Error while parsing options.xml: ${Std.string(e)}', ERROR);
Logs.error('Error while parsing options.xml: ${Std.string(e)}');
}
if (access != null)
@@ -100,7 +100,7 @@ class OptionsMenu extends TreeMenu {
for(node in xml.elements) {
if (!node.has.name) {
Logs.trace("An option node requires a name attribute.", WARNING);
Logs.warn("An option node requires a name attribute.");
continue;
}
var name = node.getAtt("name");
@@ -109,20 +109,20 @@ class OptionsMenu extends TreeMenu {
switch(node.name) {
case "checkbox":
if (!node.has.id) {
Logs.trace("A checkbox option requires an \"id\" for option saving.", WARNING);
Logs.warn("A checkbox option requires an \"id\" for option saving.");
continue;
}
options.push(new Checkbox(name, desc, node.att.id, FlxG.save.data));
case "number":
if (!node.has.id) {
Logs.trace("A number option requires an \"id\" for option saving.", WARNING);
Logs.warn("A number option requires an \"id\" for option saving.");
continue;
}
options.push(new NumOption(name, desc, Std.parseFloat(node.att.min), Std.parseFloat(node.att.max), Std.parseFloat(node.att.change), node.att.id, null, FlxG.save.data));
case "choice":
if (!node.has.id) {
Logs.trace("A choice option requires an \"id\" for option saving.", WARNING);
Logs.warn("A choice option requires an \"id\" for option saving.");
continue;
}
@@ -64,7 +64,7 @@ class GithubUserIcon extends FlxSprite
var bytes = null;
if(unfLink) {
try bytes = HttpUtil.requestBytes('${user.avatar_url}?size=$size')
catch(e) Logs.traceColored([Logs.logText('Failed to download github pfp for ${user.login}: ${CoolUtil.removeIP(e.message)} - (Retrying using the api..)', RED)], ERROR);
catch(e) Logs.error('Failed to download github pfp for ${user.login}: ${CoolUtil.removeIP(e.message)} - (Retrying using the api..)');
if(bytes != null) {
bmap = BitmapData.fromBytes(bytes);
@@ -73,9 +73,9 @@ class GithubUserIcon extends FlxSprite
}
if(planB) {
if(unfLink) user = GitHub.getUser(user.login, function(e) Logs.traceColored([Logs.logText('Failed to download github user info for ${user.login}: ${CoolUtil.removeIP(e.message)}', RED)], ERROR)); // Api part - Nex
if(unfLink) user = GitHub.getUser(user.login, function(e) Logs.error('Failed to download github user info for ${user.login}: ${CoolUtil.removeIP(e.message)}')); // Api part - Nex
try bytes = HttpUtil.requestBytes('${user.avatar_url}&size=$size')
catch(e) Logs.traceColored([Logs.logText('Failed to download github pfp for ${user.login}: ${CoolUtil.removeIP(e.message)}', RED)], ERROR);
catch(e) Logs.error('Failed to download github pfp for ${user.login}: ${CoolUtil.removeIP(e.message)}');
if(bytes != null) bmap = BitmapData.fromBytes(bytes);
}
@@ -88,7 +88,7 @@ class GithubUserIcon extends FlxSprite
bmap = null;
mutex.release();
} catch(e) {
Logs.traceColored([Logs.logText('Failed to update the pfp for ${user.login}: ${e.message}', RED)], ERROR);
Logs.error('Failed to update the pfp for ${user.login}: ${e.message}');
}
} else {
mutex.acquire();