diff options
| author | Crystalwarrior <varsash@gmail.com> | 2019-09-12 15:40:19 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2019-09-12 15:40:19 +0300 |
| commit | 3b415f5a7005fd0b42ba7ccbb9a8836746a72d41 (patch) | |
| tree | 2b2547988abf6db0fd314ea2cd2f4fb56008b577 /src/aocharmovie.cpp | |
| parent | 7e2ec58c7eb62077733f354764d0b729fe0e0a93 (diff) | |
Expand get_image_suffix to fall back on .png last
Reorganize the file_exists checks to be an array iterator instead for much less code duplication and easier ordering of priority
Reorganize desk and set_image loading on AOScene class, resolve issues with last_image setting to prevent animations from being restarted when characters talk on the same pos in succession
Apply get_image_suffix for seancestand and jurystand searches
TODO: At the moment, if you feed a .png shout, it will send the "Done" signal on the first frame (frame 0), not showing you the .png image at all. The shout code should be reorganized to allow static images to be displayed for exactly 720ms - the standard AA objection length. Usage of the timer similarly to the realizationflash.png might be possible.
Diffstat (limited to 'src/aocharmovie.cpp')
| -rw-r--r-- | src/aocharmovie.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index eacf853..883530b 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -19,25 +19,26 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { - QString original_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)); - QString alt_path = ao_app->get_character_path(p_char, p_emote + ".png"); - QString placeholder_path = ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")); - QString placeholder_default_path = ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")); - QString gif_path; - - if (file_exists(original_path)) - gif_path = original_path; - else if (file_exists(alt_path)) - gif_path = alt_path; - else if (file_exists(placeholder_path)) - gif_path = placeholder_path; - else - gif_path = placeholder_default_path; + QString emote_path; + QList<QString> pathlist; + pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)) <<//Default path + ao_app->get_character_path(p_char, p_emote + ".png") << //Non-animated path if emote_prefix fails + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")) << //Theme placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")); //Default theme placeholder path + + for (QString path : pathlist) + { + if (file_exists(path)) + { + emote_path = path; + break; + } + } m_movie->stop(); - m_movie->setFileName(gif_path); + m_movie->setFileName(emote_path); - QImageReader *reader = new QImageReader(gif_path); + QImageReader *reader = new QImageReader(emote_path); movie_frames.clear(); QImage f_image = reader->read(); |
