diff --git a/assets/images/NOTE_assets.png b/assets/images/NOTE_assets.png index 59b38b73..355f6af6 100644 Binary files a/assets/images/NOTE_assets.png and b/assets/images/NOTE_assets.png differ diff --git a/assets/images/NOTE_assets.xml b/assets/images/NOTE_assets.xml index 8d3f0222..0b0f2781 100644 --- a/assets/images/NOTE_assets.xml +++ b/assets/images/NOTE_assets.xml @@ -1,53 +1,53 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/noteSplashes.png b/assets/images/noteSplashes.png index fe5b48f8..4575f804 100644 Binary files a/assets/images/noteSplashes.png and b/assets/images/noteSplashes.png differ diff --git a/assets/images/noteSplashes.xml b/assets/images/noteSplashes.xml index b779c7f7..18eebb12 100644 --- a/assets/images/noteSplashes.xml +++ b/assets/images/noteSplashes.xml @@ -1,37 +1,40 @@  - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pixelUI/NOTE_assets.png b/assets/images/pixelUI/NOTE_assets.png index 55924362..645685ed 100644 Binary files a/assets/images/pixelUI/NOTE_assets.png and b/assets/images/pixelUI/NOTE_assets.png differ diff --git a/assets/images/pixelUI/NOTE_assetsENDS.png b/assets/images/pixelUI/NOTE_assetsENDS.png index 5f3d5f4b..1530744b 100644 Binary files a/assets/images/pixelUI/NOTE_assetsENDS.png and b/assets/images/pixelUI/NOTE_assetsENDS.png differ diff --git a/source/meta/data/ClientPrefs.hx b/source/meta/data/ClientPrefs.hx index 79a8f1cb..e8f6412e 100644 --- a/source/meta/data/ClientPrefs.hx +++ b/source/meta/data/ClientPrefs.hx @@ -45,7 +45,7 @@ class ClientPrefs { public static var ghostTapAnim:Bool = true; public static var cameraPanning:Bool = true; public static var panIntensity:Float = 1; - public static var noteSkin:String = 'Defualt'; + public static var noteSkin:String = 'Default'; // defualt :skull: public static var gameplaySettings:Map = [ 'scrollspeed' => 1.0, 'scrolltype' => 'multiplicative', diff --git a/source/objects/shaders/RGBPalette.hx b/source/objects/shaders/RGBPalette.hx new file mode 100644 index 00000000..c5bc1b49 --- /dev/null +++ b/source/objects/shaders/RGBPalette.hx @@ -0,0 +1,156 @@ +package objects.shaders; + +import flixel.system.FlxAssets.FlxShader; + +class RGBPalette { + public var shader(default, null):RGBPaletteShader = new RGBPaletteShader(); + public var r(default, set):FlxColor; + public var g(default, set):FlxColor; + public var b(default, set):FlxColor; + public var mult(default, set):Float; + + private function set_r(color:FlxColor) { + r = color; + shader.r.value = [color.redFloat, color.greenFloat, color.blueFloat]; + return color; + } + + private function set_g(color:FlxColor) { + g = color; + shader.g.value = [color.redFloat, color.greenFloat, color.blueFloat]; + return color; + } + + private function set_b(color:FlxColor) { + b = color; + shader.b.value = [color.redFloat, color.greenFloat, color.blueFloat]; + return color; + } + + private function set_mult(value:Float) { + mult = FlxMath.bound(value, 0, 1); + shader.mult.value = [mult]; + return mult; + } + + public function new() + { + r = 0xFFFF0000; + g = 0xFF00FF00; + b = 0xFF0000FF; + mult = 1.0; + } +} + +// automatic handler for easy usability +class RGBShaderReference +{ + public var r(default, set):FlxColor; + public var g(default, set):FlxColor; + public var b(default, set):FlxColor; + public var mult(default, set):Float; + public var enabled(default, set):Bool = true; + + public var parent:RGBPalette; + private var _owner:FlxSprite; + private var _original:RGBPalette; + public function new(owner:FlxSprite, ref:RGBPalette) + { + parent = ref; + _owner = owner; + _original = ref; + owner.shader = ref.shader; + + @:bypassAccessor + { + r = parent.r; + g = parent.g; + b = parent.b; + mult = parent.mult; + } + } + + private function set_r(value:FlxColor) + { + if(allowNew && value != _original.r) cloneOriginal(); + return (r = parent.r = value); + } + private function set_g(value:FlxColor) + { + if(allowNew && value != _original.g) cloneOriginal(); + return (g = parent.g = value); + } + private function set_b(value:FlxColor) + { + if(allowNew && value != _original.b) cloneOriginal(); + return (b = parent.b = value); + } + private function set_mult(value:Float) + { + if(allowNew && value != _original.mult) cloneOriginal(); + return (mult = parent.mult = value); + } + private function set_enabled(value:Bool) + { + _owner.shader = value ? parent.shader : null; + return (enabled = value); + } + + public var allowNew = true; + private function cloneOriginal() + { + if(allowNew) + { + allowNew = false; + if(_original != parent) return; + + parent = new RGBPalette(); + parent.r = _original.r; + parent.g = _original.g; + parent.b = _original.b; + parent.mult = _original.mult; + _owner.shader = parent.shader; + //trace('created new shader'); + } + } +} + +class RGBPaletteShader extends FlxShader { + @:glFragmentHeader(' + #pragma header + + uniform vec3 r; + uniform vec3 g; + uniform vec3 b; + uniform float mult; + + vec4 flixel_texture2DCustom(sampler2D bitmap, vec2 coord) { + vec4 color = flixel_texture2D(bitmap, coord); + if (!hasTransform || color.a == 0.0 || mult == 0.0) { + return color; + } + + vec4 newColor = color; + newColor.rgb = min(color.r * r + color.g * g + color.b * b, vec3(1.0)); + newColor.a = color.a; + + color = mix(color, newColor, mult); + + if(color.a > 0.0) { + return vec4(color.rgb, color.a); + } + return vec4(0.0, 0.0, 0.0, 0.0); + }') + + @:glFragmentSource(' + #pragma header + + void main() { + gl_FragColor = flixel_texture2DCustom(bitmap, openfl_TextureCoordv); + }') + + public function new() + { + super(); + } +} \ No newline at end of file diff --git a/source/objects/userinterface/note/Note.hx b/source/objects/userinterface/note/Note.hx index 0c2003ef..9902c993 100644 --- a/source/objects/userinterface/note/Note.hx +++ b/source/objects/userinterface/note/Note.hx @@ -1,6 +1,5 @@ package objects.userinterface.note; -import flixel.graphics.frames.FlxAtlasFrames; import objects.shaders.*; typedef EventNote = { @@ -44,7 +43,7 @@ class Note extends FlxSprite public var eventVal1:String = ''; public var eventVal2:String = ''; - public var colorMask:ColorMask; + public var rgbPalette:RGBPalette; public var inEditor:Bool = false; public var animSuffix:String = ''; @@ -131,8 +130,8 @@ class Note extends FlxSprite noteSplashTexture = PlayState.SONG.splashSkin; if (noteData > -1 && noteData < ClientPrefs.arrowRGB.length) { - colorMask.rCol = FlxColor.fromRGB(ClientPrefs.arrowRGB[noteData][0], ClientPrefs.arrowRGB[noteData][1], ClientPrefs.arrowRGB[noteData][2]); - colorMask.gCol = colorMask.rCol.getDarkened(0.6); + rgbPalette.r = FlxColor.fromRGB(ClientPrefs.arrowRGB[noteData][0], ClientPrefs.arrowRGB[noteData][1], ClientPrefs.arrowRGB[noteData][2]); + rgbPalette.g = rgbPalette.r.getDarkened(0.6); } if(noteData > -1 && noteType != value) { @@ -159,7 +158,7 @@ class Note extends FlxSprite } noteType = value; } - noteSplashColor = colorMask.rCol; + noteSplashColor = rgbPalette.r; return value; } @@ -186,8 +185,8 @@ class Note extends FlxSprite if(noteData > -1) { texture = ''; - colorMask = new ColorMask(); - shader = colorMask.shader; + rgbPalette = new RGBPalette(); + shader = rgbPalette.shader; x += swagWidth * (noteData); if(!isSustainNote && noteData > -1 && noteData < 4) { //Doing this 'if' check to fix the warnings on Senpai songs diff --git a/source/objects/userinterface/note/NoteSplash.hx b/source/objects/userinterface/note/NoteSplash.hx index 2c1951cb..9a70e0fe 100644 --- a/source/objects/userinterface/note/NoteSplash.hx +++ b/source/objects/userinterface/note/NoteSplash.hx @@ -5,7 +5,7 @@ import objects.userinterface.note.*; class NoteSplash extends FlxSprite { - public var colorMask:ColorMask = null; + public var rgbPalette:RGBPalette = null; private var idleAnim:String; private var textureLoaded:String = null; @@ -19,7 +19,7 @@ class NoteSplash extends FlxSprite loadAnims(skin); - colorMask = new ColorMask(); + rgbPalette = new RGBPalette(); setupNoteSplash(x, y, note); antialiasing = ClientPrefs.globalAntialiasing; @@ -33,18 +33,18 @@ class NoteSplash extends FlxSprite if(texture == null) { texture = 'noteSplashes'; if(PlayState.SONG.splashSkin != null && PlayState.SONG.splashSkin.length > 0) texture = PlayState.SONG.splashSkin; - shader = colorMask.shader; + shader = rgbPalette.shader; } // fucking charting state defaults if(texture == 'noteSplashes') { - shader = colorMask.shader; + shader = rgbPalette.shader; } if(textureLoaded != texture) { loadAnims(texture); } - colorMask.rCol = color; + rgbPalette.r = color; offset.set(10, 10); var animNum:Int = FlxG.random.int(1, 2); diff --git a/source/objects/userinterface/note/StrumNote.hx b/source/objects/userinterface/note/StrumNote.hx index 3aaa0a13..daa68587 100644 --- a/source/objects/userinterface/note/StrumNote.hx +++ b/source/objects/userinterface/note/StrumNote.hx @@ -5,7 +5,7 @@ import objects.userinterface.note.*; class StrumNote extends FlxSprite { - private var colorMask:ColorMask; + private var rgbPalette:RGBPalette; public var resetAnim:Float = 0; private var noteData:Int = 0; public var direction:Float = 90;//plan on doing scroll directions soon -bb @@ -26,27 +26,26 @@ class StrumNote extends FlxSprite public function new(x:Float, y:Float, leData:Int, player:Int) { animation = new PsychAnimationController(this); - colorMask = new ColorMask(); + rgbPalette = new RGBPalette(); noteData = leData; this.player = player; this.noteData = leData; super(x, y); var skin:String = 'NOTE_assets'; - /* - if(ClientPrefs.noteSkin != null) { - skin = 'noteskins/NOTE_assets-${ClientPrefs.noteSkin.toLowerCase()}'; - } else { - skin = "NOTE_assets"; + if (PlayState.SONG.arrowSkin == null || PlayState.SONG.arrowSkin.length <= 1) { + if (ClientPrefs.noteSkin == 'Default') { + skin = 'NOTE_assets'; + } else if (ClientPrefs.noteSkin == 'Chip') { + skin = 'noteskins/NOTE_assets-chip'; + } else if (ClientPrefs.noteSkin == 'Future') { + skin = 'noteskins/NOTE_assets-future'; + }else { + skin = 'NOTE_assets'; // to prevent crashes + } } - */ if(PlayState.SONG.arrowSkin != null && PlayState.SONG.arrowSkin.length > 1) skin = PlayState.SONG.arrowSkin; - switch (ClientPrefs.noteSkin) { - case 'Chip': skin = 'noteskins/NOTE_assets-chip'; - case 'Future' : skin = 'noteskins/NOTE_assets-future'; - default: skin = 'NOTE_assets'; - } - shader = colorMask.shader; + shader = rgbPalette.shader; texture = skin; //Load texture and anims scrollFactor.set(); @@ -59,6 +58,7 @@ class StrumNote extends FlxSprite if(PlayState.isPixelStage) { + // old code, blehh!! /* var skin:String = 'NOTE_assets'; if (FileSystem.exists(Paths.modFolders('images/pixelUI/$texture.png')) && FileSystem.exists(Paths.modFolders('images/pixelUI/' + texture + 'ENDS.png'))) { @@ -167,19 +167,19 @@ class StrumNote extends FlxSprite centerOrigin(); if(animation.curAnim == null || animation.curAnim.name == 'static') { // RGB - colorMask.rCol = 0xFF87A3AD; - colorMask.gCol = FlxColor.BLACK; + rgbPalette.r = 0xFF87A3AD; + rgbPalette.g = FlxColor.BLACK; } else { if (noteData > -1 && noteData < ClientPrefs.arrowRGB.length) { - colorMask.rCol = FlxColor.fromRGB(ClientPrefs.arrowRGB[noteData][0], ClientPrefs.arrowRGB[noteData][1], ClientPrefs.arrowRGB[noteData][2]); - colorMask.gCol = colorMask.rCol.getDarkened(0.6); + rgbPalette.r = FlxColor.fromRGB(ClientPrefs.arrowRGB[noteData][0], ClientPrefs.arrowRGB[noteData][1], ClientPrefs.arrowRGB[noteData][2]); + rgbPalette.g = rgbPalette.rCol.getDarkened(0.6); if (animation.curAnim.name == 'pressed') { - var color:FlxColor = colorMask.rCol; - colorMask.rCol = FlxColor.fromHSL(color.hue, color.saturation * 0.5, color.lightness * 1.2); - colorMask.gCol = 0xFF201E31; + var color:FlxColor = rgbPalette.r; + rgbPalette.r = FlxColor.fromHSL(color.hue, color.saturation * 0.5, color.lightness * 1.2); + rgbPalette.g = 0xFF201E31; } }