Commit Graph

588 Commits

Author SHA1 Message Date
fd
07f6ef9479 Comments for previous commit 2015-01-29 00:37:25 -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
fd
33f2207881 CircumscribedCircle, LinearBezier Curves, multi repeats arrows,
CircleColorOrdering

fd
2015-01-28 00:30:51 -05:00
Jeffrey Han
f71b2c25f2 Quick fix: 'Esc' key not properly checked in splash screen.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-27 15:20:03 -05:00
Jeffrey Han
71edef2fa9 Fixed server socket being closed after a restart.
Prevents a bug where multiple program instances can be run.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-27 05:49:58 -05:00
Jeffrey Han
44bdf70c98 Renamed GameScore class to GameData.
Makes more sense, since the class is responsible for more than just the score.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-27 03:19:39 -05:00
Jeffrey Han
ef9e38bf2d Minor scorebar updates.
- Support loading scorebar-bg animations.
- Slight changes to scaling and positioning of scorebar-bg.  This still isn't quite correct (TODO).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-25 18:36:54 -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
d2b3249e2c Follow-up to 924f528: small fix.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-23 16:11:10 -05:00
Jeffrey Han
924f528881 Don't reset track to preview position unless game is complete.
(conforming to osu! behavior)

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-23 16:06:57 -05:00
Jeffrey Han
423866c222 Replaced GameScore.GRADE_* constants with an enum.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-22 15:12:15 -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
d6c7476b88 Removed some unnecessary SlickException throwing/catching.
Mostly leftovers from moving Image creation to GameImage.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-21 18:56:53 -05:00
Jeffrey Han
e02cf60312 Added multi-image support to GameImage.
- Allows loading an undetermined number of files using a format string (e.g. combo bursts, slider balls).
- Fixes bug with those images not being properly reloaded.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-21 17:10:31 -05:00
Jeffrey Han
131c8a5637 Quick fix: lighting images weren't being reloaded properly.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-21 03:47:47 -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
ee617c0710 Updating version to 0.4.0.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-21 02:37:02 -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
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
e2c1f2f937 Small memory optimization: reuse audio File objects in song groups.
Each song group references the same audio file probably 100% of the time, so don't create duplicate objects.

Also, follow-up to 3b13cc7: the up/down arrow keys now change global volume in the main menu and game states (in addition to the scroll wheel).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-20 22:19:14 -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
f9c0794693 Save screenshots in a new thread.
Use BufferedImage/ImageIO instead of ImageOut (not threadable).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-20 00:54:12 -05:00
Jeffrey Han
95775d8e73 Preload game images when program initializes.
Reverted earlier change to load images immediately before a game begins, since there is a noticeable lag in some cases.

Other changes:
- Added 'preload' field to GameImage.
- Changed 'gameImage' field in GameImage to 'skinnable' (more suitable name).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-18 17:01:13 -05:00
Jeffrey Han
53158fd310 Interrupt OsuParser by pressing 'ESC' in Splash state.
Allows parsing only a subset of OsuFiles, in case parsing takes too long.

Other changes:
- Press 'ESC' three times to exit from the Splash state.
- Override Container.exit().
- Reset MusicController in closeRequested() to prevent an OpenAL error.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-18 15:26:00 -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
2f56bca9f7 Small GUI tweaks.
- FPS display is now much more subtle.
- A couple of main menu tweaks.

Other changes:
- Restore old alpha levels of Utils.COLOR_* constants when modifying them.
- Utils.loadFont() can load any font effect, not just a ColorEffect.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-18 12:39:30 -05:00
Jeffrey Han
d92e67e5f1 More quick fixes.
- Minor typo in ErrorHandler.
- Prevent more than one music control button in the main menu from being hovered over at once.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-17 00:44:23 -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
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
816c9bb659 Quick bug fixes.
- Checkpoint loading now works again. (blame: 9e69afa)
- Forgot to check for VSync when application initializes. (blame: 97f3aad)
- Also clear game data after finishing a checkpoint game.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 14:10:42 -05:00
Jeffrey Han
09a5979475 Added a button to link to GitHub repository in main menu.
GitHub "mark" image is from: https://github.com/logos

Also changed default screen resolution to 1024x768 since it's more likely to be supported.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 13:42:54 -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
7bd9eba2f5 Added HitObject interface for OsuHitObjects during gameplay.
This greatly simplifies object-handling code, and is slightly more time and memory efficient.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 03:47:37 -05:00
Jeffrey Han
bcf1fa301a Implemented mod shortcut keys in options menu.
See for details: http://osu.ppy.sh/wiki/Shortcut_Key_Reference#Mods_screen

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-16 02:26:13 -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
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
f8dad2889f Added support for multiple GameImage file extensions.
Specifically, the main menu background and pause/fail backgrounds now accept JPGs as well as PNGs.

Other changes:
- Don't draw the default pause/fail background if the buttons are skinned and the background is unskinned.
- Preload logo and main menu background.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-15 18:16:46 -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
9db9c2f3ad Add more options to crash popup.
Options: "Send Report" (opens GitHub issues and log file), "View Error Log" (opens log file), "Close" (does nothing).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-15 04:16:20 -05:00
Jeffrey Han
09d96f3f08 Automatically open the log file when opsu! crashes.
- Sends a JOptionPane message dialogue if java.awt.Desktop is supported.

Other changes:
- Updated natives directory, and set the LWJGL library path if it exists.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-15 02:47:48 -05:00
Jeffrey Han
97f3aad772 Enable VSync when target FPS is 60.
Other changes:
- Write actual resolution and FPS values to config file instead of array indexes.
- Rewrote resolutions[][] array as an enum.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-15 01:52:16 -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