diff --git a/source/funkin/graphics/framebuffer/FrameBuffer.hx b/source/funkin/graphics/framebuffer/FrameBuffer.hx index 786f980ea..e99f72b77 100644 --- a/source/funkin/graphics/framebuffer/FrameBuffer.hx +++ b/source/funkin/graphics/framebuffer/FrameBuffer.hx @@ -1,5 +1,6 @@ package funkin.graphics.framebuffer; +import flixel.FlxSprite; import flixel.FlxCamera; import flixel.util.FlxColor; import openfl.Lib; @@ -118,4 +119,14 @@ class FrameBuffer { spriteCopies.push(spriteCopy); } + + /** + * Adds the sprite to the frame buffer. The sprite will only be seen from + * the frame buffer. + * @param sprite the sprite + */ + public function moveSprite(sprite:FlxSprite):Void + { + sprite.cameras = [camera]; + } } diff --git a/source/funkin/graphics/framebuffer/FrameBufferManager.hx b/source/funkin/graphics/framebuffer/FrameBufferManager.hx index 5ed4afb3a..6a0aaac53 100644 --- a/source/funkin/graphics/framebuffer/FrameBufferManager.hx +++ b/source/funkin/graphics/framebuffer/FrameBufferManager.hx @@ -51,11 +51,21 @@ class FrameBufferManager * @param color if this is not `null`, the sprite will be filled with the color. * if this is `null`, the sprite will keep its original color. */ - public function addSpriteCopyTo(name:String, sprite:FlxSprite, color:Null = null):Void + public function copySpriteTo(name:String, sprite:FlxSprite, color:Null = null):Void { frameBufferMap[name].addSpriteCopy(new SpriteCopy(sprite, color)); } + /** + * Adds the sprite to the frame buffer. The sprite will only be seen from the frame buffer. + * @param name the name of the frame buffer + * @param sprite the sprite + */ + public function moveSpriteTo(name:String, sprite:FlxSprite):Void + { + frameBufferMap[name].moveSprite(sprite); + } + /** * Call this before drawing anything. */ diff --git a/source/funkin/graphics/framebuffer/SpriteCopy.hx b/source/funkin/graphics/framebuffer/SpriteCopy.hx index b95462ea3..ea7de69dc 100644 --- a/source/funkin/graphics/framebuffer/SpriteCopy.hx +++ b/source/funkin/graphics/framebuffer/SpriteCopy.hx @@ -10,7 +10,7 @@ import flixel.util.FlxColor; class SpriteCopy { final sprite:FlxSprite; - var color:Null; + final color:Null; public function new(sprite:FlxSprite, color:Null) { diff --git a/source/funkin/graphics/shaders/RuntimeRainShader.hx b/source/funkin/graphics/shaders/RuntimeRainShader.hx index 5675f26e6..dc35a7bb7 100644 --- a/source/funkin/graphics/shaders/RuntimeRainShader.hx +++ b/source/funkin/graphics/shaders/RuntimeRainShader.hx @@ -86,6 +86,14 @@ class RuntimeRainShader extends RuntimePostEffectShader return mask = value; } + public var lightMap(default, set):BitmapData; + + function set_lightMap(value:BitmapData):BitmapData + { + this.setBitmapData('uLightMap', value); + return lightMap = value; + } + public var numLights(default, set):Int = 0; function set_numLights(value:Int):Int diff --git a/source/funkin/play/stage/Stage.hx b/source/funkin/play/stage/Stage.hx index def67bdbc..298484a97 100644 --- a/source/funkin/play/stage/Stage.hx +++ b/source/funkin/play/stage/Stage.hx @@ -1,5 +1,6 @@ package funkin.play.stage; +import openfl.display.BlendMode; import funkin.graphics.framebuffer.FrameBufferManager; import flixel.util.FlxColor; import funkin.graphics.framebuffer.SpriteCopy; @@ -800,6 +801,22 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass } } + /** + * FIXME: Polymod hack + */ + function stringEndsWith(a:String, b:String):Bool + { + return a.endsWith(b); + } + + /** + * FIXME: Polymod hack + */ + function setBlendAdd(sprite:FlxSprite, blend:BlendMode):Void + { + sprite.blend = blend; + } + public function onScriptEvent(event:ScriptEvent) {} public function onPause(event:PauseScriptEvent) {}