adjusted preanims and added emotions/ao2 feature

This commit is contained in:
David Skoland 2017-02-16 11:48:38 +01:00
parent ca6b1030be
commit c5c7997f41
5 changed files with 20 additions and 13 deletions

View File

@ -111,7 +111,7 @@ void AOCharMovie::frame_change(int n_frame)
if (m_movie->frameCount() - 1 == n_frame && play_once)
{
delay(m_movie->nextFrameDelay());
preanim_timer->start(m_movie->nextFrameDelay());
done();
}
}

View File

@ -14,6 +14,7 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x
connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
}
/*
void AOEmoteButton::set_on(QString p_char, int p_emote)
{
//+1 because programmatical emotes start on 0, while filesystem ones start on 1
@ -31,17 +32,24 @@ void AOEmoteButton::set_on(QString p_char, int p_emote)
this->setStyleSheet("border-image:url(\"\")");
}
}
*/
void AOEmoteButton::set_off(QString p_char, int p_emote)
void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix)
{
QString emotion_number = QString::number(p_emote + 1);
QString image_path = ao_app->get_character_path(p_char) + "emotions/button" + emotion_number + "_off.png";
QString image_path = ao_app->get_character_path(p_char) + "emotions/button" + emotion_number + suffix;
QString alt_path = ao_app->get_character_path(p_char) + "emotions/ao2/button" + emotion_number + suffix;
if (file_exists(image_path))
{
this->setText("");
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
}
else if (file_exists(alt_path))
{
this->setText("");
this->setStyleSheet("border-image:url(\"" + alt_path + "\")");
}
else
{
this->setText(ao_app->get_emote_comment(p_char, p_emote));

View File

@ -12,8 +12,9 @@ class AOEmoteButton : public QPushButton
public:
AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
void set_on(QString p_char, int p_emote);
void set_off(QString p_char, int p_emote);
//void set_on(QString p_char, int p_emote);
//void set_off(QString p_char, int p_emote);
void set_image(QString p_char, int p_emote, QString suffix);
void set_id(int p_id) {m_id = p_id;}
int get_id() {return m_id;}

View File

@ -91,9 +91,9 @@ void Courtroom::set_emote_page()
AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
if (n_real_emote == current_emote)
f_emote->set_on(current_char, n_real_emote);
f_emote->set_image(current_char, n_real_emote, "_on.png");
else
f_emote->set_off(current_char, n_real_emote);
f_emote->set_image(current_char, n_real_emote, "_off.png");
f_emote->show();
}
@ -106,17 +106,15 @@ void Courtroom::on_emote_clicked(int p_id)
int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page;
if (current_emote >= min && current_emote <= max)
ui_emote_list.at(current_emote % max_emotes_on_page)->set_off(current_char, current_emote);
ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off.png");
current_emote = p_id + max_emotes_on_page * current_emote_page;
ui_emote_list.at(current_emote % max_emotes_on_page)->set_on(current_char, current_emote);
ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png");
int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
if (emote_mod == 1 ||
emote_mod == 3 ||
emote_mod == 4)
if (emote_mod == 1)
ui_pre->setChecked(true);
else
ui_pre->setChecked(false);

View File

@ -286,7 +286,7 @@ QString AOApplication::get_pre_emote(QString p_char, int p_emote)
if (result_contents.size() < 4)
{
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
return "normal";
return "";
}
else return result_contents.at(1);
}