final commit

This commit is contained in:
iamgoofball 2019-01-21 15:45:51 -08:00
parent debd386a71
commit a7a614482e
7 changed files with 44 additions and 7 deletions

View File

@ -166,6 +166,10 @@ public:
// from the config.ini. // from the config.ini.
bool is_discord_enabled(); 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 // Returns the value of the maximum amount of lines the IC chatlog
// may contain, from config.ini. // may contain, from config.ini.
int get_max_log_size(); int get_max_log_size();

View File

@ -64,6 +64,7 @@ private:
bool m_flipped = false; bool m_flipped = false;
bool play_once = true; bool play_once = true;
bool apng = false;
signals: signals:
void done(); void done();

View File

@ -55,6 +55,8 @@ private:
QLineEdit *ui_ms_textbox; QLineEdit *ui_ms_textbox;
QLabel *ui_discord_lbl; QLabel *ui_discord_lbl;
QCheckBox *ui_discord_cb; QCheckBox *ui_discord_cb;
QLabel *ui_epilepsy_lbl;
QCheckBox *ui_epilepsy_cb;
QWidget *ui_callwords_tab; QWidget *ui_callwords_tab;
QWidget *ui_callwords_widget; QWidget *ui_callwords_widget;

View File

@ -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) 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 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 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"); 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_emote = emote_prefix + p_emote;
current_char = p_char; current_char = p_char;
if (file_exists(apng_path)) if (file_exists(apng_path))
{
gif_path = apng_path; gif_path = apng_path;
apng = true;
}
else if (file_exists(original_path)) else if (file_exists(original_path))
gif_path = original_path; gif_path = original_path;
else if (file_exists(alt_path)) else if (file_exists(alt_path))
@ -145,6 +149,9 @@ void AOCharMovie::sfx_two_network_boogaloo()
void AOCharMovie::movie_ticker() void AOCharMovie::movie_ticker()
{ {
if(apng){
ticker->start(m_movie->nextFrameDelay());
}
if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1) if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1)
{ {
delete m_movie; delete m_movie;
@ -165,12 +172,12 @@ 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 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 // ps: fuck private functions/variables as a concept, freedom 2 do dangerous things 5ever
this->play_frame_sfx(); this->play_frame_sfx();
qDebug() << "Current frame number: " << m_movie->currentFrameNumber(); if(!apng){
qDebug() << "Frames Left: " << m_movie->frameCount() - 1;
qDebug() << "Frame Delay: " << m_movie->nextFrameDelay();
ticker->start(m_movie->nextFrameDelay()); ticker->start(m_movie->nextFrameDelay());
} }
}
void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image) void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image)
{ {
QPixmap f_pixmap; QPixmap f_pixmap;

View File

@ -167,6 +167,17 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb); 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. // Here we start the callwords tab.
ui_callwords_tab = new QWidget(); ui_callwords_tab = new QWidget();
ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); 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("show_custom_shownames", ui_showname_cb->isChecked());
configini->setValue("master", ui_ms_textbox->text()); configini->setValue("master", ui_ms_textbox->text());
configini->setValue("discord", ui_discord_cb->isChecked()); 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"); QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");

View File

@ -1752,6 +1752,8 @@ void Courtroom::handle_chatmessage_2()
void Courtroom::doScreenShake() void Courtroom::doScreenShake()
{ {
if(!ao_app->is_shakeandflash_enabled())
return;
screenshake_group = new QParallelAnimationGroup; screenshake_group = new QParallelAnimationGroup;
screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this); screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this);
chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this); chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this);
@ -2197,6 +2199,8 @@ void Courtroom::realization_done()
void Courtroom::doRealization() void Courtroom::doRealization()
{ {
if(!ao_app->is_shakeandflash_enabled())
return;
realization_timer->start(60); realization_timer->start(60);
ui_vp_realization->show(); ui_vp_realization->show();

View File

@ -10,8 +10,8 @@ int AOApplication::read_blip_rate()
{ {
int result = configini->value("blip_rate", 2).toInt(); int result = configini->value("blip_rate", 2).toInt();
if (result < 2) if (result < 1)
return 2; return 1;
return result; return result;
} }
@ -632,7 +632,7 @@ bool AOApplication::get_looping_sfx()
bool AOApplication::get_objectmusic() bool AOApplication::get_objectmusic()
{ {
QString result = configini->value("kill_music_on_object", "true").value<QString>(); QString result = configini->value("kill_music_on_object", "false").value<QString>();
return result.startsWith("true"); return result.startsWith("true");
} }
@ -642,6 +642,13 @@ bool AOApplication::is_discord_enabled()
return result.startsWith("true"); return result.startsWith("true");
} }
bool AOApplication::is_shakeandflash_enabled()
{
QString result = configini->value("shakeandflash", "true").value<QString>();
return result.startsWith("true");
}
bool AOApplication::get_casing_enabled() bool AOApplication::get_casing_enabled()
{ {
QString result = configini->value("casing_enabled", "false").value<QString>(); QString result = configini->value("casing_enabled", "false").value<QString>();