Commit Graph

42 Commits

Author SHA1 Message Date
Jeffrey Han
6506967c12 Added some missing @param and @throws Javadoc comments.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-09-09 23:51:16 -04:00
Jeffrey Han
ae5016f3ab Validate audio files before trying to load them. (part of #120)
Also fixed an issue where songMenu.resetGameDataOnLoad() sometimes wasn't being called when it should be (e.g. after playing a beatmap, if you move to a different screen, your score won't appear in the song menu right away).  It's now being called more often than necessary, but that should be fine.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-08-20 22:58:45 -05:00
Jeffrey Han
f3825eba5e Added many missing Javadocs; other minor cleanup.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-05-29 06:06:37 -04:00
Jeffrey Han
00a08f1327 Renamed "OsuParser" to "BeatmapParser"; moved into "opsu.beatmaps".
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-05-29 03:07:58 -04:00
Jeffrey Han
53c79c5d85 Major refactoring - now using far more logical class names.
- Renamed "OsuFile" to "Beatmap".  All related variables and methods with "osu" have also been renamed to "beatmap" (or variants of each).
- Renamed "OsuGroupNode" to "BeatmapSetNode".  Avoids confusion since groups are identified by a "set ID", not a "group ID".
- Renamed "OsuGroupList" to "BeatmapSetList", for the same reason as above.
- Renamed "OsuDB" to "BeatmapDB", for the same reason as above.
- Moved classes directly related to parsed beatmaps (Beatmap, BeatmapSetList, BeatmapSetNode, OsuHitObject, and TimingPoint) into a new "beatmap" package.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-05-16 21:25:19 -04:00
Jeffrey Han
2efb18e225 Follow-up to #68.
Fixes:
- Set the modified speed again after unpausing and loading from checkpoints.
- Changed countdown delays based on current speed.
- Changed color of highlighted song info text to that in osu!.
- Made playback images unskinnable.

Code changes:
- Changed playback field in Game class to the PlaybackSpeed object instead of just the button.
- Changed PlaybackSpeed.next() to a non-static method.
- Added/edited Javadocs.
- Changed image names.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-04-03 18:08:35 -04:00
Pavel Kolchev
d8425197a7 Implement playback speed in replays. 2015-04-02 19:38:45 +03:00
Pavel Kolchev
5f3ce74c64 Implemented half/double time mod.
Dynamic bpm, map length in song select menu.
Fixed replay and spinner with these mods.
2015-03-31 18:14:52 +03:00
Jeffrey Han
c15cd5cb4c Follow-up to a6ece30: allow changing volume anywhere with ALT key.
The master volume can now be changed (using the mouse wheel) with the ALT key pressed in any menu, as in osu!.

Also improved the handling of dimmed tracks.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-26 20:45:33 -04:00
Jeffrey Han
e6576bd7f9 Glyph loading fixes and improvements (for Unicode fonts).
- Glyphs are now loaded for specific fonts as needed, not for all of them at once.  This reduces lag and saves memory.
- Fixed glyphs not being loaded in the downloads menu.
- Moved Utils.loadGlyphs() calls directly above text drawing code (easier to maintain, and fixes a bug with text flickering once).

Also removed MusicController methods 'getTrackName()' and 'getArtistName()' (not needed).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-19 16:45:26 -04:00
Jeffrey Han
ec042159a8 Added track previews to the downloads menu.
Currently uses the osu! server to load MP3 previews.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-19 15:58:50 -04:00
Jeffrey Han
7d5899ba7e Fixed a major memory leak caused by MusicController.getDuration().
Blame: f23159d

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-19 04:47:02 -04:00
Jeffrey Han
f23159d003 Added method to get duration of MP3s.
Currently used for the music bar in the main menu.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-16 13:16:30 -04:00
Jeffrey Han
dc26f6c131 TextField updates, and bug fixes from some recent commits.
- Added modified copy of slick.gui.TextField: added CTRL+BACKSPACE for word deletion, and disabled left/right arrows to move cursor and CTRL+Z to undo.
- Fixed musicEnded() incorrectly setting the "trackEnded" upon swapping tracks.  This has caused some nasty loops since #38.
- Fixed a null pointer exception in OsuDB from 0b03912.
- Fixed the song menu search bar transition being incorrectly reset when hitting backspace on a 0-length query.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-03-08 16:34:28 -04:00
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
fd
2825f4c885 Fixes Music Ended (hopefully) 2015-02-21 20:14:48 -05:00
Jeffrey Han
329d54c230 Minor changes.
- Replaced duplicate GameImage.process_sub() calls from related images with calling a single method, for easier editing.
- Suppress warnings from overwritten Slick2D classes.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-16 01:24:22 -05:00
Jeffrey Han
54806303f4 Reformatting of #17 and #18, and minor bug fix in #17.
Fixed not losing any health at near-zero rotation angles.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-14 01:07:17 -05:00
Jeffrey Han
4920508060 Quick fix for song groups with different preview times.
Also moved some negative track position checks around to catch more cases.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-12 14:52:51 -05:00
Jeffrey Han
f6eec5cd6c Follow-up to #15.
- Removed the temporary directory (Options.TMP_DIR), which is no longer needed.
- Excluded original Slick2D classes that were overridden in pom.xml.
- Formatting changes and documentation.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-02-12 03:52:19 -05:00
fd
a0bf2293cf Clean up and it doesn't throw that slick exception anymore. 2015-02-11 22:41:20 -05:00
fd
08406ac038 Changed some methods in OpenALStreamPlayer to synchornized methods.
Seems to work with ogg now too.

Hopefully this fixes it, but I don't 
actually know much about concurrency.

However it stills throws "Could not clear SoundStore sources, err"
and so it remains removed.
2015-02-09 21:33:37 -05:00
fd
6883e2ab44 MP3 Audio Streaming through modifying some of slick's openal files
May rarly crash/not play on next music.
May have introduced other unknown bugs. 
This may be due to loading it async.
Also loading of ogg is not loaded async anymore as it seems it doesn't
work very well.
2015-02-08 23:48:55 -05:00
Jeffrey Han
84e463e8fb Added a listener for the end of music tracks.
Fixes a bug during gameplay where if the music track ends before the last hit object is processed (esp. spinners), the game would hang.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-29 21:24:21 -05:00
Jeffrey Han
6fa8df955f Minor theme song fix.
Prevents a bug due to threading where the theme song can still be playing in the song menu (when songs are loaded) if the user clicks fast enough.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-29 03:57:55 -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
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
19476993f9 Options state refactoring.
- Renamed Options state into OptionsMenu, and created Options class for solely handling user options.  Moved everything unrelated to the actual options menu into the static Options class.
- OptionsMenu no longer has static fields.
- Refactored option tabs into an enum, which makes the code much cleaner.

Also fixed a bug where global volume wasn't being used on container initialization.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-20 23:56:10 -05:00
Jeffrey Han
2bc45bec0a Follow-up to f98edf8: better checks for application restart.
- Fixes resource reloading when OsuGroupList is empty (i.e. if user has no beatmaps installed).
- OsuGroupList is no longer initialized with a class instance; OsuGroupList.create() is called by OsuParser.
- Also clear 'lastOsu' field in MusicController.reset().  Fixes theme song not playing on restart if it was the last track played (i.e. if no beatmaps installed).
- Call MusicController.reset() last so that more garbage is collected.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-20 19:24:59 -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
ee17b20b25 Added wrapper around AppGameContainer to catch critical errors.
Critical game errors (detected in Game.updateAndRender()) are now passed through ErrorHandler.  Note that the actual exception is not displayed in the ErrorHandler window, only the log.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-18 14:29:48 -05:00
Jeffrey Han
f5df00255f Moved track volume dimming into MusicController.
- Fixes an issue where the first few milliseconds of the theme song would always play at full volume, even if container is not focused.
- Allows easier application to any song.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 16:02: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
b54eb95747 Updated copyright notices for 2015.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 12:05:44 -05:00
Jeffrey Han
553f091693 Added ErrorHandler class to handle all critical errors.
This mostly replaces the Slick2D Log class for error reporting.  Most game errors will now trigger the error popup.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-15 21:55:26 -05:00
Jeffrey Han
516e6280c7 Call System.gc() on track changes and game resets.
This causes a noticeable drop in memory usage in most cases.

Also renamed the "crash" popup since the game doesn't necessarily crash.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-15 16:47:55 -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
1e59819f3a Dim theme song volume when window is not focused.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-10 20:14:39 -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