aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-02-17 01:26:49 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-02-17 01:26:49 +0100
commit57d921feb0f9f0ab92a1d96b6d60ec148aa2f571 (patch)
treebf8541b7356ab9a79027ab96b8ebcfbfa1725f16
parent00e491bb2638fcfdd9bb81f7bd3a87f614fcd9e4 (diff)
tried to improve preanim durations and added emote dropdown
-rw-r--r--Attorney_Online_remake.pro2
-rw-r--r--aoapplication.h2
-rw-r--r--aocharmovie.cpp10
-rw-r--r--aocharmovie.h2
-rw-r--r--courtroom.cpp14
-rw-r--r--courtroom.h5
-rw-r--r--emotes.cpp23
7 files changed, 49 insertions, 9 deletions
diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro
index cbbfab67..36fb0776 100644
--- a/Attorney_Online_remake.pro
+++ b/Attorney_Online_remake.pro
@@ -13,7 +13,7 @@ RC_ICONS = logo.ico
TARGET = Attorney_Online_remake
TEMPLATE = app
-VERSION = 2.1.9.0
+VERSION = 2.1.10.0
SOURCES += main.cpp\
lobby.cpp \
diff --git a/aoapplication.h b/aoapplication.h
index ff095cde..be726227 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -120,7 +120,7 @@ public:
private:
const int RELEASE = 2;
const int MAJOR_VERSION = 1;
- const int MINOR_VERSION = 9;
+ const int MINOR_VERSION = 10;
QString user_theme = "default";
diff --git a/aocharmovie.cpp b/aocharmovie.cpp
index 66c9ef01..301b4a90 100644
--- a/aocharmovie.cpp
+++ b/aocharmovie.cpp
@@ -72,24 +72,28 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
this->clear();
m_movie->setFileName(gif_path);
+ 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)
{
-
real_duration += m_movie->nextFrameDelay();
m_movie->jumpToFrame(n_frame);
}
+ qDebug() << "full_duration: " << full_duration;
qDebug() << "real_duration: " << real_duration;
- qDebug() << "duration: " << duration;
double percentage_modifier = 100.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;
play_once = true;
diff --git a/aocharmovie.h b/aocharmovie.h
index 2f9cbbcb..4cb4f26c 100644
--- a/aocharmovie.h
+++ b/aocharmovie.h
@@ -32,6 +32,8 @@ private:
QVector<QImage> flipped_movie;
QTimer *preanim_timer;
+ const int time_mod = 62;
+
bool m_flipped = false;
bool play_once = true;
diff --git a/courtroom.cpp b/courtroom.cpp
index 5217e314..d6a3738a 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -112,6 +112,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_emote_left = 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);
@@ -242,6 +244,8 @@ 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_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()));
@@ -458,6 +462,8 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_emote_right, "emote_right");
ui_emote_right->set_image("arrow_right.png");
+ set_size_and_pos(ui_emote_dropdown, "emote_dropdown");
+
//emote buttons
set_size_and_pos(ui_defense_bar, "defense_bar");
@@ -745,6 +751,7 @@ void Courtroom::enter_courtroom(int p_cid)
ui_emotes->show();
set_emote_page();
+ set_emote_dropdown();
current_evidence_page = 0;
current_evidence = 0;
@@ -882,7 +889,8 @@ void Courtroom::on_chat_return_pressed()
if (ui_ic_chat_message->text() == "" || is_muted)
return;
- if (anim_state < 3 || text_state < 2)
+ if ((anim_state < 3 || text_state < 2) &&
+ objection_state == 0)
return;
//MS#chat#
@@ -1203,9 +1211,9 @@ 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) * 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 sfx_delay = m_chatmessage[SFX_DELAY].toInt() * time_mod;
+ int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60;
sfx_delay_timer->start(sfx_delay);
diff --git a/courtroom.h b/courtroom.h
index 1c9f38fa..5238652c 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -236,6 +236,8 @@ private:
AOButton *ui_emote_left;
AOButton *ui_emote_right;
+ QComboBox *ui_emote_dropdown;
+
AOImage *ui_defense_bar;
AOImage *ui_prosecution_bar;
@@ -304,6 +306,7 @@ private:
void construct_emotes();
void set_emote_page();
+ void set_emote_dropdown();
void construct_evidence();
void set_evidence_page();
@@ -339,6 +342,8 @@ private slots:
void on_emote_left_clicked();
void on_emote_right_clicked();
+ void on_emote_dropdown_changed(int p_index);
+
void on_evidence_clicked(int p_id);
void on_evidence_hover(int p_id, bool p_state);
diff --git a/emotes.cpp b/emotes.cpp
index 4793eec4..5d777647 100644
--- a/emotes.cpp
+++ b/emotes.cpp
@@ -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)
{
int min = current_emote_page * max_emotes_on_page;
@@ -112,7 +127,8 @@ void Courtroom::on_emote_clicked(int p_id)
current_emote = p_id + max_emotes_on_page * current_emote_page;
- ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png");
+ 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");
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();
}
+
+void Courtroom::on_emote_dropdown_changed(int p_index)
+{
+ on_emote_clicked(p_index);
+}