Case Announcer: Witness Support also some other shit
This commit is contained in:
		
							parent
							
								
									f9406d0a7f
								
							
						
					
					
						commit
						0649e7b28e
					
				@ -36,6 +36,7 @@ private:
 | 
			
		||||
  QCheckBox *ui_judge_needed;
 | 
			
		||||
  QCheckBox *ui_juror_needed;
 | 
			
		||||
  QCheckBox *ui_steno_needed;
 | 
			
		||||
  QCheckBox *ui_witness_needed;
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
  void ok_pressed();
 | 
			
		||||
 | 
			
		||||
@ -59,6 +59,7 @@
 | 
			
		||||
#include <QThreadPool>
 | 
			
		||||
#include <QFuture>
 | 
			
		||||
#include <QMetaObject>
 | 
			
		||||
#include <QLayout>
 | 
			
		||||
#include <stack>
 | 
			
		||||
 | 
			
		||||
class AOApplication;
 | 
			
		||||
@ -194,6 +195,9 @@ public:
 | 
			
		||||
  //properly sets up some varibles: resets user state
 | 
			
		||||
  void enter_courtroom(int p_cid);
 | 
			
		||||
 | 
			
		||||
  // mfw this didnt fucking exist yet
 | 
			
		||||
  void set_character(int char_id);
 | 
			
		||||
 | 
			
		||||
  //helper function that populates ui_music_list with the contents of music_list
 | 
			
		||||
  void list_music();
 | 
			
		||||
  void list_areas();
 | 
			
		||||
@ -234,7 +238,7 @@ public:
 | 
			
		||||
  //Toggles the judge buttons, whether they should appear or not.
 | 
			
		||||
  void toggle_judge_buttons(bool is_on);
 | 
			
		||||
 | 
			
		||||
  void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno);
 | 
			
		||||
  void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno, bool wit);
 | 
			
		||||
 | 
			
		||||
  void check_connection_received();
 | 
			
		||||
  void doScreenShake();
 | 
			
		||||
@ -575,7 +579,7 @@ public slots:
 | 
			
		||||
 | 
			
		||||
  void mod_called(QString p_ip);
 | 
			
		||||
 | 
			
		||||
  void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno);
 | 
			
		||||
  void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness);
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void start_chat_ticking();
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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());
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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")
 | 
			
		||||
 | 
			
		||||
@ -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();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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::set_character(int char_id) // can you fucking believe this didn't exist yet
 | 
			
		||||
{
 | 
			
		||||
    m_cid = char_id;
 | 
			
		||||
 | 
			
		||||
    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 (ao_app->is_discord_enabled())
 | 
			
		||||
        ao_app->discord->state_character(f_char.toStdString());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    current_char = f_char;
 | 
			
		||||
 | 
			
		||||
    current_emote_page = 0;
 | 
			
		||||
    current_emote = 0;
 | 
			
		||||
 | 
			
		||||
    if (m_cid == -1)
 | 
			
		||||
      ui_emotes->hide();
 | 
			
		||||
    else
 | 
			
		||||
      ui_emotes->show();
 | 
			
		||||
 | 
			
		||||
    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)
 | 
			
		||||
{ 
 | 
			
		||||
  m_cid = p_cid;
 | 
			
		||||
 | 
			
		||||
  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 (ao_app->is_discord_enabled())
 | 
			
		||||
      ao_app->discord->state_character(f_char.toStdString());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  current_char = f_char;
 | 
			
		||||
 | 
			
		||||
  current_emote_page = 0;
 | 
			
		||||
  current_emote = 0;
 | 
			
		||||
 | 
			
		||||
  if (m_cid == -1)
 | 
			
		||||
    ui_emotes->hide();
 | 
			
		||||
  else
 | 
			
		||||
    ui_emotes->show();
 | 
			
		||||
 | 
			
		||||
  set_emote_page();
 | 
			
		||||
  set_emote_dropdown();
 | 
			
		||||
  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));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user