diff --git a/source/CoolUtil.hx b/source/CoolUtil.hx index ffdf13bbcff..0b6afdce5a2 100644 --- a/source/CoolUtil.hx +++ b/source/CoolUtil.hx @@ -39,7 +39,7 @@ class CoolUtil inline public static function quantize(f:Float, snap:Float){ // changed so this actually works lol var m:Float = Math.fround(f * snap); - trace(snap); + //trace(snap); yo why does it trace the snap return (m / snap); } diff --git a/source/Note.hx b/source/Note.hx index 21028b88ea2..99f11b3f925 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -374,7 +374,7 @@ class Note extends FlxSprite this.shader = new ColoredNoteShader(PlayState.instance.boyfriend.healthColorArray[0], PlayState.instance.boyfriend.healthColorArray[1], PlayState.instance.boyfriend.healthColorArray[2], false, 10); } if (gfNote) { - this.shader = new ColoredNoteShader(PlayState.instance.gf.healthColorArray[0], PlayState.instance.gf.healthColorArray[1], PlayState.instance.gf.healthColorArray[2], false, 10); + if (PlayState.instance.gf != null) this.shader = new ColoredNoteShader(PlayState.instance.gf.healthColorArray[0], PlayState.instance.gf.healthColorArray[1], PlayState.instance.gf.healthColorArray[2], false, 10); } } } diff --git a/source/PlayState.hx b/source/PlayState.hx index 0e795f63dfa..12c28488310 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -7100,7 +7100,7 @@ if (ClientPrefs.showNPS) { case 'gf': if (gfGhostTween != null) gfGhostTween.cancel(); - ghost.color = FlxColor.fromRGB(gf.healthColorArray[0] + 50, gf.healthColorArray[1] + 50, gf.healthColorArray[2] + 50); + if (gf != null) ghost.color = FlxColor.fromRGB(gf.healthColorArray[0] + 50, gf.healthColorArray[1] + 50, gf.healthColorArray[2] + 50); gfGhostTween = FlxTween.tween(gfGhost, {alpha: 0}, 0.75, { ease: FlxEase.linear, onComplete: function(twn:FlxTween) @@ -8312,7 +8312,7 @@ if (!allSicks && ClientPrefs.colorRatingHit && ClientPrefs.hudType != 'Tails Get final animToPlay:String = singAnimations[Std.int(Math.abs(daNote.noteData))] + altAnim; if(daNote.gfNote && ClientPrefs.charsAndBG) { char = gf; - if (ClientPrefs.doubleGhost) + if (ClientPrefs.doubleGhost && gf != null) { if (!daNote.isSustainNote && noteRows[daNote.mustPress?0:1][daNote.row].length > 1) { @@ -8513,7 +8513,7 @@ if (!allSicks && ClientPrefs.colorRatingHit && ClientPrefs.hudType != 'Tails Get if (ClientPrefs.noteColorStyle == 'Char-Based') { if (!isDadNote) splashColor = FlxColor.fromRGB(boyfriend.healthColorArray[0], boyfriend.healthColorArray[1], boyfriend.healthColorArray[2]); - if (isGfNote) splashColor = FlxColor.fromRGB(gf.healthColorArray[0], gf.healthColorArray[1], gf.healthColorArray[2]); + if (isGfNote && gf != null) splashColor = FlxColor.fromRGB(gf.healthColorArray[0], gf.healthColorArray[1], gf.healthColorArray[2]); } var splash:NoteSplash = grpNoteSplashes.recycle(NoteSplash); diff --git a/source/Song.hx b/source/Song.hx index a29378865bc..97b5fc5c3da 100644 --- a/source/Song.hx +++ b/source/Song.hx @@ -49,7 +49,7 @@ class Song public var speed:Float = 1; public var stage:String; public var songCredit:String; - public var event7:String; + public var event7:String = 'None'; public var event7Value:String; public var windowName:String; public var validScore:Bool = true; diff --git a/source/StrumNote.hx b/source/StrumNote.hx index f22b958a9b7..fb7427b91e8 100644 --- a/source/StrumNote.hx +++ b/source/StrumNote.hx @@ -245,7 +245,7 @@ class StrumNote extends FlxSprite rgbShaderEnabled = true; } public function enableRGBGF() { - if (Std.isOfType(this.shader, ColoredNoteShader)) + if (Std.isOfType(this.shader, ColoredNoteShader) && PlayState.instance.gf != null) cast(this.shader, ColoredNoteShader).setColors(PlayState.instance.gf.healthColorArray[0], PlayState.instance.gf.healthColorArray[1], PlayState.instance.gf.healthColorArray[2]); cast(this.shader, ColoredNoteShader).enabled.value = [true]; rgbShaderEnabled = true; diff --git a/source/editors/ChartingState.hx b/source/editors/ChartingState.hx index d4813e072b6..0fe4cdac8ff 100644 --- a/source/editors/ChartingState.hx +++ b/source/editors/ChartingState.hx @@ -79,6 +79,7 @@ class ChartingState extends MusicBeatState private var noteTypeIntMap:Map = new Map(); private var noteTypeMap:Map> = new Map>(); public var ignoreWarnings = false; + public var showTheGrid = false; public var undos = []; public var redos = []; var eventStuff:Array = @@ -537,6 +538,7 @@ class ChartingState extends MusicBeatState var check_mute_inst:FlxUICheckBox = null; var check_vortex:FlxUICheckBox = null; + var check_showGrid:FlxUICheckBox = null; var check_warnings:FlxUICheckBox = null; var playSoundBf:FlxUICheckBox = null; var playSoundDad:FlxUICheckBox = null; @@ -575,7 +577,8 @@ class ChartingState extends MusicBeatState var reloadSongJson:FlxButton = new FlxButton(reloadSong.x, saveButton.y + 30, "Reload JSON", function() { - openSubState(new Prompt('This action will clear current progress.\n\nProceed?', 0, function(){loadJson(_song.song.toLowerCase()); }, null,ignoreWarnings)); + openSubState(new Prompt('This action will clear current progress.\n\nProceed?', 0, function() + {loadJson(_song.song.toLowerCase()); }, null,ignoreWarnings)); }); var loadAutosaveBtn:FlxButton = new FlxButton(reloadSongJson.x, reloadSongJson.y + 30, 'Load Autosave', function() @@ -793,6 +796,10 @@ class ChartingState extends MusicBeatState FlxG.camera.follow(camPos); } + function songJsonPopup() { //you tried reloading the json, but it doesn't exist + CoolUtil.coolError("The engine failed to load the JSON! \nEither it doesn't exist, or the name doesn't match with the one you're putting?", "JS Engine Anti-Crash Tool"); + } + var creditInputText:FlxUIInputText; var winNameInputText:FlxUIInputText; function addSongDataUI():Void //therell be more added here later @@ -1669,6 +1676,17 @@ class ChartingState extends MusicBeatState reloadGridLayer(); }; + check_showGrid = new FlxUICheckBox(10, 220, null, null, "Show Grid", 100); + if (FlxG.save.data.showGrid == null) FlxG.save.data.showGrid = false; + check_showGrid.checked = FlxG.save.data.showGrid; + + check_showGrid.callback = function() + { + FlxG.save.data.showGrid = check_showGrid.checked; + showTheGrid = FlxG.save.data.showGrid; + reloadGridLayer(); + }; + check_warnings = new FlxUICheckBox(10, 120, null, null, "Ignore Progress Warnings", 100); if (FlxG.save.data.ignoreWarnings == null) FlxG.save.data.ignoreWarnings = false; check_warnings.checked = FlxG.save.data.ignoreWarnings; @@ -1773,6 +1791,7 @@ class ChartingState extends MusicBeatState tab_group_chart.add(check_vortex); tab_group_chart.add(mouseScrollingQuant); tab_group_chart.add(check_warnings); + tab_group_chart.add(check_showGrid); tab_group_chart.add(playSoundBf); tab_group_chart.add(playSoundDad); UI_box.addGroup(tab_group_chart); @@ -2721,7 +2740,9 @@ class ChartingState extends MusicBeatState var lastSecBeatsNext:Float = 0; function reloadGridLayer() { gridLayer.clear(); - gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 9, Std.int(GRID_SIZE * getSectionBeats() * 4 * zoomList[curZoom])); + if (showTheGrid) + gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 9, Std.int(GRID_SIZE * getSectionBeats() * 4 * zoomList[curZoom])); + else gridBG = new FlxSprite().makeGraphic(Std.int(GRID_SIZE * 9), Std.int(GRID_SIZE * getSectionBeats() * 4 * zoomList[curZoom]), 0xffe7e6e6); #if desktop if(FlxG.save.data.chart_waveformInst || FlxG.save.data.chart_waveformVoices) { @@ -2733,11 +2754,15 @@ class ChartingState extends MusicBeatState var foundNextSec:Bool = false; if(sectionStartTime(1) <= FlxG.sound.music.length) { - nextGridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 9, Std.int(GRID_SIZE * getSectionBeats(curSec + 1) * 4 * zoomList[curZoom])); - leHeight = Std.int(gridBG.height + nextGridBG.height); - foundNextSec = true; + if (showTheGrid) { + // If showTheGrid is enabled, create a grid overlay for the next section + nextGridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 9, Std.int(GRID_SIZE * getSectionBeats(curSec + 1) * 4 * zoomList[curZoom])); + leHeight = Std.int(gridBG.height + nextGridBG.height); + foundNextSec = true; + } else { // Else, make a simple gray graphic + nextGridBG = new FlxSprite().makeGraphic(1, 1, FlxColor.TRANSPARENT); + } } - else nextGridBG = new FlxSprite().makeGraphic(1, 1, FlxColor.TRANSPARENT); nextGridBG.y = gridBG.height; gridLayer.add(nextGridBG); @@ -3704,6 +3729,8 @@ class ChartingState extends MusicBeatState { //shitty null fix, i fucking hate it when this happens //make it look sexier if possible + if(sys.FileSystem.exists(Paths.json(song + '/' + song)) || sys.FileSystem.exists(Paths.modsJson(song + '/' + song))) + { if (CoolUtil.difficulties[PlayState.storyDifficulty] != CoolUtil.defaultDifficulty) { if(CoolUtil.difficulties[PlayState.storyDifficulty] == null){ PlayState.SONG = Song.loadFromJson(song.toLowerCase(), song.toLowerCase()); @@ -3714,6 +3741,12 @@ class ChartingState extends MusicBeatState PlayState.SONG = Song.loadFromJson(song.toLowerCase(), song.toLowerCase()); } MusicBeatState.resetState(); + } + else + { + trace (song + "'s JSON doesn't exist!"); + songJsonPopup(); //HAH, IT AINT CRASHING NOW + } } public function autosaveSong():Void