diff --git a/aocharmovie.cpp b/aocharmovie.cpp index b591c2249..930def3da 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -56,24 +56,40 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) m_movie->start(); } -void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) +void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration, int reverse) { QString gif_path = ao_app->get_character_path(p_char) + p_emote.toLower(); m_movie->stop(); this->clear(); m_movie->setFileName(gif_path); - m_movie->jumpToFrame(0); - + if (reverse != 0): + { + m_movie->jumpToFrame(m_movie->frameCount()); + } + else + { + m_movie->jumpToFrame(0); + } int full_duration = duration * time_mod; int real_duration = 0; play_once = false; - - for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame) + if (reverse != 0): + { + for (int n_frame = m_movie->frameCount() ; n_frame > 0 ; --n_frame) + { + real_duration += m_movie->nextFrameDelay(); + m_movie->jumpToFrame(n_frame - 1); + } + } + else { - real_duration += m_movie->nextFrameDelay(); - m_movie->jumpToFrame(n_frame + 1); + for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame) + { + real_duration += m_movie->nextFrameDelay(); + m_movie->jumpToFrame(n_frame + 1); + } } qDebug() << "full_duration: " << full_duration; qDebug() << "real_duration: " << real_duration; diff --git a/aocharmovie.h b/aocharmovie.h index b26bada52..c6aa1f450 100644 --- a/aocharmovie.h +++ b/aocharmovie.h @@ -17,7 +17,7 @@ class AOCharMovie : public QLabel AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); void play(QString p_char, QString p_emote, QString emote_prefix); - void play_pre(QString p_char, QString p_emote, int duration); + void play_pre(QString p_char, QString p_emote, int duration, int reverse); void play_talking(QString p_char, QString p_emote); void play_idle(QString p_char, QString p_emote); diff --git a/base/themes/default/courtroom_design.ini b/base/themes/default/courtroom_design.ini index 16e5f474f..36c2097d8 100644 --- a/base/themes/default/courtroom_design.ini +++ b/base/themes/default/courtroom_design.ini @@ -34,7 +34,8 @@ reload_theme = 5, 415, 101, 23 call_mod = 5, 440, 71, 23 pre = 187, 345, 51, 21 flip = 187, 362, 51, 21 -guard = 187, 379, 61, 21 +reverse = 187, 379, 51, 21 +guard = 187, 396, 61, 21 custom_objection = 250, 325, 40, 40 realization = 295, 325, 40, 40 mute_button = 340, 325, 40, 40 diff --git a/courtroom.cpp b/courtroom.cpp index 352a3da5c..e9642d35f 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -143,6 +143,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_guard = new QCheckBox(this); ui_guard->setText("Guard"); ui_guard->hide(); + ui_reverse = new QCheckBox(this); + ui_reverse->setText("Reverse"); ui_custom_objection = new AOButton(this, ao_app); ui_realization = new AOButton(this, ao_app); @@ -244,6 +246,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); + connect(ui_reverse, SIGNAL(clicked()), this, SLOT(on_reverse_clicked())); connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); @@ -450,6 +453,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_guard, "guard"); + set_size_and_pos(ui_reverse, "reverse"); + set_size_and_pos(ui_custom_objection, "custom_objection"); ui_custom_objection->set_image("custom.png"); @@ -799,6 +804,7 @@ void Courtroom::on_chat_return_pressed() //placeholder# //realization# //text_color#% + //reverse# QStringList packet_contents; @@ -901,6 +907,15 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(f_text_color); + QString f_reverse; + + if (ui_reverse->isChecked()) + f_reverse = "1"; + else + f_reverse = "0"; + + packet_contents.append(f_flip); + ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1228,8 +1243,12 @@ void Courtroom::play_preanim() qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif"; return; } - - ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); + int is_reversed = 0; + if (m_chatmessage[REVERSE] == "1") + { + is_reversed = 1; + } + ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration, is_reversed); anim_state = 1; if (text_delay >= 0) text_delay_timer->start(text_delay); @@ -2079,6 +2098,18 @@ void Courtroom::on_flip_clicked() ui_ic_chat_message->setFocus(); } +void Courtroom::on_reverse_clicked() +{ + if (ui_pre->isChecked() == false) + { + if(ui_reverse->isChecked()) + { + ui_pre->setChecked(false) + } + } + ui_ic_chat_message->setFocus(); +} + void Courtroom::on_guard_clicked() { ui_ic_chat_message->setFocus(); diff --git a/courtroom.h b/courtroom.h index 728502b4d..ff018d00b 100644 --- a/courtroom.h +++ b/courtroom.h @@ -337,6 +337,7 @@ class Courtroom : public QMainWindow QCheckBox *ui_pre; QCheckBox *ui_flip; QCheckBox *ui_guard; + QCheckBox *ui_reverse; AOButton *ui_custom_objection; AOButton *ui_realization; @@ -481,6 +482,7 @@ private slots: void on_pre_clicked(); void on_flip_clicked(); void on_guard_clicked(); + void on_reverse_clicked(); void on_evidence_button_clicked(); diff --git a/datatypes.h b/datatypes.h index 37d3e99ac..49a5c65d6 100644 --- a/datatypes.h +++ b/datatypes.h @@ -53,6 +53,7 @@ struct chatmessage_type int cid; int sfx_delay; int flip; + int reverse; }; struct area_type @@ -92,7 +93,8 @@ enum CHAT_MESSAGE EVIDENCE_ID, FLIP, REALIZATION, - TEXT_COLOR + TEXT_COLOR, + REVERSE }; enum COLOR