play here

This commit is contained in:
Yoshman29
2023-04-19 02:48:18 +02:00
parent 2f7c539d2a
commit 6149753495
4 changed files with 23 additions and 13 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
- [x] Fix the strumlines bar when zooming out
- [ ] Step based zooming
- [ ] Algorithm to make note placements faster & sorted out
- [ ] Play here working
- [x] Play here working
- [ ] Events (including Camera Movement)
- [ ] Custom Notes
- [ ] Metadata Editing
+11 -5
View File
@@ -341,7 +341,8 @@ class Charter extends UIState {
scrollBar = new UIScrollBar(FlxG.width - 20, topMenuSpr.bHeight, 1000, 0, 100);
scrollBar.cameras = [uiCamera];
scrollBar.onChange = function(v) {
Conductor.songPosition = Conductor.getTimeForStep(v);
if (!FlxG.sound.music.playing)
Conductor.songPosition = Conductor.getTimeForStep(v);
};
uiGroup.add(scrollBar);
@@ -658,6 +659,9 @@ class Charter extends UIState {
}
}
public static var startTime:Float = 0;
public static var startHere:Bool = false;
function updateDisplaySprites() {
conductorFollowerSpr.scale.set(gridBackdrop.strumlinesAmount * 4 * 40, 4);
conductorFollowerSpr.updateHitbox();
@@ -793,9 +797,9 @@ class Charter extends UIState {
FlxG.sound.music.pause();
vocals.pause();
} else {
vocals.time = FlxG.sound.music.time = Conductor.songPosition;
FlxG.sound.music.play();
vocals.play();
vocals.time = FlxG.sound.music.time = Conductor.songPosition;
}
}
@@ -834,11 +838,11 @@ class Charter extends UIState {
inline function _chart_playtest(_)
playtestChart(0, false);
inline function _chart_playtest_here(_)
playtestChart(Conductor.songPosition, false);
playtestChart(Conductor.songPosition, false, true);
inline function _chart_playtest_opponent(_)
playtestChart(0, true);
inline function _chart_playtest_opponent_here(_)
playtestChart(Conductor.songPosition, true);
playtestChart(Conductor.songPosition, true, true);
function _playback_metronome(t) {
t.icon = (Options.charterMetronomeEnabled = !Options.charterMetronomeEnabled) ? 1 : 0;
@@ -913,8 +917,10 @@ class Charter extends UIState {
]));
}
public function playtestChart(time:Float = 0, opponentMode = false) {
public function playtestChart(time:Float = 0, opponentMode = false, here = false) {
buildChart();
startHere = here;
startTime = Conductor.songPosition;
PlayState.opponentMode = opponentMode;
PlayState.chartingMode = true;
FlxG.switchState(new PlayState());
+3 -2
View File
@@ -1,5 +1,6 @@
package funkin.game;
import funkin.editors.charter.Charter;
import funkin.savedata.FunkinSave;
import flixel.graphics.FlxGraphic;
import funkin.backend.chart.Chart;
@@ -629,7 +630,7 @@ class PlayState extends MusicBeatState
// CAMERA & HUD INITIALISATION
#if REGION
for(str in strumLines)
str.generate(str.data);
str.generate(str.data, (chartingMode && Charter.startHere) ? Charter.startTime : null);
camFollow = new FlxObject(0, 0, 2, 2);
camFollow.setPosition(camPos.x, camPos.y);
@@ -858,7 +859,7 @@ class PlayState extends MusicBeatState
vocals.pause();
inst.pause();
inst.time = vocals.time = 0;
inst.time = vocals.time = (chartingMode && Charter.startHere) ? Charter.startTime : 0;
vocals.play();
inst.play();
+8 -5
View File
@@ -64,7 +64,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
private inline function set_ghostTapping(b:Bool):Bool
return this.ghostTapping = b;
private var strumOffset:Float = 0.25;
public function new(characters:Array<Character>, strumOffset:Float = 0.25, cpu:Bool = false, opponentSide:Bool = true, ?controls:Controls) {
@@ -77,10 +77,13 @@ class StrumLine extends FlxTypedGroup<Strum> {
this.notes = new NoteGroup();
}
public function generate(strumLine:ChartStrumLine) {
public function generate(strumLine:ChartStrumLine, ?startTime:Float) {
if (strumLine.notes != null) for(note in strumLine.notes) {
if (startTime != null && startTime > note.time)
continue;
notes.add(new Note(this, note, false));
if (note.sLen > Conductor.stepCrochet * 0.75) {
var len:Float = note.sLen;
var curLen:Float = 0;
@@ -108,10 +111,10 @@ class StrumLine extends FlxTypedGroup<Strum> {
public function updateNotes() {
notes.forEach(updateNote);
}
var __updateNote_strum:Strum;
public function updateNote(daNote:Note) {
for(e in members) {
if (e.ID == daNote.noteData % 4) {
__updateNote_strum = e;