From c5c7997f41dc9b55a471d00d47c798a34f977d30 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Thu, 16 Feb 2017 11:48:38 +0100 Subject: [PATCH] adjusted preanims and added emotions/ao2 feature --- aocharmovie.cpp | 2 +- aoemotebutton.cpp | 12 ++++++++++-- aoemotebutton.h | 5 +++-- emotes.cpp | 12 +++++------- text_file_functions.cpp | 2 +- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/aocharmovie.cpp b/aocharmovie.cpp index d4b4214..8be462f 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -111,7 +111,7 @@ void AOCharMovie::frame_change(int n_frame) if (m_movie->frameCount() - 1 == n_frame && play_once) { - delay(m_movie->nextFrameDelay()); + preanim_timer->start(m_movie->nextFrameDelay()); done(); } } diff --git a/aoemotebutton.cpp b/aoemotebutton.cpp index 5eb5d75..b6ba8e0 100644 --- a/aoemotebutton.cpp +++ b/aoemotebutton.cpp @@ -14,6 +14,7 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); } +/* void AOEmoteButton::set_on(QString p_char, int p_emote) { //+1 because programmatical emotes start on 0, while filesystem ones start on 1 @@ -31,17 +32,24 @@ void AOEmoteButton::set_on(QString p_char, int p_emote) this->setStyleSheet("border-image:url(\"\")"); } } +*/ -void AOEmoteButton::set_off(QString p_char, int p_emote) +void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix) { QString emotion_number = QString::number(p_emote + 1); - QString image_path = ao_app->get_character_path(p_char) + "emotions/button" + emotion_number + "_off.png"; + QString image_path = ao_app->get_character_path(p_char) + "emotions/button" + emotion_number + suffix; + QString alt_path = ao_app->get_character_path(p_char) + "emotions/ao2/button" + emotion_number + suffix; if (file_exists(image_path)) { this->setText(""); this->setStyleSheet("border-image:url(\"" + image_path + "\")"); } + else if (file_exists(alt_path)) + { + this->setText(""); + this->setStyleSheet("border-image:url(\"" + alt_path + "\")"); + } else { this->setText(ao_app->get_emote_comment(p_char, p_emote)); diff --git a/aoemotebutton.h b/aoemotebutton.h index 38888a7..cc3dfac 100644 --- a/aoemotebutton.h +++ b/aoemotebutton.h @@ -12,8 +12,9 @@ class AOEmoteButton : public QPushButton public: AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y); - void set_on(QString p_char, int p_emote); - void set_off(QString p_char, int p_emote); + //void set_on(QString p_char, int p_emote); + //void set_off(QString p_char, int p_emote); + void set_image(QString p_char, int p_emote, QString suffix); void set_id(int p_id) {m_id = p_id;} int get_id() {return m_id;} diff --git a/emotes.cpp b/emotes.cpp index 34db884..212b0a3 100644 --- a/emotes.cpp +++ b/emotes.cpp @@ -91,9 +91,9 @@ void Courtroom::set_emote_page() AOEmoteButton *f_emote = ui_emote_list.at(n_emote); if (n_real_emote == current_emote) - f_emote->set_on(current_char, n_real_emote); + f_emote->set_image(current_char, n_real_emote, "_on.png"); else - f_emote->set_off(current_char, n_real_emote); + f_emote->set_image(current_char, n_real_emote, "_off.png"); f_emote->show(); } @@ -106,17 +106,15 @@ void Courtroom::on_emote_clicked(int p_id) int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page; if (current_emote >= min && current_emote <= max) - ui_emote_list.at(current_emote % max_emotes_on_page)->set_off(current_char, current_emote); + ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off.png"); current_emote = p_id + max_emotes_on_page * current_emote_page; - ui_emote_list.at(current_emote % max_emotes_on_page)->set_on(current_char, current_emote); + ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png"); int emote_mod = ao_app->get_emote_mod(current_char, current_emote); - if (emote_mod == 1 || - emote_mod == 3 || - emote_mod == 4) + if (emote_mod == 1) ui_pre->setChecked(true); else ui_pre->setChecked(false); diff --git a/text_file_functions.cpp b/text_file_functions.cpp index 6416781..f51df62 100644 --- a/text_file_functions.cpp +++ b/text_file_functions.cpp @@ -286,7 +286,7 @@ QString AOApplication::get_pre_emote(QString p_char, int p_emote) if (result_contents.size() < 4) { qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return "normal"; + return ""; } else return result_contents.at(1); }