diff --git a/aoapplication.h b/aoapplication.h index 3dfd813..3c6ef4c 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -44,10 +44,18 @@ public: unsigned int s_decryptor = 5; bool encryption_needed = true; bool ao2_features = false; - //player number, it's hardly used but might be needed for some old servers - bool s_pv = 0; - ////////////////////////////////////////////////// + ///////////////loading info/////////////////// + + //player number, it's hardly used but might be needed for some old servers + int s_pv = 0; + + int char_list_size = 0; + int loaded_chars = 0; + int evidence_list_size = 0; + int loaded_evidence = 0; + int music_list_size = 0; + int loaded_music = 0; int get_release() {return RELEASE;} int get_major_version() {return MAJOR_VERSION;} diff --git a/courtroom.h b/courtroom.h index ab78c04..1278c83 100644 --- a/courtroom.h +++ b/courtroom.h @@ -24,6 +24,11 @@ class Courtroom : public QMainWindow Q_OBJECT public: explicit Courtroom(AOApplication *p_ao_app); + + void append_char(char_type p_char){char_list.append(p_char);} + void append_evidence(evi_type p_evi){evidence_list.append(p_evi);} + void append_music(QString f_music){music_list.append(f_music);} + void set_widgets(); void set_size_and_pos(QWidget *p_widget, QString p_identifier); @@ -41,6 +46,10 @@ private: const int m_viewport_width = 256; const int m_viewport_height = 192; + QVector char_list; + QVector evidence_list; + QVector music_list; + AOImage *ui_background; //viewport elements like background, desk, etc. diff --git a/lobby.cpp b/lobby.cpp index 04ec4f9..4a43df7 100644 --- a/lobby.cpp +++ b/lobby.cpp @@ -176,15 +176,11 @@ void Lobby::on_connect_released() { ui_connect->set_image("connect.png"); - //D3BUG START + AOPacket *f_packet = new AOPacket("askchaa#%"); - ao_app->construct_courtroom(); + ao_app->send_server_packet(f_packet); - ao_app->destruct_lobby(); - - //D3BUG END - - //T0D0: call ao_app to initialize loading sequence + delete f_packet; } void Lobby::on_about_clicked() diff --git a/packet_distribution.cpp b/packet_distribution.cpp index 5250dfa..391f2e2 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -99,7 +99,12 @@ void AOApplication::server_packet_received(AOPacket *p_packet) if (f_contents.size() < 1) return; - //T0D0: save server version here, somehow(it's in the HI# packet usually) + s_pv = f_contents.at(0).toInt(); + + if (f_contents.size() < 2) + return; + + //T0D0: store server version } else if (header == "CT") { @@ -121,6 +126,37 @@ void AOApplication::server_packet_received(AOPacket *p_packet) w_lobby->set_player_count(f_contents.at(0).toInt(), f_contents.at(1).toInt()); } + else if (header == "SI") + { + if (f_contents.size() > 3) + return; + + char_list_size = f_contents.at(0).toInt(); + loaded_chars = 0; + evidence_list_size = f_contents.at(1).toInt(); + loaded_evidence = 0; + music_list_size = f_contents.at(2).toInt(); + loaded_music = 0; + + destruct_courtroom(); + + construct_courtroom(); + + AOPacket *f_packet = new AOPacket("askchar2#%"); + send_server_packet(f_packet); + delete f_packet; + } + else if (header == "CI") + { + if (!courtroom_constructed) + return; + AOPacket *f_packet = new AOPacket("AN#1#%"); + send_server_packet(f_packet); + delete f_packet; + + //w_courtroom->append_char(); + + } } void AOApplication::send_ms_packet(AOPacket *p_packet) @@ -142,7 +178,7 @@ void AOApplication::send_server_packet(AOPacket *p_packet) if (encryption_needed) { - qDebug() << "S:(e)" << f_packet; + qDebug() << "S(e):" << f_packet; p_packet->encrypt_header(s_decryptor); f_packet = p_packet->to_string();