diff --git a/include/aoapplication.h b/include/aoapplication.h index 2ae1655..7a5e633 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -166,6 +166,10 @@ public: // from the config.ini. bool is_discord_enabled(); + // Returns the value of whether shaking and flashing should be enabled. + // from the config.ini. + bool is_shakeandflash_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/aocharmovie.h b/include/aocharmovie.h index 94e242b..6c127a6 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -64,6 +64,7 @@ private: bool m_flipped = false; bool play_once = true; + bool apng = false; signals: void done(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 03b1e71..175b804 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -55,6 +55,8 @@ private: QLineEdit *ui_ms_textbox; QLabel *ui_discord_lbl; QCheckBox *ui_discord_cb; + QLabel *ui_epilepsy_lbl; + QCheckBox *ui_epilepsy_cb; QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index cbf9b79..3d65055 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -18,6 +18,7 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { + apng = false; QString original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif"); QString alt_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".png"); QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng"); @@ -27,7 +28,10 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) current_emote = emote_prefix + p_emote; current_char = p_char; if (file_exists(apng_path)) + { gif_path = apng_path; + apng = true; + } else if (file_exists(original_path)) gif_path = original_path; else if (file_exists(alt_path)) @@ -145,6 +149,9 @@ void AOCharMovie::sfx_two_network_boogaloo() void AOCharMovie::movie_ticker() { + if(apng){ + ticker->start(m_movie->nextFrameDelay()); + } if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1) { delete m_movie; @@ -165,10 +172,10 @@ void AOCharMovie::movie_ticker() this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage()); // imagine if QT had sane stuff like "mirror on QMovie" or "resize the image on QT" or "interface with the current QMovie image" or anything else // ps: fuck private functions/variables as a concept, freedom 2 do dangerous things 5ever this->play_frame_sfx(); - qDebug() << "Current frame number: " << m_movie->currentFrameNumber(); - qDebug() << "Frames Left: " << m_movie->frameCount() - 1; - qDebug() << "Frame Delay: " << m_movie->nextFrameDelay(); - ticker->start(m_movie->nextFrameDelay()); + if(!apng){ + ticker->start(m_movie->nextFrameDelay()); + } + } void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 4d0e479..247a231 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -167,6 +167,17 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb); + ui_epilepsy_lbl = new QLabel(ui_form_layout_widget); + ui_epilepsy_lbl->setText(tr("Allow Shake/Flash:")); + ui_epilepsy_lbl->setToolTip(tr("Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); + + ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_epilepsy_lbl); + + ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget); + ui_epilepsy_cb->setChecked(ao_app->is_shakeandflash_enabled()); + + ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_epilepsy_cb); + // Here we start the callwords tab. ui_callwords_tab = new QWidget(); ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); @@ -486,6 +497,7 @@ void AOOptionsDialog::save_pressed() configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); configini->setValue("master", ui_ms_textbox->text()); configini->setValue("discord", ui_discord_cb->isChecked()); + configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a097444..537558f 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1752,6 +1752,8 @@ void Courtroom::handle_chatmessage_2() void Courtroom::doScreenShake() { + if(!ao_app->is_shakeandflash_enabled()) + return; screenshake_group = new QParallelAnimationGroup; screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this); chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this); @@ -2197,6 +2199,8 @@ void Courtroom::realization_done() void Courtroom::doRealization() { + if(!ao_app->is_shakeandflash_enabled()) + return; realization_timer->start(60); ui_vp_realization->show(); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 6bc66d0..68d0a04 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -10,8 +10,8 @@ int AOApplication::read_blip_rate() { int result = configini->value("blip_rate", 2).toInt(); - if (result < 2) - return 2; + if (result < 1) + return 1; return result; } @@ -632,7 +632,7 @@ bool AOApplication::get_looping_sfx() bool AOApplication::get_objectmusic() { - QString result = configini->value("kill_music_on_object", "true").value(); + QString result = configini->value("kill_music_on_object", "false").value(); return result.startsWith("true"); } @@ -642,6 +642,13 @@ bool AOApplication::is_discord_enabled() return result.startsWith("true"); } +bool AOApplication::is_shakeandflash_enabled() +{ + QString result = configini->value("shakeandflash", "true").value(); + return result.startsWith("true"); +} + + bool AOApplication::get_casing_enabled() { QString result = configini->value("casing_enabled", "false").value();