aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/aoapplication.h3
-rw-r--r--src/aosfxplayer.cpp3
-rw-r--r--src/courtroom.cpp39
-rw-r--r--src/text_file_functions.cpp69
4 files changed, 64 insertions, 50 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h
index af1433f..8dd48c6 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -335,6 +335,9 @@ public:
//Returns the sfx of p_char's p_emote
QString get_sfx_name(QString p_char, int p_emote);
+ //Returns the blipsound of p_char's p_emote
+ QString get_emote_blip(QString p_char, int p_emote);
+
//Returns if the sfx is defined as looping in char.ini
QString get_sfx_looping(QString p_char, QString p_sfx);
diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp
index ca2b393..cc01972 100644
--- a/src/aosfxplayer.cpp
+++ b/src/aosfxplayer.cpp
@@ -56,6 +56,9 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel
else
f_path = sound_path;
+ if (!file_exists(f_path))
+ f_path = ao_app->get_sfx_suffix(f_path); //If we're not given a sound file with .wav/.ogg/.opus already there, let's do this thing
+
m_stream_list[channel] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
set_volume_internal(m_volume);
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index fec354a..30c391f 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -782,7 +782,7 @@ void Courtroom::set_widgets()
ui_custom_objection->setText(tr("Custom Shout!"));
ui_custom_objection->set_image("custom");
ui_custom_objection->setToolTip(tr("This will display the custom character-defined animation in the viewport as soon as it is pressed.\n"
- "To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.wav"));
+ "To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect"));
set_size_and_pos(ui_realization, "realization");
ui_realization->set_image("realization");
@@ -1002,9 +1002,10 @@ void Courtroom::set_background(QString p_background, bool display)
ui_vp_testimony->stop();
current_background = p_background;
- is_ao2_bg = file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("defensedesk"))) &&
- file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("prosecutiondesk"))) &&
- file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("stand")));
+ is_ao2_bg = true;
+// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("defensedesk"))) &&
+// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("prosecutiondesk"))) &&
+// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("stand")));
if (is_ao2_bg)
{
@@ -1127,10 +1128,7 @@ void Courtroom::update_character(int p_cid)
ui_prosecution_plus->hide();
}
- if (ao_app->custom_objection_enabled &&
- (file_exists(ao_app->get_character_path(current_char, "custom.gif")) ||
- file_exists(ao_app->get_character_path(current_char, "custom.apng"))) &&
- file_exists(ao_app->get_character_path(current_char, "custom.wav")))
+ if (ao_app->custom_objection_enabled && file_exists(ao_app->get_image_suffix(ao_app->get_character_path(current_char, "custom"))))
ui_custom_objection->show();
else
ui_custom_objection->hide();
@@ -1597,8 +1595,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n';
+ //Remove undesired newline chars
+ m_chatmessage[MESSAGE].remove("\n");
+ chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
- if (f_char_id >= 0 && f_message == previous_ic_message) //Not a system message
+ if (f_char_id >= 0 && !chatmessage_is_empty && f_message == previous_ic_message) //Not a system message
return;
if (f_char_id <= -1)
@@ -1615,11 +1616,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
chat_tick_timer->stop();
ui_vp_evidence_display->reset();
- //Remove undesired newline chars
- m_chatmessage[MESSAGE].remove("\n");
-
- chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
-
//Hey, our message showed up! Cool!
if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text().remove("\n") && m_chatmessage[CHAR_ID].toInt() == m_cid)
{
@@ -1669,22 +1665,22 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
{
case 1:
ui_vp_objection->play("holdit_bubble", f_char, f_custom_theme, 724);
- objection_player->play("holdit.wav", f_char, f_custom_theme);
+ objection_player->play("holdit", f_char, f_custom_theme);
break;
case 2:
ui_vp_objection->play("objection_bubble", f_char, f_custom_theme, 724);
- objection_player->play("objection.wav", f_char, f_custom_theme);
+ objection_player->play("objection", f_char, f_custom_theme);
if(ao_app->objection_stop_music())
music_player->stop();
break;
case 3:
ui_vp_objection->play("takethat_bubble", f_char, f_custom_theme, 724);
- objection_player->play("takethat.wav", f_char, f_custom_theme);
+ objection_player->play("takethat", f_char, f_custom_theme);
break;
//case 4 is AO2 only
case 4:
ui_vp_objection->play("custom", f_char, f_custom_theme, 724);
- objection_player->play("custom.wav", f_char, f_custom_theme);
+ objection_player->play("custom", f_char, f_custom_theme);
break;
default:
qDebug() << "W: Logic error in objection switch statement!";
@@ -2493,7 +2489,7 @@ void Courtroom::start_chat_ticking()
QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]);
- blip_player->set_blips(ao_app->get_sfx_suffix(f_gender));
+ blip_player->set_blips(f_gender);
//means text is currently ticking
text_state = 1;
@@ -2518,7 +2514,7 @@ void Courtroom::chat_tick()
ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]);
}
QString f_char = m_chatmessage[CHAR_NAME];
- QString f_custom_theme = ao_app->get_char_shouts(f_char);
+ QString f_custom_theme = ao_app->get_chat(f_char);
ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that.
additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt());
real_tick_pos = ui_vp_message->toPlainText().size();
@@ -3320,7 +3316,8 @@ void Courtroom::on_music_search_edited(QString p_text)
if (p_text != "")
{
- QList<QTreeWidgetItem*> clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 0);
+ //Search in metadata
+ QList<QTreeWidgetItem*> clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1);
foreach(QTreeWidgetItem* item, clist)
{
if (item->parent() != nullptr) //So the category shows up too
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index f38bbb5..da14413 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -527,16 +527,15 @@ QString AOApplication::get_sfx(QString p_identifier)
QString AOApplication::get_sfx_suffix(QString sound_to_check)
{
- QString mp3_check = get_sounds_path(sound_to_check + ".mp3");
- QString opus_check = get_sounds_path(sound_to_check + ".opus");
- if (file_exists(opus_check))
- {
+ sound_to_check = get_sounds_path(sound_to_check);
+ if (file_exists(sound_to_check + ".opus"))
return sound_to_check + ".opus";
- }
- else if (file_exists(mp3_check))
- {
+ if (file_exists(sound_to_check + ".ogg"))
+ return sound_to_check + ".ogg";
+ if (file_exists(sound_to_check + ".mp3"))
return sound_to_check + ".mp3";
- }
+ if (file_exists(sound_to_check + ".mp4"))
+ return sound_to_check + ".mp4";
return sound_to_check + ".wav";
}
@@ -599,7 +598,7 @@ QString AOApplication::get_char_name(QString p_char)
if (f_result == "")
return p_char;
- else return f_result;
+ return f_result;
}
QString AOApplication::get_showname(QString p_char)
@@ -611,7 +610,7 @@ QString AOApplication::get_showname(QString p_char)
return "";
if (f_result == "")
return p_char;
- else return f_result;
+ return f_result;
}
QString AOApplication::get_char_side(QString p_char)
@@ -620,7 +619,7 @@ QString AOApplication::get_char_side(QString p_char)
if (f_result == "")
return "wit";
- else return f_result;
+ return f_result;
}
QString AOApplication::get_gender(QString p_char)
@@ -629,8 +628,14 @@ QString AOApplication::get_gender(QString p_char)
if (f_result == "")
return "sfx-blipmale";
- if (!file_exists(get_sfx(f_result)))
- f_result = "sfx-blip" + f_result;
+
+ if (!file_exists(get_sfx_suffix(get_sfx(f_result))))
+ {
+ if (file_exists(get_sfx_suffix(get_sfx("blips/" + f_result))))
+ return "blips/" + f_result; //Return the cool kids variant
+
+ return "sfx-blip" + f_result; //Return legacy variant
+ }
return f_result;
}
@@ -663,7 +668,7 @@ QString AOApplication::get_char_shouts(QString p_char)
QString f_result = read_char_ini(p_char, "shouts", "Options");
if (f_result == "")
return "default";
- else return f_result;
+ return f_result;
}
int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
@@ -672,7 +677,7 @@ int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
if (f_result == "")
return -1;
- else return f_result.toInt();
+ return f_result.toInt();
}
int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
@@ -681,7 +686,7 @@ int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
if (f_result == "")
return -1;
- else return f_result.toInt();
+ return f_result.toInt();
}
int AOApplication::get_emote_number(QString p_char)
@@ -690,7 +695,7 @@ int AOApplication::get_emote_number(QString p_char)
if (f_result == "")
return 0;
- else return f_result.toInt();
+ return f_result.toInt();
}
QString AOApplication::get_emote_comment(QString p_char, int p_emote)
@@ -704,7 +709,7 @@ QString AOApplication::get_emote_comment(QString p_char, int p_emote)
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
return "normal";
}
- else return result_contents.at(0);
+ return result_contents.at(0);
}
QString AOApplication::get_pre_emote(QString p_char, int p_emote)
@@ -718,7 +723,7 @@ QString AOApplication::get_pre_emote(QString p_char, int p_emote)
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
return "";
}
- else return result_contents.at(1);
+ return result_contents.at(1);
}
QString AOApplication::get_emote(QString p_char, int p_emote)
@@ -732,7 +737,7 @@ QString AOApplication::get_emote(QString p_char, int p_emote)
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
return "normal";
}
- else return result_contents.at(2);
+ return result_contents.at(2);
}
int AOApplication::get_emote_mod(QString p_char, int p_emote)
@@ -746,7 +751,7 @@ int AOApplication::get_emote_mod(QString p_char, int p_emote)
qDebug() << "W: misformatted char.ini: " << p_char << ", " << QString::number(p_emote);
return 0;
}
- else return result_contents.at(3).toInt();
+ return result_contents.at(3).toInt();
}
int AOApplication::get_desk_mod(QString p_char, int p_emote)
@@ -762,7 +767,7 @@ int AOApplication::get_desk_mod(QString p_char, int p_emote)
if (string_result == "")
return -1;
- else return string_result.toInt();
+ return string_result.toInt();
}
QString AOApplication::get_sfx_name(QString p_char, int p_emote)
@@ -771,7 +776,13 @@ QString AOApplication::get_sfx_name(QString p_char, int p_emote)
if (f_result == "")
return "1";
- else return f_result;
+ return f_result;
+}
+
+QString AOApplication::get_emote_blip(QString p_char, int p_emote)
+{
+ QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundB");
+ return f_result;
}
int AOApplication::get_sfx_delay(QString p_char, int p_emote)
@@ -780,7 +791,7 @@ int AOApplication::get_sfx_delay(QString p_char, int p_emote)
if (f_result == "")
return 1;
- else return f_result.toInt();
+ return f_result.toInt();
}
QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx)
@@ -789,7 +800,7 @@ QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx)
if (f_result == "")
return "0";
- else return f_result;
+ return f_result;
}
QString AOApplication::get_sfx_frame(QString p_char, QString p_emote, int n_frame)
@@ -798,7 +809,7 @@ QString AOApplication::get_sfx_frame(QString p_char, QString p_emote, int n_fram
if (f_result == "")
return "";
- else return f_result;
+ return f_result;
}
QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, int n_frame)
@@ -807,7 +818,7 @@ QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, in
if (f_result == "")
return "";
- else return f_result;
+ return f_result;
}
QString AOApplication::get_flash_frame(QString p_char, QString p_emote, int n_frame)
@@ -816,7 +827,7 @@ QString AOApplication::get_flash_frame(QString p_char, QString p_emote, int n_fr
if (f_result == "")
return "";
- else return f_result;
+ return f_result;
}
int AOApplication::get_text_delay(QString p_char, QString p_emote)
@@ -825,7 +836,7 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote)
if (f_result == "")
return -1;
- else return f_result.toInt();
+ return f_result.toInt();
}
QStringList AOApplication::get_theme_effects()