Merge pull request #115 from mad-s/master

'Hidden' gamemod
This commit is contained in:
Jeffrey Han 2015-08-08 18:40:37 -05:00
commit 262fa9d4c4
6 changed files with 46 additions and 17 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@
.metadata .metadata
.classpath .classpath
.project .project
.externalToolBuilders/
# IntelliJ # IntelliJ
.idea/ .idea/

View File

@ -48,7 +48,7 @@ public enum GameMod {
"DoubleTime", "Zoooooooooom."), "DoubleTime", "Zoooooooooom."),
// NIGHTCORE (Category.HARD, 2, GameImage.MOD_NIGHTCORE, "NT", 64, Input.KEY_D, 1.12f, // NIGHTCORE (Category.HARD, 2, GameImage.MOD_NIGHTCORE, "NT", 64, Input.KEY_D, 1.12f,
// "Nightcore", "uguuuuuuuu"), // "Nightcore", "uguuuuuuuu"),
HIDDEN (Category.HARD, 3, GameImage.MOD_HIDDEN, "HD", 8, Input.KEY_F, 1.06f, false, HIDDEN (Category.HARD, 3, GameImage.MOD_HIDDEN, "HD", 8, Input.KEY_F, 1.06f,
"Hidden", "Play with no approach circles and fading notes for a slight score advantage."), "Hidden", "Play with no approach circles and fading notes for a slight score advantage."),
FLASHLIGHT (Category.HARD, 4, GameImage.MOD_FLASHLIGHT, "FL", 1024, Input.KEY_G, 1.12f, FLASHLIGHT (Category.HARD, 4, GameImage.MOD_FLASHLIGHT, "FL", 1024, Input.KEY_G, 1.12f,
"Flashlight", "Restricted view area."), "Flashlight", "Restricted view area."),

View File

@ -98,10 +98,16 @@ public class Circle implements GameObject {
float approachScale = 1 + scale * 3; float approachScale = 1 + scale * 3;
float alpha = Utils.clamp(1 - fadeinScale, 0, 1); float alpha = Utils.clamp(1 - fadeinScale, 0, 1);
if (GameMod.HIDDEN.isActive()) {
float fadeOutScale = -(float)(timeDiff-game.getApproachTime())/game.getDecayTime();
float fadeOutAlpha = Utils.clamp(1-fadeOutScale, 0, 1);
alpha = Math.min(alpha, fadeOutAlpha);
}
float oldAlpha = Utils.COLOR_WHITE_FADE.a; float oldAlpha = Utils.COLOR_WHITE_FADE.a;
Utils.COLOR_WHITE_FADE.a = color.a = alpha; Utils.COLOR_WHITE_FADE.a = color.a = alpha;
if (timeDiff >= 0) if (timeDiff >= 0 && !GameMod.HIDDEN.isActive())
GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color); GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color);
GameImage.HITCIRCLE.getImage().drawCentered(x, y, color); GameImage.HITCIRCLE.getImage().drawCentered(x, y, color);
boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber(); boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber();

View File

@ -210,6 +210,11 @@ public class Slider implements GameObject {
tick.drawCentered(c[0], c[1], Utils.COLOR_WHITE_FADE); tick.drawCentered(c[0], c[1], Utils.COLOR_WHITE_FADE);
} }
} }
if (GameMod.HIDDEN.isActive()) {
float fadeOutScale = -(float)(timeDiff-game.getApproachTime())/game.getDecayTime();
float fadeOutAlpha = Utils.clamp(1-fadeOutScale, 0, 1);
alpha = Math.min(alpha, fadeOutAlpha);
}
if (sliderClickedInitial) if (sliderClickedInitial)
; // don't draw current combo number if already clicked ; // don't draw current combo number if already clicked
else else
@ -243,7 +248,8 @@ public class Slider implements GameObject {
if (timeDiff >= 0) { if (timeDiff >= 0) {
// approach circle // approach circle
GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color); if(!GameMod.HIDDEN.isActive())
GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color);
} else { } else {
// Since update() might not have run before drawing during a replay, the // Since update() might not have run before drawing during a replay, the
// slider time may not have been calculated, which causes NAN numbers and flicker. // slider time may not have been calculated, which causes NAN numbers and flicker.
@ -253,16 +259,18 @@ public class Slider implements GameObject {
float[] c = curve.pointAt(getT(trackPosition, false)); float[] c = curve.pointAt(getT(trackPosition, false));
float[] c2 = curve.pointAt(getT(trackPosition, false) + 0.01f); float[] c2 = curve.pointAt(getT(trackPosition, false) + 0.01f);
float t = getT(trackPosition, false); if(!GameMod.HIDDEN.isActive()){
// float dis = hitObject.getPixelLength() * HitObject.getXMultiplier() * (t - (int) t); float t = getT(trackPosition, false);
// Image sliderBallFrame = sliderBallImages[(int) (dis / (diameter * Math.PI) * 30) % sliderBallImages.length]; // float dis = hitObject.getPixelLength() * HitObject.getXMultiplier() * (t - (int) t);
Image sliderBallFrame = sliderBallImages[(int) (t * sliderTime * 60 / 1000) % sliderBallImages.length]; // Image sliderBallFrame = sliderBallImages[(int) (dis / (diameter * Math.PI) * 30) % sliderBallImages.length];
float angle = (float) (Math.atan2(c2[1] - c[1], c2[0] - c[0]) * 180 / Math.PI); Image sliderBallFrame = sliderBallImages[(int) (t * sliderTime * 60 / 1000) % sliderBallImages.length];
sliderBallFrame.setRotation(angle); float angle = (float) (Math.atan2(c2[1] - c[1], c2[0] - c[0]) * 180 / Math.PI);
sliderBallFrame.drawCentered(c[0], c[1]); sliderBallFrame.setRotation(angle);
sliderBallFrame.drawCentered(c[0], c[1]);
}
// follow circle // follow circle
if (followCircleActive) { if (followCircleActive){
GameImage.SLIDER_FOLLOWCIRCLE.getImage().drawCentered(c[0], c[1]); GameImage.SLIDER_FOLLOWCIRCLE.getImage().drawCentered(c[0], c[1]);
// "flashlight" mod: dim the screen // "flashlight" mod: dim the screen
@ -274,6 +282,8 @@ public class Slider implements GameObject {
Utils.COLOR_BLACK_ALPHA.a = oldAlphaBlack; Utils.COLOR_BLACK_ALPHA.a = oldAlphaBlack;
} }
} }
} }
Utils.COLOR_WHITE_FADE.a = oldAlpha; Utils.COLOR_WHITE_FADE.a = oldAlpha;

View File

@ -211,9 +211,11 @@ public class Spinner implements GameObject {
// main spinner elements // main spinner elements
float approachScale = 1 - Utils.clamp(((float) timeDiff / (hitObject.getTime() - hitObject.getEndTime())), 0f, 1f); float approachScale = 1 - Utils.clamp(((float) timeDiff / (hitObject.getTime() - hitObject.getEndTime())), 0f, 1f);
GameImage.SPINNER_CIRCLE.getImage().setAlpha(alpha); if(!GameMod.HIDDEN.isActive()){
GameImage.SPINNER_CIRCLE.getImage().setRotation(drawRotation * 360f); GameImage.SPINNER_CIRCLE.getImage().setAlpha(alpha);
GameImage.SPINNER_CIRCLE.getImage().drawCentered(width / 2, height / 2); GameImage.SPINNER_CIRCLE.getImage().setRotation(drawRotation * 360f);
GameImage.SPINNER_CIRCLE.getImage().drawCentered(width / 2, height / 2);
}
Image approachCircleScaled = GameImage.SPINNER_APPROACHCIRCLE.getImage().getScaledCopy(approachScale); Image approachCircleScaled = GameImage.SPINNER_APPROACHCIRCLE.getImage().getScaledCopy(approachScale);
approachCircleScaled.setAlpha(alpha); approachCircleScaled.setAlpha(alpha);
approachCircleScaled.drawCentered(width / 2, height / 2); approachCircleScaled.drawCentered(width / 2, height / 2);

View File

@ -117,6 +117,10 @@ public class Game extends BasicGameState {
/** Hit object approach time, in milliseconds. */ /** Hit object approach time, in milliseconds. */
private int approachTime; private int approachTime;
/** Decay of elements in hidden mod, in milliseconds. */
//TODO: figure out actual formula for decay time
private int decayTime = 800;
/** Time offsets for obtaining each hit result (indexed by HIT_* constants). */ /** Time offsets for obtaining each hit result (indexed by HIT_* constants). */
private int[] hitResultOffset; private int[] hitResultOffset;
@ -1515,6 +1519,12 @@ public class Game extends BasicGameState {
*/ */
public int getApproachTime() { return approachTime; } public int getApproachTime() { return approachTime; }
/**
* Returns the object decay time in hidden mod, in milliseconds.
*/
public int getDecayTime() { return decayTime; }
/** /**
* Returns an array of hit result offset times, in milliseconds (indexed by GameData.HIT_* constants). * Returns an array of hit result offset times, in milliseconds (indexed by GameData.HIT_* constants).
*/ */