Skip to content

Commit

Permalink
BMS Player : fix bugs about autoplay
Browse files Browse the repository at this point in the history
  • Loading branch information
exch-bms2 committed Dec 2, 2016
1 parent e690bbe commit 138164e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/bms/player/beatoraja/play/BMSPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public BMSPlayer(MainController main, PlayerResource resource) {
}
}

judge = new JudgeManager(this, model, resource.getConstraint());
judge = new JudgeManager(this, model, autoplay == 1, resource.getConstraint());
if (exjudge) {
judge.setJudgeMode(JudgeManager.EXPAND_JUDGE);
}
Expand Down Expand Up @@ -476,9 +476,7 @@ public void render() {

input.setStartTime(now + getStartTime() - starttimeoffset);
List<KeyInputLog> keylog = null;
if (autoplay == 1) {
keylog = createAutoplayLog(model);
} else if (autoplay >= 3) {
if (autoplay >= 3) {
keylog = Arrays.asList(replay.keylog);
}
autoThread = new AutoplayThread();
Expand Down Expand Up @@ -566,7 +564,9 @@ && getTimer()[TIMER_ENDOFNOTE_1P] == Long.MIN_VALUE
resource.setCombo(judge.getCourseCombo());
resource.setMaxcombo(judge.getCourseMaxcombo());
saveConfig();
gaugelog.add(0f);
for(long l = getTimer()[TIMER_FAILED] - getTimer()[TIMER_PLAY];l < playtime + 500;l += 500) {
gaugelog.add(0f);
}
resource.setGauge(gaugelog);
resource.setGrooveGauge(gauge);
input.setEnableKeyInput(true);
Expand All @@ -590,7 +590,6 @@ && getTimer()[TIMER_ENDOFNOTE_1P] == Long.MIN_VALUE
}
long l2 = now - getTimer()[TIMER_FADEOUT];
if (l2 > skin.getFadeout()) {
resource.getAudioProcessor().stop(null);
resource.getBGAManager().stop();
if (keyinput != null) {
Logger.getGlobal().info("入力パフォーマンス(max ms) : " + keyinput.frametimes);
Expand Down
45 changes: 43 additions & 2 deletions src/bms/player/beatoraja/play/JudgeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ public class JudgeManager {

private int prevtime;

public JudgeManager(BMSPlayer main, BMSModel model, int[] constraint) {
private boolean autoplay = false;

public JudgeManager(BMSPlayer main, BMSModel model, boolean autoplay, int[] constraint) {
this.main = main;
this.autoplay = autoplay;
init(model);
for (int mode : constraint) {
if (mode == TableData.NO_GREAT) {
Expand Down Expand Up @@ -250,6 +253,44 @@ public void update(final int time) {
main.getGauge().addValue(-mnote.getDamage());
System.out.println("Mine Damage : " + mnote.getWav());
}

if(autoplay) {
final int lane = keyassign[key];
// ここにオートプレイ処理を入れる
if(note instanceof NormalNote && note.getState() == 0) {
main.play(note, config.getKeyvolume());
this.update(lane, 0, time, 0);
note.setTime(0);
note.setState(1);
}
if(note instanceof LongNote) {
final LongNote ln = (LongNote) note;
if (ln.getSection() == tl.getSection() && ln.getState() == 0) {
main.play(note, config.getKeyvolume());
if ((lntype == BMSModel.LNTYPE_LONGNOTE && ln.getType() == LongNote.TYPE_UNDEFINED)
|| ln.getType() == LongNote.TYPE_LONGNOTE) {
passingcount[lane] = 0;
} else {
this.update(lane, 0, time, 0);
ln.setTime(0);
ln.setState(1);
}
processing[lane] = ln;
}
if (ln.getEndnote().getSection() == tl.getSection() && ln.getEndnote().getState() == 0) {
if ((lntype != BMSModel.LNTYPE_LONGNOTE && ln.getType() == LongNote.TYPE_UNDEFINED)
|| ln.getType() == LongNote.TYPE_CHARGENOTE
|| ln.getType() == LongNote.TYPE_HELLCHARGENOTE) {
this.update(lane, 0, time, 0);
ln.getEndnote().setState(1);
ln.getEndnote().setTime(0);
main.play(processing[lane].getEndnote(), config.getKeyvolume());
processing[lane] = null;
}
}
}

}
}
}
if (pos < i && tl.getTime() < prevtime - njudge[5]) {
Expand All @@ -261,7 +302,7 @@ public void update(final int time) {
// HCNゲージ増減判定
Arrays.fill(next_inclease, false);
for (int key = 0; key < keyassign.length; key++) {
if (passing[keyassign[key]] != null && keystate[key]) {
if (passing[keyassign[key]] != null && (keystate[key] || autoplay)) {
next_inclease[keyassign[key]] = true;
}
}
Expand Down

0 comments on commit 138164e

Please sign in to comment.