clang-format pass

This commit is contained in:
in1tiate 2024-05-20 09:12:47 -05:00
parent a23614059b
commit 5d90088b5c

View File

@ -779,11 +779,9 @@ void Courtroom::set_widgets()
ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height()); ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height());
ui_vp_dummy_char->move_and_center(0, 0); ui_vp_dummy_char->move_and_center(0, 0);
ui_vp_dummy_char->combo_resize(ui_viewport->width(), ui_vp_dummy_char->combo_resize(ui_viewport->width(), ui_viewport->height());
ui_viewport->height());
ui_vp_sidedummy_char->move_and_center(0, 0); ui_vp_sidedummy_char->move_and_center(0, 0);
ui_vp_sidedummy_char->combo_resize(ui_viewport->width(), ui_vp_sidedummy_char->combo_resize(ui_viewport->width(), ui_viewport->height());
ui_viewport->height());
// the AO2 desk element // the AO2 desk element
ui_vp_desk->move_and_center(0, 0); ui_vp_desk->move_and_center(0, 0);
@ -1424,7 +1422,8 @@ void Courtroom::set_background(QString p_background, bool display)
if ((file_exists(ao_app->get_image_suffix(ao_app->get_background_path(real_pos)))) || // Normal check, OR if ((file_exists(ao_app->get_image_suffix(ao_app->get_background_path(real_pos)))) || // Normal check, OR
(overrides.contains(pos) && // It's one of our subpos overrides, AND (overrides.contains(pos) && // It's one of our subpos overrides, AND
file_exists(ao_app->get_image_suffix(ao_app->get_background_path("court"))) && // the "court" default image exists, AND file_exists(ao_app->get_image_suffix(ao_app->get_background_path("court"))) && // the "court" default image exists, AND
!ao_app->read_design_ini("court:" + pos + "/pos_center", ao_app->get_background_path("design.ini")).isEmpty())) { // config exists for this pos !ao_app->read_design_ini("court:" + pos + "/pos_center", ao_app->get_background_path("design.ini")).isEmpty()))
{ // config exists for this pos
pos_list.append(pos); pos_list.append(pos);
} }
} }
@ -2303,7 +2302,8 @@ void Courtroom::on_chat_return_pressed()
} }
} }
if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::CUSTOM_BLIPS)) { if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::CUSTOM_BLIPS))
{
packet_contents.append(ao_app->get_blipname(current_char, current_emote)); packet_contents.append(ao_app->get_blipname(current_char, current_emote));
} }
packet_contents.append(ui_slide_enable->isChecked() ? "1" : "0"); // just let the server figure out what to do with this packet_contents.append(ui_slide_enable->isChecked() ? "1" : "0"); // just let the server figure out what to do with this
@ -2966,19 +2966,22 @@ void Courtroom::do_screenshake()
screenshake_animation_group->start(); screenshake_animation_group->start();
} }
void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_pos) { void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_pos)
{
if (m_chatmessage[EMOTE] != "") if (m_chatmessage[EMOTE] != "")
display_character(); display_character();
const QStringList legacy_pos = {"def", "wit", "pro"}; const QStringList legacy_pos = {"def", "wit", "pro"};
QString t_old_pos = old_pos; QString t_old_pos = old_pos;
QString t_new_pos = new_pos; QString t_new_pos = new_pos;
if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path("court")))) { if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path("court"))))
if (legacy_pos.contains(old_pos)) { {
if (legacy_pos.contains(old_pos))
{
t_old_pos = "court:" + old_pos; t_old_pos = "court:" + old_pos;
} }
if (legacy_pos.contains(new_pos)) { if (legacy_pos.contains(new_pos))
{
t_new_pos = "court:" + new_pos; t_new_pos = "court:" + new_pos;
} }
} }
@ -2989,14 +2992,8 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
int duration = ao_app->get_pos_transition_duration(t_old_pos, t_new_pos); int duration = ao_app->get_pos_transition_duration(t_old_pos, t_new_pos);
// conditions to stop slide // conditions to stop slide
if (old_pos == new_pos || if (old_pos == new_pos || old_pos_pair.first != new_pos_pair.first || new_pos_pair.second == -1 || !Options::getInstance().slidesEnabled() || m_chatmessage[SLIDE] != "1" || duration == -1 || m_chatmessage[EMOTE_MOD].toInt() == ZOOM || m_chatmessage[EMOTE_MOD].toInt() == PREANIM_ZOOM)
old_pos_pair.first != new_pos_pair.first || {
new_pos_pair.second == -1 ||
!Options::getInstance().slidesEnabled() ||
m_chatmessage[SLIDE] != "1" ||
duration == -1 ||
m_chatmessage[EMOTE_MOD].toInt() == ZOOM ||
m_chatmessage[EMOTE_MOD].toInt() == PREANIM_ZOOM) {
#ifdef DEBUG_TRANSITION #ifdef DEBUG_TRANSITION
qDebug() << "skipping transition - not applicable"; qDebug() << "skipping transition - not applicable";
#endif #endif
@ -3017,7 +3014,8 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
QList<AOLayer *> affected_list = {ui_vp_background, ui_vp_desk, ui_vp_player_char}; QList<AOLayer *> affected_list = {ui_vp_background, ui_vp_desk, ui_vp_player_char};
bool paired = false; bool paired = false;
if (!ui_vp_sideplayer_char->isHidden()) { if (!ui_vp_sideplayer_char->isHidden())
{
affected_list.append(ui_vp_sideplayer_char); affected_list.append(ui_vp_sideplayer_char);
paired = true; paired = true;
} }
@ -3027,7 +3025,8 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
float scaling_factor = ui_vp_background->get_scaling_factor(); float scaling_factor = ui_vp_background->get_scaling_factor();
int offset = (float(old_pos_pair.second) * scaling_factor) - (float(new_pos_pair.second) * scaling_factor); int offset = (float(old_pos_pair.second) * scaling_factor) - (float(new_pos_pair.second) * scaling_factor);
for (AOLayer *ui_element : affected_list) { for (AOLayer *ui_element : affected_list)
{
QPropertyAnimation *transition_animation = new QPropertyAnimation(ui_element, "pos", this); QPropertyAnimation *transition_animation = new QPropertyAnimation(ui_element, "pos", this);
transition_animation->setStartValue(ui_element->pos()); transition_animation->setStartValue(ui_element->pos());
transition_animation->setDuration(duration); transition_animation->setDuration(duration);
@ -3040,9 +3039,11 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
// This should be easy. But it isn't // This should be easy. But it isn't
QString slide_emote; QString slide_emote;
if (m_chatmessage[OBJECTION_MOD].contains("4") || m_chatmessage[OBJECTION_MOD].toInt() == 2) { if (m_chatmessage[OBJECTION_MOD].contains("4") || m_chatmessage[OBJECTION_MOD].toInt() == 2)
{
slide_emote = "(a)" + ao_app->read_char_ini(m_chatmessage[CHAR_NAME], "objection_pose", "Options"); slide_emote = "(a)" + ao_app->read_char_ini(m_chatmessage[CHAR_NAME], "objection_pose", "Options");
if (slide_emote == "(a)") { if (slide_emote == "(a)")
{
slide_emote = "(a)" + m_chatmessage[EMOTE]; slide_emote = "(a)" + m_chatmessage[EMOTE];
} }
} }
@ -3068,7 +3069,8 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
ui_vp_dummy_char->move(starting_position.x(), starting_position.y()); ui_vp_dummy_char->move(starting_position.x(), starting_position.y());
// If the new message is paired, do it all again for the pair character. Yippee! // If the new message is paired, do it all again for the pair character. Yippee!
if (m_chatmessage[OTHER_CHARID].toInt() != -1 && !m_chatmessage[OTHER_NAME].isEmpty()) { if (m_chatmessage[OTHER_CHARID].toInt() != -1 && !m_chatmessage[OTHER_NAME].isEmpty())
{
ui_vp_sidedummy_char->set_flipped(m_chatmessage[OTHER_FLIP].toInt()); ui_vp_sidedummy_char->set_flipped(m_chatmessage[OTHER_FLIP].toInt());
ui_vp_sidedummy_char->load_image(other_slide_emote, m_chatmessage[OTHER_NAME], 0, false); ui_vp_sidedummy_char->load_image(other_slide_emote, m_chatmessage[OTHER_NAME], 0, false);
set_self_offset(m_chatmessage[OTHER_OFFSET], ui_vp_sidedummy_char); set_self_offset(m_chatmessage[OTHER_OFFSET], ui_vp_sidedummy_char);
@ -3077,7 +3079,8 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
{ {
// Change the order of appearance based on the pair order variable // Change the order of appearance based on the pair order variable
int order = args.at(1).toInt(); int order = args.at(1).toInt();
switch (order) { switch (order)
{
case 0: // Our character is in front case 0: // Our character is in front
ui_vp_sidedummy_char->stackUnder(ui_vp_dummy_char); ui_vp_sidedummy_char->stackUnder(ui_vp_dummy_char);
break; break;
@ -3100,17 +3103,20 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
ui_vp_sidedummy_char->move(starting_position.x(), starting_position.y()); ui_vp_sidedummy_char->move(starting_position.x(), starting_position.y());
} }
else { else
{
ui_vp_sidedummy_char->stop(); ui_vp_sidedummy_char->stop();
} }
ui_vp_player_char->freeze(); ui_vp_player_char->freeze();
ui_vp_player_char->show(); ui_vp_player_char->show();
if (paired) { if (paired)
{
ui_vp_sideplayer_char->freeze(); ui_vp_sideplayer_char->freeze();
ui_vp_sideplayer_char->show(); ui_vp_sideplayer_char->show();
} }
else { else
{
ui_vp_sideplayer_char->stop(); ui_vp_sideplayer_char->stop();
} }
ui_vp_dummy_char->freeze(); ui_vp_dummy_char->freeze();
@ -3118,15 +3124,15 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
QTimer::singleShot(TRANSITION_BOOKEND_DELAY, transition_animation_group, SLOT(start())); QTimer::singleShot(TRANSITION_BOOKEND_DELAY, transition_animation_group, SLOT(start()));
} }
void Courtroom::on_transition_finish()
void Courtroom::on_transition_finish() { {
transition_animation_group->clear(); transition_animation_group->clear();
transition_animation_group->setCurrentTime(0); transition_animation_group->setCurrentTime(0);
QTimer::singleShot(TRANSITION_BOOKEND_DELAY, this, SLOT(post_transition_cleanup())); QTimer::singleShot(TRANSITION_BOOKEND_DELAY, this, SLOT(post_transition_cleanup()));
} }
void Courtroom::post_transition_cleanup() { void Courtroom::post_transition_cleanup()
{
set_scene(m_chatmessage[DESK_MOD].toInt(), m_chatmessage[SIDE]); set_scene(m_chatmessage[DESK_MOD].toInt(), m_chatmessage[SIDE]);
// Move the character on the viewport according to the offsets // Move the character on the viewport according to the offsets
@ -3135,13 +3141,13 @@ void Courtroom::post_transition_cleanup() {
int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
bool immediate = m_chatmessage[IMMEDIATE].toInt() == 1; bool immediate = m_chatmessage[IMMEDIATE].toInt() == 1;
// Reset the pair character // Reset the pair character
ui_vp_sideplayer_char->stop(); ui_vp_sideplayer_char->stop();
ui_vp_sideplayer_char->move_and_center(0, 0); ui_vp_sideplayer_char->move_and_center(0, 0);
// If the emote_mod is not zooming // If the emote_mod is not zooming
if (emote_mod != ZOOM && emote_rows != PREANIM_ZOOM) { if (emote_mod != ZOOM && emote_rows != PREANIM_ZOOM)
{
// Display the pair character // Display the pair character
display_pair_character(m_chatmessage[OTHER_CHARID], m_chatmessage[OTHER_OFFSET]); display_pair_character(m_chatmessage[OTHER_CHARID], m_chatmessage[OTHER_OFFSET]);
} }
@ -6418,7 +6424,6 @@ void Courtroom::on_settings_clicked()
ao_app->call_settings_menu(); ao_app->call_settings_menu();
} }
void Courtroom::on_additive_clicked() void Courtroom::on_additive_clicked()
{ {
if (ui_additive->isChecked()) if (ui_additive->isChecked())