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/aoscene.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/aoscene.cpp')
| -rw-r--r-- | src/aoscene.cpp | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/src/aoscene.cpp b/src/aoscene.cpp deleted file mode 100644 index 78d69acd..00000000 --- a/src/aoscene.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "aoscene.h" -#include "courtroom.h" -#include "file_functions.h" - -AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) -{ - m_parent = parent; - ao_app = p_ao_app; - m_movie = new QMovie(this); - m_movie->setCacheMode(QMovie::CacheAll); - last_image = ""; -} - -void AOScene::set_image(QString p_image) -{ - QString background_path = - ao_app->get_image_suffix(ao_app->get_background_path(p_image)); - if (!file_exists(background_path)) // If image is missing, clear current image - { - this->clear(); - this->setMovie(nullptr); - - m_movie->stop(); - last_image = ""; - return; - } - - if (!file_exists(background_path) || background_path != last_image) - { - this->clear(); - this->setMovie(nullptr); - - m_movie->stop(); - m_movie->setFileName(background_path); - } - - if (m_movie->isValid() && m_movie->frameCount() > 1) { - m_movie->jumpToNextFrame(); - float scale_factor = static_cast<float>(f_h) / - static_cast<float>(m_movie->frameRect().height()); - // preserve aspect ratio - int n_w = static_cast<int>(m_movie->frameRect().width() * scale_factor); - int n_h = static_cast<int>(m_movie->frameRect().height() * scale_factor); - - m_movie->setScaledSize(QSize(n_w, n_h)); - this->resize(m_movie->scaledSize()); - if (!file_exists(background_path) || background_path != last_image) - { - this->setMovie(m_movie); - m_movie->start(); - } - QLabel::move(x + (f_w - n_w) / 2, y + (f_h - n_h) / 2); // Center - } - else { - QPixmap background(background_path); - auto transform_mode = Qt::FastTransformation; - if (background.height() > f_h) // We are downscaling, use anti-aliasing. - transform_mode = Qt::SmoothTransformation; - - background = background.scaledToHeight(f_h, transform_mode); - this->resize(background.size()); - this->setPixmap(background); - QLabel::move( - x + (f_w - background.width()) / 2, - y + (f_h - background.height()) / - 2); // Always center horizontally, always center vertically - } - last_image = background_path; -} - -void AOScene::set_legacy_desk(QString p_image) -{ - - QString desk_path = - ao_app->get_image_suffix(ao_app->get_background_path(p_image)); - if (!file_exists(desk_path)) // If image is missing, clear current image - { - this->clear(); - this->setMovie(nullptr); - - m_movie->stop(); - last_image = ""; - return; - } - - if (file_exists(desk_path) && desk_path == last_image) - return; - - QPixmap f_desk(desk_path); - - // vanilla desks vary in both width and height. in order to make that work - // with viewport rescaling, some INTENSE math is needed. - int vp_width = m_parent->width(); - int vp_height = m_parent->height(); - - double h_modifier = vp_height / 192; - - int final_h = static_cast<int>(h_modifier * f_desk.height()); - - this->clear(); - this->setMovie(nullptr); - - m_movie->stop(); - m_movie->setFileName(desk_path); - - m_movie->setScaledSize(QSize(vp_width, final_h)); - - if (m_movie->isValid() && m_movie->frameCount() > 1) { - this->setMovie(m_movie); - m_movie->start(); - } - else { - this->resize(vp_width, final_h); - this->setPixmap(f_desk.scaled(vp_width, final_h)); - } - last_image = desk_path; -} - -void AOScene::combo_resize(int w, int h) -{ - QSize f_size(w, h); - f_w = w; - f_h = h; - this->resize(f_size); -} - -void AOScene::move(int ax, int ay) -{ - x = ax; - y = ay; - QLabel::move(x, y); -} |
