Added initial sound effect support.

- Added SoundController module, which uses Java Sound since OpenAL has a slight delay on playing sounds.
- Uploaded all effect WAVs. (credits: WWWskin, AL's IA, Fantasy's Skin, Minimalist Miku)
- Added a missing entry in credits.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2014-07-01 01:14:03 -04:00
parent 60eaa42997
commit 0604a25822
54 changed files with 500 additions and 61 deletions

View File

@@ -172,7 +172,9 @@ public class Circle {
if (distance < circleRadius) {
int result = hitResult(hitObject.time);
if (result > -1) {
score.hitResult(hitObject.time, result, hitObject.x, hitObject.y, color, comboEnd);
score.hitResult(hitObject.time, result, hitObject.x, hitObject.y,
color, comboEnd, hitObject.hitSound
);
return true;
}
}
@@ -192,11 +194,11 @@ public class Circle {
if (overlap || trackPosition > hitObject.time + hitResultOffset[GameScore.HIT_50]) {
if (isAutoMod) // "auto" mod: catch any missed notes due to lag
score.hitResult(hitObject.time, GameScore.HIT_300,
hitObject.x, hitObject.y, color, comboEnd);
hitObject.x, hitObject.y, color, comboEnd, hitObject.hitSound);
else // no more points can be scored, so send a miss
score.hitResult(hitObject.time, GameScore.HIT_MISS,
hitObject.x, hitObject.y, null, comboEnd);
hitObject.x, hitObject.y, null, comboEnd, hitObject.hitSound);
return true;
}
@@ -204,7 +206,7 @@ public class Circle {
else if (isAutoMod) {
if (Math.abs(trackPosition - hitObject.time) < hitResultOffset[GameScore.HIT_300]) {
score.hitResult(hitObject.time, GameScore.HIT_300,
hitObject.x, hitObject.y, color, comboEnd);
hitObject.x, hitObject.y, color, comboEnd, hitObject.hitSound);
return true;
}
}

View File

@@ -384,10 +384,11 @@ public class Slider {
if (currentRepeats % 2 == 0) // last circle
score.hitResult(hitObject.time + (int) sliderTimeTotal, result,
hitObject.sliderX[lastIndex], hitObject.sliderY[lastIndex], color, comboEnd);
hitObject.sliderX[lastIndex], hitObject.sliderY[lastIndex],
color, comboEnd, hitObject.hitSound);
else // first circle
score.hitResult(hitObject.time + (int) sliderTimeTotal, result,
hitObject.x, hitObject.y, color, comboEnd);
hitObject.x, hitObject.y, color, comboEnd, hitObject.hitSound);
return result;
}
@@ -420,7 +421,8 @@ public class Slider {
if (result > -1) {
sliderClicked = true;
score.sliderTickResult(hitObject.time, result, hitObject.x, hitObject.y);
score.sliderTickResult(hitObject.time, result,
hitObject.x, hitObject.y, hitObject.hitSound);
return true;
}
}
@@ -465,9 +467,11 @@ public class Slider {
sliderClicked = true;
if (isAutoMod) { // "auto" mod: catch any missed notes due to lag
ticksHit++;
score.sliderTickResult(hitObject.time, GameScore.HIT_SLIDER30, hitObject.x, hitObject.y);
score.sliderTickResult(hitObject.time, GameScore.HIT_SLIDER30,
hitObject.x, hitObject.y, hitObject.hitSound);
} else
score.sliderTickResult(hitObject.time, GameScore.HIT_MISS, hitObject.x, hitObject.y);
score.sliderTickResult(hitObject.time, GameScore.HIT_MISS,
hitObject.x, hitObject.y, hitObject.hitSound);
}
// "auto" mod: send a perfect hit result
@@ -475,7 +479,8 @@ public class Slider {
if (Math.abs(trackPosition - hitObject.time) < hitResultOffset[GameScore.HIT_300]) {
ticksHit++;
sliderClicked = true;
score.sliderTickResult(hitObject.time, GameScore.HIT_SLIDER30, hitObject.x, hitObject.y);
score.sliderTickResult(hitObject.time, GameScore.HIT_SLIDER30,
hitObject.x, hitObject.y, hitObject.hitSound);
}
}
}
@@ -540,24 +545,26 @@ public class Slider {
ticksHit++;
if (currentRepeats % 2 > 0) // last circle
score.sliderTickResult(trackPosition, GameScore.HIT_SLIDER30,
hitObject.sliderX[lastIndex], hitObject.sliderY[lastIndex]);
hitObject.sliderX[lastIndex], hitObject.sliderY[lastIndex],
hitObject.hitSound);
else // first circle
score.sliderTickResult(trackPosition, GameScore.HIT_SLIDER30,
c[0], c[1]);
c[0], c[1], hitObject.hitSound);
}
// held during new tick
if (isNewTick) {
ticksHit++;
score.sliderTickResult(trackPosition, GameScore.HIT_SLIDER10, c[0], c[1]);
score.sliderTickResult(trackPosition, GameScore.HIT_SLIDER10,
c[0], c[1], (byte) -1);
}
} else {
followCircleActive = false;
if (isNewRepeat)
score.sliderTickResult(trackPosition, GameScore.HIT_MISS, 0, 0);
score.sliderTickResult(trackPosition, GameScore.HIT_MISS, 0, 0, hitObject.hitSound);
if (isNewTick)
score.sliderTickResult(trackPosition, GameScore.HIT_MISS, 0, 0);
score.sliderTickResult(trackPosition, GameScore.HIT_MISS, 0, 0, (byte) -1);
}
return false;

View File

@@ -21,6 +21,7 @@ package itdelatrisu.opsu.objects;
import itdelatrisu.opsu.GameScore;
import itdelatrisu.opsu.MusicController;
import itdelatrisu.opsu.OsuHitObject;
import itdelatrisu.opsu.SoundController;
import itdelatrisu.opsu.states.Game;
import itdelatrisu.opsu.states.Options;
@@ -163,16 +164,19 @@ public class Spinner {
int result;
float ratio = rotations / rotationsNeeded;
if (ratio >= 1.0f ||
Options.isModActive(Options.MOD_AUTO) || Options.isModActive(Options.MOD_SPUN_OUT))
Options.isModActive(Options.MOD_AUTO) ||
Options.isModActive(Options.MOD_SPUN_OUT)) {
result = GameScore.HIT_300;
else if (ratio >= 0.8f)
SoundController.playSound(SoundController.SOUND_SPINNEROSU);
} else if (ratio >= 0.8f)
result = GameScore.HIT_100;
else if (ratio >= 0.5f)
result = GameScore.HIT_50;
else
result = GameScore.HIT_MISS;
score.hitResult(hitObject.endTime, result, width / 2, height / 2, Color.transparent, true);
score.hitResult(hitObject.endTime, result, width / 2, height / 2,
Color.transparent, true, (byte) -1);
return result;
}
@@ -240,10 +244,13 @@ public class Spinner {
// added one whole rotation...
if (Math.floor(newRotations) > rotations) {
if (newRotations > rotationsNeeded) // extra rotations
if (newRotations > rotationsNeeded) { // extra rotations
score.changeScore(1000);
else
SoundController.playSound(SoundController.SOUND_SPINNERBONUS);
} else {
score.changeScore(100);
SoundController.playSound(SoundController.SOUND_SPINNERSPIN);
}
}
rotations = newRotations;