Skip to content
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
2 changes: 1 addition & 1 deletion source/funkin/InitState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class InitState extends FlxState
* @param songId
* @param difficultyId
*/
function startSong(songId:String, difficultyId:String = 'normal'):Void
function startSong(songId:String = '', difficultyId:String = 'normal'):Void
{
var songData:Null<funkin.play.song.Song> = funkin.data.song.SongRegistry.instance.fetchEntry(songId);

Expand Down
2 changes: 2 additions & 0 deletions source/funkin/data/notestyle/NoteStyleData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ typedef NoteStyleData_NoteStrumline =
var rightPress:UnnamedAnimationData;
var rightConfirm:UnnamedAnimationData;
var rightConfirmHold:UnnamedAnimationData;
// Special FPS dependent Y offset for the strumline notes, for ensuring the visual hit window matches the calculated one.
var FPSYOffset:Float;
}

typedef NoteStyleData_NoteSplash =
Expand Down
50 changes: 45 additions & 5 deletions source/funkin/play/notes/Strumline.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,39 @@ class Strumline extends FlxSpriteGroup

// Positional fixes for new strumline graphics.
static final INITIAL_OFFSET:Float = -0.275 * STRUMLINE_SIZE;

/**
* Calculates the Y offset for the strumline hit window based on framerate cap and note style.
* The lower the FPS, the more the hit window is offset upwards on the y-axis.
*/
function getDynamicOffset():Float {
// Base offset for the strumline, includes initial value and style-specific adjustment.
var initialOffset:Float = INITIAL_OFFSET + (noteStyle?.getStrumlineFPSYOffset() ?? 10.0);

// Current framerate value from preferences.
var framerate:Float = Preferences.framerate;

// Maximum and minimum framerate values used for offset calculation.
var maxFramerate:Float = 500.0;
var minFramerate:Float = 30.0;

// The largest possible dynamic offset based on framerate range.
var maxDynamicOffset:Float = (maxFramerate - minFramerate) * 0.025;

// Ratio representing how far the current framerate is from the maximum.
var framerateRatio:Float = (maxFramerate - framerate) / (maxFramerate - minFramerate);

// Final calculated offset, combining base and dynamic offsets.
var dynamicOffset:Float = initialOffset + maxDynamicOffset * framerateRatio;

// Extra offset applied when downscroll is enabled because for some reason it's not the same as upscroll.
if (isDownscroll) {
dynamicOffset -= (maxFramerate / framerate) * 4.26;
}

return dynamicOffset;
}

static final NUDGE:Float = 2.0;

static final KEY_COUNT:Int = 4;
Expand Down Expand Up @@ -584,7 +617,7 @@ class Strumline extends FlxSpriteGroup
if (note == null || !note.alive) continue;
// Set the note's position.
if (!customPositionData) note.y = this.y
- INITIAL_OFFSET
- getDynamicOffset()
+ GRhythmUtil.getNoteY(note.strumTime, scrollSpeed, isDownscroll, conductorInUse)
+ note.yOffset;

Expand Down Expand Up @@ -666,7 +699,7 @@ class Strumline extends FlxSpriteGroup
if (isDownscroll)
{
holdNote.y = this.y
- INITIAL_OFFSET
- getDynamicOffset()
+ GRhythmUtil.getNoteY(holdNote.strumTime, scrollSpeed, isDownscroll, conductorInUse)
- holdNote.height
+ STRUMLINE_SIZE / 2
Expand All @@ -675,7 +708,7 @@ class Strumline extends FlxSpriteGroup
else
{
holdNote.y = this.y
- INITIAL_OFFSET
- getDynamicOffset()
+ GRhythmUtil.getNoteY(holdNote.strumTime, scrollSpeed, isDownscroll, conductorInUse)
+ yOffset
+ STRUMLINE_SIZE / 2
Expand Down Expand Up @@ -707,11 +740,18 @@ class Strumline extends FlxSpriteGroup
{
if (isDownscroll)
{
holdNote.y = this.y - INITIAL_OFFSET - holdNote.height + STRUMLINE_SIZE / 2;
holdNote.y = this.y
- INITIAL_OFFSET
- holdNote.height
+ STRUMLINE_SIZE / 2
+ holdNote.yOffset;
}
else
{
holdNote.y = this.y - INITIAL_OFFSET + STRUMLINE_SIZE / 2;
holdNote.y = this.y
- INITIAL_OFFSET
+ STRUMLINE_SIZE / 2
+ holdNote.yOffset;
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions source/funkin/play/notes/notestyle/NoteStyle.hx
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ class NoteStyle implements IRegistryEntry<NoteStyleData>
return filteredResult;
}

public function getStrumlineFPSYOffset():Float
{
return _data?.assets?.noteStrumline?.data?.FPSYOffset ?? 5.0;
}

public function getStrumlineOffsets():Array<Float>
{
return _data?.assets?.noteStrumline?.offsets ?? fallback?.getStrumlineOffsets() ?? [0.0, 0.0];
Expand Down