fixed a bug where spectators could not hear music

This commit is contained in:
David Skoland 2017-02-15 13:58:14 +01:00
parent 3f926341c8
commit f7db8fa64a
3 changed files with 30 additions and 20 deletions

View File

@ -608,6 +608,8 @@ void Courtroom::done_received()
set_mute_list(); set_mute_list();
show(); show();
ui_spectator->show();
} }
void Courtroom::set_char_select_page() void Courtroom::set_char_select_page()
@ -681,12 +683,22 @@ void Courtroom::set_background(QString p_background)
void Courtroom::enter_courtroom(int p_cid) void Courtroom::enter_courtroom(int p_cid)
{ {
m_cid = 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_char = f_char;
current_emote_page = 0; current_emote_page = 0;
current_emote = 0; current_emote = 0;
if (m_cid == -1)
ui_emotes->hide();
else
ui_emotes->show(); ui_emotes->show();
set_emote_page(); set_emote_page();
@ -694,9 +706,7 @@ void Courtroom::enter_courtroom(int p_cid)
current_evidence_page = 0; current_evidence_page = 0;
current_evidence = 0; current_evidence = 0;
qDebug() << "setting evidence page";
set_evidence_page(); set_evidence_page();
qDebug() << "evidence page set";
QString side = ao_app->get_char_side(f_char); 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_char_select_background->hide();
ui_ic_chat_message->setEnabled(true); ui_ic_chat_message->setEnabled(m_cid != -1);
ui_ic_chat_message->setFocus(); ui_ic_chat_message->setFocus();
} }
@ -1147,6 +1157,12 @@ void Courtroom::play_preanim()
QString f_char = m_chatmessage[CHAR_NAME]; QString f_char = m_chatmessage[CHAR_NAME];
QString f_preanim = m_chatmessage[PRE_EMOTE]; 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 //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) * time_mod;
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;
@ -1740,6 +1756,7 @@ void Courtroom::on_change_character_clicked()
blip_player->set_volume(0); blip_player->set_volume(0);
ui_char_select_background->show(); ui_char_select_background->show();
ui_spectator->hide();
} }
void Courtroom::on_reload_theme_clicked() void Courtroom::on_reload_theme_clicked()
@ -1775,13 +1792,10 @@ void Courtroom::on_char_select_right_clicked()
void Courtroom::on_spectator_clicked() void Courtroom::on_spectator_clicked()
{ {
enter_courtroom(-1);
ui_emotes->hide(); ui_emotes->hide();
ui_witness_testimony->hide();
ui_cross_examination->hide();
ui_ic_chat_message->setEnabled(false);
ui_char_select_background->hide(); ui_char_select_background->hide();
} }

View File

@ -59,6 +59,9 @@ void Courtroom::construct_emotes()
void Courtroom::set_emote_page() void Courtroom::set_emote_page()
{ {
if (m_cid == -1)
return;
int total_emotes = ao_app->get_emote_number(current_char); int total_emotes = ao_app->get_emote_number(current_char);
ui_emote_left->hide(); ui_emote_left->hide();

View File

@ -83,6 +83,9 @@ void Courtroom::construct_evidence()
void Courtroom::set_evidence_page() void Courtroom::set_evidence_page()
{ {
if (m_cid == -1)
return;
local_evidence_list.clear(); local_evidence_list.clear();
QString evi_string = char_list.at(m_cid).evidence_string; 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(); int total_evidence = local_evidence_list.size();
qDebug() << "total_evidence: " << total_evidence;
ui_evidence_left->hide(); ui_evidence_left->hide();
ui_evidence_right->hide(); ui_evidence_right->hide();
qDebug() << "hid evidence left and right";
for (AOEvidenceButton *i_button : ui_evidence_list) for (AOEvidenceButton *i_button : ui_evidence_list)
{ {
i_button->hide(); i_button->hide();
} }
qDebug() << "hid all evidence buttons";
if (total_evidence == 0) if (total_evidence == 0)
return; return;
qDebug() << "max_evi_on_page =" << max_evidence_on_page;
int total_pages = total_evidence / max_evidence_on_page; int total_pages = total_evidence / max_evidence_on_page;
qDebug() << "total_pages: " << total_pages;
int evidence_on_page = 0; int evidence_on_page = 0;
if (total_evidence % max_evidence_on_page != 0) if (total_evidence % max_evidence_on_page != 0)