disabled ao2 loading for now

This commit is contained in:
David Skoland 2017-02-13 22:50:40 +01:00
parent 511b1e7eee
commit d73865cfcd
5 changed files with 138 additions and 27 deletions

View File

@ -50,6 +50,7 @@ public:
bool prezoom_enabled = false;
bool flipping_enabled = false;
bool custom_objection_enabled = false;
bool improved_loading_enabled = false;
///////////////loading info///////////////////

View File

@ -32,7 +32,7 @@ private:
QVector<QImage> flipped_movie;
QTimer *preanim_timer;
bool m_flipped = true;
bool m_flipped = false;
signals:
void done();

View File

@ -248,6 +248,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked()));
connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked()));
connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked()));
connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked()));
connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
@ -776,7 +778,12 @@ void Courtroom::on_chat_return_pressed()
//needed or else legacy won't understand what we're saying
if (objection_state > 0)
f_emote_mod = 2;
{
if (f_emote_mod == 5)
f_emote_mod = 6;
else
f_emote_mod = 2;
}
else if (ui_pre->isChecked())
{
if (f_emote_mod == 0)
@ -905,16 +912,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
switch (emote_mod)
{
//we change the chatmessage from no preanim to preanim, see documentation
case 0: case 2:
m_chatmessage[EMOTE_MOD] = "1";
break;
case 5:
m_chatmessage[EMOTE_MOD] = QString::number(--emote_mod);
break;
}
if (emote_mod == 0)
m_chatmessage[EMOTE_MOD] = 1;
}
else
handle_chatmessage_2();
@ -954,13 +953,13 @@ void Courtroom::handle_chatmessage_2()
switch (emote_mod)
{
case 1: case 3: case 4:
case 1: case 2: case 3: case 4: case 6:
play_preanim();
break;
default:
qDebug() << "W: invalid emote mod: " << QString::number(emote_mod);
//intentional fallthru
case 0: case 2: case 5:
case 0: case 5:
start_chat_ticking();
handle_chatmessage_3();
}
@ -1574,16 +1573,19 @@ void Courtroom::on_text_color_changed(int p_color)
void Courtroom::on_music_slider_moved(int p_value)
{
music_player->set_volume(p_value);
ui_ic_chat_message->setFocus();
}
void Courtroom::on_sfx_slider_moved(int p_value)
{
sfx_player->set_volume(p_value);
ui_ic_chat_message->setFocus();
}
void Courtroom::on_blip_slider_moved(int p_value)
{
blip_player->set_volume(p_value);
ui_ic_chat_message->setFocus();
}
void Courtroom::on_witness_testimony_clicked()
@ -1666,6 +1668,16 @@ void Courtroom::on_pre_clicked()
ui_ic_chat_message->setFocus();
}
void Courtroom::on_flip_clicked()
{
ui_ic_chat_message->setFocus();
}
void Courtroom::on_guard_clicked()
{
ui_ic_chat_message->setFocus();
}
void Courtroom::char_clicked(int n_char)
{
int n_real_char = n_char + current_char_page * 90;

View File

@ -123,7 +123,7 @@ private:
QTimer *realization_timer;
//every time point in char.inis times this equals the final time
const int time_mod = 35;
const int time_mod = 40;
static const int chatmessage_size = 15;
QString m_chatmessage[chatmessage_size];
@ -328,6 +328,8 @@ private slots:
void on_call_mod_clicked();
void on_pre_clicked();
void on_flip_clicked();
void on_guard_clicked();
void on_back_to_lobby_clicked();

View File

@ -100,19 +100,34 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
}
else if (header == "ID")
{
if (f_contents.size() < 1)
if (f_contents.size() < 2)
goto end;
s_pv = f_contents.at(0).toInt();
if (f_contents.size() < 2)
goto end;
QString server_version = f_contents.at(1);
ao2_features = false;
yellow_text_enabled = false;
encryption_needed = true;
//T0D0: store server version
if (server_version == "v1300.146")
{
encryption_needed = false;
yellow_text_enabled = true;
//still needs some tweaking to work
prezoom_enabled = false;
flipping_enabled = true;
custom_objection_enabled = true;
//improved loading disabled for now
//improved_loading_enabled = true;
improved_loading_enabled = false;
}
else
{
encryption_needed = true;
yellow_text_enabled = false;
prezoom_enabled = false;
flipping_enabled = false;
custom_objection_enabled = false;
improved_loading_enabled = false;
}
}
else if (header == "CT")
{
@ -170,7 +185,14 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
w_lobby->set_loading_text("Loading");
w_lobby->set_loading_value(0);
AOPacket *f_packet = new AOPacket("askchar2#%");
AOPacket *f_packet;
//AO2 loading disabled for now
//if(improved_loading_enabled)
// f_packet = new AOPacket("RC#%");
//else
f_packet = new AOPacket("askchar2#%");
send_server_packet(f_packet);
}
else if (header == "CI")
@ -208,11 +230,17 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
int loading_value = (loaded_chars / static_cast<double>(total_loading_size)) * 100;
w_lobby->set_loading_value(loading_value);
QString next_packet_number = QString::number(((loaded_chars - 1) / 10) + 1);
send_server_packet(new AOPacket("AN#" + next_packet_number + "#%"));
if (improved_loading_enabled)
send_server_packet(new AOPacket("RE#%"));
else
{
QString next_packet_number = QString::number(((loaded_chars - 1) / 10) + 1);
send_server_packet(new AOPacket("AN#" + next_packet_number + "#%"));
}
}
else if (header == "EI"){
else if (header == "EI")
{
if (!courtroom_constructed)
goto end;
@ -288,6 +316,74 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
w_courtroom->set_taken(n_char, false);
}
}
//AO2 loading is temporarily disabled as it needs to be revised altogether
/*
else if (header == "SC")
{
if (!courtroom_constructed)
goto end;
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
{
QStringList sub_elements = f_contents.at(n_element).split("&");
if (sub_elements.size() < 2)
break;
char_type f_char;
f_char.name = sub_elements.at(0);
f_char.description = sub_elements.at(1);
//temporary. the TC packet sets this properly
f_char.taken = false;
++loaded_chars;
w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size));
w_courtroom->append_char(f_char);
}
int total_loading_size = char_list_size + evidence_list_size + music_list_size;
int loading_value = (loaded_chars / static_cast<double>(total_loading_size)) * 100;
w_lobby->set_loading_value(loading_value);
send_server_packet(new AOPacket("RE#%"));
}
else if (header == "SE")
{
if (!courtroom_constructed)
goto end;
// +1 because evidence starts at 1 rather than 0 for whatever reason
//enjoy fanta
if (f_contents.at(0).toInt() != loaded_evidence + 1)
goto end;
if (f_contents.size() < 2)
goto end;
QStringList sub_elements = f_contents.at(1).split("&");
if (sub_elements.size() < 4)
goto end;
evi_type f_evi;
f_evi.name = sub_elements.at(0);
f_evi.description = sub_elements.at(1);
//no idea what the number at position 2 is. probably an identifier?
f_evi.image = sub_elements.at(3);
++loaded_evidence;
w_lobby->set_loading_text("Loading evidence:\n" + QString::number(loaded_evidence) + "/" + QString::number(evidence_list_size));
w_courtroom->append_evidence(f_evi);
int total_loading_size = char_list_size + evidence_list_size + music_list_size;
int loading_value = ((loaded_chars + loaded_evidence) / static_cast<double>(total_loading_size)) * 100;
w_lobby->set_loading_value(loading_value);
send_server_packet(new AOPacket("RM#%"));
}
*/
else if (header == "DONE")
{
if (!courtroom_constructed)