From f113f8fae8a258c5fa76f7d025bdb0c30d758fd8 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 26 Jul 2018 14:46:02 +0200 Subject: Added a bunch of features. - The IC chatlog now goes from top to bottom. - The same chatlog can be set to a limit by putting 'log_maximum = 100', for example, into the config.ini file. - Reloading the theme checks for the log limit again. - If a message starts with '~~' (two tildes), it'll be centered (for testimony title usage). - Inline colour options: - Text between {curly braces} will appear orange. - Text between (parentheses) will appear blue. - Text between $dollar signs$ will appear green. - The symbols can still be got by putting a '\' in front of them. - I.e.: \{, \}, \(, \), \$, \\ --- courtroom.cpp | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 132 insertions(+), 8 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index ca94f434..decb772c 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -83,6 +83,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ic_chatlog = new QTextEdit(this); ui_ic_chatlog->setReadOnly(true); + ui_ic_chatlog->document()->setMaximumBlockCount(ao_app->get_max_log_size()); ui_ms_chatlog = new AOTextArea(this); ui_ms_chatlog->setReadOnly(true); @@ -1039,6 +1040,25 @@ void Courtroom::handle_chatmessage_2() set_scene(); set_text_color(); + // Check if the message needs to be centered. + QString f_message = m_chatmessage[MESSAGE]; + if (f_message.size() >= 2) + { + if (f_message.startsWith("~~")) + { + message_is_centered = true; + } + else + { + message_is_centered = false; + } + } + else + { + ui_vp_message->setAlignment(Qt::AlignLeft); + } + + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); if (ao_app->flipping_enabled && m_chatmessage[FLIP].toInt() == 1) @@ -1156,14 +1176,22 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) normal.setFontWeight(QFont::Normal); const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); - const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); + const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); - ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->textCursor().insertText(p_name, bold); - ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + if (!first_message_sent) + { + ui_ic_chatlog->textCursor().insertText(p_name, bold); + first_message_sent = true; + } + else + { + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + } + ui_ic_chatlog->textCursor().insertText(p_text, normal); - if (old_cursor.hasSelection() || !is_scrolled_up) + if (old_cursor.hasSelection() || !is_scrolled_down) { // The user has selected text or scrolled away from the top: maintain position. ui_ic_chatlog->setTextCursor(old_cursor); @@ -1172,8 +1200,8 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) else { // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); } } @@ -1238,6 +1266,13 @@ void Courtroom::start_chat_ticking() return; } + // At this point, we'd do well to clear the inline colour stack. + // This stops it from flowing into next messages. + while (!inline_colour_stack.empty()) + { + inline_colour_stack.pop(); + } + ui_vp_chatbox->show(); tick_pos = 0; @@ -1301,8 +1336,94 @@ void Courtroom::chat_tick() ui_vp_message->insertHtml("" + f_character + ""); } + + else if (f_character == "\\" and !next_character_is_not_special) + { + next_character_is_not_special = true; + } + + else if (f_character == "{" and !next_character_is_not_special) + { + inline_colour_stack.push(INLINE_ORANGE); + } + else if (f_character == "}" and !next_character_is_not_special + and !inline_colour_stack.empty()) + { + if (inline_colour_stack.top() == INLINE_ORANGE) + { + inline_colour_stack.pop(); + } + } + + else if (f_character == "(" and !next_character_is_not_special) + { + inline_colour_stack.push(INLINE_BLUE); + ui_vp_message->insertHtml("" + f_character + ""); + } + else if (f_character == ")" and !next_character_is_not_special + and !inline_colour_stack.empty()) + { + if (inline_colour_stack.top() == INLINE_BLUE) + { + inline_colour_stack.pop(); + ui_vp_message->insertHtml("" + f_character + ""); + } + } + + else if (f_character == "$" and !next_character_is_not_special) + { + if (!inline_colour_stack.empty()) + { + if (inline_colour_stack.top() == INLINE_GREEN) + { + inline_colour_stack.pop(); + } + else + { + inline_colour_stack.push(INLINE_GREEN); + } + } + else + { + inline_colour_stack.push(INLINE_GREEN); + } + } + else - ui_vp_message->insertHtml(f_character); + { + next_character_is_not_special = false; + if (!inline_colour_stack.empty()) + { + switch (inline_colour_stack.top()) { + case INLINE_ORANGE: + ui_vp_message->insertHtml("" + f_character + ""); + break; + case INLINE_BLUE: + ui_vp_message->insertHtml("" + f_character + ""); + break; + case INLINE_GREEN: + ui_vp_message->insertHtml("" + f_character + ""); + break; + default: + ui_vp_message->insertHtml(f_character); + break; + } + + } + else + { + ui_vp_message->insertHtml(f_character); + } + + if (message_is_centered) + { + ui_vp_message->setAlignment(Qt::AlignCenter); + } + else + { + ui_vp_message->setAlignment(Qt::AlignLeft); + } + } QScrollBar *scroll = ui_vp_message->verticalScrollBar(); scroll->setValue(scroll->maximum()); @@ -1975,6 +2096,9 @@ void Courtroom::on_reload_theme_clicked() { ao_app->reload_theme(); + //Refresh IC chat limits. + ui_ic_chatlog->document()->setMaximumBlockCount(ao_app->get_max_log_size()); + //to update status on the background set_background(current_background); enter_courtroom(m_cid); -- cgit From 958643505b2ab9cfa601f3d2d035579fbab6c747 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 26 Jul 2018 20:30:43 +0200 Subject: IC chatlog filtering with awful code-duplication. --- courtroom.cpp | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index decb772c..460c95cd 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1180,6 +1180,96 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::End); + // Get rid of centering. + if(p_text.startsWith(": ~~")) + { + // Don't forget, the p_text part actually everything after the name! + // Hence why we check for ': ~~'. + + // If the user decided to put a space after the two tildes, remove that + // in one go. + p_text.remove("~~ "); + + // Remove all remaining ~~s. + p_text.remove("~~"); + } + + // Get rid of the inline-colouring. + // I know, I know, excessive code duplication. + // Nobody looks in here, I'm fine. + int trick_check_pos = 0; + bool ic_next_is_not_special = false; + QString f_character = p_text.at(trick_check_pos); + std::stack ic_colour_stack; + while (trick_check_pos < p_text.size()) + { + f_character = p_text.at(trick_check_pos); + if (f_character == "\\" and !ic_next_is_not_special) + { + ic_next_is_not_special = true; + p_text.remove(trick_check_pos,1); + } + + else if (f_character == "{" and !ic_next_is_not_special) + { + ic_colour_stack.push(INLINE_ORANGE); + p_text.remove(trick_check_pos,1); + } + else if (f_character == "}" and !ic_next_is_not_special + and !ic_colour_stack.empty()) + { + if (ic_colour_stack.top() == INLINE_ORANGE) + { + ic_colour_stack.pop(); + p_text.remove(trick_check_pos,1); + } + } + + else if (f_character == "(" and !ic_next_is_not_special) + { + ic_colour_stack.push(INLINE_BLUE); + p_text.remove(trick_check_pos,1); + } + else if (f_character == ")" and !ic_next_is_not_special + and !ic_colour_stack.empty()) + { + if (ic_colour_stack.top() == INLINE_BLUE) + { + ic_colour_stack.pop(); + p_text.remove(trick_check_pos,1); + } + } + + else if (f_character == "$" and !ic_next_is_not_special) + { + if (!ic_colour_stack.empty()) + { + if (ic_colour_stack.top() == INLINE_GREEN) + { + ic_colour_stack.pop(); + p_text.remove(trick_check_pos,1); + } + else + { + ic_colour_stack.push(INLINE_GREEN); + p_text.remove(trick_check_pos,1); + } + } + else + { + ic_colour_stack.push(INLINE_GREEN); + p_text.remove(trick_check_pos,1); + } + } + else + { + trick_check_pos++; + ic_next_is_not_special = false; + } + } + + // After all of that, let's jot down the message into the IC chatlog. + if (!first_message_sent) { ui_ic_chatlog->textCursor().insertText(p_name, bold); @@ -1189,6 +1279,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) { ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); } + ui_ic_chatlog->textCursor().insertText(p_text, normal); if (old_cursor.hasSelection() || !is_scrolled_down) -- cgit From 68f6d5e27ae1cce6c576902f5209333b6f26eb36 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 26 Jul 2018 22:20:48 +0200 Subject: Changed the green inline colour's symbol to backwards apostrophe. --- courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 460c95cd..0818fcaf 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1240,7 +1240,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) } } - else if (f_character == "$" and !ic_next_is_not_special) + else if (f_character == "`" and !ic_next_is_not_special) { if (!ic_colour_stack.empty()) { @@ -1461,7 +1461,7 @@ void Courtroom::chat_tick() } } - else if (f_character == "$" and !next_character_is_not_special) + else if (f_character == "`" and !next_character_is_not_special) { if (!inline_colour_stack.empty()) { -- cgit From 5aacfa8b486d6dcb9c8dee35605b1ec13c49a27a Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 26 Jul 2018 22:23:31 +0200 Subject: Fixed the parenthesis bug. --- courtroom.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 0818fcaf..984109dc 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1228,7 +1228,6 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) else if (f_character == "(" and !ic_next_is_not_special) { ic_colour_stack.push(INLINE_BLUE); - p_text.remove(trick_check_pos,1); } else if (f_character == ")" and !ic_next_is_not_special and !ic_colour_stack.empty()) @@ -1236,7 +1235,6 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) if (ic_colour_stack.top() == INLINE_BLUE) { ic_colour_stack.pop(); - p_text.remove(trick_check_pos,1); } } -- cgit From 8c81a88e13560b08b5bac69f63a94800f9e42597 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 26 Jul 2018 23:19:32 +0200 Subject: Fixed a bug with inline blue, added whispering. Furthermore, there are no longer any checks on the yellow and the rainbow colours, they are available from the getgo. --- courtroom.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 984109dc..3ea87938 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -174,8 +174,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_text_color->addItem("Red"); ui_text_color->addItem("Orange"); ui_text_color->addItem("Blue"); - if (ao_app->yellow_text_enabled) - ui_text_color->addItem("Yellow"); + ui_text_color->addItem("Yellow"); + ui_text_color->addItem("Rainbow"); + //ui_text_color->addItem("Pink"); + //ui_text_color->addItem("Purple"); ui_music_slider = new QSlider(Qt::Horizontal, this); ui_music_slider->setRange(0, 100); @@ -906,7 +908,7 @@ void Courtroom::on_chat_return_pressed() if (text_color < 0) f_text_color = "0"; - else if (text_color > 4 && !ao_app->yellow_text_enabled) + else if (text_color > 8) f_text_color = "0"; else f_text_color = QString::number(text_color); @@ -1228,6 +1230,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) else if (f_character == "(" and !ic_next_is_not_special) { ic_colour_stack.push(INLINE_BLUE); + trick_check_pos++; } else if (f_character == ")" and !ic_next_is_not_special and !ic_colour_stack.empty()) @@ -1235,6 +1238,22 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) if (ic_colour_stack.top() == INLINE_BLUE) { ic_colour_stack.pop(); + trick_check_pos++; + } + } + + else if (f_character == "[" and !ic_next_is_not_special) + { + ic_colour_stack.push(INLINE_GREY); + trick_check_pos++; + } + else if (f_character == "]" and !ic_next_is_not_special + and !ic_colour_stack.empty()) + { + if (ic_colour_stack.top() == INLINE_GREY) + { + ic_colour_stack.pop(); + trick_check_pos++; } } @@ -1459,6 +1478,21 @@ void Courtroom::chat_tick() } } + else if (f_character == "[" and !next_character_is_not_special) + { + inline_colour_stack.push(INLINE_GREY); + ui_vp_message->insertHtml("" + f_character + ""); + } + else if (f_character == "]" and !next_character_is_not_special + and !inline_colour_stack.empty()) + { + if (inline_colour_stack.top() == INLINE_GREY) + { + inline_colour_stack.pop(); + ui_vp_message->insertHtml("" + f_character + ""); + } + } + else if (f_character == "`" and !next_character_is_not_special) { if (!inline_colour_stack.empty()) @@ -1493,6 +1527,9 @@ void Courtroom::chat_tick() case INLINE_GREEN: ui_vp_message->insertHtml("" + f_character + ""); break; + case INLINE_GREY: + ui_vp_message->insertHtml("" + f_character + ""); + break; default: ui_vp_message->insertHtml(f_character); break; @@ -1674,6 +1711,14 @@ void Courtroom::set_text_color() ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: yellow"); break; + case PINK: + ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: pink"); + break; + case PURPLE: + ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: purple"); + break; default: qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; case WHITE: @@ -1827,9 +1872,9 @@ void Courtroom::on_ooc_return_pressed() ui_guard->show(); else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended) { - ui_text_color->addItem("Rainbow"); + //ui_text_color->addItem("Rainbow"); ui_ooc_chat_message->clear(); - rainbow_appended = true; + //rainbow_appended = true; return; } -- cgit From a8205986a4592056f2445f3b104e45a84f674ba9 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 26 Jul 2018 23:35:21 +0200 Subject: Orange is now |, comments for text features. --- courtroom.cpp | 58 +++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 17 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 3ea87938..24b63cde 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1206,27 +1206,38 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) while (trick_check_pos < p_text.size()) { f_character = p_text.at(trick_check_pos); + + // Escape character. if (f_character == "\\" and !ic_next_is_not_special) { ic_next_is_not_special = true; p_text.remove(trick_check_pos,1); } - else if (f_character == "{" and !ic_next_is_not_special) - { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos,1); - } - else if (f_character == "}" and !ic_next_is_not_special - and !ic_colour_stack.empty()) + // Orange inline colourisation. + else if (f_character == "|" and !ic_next_is_not_special) { - if (ic_colour_stack.top() == INLINE_ORANGE) + if (!ic_colour_stack.empty()) { - ic_colour_stack.pop(); + if (ic_colour_stack.top() == INLINE_ORANGE) + { + ic_colour_stack.pop(); + p_text.remove(trick_check_pos,1); + } + else + { + ic_colour_stack.push(INLINE_ORANGE); + p_text.remove(trick_check_pos,1); + } + } + else + { + ic_colour_stack.push(INLINE_ORANGE); p_text.remove(trick_check_pos,1); } } + // Blue inline colourisation. else if (f_character == "(" and !ic_next_is_not_special) { ic_colour_stack.push(INLINE_BLUE); @@ -1242,6 +1253,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) } } + // Grey inline colourisation. else if (f_character == "[" and !ic_next_is_not_special) { ic_colour_stack.push(INLINE_GREY); @@ -1257,6 +1269,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) } } + // Green inline colourisation. else if (f_character == "`" and !ic_next_is_not_special) { if (!ic_colour_stack.empty()) @@ -1445,24 +1458,33 @@ void Courtroom::chat_tick() ui_vp_message->insertHtml("" + f_character + ""); } + // Escape character. else if (f_character == "\\" and !next_character_is_not_special) { next_character_is_not_special = true; } - else if (f_character == "{" and !next_character_is_not_special) - { - inline_colour_stack.push(INLINE_ORANGE); - } - else if (f_character == "}" and !next_character_is_not_special - and !inline_colour_stack.empty()) + // Orange inline colourisation. + else if (f_character == "|" and !next_character_is_not_special) { - if (inline_colour_stack.top() == INLINE_ORANGE) + if (!inline_colour_stack.empty()) { - inline_colour_stack.pop(); + if (inline_colour_stack.top() == INLINE_ORANGE) + { + inline_colour_stack.pop(); + } + else + { + inline_colour_stack.push(INLINE_ORANGE); + } + } + else + { + inline_colour_stack.push(INLINE_ORANGE); } } + // Blue inline colourisation. else if (f_character == "(" and !next_character_is_not_special) { inline_colour_stack.push(INLINE_BLUE); @@ -1478,6 +1500,7 @@ void Courtroom::chat_tick() } } + // Grey inline colourisation. else if (f_character == "[" and !next_character_is_not_special) { inline_colour_stack.push(INLINE_GREY); @@ -1493,6 +1516,7 @@ void Courtroom::chat_tick() } } + // Green inline colourisation. else if (f_character == "`" and !next_character_is_not_special) { if (!inline_colour_stack.empty()) -- cgit From 3295e5a78e55e1cc11b6ee705fff3ca54c2a02f6 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 26 Jul 2018 23:51:47 +0200 Subject: Text speed modifier. - 7 different speeds. - `{` turns the speed down. - `}` turns the speed up! --- courtroom.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 24b63cde..264192d9 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1214,6 +1214,16 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) p_text.remove(trick_check_pos,1); } + // Text speed modifier. + 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) { @@ -1398,7 +1408,10 @@ void Courtroom::start_chat_ticking() tick_pos = 0; blip_pos = 0; - chat_tick_timer->start(chat_tick_interval); + + // At the start of every new message, we set the text speed to the default. + current_display_speed = 3; + chat_tick_timer->start(message_display_speed[current_display_speed]); QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); @@ -1415,10 +1428,12 @@ void Courtroom::chat_tick() QString f_message = m_chatmessage[MESSAGE]; + // Due to our new text speed system, we always need to stop the timer now. + chat_tick_timer->stop(); + if (tick_pos >= f_message.size()) { text_state = 2; - chat_tick_timer->stop(); anim_state = 3; ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); } @@ -1464,6 +1479,17 @@ void Courtroom::chat_tick() next_character_is_not_special = true; } + // Text speed modifier. + else if (f_character == "{" and !next_character_is_not_special) + { + // ++, because it INCREASES delay! + current_display_speed++; + } + else if (f_character == "}" and !next_character_is_not_special) + { + current_display_speed--; + } + // Orange inline colourisation. else if (f_character == "|" and !next_character_is_not_special) { @@ -1594,6 +1620,20 @@ void Courtroom::chat_tick() } ++tick_pos; + + // Restart the timer, but according to the newly set speeds, if there were any. + // Keep the speed at bay. + if (current_display_speed < 0) + { + current_display_speed = 0; + } + + if (current_display_speed > 6) + { + current_display_speed = 6; + } + + chat_tick_timer->start(message_display_speed[current_display_speed]); } } -- cgit From 977a88a2672ff9bd6ebec8b29eb37f7a120c1e1f Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 27 Jul 2018 22:06:09 +0200 Subject: Ability to set a default username added. - Done by adding a `default_username = whatever` to your `config.ini`. - `whatever` can be any string. - If nothing is given, it defaults to the, uh, default nothing. --- courtroom.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 264192d9..d3e3728e 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -111,6 +111,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ooc_chat_name->setFrame(false); ui_ooc_chat_name->setPlaceholderText("Name"); + ui_ooc_chat_name->setText(p_ao_app->get_default_username()); + //ui_area_password = new QLineEdit(this); //ui_area_password->setFrame(false); ui_music_search = new QLineEdit(this); -- cgit From 7d476867cbc85ed72cb6d9faa286116e58010c4c Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 27 Jul 2018 23:09:41 +0200 Subject: 'Call mod' button now pops up a dialog. - Allows for cancelling calling a mod if it was a mistake. - Allows for giving a reason for the call, optionally. - **Obviously needs server-side support, too, to work.** --- courtroom.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index d3e3728e..4e1529b7 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -13,6 +13,7 @@ #include #include #include +#include Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { @@ -2337,7 +2338,14 @@ void Courtroom::on_spectator_clicked() void Courtroom::on_call_mod_clicked() { - ao_app->send_server_packet(new AOPacket("ZZ#%")); + bool ok; + QString text = QInputDialog::getText(ui_viewport, "Call a mod", + "Reason for the modcall (optional):", QLineEdit::Normal, + "", &ok); + if (ok) + { + ao_app->send_server_packet(new AOPacket("ZZ#" + text + "#%")); + } ui_ic_chat_message->setFocus(); } -- cgit From 366389c6bc8c3bd52303e791e42966a1ef6455b0 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 27 Jul 2018 23:39:56 +0200 Subject: The log now has an option to go both ways. - Due to the log's nature, this must be set manually in one's `config.ini`. --- courtroom.cpp | 68 +++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 20 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 4e1529b7..fda29cec 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1175,15 +1175,14 @@ void Courtroom::handle_chatmessage_3() void Courtroom::append_ic_text(QString p_text, QString p_name) { + bool downwards = ao_app->get_log_goes_downwards(); + QTextCharFormat bold; QTextCharFormat normal; bold.setFontWeight(QFont::Bold); normal.setFontWeight(QFont::Normal); const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); - const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); - - ui_ic_chatlog->moveCursor(QTextCursor::End); // Get rid of centering. if(p_text.startsWith(": ~~")) @@ -1313,29 +1312,58 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) // After all of that, let's jot down the message into the IC chatlog. - if (!first_message_sent) - { - ui_ic_chatlog->textCursor().insertText(p_name, bold); - first_message_sent = true; - } - else + if (downwards) { - ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); - } + const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); + + ui_ic_chatlog->moveCursor(QTextCursor::End); + + if (!first_message_sent) + { + ui_ic_chatlog->textCursor().insertText(p_name, bold); + first_message_sent = true; + } + else + { + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + } - ui_ic_chatlog->textCursor().insertText(p_text, normal); + ui_ic_chatlog->textCursor().insertText(p_text, normal); - if (old_cursor.hasSelection() || !is_scrolled_down) - { - // The user has selected text or scrolled away from the top: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + if (old_cursor.hasSelection() || !is_scrolled_down) + { + // The user has selected text or scrolled away from the bottom: maintain position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else + { + // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the top. + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); + } } else { - // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); + const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); + + ui_ic_chatlog->moveCursor(QTextCursor::Start); + + ui_ic_chatlog->textCursor().insertText(p_name, bold); + ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + + if (old_cursor.hasSelection() || !is_scrolled_up) + { + // The user has selected text or scrolled away from the top: maintain position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else + { + // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); + } } } -- cgit From 1b70d4d6dbc5090fde105ade1db57ed668d5e520 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 28 Jul 2018 00:14:57 +0200 Subject: In-game log limit changer + enabling other full text colours. --- courtroom.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index fda29cec..55a17846 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -140,6 +140,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_sfx_label = new QLabel(this); ui_blip_label = new QLabel(this); + ui_log_limit_label = new QLabel(this); + ui_hold_it = new AOButton(this, ao_app); ui_objection = new AOButton(this, ao_app); ui_take_that = new AOButton(this, ao_app); @@ -179,8 +181,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_text_color->addItem("Blue"); ui_text_color->addItem("Yellow"); ui_text_color->addItem("Rainbow"); - //ui_text_color->addItem("Pink"); - //ui_text_color->addItem("Purple"); + ui_text_color->addItem("Pink"); + ui_text_color->addItem("Purple"); ui_music_slider = new QSlider(Qt::Horizontal, this); ui_music_slider->setRange(0, 100); @@ -194,6 +196,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_blip_slider->setRange(0, 100); ui_blip_slider->setValue(ao_app->get_default_blip()); + ui_log_limit_spinbox = new QSpinBox(this); + ui_log_limit_spinbox->setRange(0, 10000); + ui_log_limit_spinbox->setValue(ao_app->get_max_log_size()); + ui_evidence_button = new AOButton(this, ao_app); construct_evidence(); @@ -249,6 +255,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this, SLOT(on_sfx_slider_moved(int))); connect(ui_blip_slider, SIGNAL(valueChanged(int)), this, SLOT(on_blip_slider_moved(int))); + connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_log_limit_changed(int))); + connect(ui_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked())); connect(ui_music_search, SIGNAL(textChanged(QString)), this, SLOT(on_music_search_edited(QString))); @@ -438,6 +446,9 @@ void Courtroom::set_widgets() set_size_and_pos(ui_blip_label, "blip_label"); ui_blip_label->setText("Blips"); + set_size_and_pos(ui_log_limit_label, "log_limit_label"); + ui_log_limit_label->setText("Log limit"); + set_size_and_pos(ui_hold_it, "hold_it"); ui_hold_it->set_image("holdit.png"); set_size_and_pos(ui_objection, "objection"); @@ -496,6 +507,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_sfx_slider, "sfx_slider"); set_size_and_pos(ui_blip_slider, "blip_slider"); + set_size_and_pos(ui_log_limit_spinbox, "log_limit_spinbox"); + set_size_and_pos(ui_evidence_button, "evidence_button"); ui_evidence_button->set_image("evidencebutton.png"); @@ -2288,6 +2301,11 @@ void Courtroom::on_blip_slider_moved(int p_value) ui_ic_chat_message->setFocus(); } +void Courtroom::on_log_limit_changed(int value) +{ + ui_ic_chatlog->document()->setMaximumBlockCount(value); +} + void Courtroom::on_witness_testimony_clicked() { if (is_muted) -- cgit From c1807e0888c5851ab4fc2b419ec892a601792179 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 28 Jul 2018 14:41:42 +0200 Subject: Max OOC name limited, unnecessary variable removed. --- courtroom.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 55a17846..70e3f662 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -111,6 +111,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ooc_chat_name = new QLineEdit(this); ui_ooc_chat_name->setFrame(false); ui_ooc_chat_name->setPlaceholderText("Name"); + ui_ooc_chat_name->setMaxLength(30); ui_ooc_chat_name->setText(p_ao_app->get_default_username()); -- cgit From e8f07c68c2aec19f65318d4aa6241ebcb0f1ccf5 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 28 Jul 2018 16:09:54 +0200 Subject: Allow changing of shownames. Don't forget to set the size and position of the name input in a theme. --- courtroom.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 6 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 70e3f662..b70ec0b8 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -99,8 +99,13 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() //ui_area_list = new QListWidget(this); ui_music_list = new QListWidget(this); + ui_ic_chat_name = new QLineEdit(this); + ui_ic_chat_name->setFrame(false); + ui_ic_chat_name->setPlaceholderText("Showname"); + ui_ic_chat_message = new QLineEdit(this); ui_ic_chat_message->setFrame(false); + ui_ic_chat_message->setPlaceholderText("Message"); ui_muted = new AOImage(ui_ic_chat_message, ao_app); ui_muted->hide(); @@ -399,14 +404,17 @@ void Courtroom::set_widgets() { set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); set_size_and_pos(ui_vp_chatbox, "ao2_chatbox"); + set_size_and_pos(ui_ic_chat_name, "ao2_ic_chat_name"); } else { set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); set_size_and_pos(ui_vp_chatbox, "chatbox"); + set_size_and_pos(ui_ic_chat_name, "ic_chat_name"); } ui_ic_chat_message->setStyleSheet("QLineEdit{background-color: rgba(100, 100, 100, 255);}"); + ui_ic_chat_name->setStyleSheet("QLineEdit{background-color: rgba(180, 180, 180, 255);}"); ui_vp_chatbox->set_image("chatmed.png"); ui_vp_chatbox->hide(); @@ -932,17 +940,40 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(f_text_color); + if (!ui_ic_chat_name->text().isEmpty()) + { + packet_contents.append(ui_ic_chat_name->text()); + } + ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } void Courtroom::handle_chatmessage(QStringList *p_contents) { - if (p_contents->size() < chatmessage_size) + // Instead of checking for whether a message has at least chatmessage_size + // amount of packages, we'll check if it has at least 15. + // That was the original chatmessage_size. + if (p_contents->size() < 15) return; + //qDebug() << "A message was got. Its contents:"; for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string) { - m_chatmessage[n_string] = p_contents->at(n_string); + //m_chatmessage[n_string] = p_contents->at(n_string); + + // Note that we have added stuff that vanilla clients and servers simply won't send. + // So now, we have to check if the thing we want even exists amongst the packet's content. + // Also, don't forget! A size 15 message will have indices from 0 to 14. + if (n_string < p_contents->size()) + { + m_chatmessage[n_string] = p_contents->at(n_string); + //qDebug() << "- " << n_string << ": " << p_contents->at(n_string); + } + else + { + m_chatmessage[n_string] = ""; + //qDebug() << "- " << n_string << ": Nothing?"; + } } int f_char_id = m_chatmessage[CHAR_ID].toInt(); @@ -953,7 +984,16 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) if (mute_map.value(m_chatmessage[CHAR_ID].toInt())) return; - QString f_showname = ao_app->get_showname(char_list.at(f_char_id).name); + QString f_showname; + if (m_chatmessage[SHOWNAME].isEmpty()) + { + f_showname = ao_app->get_showname(char_list.at(f_char_id).name); + } + else + { + f_showname = m_chatmessage[SHOWNAME]; + } + QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; @@ -1037,11 +1077,18 @@ void Courtroom::handle_chatmessage_2() ui_vp_speedlines->stop(); ui_vp_player_char->stop(); - QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; + if (m_chatmessage[SHOWNAME].isEmpty()) + { + QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; - QString f_showname = ao_app->get_showname(real_name); + QString f_showname = ao_app->get_showname(real_name); - ui_vp_showname->setText(f_showname); + ui_vp_showname->setText(f_showname); + } + else + { + ui_vp_showname->setText(m_chatmessage[SHOWNAME]); + } ui_vp_message->clear(); ui_vp_chatbox->hide(); -- cgit From cfc2d74d303787c8694f735f6fe3d1f989073c32 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 28 Jul 2018 18:35:48 +0200 Subject: Limit modcall reason size to 100. --- courtroom.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index b70ec0b8..d0765b16 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2438,6 +2438,7 @@ void Courtroom::on_call_mod_clicked() "", &ok); if (ok) { + text = text.chopped(100); ao_app->send_server_packet(new AOPacket("ZZ#" + text + "#%")); } -- cgit From c5ef5b0e690a6a764d6c18338907d9dc56379afd Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 28 Jul 2018 18:54:29 +0200 Subject: The colour purple has been changed to cyan. --- courtroom.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index d0765b16..2b72aad4 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -188,7 +188,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_text_color->addItem("Yellow"); ui_text_color->addItem("Rainbow"); ui_text_color->addItem("Pink"); - ui_text_color->addItem("Purple"); + ui_text_color->addItem("Cyan"); ui_music_slider = new QSlider(Qt::Horizontal, this); ui_music_slider->setRange(0, 100); @@ -1871,9 +1871,9 @@ void Courtroom::set_text_color() ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: pink"); break; - case PURPLE: + case CYAN: ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: purple"); + "color: cyan"); break; default: qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; -- cgit From 5283bc68d26c63a637bbd60b11dc2c11a7635b76 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 28 Jul 2018 21:56:56 +0200 Subject: Fixed a big stack bug that softlocked the game. --- courtroom.cpp | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 2b72aad4..f9259b74 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1324,6 +1324,10 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ic_colour_stack.pop(); trick_check_pos++; } + else + { + ic_next_is_not_special = true; + } } // Grey inline colourisation. @@ -1340,6 +1344,10 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ic_colour_stack.pop(); trick_check_pos++; } + else + { + ic_next_is_not_special = true; + } } // Green inline colourisation. @@ -1523,6 +1531,9 @@ void Courtroom::chat_tick() // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); + // Stops blips from playing when we have a formatting option. + bool formatting_char = false; + if (tick_pos >= f_message.size()) { text_state = 2; @@ -1569,6 +1580,7 @@ void Courtroom::chat_tick() else if (f_character == "\\" and !next_character_is_not_special) { next_character_is_not_special = true; + formatting_char = true; } // Text speed modifier. @@ -1576,10 +1588,12 @@ void Courtroom::chat_tick() { // ++, because it INCREASES delay! current_display_speed++; + formatting_char = true; } else if (f_character == "}" and !next_character_is_not_special) { current_display_speed--; + formatting_char = true; } // Orange inline colourisation. @@ -1600,6 +1614,7 @@ void Courtroom::chat_tick() { inline_colour_stack.push(INLINE_ORANGE); } + formatting_char = true; } // Blue inline colourisation. @@ -1616,6 +1631,11 @@ void Courtroom::chat_tick() inline_colour_stack.pop(); ui_vp_message->insertHtml("" + f_character + ""); } + else + { + next_character_is_not_special = true; + tick_pos--; + } } // Grey inline colourisation. @@ -1632,6 +1652,11 @@ void Courtroom::chat_tick() inline_colour_stack.pop(); ui_vp_message->insertHtml("" + f_character + ""); } + else + { + next_character_is_not_special = true; + tick_pos--; + } } // Green inline colourisation. @@ -1642,15 +1667,18 @@ void Courtroom::chat_tick() if (inline_colour_stack.top() == INLINE_GREEN) { inline_colour_stack.pop(); + formatting_char = true; } else { inline_colour_stack.push(INLINE_GREEN); + formatting_char = true; } } else { inline_colour_stack.push(INLINE_GREEN); + formatting_char = true; } } @@ -1702,7 +1730,7 @@ void Courtroom::chat_tick() if (f_message.at(tick_pos) != ' ' || blank_blip) { - if (blip_pos % blip_rate == 0) + if (blip_pos % blip_rate == 0 && !formatting_char) { blip_pos = 0; blip_player->blip_tick(); @@ -1725,7 +1753,16 @@ void Courtroom::chat_tick() current_display_speed = 6; } - chat_tick_timer->start(message_display_speed[current_display_speed]); + // If we had a formatting char, we shouldn't wait so long again, as it won't appear! + if (formatting_char) + { + chat_tick_timer->start(1); + } + else + { + chat_tick_timer->start(message_display_speed[current_display_speed]); + } + } } -- cgit From 0561ae7fd6458a310d29e5cde4dfa30877365fcb Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 28 Jul 2018 23:56:37 +0200 Subject: Allow the toggling of custom shownames. Don't forget to enable it in a theme. --- courtroom.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index f9259b74..ec1393bd 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -169,6 +169,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_guard->setText("Guard"); ui_guard->hide(); + ui_showname_enable = new QCheckBox(this); + ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); + ui_showname_enable->setText("Custom shownames"); + ui_showname_enable; + ui_custom_objection = new AOButton(this, ao_app); ui_realization = new AOButton(this, ao_app); ui_mute = new AOButton(this, ao_app); @@ -278,6 +283,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); + connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked())); + connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); set_widgets(); @@ -489,6 +496,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_guard, "guard"); + set_size_and_pos(ui_showname_enable, "showname_enable"); + set_size_and_pos(ui_custom_objection, "custom_objection"); ui_custom_objection->set_image("custom.png"); @@ -985,7 +994,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) return; QString f_showname; - if (m_chatmessage[SHOWNAME].isEmpty()) + if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { f_showname = ao_app->get_showname(char_list.at(f_char_id).name); } @@ -1077,7 +1086,7 @@ void Courtroom::handle_chatmessage_2() ui_vp_speedlines->stop(); ui_vp_player_char->stop(); - if (m_chatmessage[SHOWNAME].isEmpty()) + if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; @@ -2497,6 +2506,11 @@ void Courtroom::on_guard_clicked() ui_ic_chat_message->setFocus(); } +void Courtroom::on_showname_enable_clicked() +{ + ui_ic_chat_message->setFocus(); +} + void Courtroom::on_evidence_button_clicked() { if (ui_evidence->isHidden()) -- cgit From 95d521de9eb64fb355be2db88bf7b47c368193b8 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sun, 29 Jul 2018 15:48:11 +0200 Subject: Modified the centering behaviour. Now only the two beginning tildes get removed. This is so that people can do location and time announcements. --- courtroom.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index ec1393bd..8f8bc37c 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1260,12 +1260,10 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) // Don't forget, the p_text part actually everything after the name! // Hence why we check for ': ~~'. - // If the user decided to put a space after the two tildes, remove that - // in one go. - p_text.remove("~~ "); - - // Remove all remaining ~~s. - p_text.remove("~~"); + // Let's remove those two tildes, then. + // : _ ~ ~ + // 0 1 2 3 + p_text.remove(2,2); } // Get rid of the inline-colouring. @@ -1543,6 +1541,13 @@ void Courtroom::chat_tick() // Stops blips from playing when we have a formatting option. bool formatting_char = false; + // If previously, we have detected that the message is centered, now + // is the time to remove those two tildes at the start. + if (message_is_centered) + { + f_message.remove(0,2); + } + if (tick_pos >= f_message.size()) { text_state = 2; -- cgit From f77381864e64e0c21b8db838daa62bbab2b58dc4 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 30 Jul 2018 18:58:23 +0200 Subject: Removed the now unneeded reloading of log limits on theme reload. --- courtroom.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 8f8bc37c..113a69a6 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2442,9 +2442,6 @@ void Courtroom::on_reload_theme_clicked() { ao_app->reload_theme(); - //Refresh IC chat limits. - ui_ic_chatlog->document()->setMaximumBlockCount(ao_app->get_max_log_size()); - //to update status on the background set_background(current_background); enter_courtroom(m_cid); -- cgit From c460a5b795bc4c65d271db5b6f2af0a946cf6947 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 3 Aug 2018 19:50:53 +0200 Subject: Static linking for Windows. --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 113a69a6..415c20ec 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2486,7 +2486,7 @@ void Courtroom::on_call_mod_clicked() "", &ok); if (ok) { - text = text.chopped(100); + text = text.left(100); ao_app->send_server_packet(new AOPacket("ZZ#" + text + "#%")); } -- cgit From f9baa0454d49d7da65a5c17afbb11aefa120e85a Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 7 Aug 2018 19:28:05 +0200 Subject: Log limit bugfixes. - Log limit is now correctly applied in both directions. - Log direction now cannot be changed by rewriting the ini mid-game. --- courtroom.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 415c20ec..7c118348 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -84,7 +84,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ic_chatlog = new QTextEdit(this); ui_ic_chatlog->setReadOnly(true); - ui_ic_chatlog->document()->setMaximumBlockCount(ao_app->get_max_log_size()); + + log_maximum_blocks = ao_app->get_max_log_size(); + log_goes_downwards = ao_app->get_log_goes_downwards(); ui_ms_chatlog = new AOTextArea(this); ui_ms_chatlog->setReadOnly(true); @@ -172,7 +174,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_showname_enable = new QCheckBox(this); ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); ui_showname_enable->setText("Custom shownames"); - ui_showname_enable; ui_custom_objection = new AOButton(this, ao_app); ui_realization = new AOButton(this, ao_app); @@ -1245,8 +1246,6 @@ void Courtroom::handle_chatmessage_3() void Courtroom::append_ic_text(QString p_text, QString p_name) { - bool downwards = ao_app->get_log_goes_downwards(); - QTextCharFormat bold; QTextCharFormat normal; bold.setFontWeight(QFont::Bold); @@ -1388,7 +1387,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) // After all of that, let's jot down the message into the IC chatlog. - if (downwards) + if (log_goes_downwards) { const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); @@ -1414,10 +1413,20 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) } else { - // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the top. + // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); } + + // Finally, if we got too many blocks in the current log, delete some from the top. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + { + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deleteChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } } else { @@ -1440,6 +1449,17 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); } + + + // Finally, if we got too many blocks in the current log, delete some from the bottom. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + { + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deletePreviousChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } } } @@ -2402,7 +2422,7 @@ void Courtroom::on_blip_slider_moved(int p_value) void Courtroom::on_log_limit_changed(int value) { - ui_ic_chatlog->document()->setMaximumBlockCount(value); + log_maximum_blocks = value; } void Courtroom::on_witness_testimony_clicked() -- cgit From eca2cd02f41ae5496a0cb1f393fe82c44e593603 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 7 Aug 2018 21:10:47 +0200 Subject: Inline blue text now stops the character from talking. --- courtroom.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 7c118348..3a5173c8 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1195,11 +1195,17 @@ void Courtroom::handle_chatmessage_3() bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE; if (!text_is_blue && text_state == 1) + { //talking f_anim_state = 2; + entire_message_is_blue = false; + } else + { //idle f_anim_state = 3; + entire_message_is_blue = true; + } if (f_anim_state <= anim_state) return; @@ -1536,6 +1542,10 @@ void Courtroom::start_chat_ticking() tick_pos = 0; blip_pos = 0; + // Just in case we somehow got inline blue text left over from a previous message, + // let's set it to false. + inline_blue_depth = 0; + // At the start of every new message, we set the text speed to the default. current_display_speed = 3; chat_tick_timer->start(message_display_speed[current_display_speed]); @@ -1656,6 +1666,18 @@ void Courtroom::chat_tick() { inline_colour_stack.push(INLINE_BLUE); ui_vp_message->insertHtml("" + f_character + ""); + + // Increase how deep we are in inline blues. + inline_blue_depth++; + + // Here, we check if the entire message is blue. + // If it isn't, we stop talking. + if (!entire_message_is_blue) + { + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_idle(f_char, f_emote); + } } else if (f_character == ")" and !next_character_is_not_special and !inline_colour_stack.empty()) @@ -1664,6 +1686,24 @@ void Courtroom::chat_tick() { inline_colour_stack.pop(); ui_vp_message->insertHtml("" + f_character + ""); + + // Decrease how deep we are in inline blues. + // Just in case, we do a check if we're above zero, but we should be. + if (inline_blue_depth > 0) + { + inline_blue_depth--; + // Here, we check if the entire message is blue. + // If it isn't, we start talking if we have completely climbed out of inline blues. + if (!entire_message_is_blue) + { + if (inline_blue_depth == 0) + { + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_talking(f_char, f_emote); + } + } + } } else { -- cgit From c85244e38c5444a37d926e1d6284f6bea43341be Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 8 Aug 2018 19:19:53 +0200 Subject: config.ini functioning changed. - Now the program uses the QSettings class to manipulate the `config.ini`. - Support for multiple audio devices and options menu started. --- courtroom.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 3a5173c8..b275b1fc 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1222,6 +1222,7 @@ void Courtroom::handle_chatmessage_3() break; default: qDebug() << "W: invalid anim_state: " << f_anim_state; + // fall through case 3: ui_vp_player_char->play_idle(f_char, f_emote); anim_state = 3; @@ -1988,6 +1989,7 @@ void Courtroom::set_text_color() break; default: qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; + // fall through case WHITE: ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white"); -- cgit From 885df58ec92abcde5e8aec60535e1a04d10a4e4a Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 8 Aug 2018 22:28:20 +0200 Subject: Clientside now no longer displays '.mp3' at the end of every song mention. --- courtroom.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index b275b1fc..3e53867c 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -796,10 +796,12 @@ 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.replace(".mp3",""); if (i_song.toLower().contains(ui_music_search->text().toLower())) { - ui_music_list->addItem(i_song); + ui_music_list->addItem(i_song_listname); QString song_path = ao_app->get_base_path() + "sounds/music/" + i_song.toLower(); @@ -2043,6 +2045,8 @@ void Courtroom::handle_song(QStringList *p_contents) return; QString f_song = f_contents.at(0); + QString f_song_clear = f_song; + f_song_clear.replace(".mp3", ""); int n_char = f_contents.at(1).toInt(); if (n_char < 0 || n_char >= char_list.size()) @@ -2055,7 +2059,7 @@ void Courtroom::handle_song(QStringList *p_contents) if (!mute_map.value(n_char)) { - append_ic_text(" has played a song: " + f_song, str_char); + append_ic_text(" has played a song: " + f_song_clear, str_char); music_player->play(f_song); } } @@ -2290,7 +2294,8 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model) if (is_muted) return; - QString p_song = ui_music_list->item(p_model.row())->text(); + //QString p_song = ui_music_list->item(p_model.row())->text(); + QString p_song = music_list.at(p_model.row()); ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false); } -- cgit From 0f2665aabed04f0fe68b1104a0b5df05d0525d01 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 9 Aug 2018 21:23:30 +0200 Subject: Settings menu avaiable through ingame means + IC beautification. - Changing songs is now done in italics. --- courtroom.cpp | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 110 insertions(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 3e53867c..040c5b40 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -161,6 +161,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_change_character = new AOButton(this, ao_app); ui_reload_theme = new AOButton(this, ao_app); ui_call_mod = new AOButton(this, ao_app); + ui_settings = new AOButton(this, ao_app); ui_pre = new QCheckBox(this); ui_pre->setText("Pre"); @@ -279,6 +280,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked())); connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked())); connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked())); + connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); @@ -490,6 +492,9 @@ void Courtroom::set_widgets() set_size_and_pos(ui_call_mod, "call_mod"); ui_call_mod->setText("Call mod"); + set_size_and_pos(ui_settings, "settings"); + ui_settings->setText("Settings"); + set_size_and_pos(ui_pre, "pre"); ui_pre->setText("Pre"); @@ -1472,6 +1477,99 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) } } +// Call it ugly, call it a hack, but I wanted to do something special with the songname changes. +void Courtroom::append_ic_songchange(QString p_songname, QString p_name) +{ + QTextCharFormat bold; + QTextCharFormat normal; + QTextCharFormat italics; + bold.setFontWeight(QFont::Bold); + normal.setFontWeight(QFont::Normal); + italics.setFontItalic(true); + const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); + const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); + + if (log_goes_downwards) + { + const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); + + ui_ic_chatlog->moveCursor(QTextCursor::End); + + if (!first_message_sent) + { + ui_ic_chatlog->textCursor().insertText(p_name, bold); + first_message_sent = true; + } + else + { + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + } + + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_songname, italics); + ui_ic_chatlog->textCursor().insertText(".", normal); + + if (old_cursor.hasSelection() || !is_scrolled_down) + { + // The user has selected text or scrolled away from the bottom: maintain position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else + { + // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); + } + + // Finally, if we got too many blocks in the current log, delete some from the top. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + { + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deleteChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } + } + else + { + const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); + + ui_ic_chatlog->moveCursor(QTextCursor::Start); + + ui_ic_chatlog->textCursor().insertText(p_name, bold); + + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_songname, italics); + ui_ic_chatlog->textCursor().insertText(".", normal); + + if (old_cursor.hasSelection() || !is_scrolled_up) + { + // The user has selected text or scrolled away from the top: maintain position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else + { + // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); + } + + + // Finally, if we got too many blocks in the current log, delete some from the bottom. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + { + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deletePreviousChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } + } +} + void Courtroom::play_preanim() { QString f_char = m_chatmessage[CHAR_NAME]; @@ -2059,7 +2157,7 @@ void Courtroom::handle_song(QStringList *p_contents) if (!mute_map.value(n_char)) { - append_ic_text(" has played a song: " + f_song_clear, str_char); + append_ic_songchange(f_song_clear, str_char); music_player->play(f_song); } } @@ -2150,6 +2248,12 @@ void Courtroom::on_ooc_return_pressed() //rainbow_appended = true; return; } + else if (ooc_message.startsWith("/settings")) + { + ui_ooc_chat_message->clear(); + ao_app->call_settings_menu(); + return; + } QStringList packet_contents; packet_contents.append(ui_ooc_chat_name->text()); @@ -2560,6 +2664,11 @@ void Courtroom::on_call_mod_clicked() ui_ic_chat_message->setFocus(); } +void Courtroom::on_settings_clicked() +{ + ao_app->call_settings_menu(); +} + void Courtroom::on_pre_clicked() { ui_ic_chat_message->setFocus(); -- cgit From 84da730bcef71aeb0d0944261a44dc289949a74d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 10 Aug 2018 00:09:41 +0200 Subject: Music changing now shows your custom showname, if set. --- courtroom.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 040c5b40..1b24bd38 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2155,6 +2155,12 @@ void Courtroom::handle_song(QStringList *p_contents) { QString str_char = char_list.at(n_char).name; + if (p_contents->length() > 2) + { + if (ui_showname_enable->isChecked()) + str_char = p_contents->at(2); + } + if (!mute_map.value(n_char)) { append_ic_songchange(f_song_clear, str_char); @@ -2401,7 +2407,14 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model) //QString p_song = ui_music_list->item(p_model.row())->text(); QString p_song = music_list.at(p_model.row()); - ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false); + if (!ui_ic_chat_name->text().isEmpty()) + { + ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#" + ui_ic_chat_name->text() + "#%"), false); + } + else + { + ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false); + } } void Courtroom::on_hold_it_clicked() -- cgit From 0f8cb919e289d433d8a7e84b16b934c2b04c7dd2 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 14 Aug 2018 17:06:23 +0200 Subject: Fixed a bug where the music being played would depend on the row selected. --- courtroom.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 1b24bd38..8d500157 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -790,6 +790,7 @@ void Courtroom::enter_courtroom(int p_cid) void Courtroom::list_music() { ui_music_list->clear(); + music_row_to_number.clear(); QString f_file = "courtroom_design.ini"; @@ -807,6 +808,7 @@ void Courtroom::list_music() if (i_song.toLower().contains(ui_music_search->text().toLower())) { ui_music_list->addItem(i_song_listname); + music_row_to_number.append(n_song); QString song_path = ao_app->get_base_path() + "sounds/music/" + i_song.toLower(); @@ -2404,8 +2406,7 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model) if (is_muted) return; - //QString p_song = ui_music_list->item(p_model.row())->text(); - QString p_song = music_list.at(p_model.row()); + QString p_song = music_list.at(music_row_to_number.at(p_model.row())); if (!ui_ic_chat_name->text().isEmpty()) { -- cgit From af4a62b65d07d9afff137d55906e38cef6356300 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 14 Aug 2018 18:32:41 +0200 Subject: Fixed chatlog not working properly. --- courtroom.cpp | 82 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 40 insertions(+), 42 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 8d500157..293b39d5 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1421,6 +1421,16 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->textCursor().insertText(p_text, normal); + // If we got too many blocks in the current log, delete some from the top. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + { + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deleteChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } + if (old_cursor.hasSelection() || !is_scrolled_down) { // The user has selected text or scrolled away from the bottom: maintain position. @@ -1433,16 +1443,6 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); } - - // Finally, if we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) - { - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deleteChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; - } } else { @@ -1453,6 +1453,16 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->textCursor().insertText(p_name, bold); ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + // If we got too many blocks in the current log, delete some from the bottom. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + { + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deletePreviousChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } + if (old_cursor.hasSelection() || !is_scrolled_up) { // The user has selected text or scrolled away from the top: maintain position. @@ -1465,17 +1475,6 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); } - - - // Finally, if we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) - { - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deletePreviousChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; - } } } @@ -1511,6 +1510,16 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->textCursor().insertText(p_songname, italics); ui_ic_chatlog->textCursor().insertText(".", normal); + // If we got too many blocks in the current log, delete some from the top. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + { + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deleteChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } + if (old_cursor.hasSelection() || !is_scrolled_down) { // The user has selected text or scrolled away from the bottom: maintain position. @@ -1523,16 +1532,6 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); } - - // Finally, if we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) - { - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deleteChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; - } } else { @@ -1546,6 +1545,16 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->textCursor().insertText(p_songname, italics); ui_ic_chatlog->textCursor().insertText(".", normal); + // If we got too many blocks in the current log, delete some from the bottom. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + { + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deletePreviousChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } + if (old_cursor.hasSelection() || !is_scrolled_up) { // The user has selected text or scrolled away from the top: maintain position. @@ -1558,17 +1567,6 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); } - - - // Finally, if we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) - { - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deletePreviousChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; - } } } -- cgit From b25b8019f03464d8dac0e8796aeee73cf6c45600 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 14 Aug 2018 21:26:30 +0200 Subject: Fixed a minor linebreak bug in the IC chatlog. --- courtroom.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 293b39d5..717ee9db 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1507,8 +1507,7 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) } ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_songname, italics); - ui_ic_chatlog->textCursor().insertText(".", normal); + ui_ic_chatlog->textCursor().insertText(p_songname + "." + '\n', italics); // If we got too many blocks in the current log, delete some from the top. while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) @@ -1539,11 +1538,10 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().insertText(p_name, bold); + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_songname, italics); - ui_ic_chatlog->textCursor().insertText(".", normal); + ui_ic_chatlog->textCursor().insertText(p_songname + ".", italics); // If we got too many blocks in the current log, delete some from the bottom. while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) -- cgit From d6b6a03802e56e4e4ea06402846eb460d0cf5d00 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 16 Aug 2018 00:44:32 +0200 Subject: Fixed extra linebreaks after songchange in IC. --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 717ee9db..9b579d55 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1507,7 +1507,7 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) } ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_songname + "." + '\n', italics); + ui_ic_chatlog->textCursor().insertText(p_songname + ".", italics); // If we got too many blocks in the current log, delete some from the top. while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) -- cgit From 331bca5f7361ba239531faca070872ee8d44addb Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 16 Aug 2018 18:48:11 +0200 Subject: Fixed a bug regarding the log limit being zero. - This also returned the previous behaviour when the log limit is zero, that is, no log limit is applied then. --- courtroom.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 9b579d55..4ed4ffbb 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1422,7 +1422,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->textCursor().insertText(p_text, normal); // If we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); @@ -1454,7 +1454,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); // If we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); @@ -1510,7 +1510,7 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->textCursor().insertText(p_songname + ".", italics); // If we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); @@ -1538,13 +1538,13 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + ui_ic_chatlog->textCursor().insertText(p_name, bold); ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_songname + ".", italics); + ui_ic_chatlog->textCursor().insertText(p_songname + "." + '\n', italics); // If we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); -- cgit From 0368e7dc459b3057f8c7d0e6e329de0d3cd7c424 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 16 Aug 2018 20:04:19 +0200 Subject: Guilty / Not Guilty buttons for the judge position. --- courtroom.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 4ed4ffbb..2555e64d 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -157,6 +157,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ooc_toggle = new AOButton(this, ao_app); ui_witness_testimony = new AOButton(this, ao_app); ui_cross_examination = new AOButton(this, ao_app); + ui_guilty = new AOButton(this, ao_app); + ui_not_guilty = new AOButton(this, ao_app); ui_change_character = new AOButton(this, ao_app); ui_reload_theme = new AOButton(this, ao_app); @@ -276,6 +278,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_witness_testimony, SIGNAL(clicked()), this, SLOT(on_witness_testimony_clicked())); connect(ui_cross_examination, SIGNAL(clicked()), this, SLOT(on_cross_examination_clicked())); + connect(ui_guilty, SIGNAL(clicked()), this, SLOT(on_guilty_clicked())); + connect(ui_not_guilty, SIGNAL(clicked()), this, SLOT(on_not_guilty_clicked())); connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked())); connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked())); @@ -483,6 +487,11 @@ void Courtroom::set_widgets() set_size_and_pos(ui_cross_examination, "cross_examination"); ui_cross_examination->set_image("crossexamination.png"); + set_size_and_pos(ui_guilty, "guilty"); + ui_guilty->set_image("guilty.png"); + set_size_and_pos(ui_not_guilty, "not_guilty"); + ui_not_guilty->set_image("notguilty.png"); + set_size_and_pos(ui_change_character, "change_character"); ui_change_character->setText("Change character"); @@ -739,6 +748,8 @@ void Courtroom::enter_courtroom(int p_cid) { ui_witness_testimony->show(); ui_cross_examination->show(); + ui_not_guilty->show(); + ui_guilty->show(); ui_defense_minus->show(); ui_defense_plus->show(); ui_prosecution_minus->show(); @@ -748,6 +759,8 @@ void Courtroom::enter_courtroom(int p_cid) { ui_witness_testimony->hide(); ui_cross_examination->hide(); + ui_guilty->hide(); + ui_not_guilty->hide(); ui_defense_minus->hide(); ui_defense_plus->hide(); ui_prosecution_minus->hide(); @@ -2167,7 +2180,7 @@ void Courtroom::handle_song(QStringList *p_contents) } } -void Courtroom::handle_wtce(QString p_wtce) +void Courtroom::handle_wtce(QString p_wtce, int variant) { QString sfx_file = "courtroom_sounds.ini"; @@ -2186,6 +2199,20 @@ void Courtroom::handle_wtce(QString p_wtce) ui_vp_wtce->play("crossexamination"); testimony_in_progress = false; } + else if (p_wtce == "judgeruling") + { + if (variant == 0) + { + 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")); + ui_vp_wtce->play("guilty"); + testimony_in_progress = false; + } + } } void Courtroom::set_hp_bar(int p_bar, int p_state) @@ -2606,6 +2633,26 @@ void Courtroom::on_cross_examination_clicked() ui_ic_chat_message->setFocus(); } +void Courtroom::on_not_guilty_clicked() +{ + if (is_muted) + return; + + ao_app->send_server_packet(new AOPacket("RT#judgeruling#0#%")); + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_guilty_clicked() +{ + if (is_muted) + return; + + ao_app->send_server_packet(new AOPacket("RT#judgeruling#1#%")); + + ui_ic_chat_message->setFocus(); +} + void Courtroom::on_change_character_clicked() { music_player->set_volume(0); -- cgit From 572888a9dde7850fd618d6a14d303de31ae9161b Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 16 Aug 2018 20:56:26 +0200 Subject: Minor fix regarding the /pos command and the NG/G buttons. --- courtroom.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 2555e64d..6e855f36 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2255,6 +2255,8 @@ void Courtroom::on_ooc_return_pressed() { ui_witness_testimony->show(); ui_cross_examination->show(); + ui_guilty->show(); + ui_not_guilty->show(); ui_defense_minus->show(); ui_defense_plus->show(); ui_prosecution_minus->show(); @@ -2264,6 +2266,8 @@ void Courtroom::on_ooc_return_pressed() { ui_witness_testimony->hide(); ui_cross_examination->hide(); + ui_guilty->hide(); + ui_not_guilty->hide(); ui_defense_minus->hide(); ui_defense_plus->hide(); ui_prosecution_minus->hide(); -- cgit From eee682bf0d603b0afe9dc2e41bf971669cea225d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 17 Aug 2018 01:34:22 +0200 Subject: Fixed an issue with the audio output change not registering. --- courtroom.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 6e855f36..3dd0c4fc 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -20,8 +20,24 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ao_app = p_ao_app; //initializing sound device - BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL); - BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + + + // Change the default audio output device to be the one the user has given + // in his config.ini file for now. + int a = 0; + BASS_DEVICEINFO info; + + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) + { + if (ao_app->get_audio_output_device() == info.name) + { + BASS_SetDevice(a); + BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL); + BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + qDebug() << info.name << "was set as the default audio output device."; + break; + } + } keepalive_timer = new QTimer(this); keepalive_timer->start(60000); -- cgit From b9f1998c93067d29e5b2cea4d30d95229c27a810 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sun, 19 Aug 2018 08:03:14 +0200 Subject: Minor fix: the default showname is now correctly the name of the character. --- courtroom.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 3dd0c4fc..5800f583 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -811,6 +811,7 @@ void Courtroom::enter_courtroom(int p_cid) //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); ui_char_select_background->hide(); + ui_ic_chat_name->setPlaceholderText(ao_app->get_showname(f_char)); ui_ic_chat_message->setEnabled(m_cid != -1); ui_ic_chat_message->setFocus(); -- cgit From 95b8bd72d3aa870c829fb3176a66cc1976a1762d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sun, 19 Aug 2018 09:17:48 +0200 Subject: Ability to toggle Discord RPC. Reimplementation of `bed0b55e70f13adf772584fc0d31ebfe59597115` from old origin. --- courtroom.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 5800f583..f8c7c8a7 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -731,13 +731,16 @@ void Courtroom::enter_courtroom(int p_cid) if (m_cid == -1) { - ao_app->discord->state_spectate(); + 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); - 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; -- cgit From d314b8dd07f72d94724c3902258dfb2641d3435c Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sun, 19 Aug 2018 09:37:34 +0200 Subject: Moved includes out of the CPP files into the header files. Reimplementation of `30a87d23c9c63bed072b3460e7482075dc530b2c` from the old origin. --- courtroom.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index f8c7c8a7..dce4186e 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -7,14 +7,6 @@ #include "datatypes.h" #include "debug_functions.h" -#include -#include -#include -#include -#include -#include -#include - Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { ao_app = p_ao_app; -- cgit From 91ad46eea043673b188f5b5d4be49d66e0b7ba0d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 24 Aug 2018 15:51:28 +0200 Subject: Fixed a Windows bug where there was no way to get back to the default audio device. --- courtroom.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index dce4186e..3b9930b8 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -19,15 +19,23 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() int a = 0; BASS_DEVICEINFO info; - for (a = 0; BASS_GetDeviceInfo(a, &info); a++) + if (ao_app->get_audio_output_device() == "Default") { - if (ao_app->get_audio_output_device() == info.name) + BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL); + BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + } + else + { + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) { - BASS_SetDevice(a); - BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL); - BASS_PluginLoad("bassopus.dll", BASS_UNICODE); - qDebug() << info.name << "was set as the default audio output device."; - break; + if (ao_app->get_audio_output_device() == info.name) + { + BASS_SetDevice(a); + BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL); + BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + qDebug() << info.name << "was set as the default audio output device."; + break; + } } } -- cgit From 739142f8ddd194b7f4ed42fe813979655d04262a Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 3 Sep 2018 03:52:16 +0200 Subject: Dual characters on screen Part I The basics have been laid out. - Communication about the second character established. - Pairing sytem made. - Placement system of the second character implemented. Needs: - More testing. - A workable UI. - Fix for zooms. --- courtroom.cpp | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 176 insertions(+), 4 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 3b9930b8..c02f94e4 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -80,6 +80,8 @@ 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_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); + ui_vp_sideplayer_char->hide(); ui_vp_desk = new AOScene(ui_viewport, ao_app); ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app); @@ -379,6 +381,9 @@ void Courtroom::set_widgets() ui_vp_player_char->move(0, 0); ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height()); + ui_vp_sideplayer_char->move(0, 0); + ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height()); + //the AO2 desk element ui_vp_desk->move(0, 0); ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height()); @@ -891,6 +896,12 @@ void Courtroom::on_chat_return_pressed() //realization# //text_color#% + // Additionally, in our case: + + //showname# + //other_charid# + //self_offset#% + QStringList packet_contents; QString f_side = ao_app->get_char_side(current_char); @@ -997,6 +1008,19 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(ui_ic_chat_name->text()); } + // If there is someone this user would like to appear with. + if (other_charid > -1) + { + // First, we'll add a filler in case we haven't set an IC showname. + if (ui_ic_chat_name->text().isEmpty()) + { + packet_contents.append(""); + } + + packet_contents.append(QString::number(other_charid)); + packet_contents.append(QString::number(offset_with_pair)); + } + ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1184,6 +1208,125 @@ void Courtroom::handle_chatmessage_2() else ui_vp_player_char->set_flipped(false); + QString side = m_chatmessage[SIDE]; + + // Making the second character appear. + if (m_chatmessage[OTHER_CHARID].isEmpty()) + { + // If there is no second character, hide 'em, and center the first. + ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->move(0,0); + + ui_vp_player_char->move(0,0); + } + else + { + bool ok; + int got_other_charid = m_chatmessage[OTHER_CHARID].toInt(&ok); + if (ok) + { + if (got_other_charid > -1) + { + // If there is, show them! + ui_vp_sideplayer_char->show(); + + // Depending on where we are, we offset the characters, and reorder their stacking. + if (side == "def") + { + // We also move the character down depending on how far the are to the right. + int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); + int vert_offset = 0; + if (hor_offset > 0) + { + vert_offset = hor_offset / 20; + } + ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100); + + // We do the same with the second character. + int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); + int vert2_offset = 0; + if (hor2_offset > 0) + { + vert2_offset = hor2_offset / 20; + } + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); + + // Finally, we reorder them based on who is more to the left. + // The person more to the left is more in the front. + if (hor2_offset >= hor_offset) + { + ui_vp_sideplayer_char->raise(); + ui_vp_player_char->raise(); + } + else + { + ui_vp_player_char->raise(); + ui_vp_sideplayer_char->raise(); + } + ui_vp_desk->raise(); + ui_vp_legacy_desk->raise(); + } + else if (side == "pro") + { + // Almost the same thing happens here, but in reverse. + int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); + int vert_offset = 0; + if (hor_offset < 0) + { + // We don't want to RAISE the char off the floor. + vert_offset = -1 * hor_offset / 20; + } + ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100); + + // We do the same with the second character. + int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); + int vert2_offset = 0; + if (hor2_offset < 0) + { + vert2_offset = -1 * hor2_offset / 20; + } + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset, ui_viewport->height() * vert2_offset); + + // Finally, we reorder them based on who is more to the right. + if (hor2_offset <= hor_offset) + { + ui_vp_sideplayer_char->raise(); + ui_vp_player_char->raise(); + } + else + { + ui_vp_player_char->raise(); + ui_vp_sideplayer_char->raise(); + } + ui_vp_desk->raise(); + ui_vp_legacy_desk->raise(); + } + else + { + // In every other case, the talker is on top. + ui_vp_sideplayer_char->raise(); + ui_vp_player_char->raise(); + ui_vp_desk->raise(); + ui_vp_legacy_desk->raise(); + } + // We should probably also play the other character's idle emote. + if (ao_app->flipping_enabled && m_chatmessage[OTHER_FLIP].toInt() == 1) + ui_vp_sideplayer_char->set_flipped(true); + else + ui_vp_sideplayer_char->set_flipped(false); + ui_vp_sideplayer_char->play_idle(char_list.at(got_other_charid).name, m_chatmessage[OTHER_EMOTE]); + } + else + { + // 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->move(0,0); + + ui_vp_player_char->move(0,0); + } + } + } switch (emote_mod) { @@ -1216,10 +1359,11 @@ void Courtroom::handle_chatmessage_3() int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); + QString side = m_chatmessage[SIDE]; + if (emote_mod == 5 || emote_mod == 6) { - QString side = m_chatmessage[SIDE]; ui_vp_desk->hide(); ui_vp_legacy_desk->hide(); @@ -2305,9 +2449,37 @@ void Courtroom::on_ooc_return_pressed() } else if (ooc_message.startsWith("/settings")) { - ui_ooc_chat_message->clear(); - ao_app->call_settings_menu(); - return; + ui_ooc_chat_message->clear(); + ao_app->call_settings_menu(); + return; + } + else if (ooc_message.startsWith("/pair")) + { + ui_ooc_chat_message->clear(); + ooc_message.remove(0,6); + + bool ok; + int whom = ooc_message.toInt(&ok); + if (ok) + { + if (whom > -1) + other_charid = whom; + } + return; + } + else if (ooc_message.startsWith("/offset")) + { + ui_ooc_chat_message->clear(); + ooc_message.remove(0,8); + + bool ok; + int off = ooc_message.toInt(&ok); + if (ok) + { + if (off >= -100 && off <= 100) + offset_with_pair = off; + } + return; } QStringList packet_contents; -- cgit From 22e0cb8e1a97e57a6235c23afc6508f5e441aefc Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 3 Sep 2018 12:55:57 +0200 Subject: Dual characters on screen Part 2. - UI option to change pairup. - Fixed a bug on the prosecution side. - Dual characters now allow for iniswapped characters. - Zooming now doesn't stay on the field, instead, the game defaults to the last emote. --- courtroom.cpp | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 121 insertions(+), 15 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index c02f94e4..dd03212b 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -119,6 +119,12 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() //ui_area_list = new QListWidget(this); ui_music_list = new QListWidget(this); + ui_pair_list = new QListWidget(this); + ui_pair_offset_spinbox = new QSpinBox(this); + ui_pair_offset_spinbox->setRange(-100,100); + ui_pair_offset_spinbox->setSuffix("% offset"); + ui_pair_button = new AOButton(this, ao_app); + ui_ic_chat_name = new QLineEdit(this); ui_ic_chat_name->setFrame(false); ui_ic_chat_name->setPlaceholderText("Showname"); @@ -310,6 +316,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked())); + connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked())); + connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex))); + connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int))); + connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); set_widgets(); @@ -341,6 +351,21 @@ void Courtroom::set_mute_list() } } +void Courtroom::set_pair_list() +{ + QStringList sorted_pair_list; + + for (char_type i_char : char_list) + sorted_pair_list.append(i_char.name); + + sorted_pair_list.sort(); + + for (QString i_name : sorted_pair_list) + { + ui_pair_list->addItem(i_name); + } +} + void Courtroom::set_widgets() { blip_rate = ao_app->read_blip_rate(); @@ -430,6 +455,13 @@ void Courtroom::set_widgets() set_size_and_pos(ui_mute_list, "mute_list"); ui_mute_list->hide(); + set_size_and_pos(ui_pair_list, "pair_list"); + ui_pair_list->hide(); + set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); + ui_pair_offset_spinbox->hide(); + set_size_and_pos(ui_pair_button, "pair_button"); + ui_pair_button->set_image("pair_button.png"); + //set_size_and_pos(ui_area_list, "area_list"); //ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); @@ -697,6 +729,7 @@ void Courtroom::done_received() set_char_select_page(); set_mute_list(); + set_pair_list(); set_char_select(); @@ -1009,7 +1042,8 @@ void Courtroom::on_chat_return_pressed() } // If there is someone this user would like to appear with. - if (other_charid > -1) + // And said someone is not ourselves! + if (other_charid > -1 && other_charid != m_cid) { // First, we'll add a filler in case we haven't set an IC showname. if (ui_ic_chat_name->text().isEmpty()) @@ -1285,7 +1319,7 @@ void Courtroom::handle_chatmessage_2() { vert2_offset = -1 * hor2_offset / 20; } - ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset, ui_viewport->height() * vert2_offset); + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); // Finally, we reorder them based on who is more to the right. if (hor2_offset <= hor_offset) @@ -1303,9 +1337,28 @@ void Courtroom::handle_chatmessage_2() } else { - // In every other case, the talker is on top. - ui_vp_sideplayer_char->raise(); - ui_vp_player_char->raise(); + // In every other case, the person more to the left is on top. + // With one exception, hlp. + // These cases also don't move the characters down. + int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); + ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, 0); + + // We do the same with the second character. + int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, 0); + + // Finally, we reorder them based on who is more to the left. + // The person more to the left is more in the front. + if (hor2_offset >= hor_offset) + { + ui_vp_sideplayer_char->raise(); + ui_vp_player_char->raise(); + } + else + { + ui_vp_player_char->raise(); + ui_vp_sideplayer_char->raise(); + } ui_vp_desk->raise(); ui_vp_legacy_desk->raise(); } @@ -1314,7 +1367,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->play_idle(char_list.at(got_other_charid).name, m_chatmessage[OTHER_EMOTE]); + ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE]); } else { @@ -1366,6 +1419,7 @@ void Courtroom::handle_chatmessage_3() { ui_vp_desk->hide(); ui_vp_legacy_desk->hide(); + ui_vp_sideplayer_char->hide(); // Hide the second character if we're zooming! if (side == "pro" || side == "hlp" || @@ -2599,25 +2653,51 @@ void Courtroom::on_mute_list_clicked(QModelIndex p_index) mute_map.insert(f_cid, true); f_item->setText(real_char + " [x]"); } +} +void Courtroom::on_pair_list_clicked(QModelIndex p_index) +{ + QListWidgetItem *f_item = ui_pair_list->item(p_index.row()); + QString f_char = f_item->text(); + QString real_char; - - /* if (f_char.endsWith(" [x]")) { real_char = f_char.left(f_char.size() - 4); - mute_map.remove(real_char); - mute_map.insert(real_char, false); f_item->setText(real_char); } else - { real_char = f_char; - mute_map.remove(real_char); - mute_map.insert(real_char, true); - f_item->setText(real_char + " [x]"); + + int f_cid = -1; + + for (int n_char = 0 ; n_char < char_list.size() ; n_char++) + { + if (char_list.at(n_char).name == real_char) + f_cid = n_char; + } + + if (f_cid < 0 || f_cid >= char_list.size()) + { + qDebug() << "W: " << real_char << " not present in char_list"; + return; } - */ + + other_charid = f_cid; + + // Redo the character list. + QStringList sorted_pair_list; + + for (char_type i_char : char_list) + sorted_pair_list.append(i_char.name); + + sorted_pair_list.sort(); + + for (int i = 0; i < ui_pair_list->count(); i++) { + ui_pair_list->item(i)->setText(sorted_pair_list.at(i)); + } + + f_item->setText(real_char + " [x]"); } void Courtroom::on_music_list_double_clicked(QModelIndex p_model) @@ -2738,6 +2818,9 @@ void Courtroom::on_mute_clicked() if (ui_mute_list->isHidden()) { ui_mute_list->show(); + ui_pair_list->hide(); + ui_pair_offset_spinbox->hide(); + ui_pair_button->set_image("pair_button.png"); ui_mute->set_image("mute_pressed.png"); } else @@ -2747,6 +2830,24 @@ void Courtroom::on_mute_clicked() } } +void Courtroom::on_pair_clicked() +{ + if (ui_pair_list->isHidden()) + { + ui_pair_list->show(); + ui_pair_offset_spinbox->show(); + ui_mute_list->hide(); + ui_mute->set_image("mute.png"); + ui_pair_button->set_image("pair_button_pressed.png"); + } + else + { + ui_pair_list->hide(); + ui_pair_offset_spinbox->hide(); + ui_pair_button->set_image("pair_button.png"); + } +} + void Courtroom::on_defense_minus_clicked() { int f_state = defense_bar_state - 1; @@ -2809,6 +2910,11 @@ void Courtroom::on_log_limit_changed(int value) log_maximum_blocks = value; } +void Courtroom::on_pair_offset_changed(int value) +{ + offset_with_pair = value; +} + void Courtroom::on_witness_testimony_clicked() { if (is_muted) -- cgit From e45e138fb5c8856e3047b5c60c957782a90f5598 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 3 Sep 2018 13:03:02 +0200 Subject: 'Call mod' button can now send argumentless modcalls again. This stopped the client from being able to call a mod in vanilla servers before. --- courtroom.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index dd03212b..15d50254 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -3017,7 +3017,10 @@ void Courtroom::on_call_mod_clicked() if (ok) { text = text.left(100); - ao_app->send_server_packet(new AOPacket("ZZ#" + text + "#%")); + if (!text.isEmpty()) + ao_app->send_server_packet(new AOPacket("ZZ#" + text + "#%")); + else + ao_app->send_server_packet(new AOPacket("ZZ#%")); } ui_ic_chat_message->setFocus(); -- cgit From becf58dd4f9432364a64dc7af006b3938245127b Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 3 Sep 2018 15:55:34 +0200 Subject: Area list added. - Accessible with the ingame A/M button, or by `/switch_am`. - The music list now only lists music. - The area list lists the areas. - It describes general area properties (playercount, status, CM, locked). - Automatically updates as these change. - Clicking on an area behaves the same way as clicking on an area in the music list previously did. --- courtroom.cpp | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 3 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 15d50254..28540deb 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -116,7 +116,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_server_chatlog->setOpenExternalLinks(true); ui_mute_list = new QListWidget(this); - //ui_area_list = new QListWidget(this); + ui_area_list = new QListWidget(this); + ui_area_list->hide(); ui_music_list = new QListWidget(this); ui_pair_list = new QListWidget(this); @@ -188,6 +189,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_reload_theme = new AOButton(this, ao_app); ui_call_mod = new AOButton(this, ao_app); ui_settings = new AOButton(this, ao_app); + ui_switch_area_music = new AOButton(this, ao_app); ui_pre = new QCheckBox(this); ui_pre->setText("Pre"); @@ -273,6 +275,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed())); connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_music_list_double_clicked(QModelIndex))); + connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_area_list_double_clicked(QModelIndex))); connect(ui_hold_it, SIGNAL(clicked()), this, SLOT(on_hold_it_clicked())); connect(ui_objection, SIGNAL(clicked()), this, SLOT(on_objection_clicked())); @@ -309,6 +312,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked())); connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked())); connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); + connect(ui_switch_area_music, SIGNAL(clicked()), this, SLOT(on_switch_area_music_clicked())); connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); @@ -462,8 +466,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_pair_button, "pair_button"); ui_pair_button->set_image("pair_button.png"); - //set_size_and_pos(ui_area_list, "area_list"); - //ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + set_size_and_pos(ui_area_list, "music_list"); + ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); set_size_and_pos(ui_music_list, "music_list"); @@ -557,6 +561,9 @@ void Courtroom::set_widgets() set_size_and_pos(ui_settings, "settings"); ui_settings->setText("Settings"); + set_size_and_pos(ui_switch_area_music, "switch_area_music"); + ui_switch_area_music->setText("A/M"); + set_size_and_pos(ui_pre, "pre"); ui_pre->setText("Pre"); @@ -656,6 +663,7 @@ void Courtroom::set_fonts() set_font(ui_ms_chatlog, "ms_chatlog"); set_font(ui_server_chatlog, "server_chatlog"); set_font(ui_music_list, "music_list"); + set_font(ui_area_list, "music_list"); } void Courtroom::set_font(QWidget *widget, QString p_identifier) @@ -839,6 +847,7 @@ void Courtroom::enter_courtroom(int p_cid) ui_flip->hide(); list_music(); + list_areas(); music_player->set_volume(ui_music_slider->value()); sfx_player->set_volume(ui_sfx_slider->value()); @@ -893,6 +902,71 @@ void Courtroom::list_music() } } +void Courtroom::list_areas() +{ + ui_area_list->clear(); + area_row_to_number.clear(); + + QString f_file = "courtroom_design.ini"; + + QBrush free_brush(ao_app->get_color("area_free_color", f_file)); + QBrush lfp_brush(ao_app->get_color("area_lfp_color", f_file)); + QBrush casing_brush(ao_app->get_color("area_casing_color", f_file)); + QBrush recess_brush(ao_app->get_color("area_recess_color", f_file)); + QBrush rp_brush(ao_app->get_color("area_rp_color", f_file)); + QBrush gaming_brush(ao_app->get_color("area_gaming_color", f_file)); + QBrush locked_brush(ao_app->get_color("area_locked_color", f_file)); + + int n_listed_areas = 0; + + for (int n_area = 0 ; n_area < area_list.size() ; ++n_area) + { + QString i_area = area_list.at(n_area); + i_area.append("\n "); + + i_area.append(arup_statuses.at(n_area)); + i_area.append(" | CM: "); + i_area.append(arup_cms.at(n_area)); + + i_area.append("\n "); + + i_area.append(QString::number(arup_players.at(n_area))); + i_area.append(" users | "); + if (arup_locks.at(n_area) == true) + i_area.append("LOCKED"); + else + i_area.append("OPEN"); + + if (i_area.toLower().contains(ui_music_search->text().toLower())) + { + ui_area_list->addItem(i_area); + area_row_to_number.append(n_area); + + // Colouring logic here. + ui_area_list->item(n_listed_areas)->setBackground(free_brush); + if (arup_locks.at(n_area)) + { + ui_area_list->item(n_listed_areas)->setBackground(locked_brush); + } + else + { + if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") + ui_area_list->item(n_listed_areas)->setBackground(lfp_brush); + else if (arup_statuses.at(n_area) == "CASING") + ui_area_list->item(n_listed_areas)->setBackground(casing_brush); + else if (arup_statuses.at(n_area) == "RECESS") + ui_area_list->item(n_listed_areas)->setBackground(recess_brush); + else if (arup_statuses.at(n_area) == "RP") + ui_area_list->item(n_listed_areas)->setBackground(rp_brush); + else if (arup_statuses.at(n_area) == "GAMING") + ui_area_list->item(n_listed_areas)->setBackground(gaming_brush); + } + + ++n_listed_areas; + } + } +} + void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) { ui_ms_chatlog->append_chatmessage(f_name, f_message); @@ -2535,6 +2609,11 @@ void Courtroom::on_ooc_return_pressed() } return; } + else if (ooc_message.startsWith("/switch_am")) + { + on_switch_area_music_clicked(); + return; + } QStringList packet_contents; packet_contents.append(ui_ooc_chat_name->text()); @@ -2577,6 +2656,7 @@ void Courtroom::on_music_search_edited(QString p_text) //preventing compiler warnings p_text += "a"; list_music(); + list_areas(); } void Courtroom::on_pos_dropdown_changed(int p_index) @@ -2717,6 +2797,12 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model) } } +void Courtroom::on_area_list_double_clicked(QModelIndex p_model) +{ + QString p_area = area_list.at(area_row_to_number.at(p_model.row())); + ao_app->send_server_packet(new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"), false); +} + void Courtroom::on_hold_it_clicked() { if (objection_state == 1) @@ -3064,6 +3150,20 @@ void Courtroom::on_evidence_button_clicked() } } +void Courtroom::on_switch_area_music_clicked() +{ + if (ui_area_list->isHidden()) + { + ui_area_list->show(); + ui_music_list->hide(); + } + else + { + ui_area_list->hide(); + ui_music_list->show(); + } +} + void Courtroom::ping_server() { ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%")); -- cgit From fe955d692350cd3bac192721c09d8fdd445afc5d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 4 Sep 2018 17:32:20 +0200 Subject: Removed the dependency on `bass.dll`. This is merely a reimplementation of Gameboyprinter's changes on the main thing. The only thing that's different from that one is that the options menu has had its audio device removed, too. --- courtroom.cpp | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 28540deb..64afd4d9 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -11,34 +11,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { ao_app = p_ao_app; - //initializing sound device - - - // Change the default audio output device to be the one the user has given - // in his config.ini file for now. - int a = 0; - BASS_DEVICEINFO info; - - if (ao_app->get_audio_output_device() == "Default") - { - BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL); - BASS_PluginLoad("bassopus.dll", BASS_UNICODE); - } - else - { - for (a = 0; BASS_GetDeviceInfo(a, &info); a++) - { - if (ao_app->get_audio_output_device() == info.name) - { - BASS_SetDevice(a); - BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL); - BASS_PluginLoad("bassopus.dll", BASS_UNICODE); - qDebug() << info.name << "was set as the default audio output device."; - break; - } - } - } - keepalive_timer = new QTimer(this); keepalive_timer->start(60000); -- cgit From 0ef34d6354712558dd06e36693bd10009b2ab81d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 4 Sep 2018 20:20:11 +0200 Subject: Fixed the zoom and the `hld` pos with double characters. --- courtroom.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 64afd4d9..844de292 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1384,7 +1384,6 @@ void Courtroom::handle_chatmessage_2() else { // In every other case, the person more to the left is on top. - // With one exception, hlp. // These cases also don't move the characters down. int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, 0); @@ -1395,7 +1394,8 @@ void Courtroom::handle_chatmessage_2() // Finally, we reorder them based on who is more to the left. // The person more to the left is more in the front. - if (hor2_offset >= hor_offset) + if (((hor2_offset >= hor_offset) && !(side == "hld")) || + ((hor2_offset <= hor_offset) && (side == "hld"))) { ui_vp_sideplayer_char->raise(); ui_vp_player_char->raise(); @@ -1465,7 +1465,10 @@ void Courtroom::handle_chatmessage_3() { ui_vp_desk->hide(); ui_vp_legacy_desk->hide(); - ui_vp_sideplayer_char->hide(); // Hide the second character if we're zooming! + + // Since we're zooming, hide the second character, and centre the first. + ui_vp_sideplayer_char->hide(); + ui_vp_player_char->move(0,0); if (side == "pro" || side == "hlp" || -- cgit From ecade0dc13465059c93932fe863aa1e3f1f7e16c Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 4 Sep 2018 20:36:11 +0200 Subject: Removed the specific check on `hld` in pairs. Perhaps a better solution may present itself later. --- courtroom.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 844de292..7fa25df9 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1394,8 +1394,7 @@ void Courtroom::handle_chatmessage_2() // Finally, we reorder them based on who is more to the left. // The person more to the left is more in the front. - if (((hor2_offset >= hor_offset) && !(side == "hld")) || - ((hor2_offset <= hor_offset) && (side == "hld"))) + if (hor2_offset >= hor_offset) { ui_vp_sideplayer_char->raise(); ui_vp_player_char->raise(); -- cgit From 4f30afa51d84be5ea16911b7e4fbd545a87e24b3 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 4 Sep 2018 21:19:10 +0200 Subject: The server now announces what features it has. I'm not sure why I did this. --- courtroom.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 26 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 7fa25df9..c4d90748 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -437,6 +437,16 @@ void Courtroom::set_widgets() ui_pair_offset_spinbox->hide(); set_size_and_pos(ui_pair_button, "pair_button"); ui_pair_button->set_image("pair_button.png"); + if (ao_app->charpairs_enabled) + { + ui_pair_button->setEnabled(true); + ui_pair_button->show(); + } + else + { + ui_pair_button->setEnabled(false); + ui_pair_button->hide(); + } set_size_and_pos(ui_area_list, "music_list"); ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); @@ -833,7 +843,16 @@ void Courtroom::enter_courtroom(int p_cid) //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); ui_char_select_background->hide(); - ui_ic_chat_name->setPlaceholderText(ao_app->get_showname(f_char)); + if (ao_app->shownames_enabled) + { + ui_ic_chat_name->setPlaceholderText(ao_app->get_showname(f_char)); + ui_ic_chat_name->setEnabled(true); + } + else + { + ui_ic_chat_name->setPlaceholderText("---"); + ui_ic_chat_name->setEnabled(false); + } ui_ic_chat_message->setEnabled(m_cid != -1); ui_ic_chat_message->setFocus(); @@ -894,44 +913,56 @@ void Courtroom::list_areas() for (int n_area = 0 ; n_area < area_list.size() ; ++n_area) { QString i_area = area_list.at(n_area); - i_area.append("\n "); - i_area.append(arup_statuses.at(n_area)); - i_area.append(" | CM: "); - i_area.append(arup_cms.at(n_area)); + if (ao_app->arup_enabled) + { + i_area.append("\n "); - i_area.append("\n "); + i_area.append(arup_statuses.at(n_area)); + i_area.append(" | CM: "); + i_area.append(arup_cms.at(n_area)); - i_area.append(QString::number(arup_players.at(n_area))); - i_area.append(" users | "); - if (arup_locks.at(n_area) == true) - i_area.append("LOCKED"); - else - i_area.append("OPEN"); + i_area.append("\n "); + + i_area.append(QString::number(arup_players.at(n_area))); + i_area.append(" users | "); + + if (arup_locks.at(n_area) == true) + i_area.append("LOCKED"); + else + i_area.append("OPEN"); + } if (i_area.toLower().contains(ui_music_search->text().toLower())) { ui_area_list->addItem(i_area); area_row_to_number.append(n_area); - // Colouring logic here. - ui_area_list->item(n_listed_areas)->setBackground(free_brush); - if (arup_locks.at(n_area)) + if (ao_app->arup_enabled) { - ui_area_list->item(n_listed_areas)->setBackground(locked_brush); + // Colouring logic here. + ui_area_list->item(n_listed_areas)->setBackground(free_brush); + if (arup_locks.at(n_area)) + { + ui_area_list->item(n_listed_areas)->setBackground(locked_brush); + } + else + { + if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") + ui_area_list->item(n_listed_areas)->setBackground(lfp_brush); + else if (arup_statuses.at(n_area) == "CASING") + ui_area_list->item(n_listed_areas)->setBackground(casing_brush); + else if (arup_statuses.at(n_area) == "RECESS") + ui_area_list->item(n_listed_areas)->setBackground(recess_brush); + else if (arup_statuses.at(n_area) == "RP") + ui_area_list->item(n_listed_areas)->setBackground(rp_brush); + else if (arup_statuses.at(n_area) == "GAMING") + ui_area_list->item(n_listed_areas)->setBackground(gaming_brush); + } } else { - if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") - ui_area_list->item(n_listed_areas)->setBackground(lfp_brush); - else if (arup_statuses.at(n_area) == "CASING") - ui_area_list->item(n_listed_areas)->setBackground(casing_brush); - else if (arup_statuses.at(n_area) == "RECESS") - ui_area_list->item(n_listed_areas)->setBackground(recess_brush); - else if (arup_statuses.at(n_area) == "RP") - ui_area_list->item(n_listed_areas)->setBackground(rp_brush); - else if (arup_statuses.at(n_area) == "GAMING") - ui_area_list->item(n_listed_areas)->setBackground(gaming_brush); + ui_area_list->item(n_listed_areas)->setBackground(free_brush); } ++n_listed_areas; @@ -3070,6 +3101,13 @@ void Courtroom::on_spectator_clicked() void Courtroom::on_call_mod_clicked() { + if (!ao_app->modcall_reason_enabled) + { + ao_app->send_server_packet(new AOPacket("ZZ#%")); + ui_ic_chat_message->setFocus(); + return; + } + bool ok; QString text = QInputDialog::getText(ui_viewport, "Call a mod", "Reason for the modcall (optional):", QLineEdit::Normal, -- cgit From adfe21afd6e5f4efc9c60b45590f4c086b9e0e52 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 4 Sep 2018 22:45:07 +0200 Subject: Added `jur` and `sea` positions. --- courtroom.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index c4d90748..6df5f9fb 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -137,6 +137,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pos_dropdown->addItem("jud"); ui_pos_dropdown->addItem("hld"); ui_pos_dropdown->addItem("hlp"); + ui_pos_dropdown->addItem("jur"); + ui_pos_dropdown->addItem("sea"); ui_defense_bar = new AOImage(this, ao_app); ui_prosecution_bar = new AOImage(this, ao_app); @@ -1482,7 +1484,7 @@ void Courtroom::handle_chatmessage_3() //shifted by 1 because 0 is no evidence per legacy standards QString f_image = local_evidence_list.at(f_evi_id - 1).image; //def jud and hlp should display the evidence icon on the RIGHT side - bool is_left_side = !(f_side == "def" || f_side == "hlp" || f_side == "jud"); + bool is_left_side = !(f_side == "def" || f_side == "hlp" || f_side == "jud" || f_side == "jur"); ui_vp_evidence_display->show_evidence(f_image, is_left_side, ui_sfx_slider->value()); } @@ -2321,6 +2323,16 @@ void Courtroom::set_scene() f_background = "prohelperstand"; f_desk_image = "prohelperdesk"; } + else if (f_side == "jur") + { + f_background = "jurystand"; + f_desk_image = "jurydesk"; + } + else if (f_side == "sea") + { + f_background = "seancestand"; + f_desk_image = "seancedesk"; + } else { if (is_ao2_bg) -- cgit From 12727fcf7f0684f916290113da4a76c331fadce9 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 5 Sep 2018 02:07:23 +0200 Subject: `misc` folder given purpose as the 'default' for shouts and chatboxes. - Default bubbles. - Default shout sounds. - Custom chatbox. - Custom colours for the chatbox. - No need to have duplicate files of bubbles and shouts all over the character folders. --- courtroom.cpp | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 6df5f9fb..bf3d2d24 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1228,20 +1228,20 @@ 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); + objection_player->play("holdit.wav", f_char, f_custom_theme); break; case 2: ui_vp_objection->play("objection", f_char, f_custom_theme); - objection_player->play("objection.wav", f_char); + objection_player->play("objection.wav", f_char, f_custom_theme); break; case 3: ui_vp_objection->play("takethat", f_char, f_custom_theme); - objection_player->play("takethat.wav", f_char); + objection_player->play("takethat.wav", f_char, f_custom_theme); break; //case 4 is AO2 only case 4: ui_vp_objection->play("custom", f_char, f_custom_theme); - objection_player->play("custom.wav", f_char); + objection_player->play("custom.wav", f_char, f_custom_theme); break; default: qDebug() << "W: Logic error in objection switch statement!"; @@ -1288,7 +1288,7 @@ void Courtroom::handle_chatmessage_2() ui_vp_chatbox->set_image("chatmed.png"); else { - QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + ".png"; + QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png"; ui_vp_chatbox->set_image_from_path(chatbox_path); } @@ -2377,7 +2377,23 @@ void Courtroom::set_scene() void Courtroom::set_text_color() { - switch (m_chatmessage[TEXT_COLOR].toInt()) + QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME])); + + ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0)); + ui_vp_message->setTextColor(textcolor); + + QString style = "background-color: rgba(0, 0, 0, 0);"; + style.append("color: rgb("); + style.append(QString::number(textcolor.red())); + style.append(", "); + style.append(QString::number(textcolor.green())); + style.append(", "); + style.append(QString::number(textcolor.blue())); + style.append(")"); + + ui_vp_message->setStyleSheet(style); + + /*switch (m_chatmessage[TEXT_COLOR].toInt()) { case GREEN: ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" @@ -2414,7 +2430,7 @@ void Courtroom::set_text_color() ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white"); - } + }*/ } void Courtroom::set_ip_list(QString p_list) @@ -2629,8 +2645,19 @@ void Courtroom::on_ooc_return_pressed() else if (ooc_message.startsWith("/switch_am")) { on_switch_area_music_clicked(); + ui_ooc_chat_message->clear(); return; } + else if (ooc_message.startsWith("/enable_blocks")) + { + ao_app->shownames_enabled = true; + ao_app->charpairs_enabled = true; + ao_app->arup_enabled = true; + ao_app->modcall_reason_enabled = true; + on_reload_theme_clicked(); + ui_ooc_chat_message->clear(); + return; + } QStringList packet_contents; packet_contents.append(ui_ooc_chat_name->text()); -- cgit From 78c339869d64295da3d6aef5577a16f7fdc49b78 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 5 Sep 2018 02:25:04 +0200 Subject: Inline text now also obey `misc` rules. --- courtroom.cpp | 68 +++++++++++++++-------------------------------------------- 1 file changed, 17 insertions(+), 51 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index bf3d2d24..435dcd34 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2010,19 +2010,19 @@ void Courtroom::chat_tick() switch (rainbow_counter) { case 0: - html_color = "#FF0000"; + html_color = get_text_color(QString::number(RED)).name(); break; case 1: - html_color = "#FF7F00"; + html_color = get_text_color(QString::number(ORANGE)).name(); break; case 2: - html_color = "#FFFF00"; + html_color = get_text_color(QString::number(YELLOW)).name(); break; case 3: - html_color = "#00FF00"; + html_color = get_text_color(QString::number(GREEN)).name(); break; default: - html_color = "#2d96ff"; + html_color = get_text_color(QString::number(BLUE)).name(); rainbow_counter = -1; } @@ -2076,7 +2076,7 @@ void Courtroom::chat_tick() else if (f_character == "(" and !next_character_is_not_special) { inline_colour_stack.push(INLINE_BLUE); - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + f_character + ""); // Increase how deep we are in inline blues. inline_blue_depth++; @@ -2096,7 +2096,7 @@ void Courtroom::chat_tick() if (inline_colour_stack.top() == INLINE_BLUE) { inline_colour_stack.pop(); - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + f_character + ""); // Decrease how deep we are in inline blues. // Just in case, we do a check if we're above zero, but we should be. @@ -2127,7 +2127,7 @@ void Courtroom::chat_tick() else if (f_character == "[" and !next_character_is_not_special) { inline_colour_stack.push(INLINE_GREY); - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + f_character + ""); } else if (f_character == "]" and !next_character_is_not_special and !inline_colour_stack.empty()) @@ -2135,7 +2135,7 @@ void Courtroom::chat_tick() if (inline_colour_stack.top() == INLINE_GREY) { inline_colour_stack.pop(); - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + f_character + ""); } else { @@ -2174,16 +2174,16 @@ void Courtroom::chat_tick() { switch (inline_colour_stack.top()) { case INLINE_ORANGE: - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + f_character + ""); break; case INLINE_BLUE: - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + f_character + ""); break; case INLINE_GREEN: - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + f_character + ""); break; case INLINE_GREY: - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + f_character + ""); break; default: ui_vp_message->insertHtml(f_character); @@ -2392,45 +2392,11 @@ void Courtroom::set_text_color() style.append(")"); ui_vp_message->setStyleSheet(style); +} - /*switch (m_chatmessage[TEXT_COLOR].toInt()) - { - case GREEN: - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: rgb(0, 255, 0)"); - break; - case RED: - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: red"); - break; - case ORANGE: - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: orange"); - break; - case BLUE: - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: rgb(45, 150, 255)"); - break; - case YELLOW: - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: yellow"); - break; - case PINK: - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: pink"); - break; - case CYAN: - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: cyan"); - break; - default: - qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; - // fall through - case WHITE: - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: white"); - - }*/ +QColor Courtroom::get_text_color(QString color) +{ + return ao_app->get_chat_color(color, ao_app->get_chat(m_chatmessage[CHAR_NAME])); } void Courtroom::set_ip_list(QString p_list) -- cgit From 93cd2ad3747ff609e0aa2175a2622afe9ef6b56d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 5 Sep 2018 17:21:27 +0200 Subject: Non-interrupting pres. --- courtroom.cpp | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 122 insertions(+), 10 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 435dcd34..dd6c1601 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -178,6 +178,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); ui_showname_enable->setText("Custom shownames"); + ui_pre_non_interrupt = new QCheckBox(this); + ui_pre_non_interrupt->setText("No Intrpt"); + ui_custom_objection = new AOButton(this, ao_app); ui_realization = new AOButton(this, ao_app); ui_mute = new AOButton(this, ao_app); @@ -551,6 +554,9 @@ void Courtroom::set_widgets() set_size_and_pos(ui_pre, "pre"); ui_pre->setText("Pre"); + set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); + ui_pre_non_interrupt->setText("No Intrpt"); + set_size_and_pos(ui_flip, "flip"); set_size_and_pos(ui_guard, "guard"); @@ -1012,7 +1018,8 @@ void Courtroom::on_chat_return_pressed() //showname# //other_charid# - //self_offset#% + //self_offset# + //noninterrupting_preanim#% QStringList packet_contents; @@ -1051,7 +1058,7 @@ void Courtroom::on_chat_return_pressed() else f_emote_mod = 2; } - else if (ui_pre->isChecked()) + else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) { if (f_emote_mod == 0) f_emote_mod = 1; @@ -1134,6 +1141,22 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(QString::number(offset_with_pair)); } + if (ui_pre_non_interrupt->isChecked() and ui_pre->isChecked()) + { + if (ui_ic_chat_name->text().isEmpty()) + { + packet_contents.append(""); + } + + if (!(other_charid > -1 && other_charid != m_cid)) + { + packet_contents.append("-1"); + packet_contents.append("0"); + } + + packet_contents.append("1"); + } + ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1468,7 +1491,10 @@ void Courtroom::handle_chatmessage_2() qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); //intentional fallthru case 0: case 5: - handle_chatmessage_3(); + if (m_chatmessage[NONINTERRUPTING_PRE].isEmpty()) + handle_chatmessage_3(); + else + play_noninterrupting_preanim(); } } @@ -1915,8 +1941,45 @@ void Courtroom::play_preanim() } +void Courtroom::play_noninterrupting_preanim() +{ + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_preanim = m_chatmessage[PRE_EMOTE]; + + //all time values in char.inis are multiplied by a constant(time_mod) to get the actual time + 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; + + int preanim_duration; + + if (ao2_duration < 0) + preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); + else + preanim_duration = ao2_duration; + + sfx_delay_timer->start(sfx_delay); + + if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif") || + preanim_duration < 0) + { + anim_state = 4; + preanim_done(); + qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif"; + return; + } + + ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); + anim_state = 4; + if (text_delay >= 0) + text_delay_timer->start(text_delay); + + handle_chatmessage_3(); +} + void Courtroom::preanim_done() { + anim_state = 1; handle_chatmessage_3(); } @@ -1927,13 +1990,14 @@ void Courtroom::realization_done() void Courtroom::start_chat_ticking() { - ui_vp_message->clear(); - set_text_color(); - rainbow_counter = 0; //we need to ensure that the text isn't already ticking because this function can be called by two logic paths if (text_state != 0) return; + ui_vp_message->clear(); + set_text_color(); + rainbow_counter = 0; + if (chatmessage_is_empty) { //since the message is empty, it's technically done ticking @@ -1992,8 +2056,11 @@ void Courtroom::chat_tick() if (tick_pos >= f_message.size()) { text_state = 2; - anim_state = 3; - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + if (anim_state != 4) + { + anim_state = 3; + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + } } else @@ -2083,7 +2150,7 @@ void Courtroom::chat_tick() // Here, we check if the entire message is blue. // If it isn't, we stop talking. - if (!entire_message_is_blue) + if (!entire_message_is_blue and anim_state != 4) { QString f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; @@ -2107,7 +2174,7 @@ void Courtroom::chat_tick() // If it isn't, we start talking if we have completely climbed out of inline blues. if (!entire_message_is_blue) { - if (inline_blue_depth == 0) + if (inline_blue_depth == 0 and anim_state != 4) { QString f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; @@ -2566,18 +2633,23 @@ void Courtroom::on_ooc_return_pressed() } } else if (ooc_message.startsWith("/login")) + { ui_guard->show(); + append_server_chatmessage("CLIENT", "You were granted the Guard button."); + } else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended) { //ui_text_color->addItem("Rainbow"); ui_ooc_chat_message->clear(); //rainbow_appended = true; + append_server_chatmessage("CLIENT", "This does nohing, but there you go."); return; } else if (ooc_message.startsWith("/settings")) { ui_ooc_chat_message->clear(); ao_app->call_settings_menu(); + append_server_chatmessage("CLIENT", "You opened the settings menu."); return; } else if (ooc_message.startsWith("/pair")) @@ -2590,7 +2662,21 @@ void Courtroom::on_ooc_return_pressed() if (ok) { if (whom > -1) + { other_charid = whom; + QString msg = "You will now pair up with "; + msg.append(char_list.at(whom).name); + msg.append(" if they also choose your character in return."); + append_server_chatmessage("CLIENT", msg); + } + else + { + append_server_chatmessage("CLIENT", "You are no longer paired with anyone."); + } + } + else + { + append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised."); } return; } @@ -2604,18 +2690,34 @@ void Courtroom::on_ooc_return_pressed() if (ok) { if (off >= -100 && off <= 100) + { offset_with_pair = off; + QString msg = "You have set your offset to "; + msg.append(QString::number(off)); + msg.append("%."); + append_server_chatmessage("CLIENT", msg); + } + else + { + append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!"); + } + } + else + { + append_server_chatmessage("CLIENT", "That offset does not look like one."); } return; } else if (ooc_message.startsWith("/switch_am")) { + append_server_chatmessage("CLIENT", "You switched your music and area list."); on_switch_area_music_clicked(); ui_ooc_chat_message->clear(); return; } else if (ooc_message.startsWith("/enable_blocks")) { + append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this."); ao_app->shownames_enabled = true; ao_app->charpairs_enabled = true; ao_app->arup_enabled = true; @@ -2624,6 +2726,16 @@ void Courtroom::on_ooc_return_pressed() ui_ooc_chat_message->clear(); return; } + else if (ooc_message.startsWith("/non_int_pre")) + { + if (ui_pre_non_interrupt->isChecked()) + append_server_chatmessage("CLIENT", "Your pre-animations interrupt again."); + else + append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text."); + ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked()); + ui_ooc_chat_message->clear(); + return; + } QStringList packet_contents; packet_contents.append(ui_ooc_chat_name->text()); -- cgit From b33d0b0a3c9311fc43d5d00d56d7b6c8d706adcd Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 7 Sep 2018 10:02:35 +0200 Subject: Lowered the prosecutor / defence characters, so they don't float above some desks. --- courtroom.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index dd6c1601..7c6b7fb1 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1374,7 +1374,7 @@ void Courtroom::handle_chatmessage_2() int vert_offset = 0; if (hor_offset > 0) { - vert_offset = hor_offset / 20; + vert_offset = hor_offset / 10; } ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100); @@ -1383,7 +1383,7 @@ void Courtroom::handle_chatmessage_2() int vert2_offset = 0; if (hor2_offset > 0) { - vert2_offset = hor2_offset / 20; + vert2_offset = hor2_offset / 10; } ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); @@ -1410,7 +1410,7 @@ void Courtroom::handle_chatmessage_2() if (hor_offset < 0) { // We don't want to RAISE the char off the floor. - vert_offset = -1 * hor_offset / 20; + vert_offset = -1 * hor_offset / 10; } ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100); @@ -1419,7 +1419,7 @@ void Courtroom::handle_chatmessage_2() int vert2_offset = 0; if (hor2_offset < 0) { - vert2_offset = -1 * hor2_offset / 20; + vert2_offset = -1 * hor2_offset / 10; } ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); -- cgit From 8006d40d1495a848b07a59bf514100648c82459c Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 01:16:28 +0200 Subject: Fixed bugs regarding noninterrupting pres. - They are now actually non-interrupting when an interjection is played. - Realisation now happens at the start of the message if the pre is non-interrupting. --- courtroom.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 7c6b7fb1..5eb2c56e 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1141,7 +1141,7 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(QString::number(offset_with_pair)); } - if (ui_pre_non_interrupt->isChecked() and ui_pre->isChecked()) + if (ui_pre_non_interrupt->isChecked()) { if (ui_ic_chat_name->text().isEmpty()) { @@ -1502,6 +1502,13 @@ void Courtroom::handle_chatmessage_3() { start_chat_ticking(); + if (m_chatmessage[REALIZATION] == "1") + { + realization_timer->start(60); + ui_vp_realization->show(); + sfx_player->play(ao_app->get_sfx("realization")); + } + int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); QString f_side = m_chatmessage[SIDE]; @@ -1575,13 +1582,6 @@ void Courtroom::handle_chatmessage_3() anim_state = 3; } - if (m_chatmessage[REALIZATION] == "1") - { - realization_timer->start(60); - ui_vp_realization->show(); - sfx_player->play(ao_app->get_sfx("realization")); - } - QString f_message = m_chatmessage[MESSAGE]; QStringList call_words = ao_app->get_call_words(); -- cgit From c1c042b93d0d0550bd1dfb3cc17f3209135a26c0 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 01:42:44 +0200 Subject: Revert "Removed the dependency on `bass.dll`." This reverts commit fe955d692350cd3bac192721c09d8fdd445afc5d. --- courtroom.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 5eb2c56e..4e759a35 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -11,6 +11,34 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { ao_app = p_ao_app; + //initializing sound device + + + // Change the default audio output device to be the one the user has given + // in his config.ini file for now. + int a = 0; + BASS_DEVICEINFO info; + + if (ao_app->get_audio_output_device() == "Default") + { + BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL); + BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + } + else + { + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) + { + if (ao_app->get_audio_output_device() == info.name) + { + BASS_SetDevice(a); + BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL); + BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + qDebug() << info.name << "was set as the default audio output device."; + break; + } + } + } + keepalive_timer = new QTimer(this); keepalive_timer->start(60000); -- cgit From fcd8f5b5abb2329aded120007319d581908c8a69 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 02:33:18 +0200 Subject: Areas can now be spectatable, too. - Makes it so that people can join, but can't type IC unless invited. - The CM can set it with `/area_spectate`. --- courtroom.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 4e759a35..d6ac56cd 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -963,10 +963,7 @@ void Courtroom::list_areas() i_area.append(QString::number(arup_players.at(n_area))); i_area.append(" users | "); - if (arup_locks.at(n_area) == true) - i_area.append("LOCKED"); - else - i_area.append("OPEN"); + i_area.append(arup_locks.at(n_area)); } if (i_area.toLower().contains(ui_music_search->text().toLower())) @@ -978,7 +975,7 @@ void Courtroom::list_areas() { // Colouring logic here. ui_area_list->item(n_listed_areas)->setBackground(free_brush); - if (arup_locks.at(n_area)) + if (arup_locks.at(n_area) == "Locked") { ui_area_list->item(n_listed_areas)->setBackground(locked_brush); } -- cgit From d54064d892c26a26641e6ed67412b33d7db3f6c2 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 03:33:10 +0200 Subject: Server messages are now coloured differently. --- courtroom.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index d6ac56cd..6c66c3f1 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1005,12 +1005,19 @@ void Courtroom::list_areas() void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) { - ui_ms_chatlog->append_chatmessage(f_name, f_message); + ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); } -void Courtroom::append_server_chatmessage(QString p_name, QString p_message) +void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_colour) { - ui_server_chatlog->append_chatmessage(p_name, p_message); + QString colour = "#000000"; + + if (p_colour == "0") + 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(); + + ui_server_chatlog->append_chatmessage(p_name, p_message, colour); } void Courtroom::on_chat_return_pressed() @@ -2660,21 +2667,21 @@ void Courtroom::on_ooc_return_pressed() else if (ooc_message.startsWith("/login")) { ui_guard->show(); - append_server_chatmessage("CLIENT", "You were granted the Guard button."); + 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"); ui_ooc_chat_message->clear(); //rainbow_appended = true; - append_server_chatmessage("CLIENT", "This does nohing, but there you go."); + append_server_chatmessage("CLIENT", "This does nohing, but there you go.", "1"); return; } else if (ooc_message.startsWith("/settings")) { ui_ooc_chat_message->clear(); ao_app->call_settings_menu(); - append_server_chatmessage("CLIENT", "You opened the settings menu."); + append_server_chatmessage("CLIENT", "You opened the settings menu.", "1"); return; } else if (ooc_message.startsWith("/pair")) @@ -2692,16 +2699,16 @@ void Courtroom::on_ooc_return_pressed() QString msg = "You will now pair up with "; msg.append(char_list.at(whom).name); msg.append(" if they also choose your character in return."); - append_server_chatmessage("CLIENT", msg); + append_server_chatmessage("CLIENT", msg, "1"); } else { - append_server_chatmessage("CLIENT", "You are no longer paired with anyone."); + append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1"); } } else { - append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised."); + append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised.", "1"); } return; } @@ -2720,29 +2727,29 @@ void Courtroom::on_ooc_return_pressed() QString msg = "You have set your offset to "; msg.append(QString::number(off)); msg.append("%."); - append_server_chatmessage("CLIENT", msg); + append_server_chatmessage("CLIENT", msg, "1"); } else { - append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!"); + append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!", "1"); } } else { - append_server_chatmessage("CLIENT", "That offset does not look like one."); + append_server_chatmessage("CLIENT", "That offset does not look like one.", "1"); } return; } else if (ooc_message.startsWith("/switch_am")) { - append_server_chatmessage("CLIENT", "You switched your music and area list."); + append_server_chatmessage("CLIENT", "You switched your music and area list.", "1"); on_switch_area_music_clicked(); ui_ooc_chat_message->clear(); return; } else if (ooc_message.startsWith("/enable_blocks")) { - append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this."); + append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this.", "1"); ao_app->shownames_enabled = true; ao_app->charpairs_enabled = true; ao_app->arup_enabled = true; @@ -2754,9 +2761,9 @@ void Courtroom::on_ooc_return_pressed() else if (ooc_message.startsWith("/non_int_pre")) { if (ui_pre_non_interrupt->isChecked()) - append_server_chatmessage("CLIENT", "Your pre-animations interrupt again."); + append_server_chatmessage("CLIENT", "Your pre-animations interrupt again.", "1"); else - append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text."); + append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text.", "1"); ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked()); ui_ooc_chat_message->clear(); return; -- cgit From 29c91e63ea44a5e27b90fcf409ad9e4dc1f3f5c2 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 12:35:01 +0200 Subject: The IC chatlog can now show both name and showname, and can be exported. - Toggle the 'Custom shownames' tickbox to switch between real names and custom shownames. - Type `/save_chatlog` in the OOC to export your IC chatlog into a file. - Exporting the chatlog will append the date and time of the message, too. --- courtroom.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 6c66c3f1..2eb7d94e 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1268,6 +1268,14 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_evidence_present->set_image("present_disabled.png"); } + chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); + ic_chatlog_history.append(*temp); + + while(ic_chatlog_history.size() > log_maximum_blocks) + { + ic_chatlog_history.removeFirst(); + } + append_ic_text(": " + m_chatmessage[MESSAGE], f_showname); previous_ic_message = f_message; @@ -2555,16 +2563,24 @@ void Courtroom::handle_song(QStringList *p_contents) else { QString str_char = char_list.at(n_char).name; + QString str_show = char_list.at(n_char).name; if (p_contents->length() > 2) { - if (ui_showname_enable->isChecked()) - str_char = p_contents->at(2); + str_show = p_contents->at(2); } if (!mute_map.value(n_char)) { - append_ic_songchange(f_song_clear, str_char); + chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true); + ic_chatlog_history.append(*temp); + + while(ic_chatlog_history.size() > log_maximum_blocks) + { + ic_chatlog_history.removeFirst(); + } + + append_ic_songchange(f_song_clear, str_show); music_player->play(f_song); } } @@ -2768,6 +2784,29 @@ void Courtroom::on_ooc_return_pressed() ui_ooc_chat_message->clear(); return; } + else if (ooc_message.startsWith("/save_chatlog")) + { + QFile file("chatlog.txt"); + + if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) + { + append_server_chatmessage("CLIENT", "Couldn't open chatlog.txt to write into.", "1"); + ui_ooc_chat_message->clear(); + return; + } + + QTextStream out(&file); + + foreach (chatlogpiece item, ic_chatlog_history) { + out << item.get_full() << '\n'; + } + + file.close(); + + append_server_chatmessage("CLIENT", "The IC chatlog has been saved.", "1"); + ui_ooc_chat_message->clear(); + return; + } QStringList packet_contents; packet_contents.append(ui_ooc_chat_name->text()); @@ -3295,6 +3334,26 @@ void Courtroom::on_guard_clicked() void Courtroom::on_showname_enable_clicked() { + ui_ic_chatlog->clear(); + first_message_sent = false; + + foreach (chatlogpiece item, ic_chatlog_history) { + if (ui_showname_enable->isChecked()) + { + if (item.get_is_song()) + append_ic_songchange(item.get_message(), item.get_showname()); + else + append_ic_text(item.get_message(), item.get_showname()); + } + else + { + if (item.get_is_song()) + append_ic_songchange(item.get_message(), item.get_name()); + else + append_ic_text(item.get_message(), item.get_name()); + } + } + ui_ic_chat_message->setFocus(); } -- cgit From 41e12d304e7c4dd294c147eebd87f2a478ea84b7 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 20:37:17 +0200 Subject: `/load_case` command to quickly load cases. --- courtroom.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 2eb7d94e..fcb47817 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2807,6 +2807,62 @@ void Courtroom::on_ooc_return_pressed() ui_ooc_chat_message->clear(); return; } + else if (ooc_message.startsWith("/load_case")) + { + QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); + + if (command.size() < 2) + { + append_server_chatmessage("CLIENT", "You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini.", "1"); + ui_ooc_chat_message->clear(); + return; + } + + + if (command.size() > 2) + { + append_server_chatmessage("CLIENT", "Too many arguments to load a case! You only need one filename, without extension.", "1"); + ui_ooc_chat_message->clear(); + return; + } + + QDir casefolder("base/cases"); + if (!casefolder.exists()) + { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there.", "1"); + ui_ooc_chat_message->clear(); + return; + } + + QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); + + QString casedoc = casefile.value("doc", "UNKNOWN").value(); + + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/doc " + casedoc + "#%")); + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/status lfp#%")); + + for (int i = local_evidence_list.size() - 1; i >= 0; i--) { + ao_app->send_server_packet(new AOPacket("DE#" + QString::number(i) + "#%")); + } + + foreach (QString evi, casefile.childGroups()) { + if (evi == "General") + continue; + + QStringList f_contents; + + f_contents.append(casefile.value(evi + "/name", "UNKNOWN").value()); + f_contents.append(casefile.value(evi + "/description", "UNKNOWN").value()); + f_contents.append(casefile.value(evi + "/image", "UNKNOWN.png").value()); + + ao_app->send_server_packet(new AOPacket("PE", f_contents)); + } + + append_server_chatmessage("CLIENT", "Your case \"" + command[1] + "\" was loaded!", "1"); + ui_ooc_chat_message->clear(); + return; + } QStringList packet_contents; packet_contents.append(ui_ooc_chat_name->text()); -- cgit From 99d2894ab3a391cdb63f8158f90d62c28fcb4ed9 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 17 Sep 2018 17:52:27 +0200 Subject: Added the ability to set a default status and a CM doc for loaded cases. --- courtroom.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index fcb47817..dea4fb02 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2811,9 +2811,22 @@ void Courtroom::on_ooc_return_pressed() { QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); + QDir casefolder("base/cases"); + if (!casefolder.exists()) + { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there.", "1"); + ui_ooc_chat_message->clear(); + return; + } + QStringList caseslist = casefolder.entryList(); + caseslist.removeOne("."); + caseslist.removeOne(".."); + caseslist.replaceInStrings(".ini",""); + if (command.size() < 2) { - append_server_chatmessage("CLIENT", "You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini.", "1"); + append_server_chatmessage("CLIENT", "You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini.\nCases you can load: " + caseslist.join(", "), "1"); ui_ooc_chat_message->clear(); return; } @@ -2826,21 +2839,18 @@ void Courtroom::on_ooc_return_pressed() return; } - QDir casefolder("base/cases"); - if (!casefolder.exists()) - { - QDir::current().mkdir("base/" + casefolder.dirName()); - append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there.", "1"); - ui_ooc_chat_message->clear(); - return; - } - QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); - QString casedoc = casefile.value("doc", "UNKNOWN").value(); + QString casedoc = casefile.value("doc", "").value(); + QString cmdoc = casefile.value("cmdoc", "").value(); + QString casestatus = casefile.value("status", "").value(); - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/doc " + casedoc + "#%")); - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/status lfp#%")); + if (!casedoc.isEmpty()) + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/doc " + casedoc + "#%")); + if (!casestatus.isEmpty()) + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/status " + casestatus + "#%")); + if (!cmdoc.isEmpty()) + append_server_chatmessage("CLIENT", "Navigate to " + cmdoc + " for the CM doc.", "1"); for (int i = local_evidence_list.size() - 1; i >= 0; i--) { ao_app->send_server_packet(new AOPacket("DE#" + QString::number(i) + "#%")); -- cgit From c8ae7746b78b818b103ebc4ccecc0a21dec1c7a0 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 17 Sep 2018 19:12:01 +0200 Subject: Added the ability to name an author / authors for loaded cases. --- courtroom.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index dea4fb02..461de381 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2841,10 +2841,13 @@ void Courtroom::on_ooc_return_pressed() QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); + QString caseauth = casefile.value("author", "").value(); QString casedoc = casefile.value("doc", "").value(); QString cmdoc = casefile.value("cmdoc", "").value(); QString casestatus = casefile.value("status", "").value(); + if (!caseauth.isEmpty()) + append_server_chatmessage("CLIENT", "Case made by " + caseauth + ".", "1"); if (!casedoc.isEmpty()) ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/doc " + casedoc + "#%")); if (!casestatus.isEmpty()) -- cgit From 3de7e346babbfbb856a2a08f01cea2f431899eb5 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 18 Sep 2018 19:01:13 +0200 Subject: Minor fix regarding area's being locked. --- courtroom.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 461de381..347e889f 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -948,7 +948,12 @@ void Courtroom::list_areas() for (int n_area = 0 ; n_area < area_list.size() ; ++n_area) { - QString i_area = area_list.at(n_area); + QString i_area = ""; + i_area.append("["); + i_area.append(QString::number(n_area)); + i_area.append("] "); + + i_area.append(area_list.at(n_area)); if (ao_app->arup_enabled) { @@ -975,7 +980,7 @@ void Courtroom::list_areas() { // Colouring logic here. ui_area_list->item(n_listed_areas)->setBackground(free_brush); - if (arup_locks.at(n_area) == "Locked") + if (arup_locks.at(n_area) == "LOCKED") { ui_area_list->item(n_listed_areas)->setBackground(locked_brush); } -- cgit From b73036724aea682c3860a04968e71f911a08ea18 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 20 Sep 2018 16:41:32 +0200 Subject: Rolled all the special IC stuff into one FL packet piece. So now, a standard CCCC server uses three bonus packets: `modcall_reason`, `cccc_ic_support` and `arup`. --- courtroom.cpp | 65 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 347e889f..0a9baef5 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -208,6 +208,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pre_non_interrupt = new QCheckBox(this); ui_pre_non_interrupt->setText("No Intrpt"); + ui_pre_non_interrupt->hide(); ui_custom_objection = new AOButton(this, ao_app); ui_realization = new AOButton(this, ao_app); @@ -470,7 +471,7 @@ void Courtroom::set_widgets() ui_pair_offset_spinbox->hide(); set_size_and_pos(ui_pair_button, "pair_button"); ui_pair_button->set_image("pair_button.png"); - if (ao_app->charpairs_enabled) + if (ao_app->cccc_ic_support_enabled) { ui_pair_button->setEnabled(true); ui_pair_button->show(); @@ -583,7 +584,6 @@ void Courtroom::set_widgets() ui_pre->setText("Pre"); set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); - ui_pre_non_interrupt->setText("No Intrpt"); set_size_and_pos(ui_flip, "flip"); @@ -864,6 +864,11 @@ void Courtroom::enter_courtroom(int p_cid) else ui_flip->hide(); + if (ao_app->cccc_ic_support_enabled) + ui_pre_non_interrupt->show(); + else + ui_pre_non_interrupt->hide(); + list_music(); list_areas(); @@ -879,7 +884,7 @@ void Courtroom::enter_courtroom(int p_cid) //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); ui_char_select_background->hide(); - if (ao_app->shownames_enabled) + if (ao_app->cccc_ic_support_enabled) { ui_ic_chat_name->setPlaceholderText(ao_app->get_showname(f_char)); ui_ic_chat_name->setEnabled(true); @@ -1159,39 +1164,41 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(f_text_color); - if (!ui_ic_chat_name->text().isEmpty()) - { - packet_contents.append(ui_ic_chat_name->text()); - } - - // If there is someone this user would like to appear with. - // And said someone is not ourselves! - if (other_charid > -1 && other_charid != m_cid) + // If the server we're on supports CCCC stuff, we should use it! + if (ao_app->cccc_ic_support_enabled) { - // First, we'll add a filler in case we haven't set an IC showname. - if (ui_ic_chat_name->text().isEmpty()) + // If there is a showname entered, use that -- else, just send an empty packet-part. + if (!ui_ic_chat_name->text().isEmpty()) { - packet_contents.append(""); + packet_contents.append(ui_ic_chat_name->text()); } - - packet_contents.append(QString::number(other_charid)); - packet_contents.append(QString::number(offset_with_pair)); - } - - if (ui_pre_non_interrupt->isChecked()) - { - if (ui_ic_chat_name->text().isEmpty()) + else { packet_contents.append(""); } - if (!(other_charid > -1 && other_charid != m_cid)) + // Similarly, we send over whom we're paired with, unless we have chosen ourselves. + // Or a charid of -1 or lower, through some means. + if (other_charid > -1 && other_charid != m_cid) + { + packet_contents.append(QString::number(other_charid)); + packet_contents.append(QString::number(offset_with_pair)); + } + else { packet_contents.append("-1"); packet_contents.append("0"); } - packet_contents.append("1"); + // Finally, we send over if we want our pres to not interrupt. + if (ui_pre_non_interrupt->isChecked()) + { + packet_contents.append("1"); + } + else + { + packet_contents.append("0"); + } } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); @@ -1205,23 +1212,22 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) if (p_contents->size() < 15) return; - //qDebug() << "A message was got. Its contents:"; for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string) { //m_chatmessage[n_string] = p_contents->at(n_string); // Note that we have added stuff that vanilla clients and servers simply won't send. // So now, we have to check if the thing we want even exists 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()) + if (n_string < p_contents->size() && + (n_string < 15 || ao_app->cccc_ic_support_enabled)) { m_chatmessage[n_string] = p_contents->at(n_string); - //qDebug() << "- " << n_string << ": " << p_contents->at(n_string); } else { m_chatmessage[n_string] = ""; - //qDebug() << "- " << n_string << ": Nothing?"; } } @@ -2771,8 +2777,7 @@ void Courtroom::on_ooc_return_pressed() else if (ooc_message.startsWith("/enable_blocks")) { append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this.", "1"); - ao_app->shownames_enabled = true; - ao_app->charpairs_enabled = true; + ao_app->cccc_ic_support_enabled = true; ao_app->arup_enabled = true; ao_app->modcall_reason_enabled = true; on_reload_theme_clicked(); -- cgit From 1ea16339e086dc6cf3ade9cc3080b7c9d2b907ee Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 20 Sep 2018 18:46:21 +0200 Subject: ...And the same with the client, too! --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 0a9baef5..14a2d588 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -3059,7 +3059,7 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model) QString p_song = music_list.at(music_row_to_number.at(p_model.row())); - if (!ui_ic_chat_name->text().isEmpty()) + if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) { ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#" + ui_ic_chat_name->text() + "#%"), false); } -- cgit From ab49e69067bf0d6f0c9591602f03ed61b21214c7 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 20 Sep 2018 22:13:03 +0200 Subject: Added the ability to give characters custom realisation sounds. --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 14a2d588..418bacdf 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1557,7 +1557,7 @@ void Courtroom::handle_chatmessage_3() { realization_timer->start(60); ui_vp_realization->show(); - sfx_player->play(ao_app->get_sfx("realization")); + sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); -- cgit From ff0f8c268a36129635a8d9f459a9e511b599260f Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 20 Sep 2018 23:14:32 +0200 Subject: Full stops force the idle anim to play. --- courtroom.cpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 418bacdf..48e456f7 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2072,6 +2072,9 @@ void Courtroom::start_chat_ticking() // let's set it to false. inline_blue_depth = 0; + // And also, reset the fullstop bool. + previous_character_is_fullstop = false; + // At the start of every new message, we set the text speed to the default. current_display_speed = 3; chat_tick_timer->start(message_display_speed[current_display_speed]); @@ -2225,7 +2228,8 @@ void Courtroom::chat_tick() // If it isn't, we start talking if we have completely climbed out of inline blues. if (!entire_message_is_blue) { - if (inline_blue_depth == 0 and anim_state != 4) + // We should only go back to talking if we're out of inline blues, not during a non. int. pre, and not on the last character. + if (inline_blue_depth == 0 and anim_state != 4 and !(tick_pos+1 >= f_message.size())) { QString f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; @@ -2285,6 +2289,20 @@ void Courtroom::chat_tick() } } + // Silencing the character during long times of ellipses. + else if (f_character == "." and !next_character_is_not_special and !previous_character_is_fullstop) + { + if (!previous_character_is_fullstop && inline_blue_depth == 0 && !entire_message_is_blue) + { + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_idle(f_char, f_emote); + } + previous_character_is_fullstop = true; + next_character_is_not_special = true; + formatting_char = true; + tick_pos--; + } else { next_character_is_not_special = false; @@ -2324,6 +2342,20 @@ void Courtroom::chat_tick() } } + // Basically only go back to talkin if: + // - This character is not a fullstop + // - But the previous character was + // - And we're out of inline blues + // - And the entire messages isn't blue + // - And this isn't the last character. + if (f_character != "." && previous_character_is_fullstop && inline_blue_depth == 0 && !entire_message_is_blue && tick_pos+1 >= f_message.size()) + { + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_talking(f_char, f_emote); + previous_character_is_fullstop = false; + } + QScrollBar *scroll = ui_vp_message->verticalScrollBar(); scroll->setValue(scroll->maximum()); -- cgit From 21aaa90c44408942ec77236cfc1a721f08ad7b55 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 20 Sep 2018 23:32:32 +0200 Subject: Made objections not necessarily play a pre, unless you have Pre ticked. --- courtroom.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 48e456f7..109ffa60 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1095,10 +1095,13 @@ void Courtroom::on_chat_return_pressed() //needed or else legacy won't understand what we're saying if (objection_state > 0) { - if (f_emote_mod == 5) - f_emote_mod = 6; - else - f_emote_mod = 2; + if (ui_pre->isChecked()) + { + if (f_emote_mod == 5) + f_emote_mod = 6; + else + f_emote_mod = 2; + } } else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) { -- cgit From 3c07f27be79f1f72eec731218ba7dd3fd6470153 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sun, 23 Sep 2018 11:19:14 +0200 Subject: Generalised the music extension remover. --- courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 109ffa60..3547532a 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -915,7 +915,7 @@ void Courtroom::list_music() { QString i_song = music_list.at(n_song); QString i_song_listname = i_song; - i_song_listname.replace(".mp3",""); + i_song_listname = i_song_listname.left(i_song_listname.lastIndexOf(".")); if (i_song.toLower().contains(ui_music_search->text().toLower())) { @@ -2599,7 +2599,7 @@ void Courtroom::handle_song(QStringList *p_contents) QString f_song = f_contents.at(0); QString f_song_clear = f_song; - f_song_clear.replace(".mp3", ""); + 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()) -- cgit From 795dea1ad2b0e69c212ef174e17a63b34f3fde37 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sun, 23 Sep 2018 14:09:10 +0200 Subject: Some UI bugfixes in regards to custom client features shown + nonint-pre fixes. --- courtroom.cpp | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 3547532a..b8b5e5af 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -407,6 +407,31 @@ void Courtroom::set_widgets() set_size_and_pos(ui_viewport, "viewport"); + // 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_support_enabled) + { + ui_pair_button->show(); + ui_pre_non_interrupt->show(); + ui_showname_enable->show(); + ui_ic_chat_name->show(); + ui_ic_chat_name->setEnabled(true); + } + else + { + ui_pair_button->hide(); + ui_pre_non_interrupt->hide(); + ui_showname_enable->hide(); + ui_ic_chat_name->hide(); + ui_ic_chat_name->setEnabled(false); + } + + // We also show the non-server-dependent client additions. + // Once again, if the theme can't display it, set_move_and_pos will catch them. + ui_settings->show(); + ui_log_limit_label->show(); + ui_log_limit_spinbox->show(); + ui_vp_background->move(0, 0); ui_vp_background->resize(ui_viewport->width(), ui_viewport->height()); @@ -471,16 +496,6 @@ void Courtroom::set_widgets() ui_pair_offset_spinbox->hide(); set_size_and_pos(ui_pair_button, "pair_button"); ui_pair_button->set_image("pair_button.png"); - if (ao_app->cccc_ic_support_enabled) - { - ui_pair_button->setEnabled(true); - ui_pair_button->show(); - } - else - { - ui_pair_button->setEnabled(false); - ui_pair_button->hide(); - } set_size_and_pos(ui_area_list, "music_list"); ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); @@ -864,11 +879,6 @@ void Courtroom::enter_courtroom(int p_cid) else ui_flip->hide(); - if (ao_app->cccc_ic_support_enabled) - ui_pre_non_interrupt->show(); - else - ui_pre_non_interrupt->hide(); - list_music(); list_areas(); @@ -884,16 +894,6 @@ void Courtroom::enter_courtroom(int p_cid) //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); ui_char_select_background->hide(); - if (ao_app->cccc_ic_support_enabled) - { - ui_ic_chat_name->setPlaceholderText(ao_app->get_showname(f_char)); - ui_ic_chat_name->setEnabled(true); - } - else - { - ui_ic_chat_name->setPlaceholderText("---"); - ui_ic_chat_name->setEnabled(false); - } ui_ic_chat_message->setEnabled(m_cid != -1); ui_ic_chat_message->setFocus(); @@ -1194,7 +1194,7 @@ void Courtroom::on_chat_return_pressed() } // Finally, we send over if we want our pres to not interrupt. - if (ui_pre_non_interrupt->isChecked()) + if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) { packet_contents.append("1"); } @@ -1545,7 +1545,7 @@ void Courtroom::handle_chatmessage_2() qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); //intentional fallthru case 0: case 5: - if (m_chatmessage[NONINTERRUPTING_PRE].isEmpty()) + if (m_chatmessage[NONINTERRUPTING_PRE].toInt() == 0) handle_chatmessage_3(); else play_noninterrupting_preanim(); -- cgit From c17fe46e769878de97303f11a990809f27e8212b Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 24 Sep 2018 22:00:16 +0200 Subject: Added the ability to change the showname's colour. --- courtroom.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index b8b5e5af..3323b6fa 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1369,6 +1369,8 @@ void Courtroom::handle_chatmessage_2() ui_vp_chatbox->set_image_from_path(chatbox_path); } + ui_vp_showname->setStyleSheet("QLabel { color : " + get_text_color("_showname").name() + "; }"); + set_scene(); set_text_color(); -- cgit From 265714d9d5312e5981ed71f2d5eae20078e5b633 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 3 Oct 2018 21:24:13 +0200 Subject: Added support for opus files on Linux. --- courtroom.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 3323b6fa..c38a6073 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -23,6 +23,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL); BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + BASS_PluginLoad("libbassopus.so", 0); } else { @@ -33,6 +34,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() BASS_SetDevice(a); BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL); BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + BASS_PluginLoad("libbassopus.so", 0); qDebug() << info.name << "was set as the default audio output device."; break; } -- cgit From 546d3c897031d2b6f1c36c4b9cd94e3b9e0e62b9 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 23 Oct 2018 09:33:58 +0200 Subject: Moved bassopus stuff to its own function. Not that it works, so whatever. --- courtroom.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index c38a6073..2d5468e4 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -22,8 +22,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() if (ao_app->get_audio_output_device() == "Default") { BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL); - BASS_PluginLoad("bassopus.dll", BASS_UNICODE); - BASS_PluginLoad("libbassopus.so", 0); + load_bass_opus_plugin(); } else { @@ -33,8 +32,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { BASS_SetDevice(a); BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL); - BASS_PluginLoad("bassopus.dll", BASS_UNICODE); - BASS_PluginLoad("libbassopus.so", 0); + load_bass_opus_plugin(); qDebug() << info.name << "was set as the default audio output device."; break; } @@ -3514,3 +3512,17 @@ Courtroom::~Courtroom() delete objection_player; delete blip_player; } + +#if (defined (_WIN32) || defined (_WIN64)) +void Courtroom::load_bass_opus_plugin() +{ + BASS_PluginLoad("bassopus.dll", 0); +} +#elif (defined (LINUX) || defined (__linux__)) +void Courtroom::load_bass_opus_plugin() +{ + BASS_PluginLoad("libbassopus.so", 0); +} +#else +#error This operating system is unsupported for bass plugins. +#endif -- cgit From 3f41ed134121bfcf6e1bbbbac9fcd1aad49fbd6b Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 23 Oct 2018 09:51:53 +0200 Subject: Fixed the fullstop-silence bug. Made it so that characters correctly switch to-and-fro idle / talking anims during full stops, and don't interrupt non-interrupting pres. --- courtroom.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 2d5468e4..bd206cf4 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2297,7 +2297,7 @@ void Courtroom::chat_tick() // Silencing the character during long times of ellipses. else if (f_character == "." and !next_character_is_not_special and !previous_character_is_fullstop) { - if (!previous_character_is_fullstop && inline_blue_depth == 0 && !entire_message_is_blue) + if (!previous_character_is_fullstop && inline_blue_depth == 0 && !entire_message_is_blue && anim_state != 4) { QString f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; @@ -2352,8 +2352,9 @@ void Courtroom::chat_tick() // - But the previous character was // - And we're out of inline blues // - And the entire messages isn't blue + // - And we aren't still in a non-interrupting pre // - And this isn't the last character. - if (f_character != "." && previous_character_is_fullstop && inline_blue_depth == 0 && !entire_message_is_blue && tick_pos+1 >= f_message.size()) + if (f_character != "." && previous_character_is_fullstop && inline_blue_depth == 0 && !entire_message_is_blue && anim_state != 4 && tick_pos+1 <= f_message.size()) { QString f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; -- cgit From bbf8d103b31d5bddc277b28c0245c2ab3e399fe6 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 23 Oct 2018 10:52:59 +0200 Subject: Changed dropdown menus so they activate even if you click an item in them. --- courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index bd206cf4..b71c97bb 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -271,8 +271,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); - connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); - connect(ui_pos_dropdown, SIGNAL(activated(int)), this, SLOT(on_pos_dropdown_changed(int))); + connect(ui_emote_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_emote_dropdown_changed(int))); + connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); -- cgit From 660daf9922e68eb5f5f6bb00eb3bc51d0c460de7 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 23 Oct 2018 14:54:36 +0200 Subject: Client can now accept case alerts. - Settings has a new tab with casing settings. - Can set when the game should alert of cases. - In game tickbox to toggle if you should be alerted of cases. --- courtroom.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index b71c97bb..4426caa8 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -201,10 +201,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_guard = new QCheckBox(this); ui_guard->setText("Guard"); ui_guard->hide(); + ui_casing = new QCheckBox(this); + ui_showname_enable->setChecked(ao_app->get_casing_enabled()); + ui_casing->setText("Casing"); + ui_casing->hide(); ui_showname_enable = new QCheckBox(this); ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); - ui_showname_enable->setText("Custom shownames"); + ui_showname_enable->setText("Shownames"); ui_pre_non_interrupt = new QCheckBox(this); ui_pre_non_interrupt->setText("No Intrpt"); @@ -323,6 +327,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); + connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked())); @@ -599,11 +604,12 @@ void Courtroom::set_widgets() ui_pre->setText("Pre"); set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); - set_size_and_pos(ui_flip, "flip"); set_size_and_pos(ui_guard, "guard"); + set_size_and_pos(ui_casing, "casing"); + set_size_and_pos(ui_showname_enable, "showname_enable"); set_size_and_pos(ui_custom_objection, "custom_objection"); @@ -879,6 +885,11 @@ void Courtroom::enter_courtroom(int p_cid) else ui_flip->hide(); + if (ao_app->casing_alerts_enabled) + ui_casing->show(); + else + ui_casing->hide(); + list_music(); list_areas(); @@ -2697,6 +2708,22 @@ void Courtroom::mod_called(QString p_ip) } } +void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur) +{ + if (ui_casing->isChecked()) + { + ui_server_chatlog->append(msg); + if ((ao_app->get_casing_defence_enabled() && def) || + (ao_app->get_casing_prosecution_enabled() && pro) || + (ao_app->get_casing_judge_enabled() && jud) || + (ao_app->get_casing_juror_enabled() && jur)) + { + modcall_player->play(ao_app->get_sfx("case_call")); + ao_app->alert(this); + } + } +} + void Courtroom::on_ooc_return_pressed() { QString ooc_message = ui_ooc_chat_message->text(); @@ -3506,6 +3533,24 @@ void Courtroom::ping_server() ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%")); } +void Courtroom::on_casing_clicked() +{ + if (ao_app->casing_alerts_enabled) + { + if (ui_casing->isChecked()) + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase" + + " \"" + ao_app->get_casing_can_host_cases() + "\"" + + " " + QString::number(ao_app->get_casing_cm_enabled()) + + " " + QString::number(ao_app->get_casing_defence_enabled()) + + " " + QString::number(ao_app->get_casing_prosecution_enabled()) + + " " + QString::number(ao_app->get_casing_judge_enabled()) + + " " + QString::number(ao_app->get_casing_juror_enabled()) + + "#%")); + else + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase \"\" 0 0 0 0 0#%")); + } +} + Courtroom::~Courtroom() { delete music_player; -- cgit From de8badc9a6e74ca29cbc04ab5438d6eed2eb8984 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 23 Oct 2018 16:15:15 +0200 Subject: Support for case alerts serverside. - Users can use an ingame button to alert people of cases. --- courtroom.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 4426caa8..9cf074ac 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -191,6 +191,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_reload_theme = new AOButton(this, ao_app); ui_call_mod = new AOButton(this, ao_app); ui_settings = new AOButton(this, ao_app); + ui_announce_casing = new AOButton(this, ao_app); ui_switch_area_music = new AOButton(this, ao_app); ui_pre = new QCheckBox(this); @@ -202,7 +203,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_guard->setText("Guard"); ui_guard->hide(); ui_casing = new QCheckBox(this); - ui_showname_enable->setChecked(ao_app->get_casing_enabled()); + ui_casing->setChecked(ao_app->get_casing_enabled()); ui_casing->setText("Casing"); ui_casing->hide(); @@ -322,6 +323,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked())); connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked())); connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); + connect(ui_announce_casing, SIGNAL(clicked()), this, SLOT(on_announce_casing_clicked())); connect(ui_switch_area_music, SIGNAL(clicked()), this, SLOT(on_switch_area_music_clicked())); connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); @@ -431,6 +433,15 @@ void Courtroom::set_widgets() ui_ic_chat_name->setEnabled(false); } + if (ao_app->casing_alerts_enabled) + { + ui_announce_casing->show(); + } + else + { + ui_announce_casing->hide(); + } + // We also show the non-server-dependent client additions. // Once again, if the theme can't display it, set_move_and_pos will catch them. ui_settings->show(); @@ -597,6 +608,9 @@ void Courtroom::set_widgets() set_size_and_pos(ui_settings, "settings"); ui_settings->setText("Settings"); + set_size_and_pos(ui_announce_casing, "casing_button"); + ui_announce_casing->setText("Casing"); + set_size_and_pos(ui_switch_area_music, "switch_area_music"); ui_switch_area_music->setText("A/M"); @@ -3461,6 +3475,11 @@ void Courtroom::on_settings_clicked() ao_app->call_settings_menu(); } +void Courtroom::on_announce_casing_clicked() +{ + ao_app->call_announce_menu(this); +} + void Courtroom::on_pre_clicked() { ui_ic_chat_message->setFocus(); @@ -3551,6 +3570,18 @@ void Courtroom::on_casing_clicked() } } +void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur) +{ + if (ao_app->casing_alerts_enabled) + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/anncase \"" + + title + "\" " + + QString::number(def) + " " + + QString::number(pro) + " " + + QString::number(jud) + " " + + QString::number(jur) + + "#%")); +} + Courtroom::~Courtroom() { delete music_player; -- cgit From 962289793d97357b69e228a0b52737681d2ea0b0 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 23 Oct 2018 16:34:39 +0200 Subject: Added support for the stenographer role in case alerts. --- courtroom.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 9cf074ac..e81d4fdd 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2722,7 +2722,7 @@ void Courtroom::mod_called(QString p_ip) } } -void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur) +void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno) { if (ui_casing->isChecked()) { @@ -2730,7 +2730,8 @@ void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur) if ((ao_app->get_casing_defence_enabled() && def) || (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_juror_enabled() && jur) || + (ao_app->get_casing_steno_enabled() && steno)) { modcall_player->play(ao_app->get_sfx("case_call")); ao_app->alert(this); @@ -3564,13 +3565,14 @@ void Courtroom::on_casing_clicked() + " " + QString::number(ao_app->get_casing_prosecution_enabled()) + " " + QString::number(ao_app->get_casing_judge_enabled()) + " " + QString::number(ao_app->get_casing_juror_enabled()) + + " " + QString::number(ao_app->get_casing_steno_enabled()) + "#%")); else - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase \"\" 0 0 0 0 0#%")); + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase \"\" 0 0 0 0 0 0#%")); } } -void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur) +void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno) { if (ao_app->casing_alerts_enabled) ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/anncase \"" @@ -3578,7 +3580,8 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool + QString::number(def) + " " + QString::number(pro) + " " + QString::number(jud) + " " - + QString::number(jur) + + QString::number(jur) + " " + + QString::number(steno) + "#%")); } -- cgit From a7fa843bd3895a2be5e3f2fb573434c849f02f2d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 2 Nov 2018 15:08:39 +0100 Subject: Don't fix what's doubly broken: Emote dropdown. Made it so that emote dropdown only responds to activation, instead of index changing, i.e., reverted to previous behaviour. Emote changing already had a failsafe for the emote dropdown index changing, which activated even when you clicked on the emotes. That made it so that you'd get the Pre button ticked on emotes that didn't have 'em, and vice versa. --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index e81d4fdd..82aebcd3 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -276,7 +276,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); - connect(ui_emote_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_emote_dropdown_changed(int))); + connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); -- cgit From e8bb1f1e490e52bbfad2bbf75c56f20109a28926 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 2 Nov 2018 15:15:07 +0100 Subject: Reverted the full stop silence feature. With 3D characters, it made the game lag too much -- really wasn't worth it. --- courtroom.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 82aebcd3..120b82f1 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2102,9 +2102,6 @@ void Courtroom::start_chat_ticking() // let's set it to false. inline_blue_depth = 0; - // And also, reset the fullstop bool. - previous_character_is_fullstop = false; - // At the start of every new message, we set the text speed to the default. current_display_speed = 3; chat_tick_timer->start(message_display_speed[current_display_speed]); @@ -2318,21 +2315,6 @@ void Courtroom::chat_tick() formatting_char = true; } } - - // Silencing the character during long times of ellipses. - else if (f_character == "." and !next_character_is_not_special and !previous_character_is_fullstop) - { - if (!previous_character_is_fullstop && inline_blue_depth == 0 && !entire_message_is_blue && anim_state != 4) - { - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_emote = m_chatmessage[EMOTE]; - ui_vp_player_char->play_idle(f_char, f_emote); - } - previous_character_is_fullstop = true; - next_character_is_not_special = true; - formatting_char = true; - tick_pos--; - } else { next_character_is_not_special = false; @@ -2372,21 +2354,6 @@ void Courtroom::chat_tick() } } - // Basically only go back to talkin if: - // - This character is not a fullstop - // - But the previous character was - // - And we're out of inline blues - // - And the entire messages isn't blue - // - And we aren't still in a non-interrupting pre - // - And this isn't the last character. - if (f_character != "." && previous_character_is_fullstop && inline_blue_depth == 0 && !entire_message_is_blue && anim_state != 4 && tick_pos+1 <= f_message.size()) - { - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_emote = m_chatmessage[EMOTE]; - ui_vp_player_char->play_talking(f_char, f_emote); - previous_character_is_fullstop = false; - } - QScrollBar *scroll = ui_vp_message->verticalScrollBar(); scroll->setValue(scroll->maximum()); -- cgit From 56ec03a23a0f687b79d3ce324e517563a41c0032 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sat, 10 Nov 2018 23:08:43 -0600 Subject: Clean up style of merged in code --- courtroom.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 80ebdc80..a8efbcef 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -118,11 +118,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ic_chat_name = new QLineEdit(this); ui_ic_chat_name->setFrame(false); - ui_ic_chat_name->setPlaceholderText("Showname"); + ui_ic_chat_name->setPlaceholderText(tr("Showname")); ui_ic_chat_message = new QLineEdit(this); ui_ic_chat_message->setFrame(false); - ui_ic_chat_message->setPlaceholderText("Message"); + ui_ic_chat_message->setPlaceholderText(tr("Message")); ui_muted = new AOImage(ui_ic_chat_message, ao_app); ui_muted->hide(); @@ -193,15 +193,15 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_guard->hide(); ui_casing = new QCheckBox(this); ui_casing->setChecked(ao_app->get_casing_enabled()); - ui_casing->setText("Casing"); + ui_casing->setText(tr("Casing")); ui_casing->hide(); ui_showname_enable = new QCheckBox(this); ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); - ui_showname_enable->setText("Shownames"); + ui_showname_enable->setText(tr("Shownames")); ui_pre_non_interrupt = new QCheckBox(this); - ui_pre_non_interrupt->setText("No Intrpt"); + ui_pre_non_interrupt->setText(tr("No Intrpt")); ui_pre_non_interrupt->hide(); ui_custom_objection = new AOButton(this, ao_app); -- cgit From 33cae53665ef2a1a0db8cf664faca0faf08770f6 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sat, 10 Nov 2018 23:50:51 -0600 Subject: Merge AOV 2.5.1 into mainline --- courtroom.cpp | 62 +++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 25 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index a8efbcef..dd6bc668 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -877,7 +877,7 @@ void Courtroom::enter_courtroom(int p_cid) QString char_path = ao_app->get_character_path(current_char); if (ao_app->custom_objection_enabled && - file_exists(char_path + "custom.gif") && + (file_exists(char_path + "custom.gif") || file_exists(char_path + "custom.apng")) && file_exists(char_path + "custom.wav")) ui_custom_objection->show(); else @@ -1670,6 +1670,9 @@ void Courtroom::handle_chatmessage_3() void Courtroom::append_ic_text(QString p_text, QString p_name) { + // a bit of a silly hack, should use QListWidget for IC in the first place though + static bool isEmpty = true; + QTextCharFormat bold; QTextCharFormat normal; bold.setFontWeight(QFont::Bold); @@ -1994,13 +1997,13 @@ void Courtroom::play_preanim() preanim_duration = ao2_duration; sfx_delay_timer->start(sfx_delay); - - if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif") || + QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char) + f_preanim.toLower()); + if (!file_exists(anim_to_find) || preanim_duration < 0) { anim_state = 1; preanim_done(); - qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif"; + qDebug() << "could not find " + anim_to_find; return; } @@ -2029,13 +2032,13 @@ void Courtroom::play_noninterrupting_preanim() preanim_duration = ao2_duration; sfx_delay_timer->start(sfx_delay); - - if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif") || + QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char) + f_preanim.toLower()); + if (!file_exists(anim_to_find) || preanim_duration < 0) { anim_state = 4; preanim_done(); - qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif"; + qDebug() << "could not find " + anim_to_find; return; } @@ -2415,7 +2418,7 @@ void Courtroom::play_sfx() if (sfx_name == "1") return; - sfx_player->play(sfx_name + ".wav"); + sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); } void Courtroom::set_scene() @@ -3404,24 +3407,33 @@ void Courtroom::on_spectator_clicked() void Courtroom::on_call_mod_clicked() { - if (!ao_app->modcall_reason_enabled) - { - ao_app->send_server_packet(new AOPacket("ZZ#%")); - ui_ic_chat_message->setFocus(); - return; - } + if (ao_app->modcall_reason_enabled) { + QMessageBox errorBox; + QInputDialog input; - bool ok; - QString text = QInputDialog::getText(ui_viewport, "Call a mod", - "Reason for the modcall (optional):", QLineEdit::Normal, - "", &ok); - if (ok) - { - text = text.left(100); - if (!text.isEmpty()) - ao_app->send_server_packet(new AOPacket("ZZ#" + text + "#%")); - else - ao_app->send_server_packet(new AOPacket("ZZ#%")); + input.setWindowFlags(Qt::WindowSystemMenuHint); + input.setLabelText("Reason:"); + input.setWindowTitle("Call Moderator"); + auto code = input.exec(); + + if (code != QDialog::Accepted) + return; + + QString text = input.textValue(); + if (text.isEmpty()) { + errorBox.critical(nullptr, "Error", "You must provide a reason."); + return; + } else if (text.length() > 256) { + errorBox.critical(nullptr, "Error", "The message is too long."); + return; + } + + QStringList mod_reason; + mod_reason.append(text); + + ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); + } else { + ao_app->send_server_packet(new AOPacket("ZZ#%")); } ui_ic_chat_message->setFocus(); -- cgit From 051c8975eccffc0a0b5b1312e06b2b412590e475 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Thu, 15 Nov 2018 23:56:58 +0100 Subject: added case insensitive path function for those filesystems --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 5c552a12..5c3f966d 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -748,7 +748,7 @@ void Courtroom::list_music() { ui_music_list->addItem(i_song); - QString song_path = ao_app->get_base_path() + "sounds/music/" + i_song.toLower(); + QString song_path = ao_app->get_music_path(i_song); if (file_exists(song_path)) ui_music_list->item(n_listed_songs)->setBackground(found_brush); -- cgit From 8ffdd2afb84ec483160f156d24cf786165a9506c Mon Sep 17 00:00:00 2001 From: David Skoland Date: Fri, 16 Nov 2018 02:01:08 +0100 Subject: refactored path functions and added support for case-sensitive filesystems --- courtroom.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 5c3f966d..372d4b93 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -319,7 +319,7 @@ void Courtroom::set_widgets() //the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene() double y_modifier = 147.0 / 192.0; - int final_y = y_modifier * ui_viewport->height(); + int final_y = static_cast(y_modifier * ui_viewport->height()); ui_vp_legacy_desk->move(0, final_y); ui_vp_legacy_desk->hide(); @@ -620,11 +620,10 @@ void Courtroom::set_background(QString p_background) testimony_in_progress = false; current_background = p_background; - QString bg_path = get_background_path(); - is_ao2_bg = file_exists(bg_path + "defensedesk.png") && - file_exists(bg_path + "prosecutiondesk.png") && - file_exists(bg_path + "stand.png"); + is_ao2_bg = file_exists(ao_app->get_background_path("defensedesk.png")) && + file_exists(ao_app->get_background_path("prosecutiondesk.png")) && + file_exists(ao_app->get_background_path("stand.png")); if (is_ao2_bg) { @@ -696,11 +695,9 @@ void Courtroom::enter_courtroom(int p_cid) ui_prosecution_plus->hide(); } - QString char_path = ao_app->get_character_path(current_char); - if (ao_app->custom_objection_enabled && - file_exists(char_path + "custom.gif") && - file_exists(char_path + "custom.wav")) + file_exists(ao_app->get_character_path(current_char, "custom.gif")) && + file_exists(ao_app->get_character_path(current_char, "custom.wav"))) ui_custom_objection->show(); else ui_custom_objection->hide(); @@ -1197,12 +1194,12 @@ void Courtroom::play_preanim() sfx_delay_timer->start(sfx_delay); - if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif") || + if (!file_exists(ao_app->get_character_path(f_char, f_preanim.toLower() + ".gif")) || preanim_duration < 0) { anim_state = 1; preanim_done(); - qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif"; + qDebug() << "could not find " + ao_app->get_character_path(f_char, f_preanim.toLower() + ".gif"); return; } -- cgit From 727c39a1df42a5aba8a9c863ee2f05169d204ffa Mon Sep 17 00:00:00 2001 From: David Skoland Date: Fri, 16 Nov 2018 02:26:47 +0100 Subject: small fixes and removing compiler warnings --- courtroom.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 372d4b93..e180817f 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1034,11 +1034,11 @@ void Courtroom::handle_chatmessage_2() case 1: case 2: case 6: play_preanim(); break; - default: - qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); - //intentional fallthru case 0: case 5: handle_chatmessage_3(); + break; + default: + qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); } } @@ -1094,15 +1094,11 @@ void Courtroom::handle_chatmessage_3() QString f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; - switch (f_anim_state) - { - case 2: + if (f_anim_state == 2) { ui_vp_player_char->play_talking(f_char, f_emote); anim_state = 2; - break; - default: - qDebug() << "W: invalid anim_state: " << f_anim_state; - case 3: + } + else { ui_vp_player_char->play_idle(f_char, f_emote); anim_state = 3; } @@ -1194,12 +1190,11 @@ void Courtroom::play_preanim() sfx_delay_timer->start(sfx_delay); - if (!file_exists(ao_app->get_character_path(f_char, f_preanim.toLower() + ".gif")) || + if (!file_exists(ao_app->get_character_path(f_char, f_preanim + ".gif")) || preanim_duration < 0) { anim_state = 1; preanim_done(); - qDebug() << "could not find " + ao_app->get_character_path(f_char, f_preanim.toLower() + ".gif"); return; } @@ -1462,12 +1457,14 @@ void Courtroom::set_text_color() ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: yellow"); break; - default: - qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; case WHITE: ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white"); - + break; + default: + ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: white"); + qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; } } -- cgit From 5bf5a228335e4859b61ae1af8558778592395eeb Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sat, 17 Nov 2018 20:12:12 -0600 Subject: Fix compile-time issues from merge --- courtroom.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 88139e18..92b9030e 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -11,7 +11,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() if (ao_app->get_audio_output_device() == "Default") { - BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL); + BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); load_bass_opus_plugin(); } else @@ -21,7 +21,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() if (ao_app->get_audio_output_device() == info.name) { BASS_SetDevice(a); - BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL); + BASS_Init(a, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); load_bass_opus_plugin(); qDebug() << info.name << "was set as the default audio output device."; break; @@ -874,9 +874,9 @@ void Courtroom::enter_courtroom(int p_cid) } if (ao_app->custom_objection_enabled && - (file_exists(ao_app->get_character_path(char_path, "custom.gif")) || - file_exists(ao_app->get_character_path(char_path, "custom.apng"))) && - file_exists(ao_app->get_character_path(char_path, "custom.wav"))) + (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(); @@ -1664,9 +1664,6 @@ void Courtroom::handle_chatmessage_3() void Courtroom::append_ic_text(QString p_text, QString p_name) { - // a bit of a silly hack, should use QListWidget for IC in the first place though - static bool isEmpty = true; - QTextCharFormat bold; QTextCharFormat normal; bold.setFontWeight(QFont::Bold); @@ -1991,7 +1988,7 @@ void Courtroom::play_preanim() preanim_duration = ao2_duration; sfx_delay_timer->start(sfx_delay); - QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char) + f_preanim.toLower()); + QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); if (!file_exists(anim_to_find) || preanim_duration < 0) { @@ -2026,7 +2023,7 @@ void Courtroom::play_noninterrupting_preanim() preanim_duration = ao2_duration; sfx_delay_timer->start(sfx_delay); - QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char) + f_preanim.toLower()); + QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); if (!file_exists(anim_to_find) || preanim_duration < 0) { -- cgit From 1852f9208727dcb139be3d87ca8935a1d69c1f0f Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 25 Nov 2018 13:24:43 -0600 Subject: Overhaul theme The only thing missing in this commit is a new background. I am waiting for a higher-quality version of the AO logo. --- courtroom.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 92b9030e..66e29caf 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -105,17 +105,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_server_chatlog->setReadOnly(true); ui_server_chatlog->setOpenExternalLinks(true); - ui_mute_list = new QListWidget(this); ui_area_list = new QListWidget(this); ui_area_list->hide(); ui_music_list = new QListWidget(this); - ui_pair_list = new QListWidget(this); - ui_pair_offset_spinbox = new QSpinBox(this); - ui_pair_offset_spinbox->setRange(-100,100); - ui_pair_offset_spinbox->setSuffix("% offset"); - ui_pair_button = new AOButton(this, ao_app); - ui_ic_chat_name = new QLineEdit(this); ui_ic_chat_name->setFrame(false); ui_ic_chat_name->setPlaceholderText(tr("Showname")); @@ -140,6 +133,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() //ui_area_password->setFrame(false); ui_music_search = new QLineEdit(this); ui_music_search->setFrame(false); + ui_music_search->setPlaceholderText(tr("Search")); construct_emotes(); @@ -201,7 +195,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_showname_enable->setText(tr("Shownames")); ui_pre_non_interrupt = new QCheckBox(this); - ui_pre_non_interrupt->setText(tr("No Intrpt")); + ui_pre_non_interrupt->setText(tr("No Interrupt")); ui_pre_non_interrupt->hide(); ui_custom_objection = new AOButton(this, ao_app); @@ -241,6 +235,13 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_log_limit_spinbox->setRange(0, 10000); ui_log_limit_spinbox->setValue(ao_app->get_max_log_size()); + ui_mute_list = new QListWidget(this); + ui_pair_list = new QListWidget(this); + ui_pair_offset_spinbox = new QSpinBox(this); + ui_pair_offset_spinbox->setRange(-100,100); + ui_pair_offset_spinbox->setSuffix("% offset"); + ui_pair_button = new AOButton(this, ao_app); + ui_evidence_button = new AOButton(this, ao_app); construct_evidence(); @@ -604,7 +605,7 @@ void Courtroom::set_widgets() ui_switch_area_music->setText("A/M"); set_size_and_pos(ui_pre, "pre"); - ui_pre->setText("Pre"); + ui_pre->setText("Preanim"); set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); set_size_and_pos(ui_flip, "flip"); @@ -706,6 +707,17 @@ void Courtroom::set_fonts() set_font(ui_server_chatlog, "server_chatlog"); set_font(ui_music_list, "music_list"); set_font(ui_area_list, "music_list"); + + // Set color of labels and checkboxes + const QString design_file = "courtroom_fonts.ini"; + QColor f_color = ao_app->get_color("label_color", design_file); + QString color_string = "color: rgba(" + + QString::number(f_color.red()) + ", " + + QString::number(f_color.green()) + ", " + + QString::number(f_color.blue()) + ", 255); }"; + QString style_sheet_string = "QLabel {" + color_string + "}" + "QCheckBox {" + color_string + "}"; + setStyleSheet(style_sheet_string); } void Courtroom::set_font(QWidget *widget, QString p_identifier) -- cgit From 941a32d99caf4406d86b9fc85440c875d4ca5207 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 12 Dec 2018 18:55:16 +0100 Subject: Fixed a bug where your chatlog would completely erase if you had a limit of 0. A limit of zero otherwise means infinite, so no log limit. --- courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 66e29caf..3da69ad8 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1309,7 +1309,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); ic_chatlog_history.append(*temp); - while(ic_chatlog_history.size() > log_maximum_blocks) + while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { ic_chatlog_history.removeFirst(); } @@ -2611,7 +2611,7 @@ void Courtroom::handle_song(QStringList *p_contents) chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true); ic_chatlog_history.append(*temp); - while(ic_chatlog_history.size() > log_maximum_blocks) + while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { ic_chatlog_history.removeFirst(); } -- cgit From c5d983033ec967b644e7ed9bd1a0f5a1b4f428c3 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 12 Dec 2018 19:46:13 +0100 Subject: Merged some duplicate functions. Also brought in another function that specifically filters out inline formatting characters, so that the append IC text function is a bit more understandable. --- courtroom.cpp | 169 ++++++++++++++-------------------------------------------- 1 file changed, 39 insertions(+), 130 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 3da69ad8..7a9d3c55 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1565,13 +1565,13 @@ void Courtroom::handle_chatmessage_2() switch (emote_mod) { case 1: case 2: case 6: - play_preanim(); + play_preanim(false); break; case 0: case 5: if (m_chatmessage[NONINTERRUPTING_PRE].toInt() == 0) handle_chatmessage_3(); else - play_noninterrupting_preanim(); + play_preanim(true); break; default: qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); @@ -1674,15 +1674,8 @@ void Courtroom::handle_chatmessage_3() } -void Courtroom::append_ic_text(QString p_text, QString p_name) +QString Courtroom::filter_ic_text(QString p_text) { - QTextCharFormat bold; - QTextCharFormat normal; - bold.setFontWeight(QFont::Bold); - normal.setFontWeight(QFont::Normal); - const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); - const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); - // Get rid of centering. if(p_text.startsWith(": ~~")) { @@ -1815,85 +1808,10 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) } } - // After all of that, let's jot down the message into the IC chatlog. - - if (log_goes_downwards) - { - const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); - - ui_ic_chatlog->moveCursor(QTextCursor::End); - - if (!first_message_sent) - { - ui_ic_chatlog->textCursor().insertText(p_name, bold); - first_message_sent = true; - } - else - { - ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); - } - - ui_ic_chatlog->textCursor().insertText(p_text, normal); - - // If we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) - { - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deleteChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; - } - - if (old_cursor.hasSelection() || !is_scrolled_down) - { - // The user has selected text or scrolled away from the bottom: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else - { - // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); - } - } - else - { - const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); - - ui_ic_chatlog->moveCursor(QTextCursor::Start); - - ui_ic_chatlog->textCursor().insertText(p_name, bold); - ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); - - // If we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) - { - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deletePreviousChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; - } - - if (old_cursor.hasSelection() || !is_scrolled_up) - { - // The user has selected text or scrolled away from the top: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else - { - // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); - } - } + return p_text; } -// Call it ugly, call it a hack, but I wanted to do something special with the songname changes. -void Courtroom::append_ic_songchange(QString p_songname, QString p_name) +void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchange) { QTextCharFormat bold; QTextCharFormat normal; @@ -1904,6 +1822,9 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); + if (!is_songchange) + p_text = filter_ic_text(p_text); + if (log_goes_downwards) { const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); @@ -1920,8 +1841,15 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); } - ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_songname + ".", italics); + if (is_songchange) + { + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); + } + else + { + ui_ic_chatlog->textCursor().insertText(p_text, normal); + } // If we got too many blocks in the current log, delete some from the top. while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) @@ -1954,8 +1882,15 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->textCursor().insertText(p_name, bold); - ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_songname + "." + '\n', italics); + if (is_songchange) + { + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); + } + else + { + ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + } // If we got too many blocks in the current log, delete some from the bottom. while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) @@ -1982,7 +1917,7 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) } } -void Courtroom::play_preanim() +void Courtroom::play_preanim(bool noninterrupting) { QString f_char = m_chatmessage[CHAR_NAME]; QString f_preanim = m_chatmessage[PRE_EMOTE]; @@ -2004,53 +1939,27 @@ void Courtroom::play_preanim() if (!file_exists(anim_to_find) || preanim_duration < 0) { - anim_state = 1; + if (noninterrupting) + anim_state = 4; + else + anim_state = 1; preanim_done(); qDebug() << "could not find " + anim_to_find; return; } ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); - anim_state = 1; - if (text_delay >= 0) - text_delay_timer->start(text_delay); -} - -void Courtroom::play_noninterrupting_preanim() -{ - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_preanim = m_chatmessage[PRE_EMOTE]; - - //all time values in char.inis are multiplied by a constant(time_mod) to get the actual time - 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; - - int preanim_duration; - - if (ao2_duration < 0) - preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); - else - preanim_duration = ao2_duration; - - 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) || - preanim_duration < 0) - { + if (noninterrupting) anim_state = 4; - preanim_done(); - qDebug() << "could not find " + anim_to_find; - return; - } + else + anim_state = 1; - ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); - anim_state = 4; if (text_delay >= 0) text_delay_timer->start(text_delay); - handle_chatmessage_3(); + if (noninterrupting) + handle_chatmessage_3(); } void Courtroom::preanim_done() @@ -2616,7 +2525,7 @@ void Courtroom::handle_song(QStringList *p_contents) ic_chatlog_history.removeFirst(); } - append_ic_songchange(f_song_clear, str_show); + append_ic_text(f_song_clear, str_show, true); music_player->play(f_song); } } @@ -3476,14 +3385,14 @@ void Courtroom::on_showname_enable_clicked() if (ui_showname_enable->isChecked()) { if (item.get_is_song()) - append_ic_songchange(item.get_message(), item.get_showname()); + append_ic_text(item.get_message(), item.get_showname(), true); else append_ic_text(item.get_message(), item.get_showname()); } else { if (item.get_is_song()) - append_ic_songchange(item.get_message(), item.get_name()); + append_ic_text(item.get_message(), item.get_name(), true); else append_ic_text(item.get_message(), item.get_name()); } -- cgit From 1c6afdce99811525bd703a526041691070b03274 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 13 Dec 2018 11:38:21 +0100 Subject: Fixed a bug where there would be no sound on Windows during the first start. --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 7a9d3c55..f0bdcce2 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -9,7 +9,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() int a = 0; BASS_DEVICEINFO info; - if (ao_app->get_audio_output_device() == "Default") + if (ao_app->get_audio_output_device() == "default") { BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); load_bass_opus_plugin(); -- cgit From 9b8173a1f95919944d222e534f7041cc37cc2e17 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 14 Dec 2018 19:53:53 +0100 Subject: Made case announcement use netcode instead of calling tsuserver commands. --- courtroom.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index f0bdcce2..d1354061 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -3438,29 +3438,28 @@ void Courtroom::on_casing_clicked() if (ao_app->casing_alerts_enabled) { if (ui_casing->isChecked()) - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase" - + " \"" + ao_app->get_casing_can_host_cases() + "\"" - + " " + QString::number(ao_app->get_casing_cm_enabled()) - + " " + QString::number(ao_app->get_casing_defence_enabled()) - + " " + QString::number(ao_app->get_casing_prosecution_enabled()) - + " " + QString::number(ao_app->get_casing_judge_enabled()) - + " " + QString::number(ao_app->get_casing_juror_enabled()) - + " " + QString::number(ao_app->get_casing_steno_enabled()) + ao_app->send_server_packet(new AOPacket("SETCASE#\"" + ao_app->get_casing_can_host_cases() + "\"" + + "#" + QString::number(ao_app->get_casing_cm_enabled()) + + "#" + QString::number(ao_app->get_casing_defence_enabled()) + + "#" + QString::number(ao_app->get_casing_prosecution_enabled()) + + "#" + QString::number(ao_app->get_casing_judge_enabled()) + + "#" + QString::number(ao_app->get_casing_juror_enabled()) + + "#" + QString::number(ao_app->get_casing_steno_enabled()) + "#%")); else - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase \"\" 0 0 0 0 0 0#%")); + ao_app->send_server_packet(new AOPacket("SETCASE#\"\"#0#0#0#0#0#0#%")); } } void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno) { if (ao_app->casing_alerts_enabled) - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/anncase \"" - + title + "\" " - + QString::number(def) + " " - + QString::number(pro) + " " - + QString::number(jud) + " " - + QString::number(jur) + " " + ao_app->send_server_packet(new AOPacket("CASEA#\"" + + title + "\"#" + + QString::number(def) + "#" + + QString::number(pro) + "#" + + QString::number(jud) + "#" + + QString::number(jur) + "#" + QString::number(steno) + "#%")); } -- cgit From 410b865bae2d3f1e61d69c14ed090c6b98540716 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 14 Dec 2018 20:44:22 +0100 Subject: Changed how the new netcodes are built, so they're properly encoded. --- courtroom.cpp | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index d1354061..9472f79b 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -3438,14 +3438,19 @@ void Courtroom::on_casing_clicked() if (ao_app->casing_alerts_enabled) { if (ui_casing->isChecked()) - ao_app->send_server_packet(new AOPacket("SETCASE#\"" + ao_app->get_casing_can_host_cases() + "\"" - + "#" + QString::number(ao_app->get_casing_cm_enabled()) - + "#" + QString::number(ao_app->get_casing_defence_enabled()) - + "#" + QString::number(ao_app->get_casing_prosecution_enabled()) - + "#" + QString::number(ao_app->get_casing_judge_enabled()) - + "#" + QString::number(ao_app->get_casing_juror_enabled()) - + "#" + QString::number(ao_app->get_casing_steno_enabled()) - + "#%")); + { + QStringList f_packet; + + f_packet.append(ao_app->get_casing_can_host_cases()); + f_packet.append(QString::number(ao_app->get_casing_cm_enabled())); + f_packet.append(QString::number(ao_app->get_casing_defence_enabled())); + f_packet.append(QString::number(ao_app->get_casing_prosecution_enabled())); + 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())); + + 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#%")); } @@ -3454,14 +3459,18 @@ void Courtroom::on_casing_clicked() void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno) { if (ao_app->casing_alerts_enabled) - ao_app->send_server_packet(new AOPacket("CASEA#\"" - + title + "\"#" - + QString::number(def) + "#" - + QString::number(pro) + "#" - + QString::number(jud) + "#" - + QString::number(jur) + "#" - + QString::number(steno) - + "#%")); + { + QStringList f_packet; + + f_packet.append(title); + f_packet.append(QString::number(def)); + f_packet.append(QString::number(pro)); + f_packet.append(QString::number(jud)); + f_packet.append(QString::number(jur)); + f_packet.append(QString::number(steno)); + + ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); + } } Courtroom::~Courtroom() -- cgit From 6d1ea9d81fc02fbc481d93af549003db954aa1f7 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sat, 15 Dec 2018 10:56:59 -0600 Subject: Add big ugly hack to fall back jury/seance backgrounds to witness --- courtroom.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'courtroom.cpp') diff --git a/courtroom.cpp b/courtroom.cpp index 9472f79b..249cc160 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2375,12 +2375,14 @@ void Courtroom::set_scene() f_background = "prohelperstand"; f_desk_image = "prohelperdesk"; } - else if (f_side == "jur") + else if (f_side == "jur" && (file_exists(ao_app->get_background_path("jurystand.png")) || + file_exists(ao_app->get_background_path("jurystand.gif")))) { f_background = "jurystand"; f_desk_image = "jurydesk"; } - else if (f_side == "sea") + else if (f_side == "sea" && (file_exists(ao_app->get_background_path("seancestand.png")) || + file_exists(ao_app->get_background_path("seancestand.gif")))) { f_background = "seancestand"; f_desk_image = "seancedesk"; -- cgit