aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------base/themes0
-rw-r--r--include/aolayer.h46
-rw-r--r--include/courtroom.h8
-rw-r--r--src/aolayer.cpp38
-rw-r--r--src/courtroom.cpp48
5 files changed, 64 insertions, 76 deletions
diff --git a/base/themes b/base/themes
-Subproject 9090a63dec0384c63fc4bdc7fc68dccb961e05c
+Subproject 15b0cc4aa1241a9b740fb1ce8a61c7f699a80de
diff --git a/include/aolayer.h b/include/aolayer.h
index 6265cec6..8510edfb 100644
--- a/include/aolayer.h
+++ b/include/aolayer.h
@@ -10,6 +10,27 @@
class AOApplication;
+// "Brief" explanation of what the hell this is:
+//
+// AOLayer handles all animations both inside and outside
+// the viewport. It was originally devised as a layering
+// system, but turned into a full refactor of the existing
+// animation code.
+//
+// AOLayer has six subclasses, all of which differ mainly in
+// how they handle path resolution.
+//
+// - BackgroundLayer: self-explanatory, handles files found in base/background
+// - CharLayer: handles all the "wonderful" quirks of character path resolution
+// - SplashLayer: handles elements that can either be provided by a misc/ directory
+// or by the theme - speedlines, shouts, WT/CE, et cetera
+// - EffectLayer: this is basically a dummy layer since effects do their own wonky
+// path resolution in a different file
+// - InterfaceLayer: handles UI elements like the chat arrow and the music display
+// - StickerLayer: Crystalwarrior really wanted this. Handles "stickers," whatever those are.
+//
+// For questions comments or concerns, bother someone else
+
class AOLayer : public QLabel {
Q_OBJECT
@@ -24,6 +45,11 @@ public:
bool play_once = false; // Whether to loop this animation or not
bool cull_image = true; // if we're done playing this animation, should we
// hide it? also controls durational culling
+ // Are we loading this from the same frame we left off on?
+ bool continuous = false;
+ // Whether or not to forcibly bypass the simple check done by start_playback
+ // and use the existent value of continuous instead
+ bool force_continuous = false;
Qt::TransformationMode transform_mode = Qt::FastTransformation; // transformation mode to use for this image
bool stretch = false; // Should we stretch/squash this image to fill the screen?
@@ -72,7 +98,7 @@ protected:
QElapsedTimer actual_time;
// Usually used to turn seconds into milliseconds such as for [Time] tag in
- // char.ini
+ // char.ini (which is no longer used)
const int tick_ms = 60;
// These are the X and Y values before they are fixed based on the sprite's
@@ -91,12 +117,6 @@ protected:
int speed = 100;
bool m_flipped = false;
- // Are we loading this from the same frame we left off on? TODO: actually make
- // this work
- bool continuous = false;
- // Whether or not to forcibly bypass the simple check done by start_playback
- // and use the existent value of continuous instead
- bool force_continuous = false;
int duration = 0;
@@ -129,14 +149,6 @@ public:
void load_image(QString p_filename);
};
-class ForegroundLayer : public AOLayer {
- Q_OBJECT
-public:
- ForegroundLayer(QWidget *p_parent, AOApplication *p_ao_app);
- QString miscname; //'misc' folder to search. we fetch this based on p_charname below
- void load_image(QString p_filename, QString p_charname);
-};
-
class CharLayer : public AOLayer {
Q_OBJECT
public:
@@ -191,10 +203,10 @@ signals:
void play_sfx(QString sfx);
};
-class InterjectionLayer : public AOLayer {
+class SplashLayer : public AOLayer {
Q_OBJECT
public:
- InterjectionLayer(QWidget *p_parent, AOApplication *p_ao_app);
+ SplashLayer(QWidget *p_parent, AOApplication *p_ao_app);
void load_image(QString p_filename, QString p_charname, QString p_miscname);
};
diff --git a/include/courtroom.h b/include/courtroom.h
index 04b166f2..cebdfe24 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -605,7 +605,7 @@ private:
QWidget *ui_viewport;
BackgroundLayer *ui_vp_background;
- ForegroundLayer *ui_vp_speedlines;
+ SplashLayer *ui_vp_speedlines;
CharLayer *ui_vp_player_char;
CharLayer *ui_vp_sideplayer_char;
BackgroundLayer *ui_vp_desk;
@@ -614,10 +614,10 @@ private:
QLabel *ui_vp_showname;
InterfaceLayer *ui_vp_chat_arrow;
QTextEdit *ui_vp_message;
- InterfaceLayer *ui_vp_testimony;
- InterjectionLayer *ui_vp_wtce;
+ SplashLayer *ui_vp_testimony;
+ SplashLayer *ui_vp_wtce;
EffectLayer *ui_vp_effect;
- InterjectionLayer *ui_vp_objection;
+ SplashLayer *ui_vp_objection;
QTextEdit *ui_ic_chatlog;
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);