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>
- 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>
- 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>
- 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>
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>
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>
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>
- 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>
- 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>
- 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>
- 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>
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>
- 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>
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>
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>
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>
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>
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>
- 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>
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>
- 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>
- 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>
- Load all OsuFile String objects into a hash table while parsing, to eliminate duplicate strings.
- Trim all ArrayList objects in OsuFiles.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- 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>
- 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>
- 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>
- 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>
- 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>
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>
When pressing the "next" button, songs will only be pushed when a new track plays. Fixes a potential null pointer crash.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
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>
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>
- 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>
- Properly handle bad input and log a warning. The game may run with some gameplay errors (ex. if no base TimingPoint is parsed), but it should not crash.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- All libraries are now packed as JARs, with sources and docs also packed and separated.
- Added .classpath and .project to version control.
- Updated ant build script.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Always use '.' as decimal separator in options file, regardless of locale.
- Properly handle bad input when initially parsing hit objects.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Fixed null pointer in "Main Menu" state if no tracks loaded. (since b0c0b44)
- Fixed "keyOsuLeft" and "keyOsuRight" writing KEY_NONE to configuration file on first run (instead of default values).
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Moved the bulk of hit object parsing into the OsuHitObject constructor, and made all fields private. Only combo-related data is still set by OsuParser.
- Added 'isCircle()', 'isSlider()', 'isSpinner()', and 'isNewCombo()' methods for convenience.
Other changes:
- Fixed difficulty overrides are no longer affected by game mods.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Game keys (default Z/X) can be changed to any letter or digit in the options screen.
Other changes:
- Mouse/keyboard input in the "Game Paused Menu" state is now the same as in the game state (i.e. all game keys available).
- Moved 'isInputKeyPressed()' into "Utils" class ("Game" state didn't even call it).
- Trimmed 'failsound.wav'.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- 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>
- Search is now more like osu!, where subsequent search terms limit the existing result list (as opposed to further expanding it).
- Replaced global tag HashMap with String instance variables, since the previous implementation is incompatible with the above change (resulting in slightly higher memory usage and search times).
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Halves all difficulty values and grants 3 "lives" instead of 1, with a score multiplier of 0.5x.
Other changes:
- Fixed score display in game state if score exceeds 8 digits.
- Added a "HP_DRAIN_MULTIPLIER" constant for steady HP drain/increase (to replace numeric constants).
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Modified "LoadVerbose" option so that 'false' will display a progress bar (instead of nothing at all), and made this the default.
- Slowed down a few shifting animations.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- 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>
Makes clicking the logo more similar to the real osu! game, where the Play options show when you click the logo the second time (after it was clicked first).
- 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>
- Players can no longer set a container size larger than the screen dimensions.
- If the game resolution is equal to the screen size, the created window will be borderless.
- Added some additional resolutions.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- 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>
- Overhauled OsuTimingPoint class: parsing is done in the constructor, and fields are no longer public.
- Improved consistency of static/non-static fields in a couple of classes.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- A checkpoint (track position) can be set in the options screen, and also while playing by pressing "CTRL+S".
- A checkpoint can be loaded by pressing "CTRL+L" while playing. This will reset all game data and begin from the checkpoint time; the ranking screen will be skipped upon song completion.
Other changes:
- Don't draw grade if no objects have been processed (previously defaulted to GRADE_D).
- Calculate slider start/end angles based on a step difference (previously an arbitrary 0.01 difference).
- Always end a slider curve base on the last control point.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- 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>
- Explicitly supply the AudioFormat when creating a Clip.
- Disable Master Gain if unsupported (e.g. in PulseAudio).
- Do not try to play uninitialized sounds (e.g. LineUnavailableException during creation, seems to happen regularly with PulseAudio).
Other changes:
- Errors replaced with debugs in 'getTrackLength()' if audio fields inaccessible.
- Do not log ThreadDeath exceptions (it's a known issue, and only clutters the log file).
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- 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>
- Added 'zip4j' library to ant build script.
Other changes:
- Added 'esc' hotkey to exit from splash screen.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Included 'zip4j' library to extract the ZIP archives. (Homepage: http://www.lingala.net/zip4j/)
- OSZ files are unpacked from the root directory by default, and the path can be changed in the configuration file.
Other changes:
- Fixed a critical issue in splash screen where thread would running before other states loaded. (blame: dea7e94)
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- 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>
- Main Menu: "P" (play), "Q" (quit)
- Game: Ctrl + "R" (restart)
Other changes:
- Song Menu search textfield no longer retains focus in different states.
- 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>
- 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>
- 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>
- Credits: https://osu.ppy.sh/forum/t/198483 (image by Xiaounlimited)
Other changes:
- Added "Unranked" text image, currently displayed for "Auto" mod plays only (image by XinCrin).
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- 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>
- 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>
- This can be switched off in the configuration file.
- Credits: https://osu.ppy.sh/forum/t/98954
Other changes:
- Removed OsuFile setters/getters from Game state, replaced with a 'getOsuFile()' method in MusicController (a more logical location).
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- "Skins" directory is created in the root folder, and reads files directly from there (for now). NOT ALL FILES ARE SUPPORTED.
- To change the path (e.g. to an installed skin), edit the path in the configuration file.
Other changes:
- Renamed some files: directories now begin with a capital letter (to match osu! naming), and '.osu_tmp' renamed to '.opsu_tmp'.
- Disabled mouse grabbing, as this does not seem to work properly for touchscreen devices. (partial revert of ab487c5)
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Added support for both the new (2013+) and old cursor styles. These can be toggled on/off in the configuration file.
- Added cursor images by XinCrin (old style) and teinecthel (new style).
Other changes:
- Refactoring: Created a "Utils" module, containing methods and constants that didn't belong in the "Options" state and some duplicated drawing methods.
- Mouse is now grabbed during gameplay.
- Removed 'optionsChanged' switch, simplifying adding new options.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
- Added SoundController module, which uses Java Sound since OpenAL has a slight delay on playing sounds.
- Uploaded all effect WAVs. (credits: WWWskin, AL's IA, Fantasy's Skin, Minimalist Miku)
- Added a missing entry in credits.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
Creates a ServerSocket instance on a port (default: 49250).
Credits to marcostudios for the suggestion.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>