aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aomusicplayer.cpp7
-rw-r--r--src/courtroom.cpp24
2 files changed, 24 insertions, 7 deletions
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp
index 16d6df7..5d9df79 100644
--- a/src/aomusicplayer.cpp
+++ b/src/aomusicplayer.cpp
@@ -20,8 +20,6 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
channel = channel % m_channelmax;
if (channel < 0) // wtf?
return "[ERROR] Invalid Channel";
- QString f_path = ao_app->get_real_path(ao_app->get_music_path(p_song));
-
unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE |
BASS_UNICODE | BASS_ASYNCFILE;
unsigned int streaming_flags = BASS_STREAM_AUTOFREE;
@@ -29,7 +27,7 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
flags |= BASS_SAMPLE_LOOP;
streaming_flags |= BASS_SAMPLE_LOOP;
}
-
+ QString f_path = p_song;
DWORD newstream;
if (f_path.startsWith("http")) {
if (f_path.endsWith(".opus"))
@@ -38,6 +36,7 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
newstream = BASS_StreamCreateURL(f_path.toStdString().c_str(), 0, streaming_flags, nullptr, 0);
} else {
+ f_path = ao_app->get_real_path(ao_app->get_music_path(p_song));
if (f_path.endsWith(".opus"))
newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
else
@@ -46,7 +45,7 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
int error_code = BASS_ErrorGetCode();
- if (invoking_future.isCanceled() && channel == 0) {
+ if (invoking_future.isCanceled()) {
// Target future has changed. This stream has become irrelevant.
// So even if the stream manages to finish after the latest one, we don't run
// into order issues.
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 34a596d..27dc878 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -2404,7 +2404,7 @@ void Courtroom::display_character()
else
ui_vp_player_char->set_flipped(false);
// Move the character on the viewport according to the offsets
- set_self_offset(m_chatmessage[SELF_OFFSET]);
+ set_self_offset(m_chatmessage[SELF_OFFSET], m_chatmessage[EFFECTS]);
}
void Courtroom::display_pair_character(QString other_charid, QString other_offset)
@@ -3321,7 +3321,7 @@ void Courtroom::start_chat_ticking()
// handle expanded desk mods
switch(m_chatmessage[DESK_MOD].toInt()) {
case 4:
- set_self_offset(m_chatmessage[SELF_OFFSET]);
+ set_self_offset(m_chatmessage[SELF_OFFSET], QString("||"));
[[fallthrough]];
case 2:
set_scene("1", m_chatmessage[SIDE]);
@@ -3749,6 +3749,11 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side)
f_background = f_side;
f_desk_image = f_side + "_overlay";
}
+
+ QString desk_override = ao_app->read_design_ini("overlays/" + f_background, ao_app->get_background_path("design.ini"));
+ if (desk_override != "")
+ f_desk_image = desk_override;
+
ui_vp_background->load_image(f_background);
ui_vp_desk->load_image(f_desk_image);
@@ -3762,8 +3767,9 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side)
}
}
-void Courtroom::set_self_offset(QString p_list) {
+void Courtroom::set_self_offset(QString p_list, QString p_effect) {
QStringList self_offsets = p_list.split("&");
+ QStringList play_effect = p_effect.split("|");
int self_offset = self_offsets[0].toInt();
int self_offset_v;
if (self_offsets.length() <= 1)
@@ -3771,6 +3777,18 @@ void Courtroom::set_self_offset(QString p_list) {
else
self_offset_v = self_offsets[1].toInt();
ui_vp_player_char->move(ui_viewport->width() * self_offset / 100, ui_viewport->height() * self_offset_v / 100);
+
+ //If an effect is ignoring the users offset, we force it to the default position of the viewport.
+ if (ao_app->get_effect_property(play_effect[0], current_char, "ignore_offset") == "true") {
+ ui_vp_effect->move(ui_viewport->x(), ui_viewport->y());
+ return;
+ }
+
+ //Offset is not disabled, we move the effects layer to match the position of our character
+ //We need to add the viewport as an offset as effects are not bound to it.
+ int effect_x = (ui_viewport->width() * self_offset / 100) + ui_viewport->x();
+ int effect_y = (ui_viewport->height() * self_offset_v / 100) + ui_viewport->y();
+ ui_vp_effect->move(effect_x, effect_y);
}
void Courtroom::set_ip_list(QString p_list)