diff options
| author | iamgoofball <iamgoofball@gmail.com> | 2019-01-18 22:05:21 -0800 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2019-01-19 00:13:25 -0600 |
| commit | 248444307ff7cbe87ec4fe4024073cddb999dabc (patch) | |
| tree | 81a619370f1c917bb81212cf0efd30f63464e3d5 | |
| parent | 3c0cedbe922c9fcacd0d171423f83e375f66e178 (diff) | |
Fix bug with simultaneous shakes
| -rw-r--r-- | include/aoapplication.h | 2 | ||||
| -rw-r--r-- | include/courtroom.h | 2 | ||||
| -rw-r--r-- | src/courtroom.cpp | 26 |
3 files changed, 24 insertions, 6 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index cff0afb4..2ae1655e 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -319,7 +319,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 7; - const int MINOR_VERSION = 0; + const int MINOR_VERSION = 1; QString current_theme = "default"; diff --git a/include/courtroom.h b/include/courtroom.h index 3f93e4c5..7d2a5513 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -124,7 +124,7 @@ public: //reads theme inis and sets size and pos based on the 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 void set_taken(int n_char, bool p_taken); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ab387da6..ce4ccf1d 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -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) { if (n_char >= char_list.size()) @@ -1731,8 +1749,8 @@ void Courtroom::doScreenShake() screenshake_group = new QParallelAnimationGroup; screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this); chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this); - int screen_x = ui_viewport->x(); - int screen_y = ui_viewport->y(); + int screen_x = get_theme_pos("viewport").x(); + int screen_y = get_theme_pos("viewport").y(); QPoint pos_default = QPoint(screen_x, screen_y); QPoint pos1 = 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 pos5 = QPoint(screen_x + -3,screen_y + -5); - int chatbox_x = ui_vp_chatbox->x(); - int chatbox_y = ui_vp_chatbox->y(); + int chatbox_x = get_theme_pos("ao2_chatbox").x(); + int chatbox_y = get_theme_pos("ao2_chatbox").y(); QPoint chatbox_pos_default = QPoint(chatbox_x, chatbox_y); QPoint chatbox_pos1 = QPoint(chatbox_x + 3, chatbox_y + -5); QPoint chatbox_pos2 = QPoint(chatbox_x + 3, chatbox_y + -5); |
