Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
shitty changing scroll speed support
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Dec 1, 2023
1 parent 49fbeb7 commit d25ed49
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
2 changes: 1 addition & 1 deletion source/funkin/Preferences.hx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class Preferences {
}
else setPref("ghost-tap-style", preferences.get("ghost-tap") ? "on" : "off");
preferences.remove("ghost-tap");
SaveData.flushData();
}
SaveData.flushData();
}

inline public static function getPref(pref:String):Dynamic {
Expand Down
15 changes: 11 additions & 4 deletions source/funkin/objects/NotesGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,13 @@ class NotesGroup extends FlxGroup
}

scrollSpeed = songSpeed;

unspawnNotes.sort(CoolUtil.sortByStrumTime);
events.sort(CoolUtil.sortByStrumTime);

var i:Int = 0;
while (i < unspawnNotes.length)
unspawnNotes[i++].__doDraw();

if (isPlayState) {
final notetypeScripts:Array<String> = ModdingUtil.getSubFolderScriptList('data/notetypes', [curSong]);
Expand All @@ -292,10 +297,12 @@ class NotesGroup extends FlxGroup

public var scrollSpeed(default, set):Float = 1.0; // Shortcut to change all notes scroll speed
public function set_scrollSpeed(value:Float = 1.0) {
for (i in unspawnNotes.concat(notes.members)) {
i.noteSpeed = value;
if (value != scrollSpeed) {
for (i in unspawnNotes.concat(notes.members)) {
i.noteSpeed = value;
}
spawnNotes();
}
spawnNotes();
return scrollSpeed = value;
}

Expand Down Expand Up @@ -345,7 +352,7 @@ class NotesGroup extends FlxGroup

function spawnNotes() { // Generate notes
if (unspawnNotes[0] != null) {
while (unspawnNotes.length > 0 && unspawnNotes[0].strumTime - Conductor.songPosition < 1500 / songSpeed / cameras[0].zoom * unspawnNotes[0].spawnMult) {
while (unspawnNotes.length > 0 && unspawnNotes[0].strumTime - Conductor.songPosition < 1500 / unspawnNotes[0].noteSpeed / cameras[0].zoom * unspawnNotes[0].spawnMult) {
final dunceNote:Note = unspawnNotes[0];
ModdingUtil.addCall('noteSpawn', [dunceNote]);
notes.add(dunceNote);
Expand Down
22 changes: 18 additions & 4 deletions source/funkin/objects/note/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,21 @@ class Note extends FlxSpriteExt implements INoteData {
}

public var drawNote:Bool = true;
var __queueDraw:Bool = false;

@:noCompletion
public inline function __doDraw() {
if (isSustainNote && __queueDraw) {
__queueDraw = false;
drawSustain();
}
}

override function draw() { // This should help a bit on performance
if (drawNote) super.draw();
if (drawNote) {
__doDraw();
super.draw();
}
}

inline public function hideNote() {
Expand All @@ -140,7 +153,7 @@ class Note extends FlxSpriteExt implements INoteData {

inline public function setSusPressed() {
y = strumCenter;
drawSustain();
__queueDraw = true;
}

inline public function getCos(?_angle) {
Expand All @@ -153,14 +166,14 @@ class Note extends FlxSpriteExt implements INoteData {

function set_susLength(value:Float):Float {
susLength = Math.max(value, 0);
drawSustain();
__queueDraw = true;
return value;
}

function set_noteSpeed(value:Float):Float {
if (noteSpeed == value) return value;
noteSpeed = value;
drawSustain();
__queueDraw = true;
return value;
}

Expand All @@ -173,6 +186,7 @@ class Note extends FlxSpriteExt implements INoteData {
if (!isSustainNote) return;
final _height = newHeight ?? Math.floor(Math.max(getMillPos(getSusLeft()) / scale.y, 0));
if (_height > (susEndHeight * (noteSpeed * 0.5) / scale.y)) {
if (_height == height) return;
if (forced || (_height > height)) { // New graphic
drawSustainCached(_height);
}
Expand Down
17 changes: 7 additions & 10 deletions source/funkin/states/options/items/SettingItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ class SettingItem extends FlxSpriteGroup {
private var settingTxt:Alphabet;
public var settingType:SettingType = null;

private var checkboxSpr:FunkinSprite; //Bool
public var numSetSpr:Alphabet; //Number
public var array:Array<String>;
//private var arraySetSpr:Alphabet; //Array
private var checkboxSpr:FunkinSprite; //Bool
public var numSetSpr:Alphabet; //Number
public var array:Array<String>; //Array

public var stringID:String = '';

Expand Down Expand Up @@ -46,10 +45,10 @@ class SettingItem extends FlxSpriteGroup {
checkboxSpr = new FunkinSprite('options/optionCheckbox');
checkboxSpr.scale.set(0.8,0.8);
checkboxSpr.updateHitbox();
checkboxSpr.addAnim('open','open');
checkboxSpr.addAnim('close','close',24,false,null,[25,0]);
checkboxSpr.addAnim('staticOpen','staticOpen',24,false,null,[-17,-37]);
checkboxSpr.addAnim('staticClose','staticClose',24,false,null,[-22,-60]);
checkboxSpr.addAnim('open', 'open');
checkboxSpr.addAnim('close', 'close', 24, false, null, [25,0]);
checkboxSpr.addAnim('staticOpen', 'staticOpen', 24, false, null, [-17,-37]);
checkboxSpr.addAnim('staticClose', 'staticClose', 24, false, null, [-22,-60]);
add(checkboxSpr);
checkboxSpr.playAnim(prefValue ? 'staticOpen' : 'staticClose');
settingTxt.x += checkboxSpr.width * checkboxSpr.scale.x;
Expand All @@ -58,8 +57,6 @@ class SettingItem extends FlxSpriteGroup {
numSetSpr = new Alphabet(20, 100,'< $prefValue >');
add(numSetSpr);
settingTxt.x += numSetSpr.x + numSetSpr.width;

//case ARRAY:
}
}

Expand Down

0 comments on commit d25ed49

Please sign in to comment.