Skip to content

Commit

Permalink
Show example arrow for scroll speed in options
Browse files Browse the repository at this point in the history
  • Loading branch information
superpowers04 committed Jan 8, 2025
1 parent e0d4f4a commit 2467299
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 18 deletions.
3 changes: 3 additions & 0 deletions source/Conductor.hx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class Conductor {
public static var bpmChangeMapSteps:Map<Int,BPMChangeEvent> = [];

public function new(){}
public static function update(e:Float){
songPosition = FlxG.sound.music.time;
}

@:keep inline public static function recalculateTimings() {
Conductor.safeFrames = SESave.data.frames;
Expand Down
2 changes: 1 addition & 1 deletion source/FakeNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FakeNote extends Note
//Literally just copied flxsprite and flxobject's update
override public function update(elapsed:Float):Void
{

updateAnimation(elapsed);
}
}
2 changes: 1 addition & 1 deletion source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class Note extends FlxSprite
type = _type;
x = y = 300;
this.inCharter = _inCharter;
this.rawNote = (if(_rawNote == null) [strumTime,_noteData,0] else _rawNote);
this.rawNote = (_rawNote ?? [strumTime,_noteData,0]);



Expand Down
58 changes: 58 additions & 0 deletions source/Options.hx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class OptionCategory
this.options = options;
this.modded = mod;
}
public function update(e:Float){}
public function draw(){}
}

class Option
Expand All @@ -69,6 +71,8 @@ class Option
public function updateDisplay():String { return display; }
public function left():Bool { return false; }
public function right():Bool { return false; }
public function update(e:Float){}
public function draw(){}
}


Expand Down Expand Up @@ -537,7 +541,61 @@ class SelScriptOption extends Option
}

}
class ScrollSpeedOption extends HCFloatOption{
public var note:Note;
public var strum:StrumArrow;
override public function new(){
try{

note = new Note(0,SESave.data.downscroll ? 1 : 2);
strum = new StrumArrow(SESave.data.downscroll ? 1 : 2);
note.parentSprite = strum;
note.inCharter = note.visible = note.showNote = true;
strum.init();
strum.playStatic();
strum.x = 1000;
note.x = strum.x + (strum.width * 0.5);
}catch(e){
trace('Failed to load note for Scroll Speed ${e}');
}
super('Scroll Speed',"Change your scroll speed (1 = Chart dependent)","scrollSpeed",0.1,10,0.1);
}
override public function update(e:Float){
// if(note == null || strum == null) return;
Conductor.update(e);

strum.update(e);
note.update(e);
// trace(dist);

}
override public function draw(){
// if(note == null || strum == null) return;
var dist = (Conductor.songPosition - note.strumTime);
var _scrollSpeed = SESave.data.scrollSpeed;
Conductor.update(e);

if(Math.abs(dist) < 50){
strum.confirm();
}

note.distanceToSprite = (0.45 * dist * _scrollSpeed);
if(SESave.data.downscroll){
strum.y = 680;
note.y = strum.y + note.distanceToSprite;
}else{
strum.y = 120;
note.y = strum.y - note.distanceToSprite;
}
if(dist > 500){
strum.playStatic();
note.strumTime = Conductor.songPosition + 500;
}
strum.draw();
note.draw();
}

}
class IntOption extends Option{
var min:Int = 0;
var max:Int;
Expand Down
23 changes: 16 additions & 7 deletions source/OptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ class OptionsMenu extends MusicBeatState

var options:Array<OptionCategory> = [
new OptionCategory("Session/Temp Options", [
for (name => setting in QuickOptionsSubState.normalSettings)
{
new QuickOption(name);
}
for (name => setting in QuickOptionsSubState.normalSettings){new QuickOption(name);}
],"Chart options.\nTHESE ARE TEMPORARY AND RESET WHEN GAME IS CLOSED!"),
new OptionCategory("Modifications", [
new OpponentOption("Change the opponent character"),
Expand Down Expand Up @@ -122,7 +119,7 @@ class OptionsMenu extends MusicBeatState
new HCBoolOption("Debounce detection","Enables some simple debounce detection. Forces presses to be missed from one frame to another.","debounce"),
new Judgement("Customize your Hit Timings (LEFT or RIGHT)"),

new HCFloatOption('Scroll Speed',"Change your scroll speed (1 = Chart dependent)","scrollSpeed",0.1,10,0.1),
new ScrollSpeedOption(),
// new HCFloatOption('Scroll Speed(OSU Chart)',"Change your scroll speed OSU charts","scrollOSUSpeed",0.1,10,0.1),

new HCBoolOption("Accurate Note Sustain","Whether note sustains/holds are more accurate. If off then they act like early kade","accurateNoteSustain"),
Expand Down Expand Up @@ -231,7 +228,14 @@ class OptionsMenu extends MusicBeatState
}
],Lang.get('se.options.lang.desc')),
];

override public function draw(){
super.draw();
if(isCat){
currentSelectedCat.options[curSelected].draw();
}else if (options[curSelected] !=null){
options[curSelected].draw();
}
}
public var acceptInput:Bool = true;

private var currentDescription:String = "";
Expand All @@ -242,6 +246,7 @@ class OptionsMenu extends MusicBeatState
var currentSelectedCat:OptionCategory;
var blackBorder:FlxSprite;
var titleText:FlxText;

static public var bgMusic:FlxSound;
static public var lastMusic:FlxSound;
function addTitleText(str:String = "se.options.title"){
Expand Down Expand Up @@ -441,7 +446,11 @@ class OptionsMenu extends MusicBeatState
// updateOffsetText();
}
}

if(isCat){
currentSelectedCat.options[curSelected].update(elapsed);
}else if (options[curSelected] != null){
options[curSelected].update(elapsed);
}
}
function updateAlphabet(obj:Alphabet,str:String = ""){

Expand Down
13 changes: 5 additions & 8 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3007,21 +3007,18 @@ class PlayState extends ScriptMusicBeatState
i++;
if(daNote == null || !holdArray[daNote.noteData] || !daNote.mustPress || !daNote.isSustainNote || !daNote.updateCanHit()) continue;
if(!acns || daNote.strumTime <= Conductor.songPosition - (50 * Conductor.timeScale) || daNote.isSustainNoteEnd) {// Only destroy the note when properly hit
goodNoteHit(daNote);

continue;
}
goodNoteHit(daNote);
continue;
}
// Tell note to be clipped to strumline
daNote.isPressed = true;
hitArray[daNote.noteData] = true;
daNote.susHit(0,daNote);
callInterp("susHit",[daNote]);
}
}
{
var i = possibleNotes.length;
while(i > 0){possibleNotes.pop();i--;}
}
while(possibleNotes.pop() != null){}

// var possibleNotes:Array<Note> = [null,null,null,null]; // notes that can be hit
var onScreenNote:Bool = false;
var members = notes.members;
Expand Down
1 change: 1 addition & 0 deletions source/StrumArrow.hx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

package;

import flixel.FlxG;
Expand Down
2 changes: 1 addition & 1 deletion source/se/SESave.hx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ typedef YourMother = Dynamic;
var undlaSize:Int = 0;
var undlaTrans:Float = 0.1;
var instVol:Float = 0.8;
var masterVol:Float = 1;
var masterVol:Float = 0.6;
var voicesVol:Float = 1;
var missVol:Float = 0.1;
var hitVol:Float = 0.6;
Expand Down

0 comments on commit 2467299

Please sign in to comment.