Comment format changes.
- Collapsed Javadoc comments for all fields. - OsuFile now has proper Javadoc comments. - Fixed various mistakes with comments. Some changes with enums: - Changed Class.values() calls to values(). - Changed size() calls to a SIZE field. - Changed valuesReversed() calls to a VALUES_REVERSED field. - Removed 'static' from enum declarations. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
d6c7476b88
commit
c9e14bfc70
|
@ -29,14 +29,12 @@ import org.newdawn.slick.opengl.InternalTextureLoader;
|
|||
* AppGameContainer extension that sends critical errors to ErrorHandler.
|
||||
*/
|
||||
public class Container extends AppGameContainer {
|
||||
/**
|
||||
* SlickException causing game failure.
|
||||
*/
|
||||
/** SlickException causing game failure. */
|
||||
protected SlickException e = null;
|
||||
|
||||
/**
|
||||
* Create a new container wrapping a game
|
||||
*
|
||||
*
|
||||
* @param game The game to be wrapped
|
||||
* @throws SlickException Indicates a failure to initialise the display
|
||||
*/
|
||||
|
@ -46,7 +44,7 @@ public class Container extends AppGameContainer {
|
|||
|
||||
/**
|
||||
* Create a new container wrapping a game
|
||||
*
|
||||
*
|
||||
* @param game The game to be wrapped
|
||||
* @param width The width of the display required
|
||||
* @param height The height of the display required
|
||||
|
|
|
@ -34,28 +34,20 @@ import org.newdawn.slick.util.Log;
|
|||
* Error handler to log and display errors.
|
||||
*/
|
||||
public class ErrorHandler {
|
||||
/**
|
||||
* Error popup title.
|
||||
*/
|
||||
/** Error popup title. */
|
||||
private static final String title = "Error";
|
||||
|
||||
/**
|
||||
* Error popup description text.
|
||||
*/
|
||||
/** Error popup description text. */
|
||||
private static final String
|
||||
desc = "opsu! has encountered an error.",
|
||||
desc = "opsu! has encountered an error.",
|
||||
descR = "opsu! has encountered an error. Please report this!";
|
||||
|
||||
/**
|
||||
* Error popup button options.
|
||||
*/
|
||||
/** Error popup button options. */
|
||||
private static final String[]
|
||||
options = {"View Error Log", "Close"},
|
||||
options = {"View Error Log", "Close"},
|
||||
optionsR = {"Send Report", "View Error Log", "Close"};
|
||||
|
||||
/**
|
||||
* Text area for Exception.
|
||||
*/
|
||||
/** Text area for Exception. */
|
||||
private static final JTextArea textArea = new JTextArea(7, 30);
|
||||
static {
|
||||
textArea.setEditable(false);
|
||||
|
@ -65,16 +57,12 @@ public class ErrorHandler {
|
|||
textArea.setLineWrap(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll pane holding JTextArea.
|
||||
*/
|
||||
/** Scroll pane holding JTextArea. */
|
||||
private static final JScrollPane scroll = new JScrollPane(textArea);
|
||||
|
||||
/**
|
||||
* Error popup objects.
|
||||
*/
|
||||
/** Error popup objects. */
|
||||
private static final Object[]
|
||||
message = { desc, scroll },
|
||||
message = { desc, scroll },
|
||||
messageR = { descR, scroll };
|
||||
|
||||
// This class should not be instantiated.
|
||||
|
|
|
@ -400,26 +400,18 @@ public enum GameImage {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Image file types.
|
||||
*/
|
||||
/** Image file types. */
|
||||
private static final byte
|
||||
IMG_PNG = 1,
|
||||
IMG_JPG = 2;
|
||||
|
||||
/**
|
||||
* The file name.
|
||||
*/
|
||||
/** The file name. */
|
||||
private String filename;
|
||||
|
||||
/**
|
||||
* The formatted file name string (for loading multiple images).
|
||||
*/
|
||||
/** The formatted file name string (for loading multiple images). */
|
||||
private String filenameFormat;
|
||||
|
||||
/**
|
||||
* Image file type.
|
||||
*/
|
||||
/** Image file type. */
|
||||
private byte type;
|
||||
|
||||
/**
|
||||
|
@ -428,39 +420,25 @@ public enum GameImage {
|
|||
*/
|
||||
private boolean skinnable;
|
||||
|
||||
/**
|
||||
* Whether or not to preload the image when the program starts.
|
||||
*/
|
||||
/** Whether or not to preload the image when the program starts. */
|
||||
private boolean preload;
|
||||
|
||||
/**
|
||||
* The default image.
|
||||
*/
|
||||
/** The default image. */
|
||||
private Image defaultImage;
|
||||
|
||||
/**
|
||||
* The default image array.
|
||||
*/
|
||||
/** The default image array. */
|
||||
private Image[] defaultImages;
|
||||
|
||||
/**
|
||||
* The beatmap skin image (optional, temporary).
|
||||
*/
|
||||
/** The beatmap skin image (optional, temporary). */
|
||||
private Image skinImage;
|
||||
|
||||
/**
|
||||
* The beatmap skin image array (optional, temporary).
|
||||
*/
|
||||
/** The beatmap skin image array (optional, temporary). */
|
||||
private Image[] skinImages;
|
||||
|
||||
/**
|
||||
* Container dimensions.
|
||||
*/
|
||||
/** Container dimensions. */
|
||||
private static int containerWidth, containerHeight;
|
||||
|
||||
/**
|
||||
* Whether a skin image has been loaded.
|
||||
*/
|
||||
/** Whether a skin image has been loaded. */
|
||||
private static boolean skinImageLoaded = false;
|
||||
|
||||
/**
|
||||
|
@ -641,7 +619,7 @@ public enum GameImage {
|
|||
try {
|
||||
// try loading the image
|
||||
Image img = new Image(name);
|
||||
|
||||
|
||||
// image successfully loaded
|
||||
list.add(img);
|
||||
loaded = true;
|
||||
|
@ -706,7 +684,7 @@ public enum GameImage {
|
|||
try {
|
||||
// try loading the image
|
||||
Image img = new Image(file.getAbsolutePath());
|
||||
|
||||
|
||||
// image successfully loaded
|
||||
list.add(img);
|
||||
loaded = true;
|
||||
|
|
|
@ -39,55 +39,32 @@ public enum GameMod {
|
|||
// HIDDEN (, GameImage.MOD_HIDDEN, Input.KEY_F, 1.06f),
|
||||
// FLASHLIGHT (, GameImage.MOD_FLASHLIGHT, Input.KEY_G, 1.12f);
|
||||
|
||||
/**
|
||||
* The ID of the mod (used for positioning).
|
||||
*/
|
||||
/** The ID of the mod (used for positioning). */
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* The file name of the mod image.
|
||||
*/
|
||||
/** The file name of the mod image. */
|
||||
private GameImage image;
|
||||
|
||||
/**
|
||||
* The shortcut key associated with the mod.
|
||||
*/
|
||||
/** The shortcut key associated with the mod. */
|
||||
private int key;
|
||||
|
||||
/**
|
||||
* Score multiplier.
|
||||
*/
|
||||
/** The score multiplier. */
|
||||
private float multiplier;
|
||||
|
||||
/**
|
||||
* Whether or not this mod is active.
|
||||
*/
|
||||
/** Whether or not this mod is active. */
|
||||
private boolean active = false;
|
||||
|
||||
/**
|
||||
* The button containing the mod image (displayed in OptionsMenu screen).
|
||||
*/
|
||||
/** The button containing the mod image (displayed in OptionsMenu screen). */
|
||||
private MenuButton button;
|
||||
|
||||
/**
|
||||
* Total number of mods.
|
||||
*/
|
||||
private static final int SIZE = GameMod.values().length;
|
||||
/** Total number of mods. */
|
||||
public static final int SIZE = values().length;
|
||||
|
||||
/**
|
||||
* Returns the total number of game mods.
|
||||
* @return the number of mods
|
||||
*/
|
||||
public static int size() { return SIZE; }
|
||||
|
||||
/**
|
||||
* Returns an array of GameMod objects in reverse order.
|
||||
* @return all game mods in reverse order
|
||||
*/
|
||||
public static GameMod[] valuesReversed() {
|
||||
GameMod[] mods = GameMod.values();
|
||||
Collections.reverse(Arrays.asList(mods));
|
||||
return mods;
|
||||
/** Array of GameMod objects in reverse order. */
|
||||
public static final GameMod[] VALUES_REVERSED;
|
||||
static {
|
||||
VALUES_REVERSED = values();
|
||||
Collections.reverse(Arrays.asList(VALUES_REVERSED));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,9 +36,7 @@ import org.newdawn.slick.Image;
|
|||
* Holds score data and renders all score-related elements.
|
||||
*/
|
||||
public class GameScore {
|
||||
/**
|
||||
* Letter grades.
|
||||
*/
|
||||
/** Letter grades. */
|
||||
public static final int
|
||||
GRADE_SS = 0,
|
||||
GRADE_SSH = 1, // silver
|
||||
|
@ -50,14 +48,10 @@ public class GameScore {
|
|||
GRADE_D = 7,
|
||||
GRADE_MAX = 8; // not a grade
|
||||
|
||||
/**
|
||||
* Delta multiplier for steady HP drain.
|
||||
*/
|
||||
/** Delta multiplier for steady HP drain. */
|
||||
public static final float HP_DRAIN_MULTIPLIER = 1 / 200f;
|
||||
|
||||
/**
|
||||
* Hit result types.
|
||||
*/
|
||||
/** Hit result types. */
|
||||
public static final int
|
||||
HIT_MISS = 0,
|
||||
HIT_50 = 1,
|
||||
|
@ -70,34 +64,22 @@ public class GameScore {
|
|||
HIT_SLIDER30 = 8,
|
||||
HIT_MAX = 9; // not a hit result
|
||||
|
||||
/**
|
||||
* Hit result-related images (indexed by HIT_* constants).
|
||||
*/
|
||||
/** Hit result-related images (indexed by HIT_* constants). */
|
||||
private Image[] hitResults;
|
||||
|
||||
/**
|
||||
* Counts of each hit result so far.
|
||||
*/
|
||||
/** Counts of each hit result so far. */
|
||||
private int[] hitResultCount;
|
||||
|
||||
/**
|
||||
* Total number of hit objects so far, not including Katu/Geki (for calculating grade).
|
||||
*/
|
||||
/** Total number of hit objects so far, not including Katu/Geki (for calculating grade). */
|
||||
private int objectCount;
|
||||
|
||||
/**
|
||||
* Total objects including slider hits/ticks (for determining Full Combo status).
|
||||
*/
|
||||
/** Total objects including slider hits/ticks (for determining Full Combo status). */
|
||||
private int fullObjectCount;
|
||||
|
||||
/**
|
||||
* The current combo streak.
|
||||
*/
|
||||
/** The current combo streak. */
|
||||
private int combo;
|
||||
|
||||
/**
|
||||
* The max combo streak obtained.
|
||||
*/
|
||||
/** The max combo streak obtained. */
|
||||
private int comboMax;
|
||||
|
||||
/**
|
||||
|
@ -109,40 +91,39 @@ public class GameScore {
|
|||
*/
|
||||
private byte comboEnd;
|
||||
|
||||
/**
|
||||
* Combo burst images.
|
||||
*/
|
||||
/** Combo burst images. */
|
||||
private Image[] comboBurstImages;
|
||||
|
||||
/**
|
||||
* Index of the current combo burst image.
|
||||
*/
|
||||
/** Index of the current combo burst image. */
|
||||
private int comboBurstIndex;
|
||||
|
||||
/**
|
||||
* Alpha level of the current combo burst image (for fade out).
|
||||
*/
|
||||
/** Alpha level of the current combo burst image (for fade out). */
|
||||
private float comboBurstAlpha;
|
||||
|
||||
/**
|
||||
* Current x coordinate of the combo burst image (for sliding animation).
|
||||
*/
|
||||
/** Current x coordinate of the combo burst image (for sliding animation). */
|
||||
private int comboBurstX;
|
||||
|
||||
/**
|
||||
* List of hit result objects associated with hit objects.
|
||||
*/
|
||||
/** List of hit result objects associated with hit objects. */
|
||||
private LinkedList<OsuHitObjectResult> hitResultList;
|
||||
|
||||
/**
|
||||
* Hit result helper class.
|
||||
*/
|
||||
private class OsuHitObjectResult {
|
||||
public int time; // object start time
|
||||
public int result; // hit result
|
||||
public float x, y; // object coordinates
|
||||
public Color color; // combo color
|
||||
public float alpha = 1f; // alpha level (for fade out)
|
||||
/** Object start time. */
|
||||
public int time;
|
||||
|
||||
/** Hit result. */
|
||||
public int result;
|
||||
|
||||
/** Object coordinates. */
|
||||
public float x, y;
|
||||
|
||||
/** Combo color. */
|
||||
public Color color;
|
||||
|
||||
/** Alpha level (for fading out). */
|
||||
public float alpha = 1f;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -161,54 +142,34 @@ public class GameScore {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Current game score.
|
||||
*/
|
||||
/** Current game score. */
|
||||
private long score;
|
||||
|
||||
/**
|
||||
* Displayed game score (for animation, slightly behind score).
|
||||
*/
|
||||
/** Displayed game score (for animation, slightly behind score). */
|
||||
private long scoreDisplay;
|
||||
|
||||
/**
|
||||
* Current health bar percentage.
|
||||
*/
|
||||
/** Current health bar percentage. */
|
||||
private float health;
|
||||
|
||||
/**
|
||||
* Displayed health (for animation, slightly behind health).
|
||||
*/
|
||||
/** Displayed health (for animation, slightly behind health). */
|
||||
private float healthDisplay;
|
||||
|
||||
/**
|
||||
* Beatmap HPDrainRate value. (0:easy ~ 10:hard)
|
||||
*/
|
||||
/** Beatmap HPDrainRate value. (0:easy ~ 10:hard) */
|
||||
private float drainRate = 5f;
|
||||
|
||||
/**
|
||||
* Beatmap OverallDifficulty value. (0:easy ~ 10:hard)
|
||||
*/
|
||||
/** Beatmap OverallDifficulty value. (0:easy ~ 10:hard) */
|
||||
private float difficulty = 5f;
|
||||
|
||||
/**
|
||||
* Default text symbol images.
|
||||
*/
|
||||
/** Default text symbol images. */
|
||||
private Image[] defaultSymbols;
|
||||
|
||||
/**
|
||||
* Score text symbol images.
|
||||
*/
|
||||
/** Score text symbol images. */
|
||||
private HashMap<Character, Image> scoreSymbols;
|
||||
|
||||
/**
|
||||
* Letter grade images (large and small sizes).
|
||||
*/
|
||||
/** Letter grade images (large and small sizes). */
|
||||
private Image[] gradesLarge, gradesSmall;
|
||||
|
||||
/**
|
||||
* Container dimensions.
|
||||
*/
|
||||
/** Container dimensions. */
|
||||
private int width, height;
|
||||
|
||||
/**
|
||||
|
@ -440,7 +401,7 @@ public class GameScore {
|
|||
int modWidth = GameMod.AUTO.getImage().getWidth();
|
||||
float modX = (width * 0.98f) - modWidth;
|
||||
int modCount = 0;
|
||||
for (GameMod mod : GameMod.valuesReversed()) {
|
||||
for (GameMod mod : GameMod.VALUES_REVERSED) {
|
||||
if (mod.isActive()) {
|
||||
mod.getImage().draw(
|
||||
modX - (modCount * (modWidth / 2f)),
|
||||
|
|
|
@ -28,50 +28,35 @@ import org.newdawn.slick.Image;
|
|||
* Multi-part images and animations currently do not support hover updates.
|
||||
*/
|
||||
public class MenuButton {
|
||||
/**
|
||||
* The image associated with the button.
|
||||
*/
|
||||
/** The image associated with the button. */
|
||||
private Image img;
|
||||
|
||||
/**
|
||||
* The left and right parts of the button (optional).
|
||||
*/
|
||||
/** The left and right parts of the button (optional). */
|
||||
private Image imgL, imgR;
|
||||
|
||||
/**
|
||||
* The animation associated with the button.
|
||||
*/
|
||||
/** The animation associated with the button. */
|
||||
private Animation anim;
|
||||
|
||||
/**
|
||||
* The center coordinates.
|
||||
*/
|
||||
/** The center coordinates. */
|
||||
private float x, y;
|
||||
|
||||
/**
|
||||
* The x and y radius of the button (scaled).
|
||||
*/
|
||||
/** The x and y radius of the button (scaled). */
|
||||
private float xRadius, yRadius;
|
||||
|
||||
/**
|
||||
* The current and max scale of the button (for hovering).
|
||||
*/
|
||||
/** The current and max scale of the button (for hovering). */
|
||||
private float scale, hoverScale = 1.25f;
|
||||
|
||||
/**
|
||||
* The scaled expansion direction for the botton (for hovering).
|
||||
*/
|
||||
/** The scaled expansion direction for the button (for hovering). */
|
||||
private Expand dir = Expand.CENTER;
|
||||
|
||||
/**
|
||||
* Scaled expansion directions (for hovering).
|
||||
*/
|
||||
public enum Expand {
|
||||
CENTER, UP_RIGHT, UP_LEFT, DOWN_RIGHT, DOWN_LEFT;
|
||||
}
|
||||
/** Scaled expansion directions (for hovering). */
|
||||
public enum Expand { CENTER, UP_RIGHT, UP_LEFT, DOWN_RIGHT, DOWN_LEFT; }
|
||||
|
||||
/**
|
||||
* Creates a new button from an Image.
|
||||
* @param img the image
|
||||
* @param x the center x coordinate
|
||||
* @param y the center y coordinate
|
||||
*/
|
||||
public MenuButton(Image img, float x, float y) {
|
||||
this.img = img;
|
||||
|
@ -84,9 +69,13 @@ public class MenuButton {
|
|||
|
||||
/**
|
||||
* Creates a new button from a 3-part Image.
|
||||
* @param imgCenter the center image
|
||||
* @param imgLeft the left image
|
||||
* @param imgRight the right image
|
||||
* @param x the center x coordinate
|
||||
* @param y the center y coordinate
|
||||
*/
|
||||
public MenuButton(Image imgCenter, Image imgLeft, Image imgRight,
|
||||
float x, float y) {
|
||||
public MenuButton(Image imgCenter, Image imgLeft, Image imgRight, float x, float y) {
|
||||
this.img = imgCenter;
|
||||
this.imgL = imgLeft;
|
||||
this.imgR = imgRight;
|
||||
|
@ -99,6 +88,9 @@ public class MenuButton {
|
|||
|
||||
/**
|
||||
* Creates a new button from an Animation.
|
||||
* @param anim the animation
|
||||
* @param x the center x coordinate
|
||||
* @param y the center y coordinate
|
||||
*/
|
||||
public MenuButton(Animation anim, float x, float y) {
|
||||
this.anim = anim;
|
||||
|
@ -110,17 +102,33 @@ public class MenuButton {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets/returns new center coordinates.
|
||||
* Sets a new center x coordinate.
|
||||
*/
|
||||
public void setX(float x) { this.x = x; }
|
||||
|
||||
/**
|
||||
* Sets a new center y coordinate.
|
||||
*/
|
||||
public void setY(float y) { this.y = y; }
|
||||
|
||||
/**
|
||||
* Returns the center x coordinate.
|
||||
*/
|
||||
public float getX() { return x; }
|
||||
|
||||
/**
|
||||
* Returns the center y coordinate.
|
||||
*/
|
||||
public float getY() { return y; }
|
||||
|
||||
/**
|
||||
* Returns the associated image or animation.
|
||||
* Returns the associated image.
|
||||
*/
|
||||
public Image getImage() { return img; }
|
||||
|
||||
/**
|
||||
* Returns the associated animation.
|
||||
*/
|
||||
public Animation getAnimation() { return anim; }
|
||||
|
||||
/**
|
||||
|
@ -181,17 +189,13 @@ public class MenuButton {
|
|||
* Sets the maximum scale factor for the button (for hovering).
|
||||
* @param scale the maximum scale factor (default 1.25f)
|
||||
*/
|
||||
public void setHoverScale(float scale) {
|
||||
this.hoverScale = scale;
|
||||
}
|
||||
public void setHoverScale(float scale) { this.hoverScale = scale; }
|
||||
|
||||
/**
|
||||
* Sets the expansion direction when hovering over the button.
|
||||
* @param dir the direction
|
||||
*/
|
||||
public void setHoverDir(Expand dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
public void setHoverDir(Expand dir) { this.dir = dir; }
|
||||
|
||||
/**
|
||||
* Updates the scale of the button depending on whether or not the cursor
|
||||
|
|
|
@ -52,9 +52,7 @@ import org.newdawn.slick.util.ResourceLoader;
|
|||
* Creates game container, adds all other states, and initializes song data.
|
||||
*/
|
||||
public class Opsu extends StateBasedGame {
|
||||
/**
|
||||
* Game states.
|
||||
*/
|
||||
/** Game states. */
|
||||
public static final int
|
||||
STATE_SPLASH = 0,
|
||||
STATE_MAINMENU = 1,
|
||||
|
@ -65,11 +63,13 @@ public class Opsu extends StateBasedGame {
|
|||
STATE_GAMERANKING = 6,
|
||||
STATE_OPTIONSMENU = 7;
|
||||
|
||||
/**
|
||||
* Used to restrict the program to a single instance.
|
||||
*/
|
||||
/** Server socket for restricting the program to a single instance. */
|
||||
private static ServerSocket SERVER_SOCKET;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param name the program name
|
||||
*/
|
||||
public Opsu(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
|
@ -42,43 +42,29 @@ import org.newdawn.slick.util.Log;
|
|||
* Handles all user options.
|
||||
*/
|
||||
public class Options {
|
||||
/**
|
||||
* Temporary folder for file conversions, auto-deleted upon successful exit.
|
||||
*/
|
||||
/** Temporary folder for file conversions, auto-deleted upon successful exit. */
|
||||
public static final File TMP_DIR = new File(".opsu_tmp/");
|
||||
|
||||
/**
|
||||
* File for logging errors.
|
||||
*/
|
||||
/** File for logging errors. */
|
||||
public static final File LOG_FILE = new File(".opsu.log");
|
||||
|
||||
/**
|
||||
* File for storing user options.
|
||||
*/
|
||||
/** File for storing user options. */
|
||||
private static final File OPTIONS_FILE = new File(".opsu.cfg");
|
||||
|
||||
/**
|
||||
* Beatmap directories (where to search for files).
|
||||
*/
|
||||
/** Beatmap directories (where to search for files). */
|
||||
private static final String[] BEATMAP_DIRS = {
|
||||
"C:/Program Files (x86)/osu!/Songs/",
|
||||
"C:/Program Files/osu!/Songs/",
|
||||
"Songs/"
|
||||
};
|
||||
|
||||
/**
|
||||
* Font file name.
|
||||
*/
|
||||
/** Font file name. */
|
||||
public static final String FONT_NAME = "kochi-gothic.ttf";
|
||||
|
||||
/**
|
||||
* Repository address.
|
||||
*/
|
||||
/** Repository address. */
|
||||
public static URI REPOSITORY_URI;
|
||||
|
||||
/**
|
||||
* Issue reporting address.
|
||||
*/
|
||||
/** Issue reporting address. */
|
||||
public static URI ISSUES_URI;
|
||||
|
||||
static {
|
||||
|
@ -90,36 +76,26 @@ public class Options {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The beatmap directory.
|
||||
*/
|
||||
/** The beatmap directory. */
|
||||
private static File beatmapDir;
|
||||
|
||||
/**
|
||||
* The OSZ archive directory.
|
||||
*/
|
||||
/** The OSZ archive directory. */
|
||||
private static File oszDir;
|
||||
|
||||
/**
|
||||
* The screenshot directory (created when needed).
|
||||
*/
|
||||
/** The screenshot directory (created when needed). */
|
||||
private static File screenshotDir;
|
||||
|
||||
/**
|
||||
* The current skin directory (for user skins).
|
||||
*/
|
||||
/** The current skin directory (for user skins). */
|
||||
private static File skinDir;
|
||||
|
||||
/**
|
||||
* The theme song string:
|
||||
* filename, title, artist, length (ms)
|
||||
* {@code filename,title,artist,length(ms)}
|
||||
*/
|
||||
private static String themeString = "theme.ogg,welcome to osu!,nekodex,48000";
|
||||
|
||||
/**
|
||||
* Game options.
|
||||
*/
|
||||
public static enum GameOption {
|
||||
/** Game options. */
|
||||
public enum GameOption {
|
||||
NULL (null, null),
|
||||
SCREEN_RESOLUTION ("Screen Resolution", "Restart (Ctrl+Shift+F5) to apply resolution changes.") {
|
||||
@Override
|
||||
|
@ -359,14 +335,10 @@ public class Options {
|
|||
public void click(GameContainer container) { themeSongEnabled = !themeSongEnabled; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Option name.
|
||||
*/
|
||||
/** Option name. */
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Option description.
|
||||
*/
|
||||
/** Option description. */
|
||||
private String description;
|
||||
|
||||
/**
|
||||
|
@ -411,9 +383,7 @@ public class Options {
|
|||
public void drag(GameContainer container, int d) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Screen resolutions.
|
||||
*/
|
||||
/** Screen resolutions. */
|
||||
private enum Resolution {
|
||||
RES_800_600 (800, 600),
|
||||
RES_1024_600 (1024, 600),
|
||||
|
@ -429,14 +399,10 @@ public class Options {
|
|||
RES_2560_1440 (2560, 1440),
|
||||
RES_2560_1600 (2560, 1600);
|
||||
|
||||
/**
|
||||
* Screen dimensions.
|
||||
*/
|
||||
/** Screen dimensions. */
|
||||
private int width, height;
|
||||
|
||||
/**
|
||||
* Enum values.
|
||||
*/
|
||||
/** Enum values. */
|
||||
private static Resolution[] values = Resolution.values();
|
||||
|
||||
/**
|
||||
|
@ -468,131 +434,81 @@ public class Options {
|
|||
public String toString() { return String.format("%sx%s", width, height); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Index (row) in resolutions[][] array.
|
||||
*/
|
||||
/** Current screen resolution. */
|
||||
private static Resolution resolution = Resolution.RES_1024_768;
|
||||
|
||||
// /**
|
||||
// * Whether or not the game should run in fullscreen mode.
|
||||
// */
|
||||
// /** Whether or not the game should run in fullscreen mode. */
|
||||
// private static boolean fullscreen = false;
|
||||
|
||||
/**
|
||||
* Frame limiters.
|
||||
*/
|
||||
/** Frame limiters. */
|
||||
private static final int[] targetFPS = { 60, 120, 240 };
|
||||
|
||||
/**
|
||||
* Index in targetFPS[] array.
|
||||
*/
|
||||
/** Index in targetFPS[] array. */
|
||||
private static int targetFPSindex = 0;
|
||||
|
||||
/**
|
||||
* Whether or not to show the FPS.
|
||||
*/
|
||||
/** Whether or not to show the FPS. */
|
||||
private static boolean showFPS = false;
|
||||
|
||||
/**
|
||||
* Whether or not to show hit lighting effects.
|
||||
*/
|
||||
/** Whether or not to show hit lighting effects. */
|
||||
private static boolean showHitLighting = true;
|
||||
|
||||
/**
|
||||
* Whether or not to show combo burst images.
|
||||
*/
|
||||
/** Whether or not to show combo burst images. */
|
||||
private static boolean showComboBursts = true;
|
||||
|
||||
/**
|
||||
* Global volume level.
|
||||
*/
|
||||
/** Global volume level. */
|
||||
private static int masterVolume = 35;
|
||||
|
||||
/**
|
||||
* Default music volume.
|
||||
*/
|
||||
/** Default music volume. */
|
||||
private static int musicVolume = 80;
|
||||
|
||||
/**
|
||||
* Default sound effect volume.
|
||||
*/
|
||||
/** Default sound effect volume. */
|
||||
private static int effectVolume = 70;
|
||||
|
||||
/**
|
||||
* Default hit sound volume.
|
||||
*/
|
||||
/** Default hit sound volume. */
|
||||
private static int hitSoundVolume = 70;
|
||||
|
||||
/**
|
||||
* Offset time, in milliseconds, for music position-related elements.
|
||||
*/
|
||||
/** Offset time, in milliseconds, for music position-related elements. */
|
||||
private static int musicOffset = -150;
|
||||
|
||||
/**
|
||||
* Screenshot file format.
|
||||
*/
|
||||
/** Screenshot file formats. */
|
||||
private static String[] screenshotFormat = { "png", "jpg", "bmp" };
|
||||
|
||||
/**
|
||||
* Index in screenshotFormat[] array.
|
||||
*/
|
||||
/** Index in screenshotFormat[] array. */
|
||||
private static int screenshotFormatIndex = 0;
|
||||
|
||||
/**
|
||||
* Port binding.
|
||||
*/
|
||||
/** Port binding. */
|
||||
private static int port = 49250;
|
||||
|
||||
/**
|
||||
* Whether or not to use the new cursor type.
|
||||
*/
|
||||
/** Whether or not to use the new cursor type. */
|
||||
private static boolean newCursor = true;
|
||||
|
||||
/**
|
||||
* Whether or not dynamic backgrounds are enabled.
|
||||
*/
|
||||
/** Whether or not dynamic backgrounds are enabled. */
|
||||
private static boolean dynamicBackground = true;
|
||||
|
||||
/**
|
||||
* Whether or not to display perfect hit results.
|
||||
*/
|
||||
/** Whether or not to display perfect hit results. */
|
||||
private static boolean showPerfectHit = true;
|
||||
|
||||
/**
|
||||
* Percentage to dim background images during gameplay.
|
||||
*/
|
||||
/** Percentage to dim background images during gameplay. */
|
||||
private static int backgroundDim = 30;
|
||||
|
||||
/**
|
||||
* Whether or not to always display the default playfield background.
|
||||
*/
|
||||
/** Whether or not to always display the default playfield background. */
|
||||
private static boolean forceDefaultPlayfield = false;
|
||||
|
||||
/**
|
||||
* Whether or not to ignore resources in the beatmap folders.
|
||||
*/
|
||||
/** Whether or not to ignore resources in the beatmap folders. */
|
||||
private static boolean ignoreBeatmapSkins = false;
|
||||
|
||||
/**
|
||||
* Whether or not to play the theme song.
|
||||
*/
|
||||
/** Whether or not to play the theme song. */
|
||||
private static boolean themeSongEnabled = true;
|
||||
|
||||
/**
|
||||
* Fixed difficulty overrides.
|
||||
*/
|
||||
/** Fixed difficulty overrides. */
|
||||
private static float
|
||||
fixedCS = 0f, fixedHP = 0f,
|
||||
fixedAR = 0f, fixedOD = 0f;
|
||||
|
||||
/**
|
||||
* Whether or not to display the files being loaded in the splash screen.
|
||||
*/
|
||||
/** Whether or not to display the files being loaded in the splash screen. */
|
||||
private static boolean loadVerbose = false;
|
||||
|
||||
/**
|
||||
* Track checkpoint time, in seconds.
|
||||
*/
|
||||
/** Track checkpoint time, in seconds. */
|
||||
private static int checkpoint = 0;
|
||||
|
||||
/**
|
||||
|
@ -604,14 +520,10 @@ public class Options {
|
|||
private static boolean disableSound =
|
||||
(System.getProperty("os.name").toLowerCase().indexOf("linux") > -1);
|
||||
|
||||
/**
|
||||
* Whether or not to display non-English metadata.
|
||||
*/
|
||||
/** Whether or not to display non-English metadata. */
|
||||
private static boolean showUnicode = false;
|
||||
|
||||
/**
|
||||
* Left and right game keys.
|
||||
*/
|
||||
/** Left and right game keys. */
|
||||
private static int
|
||||
keyLeft = Keyboard.KEY_NONE,
|
||||
keyRight = Keyboard.KEY_NONE;
|
||||
|
|
|
@ -31,79 +31,163 @@ import org.newdawn.slick.util.Log;
|
|||
* Data type storing parsed data from OSU files.
|
||||
*/
|
||||
public class OsuFile implements Comparable<OsuFile> {
|
||||
/**
|
||||
* The OSU File object associated with this OsuFile.
|
||||
*/
|
||||
/** Map of all loaded background images. */
|
||||
private static HashMap<OsuFile, Image> bgImageMap = new HashMap<OsuFile, Image>();
|
||||
|
||||
/** The OSU File object associated with this OsuFile. */
|
||||
private File file;
|
||||
|
||||
/* [General] */
|
||||
public File audioFilename; // audio file object
|
||||
public int audioLeadIn = 0; // delay before music starts (in ms)
|
||||
// public String audioHash = ""; // audio hash (deprecated)
|
||||
public int previewTime = -1; // start position of music preview (in ms)
|
||||
public byte countdown = 0; // countdown type (0:disabled, 1:normal, 2:half, 3:double)
|
||||
public String sampleSet = ""; // sound samples ("None", "Normal", "Soft")
|
||||
public float stackLeniency = 0.7f; // how often closely placed hit objects will be stacked together
|
||||
public byte mode = 0; // game mode (0:osu!, 1:taiko, 2:catch the beat, 3:osu!mania)
|
||||
public boolean letterboxInBreaks = false; // whether the letterbox (top/bottom black bars) appears during breaks
|
||||
public boolean widescreenStoryboard = false;// whether the storyboard should be widescreen
|
||||
public boolean epilepsyWarning = false; // whether to show an epilepsy warning
|
||||
/**
|
||||
* [General]
|
||||
*/
|
||||
|
||||
/* [Editor] */
|
||||
/* Not implemented. */
|
||||
// public int[] bookmarks; // list of editor bookmarks (in ms)
|
||||
// public float distanceSpacing = 0f; // multiplier for "Distance Snap"
|
||||
// public byte beatDivisor = 0; // beat division
|
||||
// public int gridSize = 0; // size of grid for "Grid Snap"
|
||||
// public int timelineZoom = 0; // zoom in the editor timeline
|
||||
/** Audio file object. */
|
||||
public File audioFilename;
|
||||
|
||||
/* [Metadata] */
|
||||
public String title = ""; // song title
|
||||
public String titleUnicode = ""; // song title (unicode)
|
||||
public String artist = ""; // song artist
|
||||
public String artistUnicode = ""; // song artist (unicode)
|
||||
public String creator = ""; // beatmap creator
|
||||
public String version = ""; // beatmap difficulty
|
||||
public String source = ""; // song source
|
||||
public String tags = ""; // song tags, for searching
|
||||
public int beatmapID = 0; // beatmap ID
|
||||
public int beatmapSetID = 0; // beatmap set ID
|
||||
/** Delay time before music starts (in ms). */
|
||||
public int audioLeadIn = 0;
|
||||
|
||||
/* [Difficulty] */
|
||||
public float HPDrainRate = 5f; // HP drain (0:easy ~ 10:hard)
|
||||
public float circleSize = 4f; // size of circles
|
||||
public float overallDifficulty = 5f; // affects timing window, spinners, and approach speed (0:easy ~ 10:hard)
|
||||
public float approachRate = -1f; // how long circles stay on the screen (0:long ~ 10:short) **not in old format**
|
||||
public float sliderMultiplier = 1f; // slider movement speed multiplier
|
||||
public float sliderTickRate = 1f; // rate at which slider ticks are placed (x per beat)
|
||||
/** Audio hash (deprecated). */
|
||||
// public String audioHash = "";
|
||||
|
||||
/* [Events] */
|
||||
//Background and Video events (0)
|
||||
public String bg; // background image path
|
||||
// private Image bgImage; // background image (created when needed)
|
||||
// public Video bgVideo; // background video (not implemented)
|
||||
//Break Periods (2)
|
||||
public ArrayList<Integer> breaks; // break periods (start time, end time, ...)
|
||||
//Storyboard elements (not implemented)
|
||||
/** Start position of music preview (in ms). */
|
||||
public int previewTime = -1;
|
||||
|
||||
/* [TimingPoints] */
|
||||
public ArrayList<OsuTimingPoint> timingPoints; // timing points
|
||||
int bpmMin = 0, bpmMax = 0; // min and max BPM
|
||||
/** Countdown type (0:disabled, 1:normal, 2:half, 3:double). */
|
||||
public byte countdown = 0;
|
||||
|
||||
/* [Colours] */
|
||||
public Color[] combo; // combo colors (R,G,B), max 5
|
||||
/** Sound samples ("None", "Normal", "Soft"). */
|
||||
public String sampleSet = "";
|
||||
|
||||
/* [HitObjects] */
|
||||
public OsuHitObject[] objects; // hit objects
|
||||
public int hitObjectCircle = 0; // number of circles
|
||||
public int hitObjectSlider = 0; // number of sliders
|
||||
public int hitObjectSpinner = 0; // number of spinners
|
||||
public int endTime = -1; // last object end time (in ms)
|
||||
/** How often closely placed hit objects will be stacked together. */
|
||||
public float stackLeniency = 0.7f;
|
||||
|
||||
/** Game mode (0:osu!, 1:taiko, 2:catch the beat, 3:osu!mania). */
|
||||
public byte mode = 0;
|
||||
|
||||
/** Whether the letterbox (top/bottom black bars) appears during breaks. */
|
||||
public boolean letterboxInBreaks = false;
|
||||
|
||||
/** Whether the storyboard should be widescreen. */
|
||||
public boolean widescreenStoryboard = false;
|
||||
|
||||
/** Whether to show an epilepsy warning. */
|
||||
public boolean epilepsyWarning = false;
|
||||
|
||||
/**
|
||||
* Map of all loaded background images.
|
||||
* [Editor]
|
||||
*/
|
||||
private static HashMap<OsuFile, Image> bgImageMap = new HashMap<OsuFile, Image>();
|
||||
|
||||
/** List of editor bookmarks (in ms). */
|
||||
// public int[] bookmarks;
|
||||
|
||||
/** Multiplier for "Distance Snap". */
|
||||
// public float distanceSpacing = 0f;
|
||||
|
||||
/** Beat division. */
|
||||
// public byte beatDivisor = 0;
|
||||
|
||||
/** Size of grid for "Grid Snap". */
|
||||
// public int gridSize = 0;
|
||||
|
||||
/** Zoom in the editor timeline. */
|
||||
// public int timelineZoom = 0;
|
||||
|
||||
/**
|
||||
* [Metadata]
|
||||
*/
|
||||
|
||||
/** Song title. */
|
||||
public String title = "", titleUnicode = "";
|
||||
|
||||
/** Song artist. */
|
||||
public String artist = "", artistUnicode = "";
|
||||
|
||||
/** Beatmap creator. */
|
||||
public String creator = "";
|
||||
|
||||
/** Beatmap difficulty. */
|
||||
public String version = "";
|
||||
|
||||
/** Song source. */
|
||||
public String source = "";
|
||||
|
||||
/** Song tags (for searching). */
|
||||
public String tags = "";
|
||||
|
||||
/** Beatmap ID. */
|
||||
public int beatmapID = 0;
|
||||
|
||||
/** Beatmap set ID. */
|
||||
public int beatmapSetID = 0;
|
||||
|
||||
/**
|
||||
* [Difficulty]
|
||||
*/
|
||||
|
||||
/** HP: Health drain rate (0:easy ~ 10:hard) */
|
||||
public float HPDrainRate = 5f;
|
||||
|
||||
/** CS: Size of circles and sliders (0:large ~ 10:small). */
|
||||
public float circleSize = 4f;
|
||||
|
||||
/** OD: Affects timing window, spinners, and approach speed (0:easy ~ 10:hard). */
|
||||
public float overallDifficulty = 5f;
|
||||
|
||||
/** AR: How long circles stay on the screen (0:long ~ 10:short). */
|
||||
public float approachRate = -1f;
|
||||
|
||||
/** Slider movement speed multiplier. */
|
||||
public float sliderMultiplier = 1f;
|
||||
|
||||
/** Rate at which slider ticks are placed (x per beat). */
|
||||
public float sliderTickRate = 1f;
|
||||
|
||||
/**
|
||||
* [Events]
|
||||
*/
|
||||
|
||||
/** Background image file name. */
|
||||
public String bg;
|
||||
|
||||
/** Background video file name. */
|
||||
// public String video;
|
||||
|
||||
/** All break periods (start time, end time, ...). */
|
||||
public ArrayList<Integer> breaks;
|
||||
|
||||
/**
|
||||
* [TimingPoints]
|
||||
*/
|
||||
|
||||
/** All timing points. */
|
||||
public ArrayList<OsuTimingPoint> timingPoints;
|
||||
|
||||
/** Song BPM range. */
|
||||
int bpmMin = 0, bpmMax = 0;
|
||||
|
||||
/**
|
||||
* [Colours]
|
||||
*/
|
||||
|
||||
/** Combo colors (max 8). */
|
||||
public Color[] combo;
|
||||
|
||||
/**
|
||||
* [HitObjects]
|
||||
*/
|
||||
|
||||
/** All hit objects. */
|
||||
public OsuHitObject[] objects;
|
||||
|
||||
/** Number of individual objects. */
|
||||
public int
|
||||
hitObjectCircle = 0,
|
||||
hitObjectSlider = 0,
|
||||
hitObjectSpinner = 0;
|
||||
|
||||
/** Last object end time (in ms). */
|
||||
public int endTime = -1;
|
||||
|
||||
/**
|
||||
* Destroys all cached background images and resets the cache.
|
||||
|
|
|
@ -30,43 +30,27 @@ import java.util.regex.Pattern;
|
|||
* Indexed, expanding, doubly-linked list data type for song groups.
|
||||
*/
|
||||
public class OsuGroupList {
|
||||
/**
|
||||
* Song group structure (each group contains of an ArrayList of OsuFiles).
|
||||
*/
|
||||
/** Song group structure (each group contains of an ArrayList of OsuFiles). */
|
||||
private static OsuGroupList list;
|
||||
|
||||
/**
|
||||
* Search pattern for conditional expressions.
|
||||
*/
|
||||
/** Search pattern for conditional expressions. */
|
||||
private static final Pattern SEARCH_CONDITION_PATTERN = Pattern.compile(
|
||||
"(ar|cs|od|hp|bpm|length)(=|==|>|>=|<|<=)((\\d*\\.)?\\d+)"
|
||||
);
|
||||
|
||||
/**
|
||||
* List containing all parsed nodes.
|
||||
*/
|
||||
/** List containing all parsed nodes. */
|
||||
private ArrayList<OsuGroupNode> parsedNodes;
|
||||
|
||||
/**
|
||||
* Total number of maps (i.e. OsuFile objects).
|
||||
*/
|
||||
/** Total number of beatmaps (i.e. OsuFile objects). */
|
||||
private int mapCount = 0;
|
||||
|
||||
/**
|
||||
* Current list of nodes.
|
||||
* (For searches; otherwise, a pointer to parsedNodes.)
|
||||
*/
|
||||
/** Current list of nodes (subset of parsedNodes, used for searches). */
|
||||
private ArrayList<OsuGroupNode> nodes;
|
||||
|
||||
/**
|
||||
* Index of current expanded node.
|
||||
* If no node is expanded, the value will be -1.
|
||||
*/
|
||||
/** Index of current expanded node (-1 if no node is expanded). */
|
||||
private int expandedIndex = -1;
|
||||
|
||||
/**
|
||||
* The last search query.
|
||||
*/
|
||||
/** The last search query. */
|
||||
private String lastQuery = "";
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,26 +28,16 @@ import org.newdawn.slick.Image;
|
|||
* Node in an OsuGroupList representing a group of OsuFile objects.
|
||||
*/
|
||||
public class OsuGroupNode {
|
||||
|
||||
/**
|
||||
* List of associated OsuFile objects.
|
||||
*/
|
||||
/** List of associated OsuFile objects. */
|
||||
public ArrayList<OsuFile> osuFiles;
|
||||
|
||||
/**
|
||||
* Index of this OsuGroupNode.
|
||||
*/
|
||||
/** Index of this OsuGroupNode. */
|
||||
public int index = 0;
|
||||
|
||||
/**
|
||||
* Index of selected osuFile.
|
||||
* If not focused, the value will be -1.
|
||||
*/
|
||||
/** Index of selected osuFile (-1 if not focused). */
|
||||
public int osuFileIndex = -1;
|
||||
|
||||
/**
|
||||
* Links to other OsuGroupNode objects.
|
||||
*/
|
||||
/** Links to other OsuGroupNode objects. */
|
||||
public OsuGroupNode prev, next;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,23 +22,19 @@ package itdelatrisu.opsu;
|
|||
* Data type representing a hit object.
|
||||
*/
|
||||
public class OsuHitObject {
|
||||
/**
|
||||
* Hit object types (bits).
|
||||
*/
|
||||
/** Hit object types (bits). */
|
||||
public static final int
|
||||
TYPE_CIRCLE = 1,
|
||||
TYPE_SLIDER = 2,
|
||||
TYPE_NEWCOMBO = 4, // not an object
|
||||
TYPE_SPINNER = 8;
|
||||
|
||||
/**
|
||||
* Hit sound types (bits).
|
||||
*/
|
||||
/** Hit sound types (bits). */
|
||||
public static final byte
|
||||
SOUND_NORMAL = 0,
|
||||
SOUND_WHISTLE = 2,
|
||||
SOUND_FINISH = 4,
|
||||
SOUND_CLAP = 8;
|
||||
SOUND_NORMAL = 0,
|
||||
SOUND_WHISTLE = 2,
|
||||
SOUND_FINISH = 4,
|
||||
SOUND_CLAP = 8;
|
||||
|
||||
/**
|
||||
* Slider curve types.
|
||||
|
@ -50,82 +46,54 @@ public class OsuHitObject {
|
|||
SLIDER_LINEAR = 'L',
|
||||
SLIDER_PASSTHROUGH = 'P';
|
||||
|
||||
/**
|
||||
* Max hit object coordinates.
|
||||
*/
|
||||
/** Max hit object coordinates. */
|
||||
private static final int
|
||||
MAX_X = 512,
|
||||
MAX_Y = 384;
|
||||
|
||||
/**
|
||||
* The x and y multipliers for hit object coordinates.
|
||||
*/
|
||||
/** The x and y multipliers for hit object coordinates. */
|
||||
private static float xMultiplier, yMultiplier;
|
||||
|
||||
/**
|
||||
* The x and y offsets for hit object coordinates.
|
||||
*/
|
||||
/** The x and y offsets for hit object coordinates. */
|
||||
private static int
|
||||
xOffset, // offset right of border
|
||||
yOffset; // offset below health bar
|
||||
|
||||
/**
|
||||
* Starting coordinates (scaled).
|
||||
*/
|
||||
/** Starting coordinates (scaled). */
|
||||
private float x, y;
|
||||
|
||||
/**
|
||||
* Start time (in ms).
|
||||
*/
|
||||
/** Start time (in ms). */
|
||||
private int time;
|
||||
|
||||
/**
|
||||
* Hit object type (TYPE_* bitmask).
|
||||
*/
|
||||
/** Hit object type (TYPE_* bitmask). */
|
||||
private int type;
|
||||
|
||||
/**
|
||||
* Hit sound type (SOUND_* bitmask).
|
||||
*/
|
||||
/** Hit sound type (SOUND_* bitmask). */
|
||||
private byte hitSound;
|
||||
|
||||
/**
|
||||
* Slider curve type (SLIDER_* constant).
|
||||
*/
|
||||
/** Slider curve type (SLIDER_* constant). */
|
||||
private char sliderType;
|
||||
|
||||
/**
|
||||
* Slider coordinate lists (scaled).
|
||||
*/
|
||||
/** Slider coordinate lists (scaled). */
|
||||
private float[] sliderX, sliderY;
|
||||
|
||||
/**
|
||||
* Slider repeat count.
|
||||
*/
|
||||
/** Slider repeat count. */
|
||||
private int repeat;
|
||||
|
||||
/**
|
||||
* Slider pixel length.
|
||||
*/
|
||||
/** Slider pixel length. */
|
||||
private float pixelLength;
|
||||
|
||||
/**
|
||||
* Spinner end time (in ms).
|
||||
*/
|
||||
/** Spinner end time (in ms). */
|
||||
private int endTime;
|
||||
|
||||
// additional v10+ parameters not implemented...
|
||||
// addition -> sampl:add:cust:vol:hitsound
|
||||
// edge_hitsound, edge_addition (sliders only)
|
||||
|
||||
/**
|
||||
* Current index in combo color array.
|
||||
*/
|
||||
/** Current index in combo color array. */
|
||||
private int comboIndex;
|
||||
|
||||
/**
|
||||
* Number to display in hit object.
|
||||
*/
|
||||
/** Number to display in hit object. */
|
||||
private int comboNumber;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,24 +37,16 @@ import org.newdawn.slick.util.Log;
|
|||
* Parser for OSU files.
|
||||
*/
|
||||
public class OsuParser {
|
||||
/**
|
||||
* The current file being parsed.
|
||||
*/
|
||||
/** The current file being parsed. */
|
||||
private static File currentFile;
|
||||
|
||||
/**
|
||||
* The current directory number while parsing.
|
||||
*/
|
||||
/** The current directory number while parsing. */
|
||||
private static int currentDirectoryIndex = -1;
|
||||
|
||||
/**
|
||||
* The total number of directories to parse.
|
||||
*/
|
||||
/** The total number of directories to parse. */
|
||||
private static int totalDirectories = -1;
|
||||
|
||||
/**
|
||||
* The string database.
|
||||
*/
|
||||
/** The string lookup database. */
|
||||
private static HashMap<String, String> stringdb = new HashMap<String, String>();
|
||||
|
||||
// This class should not be instantiated.
|
||||
|
|
|
@ -24,49 +24,31 @@ import org.newdawn.slick.util.Log;
|
|||
* Data type representing a timing point.
|
||||
*/
|
||||
public class OsuTimingPoint {
|
||||
/**
|
||||
* Timing point start time/offset (in ms).
|
||||
*/
|
||||
/** Timing point start time/offset (in ms). */
|
||||
private int time = 0;
|
||||
|
||||
/**
|
||||
* Time per beat (in ms). [NON-INHERITED]
|
||||
*/
|
||||
/** Time per beat (in ms). [NON-INHERITED] */
|
||||
private float beatLength = 0f;
|
||||
|
||||
/**
|
||||
* Slider multiplier. [INHERITED]
|
||||
*/
|
||||
/** Slider multiplier. [INHERITED] */
|
||||
private int velocity = 0;
|
||||
|
||||
/**
|
||||
* Beats per measure.
|
||||
*/
|
||||
/** Beats per measure. */
|
||||
private int meter = 4;
|
||||
|
||||
/**
|
||||
* Sound sample type.
|
||||
*/
|
||||
/** Sound sample type. */
|
||||
private byte sampleType = 1;
|
||||
|
||||
/**
|
||||
* Custom sound sample type.
|
||||
*/
|
||||
/** Custom sound sample type. */
|
||||
private byte sampleTypeCustom = 0;
|
||||
|
||||
/**
|
||||
* Volume of samples. [0, 100]
|
||||
*/
|
||||
/** Volume of samples. [0, 100] */
|
||||
private int sampleVolume = 100;
|
||||
|
||||
/**
|
||||
* Whether or not this timing point is inherited.
|
||||
*/
|
||||
/** Whether or not this timing point is inherited. */
|
||||
private boolean inherited = false;
|
||||
|
||||
/**
|
||||
* Whether or not Kiai Mode is active.
|
||||
*/
|
||||
/** Whether or not Kiai Mode is active. */
|
||||
private boolean kiai = false;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,14 +28,10 @@ import net.lingala.zip4j.exception.ZipException;
|
|||
* Unpacker for OSZ (ZIP) archives.
|
||||
*/
|
||||
public class OszUnpacker {
|
||||
/**
|
||||
* The index of the current file being unpacked.
|
||||
*/
|
||||
/** The index of the current file being unpacked. */
|
||||
private static int fileIndex = -1;
|
||||
|
||||
/**
|
||||
* The total number of directories to parse.
|
||||
*/
|
||||
/** The total number of directories to parse. */
|
||||
private static File[] files;
|
||||
|
||||
// This class should not be instantiated.
|
||||
|
|
|
@ -34,43 +34,29 @@ public enum SongSort {
|
|||
BPM (3, "BPM", new BPMOrder()),
|
||||
LENGTH (4, "Length", new LengthOrder());
|
||||
|
||||
/**
|
||||
* The ID of the sort (used for tab positioning).
|
||||
*/
|
||||
/** The ID of the sort (used for tab positioning). */
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* The name of the sort.
|
||||
*/
|
||||
/** The name of the sort. */
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* The comparator for the sort.
|
||||
*/
|
||||
/** The comparator for the sort. */
|
||||
private Comparator<OsuGroupNode> comparator;
|
||||
|
||||
/**
|
||||
* The tab associated with the sort (displayed in Song Menu screen).
|
||||
*/
|
||||
/** The tab associated with the sort (displayed in Song Menu screen). */
|
||||
private MenuButton tab;
|
||||
|
||||
/**
|
||||
* Total number of sorts.
|
||||
*/
|
||||
private static final int SIZE = SongSort.values().length;
|
||||
/** Total number of sorts. */
|
||||
private static final int SIZE = values().length;
|
||||
|
||||
/**
|
||||
* Array of SongSort objects in reverse order.
|
||||
*/
|
||||
/** Array of SongSort objects in reverse order. */
|
||||
public static final SongSort[] VALUES_REVERSED;
|
||||
static {
|
||||
VALUES_REVERSED = SongSort.values();
|
||||
VALUES_REVERSED = values();
|
||||
Collections.reverse(Arrays.asList(VALUES_REVERSED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Current sort.
|
||||
*/
|
||||
/** Current sort. */
|
||||
private static SongSort currentSort = TITLE;
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,9 +57,7 @@ import org.newdawn.slick.util.ResourceLoader;
|
|||
* Contains miscellaneous utilities.
|
||||
*/
|
||||
public class Utils {
|
||||
/**
|
||||
* Game colors.
|
||||
*/
|
||||
/** Game colors. */
|
||||
public static final Color
|
||||
COLOR_BLACK_ALPHA = new Color(0, 0, 0, 0.5f),
|
||||
COLOR_WHITE_ALPHA = new Color(255, 255, 255, 0.5f),
|
||||
|
@ -75,56 +73,38 @@ public class Utils {
|
|||
COLOR_WHITE_FADE = new Color(255, 255, 255, 1f),
|
||||
COLOR_RED_HOVER = new Color(255, 112, 112);
|
||||
|
||||
/**
|
||||
* The default map colors, used when a map does not provide custom colors.
|
||||
*/
|
||||
/** The default map colors, used when a map does not provide custom colors. */
|
||||
public static final Color[] DEFAULT_COMBO = {
|
||||
COLOR_GREEN_OBJECT, COLOR_BLUE_OBJECT,
|
||||
COLOR_RED_OBJECT, COLOR_ORANGE_OBJECT
|
||||
};
|
||||
|
||||
/**
|
||||
* Game fonts.
|
||||
*/
|
||||
/** Game fonts. */
|
||||
public static UnicodeFont
|
||||
FONT_DEFAULT, FONT_BOLD,
|
||||
FONT_XLARGE, FONT_LARGE, FONT_MEDIUM, FONT_SMALL;
|
||||
|
||||
/**
|
||||
* Back button (shared by other states).
|
||||
*/
|
||||
/** Back button (shared by other states). */
|
||||
private static MenuButton backButton;
|
||||
|
||||
/**
|
||||
* Cursor image and trail.
|
||||
*/
|
||||
/** Cursor image and trail. */
|
||||
private static Image cursor, cursorTrail, cursorMiddle;
|
||||
|
||||
/**
|
||||
* Last cursor coordinates.
|
||||
*/
|
||||
/** Last cursor coordinates. */
|
||||
private static int lastX = -1, lastY = -1;
|
||||
|
||||
/**
|
||||
* Stores all previous cursor locations to display a trail.
|
||||
*/
|
||||
/** Stores all previous cursor locations to display a trail. */
|
||||
private static LinkedList<Integer>
|
||||
cursorX = new LinkedList<Integer>(),
|
||||
cursorY = new LinkedList<Integer>();
|
||||
|
||||
/**
|
||||
* Time to show volume image, in milliseconds.
|
||||
*/
|
||||
/** Time to show volume image, in milliseconds. */
|
||||
private static final int VOLUME_DISPLAY_TIME = 1500;
|
||||
|
||||
/**
|
||||
* Volume display elapsed time.
|
||||
*/
|
||||
/** Volume display elapsed time. */
|
||||
private static int volumeDisplay = -1;
|
||||
|
||||
/**
|
||||
* Set of all Unicode strings already loaded.
|
||||
*/
|
||||
/** Set of all Unicode strings already loaded. */
|
||||
private static HashSet<String> loadedGlyphs = new HashSet<String>();
|
||||
|
||||
// game-related variables
|
||||
|
|
|
@ -34,29 +34,21 @@ public enum HitSound implements SoundController.SoundComponent {
|
|||
SLIDERTICK ("slidertick"),
|
||||
SLIDERWHISTLE ("sliderwhistle");
|
||||
|
||||
/**
|
||||
* Sound sample sets.
|
||||
*/
|
||||
public static enum SampleSet {
|
||||
/** Sound sample sets. */
|
||||
public enum SampleSet {
|
||||
NORMAL ("normal", 1),
|
||||
SOFT ("soft", 2),
|
||||
DRUM ("drum", 3);
|
||||
// TAIKO ("taiko", 4);
|
||||
|
||||
/**
|
||||
* The sample set name.
|
||||
*/
|
||||
/** The sample set name. */
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* The sample set index.
|
||||
*/
|
||||
/** The sample set index. */
|
||||
private int index;
|
||||
|
||||
/**
|
||||
* Total number of sample sets.
|
||||
*/
|
||||
public static final int SIZE = SampleSet.values().length;
|
||||
/** Total number of sample sets. */
|
||||
public static final int SIZE = values().length;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -80,25 +72,17 @@ public enum HitSound implements SoundController.SoundComponent {
|
|||
public int getIndex() { return index; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Current sample set.
|
||||
*/
|
||||
/** Current sample set. */
|
||||
private static SampleSet currentSampleSet;
|
||||
|
||||
/**
|
||||
* The file name.
|
||||
*/
|
||||
/** The file name. */
|
||||
private String filename;
|
||||
|
||||
/**
|
||||
* The Clip associated with the hit sound.
|
||||
*/
|
||||
/** The Clip associated with the hit sound. */
|
||||
private HashMap<SampleSet, Clip> clips;
|
||||
|
||||
/**
|
||||
* Total number of hit sounds.
|
||||
*/
|
||||
public static final int SIZE = HitSound.values().length;
|
||||
/** Total number of hit sounds. */
|
||||
public static final int SIZE = values().length;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
@ -41,39 +41,25 @@ import org.newdawn.slick.openal.SoundStore;
|
|||
* Controller for all music.
|
||||
*/
|
||||
public class MusicController {
|
||||
/**
|
||||
* The current music track.
|
||||
*/
|
||||
/** The current music track. */
|
||||
private static Music player;
|
||||
|
||||
/**
|
||||
* The last OsuFile passed to play().
|
||||
*/
|
||||
/** The last OsuFile passed to play(). */
|
||||
private static OsuFile lastOsu;
|
||||
|
||||
/**
|
||||
* Temporary WAV file for file conversions (to be deleted).
|
||||
*/
|
||||
/** Temporary WAV file for file conversions (to be deleted). */
|
||||
private static File wavFile;
|
||||
|
||||
/**
|
||||
* Thread for loading tracks.
|
||||
*/
|
||||
/** Thread for loading tracks. */
|
||||
private static Thread trackLoader;
|
||||
|
||||
/**
|
||||
* Whether the theme song is currently playing.
|
||||
*/
|
||||
/** Whether the theme song is currently playing. */
|
||||
private static boolean themePlaying = false;
|
||||
|
||||
/**
|
||||
* Track pause time.
|
||||
*/
|
||||
/** Track pause time. */
|
||||
private static float pauseTime = 0f;
|
||||
|
||||
/**
|
||||
* Whether the current track volume is dimmed.
|
||||
*/
|
||||
/** Whether the current track volume is dimmed. */
|
||||
private static boolean trackDimmed = false;
|
||||
|
||||
// This class should not be instantiated.
|
||||
|
|
|
@ -42,9 +42,7 @@ import org.newdawn.slick.util.ResourceLoader;
|
|||
* Note: Uses Java Sound because OpenAL lags too much for accurate hit sounds.
|
||||
*/
|
||||
public class SoundController {
|
||||
/**
|
||||
* Interface for all (non-music) sound components.
|
||||
*/
|
||||
/** Interface for all (non-music) sound components. */
|
||||
public interface SoundComponent {
|
||||
/**
|
||||
* Returns the Clip associated with the sound component.
|
||||
|
@ -53,19 +51,13 @@ public class SoundController {
|
|||
public Clip getClip();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sample volume multiplier, from timing points [0, 1].
|
||||
*/
|
||||
/** Sample volume multiplier, from timing points [0, 1]. */
|
||||
private static float sampleVolumeMultiplier = 1f;
|
||||
|
||||
/**
|
||||
* The name of the current sound file being loaded.
|
||||
*/
|
||||
/** The name of the current sound file being loaded. */
|
||||
private static String currentFileName;
|
||||
|
||||
/**
|
||||
* The number of the current sound file being loaded.
|
||||
*/
|
||||
/** The number of the current sound file being loaded. */
|
||||
private static int currentFileIndex = -1;
|
||||
|
||||
// This class should not be instantiated.
|
||||
|
|
|
@ -43,20 +43,14 @@ public enum SoundEffect implements SoundController.SoundComponent {
|
|||
SPINNEROSU ("spinner-osu"),
|
||||
SPINNERSPIN ("spinnerspin");
|
||||
|
||||
/**
|
||||
* The file name.
|
||||
*/
|
||||
/** The file name. */
|
||||
private String filename;
|
||||
|
||||
/**
|
||||
* The Clip associated with the sound effect.
|
||||
*/
|
||||
/** The Clip associated with the sound effect. */
|
||||
private Clip clip;
|
||||
|
||||
/**
|
||||
* Total number of sound effects.
|
||||
*/
|
||||
public static final int SIZE = SoundEffect.values().length;
|
||||
/** Total number of sound effects. */
|
||||
public static final int SIZE = values().length;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
@ -34,29 +34,19 @@ import org.newdawn.slick.Graphics;
|
|||
* Data type representing a circle object.
|
||||
*/
|
||||
public class Circle implements HitObject {
|
||||
/**
|
||||
* The associated OsuHitObject.
|
||||
*/
|
||||
/** The associated OsuHitObject. */
|
||||
private OsuHitObject hitObject;
|
||||
|
||||
/**
|
||||
* The associated Game object.
|
||||
*/
|
||||
/** The associated Game object. */
|
||||
private Game game;
|
||||
|
||||
/**
|
||||
* The associated GameScore object.
|
||||
*/
|
||||
/** The associated GameScore object. */
|
||||
private GameScore score;
|
||||
|
||||
/**
|
||||
* The color of this circle.
|
||||
*/
|
||||
/** The color of this circle. */
|
||||
private Color color;
|
||||
|
||||
/**
|
||||
* Whether or not the circle result ends the combo streak.
|
||||
*/
|
||||
/** Whether or not the circle result ends the combo streak. */
|
||||
private boolean comboEnd;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,89 +37,55 @@ import org.newdawn.slick.Image;
|
|||
* Data type representing a slider object.
|
||||
*/
|
||||
public class Slider implements HitObject {
|
||||
/**
|
||||
* Slider ball animation.
|
||||
*/
|
||||
/** Slider ball animation. */
|
||||
private static Animation sliderBall;
|
||||
|
||||
/**
|
||||
* Slider movement speed multiplier.
|
||||
*/
|
||||
/** Slider movement speed multiplier. */
|
||||
private static float sliderMultiplier = 1.0f;
|
||||
|
||||
/**
|
||||
* Rate at which slider ticks are placed.
|
||||
*/
|
||||
/** Rate at which slider ticks are placed. */
|
||||
private static float sliderTickRate = 1.0f;
|
||||
|
||||
/**
|
||||
* The associated OsuHitObject.
|
||||
*/
|
||||
/** The associated OsuHitObject. */
|
||||
private OsuHitObject hitObject;
|
||||
|
||||
/**
|
||||
* The associated Game object.
|
||||
*/
|
||||
/** The associated Game object. */
|
||||
private Game game;
|
||||
|
||||
/**
|
||||
* The associated GameScore object.
|
||||
*/
|
||||
/** The associated GameScore object. */
|
||||
private GameScore score;
|
||||
|
||||
/**
|
||||
* The color of this slider.
|
||||
*/
|
||||
/** The color of this slider. */
|
||||
private Color color;
|
||||
|
||||
/**
|
||||
* The underlying Bezier object.
|
||||
*/
|
||||
/** The underlying Bezier object. */
|
||||
private Bezier bezier;
|
||||
|
||||
/**
|
||||
* The time duration of the slider, in milliseconds.
|
||||
*/
|
||||
/** The time duration of the slider, in milliseconds. */
|
||||
private float sliderTime = 0f;
|
||||
|
||||
/**
|
||||
* The time duration of the slider including repeats, in milliseconds.
|
||||
*/
|
||||
/** The time duration of the slider including repeats, in milliseconds. */
|
||||
private float sliderTimeTotal = 0f;
|
||||
|
||||
/**
|
||||
* Whether or not the result of the initial hit circle has been processed.
|
||||
*/
|
||||
/** Whether or not the result of the initial hit circle has been processed. */
|
||||
private boolean sliderClicked = false;
|
||||
|
||||
/**
|
||||
* Whether or not to show the follow circle.
|
||||
*/
|
||||
/** Whether or not to show the follow circle. */
|
||||
private boolean followCircleActive = false;
|
||||
|
||||
/**
|
||||
* Whether or not the slider result ends the combo streak.
|
||||
*/
|
||||
/** Whether or not the slider result ends the combo streak. */
|
||||
private boolean comboEnd;
|
||||
|
||||
/**
|
||||
* The number of repeats that have passed so far.
|
||||
*/
|
||||
/** The number of repeats that have passed so far. */
|
||||
private int currentRepeats = 0;
|
||||
|
||||
/**
|
||||
* The t values of the slider ticks.
|
||||
*/
|
||||
/** The t values of the slider ticks. */
|
||||
private float[] ticksT;
|
||||
|
||||
/**
|
||||
* The tick index in the ticksT[] array.
|
||||
*/
|
||||
/** The tick index in the ticksT[] array. */
|
||||
private int tickIndex = 0;
|
||||
|
||||
/**
|
||||
* Number of ticks hit and tick intervals so far.
|
||||
*/
|
||||
/** Number of ticks hit and tick intervals so far. */
|
||||
private int ticksHit = 0, tickIntervals = 1;
|
||||
|
||||
/**
|
||||
|
@ -129,24 +95,16 @@ public class Slider implements HitObject {
|
|||
* @author pictuga (https://github.com/pictuga/osu-web)
|
||||
*/
|
||||
private class Bezier {
|
||||
/**
|
||||
* The order of the Bezier curve.
|
||||
*/
|
||||
/** The order of the Bezier curve. */
|
||||
private int order;
|
||||
|
||||
/**
|
||||
* The step size (used for drawing),
|
||||
*/
|
||||
/** The step size (used for drawing). */
|
||||
private float step;
|
||||
|
||||
/**
|
||||
* The curve points for drawing with step size given by 'step'.
|
||||
*/
|
||||
/** The curve points for drawing with step size given by 'step'. */
|
||||
private float[] curveX, curveY;
|
||||
|
||||
/**
|
||||
* The angles of the first and last control points.
|
||||
*/
|
||||
/** The angles of the first and last control points. */
|
||||
private float startAngle, endAngle;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,34 +37,22 @@ import org.newdawn.slick.Image;
|
|||
* Data type representing a spinner object.
|
||||
*/
|
||||
public class Spinner implements HitObject {
|
||||
/**
|
||||
* Container dimensions.
|
||||
*/
|
||||
/** Container dimensions. */
|
||||
private static int width, height;
|
||||
|
||||
/**
|
||||
* The associated OsuHitObject.
|
||||
*/
|
||||
/** The associated OsuHitObject. */
|
||||
private OsuHitObject hitObject;
|
||||
|
||||
/**
|
||||
* The associated GameScore object.
|
||||
*/
|
||||
/** The associated GameScore object. */
|
||||
private GameScore score;
|
||||
|
||||
/**
|
||||
* The last rotation angle.
|
||||
*/
|
||||
/** The last rotation angle. */
|
||||
private float lastAngle = -1f;
|
||||
|
||||
/**
|
||||
* The current number of rotations.
|
||||
*/
|
||||
/** The current number of rotations. */
|
||||
private float rotations = 0f;
|
||||
|
||||
/**
|
||||
* The total number of rotations needed to clear the spinner.
|
||||
*/
|
||||
/** The total number of rotations needed to clear the spinner. */
|
||||
private float rotationsNeeded;
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,9 +59,7 @@ import org.newdawn.slick.state.transition.FadeOutTransition;
|
|||
* "Game" state.
|
||||
*/
|
||||
public class Game extends BasicGameState {
|
||||
/**
|
||||
* Game restart states.
|
||||
*/
|
||||
/** Game restart states. */
|
||||
public enum Restart {
|
||||
FALSE, // no restart
|
||||
NEW, // first time loading song
|
||||
|
@ -69,121 +67,75 @@ public class Game extends BasicGameState {
|
|||
LOSE; // health is zero: no-continue/force restart
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimum time before start of song, in milliseconds, to process skip-related actions.
|
||||
*/
|
||||
/** Minimum time before start of song, in milliseconds, to process skip-related actions. */
|
||||
private static final int SKIP_OFFSET = 2000;
|
||||
|
||||
/**
|
||||
* The associated OsuFile object.
|
||||
*/
|
||||
/** The associated OsuFile object. */
|
||||
private OsuFile osu;
|
||||
|
||||
/**
|
||||
* The associated GameScore object (holds all score data).
|
||||
*/
|
||||
/** The associated GameScore object (holds all score data). */
|
||||
private GameScore score;
|
||||
|
||||
/**
|
||||
* Current hit object index in OsuHitObject[] array.
|
||||
*/
|
||||
/** Current hit object index in OsuHitObject[] array. */
|
||||
private int objectIndex = 0;
|
||||
|
||||
/**
|
||||
* The map's HitObjects, indexed by objectIndex.
|
||||
*/
|
||||
/** The map's HitObjects, indexed by objectIndex. */
|
||||
private HitObject[] hitObjects;
|
||||
|
||||
/**
|
||||
* Delay time, in milliseconds, before song starts.
|
||||
*/
|
||||
/** Delay time, in milliseconds, before song starts. */
|
||||
private int leadInTime;
|
||||
|
||||
/**
|
||||
* Hit object approach time, in milliseconds.
|
||||
*/
|
||||
/** Hit object approach time, in milliseconds. */
|
||||
private int approachTime;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Current restart state.
|
||||
*/
|
||||
/** Current restart state. */
|
||||
private Restart restart;
|
||||
|
||||
/**
|
||||
* Current break index in breaks ArrayList.
|
||||
*/
|
||||
/** Current break index in breaks ArrayList. */
|
||||
private int breakIndex;
|
||||
|
||||
/**
|
||||
* Break start time (0 if not in break).
|
||||
*/
|
||||
/** Break start time (0 if not in break). */
|
||||
private int breakTime = 0;
|
||||
|
||||
/**
|
||||
* Whether the break sound has been played.
|
||||
*/
|
||||
/** Whether the break sound has been played. */
|
||||
private boolean breakSound;
|
||||
|
||||
/**
|
||||
* Skip button (displayed at song start, when necessary).
|
||||
*/
|
||||
/** Skip button (displayed at song start, when necessary). */
|
||||
private MenuButton skipButton;
|
||||
|
||||
/**
|
||||
* Current timing point index in timingPoints ArrayList.
|
||||
*/
|
||||
/** Current timing point index in timingPoints ArrayList. */
|
||||
private int timingPointIndex;
|
||||
|
||||
/**
|
||||
* Current beat lengths (base value and inherited value).
|
||||
*/
|
||||
/** Current beat lengths (base value and inherited value). */
|
||||
private float beatLengthBase, beatLength;
|
||||
|
||||
/**
|
||||
* Whether the countdown sound has been played.
|
||||
*/
|
||||
/** Whether the countdown sound has been played. */
|
||||
private boolean
|
||||
countdownReadySound, countdown3Sound, countdown1Sound,
|
||||
countdown2Sound, countdownGoSound;
|
||||
|
||||
/**
|
||||
* Mouse coordinates before game paused.
|
||||
*/
|
||||
/** Mouse coordinates before game paused. */
|
||||
private int pausedMouseX = -1, pausedMouseY = -1;
|
||||
|
||||
/**
|
||||
* Track position when game paused.
|
||||
*/
|
||||
/** Track position when game paused. */
|
||||
private int pauseTime = -1;
|
||||
|
||||
/**
|
||||
* Value for handling hitCircleSelect pulse effect (expanding, alpha level).
|
||||
*/
|
||||
/** Value for handling hitCircleSelect pulse effect (expanding, alpha level). */
|
||||
private float pausePulse;
|
||||
|
||||
/**
|
||||
* Whether a checkpoint has been loaded during this game.
|
||||
*/
|
||||
/** Whether a checkpoint has been loaded during this game. */
|
||||
private boolean checkpointLoaded = false;
|
||||
|
||||
/**
|
||||
* Number of deaths, used if "Easy" mod is enabled.
|
||||
*/
|
||||
/** Number of deaths, used if "Easy" mod is enabled. */
|
||||
private byte deaths = 0;
|
||||
|
||||
/**
|
||||
* Track position at death, used if "Easy" mod is enabled.
|
||||
*/
|
||||
/** Track position at death, used if "Easy" mod is enabled. */
|
||||
private int deathTime = -1;
|
||||
|
||||
/**
|
||||
* Number of retries.
|
||||
*/
|
||||
/** Number of retries. */
|
||||
private int retries = 0;
|
||||
|
||||
// game-related variables
|
||||
|
|
|
@ -47,19 +47,13 @@ import org.newdawn.slick.state.transition.FadeOutTransition;
|
|||
* </ul>
|
||||
*/
|
||||
public class GamePauseMenu extends BasicGameState {
|
||||
/**
|
||||
* Music fade-out time, in milliseconds.
|
||||
*/
|
||||
/** Music fade-out time, in milliseconds. */
|
||||
private static final int FADEOUT_TIME = 1000;
|
||||
|
||||
/**
|
||||
* Track position when the pause menu was loaded (for FADEOUT_TIME).
|
||||
*/
|
||||
/** Track position when the pause menu was loaded (for FADEOUT_TIME). */
|
||||
private long pauseStartTime;
|
||||
|
||||
/**
|
||||
* "Continue", "Retry", and "Back" buttons.
|
||||
*/
|
||||
/** "Continue", "Retry", and "Back" buttons. */
|
||||
private MenuButton continueButton, retryButton, backButton;
|
||||
|
||||
// game-related variables
|
||||
|
|
|
@ -50,14 +50,10 @@ import org.newdawn.slick.state.transition.FadeOutTransition;
|
|||
* </ul>
|
||||
*/
|
||||
public class GameRanking extends BasicGameState {
|
||||
/**
|
||||
* Associated GameScore object.
|
||||
*/
|
||||
/** Associated GameScore object. */
|
||||
private GameScore score;
|
||||
|
||||
/**
|
||||
* "Retry" and "Exit" buttons.
|
||||
*/
|
||||
/** "Retry" and "Exit" buttons. */
|
||||
private MenuButton retryButton, exitButton;
|
||||
|
||||
// game-related variables
|
||||
|
@ -107,11 +103,11 @@ public class GameRanking extends BasicGameState {
|
|||
score.drawRankingElements(g, width, height);
|
||||
|
||||
// game mods
|
||||
for (GameMod mod : GameMod.valuesReversed()) {
|
||||
for (GameMod mod : GameMod.VALUES_REVERSED) {
|
||||
if (mod.isActive()) {
|
||||
Image modImage = mod.getImage();
|
||||
modImage.draw(
|
||||
(width * 0.75f) + ((mod.getID() - (GameMod.size() / 2)) * modImage.getWidth() / 3f),
|
||||
(width * 0.75f) + ((mod.getID() - (GameMod.SIZE / 2)) * modImage.getWidth() / 3f),
|
||||
height / 2f
|
||||
);
|
||||
}
|
||||
|
|
|
@ -57,54 +57,34 @@ import org.newdawn.slick.state.transition.FadeOutTransition;
|
|||
* </ul>
|
||||
*/
|
||||
public class MainMenu extends BasicGameState {
|
||||
/**
|
||||
* Idle time, in milliseconds, before returning the logo to its original position.
|
||||
*/
|
||||
/** Idle time, in milliseconds, before returning the logo to its original position. */
|
||||
private static final short MOVE_DELAY = 5000;
|
||||
|
||||
/**
|
||||
* Logo button that reveals other buttons on click.
|
||||
*/
|
||||
/** Logo button that reveals other buttons on click. */
|
||||
private MenuButton logo;
|
||||
|
||||
/**
|
||||
* Whether or not the logo has been clicked.
|
||||
*/
|
||||
/** Whether or not the logo has been clicked. */
|
||||
private boolean logoClicked = false;
|
||||
|
||||
/**
|
||||
* Delay timer, in milliseconds, before starting to move the logo back to the center.
|
||||
*/
|
||||
/** Delay timer, in milliseconds, before starting to move the logo back to the center. */
|
||||
private int logoTimer = 0;
|
||||
|
||||
/**
|
||||
* Main "Play" and "Exit" buttons.
|
||||
*/
|
||||
/** Main "Play" and "Exit" buttons. */
|
||||
private MenuButton playButton, exitButton;
|
||||
|
||||
/**
|
||||
* Music control buttons.
|
||||
*/
|
||||
/** Music control buttons. */
|
||||
private MenuButton musicPlay, musicPause, musicNext, musicPrevious;
|
||||
|
||||
/**
|
||||
* Button linking to repository.
|
||||
*/
|
||||
/** Button linking to repository. */
|
||||
private MenuButton repoButton;
|
||||
|
||||
/**
|
||||
* Application start time, for drawing the total running time.
|
||||
*/
|
||||
/** Application start time, for drawing the total running time. */
|
||||
private long osuStartTime;
|
||||
|
||||
/**
|
||||
* Indexes of previous songs.
|
||||
*/
|
||||
/** Indexes of previous songs. */
|
||||
private Stack<Integer> previous;
|
||||
|
||||
/**
|
||||
* Background alpha level (for fade-in effect).
|
||||
*/
|
||||
/** Background alpha level (for fade-in effect). */
|
||||
private float bgAlpha = 0f;
|
||||
|
||||
// game-related variables
|
||||
|
|
|
@ -42,14 +42,10 @@ import org.newdawn.slick.state.transition.FadeInTransition;
|
|||
* </ul>
|
||||
*/
|
||||
public class MainMenuExit extends BasicGameState {
|
||||
/**
|
||||
* "Yes" and "No" buttons.
|
||||
*/
|
||||
/** "Yes" and "No" buttons. */
|
||||
private MenuButton yesButton, noButton;
|
||||
|
||||
/**
|
||||
* Initial x coordinate offsets left/right of center (for shifting animation).
|
||||
*/
|
||||
/** Initial x coordinate offsets left/right of center (for shifting animation). */
|
||||
private float centerOffset;
|
||||
|
||||
// game-related variables
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
|
@ -31,6 +28,9 @@ import itdelatrisu.opsu.Utils;
|
|||
import itdelatrisu.opsu.audio.SoundController;
|
||||
import itdelatrisu.opsu.audio.SoundEffect;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
|
@ -46,9 +46,7 @@ import org.newdawn.slick.state.transition.FadeInTransition;
|
|||
* "Game Options" state.
|
||||
*/
|
||||
public class OptionsMenu extends BasicGameState {
|
||||
/**
|
||||
* Option tabs.
|
||||
*/
|
||||
/** Option tabs. */
|
||||
private enum OptionTab {
|
||||
DISPLAY ("Display", new GameOption[] {
|
||||
GameOption.SCREEN_RESOLUTION,
|
||||
|
@ -88,39 +86,26 @@ public class OptionsMenu extends BasicGameState {
|
|||
GameOption.CHECKPOINT
|
||||
});
|
||||
|
||||
/**
|
||||
* Total number of mods.
|
||||
*/
|
||||
public static final int SIZE = OptionTab.values().length;
|
||||
/** Total number of tabs. */
|
||||
public static final int SIZE = values().length;
|
||||
|
||||
/**
|
||||
* Enum values.
|
||||
*/
|
||||
private static OptionTab[] values = OptionTab.values();
|
||||
|
||||
/**
|
||||
* Returns an array of OptionTab objects in reverse order.
|
||||
* @return all tabs in reverse order
|
||||
*/
|
||||
public static OptionTab[] valuesReversed() {
|
||||
OptionTab[] tabs = OptionTab.values();
|
||||
Collections.reverse(Arrays.asList(tabs));
|
||||
return tabs;
|
||||
/** Array of OptionTab objects in reverse order. */
|
||||
public static final OptionTab[] VALUES_REVERSED;
|
||||
static {
|
||||
VALUES_REVERSED = values();
|
||||
Collections.reverse(Arrays.asList(VALUES_REVERSED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tab name.
|
||||
*/
|
||||
/** Enum values. */
|
||||
private static OptionTab[] values = values();
|
||||
|
||||
/** Tab name. */
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Options array.
|
||||
*/
|
||||
/** Options array. */
|
||||
public GameOption[] options;
|
||||
|
||||
/**
|
||||
* Associated tab button.
|
||||
*/
|
||||
/** Associated tab button. */
|
||||
public MenuButton button;
|
||||
|
||||
/**
|
||||
|
@ -149,26 +134,18 @@ public class OptionsMenu extends BasicGameState {
|
|||
public OptionTab prev() { return values[(this.ordinal() + (SIZE - 1)) % values.length]; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Current tab.
|
||||
*/
|
||||
/** Current tab. */
|
||||
private OptionTab currentTab;
|
||||
|
||||
/**
|
||||
* Max number of options displayed on one screen.
|
||||
*/
|
||||
/** Max number of options displayed on one screen. */
|
||||
private int maxOptionsScreen = Math.max(
|
||||
Math.max(OptionTab.DISPLAY.options.length, OptionTab.MUSIC.options.length),
|
||||
Math.max(OptionTab.GAMEPLAY.options.length, OptionTab.CUSTOM.options.length));
|
||||
|
||||
/**
|
||||
* Key entry states.
|
||||
*/
|
||||
/** Key entry states. */
|
||||
private boolean keyEntryLeft = false, keyEntryRight = false;
|
||||
|
||||
/**
|
||||
* Game option coordinate modifiers (for drawing).
|
||||
*/
|
||||
/** Game option coordinate modifiers (for drawing). */
|
||||
private int textY, offsetY;
|
||||
|
||||
// game-related variables
|
||||
|
@ -241,7 +218,7 @@ public class OptionsMenu extends BasicGameState {
|
|||
break;
|
||||
}
|
||||
}
|
||||
for (OptionTab tab : OptionTab.valuesReversed()) {
|
||||
for (OptionTab tab : OptionTab.VALUES_REVERSED) {
|
||||
if (tab != currentTab)
|
||||
Utils.drawTab(tab.button.getX(), tab.button.getY(),
|
||||
tab.getName(), false, tab == hoverTab);
|
||||
|
|
|
@ -62,33 +62,21 @@ import org.newdawn.slick.state.transition.FadeOutTransition;
|
|||
* </ul>
|
||||
*/
|
||||
public class SongMenu extends BasicGameState {
|
||||
/**
|
||||
* The number of buttons to be shown on each screen.
|
||||
*/
|
||||
/** The number of buttons to be shown on each screen. */
|
||||
private static final int MAX_BUTTONS = 6;
|
||||
|
||||
/**
|
||||
* Delay time, in milliseconds, between each search.
|
||||
*/
|
||||
/** Delay time, in milliseconds, between each search. */
|
||||
private static final int SEARCH_DELAY = 500;
|
||||
|
||||
/**
|
||||
* Maximum x offset of song buttons for mouse hover, in pixels.
|
||||
*/
|
||||
/** Maximum x offset of song buttons for mouse hover, in pixels. */
|
||||
private static final float MAX_HOVER_OFFSET = 30f;
|
||||
|
||||
/**
|
||||
* Song node class representing an OsuGroupNode and file index.
|
||||
*/
|
||||
/** Song node class representing an OsuGroupNode and file index. */
|
||||
private static class SongNode {
|
||||
/**
|
||||
* Song node.
|
||||
*/
|
||||
/** Song node. */
|
||||
private OsuGroupNode node;
|
||||
|
||||
/**
|
||||
* File index.
|
||||
*/
|
||||
/** File index. */
|
||||
private int index;
|
||||
|
||||
/**
|
||||
|
@ -112,56 +100,36 @@ public class SongMenu extends BasicGameState {
|
|||
public int getIndex() { return index; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Current start node (topmost menu entry).
|
||||
*/
|
||||
/** Current start node (topmost menu entry). */
|
||||
private OsuGroupNode startNode;
|
||||
|
||||
/**
|
||||
* Current focused (selected) node.
|
||||
*/
|
||||
/** Current focused (selected) node. */
|
||||
private OsuGroupNode focusNode;
|
||||
|
||||
/**
|
||||
* The base node of the previous focus node.
|
||||
*/
|
||||
/** The base node of the previous focus node. */
|
||||
private SongNode oldFocusNode = null;
|
||||
|
||||
/**
|
||||
* Stack of previous "random" (F2) focus nodes.
|
||||
*/
|
||||
/** Stack of previous "random" (F2) focus nodes. */
|
||||
private Stack<SongNode> randomStack = new Stack<SongNode>();
|
||||
|
||||
/**
|
||||
* Current focus node's song information.
|
||||
*/
|
||||
/** Current focus node's song information. */
|
||||
private String[] songInfo;
|
||||
|
||||
/**
|
||||
* Button coordinate values.
|
||||
*/
|
||||
/** Button coordinate values. */
|
||||
private float
|
||||
buttonX, buttonY, buttonOffset,
|
||||
buttonWidth, buttonHeight;
|
||||
|
||||
/**
|
||||
* Current x offset of song buttons for mouse hover, in pixels.
|
||||
*/
|
||||
/** Current x offset of song buttons for mouse hover, in pixels. */
|
||||
private float hoverOffset = 0f;
|
||||
|
||||
/**
|
||||
* Current index of hovered song button.
|
||||
*/
|
||||
/** Current index of hovered song button. */
|
||||
private int hoverIndex = -1;
|
||||
|
||||
/**
|
||||
* The options button (to enter the "Game Options" menu).
|
||||
*/
|
||||
/** The options button (to enter the "Game Options" menu). */
|
||||
private MenuButton optionsButton;
|
||||
|
||||
/**
|
||||
* The search textfield.
|
||||
*/
|
||||
/** The search textfield. */
|
||||
private TextField search;
|
||||
|
||||
/**
|
||||
|
@ -170,29 +138,19 @@ public class SongMenu extends BasicGameState {
|
|||
*/
|
||||
private int searchTimer;
|
||||
|
||||
/**
|
||||
* Information text to display based on the search query.
|
||||
*/
|
||||
/** Information text to display based on the search query. */
|
||||
private String searchResultString;
|
||||
|
||||
/**
|
||||
* Loader animation.
|
||||
*/
|
||||
/** Loader animation. */
|
||||
private Animation loader;
|
||||
|
||||
/**
|
||||
* Whether or not to reset game data upon entering the state.
|
||||
*/
|
||||
/** Whether or not to reset game data upon entering the state. */
|
||||
private boolean resetGame = false;
|
||||
|
||||
/**
|
||||
* Whether or not to reset music track upon entering the state.
|
||||
*/
|
||||
/** Whether or not to reset music track upon entering the state. */
|
||||
private boolean resetTrack = false;
|
||||
|
||||
/**
|
||||
* Beatmap reloading thread.
|
||||
*/
|
||||
/** Beatmap reloading thread. */
|
||||
private Thread reloadThread;
|
||||
|
||||
// game-related variables
|
||||
|
|
|
@ -45,19 +45,13 @@ import org.newdawn.slick.state.StateBasedGame;
|
|||
* Loads game resources and enters "Main Menu" state.
|
||||
*/
|
||||
public class Splash extends BasicGameState {
|
||||
/**
|
||||
* Whether or not loading has completed.
|
||||
*/
|
||||
/** Whether or not loading has completed. */
|
||||
private boolean finished = false;
|
||||
|
||||
/**
|
||||
* Loading thread.
|
||||
*/
|
||||
/** Loading thread. */
|
||||
private Thread thread;
|
||||
|
||||
/**
|
||||
* Number of times the ESC key has been pressed.
|
||||
*/
|
||||
/** Number of times the 'Esc' key has been pressed. */
|
||||
private int escapeCount = 0;
|
||||
|
||||
// game-related variables
|
||||
|
|
Loading…
Reference in New Issue
Block a user