aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscatterflower <marisaposs@gameboyprinter.moe>2020-08-16 12:43:26 -0500
committerscatterflower <marisaposs@gameboyprinter.moe>2020-08-16 12:43:26 -0500
commit1c5b097f654d16e0dde47f7ae62d236427077cb7 (patch)
tree3ba86d8cb7dd67a7e1921d93fa7fde13dd2925b7
parente546ead1fa6d0f3c58fd7a429d36e2b2cb65ada5 (diff)
further cleanup of chat handler
-rw-r--r--include/courtroom.h2
-rw-r--r--src/courtroom.cpp58
2 files changed, 35 insertions, 25 deletions
diff --git a/include/courtroom.h b/include/courtroom.h
index a4bacc22..ca271a49 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -648,6 +648,8 @@ private:
void refresh_evidence();
void set_evidence_page();
+ void reset_ic();
+ void reset_ui();
public slots:
void objection_done();
void preanim_done();
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 3b3f6991..bc8405ce 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1762,6 +1762,36 @@ void Courtroom::on_chat_return_pressed()
ao_app->send_server_packet(new AOPacket("MS", packet_contents));
}
+void Courtroom::reset_ic(){
+ ui_vp_chat_arrow->stop();
+ text_state = 0;
+ anim_state = 0;
+ ui_vp_objection->stop();
+ chat_tick_timer->stop();
+ ui_vp_evidence_display->reset();
+}
+
+void Courtroom::reset_ui(){
+ if (m_chatmessage[CHAR_ID].toInt() == m_cid) {
+ ui_ic_chat_message->clear();
+ if (ui_additive->isChecked())
+ ui_ic_chat_message->insert(" ");
+ objection_state = 0;
+ realization_state = 0;
+ screenshake_state = 0;
+ is_presenting_evidence = false;
+ if (!ao_app->is_stickypres_enabled())
+ ui_pre->setChecked(false);
+ ui_hold_it->set_image("holdit");
+ ui_objection->set_image("objection");
+ ui_take_that->set_image("takethat");
+ ui_custom_objection->set_image("custom");
+ ui_realization->set_image("realization");
+ ui_screenshake->set_image("screenshake");
+ ui_evidence_present->set_image("present");
+ }
+}
+
void Courtroom::handle_chatmessage(QStringList *p_contents)
{
// Instead of checking for whether a message has at least chatmessage_size
@@ -1818,32 +1848,10 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
}
// Reset IC display
- ui_vp_chat_arrow->stop();
- text_state = 0;
- anim_state = 0;
- ui_vp_objection->stop();
- chat_tick_timer->stop();
- ui_vp_evidence_display->reset();
+ reset_ic();
// Reset UI elements after client message gets sent
- if (m_chatmessage[CHAR_ID].toInt() == m_cid) {
- ui_ic_chat_message->clear();
- if (ui_additive->isChecked())
- ui_ic_chat_message->insert(" ");
- objection_state = 0;
- realization_state = 0;
- screenshake_state = 0;
- is_presenting_evidence = false;
- if (!ao_app->is_stickypres_enabled())
- ui_pre->setChecked(false);
- ui_hold_it->set_image("holdit");
- ui_objection->set_image("objection");
- ui_take_that->set_image("takethat");
- ui_custom_objection->set_image("custom");
- ui_realization->set_image("realization");
- ui_screenshake->set_image("screenshake");
- ui_evidence_present->set_image("present");
- }
+ reset_ui();
// Let the server handle actually checking if they're allowed to do this.
is_additive = m_chatmessage[ADDITIVE].toInt() == 1;
@@ -1870,7 +1878,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
color_rgb_list.append(color);
}
- append_ic_text(m_chatmessage[MESSAGE], f_showname, "", m_chatmessage[TEXT_COLOR].toInt());
+ append_ic_text(m_chatmessage[MESSAGE], f_displayname, "", m_chatmessage[TEXT_COLOR].toInt());
// if an objection is used
if (objection_mod <= 4 && objection_mod >= 1) {