Network effects folder so you don't need to modify your own char.ini to see custom effects

This commit is contained in:
Crystalwarrior 2020-01-17 18:41:27 +03:00
parent 6138bb107b
commit 43c4e3e9d7
4 changed files with 21 additions and 9 deletions

View File

@ -317,7 +317,7 @@ public:
QStringList get_effects(QString p_char); QStringList get_effects(QString p_char);
//t //t
QString get_effect(QString effect, QString p_char); QString get_effect(QString effect, QString p_char, QString p_folder);
//Return the effect sound associated with the fx_name in the misc/effects/<char-defined>/sounds.ini, or theme/effects/sounds.ini. //Return the effect sound associated with the fx_name in the misc/effects/<char-defined>/sounds.ini, or theme/effects/sounds.ini.
QString get_effect_sound(QString fx_name, QString p_char); QString get_effect_sound(QString fx_name, QString p_char);

View File

@ -625,7 +625,7 @@ public slots:
void preanim_done(); void preanim_done();
void do_screenshake(); void do_screenshake();
void do_flash(); void do_flash();
void do_effect(QString fx_path, QString fx_sound, QString p_char); void do_effect(QString fx_path, QString fx_sound, QString p_char, QString p_folder);
void play_char_sfx(QString sfx_name); void play_char_sfx(QString sfx_name);
void mod_called(QString p_ip); void mod_called(QString p_ip);

View File

@ -1,4 +1,4 @@
#include "courtroom.h" #include "courtroom.h"
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
@ -1545,7 +1545,8 @@ void Courtroom::on_chat_return_pressed()
if (ao_app->effects_enabled) if (ao_app->effects_enabled)
{ {
QString fx_sound = ao_app->get_effect_sound(effect, current_char); QString fx_sound = ao_app->get_effect_sound(effect, current_char);
packet_contents.append(effect + "|" + fx_sound); QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options");
packet_contents.append(effect + "|" + p_effect + "|" + fx_sound);
ui_effects_dropdown->blockSignals(true); ui_effects_dropdown->blockSignals(true);
ui_effects_dropdown->setCurrentIndex(0); ui_effects_dropdown->setCurrentIndex(0);
ui_effects_dropdown->blockSignals(false); ui_effects_dropdown->blockSignals(false);
@ -1943,10 +1944,10 @@ void Courtroom::do_flash()
ui_vp_effect->play("realizationflash", f_char, f_custom_theme, 60); ui_vp_effect->play("realizationflash", f_char, f_custom_theme, 60);
} }
void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char) void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char, QString p_folder)
{ {
QString effect = ao_app->get_effect(fx_name, p_char); QString effect = ao_app->get_effect(fx_name, p_char, p_folder);
if (effect == "") if (effect == "")
return; return;
@ -2458,10 +2459,18 @@ void Courtroom::start_chat_ticking()
QStringList fx_list = m_chatmessage[EFFECTS].split("|"); QStringList fx_list = m_chatmessage[EFFECTS].split("|");
QString fx = fx_list[0]; QString fx = fx_list[0];
QString fx_sound; QString fx_sound;
QString fx_folder;
if (fx_list.length() > 1) if (fx_list.length() > 1)
fx_sound = fx_list[1]; fx_sound = fx_list[1];
this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME]); if (fx_list.length() > 2)
{
fx_folder = fx_list[1];
fx_sound = fx_list[2];
}
this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME], fx_folder);
} }
else if (m_chatmessage[REALIZATION] == "1") else if (m_chatmessage[REALIZATION] == "1")
{ {

View File

@ -885,9 +885,12 @@ QStringList AOApplication::get_effects(QString p_char)
return effects; return effects;
} }
QString AOApplication::get_effect(QString effect, QString p_char) QString AOApplication::get_effect(QString effect, QString p_char, QString p_folder)
{ {
QString p_effect = read_char_ini(p_char, "effects", "Options"); QString p_effect = p_folder;
if (p_folder == "")
p_effect = read_char_ini(p_char, "effects", "Options");
QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + "/" + effect); QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + "/" + effect);
QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect)); QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect));
QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect)); QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect));