aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2021-01-29 11:41:53 -0600
committerGitHub <noreply@github.com>2021-01-29 20:41:53 +0300
commit5cafb011f5b3cc2aef780f767e0bf054d18efc0f (patch)
tree091b63d78d343c989c752339894fdd9f79642498 /src
parent4a9480afdc189021cef1b5c85b580d89f57f464b (diff)
Fix music_display not stretching properly, reconsolidate ForegroundLayer into InterjectionLayer, rename InterjectionLayer to SplashLayer (#436)
* more intelligent separation * separation 2 electric boogaloo * rename InterjectionLayer to SplashLayer * remove redundant layer type * comments and cleanup * fix incorrect use of continuous * remove nonfunctional check * fix additive not coloring correctly Co-authored-by: Crystalwarrior <varsash@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/aolayer.cpp38
-rw-r--r--src/courtroom.cpp48
2 files changed, 31 insertions, 55 deletions
diff --git a/src/aolayer.cpp b/src/aolayer.cpp
index efa0e447..f037b219 100644
--- a/src/aolayer.cpp
+++ b/src/aolayer.cpp
@@ -28,10 +28,6 @@ BackgroundLayer::BackgroundLayer(QWidget *p_parent, AOApplication *p_ao_app)
: AOLayer(p_parent, p_ao_app)
{
}
-ForegroundLayer::ForegroundLayer(QWidget *p_parent, AOApplication *p_ao_app)
- : AOLayer(p_parent, p_ao_app)
-{
-}
CharLayer::CharLayer(QWidget *p_parent, AOApplication *p_ao_app)
: AOLayer(p_parent, p_ao_app)
{
@@ -40,7 +36,7 @@ EffectLayer::EffectLayer(QWidget *p_parent, AOApplication *p_ao_app)
: AOLayer(p_parent, p_ao_app)
{
}
-InterjectionLayer::InterjectionLayer(QWidget *p_parent, AOApplication *p_ao_app)
+SplashLayer::SplashLayer(QWidget *p_parent, AOApplication *p_ao_app)
: AOLayer(p_parent, p_ao_app)
{
}
@@ -48,7 +44,6 @@ InterfaceLayer::InterfaceLayer(QWidget *p_parent, AOApplication *p_ao_app)
: AOLayer(p_parent, p_ao_app)
{
}
-
StickerLayer::StickerLayer(QWidget *p_parent, AOApplication *p_ao_app)
: AOLayer(p_parent, p_ao_app)
{
@@ -135,27 +130,6 @@ void BackgroundLayer::load_image(QString p_filename)
start_playback(ao_app->get_image_suffix(ao_app->get_background_path(p_filename)));
}
-void ForegroundLayer::load_image(QString p_filename, QString p_charname)
-{
- play_once = false;
- cull_image = false;
- miscname = ao_app->get_char_shouts(p_charname);
- qDebug() << "[ForegroundLayer] FG loaded: " << p_filename;
- QList<QString> pathlist = {
- ao_app->get_image_suffix(ao_app->get_character_path(
- p_charname, p_filename)), // first check the character folder
- ao_app->get_image_suffix(ao_app->get_theme_path(
- "misc/" + miscname + "/" +
- p_filename)), // then check our theme's misc directory
- ao_app->get_image_suffix(ao_app->get_misc_path(
- miscname, p_filename)), // then check our global misc folder
- ao_app->get_image_suffix(
- ao_app->get_theme_path(p_filename)), // then check the user's theme
- ao_app->get_image_suffix(ao_app->get_default_theme_path(
- p_filename))}; // and finally check the default theme
- start_playback(find_image(pathlist));
-}
-
void CharLayer::load_image(QString p_filename, QString p_charname,
int p_duration, bool p_is_preanim)
{
@@ -219,12 +193,9 @@ void CharLayer::load_image(QString p_filename, QString p_charname,
this->start_playback(find_image(pathlist));
}
-void InterjectionLayer::load_image(QString p_filename, QString p_charname,
+void SplashLayer::load_image(QString p_filename, QString p_charname,
QString p_miscname)
{
- continuous = false;
- force_continuous = true;
- play_once = true;
transform_mode = ao_app->get_misc_scaling(p_miscname);
QList<QString> pathlist = {
ao_app->get_image_suffix(ao_app->get_character_path(
@@ -269,7 +240,7 @@ void EffectLayer::load_image(QString p_filename, bool p_looping)
void InterfaceLayer::load_image(QString p_filename, QString p_miscname)
{
- transform_mode = ao_app->get_misc_scaling(p_miscname);
+ stretch = true;
QList<QString> pathlist = {
ao_app->get_image_suffix(ao_app->get_theme_path(
"misc/" + p_miscname + "/" +
@@ -371,12 +342,9 @@ void AOLayer::start_playback(QString p_image)
int l_delay = m_reader.nextImageDelay();
movie_frames.append(l_pixmap);
movie_delays.append(l_delay);
- // qDebug() << "appending delay of " << l_delay;
}
}
last_path = p_image;
- // qDebug() << "CONT: " << continuous << " MAX: " << max_frames
- // << " LAST MAX: " << last_max_frames << " FRAME: " << frame;
QPixmap f_pixmap = this->get_pixmap(m_reader.read());
int f_delay = m_reader.nextImageDelay();
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 751f9a8d..e8b58a49 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -44,7 +44,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_viewport = new QWidget(this);
ui_vp_background = new BackgroundLayer(ui_viewport, ao_app);
- ui_vp_speedlines = new ForegroundLayer(ui_viewport, ao_app);
+ ui_vp_speedlines = new SplashLayer(ui_viewport, ao_app);
ui_vp_player_char = new CharLayer(ui_viewport, ao_app);
ui_vp_sideplayer_char = new CharLayer(ui_viewport, ao_app);
ui_vp_sideplayer_char->hide();
@@ -67,13 +67,18 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui_vp_message->setReadOnly(true);
- ui_vp_testimony = new InterfaceLayer(this, ao_app);
+ ui_vp_testimony = new SplashLayer(this, ao_app);
ui_vp_testimony->set_play_once(false);
ui_vp_testimony->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_vp_wtce = new InterjectionLayer(this, ao_app);
+ ui_vp_wtce = new SplashLayer(this, ao_app);
ui_vp_wtce->set_play_once(true);
+ ui_vp_wtce->continuous = false;
+ ui_vp_wtce->force_continuous = true;
ui_vp_wtce->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_vp_objection = new InterjectionLayer(this, ao_app);
+ ui_vp_objection = new SplashLayer(this, ao_app);
+ ui_vp_objection->set_play_once(true);
+ ui_vp_objection->continuous = false;
+ ui_vp_objection->force_continuous = true;
ui_vp_objection->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_ic_chatlog = new QTextEdit(this);
@@ -115,6 +120,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_music_display = new InterfaceLayer(this, ao_app);
ui_music_display->set_play_once(false);
+ ui_music_display->transform_mode = Qt::SmoothTransformation;
ui_music_display->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_music_name = new ScrollText(ui_music_display);
@@ -1998,6 +2004,7 @@ void Courtroom::chatmessage_dequeue()
QString f_char = m_chatmessage[CHAR_NAME];
f_custom_theme = ao_app->get_chat(f_char);
}
+ ui_vp_chat_arrow->transform_mode = ao_app->get_misc_scaling(f_custom_theme);
ui_vp_chat_arrow->load_image("chat_arrow", f_custom_theme);
// Nothing to parse in the queue
@@ -2592,18 +2599,16 @@ void Courtroom::initialize_chatbox()
// This should probably be called only if any change from the last chat
// arrow was actually detected.
- if (current_misc != last_misc) {
- pos_size_type design_ini_result = ao_app->get_element_dimensions(
- "chat_arrow", "courtroom_design.ini", customchar);
- if (design_ini_result.width < 0 || design_ini_result.height < 0) {
- qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini";
- ui_vp_chat_arrow->hide();
- }
- else {
- ui_vp_chat_arrow->move(design_ini_result.x + ui_vp_chatbox->x(), design_ini_result.y + ui_vp_chatbox->y());
- ui_vp_chat_arrow->combo_resize(design_ini_result.width,
- design_ini_result.height);
- }
+ pos_size_type design_ini_result = ao_app->get_element_dimensions(
+ "chat_arrow", "courtroom_design.ini", customchar);
+ if (design_ini_result.width < 0 || design_ini_result.height < 0) {
+ qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini";
+ ui_vp_chat_arrow->hide();
+ }
+ else {
+ ui_vp_chat_arrow->move(design_ini_result.x + ui_vp_chatbox->x(), design_ini_result.y + ui_vp_chatbox->y());
+ ui_vp_chat_arrow->combo_resize(design_ini_result.width,
+ design_ini_result.height);
}
pos_size_type default_width = ao_app->get_element_dimensions(
@@ -2719,7 +2724,7 @@ void Courtroom::handle_ic_speaking()
filename = "prosecution_speedlines";
else
filename = "defense_speedlines";
- ui_vp_speedlines->load_image(filename, m_chatmessage[CHAR_NAME]);
+ ui_vp_speedlines->load_image(filename, m_chatmessage[CHAR_NAME], ao_app->get_char_shouts(m_chatmessage[CHAR_NAME]));
}
// Check if this is a talking color (white text, etc.)
@@ -3308,12 +3313,14 @@ void Courtroom::chat_tick()
f_char = m_chatmessage[CHAR_NAME];
f_custom_theme = ao_app->get_chat(f_char);
}
- ui_vp_chat_arrow->load_image("chat_arrow",f_custom_theme); // Chat stopped being processed, indicate that.
+ ui_vp_chat_arrow->transform_mode = ao_app->get_misc_scaling(f_custom_theme);
+ ui_vp_chat_arrow->load_image("chat_arrow", 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());
QString f_message_filtered = filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt());
for (int c = 0; c < max_colors; ++c) {
+ additive_previous = additive_previous.replace("$c" + QString::number(c), char_color_rgb_list.at(c).name(QColor::HexRgb));
f_message_filtered = f_message_filtered.replace("$c" + QString::number(c), char_color_rgb_list.at(c).name(QColor::HexRgb));
}
additive_previous = additive_previous + f_message_filtered;
@@ -3448,6 +3455,7 @@ void Courtroom::chat_tick()
// Do the colors, gradual showing, etc. in here
QString f_message_filtered = filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt());
for (int c = 0; c < max_colors; ++c) {
+ additive_previous = additive_previous.replace("$c" + QString::number(c), char_color_rgb_list.at(c).name(QColor::HexRgb));
f_message_filtered = f_message_filtered.replace("$c" + QString::number(c), char_color_rgb_list.at(c).name(QColor::HexRgb));
}
ui_vp_message->setHtml(additive_previous + f_message_filtered);
@@ -3772,6 +3780,7 @@ void Courtroom::handle_song(QStringList *p_contents)
void Courtroom::handle_wtce(QString p_wtce, int variant)
{
QString sfx_file = "courtroom_sounds.ini";
+ QString bg_misc = ao_app->read_design_ini("misc", ao_app->get_background_path("design.ini"));
QString sfx_name;
QString filename;
ui_vp_wtce->set_static_duration(wtce_static_time);
@@ -3780,7 +3789,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
if (p_wtce == "testimony1") {
sfx_name = "witness_testimony";
filename = "witnesstestimony";
- ui_vp_testimony->load_image("testimony", "");
+ ui_vp_testimony->load_image("testimony", "", bg_misc);
}
// cross examination
else if (p_wtce == "testimony2") {
@@ -3802,7 +3811,6 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
ui_vp_testimony->stop();
}
}
- QString bg_misc = ao_app->read_design_ini("misc", ao_app->get_background_path("design.ini"));
sfx_player->play(ao_app->get_sfx(sfx_name, bg_misc));
ui_vp_wtce->load_image(filename, "", bg_misc);
ui_vp_wtce->set_play_once(true);