Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note judge timing setting #720

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
/table/*
/course/*
/favorite/*
/release/*
/ipfs/*
/.settings/*
songdata.db
songinfo.db
config.json
Expand All @@ -16,4 +19,6 @@ beatoraja_log.xml
b.bat
/*.dll
*.cim
.idea/
.idea/
.classpath
.project
15 changes: 15 additions & 0 deletions src/bms/player/beatoraja/PlayerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public class PlayerConfig {

private boolean notesDisplayTimingAutoAdjust = false;

private int soundOffset = 0;

/**
* 選曲時のモードフィルター
*/
Expand Down Expand Up @@ -259,6 +261,18 @@ public void setJudgetiming(int judgetiming) {
this.judgetiming = judgetiming;
}

public int getSoundOffset() {
return soundOffset;
}

public int getSoundOffsetMicro() {
return soundOffset * 1000;
}

public void setSoundOffset(int soundOffset) {
this.soundOffset = soundOffset;
}

public boolean isNotesDisplayTimingAutoAdjust() {
return notesDisplayTimingAutoAdjust;
}
Expand Down Expand Up @@ -801,6 +815,7 @@ public void validate() {
target = MathUtils.clamp(target, 0, TargetProperty.getAllTargetProperties().length);
targetid = targetid!= null ? targetid : "MAX";
judgetiming = MathUtils.clamp(judgetiming, JUDGETIMING_MIN, JUDGETIMING_MAX);
soundOffset = MathUtils.clamp(soundOffset, JUDGETIMING_MIN, JUDGETIMING_MAX);
misslayerDuration = MathUtils.clamp(misslayerDuration, 0, 5000);
lnmode = MathUtils.clamp(lnmode, 0, 2);
keyJudgeWindowRatePerfectGreat = MathUtils.clamp(keyJudgeWindowRatePerfectGreat, 25, 400);
Expand Down
6 changes: 6 additions & 0 deletions src/bms/player/beatoraja/launcher/PlayConfigurationView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
</valueFactory>
</NumericSpinner>
<CheckBox fx:id="notesdisplaytimingautoadjust" mnemonicParsing="false" text="%NOTESDISPLAYTIMING_AUTOADJUST" GridPane.columnIndex="2" GridPane.rowIndex="4" GridPane.columnSpan="2" />
<Label text="%NOTEJUDGETIMING" GridPane.columnIndex="4" GridPane.rowIndex="4" />
<NumericSpinner fx:id="notesjudgetiming" editable="true" GridPane.columnIndex="5" GridPane.rowIndex="4">
<valueFactory>
<SpinnerValueFactory.IntegerSpinnerValueFactory />
</valueFactory>
</NumericSpinner>
<Label text="%HISPEED_FIX" GridPane.columnIndex="0" GridPane.rowIndex="5" />
<ComboBox fx:id="fixhispeed" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<Label text="%HISPEED_MARGIN" GridPane.columnIndex="2" GridPane.rowIndex="5" />
Expand Down
5 changes: 5 additions & 0 deletions src/bms/player/beatoraja/launcher/PlayConfigurationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public class PlayConfigurationView implements Initializable {
@FXML
private CheckBox notesdisplaytimingautoadjust;
@FXML
private NumericSpinner<Integer> notesjudgetiming;
@FXML
private CheckBox bpmguide;
@FXML
private ComboBox<Integer> gaugeautoshift;
Expand Down Expand Up @@ -312,6 +314,7 @@ public void initialize(URL arg0, ResourceBundle arg1) {
initComboBox(autosavereplay4, autosaves);

notesdisplaytiming.setValueFactoryValues(PlayerConfig.JUDGETIMING_MIN, PlayerConfig.JUDGETIMING_MAX, 0, 1);
notesjudgetiming.setValueFactoryValues(PlayerConfig.JUDGETIMING_MIN, PlayerConfig.JUDGETIMING_MAX, 0, 1);
resourceController.init(this);

checkNewVersion();
Expand Down Expand Up @@ -434,6 +437,7 @@ public void updatePlayer() {
lntype.getSelectionModel().select(player.getLnmode());

notesdisplaytiming.getValueFactory().setValue(player.getJudgetiming());
notesjudgetiming.getValueFactory().setValue(player.getSoundOffset());
notesdisplaytimingautoadjust.setSelected(player.isNotesDisplayTimingAutoAdjust());

bpmguide.setSelected(player.isBpmguide());
Expand Down Expand Up @@ -536,6 +540,7 @@ public void commitPlayer() {
player.setGauge(gaugeop.getValue());
player.setLnmode(lntype.getValue());
player.setJudgetiming(getValue(notesdisplaytiming));
player.setSoundOffset(getValue(notesjudgetiming));
player.setNotesDisplayTimingAutoAdjust(notesdisplaytimingautoadjust.isSelected());

player.setBpmguide(bpmguide.isSelected());
Expand Down
20 changes: 11 additions & 9 deletions src/bms/player/beatoraja/play/JudgeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,12 @@ public void init(BMSModel model, PlayerResource resource) {
scratchJudgeWindowRate[2] = 0;
}
}

nmjudge = rule.getJudge(NoteType.NOTE, judgerank, keyJudgeWindowRate);
cnendmjudge = rule.getJudge(NoteType.LONGNOTE_END, judgerank, keyJudgeWindowRate);
smjudge = rule.getJudge(NoteType.SCRATCH, judgerank, scratchJudgeWindowRate);
scnendmjudge = rule.getJudge(NoteType.LONGSCRATCH_END, judgerank, scratchJudgeWindowRate);

final int soundOffset = main.main.getPlayerConfig().getSoundOffsetMicro();
nmjudge = rule.getJudge(NoteType.NOTE, judgerank, keyJudgeWindowRate, soundOffset);
cnendmjudge = rule.getJudge(NoteType.LONGNOTE_END, judgerank, keyJudgeWindowRate, soundOffset);
smjudge = rule.getJudge(NoteType.SCRATCH, judgerank, scratchJudgeWindowRate, soundOffset);
scnendmjudge = rule.getJudge(NoteType.LONGSCRATCH_END, judgerank, scratchJudgeWindowRate, soundOffset);
mjudgestart = mjudgeend = 0;
for (long[] l : nmjudge) {
mjudgestart = Math.min(mjudgestart, l[0]);
Expand Down Expand Up @@ -253,6 +254,7 @@ public void update(final long mtime) {
final BMSPlayerInputProcessor input = mc.getInputProcessor();
final Config config = mc.getPlayerResource().getConfig();
final long now = mc.getNowTime();
final int soundOffset = main.main.getPlayerConfig().getSoundOffsetMicro();
// 通過系の判定
Arrays.fill(next_inclease, false);

Expand Down Expand Up @@ -409,7 +411,7 @@ public void update(final long mtime) {
|| processing[lane].getType() == LongNote.TYPE_HELLCHARGENOTE) && sc >= 0
&& key != sckey[sc]) {
final long[][] mjudge = scnendmjudge;
final long dmtime = processing[lane].getMicroTime() - pmtime;
final long dmtime = processing[lane].getMicroTime() - pmtime - soundOffset;
int j = 0;
for (; j < mjudge.length && !(dmtime >= mjudge[j][0] && dmtime <= mjudge[j][1]); j++)
;
Expand Down Expand Up @@ -470,7 +472,7 @@ public void update(final long mtime) {
if (tnote instanceof LongNote) {
// ロングノート処理
final LongNote ln = (LongNote) tnote;
final long dmtime = tnote.getMicroTime() - pmtime;
final long dmtime = tnote.getMicroTime() - pmtime - soundOffset;
keysound.play(tnote, config.getAudioConfig().getKeyvolume(), 0);
if (((lntype == BMSModel.LNTYPE_LONGNOTE && ln.getType() == LongNote.TYPE_UNDEFINED)
|| ln.getType() == LongNote.TYPE_LONGNOTE)
Expand All @@ -492,7 +494,7 @@ public void update(final long mtime) {
} else {
keysound.play(tnote, config.getAudioConfig().getKeyvolume(), 0);
// 通常ノート処理
final long dmtime = tnote.getMicroTime() - pmtime;
final long dmtime = tnote.getMicroTime() - pmtime - soundOffset;
this.updateMicro(lane, tnote, mtime, j, dmtime);
}
} else {
Expand Down Expand Up @@ -529,7 +531,7 @@ public void update(final long mtime) {
// キーが離されたときの処理
if (processing[lane] != null) {
final long[][] mjudge = sc >= 0 ? scnendmjudge : cnendmjudge;
long dmtime = processing[lane].getMicroTime() - pmtime;
long dmtime = processing[lane].getMicroTime() - pmtime - soundOffset;
int j = 0;
for (; j < mjudge.length && !(dmtime >= mjudge[j][0] && dmtime <= mjudge[j][1]); j++)
;
Expand Down
45 changes: 28 additions & 17 deletions src/bms/player/beatoraja/play/JudgeProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ private JudgeProperty(long[][] note, long[][] scratch, long[][] longnote, long[]
}

public int[][] getNoteJudge(int judgerank, int[] judgeWindowRate) {
return convertMilli(windowrule.create(note, judgerank, judgeWindowRate));
return convertMilli(windowrule.create(note, judgerank, judgeWindowRate, 0));
}

public int[][] getLongNoteEndJudge(int judgerank, int[] judgeWindowRate) {
return convertMilli(windowrule.create(longnote, judgerank, judgeWindowRate));
return convertMilli(windowrule.create(longnote, judgerank, judgeWindowRate, 0));
}

public int[][] getScratchJudge(int judgerank, int[] judgeWindowRate) {
return convertMilli(windowrule.create(scratch, judgerank, judgeWindowRate));
return convertMilli(windowrule.create(scratch, judgerank, judgeWindowRate, 0));
}

public int[][] getLongScratchEndJudge(int judgerank, int[] judgeWindowRate) {
return convertMilli(windowrule.create(longscratch, judgerank, judgeWindowRate));
return convertMilli(windowrule.create(longscratch, judgerank, judgeWindowRate, 0));
}

private int[][] convertMilli(long[][] judge) {
Expand All @@ -114,20 +114,24 @@ private int[][] convertMilli(long[][] judge) {
return mjudge;
}

public long[][] getJudge(NoteType notetype, int judgerank, int[] judgeWindowRate) {
public long[][] getJudge(NoteType notetype, int judgerank, int[] judgeWindowRate, int soundOffset) {
switch(notetype) {
case NOTE:
return windowrule.create(note, judgerank, judgeWindowRate);
return windowrule.create(note, judgerank, judgeWindowRate, soundOffset);
case LONGNOTE_END:
return windowrule.create(longnote, judgerank, judgeWindowRate);
return windowrule.create(longnote, judgerank, judgeWindowRate, soundOffset);
case SCRATCH:
return windowrule.create(scratch, judgerank, judgeWindowRate);
return windowrule.create(scratch, judgerank, judgeWindowRate, soundOffset);
case LONGSCRATCH_END:
return windowrule.create(longscratch, judgerank, judgeWindowRate);
return windowrule.create(longscratch, judgerank, judgeWindowRate, soundOffset);
default:
return windowrule.create(note, judgerank, judgeWindowRate);
return windowrule.create(note, judgerank, judgeWindowRate, soundOffset);
}
}

public long[][] getJudge(NoteType notetype, int judgerank, int[] judgeWindowRate) {
return getJudge(notetype, judgerank, judgeWindowRate, 0);
}

public enum MissCondition {
ONE, ALWAYS
Expand All @@ -141,16 +145,16 @@ public enum JudgeWindowRule {
NORMAL (new int[]{25, 50, 75, 100, 125}){

@Override
public long[][] create(long[][] org, int judgerank, int[] judgeWindowRate) {
return JudgeWindowRule.create(org, judgerank,judgeWindowRate, false);
public long[][] create(long[][] org, int judgerank, int[] judgeWindowRate, int soundOffset) {
return JudgeWindowRule.create(org, judgerank,judgeWindowRate, false, soundOffset);
}

},
PMS (new int[]{33, 50, 70, 100, 133}) {

@Override
public long[][] create(long[][] org, int judgerank, int[] judgeWindowRate) {
return JudgeWindowRule.create(org, judgerank,judgeWindowRate, true);
public long[][] create(long[][] org, int judgerank, int[] judgeWindowRate, int soundOffset) {
return JudgeWindowRule.create(org, judgerank,judgeWindowRate, true, soundOffset);
}

};
Expand All @@ -160,7 +164,7 @@ public long[][] create(long[][] org, int judgerank, int[] judgeWindowRate) {
*/
public final int[] judgerank;

private static long[][] create(long[][] org, int judgerank, int[] judgeWindowRate, boolean pms) {
private static long[][] create(long[][] org, int judgerank, int[] judgeWindowRate, boolean pms, int soundOffset) {
final long[][] judge = new long[org.length][2];
final boolean[] fix = pms ? new boolean[]{true, false, false, true, true} : new boolean[]{false, false, false, false, true};
for (int i = 0; i < judge.length; i++) {
Expand Down Expand Up @@ -205,14 +209,21 @@ private static long[][] create(long[][] org, int judgerank, int[] judgeWindowRat
}
}
}


// 判定タイミング設定による補正
for (int i = 0; i < judge.length; i++) {
for(int j = 0;j < 2;j++) {
judge[i][j] += soundOffset;
}
}

return judge;
}

private JudgeWindowRule(int[] judgerank) {
this.judgerank = judgerank;
}

public abstract long[][] create(long[][] org, int judgerank, int[] judgeWindowRate);
public abstract long[][] create(long[][] org, int judgerank, int[] judgeWindowRate, int soundOffset);
}
}
1 change: 1 addition & 0 deletions src/resources/UIResources.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ CONTINUE_UNTIL_END_OF_SONG=CONTINUE UNTIL END OF SONG
ASSIST_OPTION=Assist Options
NOTESDISPLAYTIMING=Notes Display Timing Offset
NOTESDISPLAYTIMING_AUTOADJUST=Notes Display Timing Auto Adjust
NOTEJUDGETIMING=Notes Judge Timing Offset
EXPAND_JUDGE=EXPAND JUDGE
NO_MINE=NO MINE
EXTRA_NOTE=Extra Note
Expand Down
1 change: 1 addition & 0 deletions src/resources/UIResources_ja_JP.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CONTINUE_UNTIL_END_OF_SONG=\u9014\u4e2d\u843d\u3061\u7121\u3057
ASSIST_OPTION=\u30a2\u30b7\u30b9\u30c8\u30aa\u30d7\u30b7\u30e7\u30f3
NOTESDISPLAYTIMING=\u30CE\u30FC\u30C4\u8868\u793A\u30BF\u30A4\u30DF\u30F3\u30B0
NOTESDISPLAYTIMING_AUTOADJUST=\u30CE\u30FC\u30C4\u8868\u793A\u30BF\u30A4\u30DF\u30F3\u30B0\u81EA\u52D5\u8ABF\u6574
NOTEJUDGETIMING=\u5224\u5b9a\u30bf\u30a4\u30df\u30f3\u30b0
EXPAND_JUDGE=EXPAND JUDGE
NO_MINE=NO MINE
H_RANDOM_THRESHOLD_BPM=H-RAN\u9023\u6253BPM(16\u5206)
Expand Down