Fix looping frame SFX not working w/ AOV's definitions

This commit is contained in:
Crystalwarrior 2020-05-22 04:53:19 +03:00
parent 88de4cde04
commit a5868aa380
3 changed files with 16 additions and 13 deletions

View File

@ -371,7 +371,7 @@ public:
QString get_emote_blip(QString p_char, int p_emote); QString get_emote_blip(QString p_char, int p_emote);
// Returns if the sfx is defined as looping in char.ini // Returns if the sfx is defined as looping in char.ini
QString get_sfx_looping(QString p_char, QString p_sfx); QString get_sfx_looping(QString p_char, int p_emote);
// Returns if an emote has a frame specific SFX for it // Returns if an emote has a frame specific SFX for it
QString get_sfx_frame(QString p_char, QString p_emote, int n_frame); QString get_sfx_frame(QString p_char, QString p_emote, int n_frame);

View File

@ -1637,7 +1637,7 @@ void Courtroom::on_chat_return_pressed()
// emote uses it. // emote uses it.
if (ao_app->looping_sfx_support_enabled) { if (ao_app->looping_sfx_support_enabled) {
packet_contents.append( packet_contents.append(
"0"); // ao_app->get_sfx_looping(current_char, current_emote)); ao_app->get_sfx_looping(current_char, current_emote));
packet_contents.append(QString::number(screenshake_state)); packet_contents.append(QString::number(screenshake_state));
QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); QString pre_emote = ao_app->get_pre_emote(current_char, current_emote);
@ -2124,10 +2124,10 @@ void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char,
void Courtroom::play_char_sfx(QString sfx_name) void Courtroom::play_char_sfx(QString sfx_name)
{ {
sfx_player->play(sfx_name); sfx_player->play(sfx_name);
if (ao_app->get_looping_sfx()) // sfx_player->set_looping(false);
sfx_player->set_looping( // if (ao_app->get_looping_sfx())
ao_app->get_sfx_looping(current_char, QString::number(current_emote)) != // sfx_player->set_looping(
"0"); // ao_app->get_sfx_looping(current_char, current_emote) == "1");
} }
void Courtroom::handle_chatmessage_3() void Courtroom::handle_chatmessage_3()
@ -2877,8 +2877,8 @@ void Courtroom::play_sfx()
sfx_player->play(sfx_name); sfx_player->play(sfx_name);
if (ao_app->get_looping_sfx()) if (ao_app->get_looping_sfx())
sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name) != sfx_player->set_looping(
"0"); ao_app->get_sfx_looping(current_char, current_emote) == "1");
} }
void Courtroom::set_scene(QString f_desk_mod, QString f_side) void Courtroom::set_scene(QString f_desk_mod, QString f_side)

View File

@ -558,8 +558,8 @@ QString AOApplication::get_static_image_suffix(QString path_to_check)
} }
// returns whatever is to the right of "search_line =" within target_tag and // returns whatever is to the right of "search_line =" within target_tag and
// terminator_tag, trimmed returns the empty string if the search line couldnt be // terminator_tag, trimmed returns the empty string if the search line couldnt
// found // be found
QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString AOApplication::read_char_ini(QString p_char, QString p_search_line,
QString target_tag) QString target_tag)
{ {
@ -805,13 +805,16 @@ int AOApplication::get_sfx_delay(QString p_char, int p_emote)
return f_result.toInt(); return f_result.toInt();
} }
QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx) QString AOApplication::get_sfx_looping(QString p_char, int p_emote)
{ {
QString f_result = read_char_ini(p_char, p_sfx, "SoundL"); QString f_result =
read_char_ini(p_char, QString::number(p_emote + 1), "SoundL");
qDebug() << f_result;
if (f_result == "") if (f_result == "")
return "0"; return "0";
return f_result; else
return f_result;
} }
QString AOApplication::get_sfx_frame(QString p_char, QString p_emote, QString AOApplication::get_sfx_frame(QString p_char, QString p_emote,