From 9fd0317b0ae86526c3bb0e2f9fdfc877db96c0c2 Mon Sep 17 00:00:00 2001 From: Abnormal <86753001+AbnormalPoof@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:50:52 -0500 Subject: [PATCH] cleanup colorshader in stages --- preload/scripts/stages/limoRideErect.hxc | 62 ++++++++++--------- preload/scripts/stages/mainStageErect.hxc | 27 ++++---- preload/scripts/stages/phillyStreetsErect.hxc | 18 +++--- preload/scripts/stages/phillyTrainErect.hxc | 25 ++++---- 4 files changed, 67 insertions(+), 65 deletions(-) diff --git a/preload/scripts/stages/limoRideErect.hxc b/preload/scripts/stages/limoRideErect.hxc index bc54e08b..ff3c6917 100644 --- a/preload/scripts/stages/limoRideErect.hxc +++ b/preload/scripts/stages/limoRideErect.hxc @@ -132,36 +132,31 @@ class LimoRideErectStage extends Stage mist5.y = -450 + (Math.sin(_timer*0.2)*150); //trace(mist1.y); - if(PlayState.instance.currentStage.getBoyfriend() != null && PlayState.instance.currentStage.getBoyfriend().shader == null){ - PlayState.instance.currentStage.getBoyfriend().shader = colorShader; - PlayState.instance.currentStage.getGirlfriend().shader = colorShader; - PlayState.instance.currentStage.getDad().shader = colorShader; - getNamedProp('limoDancer1').shader = colorShader; - getNamedProp('limoDancer2').shader = colorShader; - getNamedProp('limoDancer3').shader = colorShader; - getNamedProp('limoDancer4').shader = colorShader; - getNamedProp('limoDancer5').shader = colorShader; - getNamedProp('fastCar').shader = colorShader; - - // PlayState.instance.currentStage.getBoyfriend().visible = false; - // PlayState.instance.currentStage.getGirlfriend().visible = false; - // PlayState.instance.currentStage.getDad().visible = false; - // getNamedProp('limo').visible = false; - // getNamedProp('limoDancer1').visible = false; - // getNamedProp('limoDancer2').visible = false; - // getNamedProp('limoDancer3').visible = false; - // getNamedProp('limoDancer4').visible = false; - // getNamedProp('limoDancer5').visible = false; - // getNamedProp('fastCar').visible = false; - // getNamedProp('bgLimo').visible = false; - // getNamedProp('limoSunset').visible = false; - // getNamedProp('shootingStar').visible = false; - - colorShader.hue = -30; - colorShader.saturation = -20; - colorShader.contrast = 0; - colorShader.brightness = -30; - } + getNamedProp('limoDancer1').shader = colorShader; + getNamedProp('limoDancer2').shader = colorShader; + getNamedProp('limoDancer3').shader = colorShader; + getNamedProp('limoDancer4').shader = colorShader; + getNamedProp('limoDancer5').shader = colorShader; + getNamedProp('fastCar').shader = colorShader; + + // PlayState.instance.currentStage.getBoyfriend().visible = false; + // PlayState.instance.currentStage.getGirlfriend().visible = false; + // PlayState.instance.currentStage.getDad().visible = false; + // getNamedProp('limo').visible = false; + // getNamedProp('limoDancer1').visible = false; + // getNamedProp('limoDancer2').visible = false; + // getNamedProp('limoDancer3').visible = false; + // getNamedProp('limoDancer4').visible = false; + // getNamedProp('limoDancer5').visible = false; + // getNamedProp('fastCar').visible = false; + // getNamedProp('bgLimo').visible = false; + // getNamedProp('limoSunset').visible = false; + // getNamedProp('shootingStar').visible = false; + + colorShader.hue = -30; + colorShader.saturation = -20; + colorShader.contrast = 0; + colorShader.brightness = -30; } function doShootingStar(beat:Int):Void @@ -176,6 +171,13 @@ class LimoRideErectStage extends Stage } + override function addCharacter(character:BaseCharacter, charType:CharacterType):Void { + // Apply the shader automatically to each character as it gets added. + super.addCharacter(character, charType); + trace('Applied stage shader to ' + character.characterName); + character.shader = colorShader; + } + function onBeatHit(event:SongTimeScriptEvent) { // When overriding onBeatHit, make sure to call super.onBeatHit, diff --git a/preload/scripts/stages/mainStageErect.hxc b/preload/scripts/stages/mainStageErect.hxc index 0afd9b56..c3b7b453 100644 --- a/preload/scripts/stages/mainStageErect.hxc +++ b/preload/scripts/stages/mainStageErect.hxc @@ -9,6 +9,7 @@ import funkin.play.PlayState; import funkin.play.stage.Stage; import funkin.graphics.adobeanimate.FlxAtlasSprite; import funkin.modding.base.ScriptedFlxAtlasSprite; +import funkin.play.character.CharacterType; class MainStageErectStage extends Stage { @@ -56,18 +57,6 @@ class MainStageErectStage extends Stage } - function onUpdate(event:UpdateScriptEvent):Void - { - super.onUpdate(event); - - if(PlayState.instance.currentStage.getBoyfriend() != null && PlayState.instance.currentStage.getBoyfriend().shader == null){ - PlayState.instance.currentStage.getBoyfriend().shader = colorShaderBf; - PlayState.instance.currentStage.getGirlfriend().shader = colorShaderGf; - PlayState.instance.currentStage.getDad().shader = colorShaderDad; - } - - } - function onBeatHit(event:SongTimeScriptEvent):Void { super.onBeatHit(event); @@ -77,4 +66,18 @@ class MainStageErectStage extends Stage { super.onStepHit(event); } + + override function addCharacter(character:BaseCharacter, charType:CharacterType):Void { + // Apply the shader automatically to each character as it gets added. + super.addCharacter(character, charType); + trace('Applied stage shader to ' + character.characterName); + switch (charType) { + case CharacterType.BF: + character.shader = colorShaderBf; + case CharacterType.DAD: + character.shader = colorShaderDad; + case CharacterType.GF: + character.shader = colorShaderGf; + } + } } diff --git a/preload/scripts/stages/phillyStreetsErect.hxc b/preload/scripts/stages/phillyStreetsErect.hxc index ff8b322c..9f501c00 100644 --- a/preload/scripts/stages/phillyStreetsErect.hxc +++ b/preload/scripts/stages/phillyStreetsErect.hxc @@ -182,6 +182,11 @@ class PhillyStreetsErectStage extends Stage colorShader = new AdjustColorShader(); + colorShader.hue = -5; + colorShader.saturation = -40; + colorShader.contrast = -25; + colorShader.brightness = -20; + mist0 = new FlxBackdrop(Paths.image('phillyStreets/erect/mistMid'), 0x01); mist0.setPosition(-650, -100); mist0.scrollFactor.set(1.2, 1.2); @@ -487,17 +492,6 @@ class PhillyStreetsErectStage extends Stage if(scrollingSky != null) scrollingSky.scrollX -= FlxG.elapsed * 22; - if(PlayState.instance.currentStage.getBoyfriend() != null && PlayState.instance.currentStage.getBoyfriend().shader == null){ - PlayState.instance.currentStage.getBoyfriend().shader = colorShader; - PlayState.instance.currentStage.getGirlfriend().shader = colorShader; - PlayState.instance.currentStage.getDad().shader = colorShader; - - colorShader.hue = -5; - colorShader.saturation = -40; - colorShader.contrast = -25; - colorShader.brightness = -20; - } - // if (rainSndAmbience != null) { // rainSndAmbience.volume = Math.min(0.3, remappedIntensityValue * 2); // } @@ -648,5 +642,7 @@ class PhillyStreetsErectStage extends Stage super.addCharacter(character, charType); // add to the mask so that characters hide puddles // frameBufferMan.copySpriteTo("mask", character, 0x000000); + trace('Applied stage shader to ' + character.characterName); + character.shader = colorShader; } } diff --git a/preload/scripts/stages/phillyTrainErect.hxc b/preload/scripts/stages/phillyTrainErect.hxc index 7b2ace93..54ba23e0 100644 --- a/preload/scripts/stages/phillyTrainErect.hxc +++ b/preload/scripts/stages/phillyTrainErect.hxc @@ -309,6 +309,12 @@ class PhillyTrainErectStage extends Stage lightShader = ScriptedFlxRuntimeShader.init('BuildingEffectShader', 1.0); trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes')); colorShader = new AdjustColorShader(); + getNamedProp('train').shader = colorShader; + + colorShader.hue = -26; + colorShader.saturation = -16; + colorShader.contrast = 0; + colorShader.brightness = -5; FlxG.sound.list.add(trainSound); for (i in 0...LIGHT_COUNT) @@ -341,18 +347,6 @@ class PhillyTrainErectStage extends Stage var shaderInput:Float = (Conductor.instance.beatLengthMs / 1000) * event.elapsed * 1.5; lightShader.scriptCall('update', [shaderInput]); - if(PlayState.instance.currentStage.getBoyfriend() != null && PlayState.instance.currentStage.getBoyfriend().shader == null){ - PlayState.instance.currentStage.getBoyfriend().shader = colorShader; - PlayState.instance.currentStage.getGirlfriend().shader = colorShader; - PlayState.instance.currentStage.getDad().shader = colorShader; - getNamedProp('train').shader = colorShader; - - colorShader.hue = -26; - colorShader.saturation = -16; - colorShader.contrast = 0; - colorShader.brightness = -5; - } - var amount:Int = 1; // Update train @@ -389,6 +383,13 @@ class PhillyTrainErectStage extends Stage } } + override function addCharacter(character:BaseCharacter, charType:CharacterType):Void { + // Apply the shader automatically to each character as it gets added. + super.addCharacter(character, charType); + trace('Applied stage shader to ' + character.characterName); + character.shader = colorShader; + } + function onBeatHit(event:SongTimeScriptEvent):Void { super.onBeatHit(event);