diff --git a/Project.xml b/Project.xml index 578659ea..e85821b0 100644 --- a/Project.xml +++ b/Project.xml @@ -2,7 +2,7 @@ - + diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index e155b513..97be45f7 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -228,16 +228,6 @@ class KadeEngineData if (FlxG.save.data.mirror == null) FlxG.save.data.mirror = false; - #if web - if (FlxG.save.data.stressMP4 == null) - FlxG.save.data.stressMP4 = false; - #else - if (FlxG.save.data.stressMP4 == null) - FlxG.save.data.stressMP4 = true; - - if (FlxG.save.data.stressMP4 == false) - FlxG.save.data.stressMP4 = true; - #end if (FlxG.save.data.background == null) FlxG.save.data.background = true; diff --git a/source/Main.hx b/source/Main.hx index 95a62247..c9ef3140 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -128,8 +128,6 @@ class Main extends Sprite { if (Std.isOfType(this, debug.StageDebugState)) Paths.clearStoredMemory(true); - if (!FlxG.save.data.gpuRender) - FlxG.bitmap.dumpCache(); var cache = cast(Assets.cache, AssetCache); for (key => font in cache.font) diff --git a/source/Paths.hx b/source/Paths.hx index fbb4f953..6a44ad62 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -60,7 +60,15 @@ class Paths } // Sprite content caching with GPU based on Forever Engine texture compression. - public static function loadImage(key:String, ?library:String, ?gpuRender:Bool):FlxGraphic + + /** + * For a given key and library for an image, returns the corresponding BitmapData. + * We can probably move the cache handling here. + * @param key + * @param library + * @return BitmapData + */ + static function loadImage(key:String, ?library:String, ?gpuRender:Bool) { var path:String = ''; @@ -71,36 +79,39 @@ class Paths if (OpenFlAssets.exists(path, IMAGE)) { - if (!currentTrackedAssets.exists(key)) + if (!currentTrackedAssets.exists(path)) { var bitmap:BitmapData = OpenFlAssets.getBitmapData(path, false); - var graphic:FlxGraphic = null; + var graphic:FlxGraphic = null; if (gpuRender) { - var texture = FlxG.stage.context3D.createTexture(bitmap.width, bitmap.height, BGRA, false, 0); + bitmap.lock(); + var texture = FlxG.stage.context3D.createRectangleTexture(bitmap.width, bitmap.height, BGRA, true); texture.uploadFromBitmapData(bitmap); - currentTrackedTextures.set(key, texture); + bitmap.disposeImage(); + FlxDestroyUtil.dispose(bitmap); + bitmap = null; - graphic = FlxGraphic.fromBitmapData(BitmapData.fromTexture(texture), false, key); - } - else - { - graphic = FlxGraphic.fromBitmapData(bitmap, false, key, false); + + bitmap = BitmapData.fromTexture(texture); + + bitmap.unlock(); } + graphic = FlxGraphic.fromBitmapData(bitmap, false, path, false); + graphic.persist = true; - currentTrackedAssets.set(key, graphic); + currentTrackedAssets.set(path, graphic); } else { // Get data from cache. // Debug.logTrace('Loading existing image from cache: $key'); } - - localTrackedAssets.push(key); - return currentTrackedAssets.get(key); + localTrackedAssets.push(path); + return currentTrackedAssets.get(path); } Debug.logWarn('Could not find image at path $path'); diff --git a/source/PlayState.hx b/source/PlayState.hx index 9671e817..403b21cc 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -490,6 +490,7 @@ class PlayState extends MusicBeatState scrollSpeed = FlxG.save.data.scrollSpeed; PlayStateChangeables.Optimize = FlxG.save.data.optimize; PlayStateChangeables.zoom = FlxG.save.data.zoom; + PlayStateChangeables.botPlay = FlxG.save.data.botplay; if (!isStoryMode) { @@ -3884,7 +3885,7 @@ class PlayState extends MusicBeatState || daNote.wasGoodHit || holdArray[Math.floor(Math.abs(daNote.noteData))])) { - if (daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= origin) + if ((daNote.causesMisses) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= origin) { // Clip to strumline swagRect.width = daNote.frameWidth; @@ -3897,14 +3898,9 @@ class PlayState extends MusicBeatState } else { - if (daNote.mustPress) - daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y - - 0.45 * ((Conductor.songPosition - daNote.strumTime) / songMultiplier) * (FlxMath.roundDecimal(leSpeed, 2))) - + daNote.noteYOff; - else - daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y - - 0.45 * ((Conductor.songPosition - daNote.strumTime) / songMultiplier) * (FlxMath.roundDecimal(leSpeed, 2))) - + daNote.noteYOff; + daNote.y = (strumY + - 0.45 * ((Conductor.songPosition - daNote.strumTime) / songMultiplier) * (FlxMath.roundDecimal(leSpeed, 2))) + + daNote.noteYOff; if (daNote.isSustainNote) { if ((PlayStateChangeables.botPlay @@ -3913,7 +3909,7 @@ class PlayState extends MusicBeatState || holdArray[Math.floor(Math.abs(daNote.noteData))])) { // Clip to strumline - if (daNote.y + daNote.offset.y * daNote.scale.y <= origin) + if ((daNote.causesMisses) && daNote.y + daNote.offset.y * daNote.scale.y <= origin) { swagRect.y = (origin - daNote.y) / daNote.scale.y; swagRect.width = daNote.width / daNote.scale.x; @@ -3981,7 +3977,7 @@ class PlayState extends MusicBeatState totalNotesHit += 1; else { - if (daNote.causesMisses && !daNote.isSustainEnd) + if (daNote.causesMisses && !daNote.sustainActive && !daNote.isSustainEnd) { if (!SONG.splitVoiceTracks) vocals.volume = 0; @@ -4021,7 +4017,6 @@ class PlayState extends MusicBeatState if (!daNote.wasGoodHit && daNote.isSustainNote && daNote.sustainActive - && daNote.spotInLine != daNote.parent.children.length && !daNote.isSustainEnd && daNote.causesMisses) { @@ -4029,7 +4024,6 @@ class PlayState extends MusicBeatState trace("hold fell over at " + daNote.spotInLine); for (i in daNote.parent.children) { - i.alpha = 0.3; i.sustainActive = false; } if (daNote.parent.wasGoodHit) @@ -4060,12 +4054,13 @@ class PlayState extends MusicBeatState } else { - if (daNote.causesMisses && !daNote.isSustainEnd) + if (daNote.causesMisses && !daNote.sustainActive && !daNote.isSustainEnd) { if (!SONG.splitVoiceTracks) vocals.volume = 0; else vocalsPlayer.volume = 0; + Debug.logTrace("huh2"); } if (theFunne && !daNote.isSustainNote && daNote.causesMisses) { @@ -4091,7 +4086,6 @@ class PlayState extends MusicBeatState if (!daNote.wasGoodHit && daNote.isSustainNote && daNote.sustainActive - && daNote.spotInLine != daNote.parent.children.length && !daNote.isSustainEnd && daNote.causesMisses) { diff --git a/source/debug/ChartingState.hx b/source/debug/ChartingState.hx index 58e1c1b1..7b873660 100644 --- a/source/debug/ChartingState.hx +++ b/source/debug/ChartingState.hx @@ -1813,7 +1813,7 @@ class ChartingState extends MusicBeatState function loadSong(daSong:String, reloadFromFile:Bool = false):Void { - inst = new FlxSound().loadEmbedded(Paths.inst(_song.audioFile)); + inst = FlxG.sound.load(Paths.inst(_song.audioFile)); if (inst != null) { inst.stop(); @@ -1831,7 +1831,7 @@ class ChartingState extends MusicBeatState if (!_song.splitVoiceTracks) { if (_song.needsVoices) - vocals = new FlxSound().loadEmbedded(Paths.voices(_song.audioFile)); + vocals = FlxG.sound.load(Paths.voices(_song.audioFile)); else vocals = new FlxSound(); FlxG.sound.list.add(vocals); @@ -1840,8 +1840,8 @@ class ChartingState extends MusicBeatState { if (_song.needsVoices) { - vocalsPlayer = new FlxSound().loadEmbedded(Paths.voices(_song.audioFile, 'P')); - vocalsEnemy = new FlxSound().loadEmbedded(Paths.voices(_song.audioFile, 'E')); + vocalsPlayer = FlxG.sound.load(Paths.voices(_song.audioFile, 'P')); + vocalsEnemy = FlxG.sound.load(Paths.voices(_song.audioFile, 'E')); } else { diff --git a/source/stages/Stage.hx b/source/stages/Stage.hx index a5a86ca7..790669cf 100644 --- a/source/stages/Stage.hx +++ b/source/stages/Stage.hx @@ -73,12 +73,13 @@ class Stage extends MusicBeatState this.curStage = daStage; camZoom = 1.05; // Don't change zoom here, unless you want to change zoom of every stage that doesn't have custom one - if (FlxG.save.data.background) + if (!FlxG.save.data.optimize) { switch (daStage) { case 'halloween': { + hasGF = false; if (FlxG.save.data.distractions) { var hallowTex = Paths.getSparrowAtlas('halloween_bg', 'week2');