From bcb368efb60fa77a71b3b1b2fe6eee5682b02c91 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Fri, 17 Feb 2017 16:40:09 +0100 Subject: [PATCH] fixed emote dropdown issues --- aocharmovie.cpp | 11 +++++++++-- courtroom.cpp | 11 +++++++++-- courtroom.h | 2 ++ emotes.cpp | 13 ++++++++++--- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/aocharmovie.cpp b/aocharmovie.cpp index 301b4a9..93d5d58 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -96,8 +96,15 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) percentage_modifier = 100.0; } qDebug() << "% mod: " << percentage_modifier; - play_once = true; - //m_movie->jumpToFrame(m_movie->frameCount() - 1); + + if (full_duration < real_duration) + { + play_once = false; + preanim_timer->start(full_duration); + } + else + play_once = true; + m_movie->setSpeed(static_cast(percentage_modifier)); play(p_char, p_emote, ""); } diff --git a/courtroom.cpp b/courtroom.cpp index d6a3738..e6b6d7a 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -244,7 +244,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony())); //emote signals are set in emotes.cpp - connect(ui_emote_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_emote_dropdown_changed(int))); + connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); @@ -1211,10 +1211,17 @@ void Courtroom::play_preanim() QString f_preanim = m_chatmessage[PRE_EMOTE]; //all time values in char.inis are multiplied by a constant(time_mod) to get the actual time - int preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); + int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim); int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod; int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60; + int preanim_duration; + + if (ao2_duration < 0) + preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); + else + preanim_duration = ao2_duration; + sfx_delay_timer->start(sfx_delay); if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif") || diff --git a/courtroom.h b/courtroom.h index 5238652..1154de9 100644 --- a/courtroom.h +++ b/courtroom.h @@ -337,6 +337,8 @@ private slots: void on_music_search_edited(QString p_text); void on_music_list_double_clicked(QModelIndex p_model); + void select_emote(int p_id); + void on_emote_clicked(int p_id); void on_emote_left_clicked(); diff --git a/emotes.cpp b/emotes.cpp index 5d77764..21db249 100644 --- a/emotes.cpp +++ b/emotes.cpp @@ -115,7 +115,7 @@ void Courtroom::set_emote_dropdown() ui_emote_dropdown->addItems(emote_list); } -void Courtroom::on_emote_clicked(int p_id) +void Courtroom::select_emote(int p_id) { int min = current_emote_page * max_emotes_on_page; int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page; @@ -125,7 +125,7 @@ void Courtroom::on_emote_clicked(int p_id) int old_emote = current_emote; - current_emote = p_id + max_emotes_on_page * current_emote_page; + current_emote = p_id; if (current_emote >= min && current_emote <= max) ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png"); @@ -141,9 +141,16 @@ void Courtroom::on_emote_clicked(int p_id) else ui_pre->setChecked(false); + ui_emote_dropdown->setCurrentIndex(current_emote); + ui_ic_chat_message->setFocus(); } +void Courtroom::on_emote_clicked(int p_id) +{ + select_emote(p_id + max_emotes_on_page * current_emote_page); +} + void Courtroom::on_emote_left_clicked() { --current_emote_page; @@ -164,5 +171,5 @@ void Courtroom::on_emote_right_clicked() void Courtroom::on_emote_dropdown_changed(int p_index) { - on_emote_clicked(p_index); + select_emote(p_index); }