From 3c0cedbe922c9fcacd0d171423f83e375f66e178 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Fri, 18 Jan 2019 19:08:56 -0800 Subject: Add screenshake, frame-specific effects, looping SFX, and clientside music looping Committed by patch since Goof is currently banned on GitHub for no good reason. --- src/courtroom.cpp | 271 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 256 insertions(+), 15 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index be7629b..ab387da 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -56,7 +56,13 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() sfx_player = new AOSfxPlayer(this, ao_app); sfx_player->set_volume(0); objection_player = new AOSfxPlayer(this, ao_app); - sfx_player->set_volume(0); + objection_player->set_volume(0); + misc_sfx_player = new AOSfxPlayer(this, ao_app); + misc_sfx_player->set_volume(0); + frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); + frame_emote_sfx_player->set_volume(0); + pair_frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); // todo: recode pair // todo: recode fucking everything + pair_frame_emote_sfx_player->set_volume(0); blip_player = new AOBlipPlayer(this, ao_app); blip_player->set_volume(0); @@ -70,7 +76,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_speedlines = new AOMovie(ui_viewport, ao_app); ui_vp_speedlines->set_play_once(false); ui_vp_player_char = new AOCharMovie(ui_viewport, ao_app); + ui_vp_player_char->frame_specific_sfx_player = frame_emote_sfx_player; + ui_vp_player_char->mycourtroom = this; ui_vp_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); + ui_vp_sideplayer_char->frame_specific_sfx_player = pair_frame_emote_sfx_player; + ui_vp_sideplayer_char->mycourtroom = this; ui_vp_sideplayer_char->hide(); ui_vp_desk = new AOScene(ui_viewport, ao_app); ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app); @@ -200,6 +210,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_custom_objection = new AOButton(this, ao_app); ui_realization = new AOButton(this, ao_app); + ui_screenshake = new AOButton(this, ao_app); ui_mute = new AOButton(this, ao_app); ui_defense_plus = new AOButton(this, ao_app); @@ -284,7 +295,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_custom_objection, SIGNAL(clicked()), this, SLOT(on_custom_objection_clicked())); connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked())); - + connect(ui_screenshake, SIGNAL(clicked()), this, SLOT(on_screenshake_clicked())); connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked())); connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked())); @@ -622,6 +633,9 @@ void Courtroom::set_widgets() set_size_and_pos(ui_realization, "realization"); ui_realization->set_image("realization.png"); + set_size_and_pos(ui_screenshake, "screenshake"); + ui_screenshake->set_image("screenshake.png"); + set_size_and_pos(ui_mute, "mute_button"); ui_mute->set_image("mute.png"); @@ -909,6 +923,9 @@ void Courtroom::enter_courtroom(int p_cid) music_player->set_volume(ui_music_slider->value()); sfx_player->set_volume(ui_sfx_slider->value()); objection_player->set_volume(ui_sfx_slider->value()); + misc_sfx_player->set_volume(ui_sfx_slider->value()); + frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); + pair_frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); blip_player->set_volume(ui_blip_slider->value()); testimony_in_progress = false; @@ -1227,7 +1244,126 @@ void Courtroom::on_chat_return_pressed() packet_contents.append("0"); } } + // If the server we're on supports Looping SFX and Screenshake, use it if the emote uses it. + if (ao_app->looping_sfx_support_enabled) + { + packet_contents.append(ao_app->get_sfx_looping(current_char, current_emote)); + qDebug() << "Are we looping this? " << ao_app->get_sfx_looping(current_char, current_emote); + packet_contents.append(QString::number(screenshake_state)); + qDebug() << "Are we screen shaking this one? " << screenshake_state; + + QString frame_screenshake = ""; + QString frame_realization = ""; + QString frame_sfx = ""; + + QString preemote_sfx = ""; + QString preemote_shake = ""; + QString preemote_flash = ""; + + QString talkemote_sfx = ""; + QString talkemote_shake = ""; + QString talkemote_flash = ""; + + QString idleemote_sfx = ""; + QString idleemote_shake = ""; + QString idleemote_flash = ""; + + QString preemote = ao_app->get_image_suffix(ao_app->get_character_path(current_char, ao_app->get_pre_emote(current_char, current_emote))); + QString talkemote_to_check = ao_app->get_image_suffix(ao_app->get_character_path(current_char, "(b)" + ao_app->get_emote(current_char, current_emote))); + QString idleemote_to_check = ao_app->get_image_suffix(ao_app->get_character_path(current_char, "(a)" + ao_app->get_emote(current_char, current_emote))); + frame_emote_checker = new QImageReader(preemote); + preemote_sfx += ao_app->get_pre_emote(current_char, current_emote); + preemote_shake += ao_app->get_pre_emote(current_char, current_emote); + preemote_flash += ao_app->get_pre_emote(current_char, current_emote); + for (int i = 0; i < frame_emote_checker->imageCount(); i++) { + QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, ao_app->get_pre_emote(current_char, current_emote), i); + QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, ao_app->get_pre_emote(current_char, current_emote), i); + QString realization_to_play = ao_app->get_realization_frame(current_char, ao_app->get_pre_emote(current_char, current_emote), i); + if(sfx_to_play != "") + { + preemote_sfx += "|" + QString::number(i) + "=" + sfx_to_play; + } + if(screenshake_to_play != "") + { + preemote_shake += "|" + QString::number(i) + "=" + screenshake_to_play; + } + if(realization_to_play != "") + { + preemote_flash += "|" + QString::number(i) + "=" + realization_to_play; + } + } + preemote_sfx += "^"; + preemote_shake += "^"; + preemote_flash += "^"; + delete frame_emote_checker; + talkemote_sfx += "(b)" + ao_app->get_emote(current_char, current_emote); + talkemote_shake += "(b)" + ao_app->get_emote(current_char, current_emote); + talkemote_flash += "(b)" + ao_app->get_emote(current_char, current_emote); + frame_emote_checker = new QImageReader(talkemote_to_check); + for (int i = 0; i < frame_emote_checker->imageCount(); i++) { + QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, "(b)" + ao_app->get_emote(current_char, current_emote), i); + QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, "(b)" + ao_app->get_emote(current_char, current_emote), i); + QString realization_to_play = ao_app->get_realization_frame(current_char, "(b)" + ao_app->get_emote(current_char, current_emote), i); + if(sfx_to_play != "") + { + talkemote_sfx += "|" + QString::number(i) + "=" + sfx_to_play; + } + if(screenshake_to_play != "") + { + talkemote_shake += "|" + QString::number(i) + "=" + screenshake_to_play; + } + if(realization_to_play != "") + { + talkemote_flash += "|" + QString::number(i) + "=" + realization_to_play; + } + } + talkemote_sfx += "^"; + talkemote_shake += "^"; + talkemote_flash += "^"; + delete frame_emote_checker; + idleemote_sfx += "(a)" + ao_app->get_emote(current_char, current_emote); + idleemote_shake += "(a)" + ao_app->get_emote(current_char, current_emote); + idleemote_flash += "(a)" + ao_app->get_emote(current_char, current_emote); + frame_emote_checker = new QImageReader(idleemote_to_check); + for (int i = 0; i < frame_emote_checker->imageCount(); i++) { + QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, "(a)" + ao_app->get_emote(current_char, current_emote), i); + QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, "(a)" + ao_app->get_emote(current_char, current_emote), i); + QString realization_to_play = ao_app->get_realization_frame(current_char, "(a)" + ao_app->get_emote(current_char, current_emote), i); + if(sfx_to_play != "") + { + idleemote_sfx += "|" + QString::number(i) + "=" + sfx_to_play; + } + if(screenshake_to_play != "") + { + idleemote_shake += "|" + QString::number(i) + "=" + screenshake_to_play; + } + if(realization_to_play != "") + { + idleemote_flash += "|" + QString::number(i) + "=" + realization_to_play; + } + } + delete frame_emote_checker; + + frame_screenshake += preemote_shake; + frame_screenshake += talkemote_shake; + frame_screenshake += idleemote_shake; + + frame_realization += preemote_flash; + frame_realization += talkemote_flash; + frame_realization += idleemote_flash; + + frame_sfx += preemote_sfx; + frame_sfx += talkemote_sfx; + frame_sfx += idleemote_sfx; + qDebug() << "Final strings:"; + qDebug() << frame_screenshake; + qDebug() << frame_realization; + qDebug() << frame_sfx; + packet_contents.append(frame_screenshake); + packet_contents.append(frame_realization); + packet_contents.append(frame_sfx); + } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1296,6 +1432,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_ic_chat_message->clear(); objection_state = 0; realization_state = 0; + screenshake_state = 0; is_presenting_evidence = false; ui_pre->setChecked(false); ui_hold_it->set_image("holdit.png"); @@ -1303,6 +1440,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_take_that->set_image("takethat.png"); ui_custom_objection->set_image("custom.png"); ui_realization->set_image("realization.png"); + ui_screenshake->set_image("screenshake.png"); ui_evidence_present->set_image("present_disabled.png"); } @@ -1334,6 +1472,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) case 2: ui_vp_objection->play("objection", f_char, f_custom_theme); objection_player->play("objection.wav", f_char, f_custom_theme); + if(ao_app->get_objectmusic()) + music_player->kill_loop(); break; case 3: ui_vp_objection->play("takethat", f_char, f_custom_theme); @@ -1366,7 +1506,10 @@ void Courtroom::handle_chatmessage_2() { ui_vp_speedlines->stop(); ui_vp_player_char->stop(); - + ui_vp_player_char->frame_sfx_hellstring = m_chatmessage[FRAME_SFX]; + ui_vp_player_char->frame_realization_hellstring = m_chatmessage[FRAME_REALIZATION]; + ui_vp_player_char->frame_screenshake_hellstring = m_chatmessage[FRAME_SCREENSHAKE]; + ui_vp_player_char->use_networked_framehell = true; if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; @@ -1548,6 +1691,7 @@ void Courtroom::handle_chatmessage_2() ui_vp_sideplayer_char->set_flipped(true); else ui_vp_sideplayer_char->set_flipped(false); + ui_vp_sideplayer_char->use_networked_framehell = false; ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE]); } else @@ -1555,13 +1699,17 @@ void Courtroom::handle_chatmessage_2() // If the server understands other characters, but there // really is no second character, hide 'em, and center the first. ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->stop(); ui_vp_sideplayer_char->move(0,0); ui_vp_player_char->move(0,0); } } } - + if (m_chatmessage[SCREENSHAKE] == "1") + { + this->doScreenShake(); + } switch (emote_mod) { case 1: case 2: case 6: @@ -1578,6 +1726,53 @@ void Courtroom::handle_chatmessage_2() } } +void Courtroom::doScreenShake() +{ + screenshake_group = new QParallelAnimationGroup; + screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this); + chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this); + int screen_x = ui_viewport->x(); + int screen_y = ui_viewport->y(); + QPoint pos_default = QPoint(screen_x, screen_y); + QPoint pos1 = QPoint(screen_x + 3, screen_y + -5); + QPoint pos2 = QPoint(screen_x + 3, screen_y + -5); + QPoint pos3 = QPoint(screen_x + -3, screen_y + 5); + QPoint pos4 = QPoint(screen_x + 3, screen_y + -5); + QPoint pos5 = QPoint(screen_x + -3,screen_y + -5); + + int chatbox_x = ui_vp_chatbox->x(); + int chatbox_y = ui_vp_chatbox->y(); + QPoint chatbox_pos_default = QPoint(chatbox_x, chatbox_y); + QPoint chatbox_pos1 = QPoint(chatbox_x + 3, chatbox_y + -5); + QPoint chatbox_pos2 = QPoint(chatbox_x + 3, chatbox_y + -5); + QPoint chatbox_pos3 = QPoint(chatbox_x + -3, chatbox_y + 5); + QPoint chatbox_pos4 = QPoint(chatbox_x + 3, chatbox_y + -5); + QPoint chatbox_pos5 = QPoint(chatbox_x + -3,chatbox_y + -5); + + screenshake_animation->setDuration(200); + screenshake_animation->setKeyValueAt(0, pos_default); + screenshake_animation->setKeyValueAt(0.1, pos1); + screenshake_animation->setKeyValueAt(0.3, pos2); + screenshake_animation->setKeyValueAt(0.5, pos3); + screenshake_animation->setKeyValueAt(0.7, pos4); + screenshake_animation->setKeyValueAt(0.9, pos5); + screenshake_animation->setEndValue(pos_default); + screenshake_animation->setEasingCurve(QEasingCurve::Linear); + chatbox_screenshake_animation->setDuration(200); + chatbox_screenshake_animation->setKeyValueAt(0, chatbox_pos_default); + chatbox_screenshake_animation->setKeyValueAt(0.1, chatbox_pos3); + chatbox_screenshake_animation->setKeyValueAt(0.3, chatbox_pos5); + chatbox_screenshake_animation->setKeyValueAt(0.5, chatbox_pos2); + chatbox_screenshake_animation->setKeyValueAt(0.7, chatbox_pos1); + chatbox_screenshake_animation->setKeyValueAt(0.9, chatbox_pos4); + chatbox_screenshake_animation->setEndValue(chatbox_pos_default); + chatbox_screenshake_animation->setEasingCurve(QEasingCurve::Linear); + + screenshake_group->addAnimation(screenshake_animation); + screenshake_group->addAnimation(chatbox_screenshake_animation); + screenshake_group->start(QAbstractAnimation::DeletionPolicy::DeleteWhenStopped); +} + void Courtroom::handle_chatmessage_3() { start_chat_ticking(); @@ -1709,6 +1904,17 @@ QString Courtroom::filter_ic_text(QString p_text) p_text.remove(trick_check_pos,1); } + else if (f_character == "$" and !ic_next_is_not_special) + { + p_text.remove(trick_check_pos,1); + } + + else if (f_character == "@" and !ic_next_is_not_special) + { + p_text.remove(trick_check_pos,1); + } + + // Orange inline colourisation. else if (f_character == "|" and !ic_next_is_not_special) { @@ -1919,14 +2125,14 @@ void Courtroom::play_preanim(bool noninterrupting) int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim); int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod; int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60; - + bool looping_sfx = m_chatmessage[LOOPING_SFX] == "1"; int preanim_duration; if (ao2_duration < 0) preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); else preanim_duration = ao2_duration; - + sfx_player->setLooping(looping_sfx); sfx_delay_timer->start(sfx_delay); QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); if (!file_exists(anim_to_find) || @@ -1942,7 +2148,6 @@ void Courtroom::play_preanim(bool noninterrupting) } ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); - if (noninterrupting) anim_state = 4; else @@ -1966,6 +2171,13 @@ void Courtroom::realization_done() ui_vp_realization->hide(); } +void Courtroom::doRealization() +{ + realization_timer->start(60); + ui_vp_realization->show(); + +} + void Courtroom::start_chat_ticking() { //we need to ensure that the text isn't already ticking because this function can be called by two logic paths @@ -1974,11 +2186,9 @@ void Courtroom::start_chat_ticking() if (m_chatmessage[REALIZATION] == "1") { - realization_timer->start(60); - ui_vp_realization->show(); - sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); + this->doRealization(); + misc_sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } - ui_vp_message->clear(); set_text_color(); rainbow_counter = 0; @@ -2076,6 +2286,18 @@ void Courtroom::chat_tick() formatting_char = true; } + else if (f_character == "@" and !next_character_is_not_special) + { + this->doScreenShake(); + formatting_char = true; + } + + else if (f_character == "$" and !next_character_is_not_special) + { + this->doRealization(); + formatting_char = true; + } + // Orange inline colourisation. else if (f_character == "|" and !next_character_is_not_special) { @@ -2541,7 +2763,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) //witness testimony if (p_wtce == "testimony1") { - sfx_player->play(ao_app->get_sfx("witness_testimony")); + misc_sfx_player->play(ao_app->get_sfx("witness_testimony")); ui_vp_wtce->play("witnesstestimony"); testimony_in_progress = true; show_testimony(); @@ -2549,7 +2771,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) //cross examination else if (p_wtce == "testimony2") { - sfx_player->play(ao_app->get_sfx("cross_examination")); + misc_sfx_player->play(ao_app->get_sfx("cross_examination")); ui_vp_wtce->play("crossexamination"); testimony_in_progress = false; } @@ -2557,12 +2779,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) { if (variant == 0) { - sfx_player->play(ao_app->get_sfx("not_guilty")); + misc_sfx_player->play(ao_app->get_sfx("not_guilty")); ui_vp_wtce->play("notguilty"); testimony_in_progress = false; } else if (variant == 1) { - sfx_player->play(ao_app->get_sfx("guilty")); + misc_sfx_player->play(ao_app->get_sfx("guilty")); ui_vp_wtce->play("guilty"); testimony_in_progress = false; } @@ -3140,6 +3362,22 @@ void Courtroom::on_realization_clicked() ui_ic_chat_message->setFocus(); } +void Courtroom::on_screenshake_clicked() +{ + if (screenshake_state == 0) + { + screenshake_state = 1; + ui_screenshake->set_image("screenshake_pressed.png"); + } + else + { + screenshake_state = 0; + ui_screenshake->set_image("screenshake.png"); + } + + ui_ic_chat_message->setFocus(); +} + void Courtroom::on_mute_clicked() { if (ui_mute_list->isHidden()) @@ -3223,6 +3461,9 @@ void Courtroom::on_sfx_slider_moved(int p_value) { sfx_player->set_volume(p_value); objection_player->set_volume(p_value); + misc_sfx_player->set_volume(p_value); + frame_emote_sfx_player->set_volume(p_value); + pair_frame_emote_sfx_player->set_volume(p_value); ui_ic_chat_message->setFocus(); } -- cgit From 248444307ff7cbe87ec4fe4024073cddb999dabc Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Fri, 18 Jan 2019 22:05:21 -0800 Subject: Fix bug with simultaneous shakes --- src/courtroom.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ab387da..ce4ccf1 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -776,6 +776,24 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) } } +QPoint Courtroom::get_theme_pos(QString p_identifier) +{ + QString filename = "courtroom_design.ini"; + + pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); + + if (design_ini_result.width < 0 || design_ini_result.height < 0) + { + qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename; + return QPoint(0,0); + } + else + { + return QPoint(design_ini_result.x, design_ini_result.y); + } +} + + void Courtroom::set_taken(int n_char, bool p_taken) { if (n_char >= char_list.size()) @@ -1731,8 +1749,8 @@ void Courtroom::doScreenShake() screenshake_group = new QParallelAnimationGroup; screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this); chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this); - int screen_x = ui_viewport->x(); - int screen_y = ui_viewport->y(); + int screen_x = get_theme_pos("viewport").x(); + int screen_y = get_theme_pos("viewport").y(); QPoint pos_default = QPoint(screen_x, screen_y); QPoint pos1 = QPoint(screen_x + 3, screen_y + -5); QPoint pos2 = QPoint(screen_x + 3, screen_y + -5); @@ -1740,8 +1758,8 @@ void Courtroom::doScreenShake() QPoint pos4 = QPoint(screen_x + 3, screen_y + -5); QPoint pos5 = QPoint(screen_x + -3,screen_y + -5); - int chatbox_x = ui_vp_chatbox->x(); - int chatbox_y = ui_vp_chatbox->y(); + int chatbox_x = get_theme_pos("ao2_chatbox").x(); + int chatbox_y = get_theme_pos("ao2_chatbox").y(); QPoint chatbox_pos_default = QPoint(chatbox_x, chatbox_y); QPoint chatbox_pos1 = QPoint(chatbox_x + 3, chatbox_y + -5); QPoint chatbox_pos2 = QPoint(chatbox_x + 3, chatbox_y + -5); -- cgit From c44832a707f655191e4337e3b3fc567ff02636eb Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Sat, 19 Jan 2019 14:39:42 -0800 Subject: guard -> disable modcalls, bugfixes for guard button, etc. --- src/courtroom.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ce4ccf1..da1b090 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -193,7 +193,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_flip->setText("Flip"); ui_flip->hide(); ui_guard = new QCheckBox(this); - ui_guard->setText("Guard"); + ui_guard->setText("Disable Modcalls"); ui_guard->hide(); ui_casing = new QCheckBox(this); ui_casing->setChecked(ao_app->get_casing_enabled()); @@ -1085,6 +1085,12 @@ 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(); + append_server_chatmessage("CLIENT", "You were granted the Disable Modcalls button.", "1"); + } ui_server_chatlog->append_chatmessage(p_name, p_message, colour); } @@ -2855,7 +2861,7 @@ void Courtroom::toggle_judge_buttons(bool is_on) void Courtroom::mod_called(QString p_ip) { ui_server_chatlog->append(p_ip); - if (ui_guard->isChecked()) + if (!ui_guard->isChecked()) { modcall_player->play(ao_app->get_sfx("mod_call")); ao_app->alert(this); @@ -2897,11 +2903,6 @@ void Courtroom::on_ooc_return_pressed() toggle_judge_buttons(false); } } - else if (ooc_message.startsWith("/login")) - { - ui_guard->show(); - append_server_chatmessage("CLIENT", "You were granted the Guard button.", "1"); - } else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended) { //ui_text_color->addItem("Rainbow"); -- cgit From 10436992148e2342e6bd563d1acfb684f225aa30 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Sat, 19 Jan 2019 21:01:19 -0800 Subject: Suffix-independent Music, Mod Music List, looping bugfixes, easter eggs, etc. --- src/courtroom.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index da1b090..a097444 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2761,9 +2761,22 @@ void Courtroom::handle_song(QStringList *p_contents) if (p_contents->length() > 2) { - str_show = p_contents->at(2); + if(p_contents->at(2) != "") + { + str_show = p_contents->at(2); + } + } + if (p_contents->length() > 3) + { + if(p_contents->at(3) != "-1") + { + music_player->enable_looping = false; + } + else + { + music_player->enable_looping = true; + } } - if (!mute_map.value(n_char)) { chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true); @@ -2780,6 +2793,12 @@ void Courtroom::handle_song(QStringList *p_contents) } } +void Courtroom::handle_failed_login() +{ + music_player->enable_looping = false; + music_player->play("failed_login"); +} + void Courtroom::handle_wtce(QString p_wtce, int variant) { QString sfx_file = "courtroom_sounds.ini"; -- cgit From a7a614482e379ad13f8e0ca1e7f3e31c33bb1c21 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Mon, 21 Jan 2019 15:45:51 -0800 Subject: final commit --- src/courtroom.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a097444..537558f 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1752,6 +1752,8 @@ void Courtroom::handle_chatmessage_2() void Courtroom::doScreenShake() { + if(!ao_app->is_shakeandflash_enabled()) + return; screenshake_group = new QParallelAnimationGroup; screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this); chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this); @@ -2197,6 +2199,8 @@ void Courtroom::realization_done() void Courtroom::doRealization() { + if(!ao_app->is_shakeandflash_enabled()) + return; realization_timer->start(60); ui_vp_realization->show(); -- cgit From 13bc82094f76011eef371ece3b3894d7cc20eaf9 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Wed, 23 Jan 2019 00:14:47 -0800 Subject: >>>>multi-threading the frame sfx/screenshake/flashes --- src/courtroom.cpp | 178 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 121 insertions(+), 57 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 537558f..19caa8d 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1095,6 +1095,66 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt ui_server_chatlog->append_chatmessage(p_name, p_message, colour); } +class AOFrameThreadingBullshitPre : public QRunnable +{ +public: + Courtroom *mycourt_fuck; + int my_frameNumber; + AOFrameThreadingBullshitPre(Courtroom *my_courtroom, int frameNumber){ + mycourt_fuck = my_courtroom; + my_frameNumber = frameNumber; + } + void run() + { + qDebug() << my_frameNumber << " FRAME NUMBER" << " from" << QThread::currentThread(); + QString sfx_to_play = mycourt_fuck->ao_app->get_frame_sfx_name(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); + QString screenshake_to_play = mycourt_fuck->ao_app->get_screenshake_frame(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); + QString realization_to_play = mycourt_fuck->ao_app->get_realization_frame(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); + if(sfx_to_play != "") + { + mycourt_fuck->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; + } + if(screenshake_to_play != "") + { + mycourt_fuck->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; + } + if(realization_to_play != "") + { + mycourt_fuck->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play; + } + } +}; + + +class AOFrameThreadingBullshit : public QRunnable +{ +public: + Courtroom *mycourt_fuck; + int my_frameNumber; + AOFrameThreadingBullshit(Courtroom *my_courtroom, int frameNumber){ + mycourt_fuck = my_courtroom; + my_frameNumber = frameNumber; + } + void run() + { + QString sfx_to_play = mycourt_fuck->ao_app->get_frame_sfx_name(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); + QString screenshake_to_play = mycourt_fuck->ao_app->get_screenshake_frame(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); + QString realization_to_play = mycourt_fuck->ao_app->get_realization_frame(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); + if(sfx_to_play != "") + { + mycourt_fuck->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; + } + if(screenshake_to_play != "") + { + mycourt_fuck->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; + } + if(realization_to_play != "") + { + mycourt_fuck->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play; + } + } +}; + void Courtroom::on_chat_return_pressed() { if (ui_ic_chat_message->text() == "" || is_muted) @@ -1275,7 +1335,7 @@ void Courtroom::on_chat_return_pressed() qDebug() << "Are we looping this? " << ao_app->get_sfx_looping(current_char, current_emote); packet_contents.append(QString::number(screenshake_state)); qDebug() << "Are we screen shaking this one? " << screenshake_state; - + qDebug() << "MAX THREAD COUNT " << QThreadPool::globalInstance()->maxThreadCount(); QString frame_screenshake = ""; QString frame_realization = ""; QString frame_sfx = ""; @@ -1295,77 +1355,86 @@ void Courtroom::on_chat_return_pressed() QString preemote = ao_app->get_image_suffix(ao_app->get_character_path(current_char, ao_app->get_pre_emote(current_char, current_emote))); QString talkemote_to_check = ao_app->get_image_suffix(ao_app->get_character_path(current_char, "(b)" + ao_app->get_emote(current_char, current_emote))); QString idleemote_to_check = ao_app->get_image_suffix(ao_app->get_character_path(current_char, "(a)" + ao_app->get_emote(current_char, current_emote))); - frame_emote_checker = new QImageReader(preemote); + + frame_emote_checker = new QMovie(this); + frame_emote_checker->setFileName(preemote); + frame_emote_checker->jumpToFrame(0); + qDebug() << "Premote fuck: " << frame_emote_checker->frameCount(); + preemote_sfx += ao_app->get_pre_emote(current_char, current_emote); preemote_shake += ao_app->get_pre_emote(current_char, current_emote); preemote_flash += ao_app->get_pre_emote(current_char, current_emote); - for (int i = 0; i < frame_emote_checker->imageCount(); i++) { - QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, ao_app->get_pre_emote(current_char, current_emote), i); - QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, ao_app->get_pre_emote(current_char, current_emote), i); - QString realization_to_play = ao_app->get_realization_frame(current_char, ao_app->get_pre_emote(current_char, current_emote), i); - if(sfx_to_play != "") - { - preemote_sfx += "|" + QString::number(i) + "=" + sfx_to_play; - } - if(screenshake_to_play != "") - { - preemote_shake += "|" + QString::number(i) + "=" + screenshake_to_play; - } - if(realization_to_play != "") - { - preemote_flash += "|" + QString::number(i) + "=" + realization_to_play; - } + + threading_sfx = preemote_sfx; + threading_shake = preemote_shake; + threading_flash = preemote_flash; + + for(int i=0; i < frame_emote_checker->frameCount(); i++){ + AOFrameThreadingBullshitPre *testfuck = new AOFrameThreadingBullshitPre(this, i); + QThreadPool::globalInstance()->start(testfuck); } + QThreadPool::globalInstance()->waitForDone(); + preemote_sfx = threading_sfx; + preemote_shake = threading_shake; + preemote_flash = threading_flash; preemote_sfx += "^"; preemote_shake += "^"; preemote_flash += "^"; delete frame_emote_checker; + + + talkemote_sfx += "(b)" + ao_app->get_emote(current_char, current_emote); talkemote_shake += "(b)" + ao_app->get_emote(current_char, current_emote); talkemote_flash += "(b)" + ao_app->get_emote(current_char, current_emote); - frame_emote_checker = new QImageReader(talkemote_to_check); - for (int i = 0; i < frame_emote_checker->imageCount(); i++) { - QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, "(b)" + ao_app->get_emote(current_char, current_emote), i); - QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, "(b)" + ao_app->get_emote(current_char, current_emote), i); - QString realization_to_play = ao_app->get_realization_frame(current_char, "(b)" + ao_app->get_emote(current_char, current_emote), i); - if(sfx_to_play != "") - { - talkemote_sfx += "|" + QString::number(i) + "=" + sfx_to_play; - } - if(screenshake_to_play != "") - { - talkemote_shake += "|" + QString::number(i) + "=" + screenshake_to_play; - } - if(realization_to_play != "") - { - talkemote_flash += "|" + QString::number(i) + "=" + realization_to_play; - } + + frame_emote_checker = new QMovie(this); + frame_emote_checker->setFileName(talkemote_to_check); + frame_emote_checker->jumpToFrame(0); + qDebug() << "TALK fuck: " << frame_emote_checker->frameCount(); + + threading_sfx = talkemote_sfx; + threading_shake = talkemote_shake; + threading_flash = talkemote_flash; + threading_prefix = QString("(b)"); + + for(int i=0; i < frame_emote_checker->frameCount(); i++){ + AOFrameThreadingBullshit *testfuck = new AOFrameThreadingBullshit(this, i); + QThreadPool::globalInstance()->start(testfuck); } + QThreadPool::globalInstance()->waitForDone(); + + talkemote_sfx = threading_sfx; + talkemote_shake = threading_shake; + talkemote_flash = threading_flash; talkemote_sfx += "^"; talkemote_shake += "^"; talkemote_flash += "^"; delete frame_emote_checker; + + + idleemote_sfx += "(a)" + ao_app->get_emote(current_char, current_emote); idleemote_shake += "(a)" + ao_app->get_emote(current_char, current_emote); idleemote_flash += "(a)" + ao_app->get_emote(current_char, current_emote); - frame_emote_checker = new QImageReader(idleemote_to_check); - for (int i = 0; i < frame_emote_checker->imageCount(); i++) { - QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, "(a)" + ao_app->get_emote(current_char, current_emote), i); - QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, "(a)" + ao_app->get_emote(current_char, current_emote), i); - QString realization_to_play = ao_app->get_realization_frame(current_char, "(a)" + ao_app->get_emote(current_char, current_emote), i); - if(sfx_to_play != "") - { - idleemote_sfx += "|" + QString::number(i) + "=" + sfx_to_play; - } - if(screenshake_to_play != "") - { - idleemote_shake += "|" + QString::number(i) + "=" + screenshake_to_play; - } - if(realization_to_play != "") - { - idleemote_flash += "|" + QString::number(i) + "=" + realization_to_play; - } + + frame_emote_checker = new QMovie(this); + frame_emote_checker->setFileName(idleemote_to_check); + frame_emote_checker->jumpToFrame(0); + qDebug() << "idle fuck: " << frame_emote_checker->frameCount(); + + threading_sfx = idleemote_sfx; + threading_shake = idleemote_shake; + threading_flash = idleemote_flash; + threading_prefix = QString("(a)"); + for(int i=0; i < frame_emote_checker->frameCount(); i++){ + AOFrameThreadingBullshit *testfuck = new AOFrameThreadingBullshit(this, i); + QThreadPool::globalInstance()->start(testfuck); } + QThreadPool::globalInstance()->waitForDone(); + idleemote_sfx = threading_sfx; + idleemote_shake = threading_shake; + idleemote_flash = threading_flash; delete frame_emote_checker; frame_screenshake += preemote_shake; @@ -1379,10 +1448,6 @@ void Courtroom::on_chat_return_pressed() frame_sfx += preemote_sfx; frame_sfx += talkemote_sfx; frame_sfx += idleemote_sfx; - qDebug() << "Final strings:"; - qDebug() << frame_screenshake; - qDebug() << frame_realization; - qDebug() << frame_sfx; packet_contents.append(frame_screenshake); packet_contents.append(frame_realization); @@ -1390,7 +1455,6 @@ void Courtroom::on_chat_return_pressed() } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } - void Courtroom::handle_chatmessage(QStringList *p_contents) { // Instead of checking for whether a message has at least chatmessage_size -- cgit From 0649e7b28e16a054072d8656a5046c7cc3cfefb6 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Wed, 23 Jan 2019 07:35:29 -0800 Subject: Case Announcer: Witness Support also some other shit --- src/courtroom.cpp | 75 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 32 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 19caa8d..8c25a2d 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)); } -- cgit From fc984fcfe2a4416274810de81a8f36fe77b0dba9 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Fri, 1 Feb 2019 16:28:14 -0800 Subject: bugfixes and shit --- src/courtroom.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/courtroom.cpp') 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#%")); } } -- cgit From e6cb5bd2cf241d638941ad5b403ab5fd7490335c Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Sat, 23 Mar 2019 14:33:31 -0700 Subject: Fixes Objections hiding the current character, instead of overlaying on top of it. Adds screenshake to objects. --- src/courtroom.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a082e6b..636df5a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1517,7 +1517,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) text_state = 0; anim_state = 0; ui_vp_objection->stop(); - ui_vp_player_char->stop(); chat_tick_timer->stop(); ui_vp_evidence_display->reset(); @@ -1564,16 +1563,19 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) case 1: ui_vp_objection->play("holdit", f_char, f_custom_theme); objection_player->play("holdit.wav", f_char, f_custom_theme); + this->doScreenShake(); break; case 2: ui_vp_objection->play("objection", f_char, f_custom_theme); objection_player->play("objection.wav", f_char, f_custom_theme); + this->doScreenShake(); if(ao_app->get_objectmusic()) music_player->kill_loop(); break; case 3: ui_vp_objection->play("takethat", f_char, f_custom_theme); objection_player->play("takethat.wav", f_char, f_custom_theme); + this->doScreenShake(); break; //case 4 is AO2 only case 4: -- cgit From 2d9fff2e969a952d1e83c1ade04d6beed2420dbc Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Mon, 25 Mar 2019 11:14:53 -0700 Subject: Reverts screenshake on object, was controversial --- src/courtroom.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 636df5a..0905528 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1563,19 +1563,16 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) case 1: ui_vp_objection->play("holdit", f_char, f_custom_theme); objection_player->play("holdit.wav", f_char, f_custom_theme); - this->doScreenShake(); break; case 2: ui_vp_objection->play("objection", f_char, f_custom_theme); objection_player->play("objection.wav", f_char, f_custom_theme); - this->doScreenShake(); if(ao_app->get_objectmusic()) music_player->kill_loop(); break; case 3: ui_vp_objection->play("takethat", f_char, f_custom_theme); objection_player->play("takethat.wav", f_char, f_custom_theme); - this->doScreenShake(); break; //case 4 is AO2 only case 4: -- cgit From f93459ed0eec6c7c64bece75cb6e8de627c605b9 Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 21 Feb 2020 17:18:25 +0100 Subject: remove fuck --- src/courtroom.cpp | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 054603d..e62f6c6 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -76,7 +76,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() misc_sfx_player->set_volume(0); frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); frame_emote_sfx_player->set_volume(0); - pair_frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); // todo: recode pair // todo: recode fucking everything + pair_frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); // todo: recode pair pair_frame_emote_sfx_player->set_volume(0); blip_player = new AOBlipPlayer(this, ao_app); @@ -878,7 +878,7 @@ void Courtroom::set_background(QString p_background) } } -void Courtroom::set_character(int char_id) // can you fucking believe this didn't exist yet +void Courtroom::set_character(int char_id) { m_cid = char_id; @@ -1129,62 +1129,62 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt ui_server_chatlog->append_chatmessage(p_name, p_message, colour); } -class AOFrameThreadingBullshitPre : public QRunnable +class AOFrameThreadingPre : public QRunnable { public: - Courtroom *mycourt_fuck; + Courtroom *thisCourtroom; int my_frameNumber; - AOFrameThreadingBullshitPre(Courtroom *my_courtroom, int frameNumber){ - mycourt_fuck = my_courtroom; + AOFrameThreadingPre(Courtroom *my_courtroom, int frameNumber){ + thisCourtroom = my_courtroom; my_frameNumber = frameNumber; } void run() { qDebug() << my_frameNumber << " FRAME NUMBER" << " from" << QThread::currentThread(); - QString sfx_to_play = mycourt_fuck->ao_app->get_frame_sfx_name(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); - QString screenshake_to_play = mycourt_fuck->ao_app->get_screenshake_frame(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); - QString realization_to_play = mycourt_fuck->ao_app->get_realization_frame(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); + QString sfx_to_play = thisCourtroom->ao_app->get_frame_sfx_name(thisCourtroom->current_char, thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); + QString screenshake_to_play = thisCourtroom->ao_app->get_screenshake_frame(thisCourtroom->current_char, thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); + QString realization_to_play = thisCourtroom->ao_app->get_realization_frame(thisCourtroom->current_char, thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); if(sfx_to_play != "") { - mycourt_fuck->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; + thisCourtroom->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; } if(screenshake_to_play != "") { - mycourt_fuck->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; + thisCourtroom->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; } if(realization_to_play != "") { - mycourt_fuck->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play; + thisCourtroom->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play; } } }; -class AOFrameThreadingBullshit : public QRunnable +class AOFrameThreading : public QRunnable { public: - Courtroom *mycourt_fuck; + Courtroom *thisCourtroom; int my_frameNumber; - AOFrameThreadingBullshit(Courtroom *my_courtroom, int frameNumber){ - mycourt_fuck = my_courtroom; + AOFrameThreading(Courtroom *my_courtroom, int frameNumber){ + thisCourtroom = my_courtroom; my_frameNumber = frameNumber; } void run() { - QString sfx_to_play = mycourt_fuck->ao_app->get_frame_sfx_name(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); - QString screenshake_to_play = mycourt_fuck->ao_app->get_screenshake_frame(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); - QString realization_to_play = mycourt_fuck->ao_app->get_realization_frame(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber); + QString sfx_to_play = thisCourtroom->ao_app->get_frame_sfx_name(thisCourtroom->current_char, thisCourtroom->threading_prefix + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); + QString screenshake_to_play = thisCourtroom->ao_app->get_screenshake_frame(thisCourtroom->current_char, thisCourtroom->threading_prefix + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); + QString realization_to_play = thisCourtroom->ao_app->get_realization_frame(thisCourtroom->current_char, thisCourtroom->threading_prefix + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); if(sfx_to_play != "") { - mycourt_fuck->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; + thisCourtroom->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; } if(screenshake_to_play != "") { - mycourt_fuck->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; + thisCourtroom->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; } if(realization_to_play != "") { - mycourt_fuck->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play; + thisCourtroom->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play; } } }; @@ -1393,7 +1393,7 @@ void Courtroom::on_chat_return_pressed() frame_emote_checker = new QMovie(this); frame_emote_checker->setFileName(preemote); frame_emote_checker->jumpToFrame(0); - qDebug() << "Premote fuck: " << frame_emote_checker->frameCount(); + qDebug() << "Premote: " << frame_emote_checker->frameCount(); preemote_sfx += ao_app->get_pre_emote(current_char, current_emote); preemote_shake += ao_app->get_pre_emote(current_char, current_emote); @@ -1404,7 +1404,7 @@ void Courtroom::on_chat_return_pressed() threading_flash = preemote_flash; for(int i=0; i < frame_emote_checker->frameCount(); i++){ - AOFrameThreadingBullshitPre *testfuck = new AOFrameThreadingBullshitPre(this, i); + AOFrameThreadingPre *testfuck = new AOFrameThreadingPre(this, i); QThreadPool::globalInstance()->start(testfuck); } QThreadPool::globalInstance()->waitForDone(); @@ -1425,7 +1425,7 @@ void Courtroom::on_chat_return_pressed() frame_emote_checker = new QMovie(this); frame_emote_checker->setFileName(talkemote_to_check); frame_emote_checker->jumpToFrame(0); - qDebug() << "TALK fuck: " << frame_emote_checker->frameCount(); + qDebug() << "Talk: " << frame_emote_checker->frameCount(); threading_sfx = talkemote_sfx; threading_shake = talkemote_shake; @@ -1433,7 +1433,7 @@ void Courtroom::on_chat_return_pressed() threading_prefix = QString("(b)"); for(int i=0; i < frame_emote_checker->frameCount(); i++){ - AOFrameThreadingBullshit *testfuck = new AOFrameThreadingBullshit(this, i); + AOFrameThreading *testfuck = new AOFrameThreading(this, i); QThreadPool::globalInstance()->start(testfuck); } QThreadPool::globalInstance()->waitForDone(); @@ -1455,14 +1455,14 @@ void Courtroom::on_chat_return_pressed() frame_emote_checker = new QMovie(this); frame_emote_checker->setFileName(idleemote_to_check); frame_emote_checker->jumpToFrame(0); - qDebug() << "idle fuck: " << frame_emote_checker->frameCount(); + qDebug() << "idle: " << frame_emote_checker->frameCount(); threading_sfx = idleemote_sfx; threading_shake = idleemote_shake; threading_flash = idleemote_flash; threading_prefix = QString("(a)"); for(int i=0; i < frame_emote_checker->frameCount(); i++){ - AOFrameThreadingBullshit *testfuck = new AOFrameThreadingBullshit(this, i); + AOFrameThreading *testfuck = new AOFrameThreading(this, i); QThreadPool::globalInstance()->start(testfuck); } QThreadPool::globalInstance()->waitForDone(); -- cgit From 87e359487d7e7d75cb696736f2a5da21d9648898 Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 21 Feb 2020 17:57:46 +0100 Subject: combine these conditions --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index e62f6c6..64c288c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2374,7 +2374,7 @@ void Courtroom::chat_tick() f_message.remove(0,2); } - if (f_message.size() == 0) + if (f_message.size() == 0 || tick_pos >= f_message.size()) { text_state = 2; if (anim_state != 4) -- cgit From 2716416b62ce6ffec89d2a8b4b984b709cb5221a Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 21 Feb 2020 18:00:23 +0100 Subject: only load bass plugins when bass is included --- src/courtroom.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 64c288c..6510ca7 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3955,30 +3955,25 @@ Courtroom::~Courtroom() delete blip_player; } - +#ifdef BASSAUDIO #if (defined (_WIN32) || defined (_WIN64)) void Courtroom::load_bass_opus_plugin() { - #ifdef BASSAUDIO BASS_PluginLoad("bassopus.dll", 0); - #endif } #elif (defined (LINUX) || defined (__linux__)) void Courtroom::load_bass_opus_plugin() { - #ifdef BASSAUDIO BASS_PluginLoad("libbassopus.so", 0); - #endif } #elif defined __APPLE__ void Courtroom::load_bass_opus_plugin() { QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; QByteArray ba = libpath.toLocal8Bit(); - #ifdef BASSAUDIO BASS_PluginLoad(ba.data(), 0); - #endif } #else #error This operating system is unsupported for bass plugins. #endif +#endif -- cgit From 0b16ac863cd3e90475e8bcb170a238350b060f20 Mon Sep 17 00:00:00 2001 From: sD Date: Sun, 23 Feb 2020 02:56:57 +0100 Subject: the charselect works again --- src/courtroom.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6510ca7..61f74e9 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -63,6 +63,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() testimony_hide_timer = new QTimer(this); testimony_hide_timer->setSingleShot(true); + char_button_mapper = new QSignalMapper(this); + music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); -- cgit From 4af8ba9c38fcab44fc29bf39299a8341ddbb389a Mon Sep 17 00:00:00 2001 From: sD Date: Sun, 23 Feb 2020 12:28:07 +0100 Subject: what was graphmeme even fot --- src/courtroom.cpp | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 61f74e9..953b050 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2361,7 +2361,6 @@ void Courtroom::chat_tick() //do not perform heavy operations here QString f_message = m_chatmessage[MESSAGE]; - f_message.remove(0, tick_pos); // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); @@ -2376,7 +2375,7 @@ void Courtroom::chat_tick() f_message.remove(0,2); } - if (f_message.size() == 0 || tick_pos >= f_message.size()) + if (tick_pos >= f_message.size()) { text_state = 2; if (anim_state != 4) @@ -2388,21 +2387,9 @@ void Courtroom::chat_tick() else { - QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message); - QString f_character; - int f_char_length; - - tbf.toNextBoundary(); - - if (tbf.position() == -1) - f_character = f_message; - else - f_character = f_message.left(tbf.position()); - - f_char_length = f_character.length(); + QString f_character = f_message.at(tick_pos); f_character = f_character.toHtmlEscaped(); - if (f_character == " ") ui_vp_message->insertPlainText(" "); @@ -2507,7 +2494,7 @@ void Courtroom::chat_tick() else { next_character_is_not_special = true; - tick_pos -= f_char_length; + tick_pos--; } } @@ -2528,7 +2515,7 @@ void Courtroom::chat_tick() else { next_character_is_not_special = true; - tick_pos -= f_char_length; + tick_pos--; } } @@ -2572,7 +2559,11 @@ void Courtroom::chat_tick() case INLINE_GREY: ui_vp_message->insertHtml("" + f_character + ""); break; + default: + ui_vp_message->insertHtml(f_character); + break; } + } else { @@ -2623,7 +2614,7 @@ void Courtroom::chat_tick() if(blank_blip) qDebug() << "blank_blip found true"; - if (f_character != ' ' || blank_blip) + if (f_message.at(tick_pos) != ' ' || blank_blip) { if (blip_pos % blip_rate == 0 && !formatting_char) @@ -2635,7 +2626,7 @@ void Courtroom::chat_tick() ++blip_pos; } - tick_pos += f_char_length; + ++tick_pos; // Restart the timer, but according to the newly set speeds, if there were any. // Keep the speed at bay. @@ -2662,7 +2653,6 @@ void Courtroom::chat_tick() } } - void Courtroom::show_testimony() { if (!testimony_in_progress || m_chatmessage[SIDE] != "wit") @@ -2862,6 +2852,8 @@ void Courtroom::handle_song(QStringList *p_contents) QString f_song_clear = f_song; int n_char = f_contents.at(1).toInt(); + qDebug() << "playing song "+f_song; + if (n_char < 0 || n_char >= char_list.size()) { music_player->play(f_song); -- cgit From ea099a51418de869ac89284f4dd61eeb283271c9 Mon Sep 17 00:00:00 2001 From: sD Date: Sun, 23 Feb 2020 12:59:20 +0100 Subject: loading lost in translation --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 953b050..ecfc304 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2835,7 +2835,7 @@ void Courtroom::set_ban(int p_cid) if (p_cid != m_cid && p_cid != -1) return; - call_notice("You have been banned."); + call_notice(tr("You have been banned.")); ao_app->construct_lobby(); ao_app->destruct_courtroom(); -- cgit