Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions source/HealthIcon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,26 @@ class HealthIcon extends FlxSprite
var file:Dynamic = Paths.image(name);

loadGraphic(file); //Load stupidly first for getting the file size
loadGraphic(file, true, Math.floor(width / 3), Math.floor(height)); //Then load it fr
iconOffsets[0] = (width - 150) / 3;
iconOffsets[1] = (width - 150) / 3;
iconOffsets[2] = (width - 150) / 3;
updateHitbox();

animation.add(char, [0, 1, 2], 0, false, isPlayer);
animation.play(char);
this.char = char;
if(width == 450){ // goofy ahh codesing
loadGraphic(file, true, Math.floor(width / 3), Math.floor(height)); //Then load it fr
iconOffsets[0] = (width - 150) / 3;
iconOffsets[1] = (width - 150) / 3;
updateHitbox();
animation.add(char, [0, 1, 2], 0, false, isPlayer);
animation.play(char);
this.char = char;

}
else if(width == 300){
loadGraphic(file, true, Math.floor(width / 2), Math.floor(height)); //Then load it fr
iconOffsets[0] = (width - 150) / 2;
iconOffsets[1] = (width - 150) / 2;
updateHitbox();
animation.add(char, [0, 1], 0, false, isPlayer);
animation.play(char);
this.char = char;

}

antialiasing = ClientPrefs.globalAntialiasing;
if(char.endsWith('-pixel')) {
Expand Down
55 changes: 54 additions & 1 deletion source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ import openfl.display.Sprite;
import openfl.events.Event;
import openfl.display.StageScaleMode;


import lime.app.Application;
import openfl.events.UncaughtErrorEvent;
import haxe.CallStack;
import haxe.io.Path;
import sys.FileSystem;
import sys.io.File;
import sys.io.Process;
import Discord.DiscordClient;

using StringTools;


class Main extends Sprite
{
var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom).
Expand Down Expand Up @@ -76,7 +89,7 @@ class Main extends Sprite
// fuck you, persistent caching stays ON during sex
FlxGraphic.defaultPersist = true;
// the reason for this is we're going to be handling our own cache smartly
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));
addChild(new FlxGame(gameWidth, gameHeight, initialState #if(flixel < "5.0.0"), zoom #end, framerate, framerate, skipSplash, startFullscreen)); // lol

#if !mobile
fpsVar = new FPS(10, 3, 0xFFFFFF);
Expand All @@ -92,5 +105,45 @@ class Main extends Sprite
FlxG.autoPause = false;
FlxG.mouse.visible = false;
#end

Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onCrash);
}

function onCrash(e:UncaughtErrorEvent):Void // putting shiz in, smh
{
var errMsg:String = "";
var path:String;
var callStack:Array<StackItem> = CallStack.exceptionStack(true);
var dateNow:String = Date.now().toString();

dateNow = dateNow.replace(" ", "_");
dateNow = dateNow.replace(":", "'");

path = "./crash/" + "PsychEngine_" + dateNow + ".txt";

for (stackItem in callStack)
{
switch (stackItem)
{
case FilePos(s, file, line, column):
errMsg += file + " (line " + line + ")\n";
default:
Sys.println(stackItem);
}
}

errMsg += "\nUncaught Error: " + e.error + "\nPlease report this error to the GitHub page: https://github.com/ShadowMario/FNF-PsychEngine\n\n> Crash Handler written by: sqirra-rng";

if (!FileSystem.exists("./crash/"))
FileSystem.createDirectory("./crash/");

File.saveContent(path, errMsg + "\n");

Sys.println(errMsg);
Sys.println("Crash dump saved in " + Path.normalize(path));

Application.current.window.alert(errMsg, "Error!");
DiscordClient.shutdown();
Sys.exit(1);
}
}
2 changes: 1 addition & 1 deletion source/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class MainMenuState extends MusicBeatState
add(leGradientBar);
leGradientBar.scrollFactor.set(0, 0);

var bgScroll:FlxBackdrop = new FlxBackdrop(Paths.image('cubicbg'), 5, 5, true, true);
var bgScroll:FlxBackdrop = new FlxBackdrop(Paths.image('cubicbg'), #if (flixel < "5.0.0") 5, 5, true, true,#else XY,#end 1,1); // flixel compatibility sucks
bgScroll.scrollFactor.set();
bgScroll.screenCenter();
bgScroll.velocity.set(50, 50);
Expand Down
Loading