aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2020-01-17 18:41:27 +0300
committerCrystalwarrior <varsash@gmail.com>2020-01-17 18:41:27 +0300
commit43c4e3e9d703a0b7d48b634d6970906dcb5709b2 (patch)
tree025ee8a5335ab7efe525264b9989bef3192abc3d
parent6138bb107b5ab4d882e9ceb75e1394c2b8ec82a3 (diff)
Network effects folder so you don't need to modify your own char.ini to see custom effects
-rw-r--r--include/aoapplication.h2
-rw-r--r--include/courtroom.h2
-rw-r--r--src/courtroom.cpp19
-rw-r--r--src/text_file_functions.cpp7
4 files changed, 21 insertions, 9 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h
index 0ab6831b..9f110874 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -317,7 +317,7 @@ public:
QStringList get_effects(QString p_char);
//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.
QString get_effect_sound(QString fx_name, QString p_char);
diff --git a/include/courtroom.h b/include/courtroom.h
index 6bca28e4..d2044172 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -625,7 +625,7 @@ public slots:
void preanim_done();
void do_screenshake();
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 mod_called(QString p_ip);
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 283611f3..81e043ef 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1,4 +1,4 @@
-#include "courtroom.h"
+#include "courtroom.h"
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
@@ -1545,7 +1545,8 @@ void Courtroom::on_chat_return_pressed()
if (ao_app->effects_enabled)
{
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->setCurrentIndex(0);
ui_effects_dropdown->blockSignals(false);
@@ -1943,10 +1944,10 @@ void Courtroom::do_flash()
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 == "")
return;
@@ -2458,10 +2459,18 @@ void Courtroom::start_chat_ticking()
QStringList fx_list = m_chatmessage[EFFECTS].split("|");
QString fx = fx_list[0];
QString fx_sound;
+ QString fx_folder;
+
if (fx_list.length() > 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")
{
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index bb5d7dea..49bf61f7 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -885,9 +885,12 @@ QStringList AOApplication::get_effects(QString p_char)
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 design_ini_path = get_image_suffix(get_theme_path("effects/" + effect));
QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect));