tried to improve preanim durations and added emote dropdown

This commit is contained in:
David Skoland 2017-02-17 01:26:49 +01:00
parent 00e491bb26
commit 57d921feb0
7 changed files with 49 additions and 9 deletions

View File

@ -13,7 +13,7 @@ RC_ICONS = logo.ico
TARGET = Attorney_Online_remake TARGET = Attorney_Online_remake
TEMPLATE = app TEMPLATE = app
VERSION = 2.1.9.0 VERSION = 2.1.10.0
SOURCES += main.cpp\ SOURCES += main.cpp\
lobby.cpp \ lobby.cpp \

View File

@ -120,7 +120,7 @@ public:
private: private:
const int RELEASE = 2; const int RELEASE = 2;
const int MAJOR_VERSION = 1; const int MAJOR_VERSION = 1;
const int MINOR_VERSION = 9; const int MINOR_VERSION = 10;
QString user_theme = "default"; QString user_theme = "default";

View File

@ -72,24 +72,28 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
this->clear(); this->clear();
m_movie->setFileName(gif_path); m_movie->setFileName(gif_path);
int full_duration = duration * time_mod;
int real_duration = 0; int real_duration = 0;
play_once = false; play_once = false;
for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame) for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame)
{ {
real_duration += m_movie->nextFrameDelay(); real_duration += m_movie->nextFrameDelay();
m_movie->jumpToFrame(n_frame); m_movie->jumpToFrame(n_frame);
} }
qDebug() << "full_duration: " << full_duration;
qDebug() << "real_duration: " << real_duration; qDebug() << "real_duration: " << real_duration;
qDebug() << "duration: " << duration;
double percentage_modifier = 100.0; double percentage_modifier = 100.0;
if (real_duration != 0 && duration != 0) if (real_duration != 0 && duration != 0)
{ {
percentage_modifier = (duration / static_cast<double>(real_duration)) * 100.0; double modifier = full_duration / static_cast<double>(real_duration);
percentage_modifier = 100 / modifier;
if (percentage_modifier > 100.0)
percentage_modifier = 100.0;
} }
qDebug() << "% mod: " << percentage_modifier; qDebug() << "% mod: " << percentage_modifier;
play_once = true; play_once = true;

View File

@ -32,6 +32,8 @@ private:
QVector<QImage> flipped_movie; QVector<QImage> flipped_movie;
QTimer *preanim_timer; QTimer *preanim_timer;
const int time_mod = 62;
bool m_flipped = false; bool m_flipped = false;
bool play_once = true; bool play_once = true;

View File

@ -112,6 +112,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_emote_left = new AOButton(this, ao_app); ui_emote_left = new AOButton(this, ao_app);
ui_emote_right = new AOButton(this, ao_app); ui_emote_right = new AOButton(this, ao_app);
ui_emote_dropdown = new QComboBox(this);
/////////////////////////////////////// ///////////////////////////////////////
ui_defense_bar = new AOImage(this, ao_app); ui_defense_bar = new AOImage(this, ao_app);
@ -242,6 +244,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony())); connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony()));
//emote signals are set in emotes.cpp //emote signals are set in emotes.cpp
connect(ui_emote_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_emote_dropdown_changed(int)));
connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex)));
connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed())); connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed()));
@ -458,6 +462,8 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_emote_right, "emote_right"); set_size_and_pos(ui_emote_right, "emote_right");
ui_emote_right->set_image("arrow_right.png"); ui_emote_right->set_image("arrow_right.png");
set_size_and_pos(ui_emote_dropdown, "emote_dropdown");
//emote buttons //emote buttons
set_size_and_pos(ui_defense_bar, "defense_bar"); set_size_and_pos(ui_defense_bar, "defense_bar");
@ -745,6 +751,7 @@ void Courtroom::enter_courtroom(int p_cid)
ui_emotes->show(); ui_emotes->show();
set_emote_page(); set_emote_page();
set_emote_dropdown();
current_evidence_page = 0; current_evidence_page = 0;
current_evidence = 0; current_evidence = 0;
@ -882,7 +889,8 @@ void Courtroom::on_chat_return_pressed()
if (ui_ic_chat_message->text() == "" || is_muted) if (ui_ic_chat_message->text() == "" || is_muted)
return; return;
if (anim_state < 3 || text_state < 2) if ((anim_state < 3 || text_state < 2) &&
objection_state == 0)
return; return;
//MS#chat# //MS#chat#
@ -1203,9 +1211,9 @@ void Courtroom::play_preanim()
QString f_preanim = m_chatmessage[PRE_EMOTE]; 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 //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) * time_mod; int preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim);
int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod; int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod;
int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * time_mod; int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60;
sfx_delay_timer->start(sfx_delay); sfx_delay_timer->start(sfx_delay);

View File

@ -236,6 +236,8 @@ private:
AOButton *ui_emote_left; AOButton *ui_emote_left;
AOButton *ui_emote_right; AOButton *ui_emote_right;
QComboBox *ui_emote_dropdown;
AOImage *ui_defense_bar; AOImage *ui_defense_bar;
AOImage *ui_prosecution_bar; AOImage *ui_prosecution_bar;
@ -304,6 +306,7 @@ private:
void construct_emotes(); void construct_emotes();
void set_emote_page(); void set_emote_page();
void set_emote_dropdown();
void construct_evidence(); void construct_evidence();
void set_evidence_page(); void set_evidence_page();
@ -339,6 +342,8 @@ private slots:
void on_emote_left_clicked(); void on_emote_left_clicked();
void on_emote_right_clicked(); void on_emote_right_clicked();
void on_emote_dropdown_changed(int p_index);
void on_evidence_clicked(int p_id); void on_evidence_clicked(int p_id);
void on_evidence_hover(int p_id, bool p_state); void on_evidence_hover(int p_id, bool p_state);

View File

@ -100,6 +100,21 @@ void Courtroom::set_emote_page()
} }
void Courtroom::set_emote_dropdown()
{
ui_emote_dropdown->clear();
int total_emotes = ao_app->get_emote_number(current_char);
QStringList emote_list;
for (int n = 0 ; n < total_emotes ; ++n)
{
emote_list.append(ao_app->get_emote_comment(current_char, n));
}
ui_emote_dropdown->addItems(emote_list);
}
void Courtroom::on_emote_clicked(int p_id) void Courtroom::on_emote_clicked(int p_id)
{ {
int min = current_emote_page * max_emotes_on_page; int min = current_emote_page * max_emotes_on_page;
@ -112,6 +127,7 @@ void Courtroom::on_emote_clicked(int p_id)
current_emote = p_id + max_emotes_on_page * current_emote_page; current_emote = p_id + max_emotes_on_page * current_emote_page;
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"); 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); int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
@ -145,3 +161,8 @@ void Courtroom::on_emote_right_clicked()
ui_ic_chat_message->setFocus(); ui_ic_chat_message->setFocus();
} }
void Courtroom::on_emote_dropdown_changed(int p_index)
{
on_emote_clicked(p_index);
}