aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriamgoofball <iamgoofball@gmail.com>2019-01-23 07:35:29 -0800
committeriamgoofball <iamgoofball@gmail.com>2019-01-23 07:35:29 -0800
commit0649e7b28e16a054072d8656a5046c7cc3cfefb6 (patch)
treeae5a5e0bf48a6b588314e337f36d8c1e9164a316 /src
parentf9406d0a7f2363843d9d7c09a9e8d3422c967a64 (diff)
Case Announcer: Witness Support also some other shit
Diffstat (limited to 'src')
-rw-r--r--src/aocaseannouncerdialog.cpp6
-rw-r--r--src/aocharmovie.cpp1
-rw-r--r--src/aoevidencebutton.cpp4
-rw-r--r--src/aomusicplayer.cpp2
-rw-r--r--src/charselect.cpp8
-rw-r--r--src/courtroom.cpp75
-rw-r--r--src/main.cpp2
-rw-r--r--src/packet_distribution.cpp25
8 files changed, 77 insertions, 46 deletions
diff --git a/src/aocaseannouncerdialog.cpp b/src/aocaseannouncerdialog.cpp
index 5b82b64f..4b36fe62 100644
--- a/src/aocaseannouncerdialog.cpp
+++ b/src/aocaseannouncerdialog.cpp
@@ -54,12 +54,15 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
ui_juror_needed->setText(tr("Jurors needed"));
ui_steno_needed = new QCheckBox(this);
ui_steno_needed->setText(tr("Stenographer needed"));
+ ui_witness_needed = new QCheckBox(this);
+ ui_witness_needed->setText(tr("Witness needed"));
ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed);
ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed);
ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed);
ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed);
ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed);
+ ui_form_layout->setWidget(6, QFormLayout::FieldRole, ui_witness_needed);
setUpdatesEnabled(true);
}
@@ -71,7 +74,8 @@ void AOCaseAnnouncerDialog::ok_pressed()
ui_prosecutor_needed->isChecked(),
ui_judge_needed->isChecked(),
ui_juror_needed->isChecked(),
- ui_steno_needed->isChecked());
+ ui_steno_needed->isChecked(),
+ ui_witness_needed->isChecked());
done(0);
}
diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp
index 3d650551..7fed6b06 100644
--- a/src/aocharmovie.cpp
+++ b/src/aocharmovie.cpp
@@ -48,7 +48,6 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
m_movie->setFileName(gif_path);
m_movie->jumpToFrame(0);
this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
- qDebug() << "playing file path: " << gif_path;
this->show();
this->play_frame_sfx();
ticker->start(m_movie->nextFrameDelay());
diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp
index 924aeb88..ab654bfe 100644
--- a/src/aoevidencebutton.cpp
+++ b/src/aoevidencebutton.cpp
@@ -89,15 +89,11 @@ void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e)
{
//QWidget::dragLeaveEvent(e);
-
- qDebug() << "drag leave event";
}
void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
{
//QWidget::dragEnterEvent(e);
-
- qDebug() << "drag enter event";
}
void AOEvidenceButton::enterEvent(QEvent * e)
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp
index 2a35f0bb..fca3c16c 100644
--- a/src/aomusicplayer.cpp
+++ b/src/aomusicplayer.cpp
@@ -35,7 +35,6 @@ void AOMusicPlayer::play(QString p_song)
double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds
if(time > 0)
{
- qDebug() << "Will loop in " << time << " seconds.";
music_loop_timer->start(time*1000);
}
}
@@ -57,7 +56,6 @@ QString AOMusicPlayer::get_path()
void AOMusicPlayer::restart_loop()
{
- qDebug() << "Restarting Music";
/*
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")
diff --git a/src/charselect.cpp b/src/charselect.cpp
index c5a10bde..6edd87ef 100644
--- a/src/charselect.cpp
+++ b/src/charselect.cpp
@@ -253,6 +253,10 @@ void Courtroom::character_loading_finished()
AOCharButton* character = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
AOCharSelectGenerationThreading *char_generate = new AOCharSelectGenerationThreading(this, n, character);
QThreadPool::globalInstance()->start(char_generate);
+ if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount())
+ {
+ QThreadPool::globalInstance()->waitForDone();
+ }
}
QThreadPool::globalInstance()->waitForDone();
filter_character_list();
@@ -265,6 +269,10 @@ void Courtroom::filter_character_list()
{
AOCharSelectFilterThreading *char_filter = new AOCharSelectFilterThreading(this, i);
QThreadPool::globalInstance()->start(char_filter);
+ if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount())
+ {
+ QThreadPool::globalInstance()->waitForDone();
+ }
}
QThreadPool::globalInstance()->waitForDone();
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 19caa8dc..8c25a2db 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1,5 +1,4 @@
#include "courtroom.h"
-
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
{
ao_app = p_ao_app;
@@ -28,7 +27,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
}
}
}
-
keepalive_timer = new QTimer(this);
keepalive_timer->start(60000);
@@ -854,45 +852,58 @@ void Courtroom::set_background(QString p_background)
}
}
-void Courtroom::enter_courtroom(int p_cid)
-{
- m_cid = p_cid;
+void Courtroom::set_character(int char_id) // can you fucking believe this didn't exist yet
+{
+ m_cid = char_id;
- QString f_char;
+ QString f_char;
- if (m_cid == -1)
- {
- if (ao_app->is_discord_enabled())
- ao_app->discord->state_spectate();
- f_char = "";
- }
- else
- {
- f_char = ao_app->get_char_name(char_list.at(m_cid).name);
+ if (m_cid == -1)
+ {
+ if (ao_app->is_discord_enabled())
+ ao_app->discord->state_spectate();
+ f_char = "";
+ }
+ else
+ {
+ f_char = ao_app->get_char_name(char_list.at(m_cid).name);
- if (ao_app->is_discord_enabled())
- ao_app->discord->state_character(f_char.toStdString());
- }
+ if (ao_app->is_discord_enabled())
+ ao_app->discord->state_character(f_char.toStdString());
+ }
- current_char = f_char;
+ current_char = f_char;
- current_emote_page = 0;
- current_emote = 0;
+ current_emote_page = 0;
+ current_emote = 0;
- if (m_cid == -1)
- ui_emotes->hide();
- else
- ui_emotes->show();
+ if (m_cid == -1)
+ ui_emotes->hide();
+ else
+ ui_emotes->show();
+
+ set_emote_page();
+ set_emote_dropdown();
- set_emote_page();
- set_emote_dropdown();
+ if (ao_app->custom_objection_enabled &&
+ (file_exists(ao_app->get_character_path(current_char, "custom.gif")) ||
+ file_exists(ao_app->get_character_path(current_char, "custom.apng"))) &&
+ file_exists(ao_app->get_character_path(current_char, "custom.wav")))
+ ui_custom_objection->show();
+ else
+ ui_custom_objection->hide();
+}
+
+void Courtroom::enter_courtroom(int p_cid)
+{
+ this->set_character(p_cid);
current_evidence_page = 0;
current_evidence = 0;
set_evidence_page();
- QString side = ao_app->get_char_side(f_char);
+ QString side = ao_app->get_char_side(current_char);
if (side == "jud")
{
@@ -1085,7 +1096,6 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt
colour = ao_app->get_color("ooc_default_color", "courtroom_design.ini").name();
if (p_colour == "1")
colour = ao_app->get_color("ooc_server_color", "courtroom_design.ini").name();
- qDebug() << p_message;
if(p_message == "Logged in as a moderator.")
{
ui_guard->show();
@@ -2955,7 +2965,7 @@ void Courtroom::mod_called(QString p_ip)
}
}
-void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno)
+void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness)
{
if (ui_casing->isChecked())
{
@@ -3674,7 +3684,7 @@ void Courtroom::on_char_select_right_clicked()
void Courtroom::on_spectator_clicked()
{
- enter_courtroom(-1);
+ this->set_character(-1);
ui_emotes->hide();
@@ -3820,7 +3830,7 @@ void Courtroom::on_casing_clicked()
}
}
-void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno)
+void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno, bool wit)
{
if (ao_app->casing_alerts_enabled)
{
@@ -3832,6 +3842,7 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool
f_packet.append(QString::number(jud));
f_packet.append(QString::number(jur));
f_packet.append(QString::number(steno));
+ f_packet.append(QString::number(wit));
ao_app->send_server_packet(new AOPacket("CASEA", f_packet));
}
diff --git a/src/main.cpp b/src/main.cpp
index 80ea93bb..5aae5c6e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
AOApplication main_app(argc, argv);
main_app.construct_lobby();
- main_app.net_manager->connect_to_master();
main_app.w_lobby->show();
+ main_app.net_manager->connect_to_master();
return main_app.exec();
}
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index 0cbf4631..7ad24739 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -460,9 +460,24 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
{
if (f_contents.size() < 3)
goto end;
-
- if (courtroom_constructed)
- w_courtroom->enter_courtroom(f_contents.at(2).toInt());
+ if(f_contents.size() < 4){
+ if (courtroom_constructed)
+ w_courtroom->enter_courtroom(f_contents.at(2).toInt());
+ }
+ else
+ {
+ if (courtroom_constructed)
+ {
+ if(f_contents.at(3) == "True")
+ {
+ w_courtroom->set_character(f_contents.at(2).toInt());
+ }
+ else
+ {
+ w_courtroom->enter_courtroom(f_contents.at(2).toInt());
+ }
+ }
+ }
}
else if (header == "MS")
{
@@ -577,8 +592,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
}
else if (header == "CASEA")
{
- if (courtroom_constructed && f_contents.size() > 6)
- w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1");
+ if (courtroom_constructed && f_contents.size() > 7)
+ w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1", f_contents.at(6) == "1");
}
end: