diff --git a/base/sounds/general/case_announced.ogg b/base/sounds/general/case_announced.ogg new file mode 100644 index 0000000..1e9c3d4 Binary files /dev/null and b/base/sounds/general/case_announced.ogg differ diff --git a/base/themes/default/courtroom_sounds.ini b/base/themes/default/courtroom_sounds.ini index 050576e..eba07a6 100644 --- a/base/themes/default/courtroom_sounds.ini +++ b/base/themes/default/courtroom_sounds.ini @@ -5,4 +5,5 @@ evidence_present = sfx-evidenceshoop.wav word_call = sfx-gaspen-yeah!.wav mod_call = adminhelp.ogg not_guilty = sfx-notguilty.wav -guilty = sfx-guilty.wav \ No newline at end of file +guilty = sfx-guilty.wav +case_call = case_announced.ogg \ No newline at end of file diff --git a/include/aoapplication.h b/include/aoapplication.h index 095dafd..19eb474 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -323,6 +323,9 @@ public: // Same for CM. bool get_casing_cm_enabled(); + // Same for witnesses. + bool get_casing_wit_enabled(); + // Get the message for the CM for casing alerts. QString get_casing_can_host_cases(); diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 24ea0c5..a88cb79 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -26,14 +26,11 @@ public: private: QWidget *m_parent; AOApplication *ao_app; - QTimer *music_loop_timer; int m_volume = 0; QString f_path; HSTREAM m_stream; -private slots: - void restart_loop(); }; #endif // AOMUSICPLAYER_H diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 175b804..53bd309 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -106,6 +106,8 @@ private: QCheckBox *ui_casing_steno_cb; QLabel *ui_casing_cm_lbl; QCheckBox *ui_casing_cm_cb; + QLabel *ui_casing_wit_lbl; + QCheckBox *ui_casing_wit_cb; QLabel *ui_casing_cm_cases_lbl; QLineEdit *ui_casing_cm_cases_textbox; diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 5c6f108..39bea0d 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -22,13 +22,10 @@ public: private: QWidget *m_parent; AOApplication *ao_app; - QTimer *sfx_loop_timer; int m_volume = 0; bool looping_sfx = false; HSTREAM m_stream; -private slots: - void restart_loop(); }; #endif // AOSFXPLAYER_H diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index fca3c16..7fcb277 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -5,9 +5,6 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject( { m_parent = parent; ao_app = p_ao_app; - music_loop_timer = new QTimer(this); - music_loop_timer->setSingleShot(true); - connect(music_loop_timer, SIGNAL(timeout()), this, SLOT(restart_loop())); } AOMusicPlayer::~AOMusicPlayer() @@ -27,17 +24,16 @@ void AOMusicPlayer::play(QString p_song) if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); - BASS_ChannelPlay(m_stream, false); - music_loop_timer->stop(); if(enable_looping) { - QWORD len=BASS_ChannelGetLength(m_stream, BASS_POS_BYTE); // the length in bytes - double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds - if(time > 0) - { - music_loop_timer->start(time*1000); - } + BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); } + else + { + BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP); + } + BASS_ChannelPlay(m_stream, false); + } @@ -54,21 +50,8 @@ QString AOMusicPlayer::get_path() return f_path; } -void AOMusicPlayer::restart_loop() -{ - /* - m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); - if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(m_stream, BASS_GetDevice());*/ - QWORD len=BASS_ChannelGetLength(m_stream, BASS_POS_BYTE); // the length in bytes - double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds - music_loop_timer->start(time*1000); - BASS_ChannelPlay(m_stream, true); -} - void AOMusicPlayer::kill_loop() { - music_loop_timer->stop(); BASS_ChannelStop(m_stream); } diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 247a231..03b4e67 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -467,6 +467,18 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb); + ui_casing_wit_lbl = new QLabel(ui_casing_widget); + ui_casing_wit_lbl->setText(tr("Witness:")); + ui_casing_wit_lbl->setToolTip(tr("If checked, you will appear amongst the potential " + "witnesses on the server.")); + + ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_wit_lbl); + + ui_casing_wit_cb = new QCheckBox(ui_casing_widget); + ui_casing_wit_cb->setChecked(ao_app->get_casing_wit_enabled()); + + ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_wit_cb); + // -- CM CASES ANNOUNCEMENTS ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget); @@ -474,12 +486,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_casing_cm_cases_lbl->setToolTip(tr("If you're a CM, enter what cases you are " "willing to host.")); - ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_cm_cases_lbl); + ui_casing_layout->setWidget(9, QFormLayout::LabelRole, ui_casing_cm_cases_lbl); ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); - ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); + ui_casing_layout->setWidget(9, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); // When we're done, we should continue the updates! setUpdatesEnabled(true); diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index e219c03..e39071e 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -5,9 +5,6 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject() { m_parent = parent; ao_app = p_ao_app; - sfx_loop_timer = new QTimer(this); - sfx_loop_timer->setSingleShot(true); - connect(sfx_loop_timer, SIGNAL(timeout()), this, SLOT(restart_loop())); } void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) @@ -39,12 +36,13 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); BASS_ChannelPlay(m_stream, false); - sfx_loop_timer->stop(); - QWORD len=BASS_ChannelGetLength(m_stream, BASS_POS_BYTE); // the length in bytes - double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds - if(time > 0 && looping_sfx && ao_app->get_looping_sfx()) + if(looping_sfx && ao_app->get_looping_sfx()) { - sfx_loop_timer->start(time*1000); + BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); + } + else + { + BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP); } } @@ -56,18 +54,6 @@ void AOSfxPlayer::setLooping(bool is_looping) void AOSfxPlayer::stop() { BASS_ChannelStop(m_stream); - sfx_loop_timer->stop(); -} - -void AOSfxPlayer::restart_loop() -{ - if(ao_app->get_looping_sfx() && looping_sfx) - { - QWORD len=BASS_ChannelGetLength(m_stream, BASS_POS_BYTE); // the length in bytes - double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds - sfx_loop_timer->start(time*1000); - BASS_ChannelPlay(m_stream, true); - } } void AOSfxPlayer::set_volume(int p_value) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 8c25a2d..a082e6b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -984,12 +984,10 @@ void Courtroom::list_music() for (int n_song = 0 ; n_song < music_list.size() ; ++n_song) { QString i_song = music_list.at(n_song); - QString i_song_listname = i_song; - i_song_listname = i_song_listname.left(i_song_listname.lastIndexOf(".")); if (i_song.toLower().contains(ui_music_search->text().toLower())) { - ui_music_list->addItem(i_song_listname); + ui_music_list->addItem(i_song); music_row_to_number.append(n_song); QString song_path = ao_app->get_music_path(i_song); @@ -2825,7 +2823,6 @@ void Courtroom::handle_song(QStringList *p_contents) QString f_song = f_contents.at(0); QString f_song_clear = f_song; - f_song_clear = f_song_clear.left(f_song_clear.lastIndexOf(".")); int n_char = f_contents.at(1).toInt(); if (n_char < 0 || n_char >= char_list.size()) @@ -2865,7 +2862,7 @@ void Courtroom::handle_song(QStringList *p_contents) ic_chatlog_history.removeFirst(); } - append_ic_text(f_song_clear, str_show, true); + append_ic_text(f_song, str_show, true); music_player->play(f_song); } } @@ -2974,7 +2971,8 @@ void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, (ao_app->get_casing_prosecution_enabled() && pro) || (ao_app->get_casing_judge_enabled() && jud) || (ao_app->get_casing_juror_enabled() && jur) || - (ao_app->get_casing_steno_enabled() && steno)) + (ao_app->get_casing_steno_enabled() && steno) || + (ao_app->get_casing_wit_enabled() && witness)) { modcall_player->play(ao_app->get_sfx("case_call")); ao_app->alert(this); @@ -3822,11 +3820,12 @@ void Courtroom::on_casing_clicked() f_packet.append(QString::number(ao_app->get_casing_judge_enabled())); f_packet.append(QString::number(ao_app->get_casing_juror_enabled())); f_packet.append(QString::number(ao_app->get_casing_steno_enabled())); + f_packet.append(QString::number(ao_app->get_casing_wit_enabled())); ao_app->send_server_packet(new AOPacket("SETCASE", f_packet)); } else - ao_app->send_server_packet(new AOPacket("SETCASE#\"\"#0#0#0#0#0#0#%")); + ao_app->send_server_packet(new AOPacket("SETCASE#\"\"#0#0#0#0#0#0#0#%")); } } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 68d0a04..a5eb273 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -685,6 +685,12 @@ bool AOApplication::get_casing_steno_enabled() return result.startsWith("true"); } +bool AOApplication::get_casing_wit_enabled() +{ + QString result = configini->value("casing_wit_enabled", "false").value(); + return result.startsWith("true"); +} + bool AOApplication::get_casing_cm_enabled() { QString result = configini->value("casing_cm_enabled", "false").value();