From 26ea00e7fc56b7e1885aab1f59b410cfbaa2e2bc Mon Sep 17 00:00:00 2001 From: Skoland Date: Sun, 19 Feb 2017 01:53:59 +0100 Subject: [PATCH] added adjustable blip rate and judge buttons on /pos jud --- Attorney_Online_remake.pro | 2 +- aoapplication.h | 4 ++- aocharmovie.cpp | 9 ++++--- courtroom.cpp | 37 +++++++++++++++++++++++++-- courtroom.h | 3 +++ lobby.cpp | 1 + text_file_functions.cpp | 52 ++++++++++++++++++++++++++++++-------- 7 files changed, 91 insertions(+), 17 deletions(-) diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index 96282fe..71850fa 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -13,7 +13,7 @@ RC_ICONS = logo.ico TARGET = Attorney_Online_remake TEMPLATE = app -VERSION = 2.2.0.0 +VERSION = 2.2.1.0 SOURCES += main.cpp\ lobby.cpp \ diff --git a/aoapplication.h b/aoapplication.h index 136990f..cee9174 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -96,7 +96,9 @@ public: QString get_evidence_path(); //implementation in text_file_functions.cpp + QString read_config(QString searchline); QString read_user_theme(); + int read_blip_rate(); void write_to_serverlist_txt(QString p_line); QVector read_serverlist_txt(); pos_size_type get_element_dimensions(QString p_identifier, QString p_file); @@ -123,7 +125,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 2; - const int MINOR_VERSION = 0; + const int MINOR_VERSION = 1; QString user_theme = "default"; diff --git a/aocharmovie.cpp b/aocharmovie.cpp index a596e53..ddce3f2 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -97,13 +97,16 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) } qDebug() << "% mod: " << percentage_modifier; - if (full_duration < real_duration) + if (full_duration == 0 || full_duration >= real_duration) + { + play_once = true; + } + else { play_once = false; preanim_timer->start(full_duration); } - else - play_once = true; + m_movie->setSpeed(static_cast(percentage_modifier)); play(p_char, p_emote, ""); diff --git a/courtroom.cpp b/courtroom.cpp index 64f1317..b9d6f5f 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -328,6 +328,8 @@ void Courtroom::set_mute_list() void Courtroom::set_widgets() { + blip_rate = ao_app->read_blip_rate(); + QString filename = "courtroom_design.ini"; pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename); @@ -1254,6 +1256,7 @@ void Courtroom::start_chat_ticking() ui_vp_chatbox->show(); tick_pos = 0; + blip_pos = 0; chat_tick_timer->start(chat_tick_interval); QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); @@ -1282,14 +1285,22 @@ void Courtroom::chat_tick() else { ui_vp_message->insertPlainText(f_message.at(tick_pos)); - //ui_vp_message->app QScrollBar *scroll = ui_vp_message->verticalScrollBar(); scroll->setValue(scroll->maximum()); scroll->hide(); if (f_message.at(tick_pos) != ' ') - blip_player->blip_tick(); + { + + if (blip_pos % blip_rate == 0) + { + blip_pos = 0; + blip_player->blip_tick(); + } + + ++blip_pos; + } ++tick_pos; } @@ -1531,6 +1542,28 @@ void Courtroom::on_ooc_return_pressed() if (ui_ooc_chat_message->text() == "" || ui_ooc_chat_name->text() == "") return; + if (ui_ooc_chat_message->text().startsWith("/pos")) + { + if (ui_ooc_chat_message->text().startsWith("/pos jud")) + { + ui_witness_testimony->show(); + ui_cross_examination->show(); + ui_defense_minus->show(); + ui_defense_plus->show(); + ui_prosecution_minus->show(); + ui_prosecution_plus->show(); + } + else + { + ui_witness_testimony->hide(); + ui_cross_examination->hide(); + ui_defense_minus->hide(); + ui_defense_plus->hide(); + ui_prosecution_minus->hide(); + ui_prosecution_plus->hide(); + } + } + //cheap, but it works if (ui_ooc_chat_message->text().startsWith("/login")) ui_guard->show(); diff --git a/courtroom.h b/courtroom.h index 10d387e..1fddb2a 100644 --- a/courtroom.h +++ b/courtroom.h @@ -119,6 +119,9 @@ private: int chat_tick_interval = 60; //which tick position(character in chat message) we are at int tick_pos = 0; + //used to determine how often blips sound + int blip_pos = 0; + int blip_rate = 1; //delay before chat messages starts ticking QTimer *text_delay_timer; diff --git a/lobby.cpp b/lobby.cpp index 5d69e9c..5e2b120 100644 --- a/lobby.cpp +++ b/lobby.cpp @@ -35,6 +35,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_progress_bar = new QProgressBar(ui_loading_background); ui_progress_bar->setMinimum(0); ui_progress_bar->setMaximum(100); + ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }"); ui_cancel = new AOButton(ui_loading_background, ao_app); connect(ui_public_servers, SIGNAL(clicked()), this, SLOT(on_public_servers_clicked())); diff --git a/text_file_functions.cpp b/text_file_functions.cpp index 857201a..eaf7f1c 100644 --- a/text_file_functions.cpp +++ b/text_file_functions.cpp @@ -7,27 +7,59 @@ #include #include -QString AOApplication::read_user_theme(){ +QString AOApplication::read_config(QString searchline) +{ + QString return_value = ""; + QFile config_file(get_base_path() + "config.ini"); if (!config_file.open(QIODevice::ReadOnly)) - return "default"; + return return_value; QTextStream in(&config_file); while(!in.atEnd()) { - QString line = in.readLine(); + QString f_line = in.readLine(); - if (line.startsWith("theme")) - { - QStringList line_elements = line.split("="); + if (!f_line.startsWith(searchline)) + continue; - if (line_elements.size() > 1) - return line_elements.at(1).trimmed(); - } + QStringList line_elements = f_line.split("="); + + if (line_elements.at(0).trimmed() != searchline) + continue; + + if (line_elements.size() < 2) + continue; + + return_value = line_elements.at(1).trimmed(); + break; } - return "default"; + config_file.close(); + + return return_value; +} + +QString AOApplication::read_user_theme() +{ + QString result = read_config("theme"); + + if (result == "") + return "default"; + else + return result; +} + +int AOApplication::read_blip_rate() +{ + QString result = read_config("blip_rate"); + + //note: the empty string converted to int will return 0 + if (result.toInt() <= 0) + return 1; + else + return result.toInt(); } void AOApplication::write_to_serverlist_txt(QString p_line)