diff options
| author | TrickyLeifa <date.epoch@gmail.com> | 2024-05-17 19:19:04 +0200 |
|---|---|---|
| committer | TrickyLeifa <date.epoch@gmail.com> | 2024-05-17 19:19:04 +0200 |
| commit | fefaad53943d8b542bd8f288dae7d15e08c67b32 (patch) | |
| tree | 37a27a49e48af87ff0ea00cd0556cb367c3562b2 /src/courtroom.cpp | |
| parent | 1ef96383c8f7ed136a0e028aef0835b4838b5e95 (diff) | |
| parent | 469e293a1885e49f1d5994d41ac7cfc9f4666952 (diff) | |
Merge branch 'master' into kaleidoscope
Diffstat (limited to 'src/courtroom.cpp')
| -rw-r--r-- | src/courtroom.cpp | 163 |
1 files changed, 79 insertions, 84 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 1f1c3cd8..7c766cc5 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -727,8 +727,8 @@ void Courtroom::set_widgets() // If there is a point to it, show all CCCC features. // We also do this this soon so that set_size_and_pos can hide them all later, // if needed. - if (ao_app->cccc_ic_supported) - { + if (ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::CCCC_IC_SUPPORT)) { ui_pair_button->show(); ui_immediate->show(); ui_showname_enable->show(); @@ -1574,7 +1574,8 @@ void Courtroom::update_character(int p_cid, QString char_name, bool reset_emote) } ui_custom_objection->hide(); - if (ao_app->custom_objection_supported) // if setting is enabled + if (ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::CUSTOMOBJECTIONS)) // if setting is enabled { custom_obj_menu->clear(); custom_objections_list.clear(); @@ -1648,8 +1649,7 @@ void Courtroom::enter_courtroom() { set_evidence_page(); - if (ao_app->flipping_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::FLIPPING)) ui_flip->show(); } else @@ -1657,8 +1657,7 @@ void Courtroom::enter_courtroom() ui_flip->hide(); } - if (ao_app->additive_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::ADDITIVE)) ui_additive->show(); } else @@ -1711,8 +1710,6 @@ void Courtroom::list_music() QBrush found_brush(ao_app->get_color("found_song_color", f_file)); QBrush missing_brush(ao_app->get_color("missing_song_color", f_file)); - int n_listed_songs = 0; - QTreeWidgetItem *parent = nullptr; for (int n_song = 0; n_song < music_list.size(); ++n_song) { @@ -1779,8 +1776,7 @@ void Courtroom::list_areas() QString i_area; i_area.append(area_list.at(n_area)); - if (ao_app->arup_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::ARUP)) { i_area.append("\n "); i_area.append(arup_statuses.at(n_area)); @@ -1810,8 +1806,7 @@ void Courtroom::list_areas() treeItem->setText(0, area_list.at(n_area)); treeItem->setText(1, i_area); - if (ao_app->arup_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::ARUP)) { // Coloring logic here. treeItem->setBackground(1, free_brush); if (arup_locks.at(n_area) == "LOCKED") @@ -1878,11 +1873,12 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt color = ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name(); } if (p_color == "1") - { - color = ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini").name(); - } - if (!ao_app->auth_packet_supported && p_message == "Logged in as a moderator.") - { + {color = + ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini") + .name();} + if (!ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::AUTH_PACKET) && + p_message == "Logged in as a moderator.") { // Emulate successful authentication on_authentication_state_received(1); } @@ -1978,11 +1974,10 @@ void Courtroom::on_chat_return_pressed() int f_desk_mod = DESK_SHOW; - if (ao_app->desk_mod_supported) - { - f_desk_mod = ao_app->get_desk_mod(current_char, current_emote); - if (!ao_app->expanded_desk_mods_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::DESKMOD)) { + f_desk_mod = ao_app->get_desk_mod(current_char, current_emote);{} + if (!ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::EXPANDED_DESK_MODS)) { if (f_desk_mod == DESK_PRE_ONLY_EX || f_desk_mod == DESK_PRE_ONLY) { f_desk_mod = DESK_HIDE; @@ -2033,8 +2028,8 @@ void Courtroom::on_chat_return_pressed() f_emote_mod = PREANIM; } // Turn zoom into preanim zoom - else if (f_emote_mod == ZOOM && ao_app->prezoom_supported) - { + else if (f_emote_mod == ZOOM && ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::PREZOOM)) { f_emote_mod = PREANIM_ZOOM; } // Play the sfx @@ -2096,8 +2091,10 @@ void Courtroom::on_chat_return_pressed() QString f_obj_state; - if ((objection_state == 4 && !ao_app->custom_objection_supported) || (objection_state < 0)) - { + if ((objection_state == 4 && + !ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::CUSTOMOBJECTIONS)) || + (objection_state < 0)) { f_obj_state = "0"; } else if (objection_custom != "" && objection_state == 4) @@ -2131,8 +2128,7 @@ void Courtroom::on_chat_return_pressed() QString f_flip; - if (ao_app->flipping_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::FLIPPING)) { if (ui_flip->isChecked()) { f_flip = "1"; @@ -2169,12 +2165,11 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(f_text_color); // If the server we're on supports CCCC stuff, we should use it! - if (ao_app->cccc_ic_supported) - { + if (ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::CCCC_IC_SUPPORT)) { // If there is a showname entered, use that -- else, just send an empty // packet-part. - if (!ui_ic_chat_name->text().isEmpty()) - { + if (!ui_ic_chat_name->text().isEmpty()) { packet_contents.append(ui_ic_chat_name->text()); } else @@ -2187,9 +2182,11 @@ void Courtroom::on_chat_return_pressed() if (other_charid > -1 && other_charid != m_cid) { QString packet = QString::number(other_charid); - if (ao_app->effects_supported) // Only servers with effects enabled will - // support pair reordering - { + if (ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::EFFECTS)) // Only servers with effects + // enabled will support pair + // reordering + { packet += "^" + QString::number(pair_order); } packet_contents.append(packet); @@ -2199,10 +2196,9 @@ void Courtroom::on_chat_return_pressed() packet_contents.append("-1"); } // Send the offset as it's gonna be used regardless - if (ao_app->y_offset_supported) - { - packet_contents.append(QString::number(char_offset) + "&" + QString::number(char_vert_offset)); - } + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::Y_OFFSET)){ + packet_contents.append(QString::number(char_offset) + "&" + + QString::number(char_vert_offset));} else { packet_contents.append(QString::number(char_offset)); @@ -2221,9 +2217,9 @@ void Courtroom::on_chat_return_pressed() // If the server we're on supports Looping SFX and Screenshake, use it if the // emote uses it. - if (ao_app->looping_sfx_supported) - { - packet_contents.append(ao_app->get_sfx_looping(current_char, current_emote)); + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::LOOPING_SFX)) { + packet_contents.append( + ao_app->get_sfx_looping(current_char, current_emote)); packet_contents.append(QString::number(screenshake_state)); QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); @@ -2251,14 +2247,14 @@ void Courtroom::on_chat_return_pressed() } } - if (ao_app->additive_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::ADDITIVE)) { packet_contents.append(ui_additive->isChecked() ? "1" : "0"); } - if (ao_app->effects_supported) - { - QString p_effect_folder = ao_app->read_char_ini(current_char, "effects", "Options"); - QString fx_sound = ao_app->get_effect_property(effect, current_char, p_effect_folder, "sound"); + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::EFFECTS)) { + QString p_effect_folder = + ao_app->read_char_ini(current_char, "effects", "Options"); + QString fx_sound = + ao_app->get_effect_property(effect, current_char, p_effect_folder, "sound"); // Don't overlap the two sfx if (!ui_pre->isChecked() && (!custom_sfx.isEmpty() || ui_sfx_dropdown->currentIndex() == 1)) @@ -2438,8 +2434,10 @@ void Courtroom::unpack_chatmessage(QStringList p_contents) // amongst the packet's content. We also have to check if the server even // supports CCCC's IC features, or if it's just japing us. Also, don't // forget! A size 15 message will have indices from 0 to 14. - if (n_string < p_contents.size() && (n_string < MS_MINIMUM || ao_app->cccc_ic_supported)) - { + if (n_string < p_contents.size() && + (n_string < MS_MINIMUM || + ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::CCCC_IC_SUPPORT))) { m_chatmessage[n_string] = p_contents.at(n_string); } else @@ -2796,8 +2794,9 @@ void Courtroom::display_pair_character(QString other_charid, QString other_offse } } // Flip the pair character - if (ao_app->flipping_supported && m_chatmessage[OTHER_FLIP].toInt() == 1) - { + if (ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::FLIPPING) && + m_chatmessage[OTHER_FLIP].toInt() == 1){ ui_vp_sideplayer_char->set_flipped(true); } else @@ -4005,8 +4004,9 @@ void Courtroom::start_chat_ticking() QString f_blips = ao_app->get_blipname(m_chatmessage[CHAR_NAME]); f_blips = ao_app->get_blips(f_blips); - if (ao_app->custom_blips_supported && !m_chatmessage[BLIPNAME].isEmpty()) - { + if (ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::CUSTOM_BLIPS) && + !m_chatmessage[BLIPNAME].isEmpty()) { f_blips = ao_app->get_blips(m_chatmessage[BLIPNAME]); } blip_player->setBlip(f_blips); @@ -4463,9 +4463,11 @@ void Courtroom::handle_song(QStringList *p_contents) } } - if (!file_exists(ao_app->get_sfx_suffix(ao_app->get_music_path(f_song))) && !f_song.startsWith("http") && f_song != "~stop.mp3" && !ao_app->asset_url.isEmpty()) - { - f_song = (ao_app->asset_url + "sounds/music/" + f_song).toLower(); + if (!file_exists(ao_app->get_sfx_suffix(ao_app->get_music_path(f_song))) && + !f_song.startsWith("http") && f_song != "~stop.mp3" && + !ao_app->m_serverdata.get_asset_url().isEmpty()) { + f_song = (ao_app->m_serverdata.get_asset_url() + "sounds/music/" + f_song) + .toLower(); } bool is_stop = (f_song == "~stop.mp3"); @@ -4684,12 +4686,11 @@ void Courtroom::on_ooc_return_pressed() { QString ooc_message = ui_ooc_chat_message->text(); - // We ignore it when the server is compatible with 2.8 - // Using an arbitrary 2.8 feature flag certainly won't cause issues someday. - if (ooc_message.startsWith("/pos") & !ao_app->effects_supported) - { - if (ooc_message == "/pos jud") - { + //We ignore it when the server is compatible with 2.8 + //Using an arbitrary 2.8 feature flag certainly won't cause issues someday. + if (ooc_message.startsWith("/pos") && + ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::EFFECTS)) { + if (ooc_message == "/pos jud") { show_judge_controls(true); } else @@ -5513,12 +5514,12 @@ void Courtroom::on_music_list_double_clicked(QTreeWidgetItem *p_item, int column QStringList packet_contents; packet_contents.append(p_song); packet_contents.append(QString::number(m_cid)); - if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_supported) || ao_app->effects_supported) - { + if ((!ui_ic_chat_name->text().isEmpty() && + ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::CCCC_IC_SUPPORT)) || + ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::EFFECTS)) packet_contents.append(ui_ic_chat_name->text()); - } - if (ao_app->effects_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::EFFECTS)){ packet_contents.append(QString::number(music_flags)); } ao_app->send_server_packet(AOPacket("MC", packet_contents)); @@ -5664,21 +5665,17 @@ void Courtroom::music_stop(bool no_effects) QStringList packet_contents; // its music list packet_contents.append(fake_song); // this is our fake song, playing it triggers special code packet_contents.append(QString::number(m_cid)); - if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_supported) || ao_app->effects_supported) - { + if ((!ui_ic_chat_name->text().isEmpty() && + ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::CCCC_IC_SUPPORT)) || + ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::EFFECTS)) packet_contents.append(ui_ic_chat_name->text()); - } - if (ao_app->effects_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::EFFECTS)) { if (no_effects) - { packet_contents.append("0"); - } else - { packet_contents.append(QString::number(music_flags)); - } - } + ao_app->send_server_packet(AOPacket("MC", packet_contents)); } @@ -5868,10 +5865,8 @@ void Courtroom::on_pair_clicked() { ui_pair_list->show(); ui_pair_offset_spinbox->show(); - if (ao_app->y_offset_supported) - { + if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::Y_OFFSET)) ui_pair_vert_offset_spinbox->show(); - } ui_pair_order_dropdown->show(); ui_mute_list->hide(); ui_mute->setImage("mute"); @@ -6184,8 +6179,8 @@ void Courtroom::on_spectator_clicked() void Courtroom::on_call_mod_clicked() { - if (ao_app->modcall_reason_supported) - { + if (ao_app->m_serverdata.get_feature( + server::BASE_FEATURE_SET::MODCALL_REASON)) { QMessageBox errorBox; QInputDialog input; |
