Commit Graph

23 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
8671718ce3 Moved most GameImage scaling/processing to a single file.
- To scale an image, override process_sub() in its enum definition.  All GameImages call the process() method when loaded.
- Skin GameImage overrides will now call process() immediately, so there's no more need for the hackish scaling status.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2015-01-07 22:36:39 -05:00
Jeffrey Han
7a187c4e4f Game mod refactoring.
- Created "GameMod" enum to handle all mod-related actions and store all related data.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-16 16:01:36 -04:00
Jeffrey Han
83f13a8879 Added options for global fixed difficulty settings (CS, HP, AR, OD).
- Added a new tab in Game Options screen containing the values.

Other changes:
- Corrected "Hard Rock" difficulty modifiers.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-05 01:24:01 -04:00
Jeffrey Han
06f8dae037 Reduced unnecessary reloading of default images. (follow-up 16afcaf)
- GameImage now stores both a default image and skin image, returning the skin image whenever available.
- Default images are loaded once on startup, instead of before every game.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-04 19:59:57 -04:00
Jeffrey Han
16afcaf3e6 Added initial support for loading beatmap skins.
- Added a GameImage enum for more organized loading of image resources.
- Game image loading now takes place directly before each beatmap is loaded.
- Added option 'IGNORE_BEATMAP_SKINS' to disable this feature.

Other changes:
- Slight correction in readme file: apparently the JAR will not run in the osu! program folder.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
2014-07-04 16:41:52 -04:00