Skip to content

Commit

Permalink
if only i ca add ourple fox
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesCatYT committed Mar 30, 2024
1 parent a425042 commit e37fdf0
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 32 deletions.
2 changes: 2 additions & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@
<!--Macro fixes-->
<haxeflag name="--macro" value="allowPackage('flash')" />
<haxeflag name="--macro" value="include('my.pack')" />
<haxeflag name="--macro" value="macros.Keep.keepClasses()" />

<haxeflag name="-dce" value="std" unless="HSCRIPT_ALLOWED" />
<haxeflag name="-dce" value="no" if="HSCRIPT_ALLOWED" />

Expand Down
26 changes: 26 additions & 0 deletions source/macros/Keep.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package macros;

#if macro
import haxe.macro.Compiler;

using StringTools;

class Keep
{
// JUST WRITE THE CLASS PACKAGE AS STRING (e.g "flixel.effects.particles.FlxParticle") IT'S AS SIMPLE AS THAT
public static var classesToKeep:Array<String> = [];

public static function keepClasses(){
var packagesArray = [];
for(clas in classesToKeep){
var dotsSplit = clas.split('.');
var pack = '';
for(i in 0...dotsSplit.length-1) pack += dotsSplit[i] + '.';
if(pack.endsWith('.')) pack = pack.substr(0, pack.length-1);
packagesArray.push(pack);
}
for(pack in packagesArray) Compiler.include(pack);
Compiler.keep(null, classesToKeep, true);
}
}
#end
4 changes: 2 additions & 2 deletions source/objects/NoteSplash.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class NoteSplash extends FlxSprite
precacheConfig(skin);
_configLoaded = skin;
scrollFactor.set();
//setupNoteSplash(x, y, 0);
setupNoteSplash(x, y, 0);
}

override function destroy()
Expand Down Expand Up @@ -181,7 +181,7 @@ class NoteSplash extends FlxSprite
return animation.getByName(name) != null;
}

static var aliveTime:Float = 0;
private var aliveTime:Float = 0;
static var buggedKillTime:Float = 0.5; //automatically kills note splashes if they break to prevent it from flooding your HUD
override function update(elapsed:Float) {
aliveTime += elapsed;
Expand Down
6 changes: 3 additions & 3 deletions source/objects/StrumNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ class StrumNote extends FlxSprite
case 0:
animation.add('static', [0]);
animation.add('pressed', [4, 8], 12, false);
animation.add('confirm', [12, 16], 24, false);
animation.add('confirm', [12, 16], 12, false);
case 1:
animation.add('static', [1]);
animation.add('pressed', [5, 9], 12, false);
animation.add('confirm', [13, 17], 24, false);
animation.add('confirm', [13, 17], 12, false);
case 2:
animation.add('static', [2]);
animation.add('pressed', [6, 10], 12, false);
animation.add('confirm', [14, 18], 12, false);
case 3:
animation.add('static', [3]);
animation.add('pressed', [7, 11], 12, false);
animation.add('confirm', [15, 19], 24, false);
animation.add('confirm', [15, 19], 12, false);
}
}
else
Expand Down
39 changes: 25 additions & 14 deletions source/options/NotesSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -653,18 +653,17 @@ class NotesSubState extends MusicBeatSubstate

function updateNotes(?instant:Bool = false)
{
for (note in modeNotes)
note.alpha = (curSelectedMode == note.ID) ? 1 : 0.6;
for (note in modeNotes) note.alpha = (curSelectedMode == note.ID) ? 1 : 0.6;

for (note in myNotes)
{
for (note in myNotes) {
var newAnim:String = curSelectedNote == note.ID ? 'confirm' : 'pressed';
note.alpha = (curSelectedNote == note.ID) ? 1 : 0.6;
if(note.animation.curAnim == null || note.animation.curAnim.name != newAnim) note.playAnim(newAnim, true);
if(instant) note.animation.curAnim.finish();
}
bigNote.animation.play('note$curSelectedNote', true);
updateColors();
fixColors(); // fixes your gosh dang note colors - DM-kun
}

function updateColors(specific:Null<FlxColor> = null)
Expand All @@ -679,26 +678,38 @@ class NotesSubState extends MusicBeatSubstate

colorWheel.color = FlxColor.fromHSB(0, 0, color.brightness);
colorWheelSelector.setPosition(colorWheel.x + colorWheel.width/2, colorWheel.y + colorWheel.height/2);
if(wheelColor.brightness != 0)
{
if(wheelColor.brightness != 0) {
var hueWrap:Float = wheelColor.hue * Math.PI / 180;
colorWheelSelector.x += Math.sin(hueWrap) * colorWheel.width/2 * wheelColor.saturation;
colorWheelSelector.y -= Math.cos(hueWrap) * colorWheel.height/2 * wheelColor.saturation;
}
colorGradientSelector.y = colorGradient.y + colorGradient.height * (1 - color.brightness);

var strumRGB:RGBShaderReference = myNotes.members[curSelectedNote].rgbShader;
switch(curSelectedMode)
{
case 0:
getShader().r = strumRGB.r = color;
case 1:
getShader().g = strumRGB.g = color;
case 2:
getShader().b = strumRGB.b = color;
switch(curSelectedMode) {
case 0: getShader().r = strumRGB.r = color;
case 1: getShader().g = strumRGB.g = color;
case 2: getShader().b = strumRGB.b = color;
}
}

function fixColors()
{
for (i in 0...3) {
var strumRGB:RGBShaderReference = myNotes.members[curSelectedNote].rgbShader;
var color:FlxColor = !onPixel ? ClientPrefs.data.arrowRGB[curSelectedNote][i] :
ClientPrefs.data.arrowRGBPixel[curSelectedNote][i];
switch(i) {
case 0: getShader().r = strumRGB.r = color;
case 1: getShader().g = strumRGB.g = color;
case 2: getShader().b = strumRGB.b = color;
}
dataArray[curSelectedNote][i] = color;
}
setShaderColor(!onPixel ? ClientPrefs.data.arrowRGB[curSelectedNote][curSelectedMode] : ClientPrefs.data.arrowRGBPixel[curSelectedNote][curSelectedMode]);
updateColors();
}

function setShaderColor(value:FlxColor) dataArray[curSelectedNote][curSelectedMode] = value;
function getShaderColor() return dataArray[curSelectedNote][curSelectedMode];
function getShader() return Note.globalRgbShaders[curSelectedNote];
Expand Down
2 changes: 1 addition & 1 deletion source/psychlua/HScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class HScript extends SScript
{
if(funk == null) funk = parentLua;

if(parentLua != null) funk.addLocalCallback(name, func);
if(funk != null) funk.addLocalCallback(name, func);
else FunkinLua.luaTrace('createCallback ($name): 3rd argument is null', false, false, FlxColor.RED);
});

Expand Down
13 changes: 6 additions & 7 deletions source/psychlua/LuaUtils.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class LuaUtils

public static function setVarInArray(instance:Dynamic, variable:String, value:Dynamic, allowMaps:Bool = false):Any
{
if (value == "true") value = true;

var splitProps:Array<String> = variable.split('[');
if(splitProps.length > 1)
{
var target:Dynamic = null;
if(PlayState.instance.variables.exists(splitProps[0]))
{
if(PlayState.instance.variables.exists(splitProps[0])) {
var retVal:Dynamic = PlayState.instance.variables.get(splitProps[0]);
if(retVal != null)
target = retVal;
if(retVal != null) target = retVal;
}
else target = Reflect.getProperty(instance, splitProps[0]);

Expand All @@ -61,19 +61,18 @@ class LuaUtils

if(allowMaps && isMap(instance))
{
//trace(instance);
instance.set(variable, value);
return value;
}

if(PlayState.instance.variables.exists(variable))
{
if(PlayState.instance.variables.exists(variable)) {
PlayState.instance.variables.set(variable, value);
return value;
}
Reflect.setProperty(instance, variable, value);
return value;
}

public static function getVarInArray(instance:Dynamic, variable:String, allowMaps:Bool = false):Any
{
var splitProps:Array<String> = variable.split('[');
Expand Down
2 changes: 1 addition & 1 deletion source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,7 @@ class PlayState extends MusicBeatState

if(daNote.mustPress)
{
if(cpuControlled && !daNote.blockHit && daNote.canBeHit && (daNote.isSustainNote || daNote.strumTime <= Conductor.songPosition))
if(cpuControlled && !daNote.blockHit && daNote.canBeHit && ((daNote.isSustainNote && daNote.prevNote.wasGoodHit) || daNote.strumTime <= Conductor.songPosition))
goodNoteHit(daNote);
}
else if (daNote.wasGoodHit && !daNote.hitByOpponent && !daNote.ignoreNote)
Expand Down
6 changes: 2 additions & 4 deletions source/states/editors/EditorPlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,8 @@ class EditorPlayState extends MusicBeatSubstate
var songSpeedType:String = ClientPrefs.getGameplaySetting('scrolltype');
switch(songSpeedType)
{
case "multiplicative":
songSpeed = PlayState.SONG.speed * ClientPrefs.getGameplaySetting('scrollspeed');
case "constant":
songSpeed = ClientPrefs.getGameplaySetting('scrollspeed');
case "multiplicative": songSpeed = PlayState.SONG.speed * ClientPrefs.getGameplaySetting('scrollspeed');
case "constant": songSpeed = ClientPrefs.getGameplaySetting('scrollspeed');
}
noteKillOffset = Math.max(Conductor.stepCrochet, 350 / songSpeed * playbackRate);

Expand Down
5 changes: 5 additions & 0 deletions source/substates/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,20 @@ class PauseSubState extends MusicBeatSubstate
blueballedTxt.alpha = 0;
levelDifficulty.alpha = 0;
levelInfo.alpha = 0;
chartingText.alpha = 0;
practiceText.alpha = 0;
practiceText.y -= 5;

levelInfo.x = FlxG.width - (levelInfo.width + 20);
levelDifficulty.x = FlxG.width - (levelDifficulty.width + 20);
blueballedTxt.x = FlxG.width - (blueballedTxt.width + 20);

FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut});
FlxTween.tween(chartingText, {alpha: 1}, 0.4, {ease: FlxEase.quartInOut});
FlxTween.tween(levelInfo, {alpha: 1, y: 20}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.3});
FlxTween.tween(levelDifficulty, {alpha: 1, y: levelDifficulty.y + 5}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.5});
FlxTween.tween(blueballedTxt, {alpha: 1, y: blueballedTxt.y + 5}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.7});
FlxTween.tween(practiceText, {alpha: 1, y: practiceText.y + 5}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.9});

grpMenuShit = new FlxTypedGroup<Alphabet>();
add(grpMenuShit);
Expand Down

0 comments on commit e37fdf0

Please sign in to comment.