Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animated Themes. Subthemes. Custom default_theme. Overhaul asset paths. Fix a ton of asset resolution bugs. #466

Merged
merged 33 commits into from
Feb 13, 2021

Conversation

Crystalwarrior
Copy link
Contributor

@Crystalwarrior Crystalwarrior commented Feb 11, 2021

This overhauls the asset/path resolution of AO2, making it much nicer and make a lot more sense. Most importantly, it drastically reduces code duplication, causing less inconsistencies and fixes a metric crapton of bugs related to that.

NEEDS TESTING!

  • Implements default_theme courtroom_config.ini option 😲
  • COMPLETELY overhauls the asset/path resolution, making it feel like an actually decent program now
  • fixes a metric crapton of bugs, see commit history for specifics
  • fixes a very old bug that caused the viewport to freeze because it never received the done(); signal it needs from objections, characters, etc.
  • Implements subthemes, and an "ST" packet. "ST" "subtheme" "1" where subtheme is a string you want your client to have their sub-theme set to, and "1" stands for if you want to reload their theme or not.
  • Subtheme setting - "server", "default", and the available subthemes in any given theme. "Server" prioritizes the subtheme we were requested by the server. "Default" means no subtheme will be initialized.
  • Adds optional animated themes which allows you to have animated buttons, images, etc.

Screenshot

Closes #427

New asset resolution functions:

get_asset_path - Loop through the list of provided asset paths and return the first valid file
get_image_path - Loop through the list of provided asset paths, apply get_image_suffix and return the first valid image file
get_sfx_path - Loop through the list of provided asset paths, apply get_sfx_suffix and return the first valid sound file
get_asset - return an asset (must contain file extension) from the get_asset_path() applied on the get_asset_paths()
get_image - return an image with get_image_suffix() applied on the get_image_path() for the get_asset_paths()
get_sfx - return a sfx from provided args with the uniquely constructed asset path list for sounds
get_config_value - obtains a value from the config that matches identifier, iterating through the list of valid paths```

@Crystalwarrior Crystalwarrior added enhancement Request for functionality not present engine/assets Issues related to INI parsing, path resolution, and asset loading ui Issues related to the user interface (non-viewport related) labels Feb 11, 2021
@Crystalwarrior Crystalwarrior added this to the 2.9 milestone Feb 11, 2021
@Crystalwarrior Crystalwarrior self-assigned this Feb 11, 2021
…path all into a single get_theme_path func

Add a default_theme variable which defines the currently recognized default theme
Add a new "get_asset_path" that will be used to simplify asset resolution considerably
Implement get_asset_path for AOButton
…hing as get_design_element anyway)

Get rid of get_char_shouts (use chat= instead)
Use get_subtheme() instead of subtheme (because get_subtheme() can perform overrides based on the user's settings)
Make get_color() use get_asset_path()
Make get_design_element() use get_asset_path()
…od, fixing an enormous amount of invalid path resolutions

Unfortunately I have to keep backwards compatibility for the backwards ass config.ini method for the chat markup (new way is chat_config.ini)
Get rid of get_theme_effects and implement the stacking behavior into get_effects instead
Also implement safety checks for the asset path generator
…d resolve major inconsistencies (such as the bug where objection sfx wouldn't be playing despite the default theme or default misc folder having them)
…ient/bin/base/themes/default//objection.wav is a valid qt5 path...)
get_asset_paths - Return an untested list of universal paths from the provided args
get_asset_path - Loop through the list of provided asset paths and return the first valid file
get_image_path - Loop through the list of provided asset paths, apply get_image_suffix and return the first valid image file
get_sfx_path - Loop through the list of provided asset paths, apply get_sfx_suffix and return the first valid sound file
get_asset - return an asset (must contain file extension) from the get_asset_path() applied on the get_asset_paths()
get_image - return an image with get_image_suffix() applied on the get_image_path() for the get_asset_paths()
get_sfx - return a sfx from provided args with the uniquely constructed asset path list for sounds

Rename old get_sfx to get_court_sfx for better clarity of its function
This replaces previous asset stuff I implemented, as I think this is a better solution lol
…matches identifier

Adjust all calls to get_asset() to actually look for a config identifier value instead, so even if a config.ini is found if it doesn't contain the identifier we want we keep looking
…ingno, the viewport still doesn't freeze up due to waiting on Objections etc. due to signals.
… to make themes that inherit from other themes that are not default.
@Crystalwarrior Crystalwarrior marked this pull request as ready for review February 12, 2021 01:27
@Crystalwarrior Crystalwarrior changed the title Implement SubThemes system Overhaul Asset Path Resolution, Implement default_theme option for themes Feb 12, 2021
@Crystalwarrior Crystalwarrior changed the title Overhaul Asset Path Resolution, Implement default_theme option for themes Overhaul Asset Path Resolution, Implement default_theme option for themes, pave way for subthemes Feb 12, 2021
@Crystalwarrior
Copy link
Contributor Author

Crystalwarrior commented Feb 12, 2021

I will implement the subthemes in a separate PR. This PR is done but requires review and testing, especially since it overhauls the asset resolution system and introduces default_theme - it also fixes a very old bug that caused the viewport to freeze because it never received the done(); signal it needs from objections, characters, etc.

@Crystalwarrior Crystalwarrior added bug Confirmed bug engine/timing Issues related to event timing and sequencing (not lag-related issues) labels Feb 12, 2021
in1tiate
in1tiate previously approved these changes Feb 12, 2021
Copy link
Member

@in1tiate in1tiate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

poggers

Fix static image Objections freezing the viewport due to done(); signal that never arrives
src/path_functions.cpp Outdated Show resolved Hide resolved
…of nasty issues due to done(); signal being sent as soon as playback begins if the image is invalid.

This is done by removing the file_exists check, and letting the rest of the functionality handle this case - the system is robust enough and treats an invalid image as a static image.
Make it possible to have fully animated AOButton and AOImage
Add a "static image" toggle for get_image_suffix
…haivor with subthemes

Add a settings option for subthemes
Have AOImage keep track of its last valid path
…the client's theme to be reloaded.

ST packet sets ao_app->subtheme no matter what. It will not reload theme unless the user has their subtheme set to "server".
Fix showname widths by rearranging font metrics to do its calculations *after* the showname font is set, and not before (making it lag behind the correct display size by 1 msg)
@Crystalwarrior Crystalwarrior changed the title Overhaul Asset Path Resolution, Implement default_theme option for themes, pave way for subthemes Subthemes. Custom default_theme. Overhaul asset paths. Fix a ton of asset resolution bugs. Feb 12, 2021
@Crystalwarrior Crystalwarrior changed the title Subthemes. Custom default_theme. Overhaul asset paths. Fix a ton of asset resolution bugs. Animated Themes. Subthemes. Custom default_theme. Overhaul asset paths. Fix a ton of asset resolution bugs. Feb 12, 2021
@@ -7,6 +7,7 @@

#include <QDebug>
#include <QLabel>
#include <QMovie>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cursed

Copy link
Member

@in1tiate in1tiate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but needs documentation.

@Crystalwarrior
Copy link
Contributor Author

Looks good, but needs documentation.

I suck at documentation :((((

@Crystalwarrior Crystalwarrior merged commit fe00c6b into master Feb 13, 2021
@oldmud0 oldmud0 deleted the feature/subthemes branch February 14, 2021 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug engine/assets Issues related to INI parsing, path resolution, and asset loading engine/timing Issues related to event timing and sequencing (not lag-related issues) enhancement Request for functionality not present ui Issues related to the user interface (non-viewport related)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New client versions "break" old themes.
3 participants