make icons for effects n shit
they're grabbed from the effects/icons/*same name as effects* gotta be .png or w/e i need my sleep
This commit is contained in:
parent
605e15bb8c
commit
ad057c6f7a
@ -303,7 +303,7 @@ public:
|
|||||||
QStringList get_char_effects(QString p_char);
|
QStringList get_char_effects(QString p_char);
|
||||||
|
|
||||||
//Get the theme's effects folder, read it and return the list of filenames in a string
|
//Get the theme's effects folder, read it and return the list of filenames in a string
|
||||||
QStringList get_effects();
|
QStringList get_effects(QString p_char);
|
||||||
|
|
||||||
//t
|
//t
|
||||||
QString get_effect(QString effect, QString p_char);
|
QString get_effect(QString effect, QString p_char);
|
||||||
|
@ -1439,7 +1439,8 @@ void Courtroom::on_chat_return_pressed()
|
|||||||
{
|
{
|
||||||
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);
|
packet_contents.append(effect + "|" + fx_sound);
|
||||||
qDebug() << effect << fx_sound;
|
ui_effects_dropdown->setCurrentIndex(0);
|
||||||
|
effect = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
ao_app->send_server_packet(new AOPacket("MS", packet_contents));
|
ao_app->send_server_packet(new AOPacket("MS", packet_contents));
|
||||||
@ -1902,10 +1903,14 @@ void Courtroom::do_flash()
|
|||||||
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)
|
||||||
{
|
{
|
||||||
if(!ao_app->is_shake_flash_enabled())
|
if(!ao_app->is_shake_flash_enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QString effect = ao_app->get_effect(fx_name, p_char);
|
||||||
|
if (effect == "")
|
||||||
|
return;
|
||||||
|
|
||||||
ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger.
|
ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger.
|
||||||
ui_vp_effect->play(ao_app->get_effect(fx_name, p_char)); // It will set_play_once to true if the filepath provided is not designed to loop more than once
|
ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once
|
||||||
if (fx_sound != "")
|
if (fx_sound != "")
|
||||||
sfx_player->play(ao_app->get_sfx_suffix(fx_sound));
|
sfx_player->play(ao_app->get_sfx_suffix(fx_sound));
|
||||||
}
|
}
|
||||||
@ -3507,17 +3512,45 @@ void Courtroom::set_effects_dropdown()
|
|||||||
ui_effects_dropdown->hide();
|
ui_effects_dropdown->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList effectslist = ao_app->get_effects() << ao_app->get_char_effects(current_char);
|
QStringList effectslist = ao_app->get_effects(current_char);
|
||||||
|
|
||||||
if (effectslist.size() <= 0)
|
if (effectslist.size() <= 0)
|
||||||
{
|
{
|
||||||
ui_effects_dropdown->hide();
|
ui_effects_dropdown->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
effectslist.prepend("None");
|
effectslist.prepend("None");
|
||||||
|
|
||||||
ui_effects_dropdown->show();
|
ui_effects_dropdown->show();
|
||||||
ui_effects_dropdown->addItems(effectslist);
|
ui_effects_dropdown->addItems(effectslist);
|
||||||
|
|
||||||
|
//ICON-MAKING HELL
|
||||||
|
QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options");
|
||||||
|
QString custom_path = ao_app->get_base_path() + "misc/" + p_effect + "/icons/";
|
||||||
|
QString theme_path = ao_app->get_theme_path("effects/icons/");
|
||||||
|
QString default_path = ao_app->get_default_theme_path("effects/icons/");
|
||||||
|
for (int i = 0; i < ui_effects_dropdown->count(); ++i)
|
||||||
|
{
|
||||||
|
QString entry = ui_effects_dropdown->itemText(i);
|
||||||
|
QString iconpath = ao_app->get_static_image_suffix(custom_path + entry);
|
||||||
|
qDebug() << iconpath << entry;
|
||||||
|
if (!file_exists(iconpath))
|
||||||
|
{
|
||||||
|
iconpath = ao_app->get_static_image_suffix(theme_path + entry);
|
||||||
|
qDebug() << iconpath << entry;
|
||||||
|
if (!file_exists(iconpath))
|
||||||
|
{
|
||||||
|
iconpath = ao_app->get_static_image_suffix(default_path + entry);
|
||||||
|
qDebug() << iconpath << entry;
|
||||||
|
if (!file_exists(iconpath))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui_effects_dropdown->setItemIcon(i, QIcon(iconpath));
|
||||||
|
}
|
||||||
|
|
||||||
ui_effects_dropdown->setCurrentIndex(0);
|
ui_effects_dropdown->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,42 +820,38 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote)
|
|||||||
QStringList AOApplication::get_char_effects(QString p_char)
|
QStringList AOApplication::get_char_effects(QString p_char)
|
||||||
{
|
{
|
||||||
QString p_effect = read_char_ini(p_char, "effects", "Options");
|
QString p_effect = read_char_ini(p_char, "effects", "Options");
|
||||||
QString p_path = get_base_path() + "misc/" + p_effect + "/";
|
QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini";
|
||||||
QStringList filters = QStringList() << "*.gif" << "*.webp" << "*.apng" << "*.png" << "*.GIF" << "*.WEBP" << "*.APNG" << "*.PNG";
|
|
||||||
|
|
||||||
QDir directory(p_path);
|
QStringList lines = read_file(p_path).split("\n");
|
||||||
QStringList images = directory.entryList(filters, QDir::Files);
|
|
||||||
|
|
||||||
QStringList effects;
|
QStringList effects;
|
||||||
foreach (QString effect, images)
|
foreach (QString effect, lines)
|
||||||
{
|
{
|
||||||
effect = effect.left(effect.lastIndexOf("."));
|
effect = effect.split("=")[0].trimmed();
|
||||||
if (!effects.contains(effect)) //Do that juicy priority meme
|
qDebug() << effect;
|
||||||
|
if (effect != "" && !effects.contains(effect))
|
||||||
effects.append(effect);
|
effects.append(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return effects;
|
return effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList AOApplication::get_effects()
|
QStringList AOApplication::get_effects(QString p_char)
|
||||||
{
|
{
|
||||||
QString design_ini_path = get_theme_path("effects/");
|
QString p_path = get_theme_path("effects/effects.ini");
|
||||||
QString default_path = get_default_theme_path("effects/");
|
QString default_path = get_default_theme_path("effects/effects.ini");
|
||||||
QStringList filters = QStringList() << "*.gif" << "*.webp" << "*.apng" << "*.png" << "*.GIF" << "*.WEBP" << "*.APNG" << "*.PNG";
|
|
||||||
|
|
||||||
QDir directory(design_ini_path);
|
if (!file_exists(p_path))
|
||||||
QStringList images = directory.entryList(filters, QDir::Files);
|
|
||||||
if (images.size() <= 0)
|
|
||||||
{
|
{
|
||||||
directory.cd(default_path);
|
p_path = default_path;
|
||||||
images = directory.entryList(filters, QDir::Files);
|
|
||||||
}
|
}
|
||||||
|
QStringList lines = read_file(p_path).split("\n");
|
||||||
|
|
||||||
QStringList effects;
|
QStringList effects = get_char_effects(p_char);
|
||||||
foreach (QString effect, images)
|
foreach (QString effect, lines)
|
||||||
{
|
{
|
||||||
effect = effect.left(effect.lastIndexOf("."));
|
effect = effect.split("=")[0].trimmed();
|
||||||
if (!effects.contains(effect)) //Do that juicy priority meme
|
qDebug() << effect;
|
||||||
|
if (effect != "" && !effects.contains(effect))
|
||||||
effects.append(effect);
|
effects.append(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,9 +884,9 @@ QString AOApplication::get_effect(QString effect, QString p_char)
|
|||||||
QString AOApplication::get_effect_sound(QString fx_name, QString p_char)
|
QString AOApplication::get_effect_sound(QString fx_name, QString p_char)
|
||||||
{
|
{
|
||||||
QString p_effect = read_char_ini(p_char, "effects", "Options");
|
QString p_effect = read_char_ini(p_char, "effects", "Options");
|
||||||
QString p_path = get_base_path() + "misc/effects/" + p_effect + "/effect_sounds.ini";
|
QString p_path = get_base_path() + "misc/effects/" + p_effect + "/effects.ini";
|
||||||
QString design_ini_path = get_theme_path("effects/effect_sounds.ini");
|
QString design_ini_path = get_theme_path("effects/effects.ini");
|
||||||
QString default_path = get_default_theme_path("effects/effect_sounds.ini");
|
QString default_path = get_default_theme_path("effects/effects.ini");
|
||||||
|
|
||||||
QString f_result = read_design_ini(fx_name, p_path);
|
QString f_result = read_design_ini(fx_name, p_path);
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
|
Loading…
Reference in New Issue
Block a user