diff options
| author | Crystalwarrior <varsash@gmail.com> | 2019-09-18 04:14:52 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2019-09-18 04:14:52 +0300 |
| commit | 605e15bb8c0ad103fb0f75454d8912ba83ba7a17 (patch) | |
| tree | f88c83ec4bcfa014050dd83d026519cdd9e1eb90 /src/text_file_functions.cpp | |
| parent | e151964785301269500b96ecfd25dbdf227f55f8 (diff) | |
Implement effects system that reads your folder in theme/effects, or misc/<folder name>/<effects>
Add an effect packet
Allow aomovie to be fed a direct path
Add some really terrible helper functions that shouldn't exist, sorry.
Diffstat (limited to 'src/text_file_functions.cpp')
| -rw-r--r-- | src/text_file_functions.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index f22bc748..d478582c 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -817,6 +817,93 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote) else return f_result.toInt(); } +QStringList AOApplication::get_char_effects(QString p_char) +{ + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/" + p_effect + "/"; + QStringList filters = QStringList() << "*.gif" << "*.webp" << "*.apng" << "*.png" << "*.GIF" << "*.WEBP" << "*.APNG" << "*.PNG"; + + QDir directory(p_path); + QStringList images = directory.entryList(filters, QDir::Files); + + QStringList effects; + foreach (QString effect, images) + { + effect = effect.left(effect.lastIndexOf(".")); + if (!effects.contains(effect)) //Do that juicy priority meme + effects.append(effect); + } + + return effects; +} + +QStringList AOApplication::get_effects() +{ + QString design_ini_path = get_theme_path("effects/"); + QString default_path = get_default_theme_path("effects/"); + QStringList filters = QStringList() << "*.gif" << "*.webp" << "*.apng" << "*.png" << "*.GIF" << "*.WEBP" << "*.APNG" << "*.PNG"; + + QDir directory(design_ini_path); + QStringList images = directory.entryList(filters, QDir::Files); + if (images.size() <= 0) + { + directory.cd(default_path); + images = directory.entryList(filters, QDir::Files); + } + + QStringList effects; + foreach (QString effect, images) + { + effect = effect.left(effect.lastIndexOf(".")); + if (!effects.contains(effect)) //Do that juicy priority meme + effects.append(effect); + } + + return effects; +} + +QString AOApplication::get_effect(QString effect, QString p_char) +{ + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + effect); + QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect)); + QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect)); + + if (!file_exists(p_path)) + { + p_path = design_ini_path; + if (!file_exists(p_path)) + { + p_path = default_path; + if (!file_exists(p_path)) + { + return ""; + } + } + } + + return p_path; +} + +QString AOApplication::get_effect_sound(QString fx_name, QString p_char) +{ + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/effects/" + p_effect + "/effect_sounds.ini"; + QString design_ini_path = get_theme_path("effects/effect_sounds.ini"); + QString default_path = get_default_theme_path("effects/effect_sounds.ini"); + + QString f_result = read_design_ini(fx_name, p_path); + if (f_result == "") + { + f_result = read_design_ini(fx_name, design_ini_path); + if (f_result == "") + { + f_result = read_design_ini(fx_name, default_path); + } + } + return f_result; +} + QString AOApplication::get_custom_realization(QString p_char) { QString f_result = read_char_ini(p_char, "realization", "Options"); |
