bugfixes and shit

This commit is contained in:
iamgoofball 2019-02-01 16:28:14 -08:00
parent 0649e7b28e
commit fc984fcfe2
11 changed files with 46 additions and 60 deletions

Binary file not shown.

View File

@ -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
guilty = sfx-guilty.wav
case_call = case_announced.ogg

View File

@ -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();

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -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)

View File

@ -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#%"));
}
}

View File

@ -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<QString>();
return result.startsWith("true");
}
bool AOApplication::get_casing_cm_enabled()
{
QString result = configini->value("casing_cm_enabled", "false").value<QString>();