aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2019-09-24 00:38:26 +0300
committerCrystalwarrior <varsash@gmail.com>2019-09-24 00:38:26 +0300
commitd8857aa2e48c89a5002f8511ce566df9c557598e (patch)
tree2602b05ad3ec0bc0300bff5e068bda46fe5c3c50
parent398f37794facc239153a8c21e0630d2eb7850739 (diff)
When the background is changed, display it in the correct position as dictated by the server packets
Add a new "set pos" packet Udpate the pos dropdown according to the current pos
-rw-r--r--include/courtroom.h4
-rw-r--r--src/courtroom.cpp52
-rw-r--r--src/packet_distribution.cpp12
3 files changed, 58 insertions, 10 deletions
diff --git a/include/courtroom.h b/include/courtroom.h
index 59e97dd3..26018e2c 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -150,6 +150,9 @@ public:
//sets the current background to argument. also does some checks to see if it's a legacy bg
void set_background(QString p_background);
+ //sets the local character pos/side to use.
+ void set_side(QString p_side);
+
//sets the evidence list member variable to argument
void set_evidence_list(QVector<evi_type> &p_evi_list);
@@ -412,6 +415,7 @@ private:
bool server_ooc = true;
QString current_background = "default";
+ QString current_side = "";
AOMusicPlayer *music_player;
AOSfxPlayer *sfx_player;
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 0c963c86..8896335e 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1005,15 +1005,44 @@ void Courtroom::set_background(QString p_background)
set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
}
-// ui_vp_speedlines->stop();
-// ui_vp_player_char->stop();
-// ui_vp_sideplayer_char->stop();
-// ui_vp_effect->stop();
-// ui_vp_message->hide();
-// ui_vp_chatbox->hide();
-// set_scene(ao_app->get_char_side(current_char), QString::number(ao_app->get_desk_mod(current_char, current_emote)));
+ ui_vp_speedlines->stop();
+ ui_vp_player_char->stop();
+ ui_vp_sideplayer_char->stop();
+ ui_vp_effect->stop();
+ ui_vp_message->hide();
+ ui_vp_chatbox->hide();
+ set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side);
}
+void Courtroom::set_side(QString p_side)
+{
+ if (p_side == "")
+ current_side = ao_app->get_char_side(current_char);
+ else
+ current_side = p_side;
+
+ qDebug() << current_side;
+ for (int i = 0; i < ui_pos_dropdown->count(); ++i)
+ {
+ QString pos = ui_pos_dropdown->itemText(i);
+ if (pos == current_side)
+ {
+ //Block the signals to prevent setCurrentIndex from triggering a pos change
+ ui_pos_dropdown->blockSignals(true);
+
+ //Set the index on dropdown ui element to let you know what pos you're on right now
+ ui_pos_dropdown->setCurrentIndex(i);
+
+ //Unblock the signals so the element can be used for setting pos again
+ ui_pos_dropdown->blockSignals(false);
+
+ //alright we dun, jobs done here boyos
+ break;
+ }
+ }
+}
+
+
void Courtroom::update_character(int p_cid)
{
bool newchar = m_cid != p_cid;
@@ -1052,7 +1081,9 @@ void Courtroom::update_character(int p_cid)
set_sfx_dropdown();
set_effects_dropdown();
- QString side = ao_app->get_char_side(f_char);
+ QString side = current_side;
+ if (side == "")
+ side = ao_app->get_char_side(current_char);
if (side == "jud")
{
@@ -1320,7 +1351,9 @@ void Courtroom::on_chat_return_pressed()
QStringList packet_contents;
- QString f_side = ao_app->get_char_side(current_char);
+ QString f_side = current_side;
+ if (f_side == "")
+ f_side = ao_app->get_char_side(current_char);
QString f_desk_mod = "chat";
@@ -2946,7 +2979,6 @@ void Courtroom::handle_song(QStringList *p_contents)
crossfade = p_contents->at(5) == "1"; //let the music player handle it if it's bigger than the channel list
}
- qDebug() << f_song << channel << p_contents->at(3) << looping;
music_player->set_looping(looping, channel);
music_player->play(f_song, channel, crossfade);
if (channel == 0)
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index e483ef91..75598405 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -594,7 +594,19 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
goto end;
if (courtroom_constructed)
+ {
+ if (f_contents.size() >= 2) //We have a pos included in the background packet!
+ w_courtroom->set_side(f_contents.at(1));
w_courtroom->set_background(f_contents.at(0));
+ }
+ }
+ else if (header == "SP")
+ {
+ if (f_contents.size() < 1)
+ goto end;
+
+ if (courtroom_constructed) //We were sent a "set position" packet
+ w_courtroom->set_side(f_contents.at(0));
}
//server accepting char request(CC) packet
else if (header == "PV")