Fix bug with simultaneous shakes

This commit is contained in:
iamgoofball 2019-01-18 22:05:21 -08:00 committed by oldmud0
parent 3c0cedbe92
commit 248444307f
3 changed files with 24 additions and 6 deletions

View File

@ -319,7 +319,7 @@ public:
private: private:
const int RELEASE = 2; const int RELEASE = 2;
const int MAJOR_VERSION = 7; const int MAJOR_VERSION = 7;
const int MINOR_VERSION = 0; const int MINOR_VERSION = 1;
QString current_theme = "default"; QString current_theme = "default";

View File

@ -124,7 +124,7 @@ public:
//reads theme inis and sets size and pos based on the identifier //reads theme inis and sets size and pos based on the identifier
void set_size_and_pos(QWidget *p_widget, QString p_identifier); void set_size_and_pos(QWidget *p_widget, QString p_identifier);
QPoint get_theme_pos(QString p_identifier);
//sets status as taken on character with cid n_char and places proper shading on charselect //sets status as taken on character with cid n_char and places proper shading on charselect
void set_taken(int n_char, bool p_taken); void set_taken(int n_char, bool p_taken);

View File

@ -776,6 +776,24 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
} }
} }
QPoint Courtroom::get_theme_pos(QString p_identifier)
{
QString filename = "courtroom_design.ini";
pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename);
if (design_ini_result.width < 0 || design_ini_result.height < 0)
{
qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename;
return QPoint(0,0);
}
else
{
return QPoint(design_ini_result.x, design_ini_result.y);
}
}
void Courtroom::set_taken(int n_char, bool p_taken) void Courtroom::set_taken(int n_char, bool p_taken)
{ {
if (n_char >= char_list.size()) if (n_char >= char_list.size())
@ -1731,8 +1749,8 @@ void Courtroom::doScreenShake()
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);
int screen_x = ui_viewport->x(); int screen_x = get_theme_pos("viewport").x();
int screen_y = ui_viewport->y(); int screen_y = get_theme_pos("viewport").y();
QPoint pos_default = QPoint(screen_x, screen_y); QPoint pos_default = QPoint(screen_x, screen_y);
QPoint pos1 = QPoint(screen_x + 3, screen_y + -5); QPoint pos1 = QPoint(screen_x + 3, screen_y + -5);
QPoint pos2 = QPoint(screen_x + 3, screen_y + -5); QPoint pos2 = QPoint(screen_x + 3, screen_y + -5);
@ -1740,8 +1758,8 @@ void Courtroom::doScreenShake()
QPoint pos4 = QPoint(screen_x + 3, screen_y + -5); QPoint pos4 = QPoint(screen_x + 3, screen_y + -5);
QPoint pos5 = QPoint(screen_x + -3,screen_y + -5); QPoint pos5 = QPoint(screen_x + -3,screen_y + -5);
int chatbox_x = ui_vp_chatbox->x(); int chatbox_x = get_theme_pos("ao2_chatbox").x();
int chatbox_y = ui_vp_chatbox->y(); int chatbox_y = get_theme_pos("ao2_chatbox").y();
QPoint chatbox_pos_default = QPoint(chatbox_x, chatbox_y); QPoint chatbox_pos_default = QPoint(chatbox_x, chatbox_y);
QPoint chatbox_pos1 = QPoint(chatbox_x + 3, chatbox_y + -5); QPoint chatbox_pos1 = QPoint(chatbox_x + 3, chatbox_y + -5);
QPoint chatbox_pos2 = QPoint(chatbox_x + 3, chatbox_y + -5); QPoint chatbox_pos2 = QPoint(chatbox_x + 3, chatbox_y + -5);