From 8e90740ccf5d07436fe628c20b945226a2da7851 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Sat, 17 Dec 2022 14:11:00 +0100 Subject: [PATCH] removed deprecated away3d support --- Project.xml | 2 +- buildnumber.txt | 2 +- .../displayobject/SpriteSymbol.hx | 1 - .../tilecontainer/TileContainerSymbol.hx | 1 - source/flx3d/FlxView3D.hx | 1 + source/funkin/away3d/Flx3DObject.hx | 5 - source/funkin/away3d/Flx3DView.hx | 113 ------------------ source/funkin/away3d/FlxMesh.hx | 30 ----- source/funkin/away3d/README.txt | 1 - source/funkin/game/HealthIcon.hx | 1 - source/funkin/game/PlayState.hx | 11 +- source/funkin/game/Stage.hx | 3 +- source/funkin/shaders/CustomShader.hx | 5 +- source/funkin/shaders/FunkinShader.hx | 2 - source/funkin/system/CoolUtil.hx | 1 - source/funkin/system/Main.hx | 2 - source/funkin/system/ZipUtils.hx | 2 +- 17 files changed, 13 insertions(+), 170 deletions(-) delete mode 100644 source/funkin/away3d/Flx3DObject.hx delete mode 100644 source/funkin/away3d/Flx3DView.hx delete mode 100644 source/funkin/away3d/FlxMesh.hx delete mode 100644 source/funkin/away3d/README.txt diff --git a/Project.xml b/Project.xml index 1c383c35..b0d15bd9 100644 --- a/Project.xml +++ b/Project.xml @@ -87,10 +87,10 @@ + - diff --git a/buildnumber.txt b/buildnumber.txt index f4a8e832..f083bc3c 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1513 \ No newline at end of file +1516 \ No newline at end of file diff --git a/source/animateatlas/displayobject/SpriteSymbol.hx b/source/animateatlas/displayobject/SpriteSymbol.hx index e3128fff..42ea0273 100644 --- a/source/animateatlas/displayobject/SpriteSymbol.hx +++ b/source/animateatlas/displayobject/SpriteSymbol.hx @@ -214,7 +214,6 @@ class SpriteSymbol extends Sprite { } private function createLayers():Void { - // todo safety check for not initialiing twice if (_layers != null) { throw new Error("You must not call this twice"); } diff --git a/source/animateatlas/tilecontainer/TileContainerSymbol.hx b/source/animateatlas/tilecontainer/TileContainerSymbol.hx index 316dddfa..3d0e35ac 100644 --- a/source/animateatlas/tilecontainer/TileContainerSymbol.hx +++ b/source/animateatlas/tilecontainer/TileContainerSymbol.hx @@ -201,7 +201,6 @@ class TileContainerSymbol extends TileContainer { } private function createLayers():Void { - // todo safety check for not initialiing twice if (_layers != null) { throw new Error("You must not call this twice"); } diff --git a/source/flx3d/FlxView3D.hx b/source/flx3d/FlxView3D.hx index d6167714..03ddfaa8 100644 --- a/source/flx3d/FlxView3D.hx +++ b/source/flx3d/FlxView3D.hx @@ -40,6 +40,7 @@ class FlxView3D extends FlxSprite view.width = width == -1 ? FlxG.width : width; view.height = height == -1 ? FlxG.height : height; view.backgroundAlpha = 0; + view.alpha = 0; bmp = new BitmapData(Std.int(view.width), Std.int(view.height), true, 0x0); loadGraphic(bmp); diff --git a/source/funkin/away3d/Flx3DObject.hx b/source/funkin/away3d/Flx3DObject.hx deleted file mode 100644 index b1643625..00000000 --- a/source/funkin/away3d/Flx3DObject.hx +++ /dev/null @@ -1,5 +0,0 @@ -package funkin.away3d; - -interface Flx3DObject { - public function destroy():Void; -} \ No newline at end of file diff --git a/source/funkin/away3d/Flx3DView.hx b/source/funkin/away3d/Flx3DView.hx deleted file mode 100644 index 3c35abd4..00000000 --- a/source/funkin/away3d/Flx3DView.hx +++ /dev/null @@ -1,113 +0,0 @@ -package funkin.away3d; - -import away3d.loaders.parsers.OBJParser; -import away3d.events.Asset3DEvent; -import openfl.utils.ByteArray; -import flixel.util.typeLimit.OneOfTwo; -import away3d.entities.Mesh; -import openfl.utils.Assets; -import hscript.Bytes; -import openfl.display.Sprite; -import flixel.FlxG; -import flixel.FlxObject; -import away3d.containers.View3D; -import away3d.loaders.Loader3D; -import away3d.loaders.misc.AssetLoaderToken; -import away3d.loaders.misc.AssetLoaderContext; -import openfl.display.BitmapData; -import flixel.FlxSprite; -import haxe.io.Path; - -class Flx3DView extends FlxSprite { - // STATIC STUFF - #if REGION - private static var __sprite:Sprite; - - public static function init() { - __sprite = new Sprite(); - FlxG.game.addChild(__sprite); - } - #end - - private var __bitmap:BitmapData; - private var __loader:Loader3D = new Loader3D(); - - public var view3d:View3D; - - public var meshes:Array = []; - - public function new(x:Float, y:Float, width:Int = 0, height:Int = 0) { - super(x, y); - __loader.addEventListener(Asset3DEvent.ASSET_COMPLETE, assetComplete); - view3d = new View3D(); - view3d.scene.addChild(__loader); - - if (width <= 0) width = FlxG.width; - if (height <= 0) height = FlxG.height; - - resizeBitmap(width, height); - - __sprite.addChild(view3d); - } - - public function assetComplete(event:Asset3DEvent) { - - } - - public function loadMesh(asset:String, callback:Mesh->Void) { - try { - var meshContent:ByteArrayData = Assets.getBytes(asset); - - if (meshContent == null) - throw "Mesh Asset is null or does not exist."; - - var context = new AssetLoaderContext(); - - var mtlPath = '${Path.withoutExtension(asset)}.mtl'; - trace(Path.withoutDirectory(mtlPath)); - context.mapUrlToData(Path.withoutDirectory(mtlPath), Assets.getBytes(mtlPath)); - - var token = __loader.loadData(meshContent, context, null, new OBJParser()); - token.addEventListener(Asset3DEvent.MESH_COMPLETE, function(ev:Asset3DEvent) { - if (ev.asset is Mesh) { - var mesh:Mesh = cast ev.asset; - addMesh(mesh); - callback(mesh); - } - }); - } catch(e) { - trace(e.details()); - } - } - - public function addMesh(mesh:Mesh) { - if (mesh == null) return; - - meshes.push(mesh); - } - - - private function resizeBitmap(width:Int, height:Int) { - if (__bitmap != null) - __bitmap.dispose(); - __bitmap = new BitmapData(width, height, true, 0); - loadGraphic(__bitmap); - } - - public override function draw() { - var filters = FlxG.game.filters; - FlxG.game.filters = null; - view3d.renderer.queueSnapshot(__bitmap); - view3d.render(); - FlxG.game.filters = filters; - - super.draw(); - } - - public override function destroy() { - __sprite.removeChild(view3d); - - view3d.dispose(); - super.destroy(); - } -} \ No newline at end of file diff --git a/source/funkin/away3d/FlxMesh.hx b/source/funkin/away3d/FlxMesh.hx deleted file mode 100644 index e7e95da3..00000000 --- a/source/funkin/away3d/FlxMesh.hx +++ /dev/null @@ -1,30 +0,0 @@ -package funkin.away3d; - -import away3d.core.base.Geometry; -import flixel.util.FlxDestroyUtil.IFlxDestroyable; -import away3d.loaders.Loader3D; -import haxe.io.Bytes; -import flixel.util.typeLimit.OneOfTwo; -import away3d.entities.Mesh; - -class FlxMesh extends Mesh implements IFlxDestroyable implements Flx3DObject { - var __loader:Loader3D = new Loader3D(); - public function new(asset:OneOfTwo, textures:Array = null) { - if (textures == null) textures = []; - - var meshContent:Bytes = null; - if (asset is String) - meshContent = Assets.getBytes(asset); - else if (asset is Bytes) - meshContent = cast(asset, Bytes); - if (meshContent == null) - throw "Mesh Asset is null or does not exist."; - - __loader.loadData(meshContent); - super(__loader.loadData()); - } - - public function destroy() { - loader.dispose(); - } -} \ No newline at end of file diff --git a/source/funkin/away3d/README.txt b/source/funkin/away3d/README.txt deleted file mode 100644 index cfc84409..00000000 --- a/source/funkin/away3d/README.txt +++ /dev/null @@ -1 +0,0 @@ -ISNT DONE YET! EARLY BETA! DO NOT USE! \ No newline at end of file diff --git a/source/funkin/game/HealthIcon.hx b/source/funkin/game/HealthIcon.hx index 10abfad8..78f29991 100644 --- a/source/funkin/game/HealthIcon.hx +++ b/source/funkin/game/HealthIcon.hx @@ -45,7 +45,6 @@ class HealthIcon extends FlxSprite var path = Paths.image('icons/$char'); if (!Assets.exists(path)) path = Paths.image('icons/face'); - // TODO: Icon Jsons?? (maybe not not to mess with sparrows but perhaps) loadGraphic(path, true, 150, 150); animation.add(char, [for(i in 0...frames.frames.length) i], 0, false, isPlayer); diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 8a7bf215..4ab0c1f5 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -229,7 +229,7 @@ class PlayState extends MusicBeatState #if desktop // TODO: Scriptable custom RPC - iconRPC = SONG.player2; + iconRPC = (dad != null && dad.icon != null) ? dad.icon : SONG.player2; detailsText = isStoryMode ? ("Story Mode: " + storyWeek.name) : "Freeplay"; @@ -842,8 +842,9 @@ class PlayState extends MusicBeatState public function pauseGame() { - // TODO: Cancellable game pause - scripts.call("onGamePause"); + var e = scripts.event("onGamePause", new CancellableEvent()); + if (e.cancelled) return; + persistentUpdate = false; persistentDraw = true; paused = true; @@ -1105,10 +1106,10 @@ class PlayState extends MusicBeatState if (SONG.validScore) { #if !switch - // TODO: Accuracy stuff Highscore.saveScore(SONG.song, { score: songScore, - misses: misses + misses: misses, + accuracy: accuracy }, difficulty); #end } diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index 3eab03a8..3f2d054e 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -34,8 +34,7 @@ class Stage extends FlxBasic implements IBeatReceiver { try { if (Assets.exists(stagePath)) stageXML = new Access(Xml.parse(Assets.getText(stagePath)).firstElement()); } catch(e) { - // TODO: handler - trace(e.details()); + Logs.trace('Couldn\'t load stage "$stage": ${e.message}', ERROR); } if (stageXML != null) { diff --git a/source/funkin/shaders/CustomShader.hx b/source/funkin/shaders/CustomShader.hx index e13f5473..3119c180 100644 --- a/source/funkin/shaders/CustomShader.hx +++ b/source/funkin/shaders/CustomShader.hx @@ -25,9 +25,8 @@ class CustomShader extends FunkinShader { var fragCode = Assets.exists(fragShaderPath) ? Assets.getText(fragShaderPath) : null; var vertCode = Assets.exists(vertShaderPath) ? Assets.getText(vertShaderPath) : null; - if (fragCode != null && vertCode != null) { - // TODO: logging!! - } + if (fragCode == null && vertCode == null) + Logs.trace('Shader "$name" couldn\'t be found.', ERROR); super(fragCode, vertCode, glslVersion); } diff --git a/source/funkin/shaders/FunkinShader.hx b/source/funkin/shaders/FunkinShader.hx index 82753e6e..84f69dd1 100644 --- a/source/funkin/shaders/FunkinShader.hx +++ b/source/funkin/shaders/FunkinShader.hx @@ -87,8 +87,6 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour { { program = __context.createProgram(GLSL); - // TODO - // program.uploadSources (vertex, fragment); @:privateAccess program.__glProgram = __createGLProgram(vertex, fragment); @:privateAccess __context.__programs.set(id, program); diff --git a/source/funkin/system/CoolUtil.hx b/source/funkin/system/CoolUtil.hx index 2fb28783..e4edaef9 100644 --- a/source/funkin/system/CoolUtil.hx +++ b/source/funkin/system/CoolUtil.hx @@ -308,7 +308,6 @@ class CoolUtil } else if (Assets.exists('$noExt/Animation.json') && Assets.exists('$noExt/spritemap.json') && Assets.exists('$noExt/spritemap.png')) { - // TODO: Credit Smokey555!! return AtlasFrameMaker.construct(noExt); } else if (Assets.exists('$noExt.xml')) { return Paths.getSparrowAtlasAlt(noExt); diff --git a/source/funkin/system/Main.hx b/source/funkin/system/Main.hx index 70139dab..c5eb3d39 100644 --- a/source/funkin/system/Main.hx +++ b/source/funkin/system/Main.hx @@ -1,6 +1,5 @@ package funkin.system; -import funkin.away3d.Flx3DView; import openfl.utils.AssetLibrary; import openfl.utils.AssetCache; import openfl.text.TextFormat; @@ -137,7 +136,6 @@ class Main extends Sprite Logs.init(); Paths.init(); ModsFolder.init(); - Flx3DView.init(); #if MOD_SUPPORT ModsFolder.switchMod("introMod"); #end diff --git a/source/funkin/system/ZipUtils.hx b/source/funkin/system/ZipUtils.hx index adebb0ef..24362a88 100644 --- a/source/funkin/system/ZipUtils.hx +++ b/source/funkin/system/ZipUtils.hx @@ -177,7 +177,7 @@ class ZipUtils { fileTime: Date.now(), dataSize: 0, data: fileContent, - crc32: Crc32.make(fileContent), // TODO??? + crc32: Crc32.make(fileContent), compressed: false }; Tools.compress(entry, 1);