Commit Graph

81 Commits

Author SHA1 Message Date
Jeffrey Han
8c24ef97c7 Follow-up to #38: loop tracks on states by default.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-07 19:04:45 -05:00
fd
11b5c41b46 Next track on trackEnded
(but checks trackended every update...)
Continue playing while minimized(does not fix moving)
start from preview time in songMenu on repeat
2015-03-07 15:31:21 -05:00
Jeffrey Han
81601d41aa Implemented various keyboard shortcuts.
- Main menu:
-- 'd': opens downloads menu
-- 'r': plays random track
- Song menu:
-- SHIFT+DEL: opens beatmap deletion menu

Other changes:
- In the main menu, tracks now play from the beginning instead of the preview time.
- Fixed "next page" icon sometimes showing in the downloads menu when a next page didn't exist.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-06 01:29:50 -05:00
Jeffrey Han
cf9b22442f Added global F7 and F10 shortcuts.
- F7: cycles through FPS settings.
- F10: toggles mouse enable/disable state during gameplay.

Also added bar notifications for saving/loading checkpoints.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-05 14:40:57 -05:00
Jeffrey Han
235adc539e Extracted UI components from Utils into a separate UI class.
Added draw(), update(), and enter() methods in UI to do all the necessary calls (instead of letting the states handle them).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-05 13:27:45 -05:00
Jeffrey Han
bf04083ebd Added a beatmap cache database.
- New database ".opsu.db" stores a cached copy of all parsed beatmaps.  All data will be read from this database unless the last modified time of a beatmap file does not match the one in the table.
- OsuParser inserts all new entries to the database in batch after parsing.
- Added *toString()/*fromString() methods for 'breaks', 'timingPoints', and 'combo' fields in OsuFile for use with the database.
- For any database format changes, update the DATABASE_VERSION field in OsuDB.
- Reloading beatmaps (F5) will now clear the beatmap cache.

Related changes:
- Added small DBController class for convenience.
- Changed 'bg' field of OsuFile to only contain the image file name, instead of the full path.
- Deleted printDatabase() method from ScoreDB.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-04 21:03:06 -05:00
fd
f9f95aae11 Merge remote-tracking branch 'ita/master' into AudioTest
Conflicts:
	src/itdelatrisu/opsu/states/SongMenu.java
2015-03-01 13:14:44 -05:00
fd
04bfbc70fc Addition/Edge Addition SampleSet
Minor fix with combo colors and spinners
2015-03-01 11:06:46 -05:00
Jeffrey Han
c543ddea01 Follow-up to #25.
- Moved all MultiClip-handling methods into the MultiClip class.
- Destroy extra clips when starting and finishing new beatmaps.
- Reduced maximum number of extra clips to 20.
- Attempted fixes at multithreading issues.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-01 00:03:06 -05:00
Jeffrey Han
163e72d423 Made sliders very slightly easier.
Sliders no longer need to be held to the end, but near it (within a 300-hit offset) for perfect hit.

Also made a slight improvement to SongMenu.setFocus().

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-21 17:12:18 -05:00
Jeffrey Han
dfeb93d696 Follow-up to ab1a377: now using Graphics.setClip().
Partial revert of changes made in that commit; also made song menu header/footer partially transparent again.  Thanks to @fluddokt.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-19 23:45:48 -05:00
Jeffrey Han
ab1a377be0 Minor graphical changes.
- Added a simple color change when hovering over an option in the options menu.
- Draw part of the song button before the start node, if any, for a more complete-looking scroll animation.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-19 02:43:26 -05:00
Jeffrey Han
25a7a826f1 More graphical updates, some code cleanup, and minor fixes.
- The MenuButton class now fully supports hover effects (scale, fade, rotate) for Animations.
- Used a fixed location for the selection buttons in the song menu (previously based on the "back" button width, which varies widely in different skins).
- Added hover effects for "retry" and "exit" buttons in the ranking screen.
- Changed animation speed of back/skip buttons.
- Fixed a bug where main menu showed the incorrect number of songs loaded during searches.
- Removed unneeded draw() methods in Utils for color filters (since 69f5aa5).
- Moved Utils.drawCentered(Image, ...) into the Image class.
- Added overwritten Image class to Maven excludes.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-19 00:33:32 -05:00
Jeffrey Han
1a4120a736 Follow-ups to #21.
- Reverted "Extends ScoresData bg to clock", as this was intended behavior.
- Fixed overlapping text in the options menu, and made it look more similar to the other menus.
- Fixed issues with the text and icon in the song menu header in certain resolutions.
- Fixed minor issue with ranking screen header text positioning.
- Decreased skip button hover scale.
- Some code style changes.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-18 19:35:26 -05:00
fd
1dc71aaa7f Merge quick bad fix 2015-02-17 22:54:20 -05:00
fd
65e538fbdc Merge remote-tracking branch 'orgin/master' into omaster
Conflicts:
	src/itdelatrisu/opsu/GameImage.java
	src/itdelatrisu/opsu/OsuGroupNode.java
2015-02-17 22:49:19 -05:00
Jeffrey Han
69f5aa5748 Added a separate Game Mods menu.
- Replaces the mods being shown in the options menu.
- Added all the (base) mod icons to the menu, with the unimplemented ones grayed out.
- Added a rotation effect to MenuButton, and now multiple effects can be set at once.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-16 17:53:24 -05:00
fd
e02b195b71 Hard coded Ranking Panel
Hard coded Scorebar
Made MenuButtonBG colours darker
Extends ScoresData clock bg
More General Scaling
2015-02-16 11:34:35 -05:00
Jeffrey Han
66016160a4 Song menu graphical updates.
- Added "selection-*" images from Xiaounlimited's "Nexus Ivory" skin.  These do the same thing as the F1-F3 keyboard buttons in the song menu.
- Removed the old wrench icon and replaced it with an "Other Options" button. F1 no longer opens the options menu.
- Moved the search bar to under the tabs and better simulate osu! behavior.  Removed the old search icon.
- Added solid black bars at the top and bottom of the song menu.  Moved the top divider closer to the end of the information text.  Cropped song button images to fit between the bars.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-15 21:38:54 -05:00
Jeffrey Han
c2793ae31c Some graphical improvements and fixes.
- The music position bar in the main menu is now clickable (changes track position).
- Fixed scroll bar height function, and merged all scroll bar drawing into a single Utils.drawScrollbar() method.
- Fixed the buggy song menu scroll bar.
- Scaled the sizes/positions of the main menu music icons (previously fixed/hardcoded).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-15 00:25:07 -05:00
Jeffrey Han
7cc4ff51d0 Follow-up to c6791c4.
- Added score management menu for deleting individual scores.
- Store generated title string lists in the beatmap menus to prevent performance issues.

Allow using the right mouse button (as well as left mouse button) in all states.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-13 03:45:38 -05:00
Jeffrey Han
c6791c4714 Added new menus, implemented using a generic ButtonMenu state.
New menus: beatmap options (erase scores/delete), delete beatmaps (single/all), reload songs.
- Pressing F3 or right-clicking in the song menu state will open the beatmap options menu.
- Pressing F5 in the song menu now opens a confirmation menu before reloading beatmaps.
- Deleted MainMenuExit state, which is replaced by MenuState.EXIT in ButtonMenu.
- Decreased Utils.FONT_XLARGE size (to fit in buttons).

Note: as of 800014e, song directory deletion is broken.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-13 02:43:34 -05:00
Jeffrey Han
b69ff68d7c Added methods to delete songs and song groups.
- OsuGroupList.get().deleteSongGroup() will delete a song group from the list.
- OsuGroupList.get().deleteSong() will delete an individual song from the list (must be expanded), and will delete the song group if there are no remaining songs in the group.
- If possible, deleted beatmap files are moved to system trash (using JNA); otherwise, they are deleted immediately.  This is done through Utils.deleteToTrash().

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-12 02:27:33 -05:00
Jeffrey Han
99bc944ed6 Minor updates.
- Draw the playfield background in the song menu if a background cannot be drawn for the focused beatmap.
- Added ScoreDB.deleteScore() method to delete a score from the database.
- Added @author tags for curve-related classes (by fluddokt, #12).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-11 02:56:02 -05:00
Jeffrey Han
f56c02864b Updates and fixes from fluddokt/opsu@76778f8 and fluddokt/opsu@cf321e9.
- Rotate slider ball image along the curve.
- Show download speed and time remaining when hovering over the download info button.
- Maintain aspect ratio of beatmap background image during gameplay.
- Clear beatmap background image cache after reaching OsuFile.MAX_CACHE_SIZE.
- Multiply hit circle size by OsuHitObject.getXMultiplier().
- Scale MENU_BUTTON_BG based on SongMenu.MAX_SONG_BUTTONS.
- Fixed download search TextField retaining focus even after leaving the downloads menu.
- Include Unicode title/artist strings in searches.
- Parse x,y beatmap coordinates as floats (instead of integers), and only read Kiai time if present.
- Added 1600x1200 resolution.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-09 21:40:38 -05:00
Jeffrey Han
ec90d6fd03 Beatmap downloader improvements and fixes.
Updates:
- Added some buttons to downloads menu: clear inactive downloads, import beatmaps, reset search, and show/hide unranked maps.
- Small changes to OsuParser, OszUnpacker, and OsuGroupList (mostly adding return values) to allow parsing only newly unpacked beatmaps.
- Added alpha fade hover effect to MenuButton, as an alternative to expanding (used for 3-part menu buttons).
- Added text rendering fields to MenuButton (also for the 3-part menu buttons).
- Added sound effects to downloads menu.

Fixes:
- Check downloads for illegal filename characters, and remove them if necessary.
- The number of results and downloads shown now supports all resolutions.
- Confirmation dialog no longer appears when restarting the application (since downloads are static).
- Do not set a focus node immediately if the theme song will be played.
- Always play the theme song if no songs are loaded (even if disabled in settings).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-02 00:15:16 -05:00
Jeffrey Han
70c70fd812 Implemented an internal beatmap downloader (using Bloodcat).
The downloads menu can be accessed through the button on the right side of the main menu.  The downloader supports searching and concurrent downloads (NOTE: this is limited by the download server!).  Double-click any search result to begin downloading it to the SongPacks directory; cancel the download by hitting the red 'x' in the upper-right corner.  A confirmation will appear if trying to quit opsu! while downloads are running.

New classes:
- Download: represents an individual download from a remote address to a local path, and provides status and progress information; downloads files using Java NIO.
- DownloadNode: holds a Download object as well as additional beatmap fields, and handles drawing.
- DownloadList: manages the current list of downloads.
- DownloadsMenu: game state controller.
- DownloadServer: interface for a beatmap download server.
- BloodcatServer: implements DownloadServer using Bloodcat.
- ReadableByteChannelWrapper: wrapper for ReadableByteChannel that tracks progress.

Added images:
- "downloads" image by @kouyang.
- "search-background" image from "Minimalist Miku" skin (listed in credits).
- "delete" icon by Visual Pharm (https://www.iconfinder.com/icons/27842/) under CC BY-ND 3.0.

Other changes:
- Added up/down/left/right Expand directions to MenuButton class.
- Removed width/height parameters from OsuParser (leftovers).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-01 02:10:17 -05:00
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