Commit Graph

54 Commits

Author SHA1 Message Date
Jeffrey Han
e93fe25834 Code style cleanup from #12.
- Moved all curve-related classes into a new package.
- Added some fields and methods to Curve abstract class.
- Removed the old (no longer used) Bezier subclass.
- Changed Error throwing to ErrorHandler.error() calls.
- Formatted code.

Also fixed a crash when reaching the ranking screen with the "Auto" mod active.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-29 20:36:23 -05:00
Jeffrey Han
baba1540a5 Javadoc fixes.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-29 03:17:53 -05:00
Jeffrey Han
f0858f657b Display time since achieving recent scores.
- Added history icon by Google: https://www.iconfinder.com/icons/326655/
- Draw history icon and elapsed time next to score buttons if they were achieved within 24 hours.  Conforming to osu! behavior, the elapsed time is not updated in real-time.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-29 03:05:09 -05:00
Jeffrey Han
1ddeb3461d Moved ScoreData to separate file and renamed Scores to ScoreDB.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-29 00:56:30 -05:00
Jeffrey Han
2007058eb1 Quick fixes.
- Fixed a crash when closing the application in the ranking screen when viewing a score.
- Fixed a minor bug where OsuGroupList fields were not being erased upon restart.
- Dim the track volume by 50% when viewing a score.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-28 20:57:43 -05:00
Jeffrey Han
ce15f25ca1 Added score-viewing components to the song menu. [Completes 0bd72e7]
Added a scrollable score history area in the song menu.  Clicking on any score button will open the ranking screen.

Details:
- All drawing is performed by ScoreData.
- Store scores for the current focus node, and display up to "MAX_SCORE_BUTTONS" at a time; "startScore" is the starting index.
- When hovered over the score area, show scroll bar if needed.  When hovered over individual score buttons, change colors and show the rank.
- Scrolling with the mouse in the score area overrides song scrolling.
- Store scaled grade images as a Grade field.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-28 19:23:02 -05:00
Jeffrey Han
0bd72e731a Save game scores to an SQLite database. [Incomplete!]
Implemented basic features (mostly stable).  The remaining features are mostly graphical.
- Added package org.xerial.sqlite-jdbc.  All scores are saved to .opsu_scores.db on table `scores` after a game completes.
- Added "Scores" class to handle all game score data (including database connections).  The "Score" subclass encapsulates all database fields.
- Added "score viewing" constructor to GameData, for use only in the ranking screen.
- Draw the grade of the highest score next to expanded song buttons in the song menu.
- Added "bit" and "abbrev" fields to GameMod, used in storing/displaying scores.
- Hide the retry/exit buttons in the ranking screen when viewing a score.

Other changes:
- Removed "objectCount" field in GameData (no longer necessary).
- Removed "getID()" method in GameMod (no longer used).
- Moved most drawing in GameRanking state to GameData.
- Removed File parameter of "GameData.loadImages()" (leftover, no longer used).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-28 03:47:24 -05:00
Jeffrey Han
0c1b86de62 Cursor updates.
- Supported loading beatmap-skinned cursors.
- Moved cursor loading into GameImage.
- Removed unnecessary scalings/rotations when drawing.
2015-01-24 22:23:49 -05:00
Jeffrey Han
c9e14bfc70 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>
2015-01-22 00:44:45 -05:00
Jeffrey Han
873d913424 Quick fix: prevent search from executing on beatmap reload.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-21 03:25:19 -05:00
Jeffrey Han
a48f8bd54d Implemented in-game beatmap reloading.
- Press F5 to reload beatmaps in the song menu (resets OsuGroupList, then invokes OSZ unpacker and OsuFile parser).
- Many components reused from Splash screen (progress display, 'Esc' interrupt).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-21 01:38:02 -05:00
Jeffrey Han
f98edf8fc8 Enabled application restarts.
- Pressing Ctrl+Shift+F5 in the options menu restarts the game.  Beatmaps and sounds are not reloaded.
- Use GameContainer.setForceExit(false) to trigger a restart after exiting.

Other changes:
- Fixed general issues with track pausing/pause states.
- Store all background images loaded in OsuFiles in a static hash table, instead of in individual objects.  This allows easier access to the allocated memory.
- Only delete OSZ files if they were unzipped. (They were previously deleted in all cases.)
- Moved more images (mods, playfield, lighting) into GameImage.
- Moved OsuHitObject initialization inside Utils.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-20 19:01:18 -05:00
Jeffrey Han
3b13cc794b Implemented volume-bg and master volume setting.
- All sounds are now multiplied by a master volume setting.
- Changed all default volume levels.
- Scrolling in the main menu and game states changes the master volume and displays a volume bar on the right side of the screen.
- "volume-bg.png" image by @kouyang.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-20 14:52:02 -05:00
Jeffrey Han
31a97fbc5d Minor graphical updates and code cleaning.
- Padded game score display, and always display 2 digits in front of the decimal (e.g. 00.00% instead of 0.00%).
- Keep map progress circle at a fixed location instead of basing it off the score length.
- Moved some track resets (pause + restart at preview) to trigger upon loading the song menu.  Fixes weird behaviors when leaving the game state.
- Cleaned up trailing whitespace and added missing overrides.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 15:44:13 -05:00
Jeffrey Han
be1ec64f28 Eliminated unneeded calls to Graphics.setColor().
The method creates a new Color object each call, so set color in UnicodeFont.drawString() instead.

Also slightly padded the song information text.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 14:46:45 -05:00
Jeffrey Han
b54eb95747 Updated copyright notices for 2015.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 12:05:44 -05:00
Jeffrey Han
38b3621c29 Implemented Ctrl+Enter in song menu (play with "auto" mod).
Also made 'Esc' during gameplay return to the song menu immediately if the "auto" mod is active.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 02:00:42 -05:00
Jeffrey Han
78aabaa43e Implemented Shift+F2 in song menu (undo random map).
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 01:40:34 -05:00
Jeffrey Han
90c10d21da Follow-up to 516e628: Fix resetting game data too soon.
Instead of resetting immediately, set a variable in SongMenu to reset data when entering the state.  Fixes some weird behaviors, and also allows resetting in more scenarios.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 00:36:05 -05:00
Jeffrey Han
b856e2924c Minor updates and code improvements.
- MusicController.getPosition() now returns time even when track is paused. (e.g. song progress bar in main menu won't reset when paused)
- Force unpause track when entering the song menu.
- Rewrote Game.RESTART_* constants as enums.
- Cleaned up logo play/exit button scaling.
- MainMenu.previous is now non-static.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-15 00:56:30 -05:00
Jeffrey Han
03095733df Removed static fields in Game state.
Mostly merged from #8 (72e8a7e).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-14 23:57:50 -05:00
Jeffrey Han
64d961a8f9 Only load image resources when needed.
- Stop loading all images on startup.
- Game images are preloaded before the song starts.
- Destroy skin images immediately after finishing a beatmap, potentially saving lots of memory.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-14 23:10:19 -05:00
Jeffrey Han
62b7ecd648 Fixed a small bug with hovering over song buttons.
The left/right arrow keys no longer reset hover data if the start node hasn't changed.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-13 23:00:09 -05:00
Jeffrey Han
4152af4977 Made OsuGroupList a singleton.
(This makes a lot more sense than storing the single pointer in Opsu.groups.)

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-11 14:17:33 -05:00
Jeffrey Han
5a09689b4c Added mouse hover effects for tabs.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-10 23:14:22 -05:00
Jeffrey Han
6e434e9709 Improved appearance of tabs.
- Replaced 'selection-tab.png' with a new image (by @kouyang).
- Simulate osu! color scheme (tab color/font color changes instead of alpha changes for selected tab).
- Added Utils.drawTab() method to avoid code duplication for Option menu tabs.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-10 22:49:23 -05:00
Jeffrey Han
ab0d3d1528 Added mouse hover effects for song buttons in song menu.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-08 16:28:49 -05:00
Jeffrey Han
db4ca5f1d5 Minor optimizations.
- Only retrieve song information String[] when needed.
- Don't try to load glyphs if Unicode metadata is disabled.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-08 12:03:39 -05:00
Jeffrey Han
f6eac71643 Moved most Image creation into GameImage enum.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-07 23:45:21 -05:00
Jeffrey Han
1e806bc9c6 SoundController refactoring.
- Added enum classes SoundEffect and HitSound.
- Added a SoundComponent interface for sound effects and hit sounds, and extended playSound() and playHitSound() methods to play any SoundComponent.
- Moved features related to sample sets to the HitSound class, and rewrote sample sets as an internal enum class.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-07 19:29:51 -05:00
Jeffrey Han
b0649541eb Better emulation of main menu behavior.
- Pressing 'Esc' will now always enter the MainMenuExit state.
- Returning from MainMenuExit state does not reset button states: these must be manually reset by calling the reset() method.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-12-30 00:41:32 -05:00
Jeffrey Han
2592faec44 Renamed GUIMenuButton class to MenuButton.
The class was originally named with the intent of adding many other GUI classes, but this never happened.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-12-30 00:00:58 -05:00
Jeffrey Han
33f5df030c Expand menu buttons when hovering.
Added hovering capabilities to GUIMenuButton.  The max scale and direction to expand the image can be modified per object.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-12-23 23:41:37 -05:00
Jeffrey Han
ce0eccd32b Implemented skinnable theme songs.
Plays a theme song when opsu! starts (can be disabled in options).  The default song is "welcome to osu!" by nekodex, uploaded by CyberKitsune.

To change the song, place a new "theme.osu" in the skins folder and edit the file name, metadata, and song length (at minimum).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-12-20 18:17:04 -05:00
Jeffrey Han
9d3a12ad9c Display checkpoint time on game screen after loading.
Also fixed some indentation issues.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-12-20 15:30:20 -05:00
Jeffrey Han
904a54df26 Added support for Unicode (non-English) metadata.
- Setting is off by default, and can be switched on in the options menu.
- Changed default font to "Arial Unicode MS" (CJK), with fallback to "Lucida Sans Console" (non-CJK).  Cross-platform support may be added later.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-08-24 23:48:52 -04:00
Jeffrey Han
9a94c03b4e Use UnicodeFont instead of TrueTypeFont.
- Fixes issue #4.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-08-24 14:48:27 -04:00
Jeffrey Han
64788b2832 Song sort refactoring.
- Created "SongSort" enum to handle everything related to sorting OsuGroupNode objects.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-18 20:33:41 -04:00
Jeffrey Han
b0c0b44ef1 Major track length-related updates.
- Parse and store the end time for every beatmap (i.e. end time of last hit object).
- Added a 'length' sorting tab.
- Added 'length' search condition.
- Removed 'getTrackLength()' and 'getTrackLengthString()' methods, as they are no longer needed.
- Added a loader spritesheet animation to render during MP3 conversions (in place of track length rendering upon completion).

Other changes:
- Added a yellow progress circle during lead-in time.
- Fixed sorting tab positioning.
- Slightly increased button animation speed in "Main Menu Exit" state.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-17 21:16:15 -04:00
Jeffrey Han
4ecd50f488 Added support for conditional search expressions.
- Pattern: {type}{operator}{value}
-- Types: ar, cs, od, hp, bpm (length not yet implemented)
-- Operators: =/==, >, >=, <, <=

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-17 12:49:12 -04:00
Jeffrey Han
943c2af178 Resolved some reported issues.
- Threaded OGG loading (in addition to MP3) to eliminate delays in song select menu. (reported by xasuma)
- Changed default OSZ unpacking location to a "SongPacks" directory to prevent unintended unpacking. (reported by Lanturn)
- Fixed a null pointer for a corner case in 'getRandomNode()'. (reported by @iceblade112)

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-15 00:20:36 -04:00
Jeffrey Han
5aa9620834 Added option to disable sound effects from loading. (partially resolves issue #1)
- By default, sound effects will be disabled on Linux due to driver issues.

Other changes:
- Minor corner-case fix in song selection. (since 95f969f)

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-10 22:01:39 -04:00
Jeffrey Han
95f969f62f Major song menu improvements and fixes.
- Song group nodes are now hidden when the group is expanded.
- Setting a new focus will always move the focus into view.
- Left and right arrow keys now shift focus by exactly 1 node.
- Render the version string for unexpanded song group nodes containing only 1 beatmap.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-10 19:13:53 -04:00
Jeffrey Han
2ed8e66bbf Minor search feature fixes.
- Search textfield now properly retains focus in song selection menu.
- Clearing an invalid search no longer changes the current song.

Other changes:
- Fixed skip image not being resized correctly.
- Added menuclick sounds when selecting a new song.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-08 19:03:43 -04:00
Jeffrey Han
331f374a5b Better positioning of mod icons and song menu header text.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-08 13:38:16 -04:00
Jeffrey Han
a9cc7a3deb Scale and rotate the cursor.
- Cursor is now scaled based on window size.
- Cursor now rotates slowly (new style only).
- Cursor now expands upon mouse press.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-06 23:13:33 -04:00
Jeffrey Han
dea7e942a3 Created a splash screen state for loading resources.
- Game now boots to splash screen, which displays parser progress.
- Added option "LoadVerbose" to disable rendering the progress text.
- Main Menu backgrounds now fade in regardless of DynamicBackground setting (as a transition from the splash screen).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-05 21:00:52 -04:00
Jeffrey Han
0dbfd18c5f Added a few missing keyboard shortcuts.
- Main Menu: "P" (play), "Q" (quit)
- Game: Ctrl + "R" (restart)

Other changes:
- Song Menu search textfield no longer retains focus in different states.
2014-07-05 14:29:48 -04:00
Jeffrey Han
03be29307f Misc. bug fixes and improvements.
- Fixed Game not loading OsuFile for maps in a song group. (blame: 5612336)
- Implemented rotations for reverse arrows, and added a new one by Alic1a.
- "Auto" mod: pausing no longer requires click to unpause, and mod images are permanently drawn.
- Program now loads from Main Menu instead of Options (unnecessary complications for the sake of a transition).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-02 23:38:30 -04:00
Jeffrey Han
2c2f28b441 Game options overhaul & new options.
- Separated options into "Display", "Music", and "Gameplay" tabs.
- New options: VolumeHitSound, DimLevel, PerfectHit
- Added options that were previously missing from Game Options screen.
- Added sounds to Game Options screen.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-02 18:24:19 -04:00