aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriamgoofball <iamgoofball@gmail.com>2019-02-01 16:28:14 -0800
committeriamgoofball <iamgoofball@gmail.com>2019-02-01 16:28:14 -0800
commitfc984fcfe2a4416274810de81a8f36fe77b0dba9 (patch)
tree567159b15acde3b546e795c52e24520919763a99 /src
parent0649e7b28e16a054072d8656a5046c7cc3cfefb6 (diff)
bugfixes and shit
Diffstat (limited to 'src')
-rw-r--r--src/aomusicplayer.cpp31
-rw-r--r--src/aooptionsdialog.cpp16
-rw-r--r--src/aosfxplayer.cpp26
-rw-r--r--src/courtroom.cpp13
-rw-r--r--src/text_file_functions.cpp6
5 files changed, 39 insertions, 53 deletions
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp
index fca3c16c..7fcb277f 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 247a2317..03b4e67b 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 e219c031..e39071e5 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 8c25a2db..a082e6b8 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 68d0a041..a5eb2731 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<QString>();
+ return result.startsWith("true");
+}
+
bool AOApplication::get_casing_cm_enabled()
{
QString result = configini->value("casing_cm_enabled", "false").value<QString>();