From 29f8733dbaecdd51dc5855e259c5def1d03b90c2 Mon Sep 17 00:00:00 2001 From: scatterflower <2956568+scatterflower@users.noreply.github.com> Date: Sun, 3 Jan 2021 19:23:01 -0600 Subject: [PATCH] FL toggle for Y offset (#360) Use "y_offset" to enable the Y offset protocol extension. --- include/aoapplication.h | 1 + src/courtroom.cpp | 8 ++++++-- src/packet_distribution.cpp | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index c06f3f9..790b445 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -76,6 +76,7 @@ public: bool looping_sfx_support_enabled = false; bool additive_enabled = false; bool effects_enabled = false; + bool y_offset_enabled = false; ///////////////loading info/////////////////// diff --git a/src/courtroom.cpp b/src/courtroom.cpp index e39c3d9..9518911 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1708,7 +1708,10 @@ void Courtroom::on_chat_return_pressed() packet_contents.append("-1"); } // Send the offset as it's gonna be used regardless - packet_contents.append(QString::number(char_offset) + "&" + QString::number(char_vert_offset)); + if(ao_app->y_offset_enabled) + packet_contents.append(QString::number(char_offset) + "&" + QString::number(char_vert_offset)); + else + packet_contents.append(QString::number(char_offset)); // Finally, we send over if we want our pres to not interrupt. if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) { @@ -4450,7 +4453,8 @@ void Courtroom::on_pair_clicked() if (ui_pair_list->isHidden()) { ui_pair_list->show(); ui_pair_offset_spinbox->show(); - ui_pair_vert_offset_spinbox->show(); + if(ao_app->y_offset_enabled) + ui_pair_vert_offset_spinbox->show(); ui_pair_order_dropdown->show(); ui_mute_list->hide(); ui_mute->set_image("mute"); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 1ffbcaf..0b73cdf 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -133,6 +133,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) looping_sfx_support_enabled = false; additive_enabled = false; effects_enabled = false; + y_offset_enabled = false; QString f_hdid; f_hdid = get_hdid(); @@ -205,6 +206,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) additive_enabled = true; if (f_packet.contains("effects", Qt::CaseInsensitive)) effects_enabled = true; + if (f_packet.contains("y_offset", Qt::CaseInsensitive)) + y_offset_enabled = true; } else if (header == "PN") { if (f_contents.size() < 2)