Skip to content

Commit

Permalink
override set_clipRect to disable clipRect rounding
Browse files Browse the repository at this point in the history
thank you mr cobalt for code
  • Loading branch information
Vortex2Oblivion committed Nov 26, 2024
1 parent cc48047 commit 6821b83
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions source/game/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import flixel.FlxSprite;
import flixel.addons.effects.FlxSkewedSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxMath;
import flixel.math.FlxRect;

using StringTools;

Expand Down Expand Up @@ -87,8 +88,17 @@ class Note extends FlxSkewedSprite {
* @see https://step-mania.fandom.com/wiki/Notes
*/
public static var quantColors:Array<Array<Int>> = [
[255, 35, 15], [19, 75, 255], [138, 7, 224], [71, 250, 22], [214, 0, 211], [246, 121, 4], [0, 200, 172], [38, 168, 41], [187, 187, 187],
[167, 199, 231], [128, 128, 0],
[255, 35, 15],
[19, 75, 255],
[138, 7, 224],
[71, 250, 22],
[214, 0, 211],
[246, 121, 4],
[0, 200, 172],
[38, 168, 41],
[187, 187, 187],
[167, 199, 231],
[128, 128, 0],
];

/**
Expand All @@ -97,21 +107,26 @@ class Note extends FlxSkewedSprite {
*/
public static var beats:Array<Int> = [4, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192];

public static function getFrames(note:Note):FlxAtlasFrames{
public static function getFrames(note:Note):FlxAtlasFrames {
if (PlayState.instance.types.contains(note.arrow_Type)) {
if (Assets.exists(Paths.image('ui skins/' + note.song.ui_Skin + "/arrows/" + note.arrow_Type, 'shared'))) {
return Paths.getSparrowAtlas('ui skins/' + note.song.ui_Skin + "/arrows/" + note.arrow_Type, 'shared' #if MODCHARTING_TOOLS ,note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
return Paths.getSparrowAtlas('ui skins/' + note.song.ui_Skin + "/arrows/" + note.arrow_Type,
'shared' #if MODCHARTING_TOOLS, note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
} else {
return Paths.getSparrowAtlas('ui skins/${note.song.ui_Skin}/arrows/default', 'shared' #if MODCHARTING_TOOLS ,note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
return Paths.getSparrowAtlas('ui skins/${note.song.ui_Skin}/arrows/default',
'shared' #if MODCHARTING_TOOLS, note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
}
} else {
if (Assets.exists(Paths.image("ui skins/default/arrows/" + note.arrow_Type, 'shared'))) {
return Paths.getSparrowAtlas("ui skins/default/arrows/" + note.arrow_Type, 'shared' #if MODCHARTING_TOOLS ,note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
return Paths.getSparrowAtlas("ui skins/default/arrows/" + note.arrow_Type,
'shared' #if MODCHARTING_TOOLS, note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
} else {
return Paths.getSparrowAtlas('ui skins/${note.song.ui_Skin}/arrows/default', 'shared' #if MODCHARTING_TOOLS ,note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
return Paths.getSparrowAtlas('ui skins/${note.song.ui_Skin}/arrows/default',
'shared' #if MODCHARTING_TOOLS, note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
}
}
return Paths.getSparrowAtlas('ui skins/default/arrows/default', 'shared' #if MODCHARTING_TOOLS ,note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
return Paths.getSparrowAtlas('ui skins/default/arrows/default',
'shared' #if MODCHARTING_TOOLS, note.song.modchartingTools || FlxG.state is modcharting.ModchartEditorState #end);
}

public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?character:Int = 0, ?arrowType:String = "default",
Expand Down Expand Up @@ -308,6 +323,17 @@ class Note extends FlxSkewedSprite {
}
}
}

/**
* Override the setter to disable rounding on clipRect
* @author CCobaltDev
*/
@:noCompletion override function set_clipRect(rect:FlxRect):FlxRect {
clipRect = rect;
if (frames != null)
frame = frames.frames[animation.frameIndex];
return rect;
}
}

typedef NoteType = {
Expand Down

0 comments on commit 6821b83

Please sign in to comment.