Follow-up to #27.
- Removed 'isSpinner' field from GameData.hitResult() since it's now being passed the full OsuHitObject. - Minor Javadoc fixes. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
33e880df77
commit
4bf5943ee0
|
@ -1031,9 +1031,10 @@ public class GameData {
|
|||
* @param result the hit result (HIT_* constants)
|
||||
* @param x the x coordinate
|
||||
* @param y the y coordinate
|
||||
* @param hitSound the object's hit sound
|
||||
* @param hitObject the hit object
|
||||
* @param repeat the current repeat number
|
||||
*/
|
||||
public void sliderTickResult(int time, int result, float x, float y, OsuHitObject hitObject, int repeats) {
|
||||
public void sliderTickResult(int time, int result, float x, float y, OsuHitObject hitObject, int repeat) {
|
||||
int hitValue = 0;
|
||||
switch (result) {
|
||||
case HIT_SLIDER30:
|
||||
|
@ -1041,9 +1042,9 @@ public class GameData {
|
|||
incrementComboStreak();
|
||||
changeHealth(1f);
|
||||
SoundController.playHitSound(
|
||||
hitObject.getEdgeHitSoundType(repeats),
|
||||
hitObject.getSampleSet(repeats),
|
||||
hitObject.getAdditionSampleSet(repeats));
|
||||
hitObject.getEdgeHitSoundType(repeat),
|
||||
hitObject.getSampleSet(repeat),
|
||||
hitObject.getAdditionSampleSet(repeat));
|
||||
break;
|
||||
case HIT_SLIDER10:
|
||||
hitValue = 10;
|
||||
|
@ -1075,11 +1076,11 @@ public class GameData {
|
|||
* @param y the y coordinate
|
||||
* @param color the combo color
|
||||
* @param end true if this is the last hit object in the combo
|
||||
* @param hitSound the object's hit sound
|
||||
* @param isSpinner whether the hit object was a spinner
|
||||
* @param hitObject the hit object
|
||||
* @param repeat the current repeat number (for sliders, or 0 otherwise)
|
||||
*/
|
||||
public void hitResult(int time, int result, float x, float y, Color color,
|
||||
boolean end, OsuHitObject hitObject, int repeats, boolean isSpinner) {
|
||||
boolean end, OsuHitObject hitObject, int repeat) {
|
||||
int hitValue = 0;
|
||||
boolean perfectHit = false;
|
||||
switch (result) {
|
||||
|
@ -1108,10 +1109,9 @@ public class GameData {
|
|||
}
|
||||
if (hitValue > 0) {
|
||||
SoundController.playHitSound(
|
||||
hitObject.getEdgeHitSoundType(repeats),
|
||||
hitObject.getSampleSet(repeats),
|
||||
hitObject.getAdditionSampleSet(repeats));
|
||||
|
||||
hitObject.getEdgeHitSoundType(repeat),
|
||||
hitObject.getSampleSet(repeat),
|
||||
hitObject.getAdditionSampleSet(repeat));
|
||||
/**
|
||||
* [SCORE FORMULA]
|
||||
* Score = Hit Value + Hit Value * (Combo * Difficulty * Mod) / 25
|
||||
|
@ -1149,7 +1149,7 @@ public class GameData {
|
|||
if (perfectHit && !Options.isPerfectHitBurstEnabled())
|
||||
; // hide perfect hit results
|
||||
else
|
||||
hitResultList.add(new OsuHitObjectResult(time, result, x, y, color, isSpinner));
|
||||
hitResultList.add(new OsuHitObjectResult(time, result, x, y, color, hitObject.isSpinner()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -89,16 +89,12 @@ public class OsuHitObject {
|
|||
/** Spinner end time (in ms). */
|
||||
private int endTime;
|
||||
|
||||
/** Edge Hit sound type (SOUND_* bitmask). */
|
||||
/** Slider edge hit sound type (SOUND_* bitmask). */
|
||||
private byte[] edgeHitSound;
|
||||
|
||||
/** Edge Hit sound addition (sampleSet, AdditionSampleSet). */
|
||||
/** Slider edge hit sound addition (sampleSet, AdditionSampleSet). */
|
||||
private byte[][] edgeAddition;
|
||||
|
||||
// additional v10+ parameters not implemented...
|
||||
// addition -> sampl:add:cust:vol:hitsound
|
||||
// edge_hitsound, edge_addition (sliders only)
|
||||
|
||||
/** Current index in combo color array. */
|
||||
private int comboIndex;
|
||||
|
||||
|
@ -152,7 +148,7 @@ public class OsuHitObject {
|
|||
* x,y,time,type,hitSound,endTime,addition
|
||||
* 256,192,654,12,0,4029,0:0:0:0:
|
||||
*
|
||||
* NOTE: 'addition' is optional, and defaults to "0:0:0:0:".
|
||||
* NOTE: 'addition' -> sampl:add:cust:vol:hitsound (optional, defaults to "0:0:0:0:")
|
||||
*/
|
||||
String tokens[] = line.split(",");
|
||||
|
||||
|
@ -167,7 +163,7 @@ public class OsuHitObject {
|
|||
if ((type & OsuHitObject.TYPE_CIRCLE) > 0) {
|
||||
if (tokens.length > 5) {
|
||||
String[] additionTokens = tokens[5].split(":");
|
||||
addition = new byte[additionTokens.length];
|
||||
this.addition = new byte[additionTokens.length];
|
||||
for (int j = 0; j < additionTokens.length; j++)
|
||||
this.addition[j] = Byte.parseByte(additionTokens[j]);
|
||||
}
|
||||
|
@ -187,10 +183,9 @@ public class OsuHitObject {
|
|||
if (tokens.length > 8) {
|
||||
String[] edgeHitSoundTokens = tokens[8].split("\\|");
|
||||
this.edgeHitSound = new byte[edgeHitSoundTokens.length];
|
||||
for (int j = 0; j < edgeHitSoundTokens.length; j++) {
|
||||
for (int j = 0; j < edgeHitSoundTokens.length; j++)
|
||||
edgeHitSound[j] = Byte.parseByte(edgeHitSoundTokens[j]);
|
||||
}
|
||||
}
|
||||
if (tokens.length > 9) {
|
||||
String[] edgeAdditionTokens = tokens[9].split("\\|");
|
||||
this.edgeAddition = new byte[edgeAdditionTokens.length][2];
|
||||
|
@ -206,7 +201,7 @@ public class OsuHitObject {
|
|||
if (index != -1)
|
||||
tokens[5] = tokens[5].substring(0, index);
|
||||
this.endTime = Integer.parseInt(tokens[5]);
|
||||
/* 'addition' not implemented. */
|
||||
/* TODO: 'addition' not implemented. */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,7 +242,8 @@ public class OsuHitObject {
|
|||
public byte getEdgeHitSoundType(int i) {
|
||||
if (edgeHitSound != null)
|
||||
return edgeHitSound[i];
|
||||
else return hitSound;
|
||||
else
|
||||
return hitSound;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -340,22 +336,26 @@ public class OsuHitObject {
|
|||
public int getComboSkip() { return (type >> TYPE_NEWCOMBO); }
|
||||
|
||||
/**
|
||||
* Returns the Sample Set at i.
|
||||
* Returns the sample set at the given index.
|
||||
* @param index the index (for sliders, ignored otherwise)
|
||||
* @return the sample set, or 0 if none available
|
||||
*/
|
||||
public byte getSampleSet(int i) {
|
||||
public byte getSampleSet(int index) {
|
||||
if (edgeAddition != null)
|
||||
return edgeAddition[i][0];
|
||||
return edgeAddition[index][0];
|
||||
if (addition != null)
|
||||
return addition[0];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Addition Sample Set at i.
|
||||
* Returns the 'addition' sample set at the given index.
|
||||
* @param index the index (for sliders, ignored otherwise)
|
||||
* @return the sample set, or 0 if none available
|
||||
*/
|
||||
public byte getAdditionSampleSet(int i) {
|
||||
public byte getAdditionSampleSet(int index) {
|
||||
if (edgeAddition != null)
|
||||
return edgeAddition[i][1];
|
||||
return edgeAddition[index][1];
|
||||
if (addition != null)
|
||||
return addition[1];
|
||||
return 0;
|
||||
|
|
|
@ -130,7 +130,7 @@ public enum HitSound implements SoundController.SoundComponent {
|
|||
|
||||
/**
|
||||
* Sets the default sample set to use when playing hit sounds.
|
||||
* @param sampleSet the sample set (0:auto, 1:normal, 2:soft, 3:drum)
|
||||
* @param sampleType the sample set (0:auto, 1:normal, 2:soft, 3:drum)
|
||||
*/
|
||||
public static void setDefaultSampleSet(byte sampleType) {
|
||||
currentDefaultSampleSet = SampleSet.NORMAL;
|
||||
|
@ -141,6 +141,7 @@ public enum HitSound implements SoundController.SoundComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sample set to use when playing hit sounds.
|
||||
* @param sampleType the sample set (0:auto, 1:normal, 2:soft, 3:drum)
|
||||
|
@ -154,6 +155,4 @@ public enum HitSound implements SoundController.SoundComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -251,6 +251,8 @@ public class SoundController {
|
|||
/**
|
||||
* Plays hit sound(s) using an OsuHitObject bitmask.
|
||||
* @param hitSound the hit sound (bitmask)
|
||||
* @param sampleSet the sample set
|
||||
* @param additionSampleSet the 'addition' sample set
|
||||
*/
|
||||
public static void playHitSound(byte hitSound, byte sampleSet, byte additionSampleSet) {
|
||||
if (hitSound < 0)
|
||||
|
|
|
@ -141,7 +141,7 @@ public class Circle implements HitObject {
|
|||
data.hitResult(
|
||||
hitObject.getTime(), result,
|
||||
hitObject.getX(), hitObject.getY(),
|
||||
color, comboEnd, hitObject, 0, false
|
||||
color, comboEnd, hitObject, 0
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
@ -160,17 +160,17 @@ public class Circle implements HitObject {
|
|||
|
||||
if (overlap || trackPosition > time + hitResultOffset[GameData.HIT_50]) {
|
||||
if (isAutoMod) // "auto" mod: catch any missed notes due to lag
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, 0, false);
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, 0);
|
||||
|
||||
else // no more points can be scored, so send a miss
|
||||
data.hitResult(time, GameData.HIT_MISS, x, y, null, comboEnd, hitObject, 0, false);
|
||||
data.hitResult(time, GameData.HIT_MISS, x, y, null, comboEnd, hitObject, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
// "auto" mod: send a perfect hit result
|
||||
else if (isAutoMod) {
|
||||
if (Math.abs(trackPosition - time) < hitResultOffset[GameData.HIT_300]) {
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, 0, false);
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,14 +253,10 @@ public class Slider implements HitObject {
|
|||
if (currentRepeats % 2 == 0) { // last circle
|
||||
float[] lastPos = curve.pointAt(1);
|
||||
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
|
||||
lastPos[0],lastPos[1], color, comboEnd,
|
||||
hitObject, currentRepeats+1
|
||||
, false);
|
||||
lastPos[0], lastPos[1], color, comboEnd, hitObject, currentRepeats + 1);
|
||||
} else { // first circle
|
||||
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
|
||||
hitObject.getX(), hitObject.getY(), color, comboEnd,
|
||||
hitObject, currentRepeats+1
|
||||
, false);
|
||||
hitObject.getX(), hitObject.getY(), color, comboEnd, hitObject, currentRepeats + 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -290,9 +286,7 @@ public class Slider implements HitObject {
|
|||
data.addHitError(hitObject.getTime(), x,y,trackPosition - hitObject.getTime());
|
||||
sliderClickedInitial = true;
|
||||
data.sliderTickResult(hitObject.getTime(), result,
|
||||
hitObject.getX(), hitObject.getY(),
|
||||
hitObject, currentRepeats
|
||||
);
|
||||
hitObject.getX(), hitObject.getY(), hitObject, currentRepeats);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class Spinner implements HitObject {
|
|||
result = GameData.HIT_MISS;
|
||||
|
||||
data.hitResult(hitObject.getEndTime(), result, width / 2, height / 2,
|
||||
Color.transparent, true, hitObject, 0, true);
|
||||
Color.transparent, true, hitObject, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user