Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply colorShader using addCharacter() #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 32 additions & 30 deletions preload/scripts/stages/limoRideErect.hxc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
27 changes: 15 additions & 12 deletions preload/scripts/stages/mainStageErect.hxc
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
}
}
18 changes: 7 additions & 11 deletions preload/scripts/stages/phillyStreetsErect.hxc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
// }
Expand Down Expand Up @@ -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;
}
}
25 changes: 13 additions & 12 deletions preload/scripts/stages/phillyTrainErect.hxc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down