aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-02-15 13:58:14 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-02-15 13:58:14 +0100
commitf7db8fa64aae47f2945e0d3c9344f6fac4534b57 (patch)
tree014cce685e2890dad5ca7df1fa29068941154a77
parent3f926341c83b4b9d75554f4fe4ca09586fb9ba40 (diff)
fixed a bug where spectators could not hear music
-rw-r--r--courtroom.cpp34
-rw-r--r--emotes.cpp3
-rw-r--r--evidence.cpp13
3 files changed, 30 insertions, 20 deletions
diff --git a/courtroom.cpp b/courtroom.cpp
index d8a34592..1b48b475 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -608,6 +608,8 @@ void Courtroom::done_received()
set_mute_list();
show();
+
+ ui_spectator->show();
}
void Courtroom::set_char_select_page()
@@ -681,22 +683,30 @@ void Courtroom::set_background(QString p_background)
void Courtroom::enter_courtroom(int p_cid)
{
m_cid = p_cid;
- QString f_char = ao_app->get_char_name(char_list.at(m_cid).name);
+
+ QString f_char;
+
+ if (m_cid == -1)
+ f_char = "";
+ else
+ f_char = ao_app->get_char_name(char_list.at(m_cid).name);
+
current_char = f_char;
current_emote_page = 0;
current_emote = 0;
- ui_emotes->show();
+ if (m_cid == -1)
+ ui_emotes->hide();
+ else
+ ui_emotes->show();
set_emote_page();
current_evidence_page = 0;
current_evidence = 0;
- qDebug() << "setting evidence page";
set_evidence_page();
- qDebug() << "evidence page set";
QString side = ao_app->get_char_side(f_char);
@@ -743,7 +753,7 @@ void Courtroom::enter_courtroom(int p_cid)
ui_char_select_background->hide();
- ui_ic_chat_message->setEnabled(true);
+ ui_ic_chat_message->setEnabled(m_cid != -1);
ui_ic_chat_message->setFocus();
}
@@ -1147,6 +1157,12 @@ void Courtroom::play_preanim()
QString f_char = m_chatmessage[CHAR_NAME];
QString f_preanim = m_chatmessage[PRE_EMOTE];
+ if (!file_exists(ao_app->get_character_path(f_char) + ".gif"))
+ {
+ preanim_done();
+ return;
+ }
+
//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 text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod;
@@ -1740,6 +1756,7 @@ void Courtroom::on_change_character_clicked()
blip_player->set_volume(0);
ui_char_select_background->show();
+ ui_spectator->hide();
}
void Courtroom::on_reload_theme_clicked()
@@ -1775,12 +1792,9 @@ void Courtroom::on_char_select_right_clicked()
void Courtroom::on_spectator_clicked()
{
- ui_emotes->hide();
-
- ui_witness_testimony->hide();
- ui_cross_examination->hide();
+ enter_courtroom(-1);
- ui_ic_chat_message->setEnabled(false);
+ ui_emotes->hide();
ui_char_select_background->hide();
}
diff --git a/emotes.cpp b/emotes.cpp
index 8832a1a7..2409ff90 100644
--- a/emotes.cpp
+++ b/emotes.cpp
@@ -59,6 +59,9 @@ void Courtroom::construct_emotes()
void Courtroom::set_emote_page()
{
+ if (m_cid == -1)
+ return;
+
int total_emotes = ao_app->get_emote_number(current_char);
ui_emote_left->hide();
diff --git a/evidence.cpp b/evidence.cpp
index a5cbb166..90018fe8 100644
--- a/evidence.cpp
+++ b/evidence.cpp
@@ -83,6 +83,9 @@ void Courtroom::construct_evidence()
void Courtroom::set_evidence_page()
{
+ if (m_cid == -1)
+ return;
+
local_evidence_list.clear();
QString evi_string = char_list.at(m_cid).evidence_string;
@@ -101,29 +104,19 @@ void Courtroom::set_evidence_page()
int total_evidence = local_evidence_list.size();
- qDebug() << "total_evidence: " << total_evidence;
-
ui_evidence_left->hide();
ui_evidence_right->hide();
- qDebug() << "hid evidence left and right";
-
for (AOEvidenceButton *i_button : ui_evidence_list)
{
i_button->hide();
}
- qDebug() << "hid all evidence buttons";
-
if (total_evidence == 0)
return;
- qDebug() << "max_evi_on_page =" << max_evidence_on_page;
-
int total_pages = total_evidence / max_evidence_on_page;
- qDebug() << "total_pages: " << total_pages;
-
int evidence_on_page = 0;
if (total_evidence % max_evidence_on_page != 0)