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:
Jeffrey Han
2015-01-22 00:44:45 -05:00
parent d6c7476b88
commit c9e14bfc70
32 changed files with 527 additions and 1008 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
);
}

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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