diff options
| -rw-r--r-- | include/aoapplication.h | 5 | ||||
| -rw-r--r-- | include/aomusicplayer.h | 4 | ||||
| -rw-r--r-- | include/aooptionsdialog.h | 3 | ||||
| -rw-r--r-- | src/aomusicplayer.cpp | 25 | ||||
| -rw-r--r-- | src/aooptionsdialog.cpp | 15 | ||||
| -rw-r--r-- | src/courtroom.cpp | 44 | ||||
| -rw-r--r-- | src/lobby.cpp | 2 | ||||
| -rw-r--r-- | src/text_file_functions.cpp | 8 |
8 files changed, 74 insertions, 32 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index 18f6ef24..af357d0c 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -200,6 +200,11 @@ public: // from the config.ini. bool is_stickypres_enabled(); + // Returns the value of whether custom chatboxes should be a thing. + // from the config.ini. + // I am increasingly maddened by the lack of dynamic auto-generation system for settings. + bool is_customchat_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index de673e5e..82751b68 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -25,8 +25,8 @@ public: const int m_channelmax = 4; // These have to be public for the stupid sync thing - int loop_start = 0; - int loop_end = 0; + int loop_start[4] = {0, 0, 0, 0}; + int loop_end[4] = {0, 0, 0, 0}; public slots: void play(QString p_song, int channel = 0, bool loop = false, diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 7e983a3f..06684ef4 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -78,6 +78,9 @@ private: QLabel *ui_stickypres_lbl; QCheckBox *ui_stickypres_cb; + QLabel *ui_customchat_lbl; + QCheckBox *ui_customchat_cb; + QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; QVBoxLayout *ui_callwords_layout; diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 8ba16418..249e01e5 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -40,8 +40,8 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop, QString d_path = f_path + ".txt"; - loop_start = 0; - loop_end = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); + loop_start[channel] = 0; + loop_end[channel] = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); if (loop && file_exists(d_path)) // Contains loop/etc. information file { QStringList lines = ao_app->read_file(d_path).split("\n"); @@ -64,11 +64,11 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop, QWORD bytes = static_cast<QWORD>(args[1].trimmed().toFloat() * sample_size * num_channels); if (arg == "loop_start") - loop_start = bytes; + loop_start[channel] = bytes; else if (arg == "loop_length") - loop_end = loop_start + bytes; + loop_end[channel] = loop_start[channel] + bytes; else if (arg == "loop_end") - loop_end = bytes; + loop_end[channel] = bytes; } qDebug() << "Found data file for song" << p_song << "length" << BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start" @@ -111,7 +111,7 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop, else this->set_volume(m_volume[channel], channel); - this->set_looping(loop); // Have to do this here due to any + this->set_looping(loop, channel); // Have to do this here due to any // crossfading-related changes, etc. } @@ -145,6 +145,7 @@ void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) void AOMusicPlayer::set_looping(bool toggle, int channel) { + qDebug() << "Setting looping for channel" << channel << "to" << toggle; m_looping = toggle; if (!m_looping) { if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) @@ -161,13 +162,13 @@ void AOMusicPlayer::set_looping(bool toggle, int channel) loop_sync[channel]); // remove the sync loop_sync[channel] = 0; } - if (loop_start > 0) { - if (loop_end == 0) - loop_end = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); - if (loop_end > 0) // Don't loop zero length songs even if we're asked to + if (loop_start[channel] > 0) { + if (loop_end[channel] == 0) + loop_end[channel] = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); + if (loop_end[channel] > 0) // Don't loop zero length songs even if we're asked to loop_sync[channel] = BASS_ChannelSetSync( - m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, - loopProc, &loop_start); + m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end[channel], + loopProc, &loop_start[channel]); } } } diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 80746f79..e6ff8ff7 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -313,6 +313,20 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickypres_cb); + row += 1; + ui_customchat_lbl = new QLabel(ui_form_layout_widget); + ui_customchat_lbl->setText(tr("Custom Chatboxes:")); + ui_customchat_lbl->setToolTip( + tr("Turn this on to allow characters to define their own " + "custom chat box designs.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_customchat_lbl); + + ui_customchat_cb = new QCheckBox(ui_form_layout_widget); + ui_customchat_cb->setChecked(ao_app->is_customchat_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_customchat_cb); + QScrollArea *scroll = new QScrollArea; scroll->setWidget(ui_form_layout_widget); ui_gameplay_tab->setLayout(new QVBoxLayout); @@ -708,6 +722,7 @@ void AOOptionsDialog::save_pressed() configini->setValue("stickysounds", ui_stickysounds_cb->isChecked()); configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked()); configini->setValue("stickypres", ui_stickypres_cb->isChecked()); + configini->setValue("customchat", ui_customchat_cb->isChecked()); QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 7a38b942..55b851e3 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1883,30 +1883,35 @@ void Courtroom::handle_chatmessage_2() QString chatbox_path = ao_app->get_theme_path("chat"); QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); - if (chatbox != "") { + QString customchar; + if (ao_app->is_customchat_enabled()) + customchar = m_chatmessage[CHAR_NAME]; + + if (chatbox != "" && ao_app->is_customchat_enabled()) { chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; if (!ui_vp_chatbox->set_chatbox(chatbox_path)) ui_vp_chatbox->set_chatbox(chatbox_path + "box"); + } - pos_size_type design_ini_result = ao_app->get_element_dimensions( - "chat_arrow", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); - if (design_ini_result.width < 0 || design_ini_result.height < 0) { - qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; - ui_vp_chat_arrow->hide(); - } - else { - ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); - ui_vp_chat_arrow->combo_resize(design_ini_result.width, - design_ini_result.height); - } + //This should probably be called only if any change from the last chat arrow was actually detected. + pos_size_type design_ini_result = ao_app->get_element_dimensions( + "chat_arrow", "courtroom_design.ini", customchar); + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; + ui_vp_chat_arrow->hide(); + } + else { + ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); + ui_vp_chat_arrow->combo_resize(design_ini_result.width, + design_ini_result.height); } pos_size_type default_width = ao_app->get_element_dimensions( - "showname", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); + "showname", "courtroom_design.ini", customchar); int extra_width = ao_app ->get_design_element("showname_extra_width", "courtroom_design.ini", - m_chatmessage[CHAR_NAME]) + customchar) .toInt(); if (extra_width > 0) { @@ -2692,8 +2697,13 @@ void Courtroom::chat_tick() ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); } - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_chat(f_char); + QString f_char; + QString f_custom_theme; + if (ao_app->is_customchat_enabled()) + { + f_char = m_chatmessage[CHAR_NAME]; + f_custom_theme = ao_app->get_chat(f_char); + } ui_vp_chat_arrow->play( "chat_arrow", f_char, f_custom_theme); // Chat stopped being processed, indicate that. @@ -4236,7 +4246,7 @@ void Courtroom::set_text_color_dropdown() // Update markdown colors. TODO: make a loading function that only loads the // config file once instead of several times for (int c = 0; c < max_colors; ++c) { - QColor color = ao_app->get_chat_color(QString::number(c), current_char); + QColor color = ao_app->get_chat_color("c" + QString::number(c), current_char); color_rgb_list.append(color); color_markdown_start_list.append(ao_app->get_chat_markdown( "c" + QString::number(c) + "_start", current_char)); diff --git a/src/lobby.cpp b/src/lobby.cpp index 613bee57..3d47416b 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -370,6 +370,8 @@ void Lobby::on_about_clicked() "<p><b>Major development:</b><br>" "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, " "Crystalwarrior, Iamgoofball" + "<p><b>Client development:</b><br>" + "Cents02, in1tiate, raidensnake, windrammer" "<p><b>QA testing:</b><br>" "CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, " "Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, " diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 4ea58d6b..122bc412 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -601,7 +601,7 @@ QString AOApplication::get_gender(QString p_char) QString f_result = read_char_ini(p_char, "gender", "Options"); if (f_result == "") - return "sfx-blipmale"; + f_result = "male"; if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result)))) @@ -988,6 +988,12 @@ bool AOApplication::is_stickypres_enabled() return result.startsWith("true"); } +bool AOApplication::is_customchat_enabled() +{ + QString result = configini->value("customchat", "true").value<QString>(); + return result.startsWith("true"); +} + bool AOApplication::get_casing_enabled() { QString result = configini->value("casing_enabled", "false").value<QString>(); |
