diff options
| author | in1tiate <32779090+in1tiate@users.noreply.github.com> | 2021-01-19 05:32:11 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-19 14:32:11 +0300 |
| commit | 894b2b2a0e6bb2744e92a2d8ed363a39d7ae59b1 (patch) | |
| tree | d5c0868152ca9958173f5e4f857a2fd98cfce56b /src/text_file_functions.cpp | |
| parent | 21b4aa5072755923f5f555605ef4dc2b01857579 (diff) | |
Consolidate AOScene, AOMovie, and AOCharMovie into one class, add support for (c) animations, implement emote continuity, add scaling overrides to all layer types, allow for stretch-to-fill images, allow for additional effect configuration (#302)
* Rewrite AOScene and remove the need for AOMovie and AOCharMovie by consolidation
* Rename AOScene to AOLayer, apply suggestions to improve functionality
* Implement suggested change to allocation
* Switch from pointer to field, fix ui_vp_player_char not resetting play_once
* Use the variable gif_name instead of the string "gif_name"
Oops.
* Total rewrite of AOLayer (again)
* Add support for (c) animations, do some housekeeping
* allow themes to override misc chatboxes
* add support for pulling InterfaceLayer elements from theme/misc
* mistakes were made
* move all frame fx functionality to CharLayer subclass
* virtual functions are cool mkay
* remove evidence of my incompetence
* allow themes to override font design inis under theme/misc
* Proper support for theme/misc chatbox, fixes
* Fix chatbox dimensions not updating and inline color causing missingnos
* rename chat markdown to chat markup
* add missing misc overrides
* quick hotfix for chatblank and misc overrides
* Fix oversight with backgrounds causing them to be culled
* Same as last commit but for FG layer
* amend comment to explain impossible shenanigans
* Adjust ForegroundLayer to take charname rather than miscname, allow for checking in char folder
* fix an incredibly embarrassing pathing bug
* add scaling overrides for all layer types, parent orphaned viewport elements to the viewport
* stupid fix because themes use "custom.png" as a button
* switch to .append()
* Revert "Merge branch 'aoscene_rewrite' of https://github.com/AttorneyOnline/AO2-Client into aoscene_rewrite"
This reverts commit bdeb1bff7639d522031aab3c133a83b0e2a291df, reversing
changes made to 125ee63b97a6f6c156e69525d88fddc625e7a978.
* switch to .append() (again)
* move function call to fix showname length calculation error
* fix nonlooping character animations being broken Again
* unparent elements from the viewport and do fancy masking arithmetic instead
* use override keyword
* move scaling override to char.ini, allow stretching, restructure effect property loading
* fix some redundancy
* unparent chat_arrow from chatbox to prevent accidental masking
* at no point do we want a frozen gif to display
* overhaul how wtce is handled
* oops
* also let sounds be pulled from theme miscs
* i should probably compile before i push
* actually make it work
* don't check a default bg
* readd 1x1 stretch thing
* actually the 1x1 thing was a bad idea
* Add missing parenthesis
* Use load_image instead of play
play is a nonexistent method now
* Remote shout_message and usages because it does nothing
* Remove multiple redefinitions
* Add in missing brackets and indent to fix build
I have know idea what this does but it brings fear
* fix build error
* fix chat arrow and remove duped code
* remove more duped code and fix misc themes
* only update chat_arrow when needed
* consolidate log_chatmessage and display_log_chatmessage
Co-authored-by: scatterflower <marisaposs@gameboyprinter.moe>
Co-authored-by: Skye Deving <76892045+skyedeving@users.noreply.github.com>
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Diffstat (limited to 'src/text_file_functions.cpp')
| -rw-r--r-- | src/text_file_functions.cpp | 155 |
1 files changed, 85 insertions, 70 deletions
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 43a72ecc..0128f565 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -67,8 +67,7 @@ bool AOApplication::get_log_goes_downwards() bool AOApplication::get_log_newline() { - QString result = - configini->value("log_newline", "false").value<QString>(); + QString result = configini->value("log_newline", "false").value<QString>(); return result.startsWith("true"); } @@ -80,8 +79,7 @@ int AOApplication::get_log_margin() bool AOApplication::get_log_timestamp() { - QString result = - configini->value("log_timestamp", "false").value<QString>(); + QString result = configini->value("log_timestamp", "false").value<QString>(); return result.startsWith("true"); } @@ -282,6 +280,13 @@ QString AOApplication::read_design_ini(QString p_identifier, } } +Qt::TransformationMode AOApplication::get_scaling(QString p_scaling) +{ + if (p_scaling == "smooth") + return Qt::SmoothTransformation; + return Qt::FastTransformation; +} + QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file) { QString design_ini_path = get_theme_path(p_file); @@ -315,28 +320,12 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file, QString p_char) { - QString char_ini_path = - get_base_path() + "misc/" + get_chat(p_char) + "/" + p_file; - QString design_ini_path = get_theme_path(p_file); - QString default_path = get_default_theme_path(p_file); - QString f_result = read_design_ini(p_identifier, char_ini_path); - pos_size_type return_value; - return_value.x = 0; return_value.y = 0; return_value.width = -1; return_value.height = -1; - - if (f_result == "") { - f_result = read_design_ini(p_identifier, design_ini_path); - if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_value; - } - } + QString f_result = get_design_element(p_identifier, p_file, p_char); QStringList sub_line_elements = f_result.split(","); @@ -353,17 +342,16 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString AOApplication::get_design_element(QString p_identifier, QString p_file, QString p_char) { - QString char_ini_path = - get_base_path() + "misc/" + get_chat(p_char) + "/" + p_file; - QString design_ini_path = get_theme_path(p_file); - QString default_path = get_default_theme_path(p_file); - QString f_result = read_design_ini(p_identifier, char_ini_path); - if (f_result == "") { - f_result = read_design_ini(p_identifier, design_ini_path); - if (f_result == "") - f_result = read_design_ini(p_identifier, default_path); + QStringList paths{get_theme_path("misc/" + get_chat(p_char) + "/" + + p_file), // user theme overrides base/misc + get_base_path() + "misc/" + get_chat(p_char) + "/" + p_file, + get_theme_path(p_file), get_default_theme_path(p_file)}; + for (const QString &path : paths) { + QString value = read_design_ini(p_identifier, path); + if (!value.isEmpty()) + return value; } - return f_result; + return ""; } QString AOApplication::get_font_name(QString p_identifier, QString p_file) { @@ -483,34 +471,30 @@ QString AOApplication::get_tagged_stylesheet(QString target_tag, QString p_file) return f_text; } -QString AOApplication::get_chat_markdown(QString p_identifier, QString p_chat) +QString AOApplication::get_chat_markup(QString p_identifier, QString p_chat) { - QString design_ini_path = - get_base_path() + "misc/" + get_chat(p_chat) + "/config.ini"; - QString default_path = get_base_path() + "misc/default/config.ini"; - QString f_result = read_design_ini(p_identifier, design_ini_path); + QStringList paths{get_theme_path("misc/" + get_chat(p_chat) + "/config.ini"), + get_base_path() + "misc/" + get_chat(p_chat) + + "/config.ini", + get_base_path() + "misc/default/config.ini", + get_theme_path("misc/default/config.ini")}; - if (f_result == "") - f_result = read_design_ini(p_identifier, default_path); + for (const QString &path : paths) { + QString value = read_design_ini(p_identifier, path); + if (!value.isEmpty()) { + return value.toLatin1(); + } + } - return f_result.toLatin1(); + return ""; } QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) { QColor return_color(255, 255, 255); - - QString design_ini_path = - get_base_path() + "misc/" + get_chat(p_chat) + "/config.ini"; - QString default_path = get_base_path() + "misc/default/config.ini"; - QString f_result = read_design_ini(p_identifier, design_ini_path); - - if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_color; - } + QString f_result = get_chat_markup(p_identifier, p_chat); + if (f_result == "") + return return_color; QStringList color_list = f_result.split(","); @@ -524,23 +508,21 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) return return_color; } -QString AOApplication::get_sfx(QString p_identifier) +QString AOApplication::get_sfx(QString p_identifier, QString p_misc) { - QString design_ini_path = get_theme_path("courtroom_sounds.ini"); - QString default_path = get_default_theme_path("courtroom_sounds.ini"); - QString f_result = read_design_ini(p_identifier, design_ini_path); + QStringList paths{get_theme_path("misc/" + p_misc + "/courtroom_sounds.ini"), + get_misc_path(p_misc, "courtroom_sounds.ini"), + get_theme_path("courtroom_sounds.ini"), + get_default_theme_path("courtroom_sounds.ini")}; QString return_sfx = ""; - if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_sfx; + for (const QString &path : paths) { + QString value = read_design_ini(p_identifier, path); + if (!value.isEmpty()) { + return value.toLatin1(); + } } - - return_sfx = f_result; - return return_sfx; } @@ -667,6 +649,31 @@ QString AOApplication::get_blips(QString p_char) return f_result; } +QString AOApplication::get_emote_property(QString p_char, QString p_emote, + QString p_property) +{ + QString f_result = + read_char_ini(p_char, p_emote, p_property); // per-emote override + if (f_result == "") + f_result = read_char_ini(p_char, p_property, + "Options"); // global for this character + return f_result; +} + +Qt::TransformationMode AOApplication::get_misc_scaling(QString p_miscname) +{ + if (p_miscname != "") { + QString misc_transform_mode = read_design_ini( + "scaling", get_theme_path("misc/" + p_miscname + "/config.ini")); + if (misc_transform_mode == "") + misc_transform_mode = + read_design_ini("scaling", get_misc_path(p_miscname, "config.ini")); + if (misc_transform_mode == "smooth") + return Qt::SmoothTransformation; + } + return Qt::FastTransformation; +} + QString AOApplication::get_category(QString p_char) { QString f_result = read_char_ini(p_char, "category", "Options"); @@ -904,7 +911,7 @@ QStringList AOApplication::get_theme_effects() QStringList lines = read_file(p_path).split("\n"); foreach (QString effect, lines) { - effect = effect.split("=")[0].trimmed(); + effect = effect.split("=")[0].trimmed().split("_")[0]; if (!effect.isEmpty() && !effects.contains(effect)) effects.append(effect); } @@ -922,7 +929,7 @@ QStringList AOApplication::get_effects(QString p_char) QStringList lines = read_file(p_path).split("\n"); foreach (QString effect, lines) { - effect = effect.split("=")[0].trimmed(); + effect = effect.split("=")[0].trimmed().split("_")[0]; if (!effect.isEmpty() && !effects.contains(effect)) effects.append(effect); } @@ -957,25 +964,33 @@ QString AOApplication::get_effect(QString effect, QString p_char, return p_path; } -QString AOApplication::get_effect_sound(QString fx_name, QString p_char) +QString AOApplication::get_effect_property(QString fx_name, QString p_char, + QString p_property) { + QString f_property; + if (p_property == "sound") + f_property = fx_name; + else + f_property = fx_name + "_" + p_property; QString p_effect = read_char_ini(p_char, "effects", "Options"); QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; QString design_ini_path = get_theme_path("effects/effects.ini"); QString default_path = get_default_theme_path("effects/effects.ini"); - QString f_result = read_design_ini(fx_name, p_path); + QString f_result = read_design_ini(f_property, p_path); if (f_result == "") { - f_result = read_design_ini(fx_name, design_ini_path); + f_result = read_design_ini(f_property, design_ini_path); if (f_result == "") { - f_result = read_design_ini(fx_name, default_path); + f_result = read_design_ini(f_property, default_path); } } - if (fx_name == "realization") { + if (fx_name == "realization" && p_property == "sound") { f_result = get_custom_realization(p_char); } + qDebug() << "got" << f_property << "of" << fx_name << "==" << f_result; + return f_result; } |
