Skip to content

Commit

Permalink
Notestyle offset fixing
Browse files Browse the repository at this point in the history
and some other stuff
  • Loading branch information
Hazardous2468 committed Nov 3, 2024
1 parent cc2c6c7 commit efee1e4
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 47 deletions.
84 changes: 73 additions & 11 deletions source/funkin/play/modchartSystem/ModConstants.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,90 @@ import funkin.play.modchartSystem.modifiers.*; // if only you worked ;_;

class ModConstants
{
public static var MODCHART_VERSION:String = "v0.7.4a";

public static var tempNoteSkinScaleFix:Bool = true;
public static var MODCHART_VERSION:String = "v0.7.5a";

public static var tooCloseToCameraFix:Float = 0.975; // dumb fix for preventing freak out on z math or something

// If a mod tag is in this array, it will automatically invert the mod value
public static var dadInvert:Array<String> = [
"rotatez", "rotatey", "drunk", "tipsy", "beat", "drunkangle", "beatangle", "confusionoffset", "bumpyx", "bouncex", "linearx", "circx", "dizzy", "zigzag",
"spiralx", "tandrunk", "square", "saw", "noteskewx"
"rotatez",
"rotatey",
"drunk",
"tipsy",
"beat",
"drunkangle",
"beatangle",
"confusionoffset",
"bumpyx",
"bouncex",
"linearx",
"circx",
"dizzy",
"zigzag",
"spiralx",
"tandrunk",
"square",
"saw",
"noteskewx"
];

public static var hideSomeDebugBois:Array<String> = [
"showsubmods", "showzerovalue", "debugx", "debugy", "arrowpathred", "arrowpathgreen", "arrowpathblue", "spiralholds", "grain", "arrowpathgrain",
"arrowpathlength", "arrowpathbacklength", "showlanemods", "showallmods", "showextra", "arrowpath_notitg", "stealthglowred", "stealthglowblue",
"stealthglowgreen", "arrowpathwidth", "noholdmathshortcut", "mathcutoff"
"showsubmods",
"showzerovalue",
"debugx",
"debugy",
"arrowpathred",
"arrowpathgreen",
"arrowpathblue",
"spiralholds",
"grain",
"arrowpathgrain",
"arrowpathlength",
"arrowpathbacklength",
"showlanemods",
"showallmods",
"showextra",
"arrowpath_notitg",
"stealthglowred",
"stealthglowblue",
"stealthglowgreen",
"arrowpathwidth",
"noholdmathshortcut",
"mathcutoff"
];

public static var specialMods:Array<String> = [
"showsubmods", "showzerovalue", "debugx", "debugy", "showlanemods", "showallmods", "showextra", "noholdmathshortcut", "invertmodvalues", "mathcutoff",
"strumx", "strumy", "strumz", "zsort", "drive2", "spiralholds", "grain", "arrowpath", "arrowpath_notitg", "arrowpathbacklength", "arrowpathlength",
"arrowpathgrain", "zsort", "invertmodvalues", "drawdistance", "drawdistanceback", "straightholds", "longholds", "strumx", "strumy", "strumz"
"showsubmods",
"showzerovalue",
"debugx",
"debugy",
"showlanemods",
"showallmods",
"showextra",
"noholdmathshortcut",
"invertmodvalues",
"mathcutoff",
"strumx",
"strumy",
"strumz",
"zsort",
"drive2",
"spiralholds",
"grain",
"arrowpath",
"arrowpath_notitg",
"arrowpathbacklength",
"arrowpathlength",
"arrowpathgrain",
"zsort",
"invertmodvalues",
"drawdistance",
"drawdistanceback",
"straightholds",
"longholds",
"strumx",
"strumy",
"strumz"
];

// Was going to use this for sorting out the new mod arrays (from mods_sorted to the new method).
Expand Down
3 changes: 3 additions & 0 deletions source/funkin/play/modchartSystem/StrumExtraData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class StrumExtraData
return this.cullModeSustain;
}

public var noteStyleOffsetX:Float = 0.0;
public var noteStyleOffsetY:Float = 0.0;

// Who we belong too, in case we need to reference it
public var whichStrumNote:StrumlineNote;

Expand Down
9 changes: 9 additions & 0 deletions source/funkin/play/modchartSystem/modifiers/OffsetMods.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class NoteOffsetXMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand All @@ -24,6 +25,7 @@ class NoteOffsetYMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand All @@ -37,6 +39,7 @@ class NoteOffsetZMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand All @@ -50,6 +53,7 @@ class HoldOffsetXMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand All @@ -63,6 +67,7 @@ class HoldOffsetYMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand All @@ -76,6 +81,7 @@ class HoldOffsetZMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand All @@ -89,6 +95,7 @@ class StrumOffsetXMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand All @@ -107,6 +114,7 @@ class StrumOffsetYMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand All @@ -125,6 +133,7 @@ class StrumOffsetZMod extends Modifier
public function new(name:String)
{
super(name, 0);
modPriority = -670;
}

override function noteMath(data:NoteData, strumLine:Strumline, ?isHoldNote = false, ?isArrowPath:Bool = false):Void
Expand Down
18 changes: 14 additions & 4 deletions source/funkin/play/modchartSystem/modifiers/RotateMods.hx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RotateXModifier extends Modifier

// grab strum x
var whichStrumNote = strumLine.getByIndex(data.direction % Strumline.KEY_COUNT);
var yyyy:Float = whichStrumNote.y;
var yyyy:Float = whichStrumNote.y - whichStrumNote.strumExtraModData.noteStyleOffsetY;
var strumZ:Float = whichStrumNote.z;

if (data.noteType != "receptor")
Expand Down Expand Up @@ -89,6 +89,7 @@ class RotateXModifier extends Modifier
rotateModPivotPoint.x += getSubVal("offset_x");
rotateModPivotPoint.y = (FlxG.height / 2) - (ModConstants.strumSize / 2);
rotateModPivotPoint.y += getSubVal("offset_y");

if (!Preferences.downscroll) // make it more like downscroll if upscroll (so 180 rotatex is like reverse 100%)
{
rotateModPivotPoint.y += -23;
Expand Down Expand Up @@ -130,7 +131,8 @@ class RotateYMod extends Modifier
// grab strum x

var whichStrumNote = strumLine.getByIndex(data.direction % Strumline.KEY_COUNT);
var strumX:Float = whichStrumNote.x;

var strumX:Float = whichStrumNote.x - whichStrumNote.strumExtraModData.noteStyleOffsetX;
var strumZ:Float = whichStrumNote.z;
if (data.noteType == "receptor")
{
Expand Down Expand Up @@ -169,6 +171,8 @@ class RotateYMod extends Modifier
rotateModPivotPoint.y = data.z;
rotateModPivotPoint.y += getSubVal("offset_y");

rotateModPivotPoint.x += strumLine.getByIndex(data.direction % Strumline.KEY_COUNT).strumExtraModData.noteStyleOffsetX;

var thing:Vector2 = ModConstants.rotateAround(rotateModPivotPoint, new Vector2(data.x, data.z), currentValue);
data.x = thing.x;
data.z = thing.y;
Expand Down Expand Up @@ -205,8 +209,8 @@ class RotateZMod extends Modifier

// grab strum x
var whichStrumNote = strumLine.getByIndex(data.direction % Strumline.KEY_COUNT);
var strumX:Float = whichStrumNote.x;
var strumY:Float = whichStrumNote.y;
var strumX:Float = whichStrumNote.x - whichStrumNote.strumExtraModData.noteStyleOffsetX;
var strumY:Float = whichStrumNote.y - whichStrumNote.strumExtraModData.noteStyleOffsetY;

if (data.noteType != "receptor")
{
Expand Down Expand Up @@ -263,6 +267,9 @@ class RotateZMod extends Modifier
rotateModPivotPoint.y = strumLine.y;
rotateModPivotPoint.y = (FlxG.height / 2) - (ModConstants.strumSize / 2);
rotateModPivotPoint.y += getSubVal("offset_y");

rotateModPivotPoint.x += strumLine.getByIndex(data.direction % Strumline.KEY_COUNT).strumExtraModData.noteStyleOffsetX;

var thing:Vector2 = ModConstants.rotateAround(rotateModPivotPoint, new Vector2(data.x, data.y), currentValue);
data.x = thing.x;
data.y = thing.y;
Expand Down Expand Up @@ -290,6 +297,7 @@ class StrumRotateXMod extends Modifier
rotateModPivotPoint.x += getSubVal("offset_x");
rotateModPivotPoint.y = (FlxG.height / 2) - (ModConstants.strumSize / 2);
rotateModPivotPoint.y += getSubVal("offset_y");

if (!Preferences.downscroll) // make it more like downscroll if upscroll (so 180 rotatex is like reverse 100%)
{
rotateModPivotPoint.y += -23;
Expand Down Expand Up @@ -323,6 +331,7 @@ class StrumRotateYMod extends Modifier
rotateModPivotPoint.x += getSubVal("offset_x");
rotateModPivotPoint.y = data.z;
rotateModPivotPoint.y += getSubVal("offset_y");
rotateModPivotPoint.x += strumLine.getByIndex(data.direction % Strumline.KEY_COUNT).strumExtraModData.noteStyleOffsetX;

var thing:Vector2 = ModConstants.rotateAround(rotateModPivotPoint, new Vector2(data.x, data.z), currentValue);
data.x = thing.x;
Expand Down Expand Up @@ -352,6 +361,7 @@ class StrumRotateZMod extends Modifier
rotateModPivotPoint.y = strumLine.y;
rotateModPivotPoint.y = (FlxG.height / 2) - (ModConstants.strumSize / 2);
rotateModPivotPoint.y += getSubVal("offset_y");
rotateModPivotPoint.x += strumLine.getByIndex(data.direction % Strumline.KEY_COUNT).strumExtraModData.noteStyleOffsetX;
var thing:Vector2 = ModConstants.rotateAround(rotateModPivotPoint, new Vector2(data.x, data.y), currentValue);
data.x = thing.x;
data.y = thing.y;
Expand Down
3 changes: 3 additions & 0 deletions source/funkin/play/notes/NoteSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,16 @@ class NoteSprite extends ZSprite
vwooshing = false;
}

public var targetScale:Float = 1.0;

/**
* Creates frames and animations
* @param noteStyle The `NoteStyle` instance
*/
public function setupNoteGraphic(noteStyle:NoteStyle):Void
{
noteStyle.buildNoteSprite(this);
targetScale = this.scale.x;

this.shader = hsvShader;
stealthGlow = 0.0;
Expand Down
Loading

0 comments on commit efee1e4

Please sign in to comment.