started implementing legacy loading protocol
This commit is contained in:
		
							parent
							
								
									3e8d0610ca
								
							
						
					
					
						commit
						b606b55cae
					
				@ -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;}
 | 
			
		||||
 | 
			
		||||
@ -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_type> char_list;
 | 
			
		||||
  QVector<evi_type> evidence_list;
 | 
			
		||||
  QVector<QString> music_list;
 | 
			
		||||
 | 
			
		||||
  AOImage *ui_background;
 | 
			
		||||
  //viewport elements like background, desk, etc.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								lobby.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								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()
 | 
			
		||||
 | 
			
		||||
@ -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();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user