aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/aoapplication.h22
-rw-r--r--include/aocharmovie.h125
-rw-r--r--include/aoevidencedisplay.h4
-rw-r--r--include/aolayer.h214
-rw-r--r--include/aomovie.h36
-rw-r--r--include/aoscene.h42
-rw-r--r--include/courtroom.h69
7 files changed, 272 insertions, 240 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h
index 9b7cef13..c0c3ba37 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -130,6 +130,7 @@ public:
QString get_default_theme_path(QString p_file);
QString get_custom_theme_path(QString p_theme, QString p_file);
QString get_character_path(QString p_char, QString p_file);
+ QString get_misc_path(QString p_misc, QString p_file);
QString get_sounds_path(QString p_file);
QString get_music_path(QString p_song);
QString get_background_path(QString p_file);
@@ -301,14 +302,14 @@ public:
// Returns the color with p_identifier from p_file
QColor get_color(QString p_identifier, QString p_file);
- // Returns the markdown symbol used for specified p_identifier such as colors
- QString get_chat_markdown(QString p_identifier, QString p_file);
+ // Returns the markup symbol used for specified p_identifier such as colors
+ QString get_chat_markup(QString p_identifier, QString p_file);
// Returns the color from the misc folder.
QColor get_chat_color(QString p_identifier, QString p_chat);
// Returns the sfx with p_identifier from sounds.ini in the current theme path
- QString get_sfx(QString p_identifier);
+ QString get_sfx(QString p_identifier, QString p_misc="default");
// Figure out if we can opus this or if we should fall back to wav
QString get_sfx_suffix(QString sound_to_check);
@@ -380,9 +381,9 @@ public:
// t
QString get_effect(QString effect, QString p_char, QString p_folder);
- // Return the effect sound associated with the fx_name in the
- // misc/effects/<char-defined>/sounds.ini, or theme/effects/sounds.ini.
- QString get_effect_sound(QString fx_name, QString p_char);
+ // Return p_property of fx_name. If p_property is "sound", return
+ // the value associated with fx_name, otherwise use fx_name + '_' + p_property.
+ QString get_effect_property(QString fx_name, QString p_char, QString p_property);
// Returns the custom realisation used by the character.
QString get_custom_realization(QString p_char);
@@ -432,6 +433,15 @@ public:
// Returns p_char's blips (previously called their "gender")
QString get_blips(QString p_char);
+ // Get a property of a given emote, or get it from "options" if emote doesn't have it
+ QString get_emote_property(QString p_char, QString p_emote, QString p_property);
+
+ // Return a transformation mode from a string ("smooth" for smooth, anything else for fast)
+ Qt::TransformationMode get_scaling(QString p_scaling);
+
+ // Returns the scaling type for p_miscname
+ Qt::TransformationMode get_misc_scaling(QString p_miscname);
+
// ======
// These are all casing-related settings.
// ======
diff --git a/include/aocharmovie.h b/include/aocharmovie.h
deleted file mode 100644
index 2dda0ec2..00000000
--- a/include/aocharmovie.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef AOCHARMOVIE_H
-#define AOCHARMOVIE_H
-
-#include <QDebug>
-#include <QElapsedTimer>
-#include <QImageReader>
-#include <QLabel>
-#include <QTimer>
-
-class AOApplication;
-
-class AOCharMovie : public QLabel {
- Q_OBJECT
-
-public:
- AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app);
-
- // Play a hat.gif - style preanimation
- void play_pre(QString p_char, QString p_emote, int duration);
-
- // Play a (b)normal.gif - style animation (talking)
- void play_talking(QString p_char, QString p_emote);
-
- // Play an (a)normal.gif - style animation (not talking)
- void play_idle(QString p_char, QString p_emote);
-
- // Stop the movie, clearing the image
- void stop();
-
- // Set the m_flipped variable to true/false
- void set_flipped(bool p_flipped) { m_flipped = p_flipped; }
-
- // Set the movie's playback speed (between 10% and 1000%)
- void set_speed(int modifier) { speed = qMax(10, qMin(modifier, 1000)); }
-
- // Move the label itself around
- void move(int ax, int ay);
-
- // This is somewhat pointless now as there's no "QMovie" object to resize, aka
- // no "combo" to speak of
- void combo_resize(int w, int h);
-
- // Return the frame delay adjusted for speed
- int get_frame_delay(int delay);
-
- QStringList network_strings;
-
- QString m_char;
- QString m_emote;
-
-private:
- AOApplication *ao_app;
-
- QVector<QPixmap> movie_frames;
- QVector<int> movie_delays;
-
- // Effects such as sfx, screenshakes and realization flashes are stored in
- // here. QString entry format: "sfx^[sfx_name]", "shake", "flash". The program
- // uses the QVector index as reference.
- QVector<QVector<QString>> movie_effects;
-
- QTimer *preanim_timer;
- QTimer *ticker;
- QString last_path;
- QImageReader *m_reader = new QImageReader();
-
- QElapsedTimer actual_time;
-
- // Usually used to turn seconds into milliseconds such as for [Time] tag in
- // char.ini
- const int time_mod = 60;
-
- // These are the X and Y values before they are fixed based on the sprite's
- // width.
- int x = 0;
- int y = 0;
- // These are the width and height values before they are fixed based on the
- // sprite's width.
- int f_w = 0;
- int f_h = 0;
-
- int frame = 0;
- int max_frames = 0;
-
- int speed = 100;
-
- bool m_flipped = false;
- bool play_once = true;
-
- // Set the movie's image to provided paths, preparing for playback.
- void load_image(QString p_char, QString p_emote, QString emote_prefix);
-
- // Start playback of the movie (if animated).
- void play();
-
- // Play a frame-specific effect, if there's any defined for that specific
- // frame.
- void play_frame_effect(int frame);
-
- // Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a
- // provided QImage
- QPixmap get_pixmap(QImage image);
-
- // Set the movie's frame to provided pixmap
- void set_frame(QPixmap f_pixmap);
-
- // Initialize the frame-specific effects from the char.ini
- void load_effects();
-
- // Initialize the frame-specific effects from the provided network_strings,
- // this is only initialized if network_strings has size more than 0.
- void load_network_effects();
-
-signals:
- void done();
- void shake();
- void flash();
- void play_sfx(QString sfx);
-
-private slots:
- void preanim_done();
- void movie_ticker();
-};
-
-#endif // AOCHARMOVIE_H
diff --git a/include/aoevidencedisplay.h b/include/aoevidencedisplay.h
index 979a754e..ff448c91 100644
--- a/include/aoevidencedisplay.h
+++ b/include/aoevidencedisplay.h
@@ -2,7 +2,7 @@
#define AOEVIDENCEDISPLAY_H
#include "aoapplication.h"
-#include "aomovie.h"
+#include "aolayer.h"
#include "aosfxplayer.h"
#include <QDebug>
@@ -21,7 +21,7 @@ public:
private:
AOApplication *ao_app;
- AOMovie *evidence_movie;
+ InterfaceLayer *evidence_movie;
QLabel *evidence_icon;
AOSfxPlayer *sfx_player;
diff --git a/include/aolayer.h b/include/aolayer.h
new file mode 100644
index 00000000..2e0510a9
--- /dev/null
+++ b/include/aolayer.h
@@ -0,0 +1,214 @@
+#ifndef AOLAYER_H
+#define AOLAYER_H
+
+#include <QDebug>
+#include <QElapsedTimer>
+#include <QImageReader>
+#include <QLabel>
+#include <QTimer>
+#include <QBitmap>
+
+class AOApplication;
+
+class AOLayer : public QLabel {
+ Q_OBJECT
+
+public:
+ AOLayer(QWidget *p_parent, AOApplication *p_ao_app);
+
+ QString filename; // file name without extension, i.e. "witnesstestimony"
+ int static_duration; // time in ms for static images to be displayed, if
+ // applicable. set to 0 for infinite
+ int max_duration; // maximum duration in ms, image will be culled if it is
+ // exceeded. set this to 0 for infinite duration
+ 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
+ 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?
+
+ // Set the movie's image to provided paths, preparing for playback.
+ void start_playback(QString p_image);
+
+ void set_play_once(bool p_play_once);
+ void set_cull_image(bool p_cull_image);
+ void set_static_duration(int p_static_duration);
+ void set_max_duration(int p_max_duration);
+
+ // Stop the movie, clearing the image
+ void stop();
+
+ // Set the m_flipped variable to true/false
+ void set_flipped(bool p_flipped) { m_flipped = p_flipped; }
+
+ // Set the movie's playback speed (between 10% and 1000%)
+ void set_speed(int modifier) { speed = qMax(10, qMin(modifier, 1000)); }
+
+ // Move the label itself around
+ void move(int ax, int ay);
+
+ // This is somewhat pointless now as there's no "QMovie" object to resize, aka
+ // no "combo" to speak of
+ void combo_resize(int w, int h);
+
+ // Return the frame delay adjusted for speed
+ int get_frame_delay(int delay);
+
+ // iterate through a list of paths and return the first entry that exists. if
+ // none exist, return NULL (safe because we check again for existence later)
+ QString find_image(QList<QString> p_list);
+
+protected:
+ AOApplication *ao_app;
+ QVector<QPixmap> movie_frames;
+ QVector<int> movie_delays;
+
+ QTimer *preanim_timer;
+ QTimer *shfx_timer;
+ QTimer *ticker;
+ QString last_path;
+ QImageReader m_reader;
+
+ QElapsedTimer actual_time;
+
+ // Usually used to turn seconds into milliseconds such as for [Time] tag in
+ // char.ini
+ const int tick_ms = 60;
+
+ // These are the X and Y values before they are fixed based on the sprite's
+ // width.
+ int x = 0;
+ int y = 0;
+ // These are the width and height values before they are fixed based on the
+ // sprite's width.
+ int f_w = 0;
+ int f_h = 0;
+
+ int frame = 0;
+ int max_frames = 0;
+ int last_max_frames = 0;
+
+ 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;
+
+ // Start playback of the movie (if animated).
+ void play();
+
+ // Freeze the movie at the current frame.
+ void freeze();
+
+ // Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a
+ // provided QImage
+ QPixmap get_pixmap(QImage image);
+
+ // Set the movie's frame to provided pixmap
+ void set_frame(QPixmap f_pixmap);
+
+signals:
+ void done();
+
+protected slots:
+ virtual void preanim_done();
+ void shfx_timer_done();
+ virtual void movie_ticker();
+};
+
+class BackgroundLayer : public AOLayer {
+ Q_OBJECT
+public:
+ BackgroundLayer(QWidget *p_parent, AOApplication *p_ao_app);
+ 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:
+ CharLayer(QWidget *p_parent, AOApplication *p_ao_app);
+ QString current_emote = ""; // name of the emote we're using
+ bool is_preanim; // equivalent to the old play_once, if true we don't want
+ // to loop this
+ QString prefix = ""; // prefix, left blank if it's a preanim
+
+ void load_image(QString p_filename, QString p_charname, int p_duration, bool p_is_preanim);
+ void play(); // overloaded so we can play effects
+
+ // networked frame fx string
+ QStringList network_strings;
+
+private:
+ QString last_char; // name of the last character we used
+ QString last_emote; // name of the last animation we used
+ QString last_prefix; // prefix of the last animation we played
+ bool was_preanim = false; // whether is_preanim was true last time
+
+ // Effects such as sfx, screenshakes and realization flashes are stored in
+ // here. QString entry format: "sfx^[sfx_name]", "shake", "flash". The program
+ // uses the QVector index as reference.
+ QVector<QVector<QString>> movie_effects;
+
+ // used for effect loading
+ QString m_char = "";
+ QString m_emote = "";
+
+ // overloaded for effects reasons
+ void start_playback(QString p_image);
+
+ // Initialize the frame-specific effects from the char.ini
+ void load_effects();
+
+ // Initialize the frame-specific effects from the provided network_strings,
+ // this is only initialized if network_strings has size more than 0.
+ void load_network_effects();
+
+ // Play a frame-specific effect, if there's any defined for that specific
+ // frame.
+ void play_frame_effect(int p_frame);
+
+private slots:
+ void preanim_done() override; // overridden so we don't accidentally cull characters
+ void movie_ticker() override; // overridden so we can play effects
+
+signals:
+ void shake();
+ void flash();
+ void play_sfx(QString sfx);
+};
+
+class InterjectionLayer : public AOLayer {
+ Q_OBJECT
+public:
+ InterjectionLayer(QWidget *p_parent, AOApplication *p_ao_app);
+ void load_image(QString p_filename, QString p_charname, QString p_miscname);
+};
+
+class EffectLayer : public AOLayer {
+ Q_OBJECT
+public:
+ EffectLayer(QWidget *p_parent, AOApplication *p_ao_app);
+ void load_image(QString p_filename, bool p_looping);
+};
+
+class InterfaceLayer : public AOLayer {
+ Q_OBJECT
+public:
+ InterfaceLayer(QWidget *p_parent, AOApplication *p_ao_app);
+ void load_image(QString p_filename, QString p_miscname);
+};
+#endif // AOLAYER_H
diff --git a/include/aomovie.h b/include/aomovie.h
deleted file mode 100644
index eb7f7a53..00000000
--- a/include/aomovie.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef AOMOVIE_H
-#define AOMOVIE_H
-
-#include <QLabel>
-#include <QMovie>
-
-class Courtroom;
-class AOApplication;
-
-class AOMovie : public QLabel {
- Q_OBJECT
-
-public:
- AOMovie(QWidget *p_parent, AOApplication *p_ao_app);
-
- void set_play_once(bool p_play_once);
- void play(QString p_image, QString p_char = "", QString p_custom_theme = "",
- int default_duration = 0);
- void combo_resize(int w, int h);
- void stop();
-
-private:
- QMovie *m_movie;
- AOApplication *ao_app;
- QTimer *timer;
- bool play_once = true;
-
-signals:
- void done();
-
-private slots:
- void frame_change(int n_frame);
- void timer_done();
-};
-
-#endif // AOMOVIE_H
diff --git a/include/aoscene.h b/include/aoscene.h
deleted file mode 100644
index 726e2641..00000000
--- a/include/aoscene.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef AOSCENE_H
-#define AOSCENE_H
-
-#include <QDebug>
-#include <QLabel>
-#include <QMovie>
-
-class Courtroom;
-class AOApplication;
-
-class AOScene : public QLabel {
- Q_OBJECT
-public:
- explicit AOScene(QWidget *parent, AOApplication *p_ao_app);
-
- void set_image(QString p_image);
- void set_legacy_desk(QString p_image);
-
- // Move the label itself around
- void move(int ax, int ay);
-
- // This is somewhat pointless now as there's no "QMovie" object to resize, aka
- // no "combo" to speak of
- void combo_resize(int w, int h);
-
-private:
- QWidget *m_parent;
- QMovie *m_movie;
- AOApplication *ao_app;
- QString last_image;
-
- // These are the X and Y values before they are fixed based on the sprite's
- // width.
- int x = 0;
- int y = 0;
- // These are the width and height values before they are fixed based on the
- // sprite's width.
- int f_w = 0;
- int f_h = 0;
-};
-
-#endif // AOSCENE_H
diff --git a/include/courtroom.h b/include/courtroom.h
index e86330e6..5ad6fa61 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -5,17 +5,15 @@
#include "aoblipplayer.h"
#include "aobutton.h"
#include "aocharbutton.h"
-#include "aocharmovie.h"
#include "aoemotebutton.h"
#include "aoevidencebutton.h"
#include "aoevidencedisplay.h"
#include "aoimage.h"
+#include "aolayer.h"
#include "aolineedit.h"
-#include "aomovie.h"
#include "aomusicplayer.h"
#include "aooptionsdialog.h"
#include "aopacket.h"
-#include "aoscene.h"
#include "aosfxplayer.h"
#include "aotextarea.h"
#include "aotextedit.h"
@@ -151,6 +149,9 @@ public:
// reads theme inis and sets size and pos based on the identifier
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
+ // reads theme and char inis and sets size and pos based on the identifier
+ void set_size_and_pos(QWidget *p_widget, QString p_identifier, QString p_char);
+
// reads theme inis and returns the size and pos as defined by it
QPoint get_theme_pos(QString p_identifier);
@@ -224,11 +225,13 @@ public:
// Parse the chat message packet and unpack it into the m_chatmessage[ITEM] format
void unpack_chatmessage(QStringList p_contents);
- // Log the message contents and information such as evidence presenting etc. into the log file
- void log_chatmessage(QString f_message, int f_char_id, QString f_showname = "", int f_color = 0);
-
- // Display the message contents and information such as evidence presenting etc. in the IC logs
- void display_log_chatmessage(QString f_message, int f_char_id, QString f_showname = "", int f_color = 0);
+ enum LogMode {
+ IO_ONLY,
+ DISPLAY_ONLY,
+ DISPLAY_AND_IO
+ };
+ // Log the message contents and information such as evidence presenting etc. into the log file, the IC log, or both.
+ void log_chatmessage(QString f_message, int f_char_id, QString f_showname = "", int f_color = 0, LogMode f_log_mode=IO_ONLY);
// Log the message contents and information such as evidence presenting etc. into the IC logs
void handle_callwords();
@@ -264,7 +267,8 @@ public:
QString filter_ic_text(QString p_text, bool colorize = false, int pos = -1,
int default_color = 0);
- void log_ic_text(QString p_name, QString p_showname, QString p_message, QString p_action="", int p_color=0);
+ void log_ic_text(QString p_name, QString p_showname, QString p_message,
+ QString p_action = "", int p_color = 0);
// adds text to the IC chatlog. p_name first as bold then p_text then a newlin
// this function keeps the chatlog scrolled to the top unless there's text
@@ -380,7 +384,8 @@ private:
// True, if log should display colors.
bool log_colors = true;
- // True, if the log should display the message like name<br>text instead of name: text
+ // True, if the log should display the message like name<br>text instead of
+ // name: text
bool log_newline = false;
// True, if the log should include RP actions like interjections, showing evidence, etc.
@@ -408,16 +413,21 @@ private:
const int time_mod = 40;
// the amount of time non-animated objection/hold it/takethat images stay
- // onscreen for in ms
- const int shout_stay_time = 724;
+ // onscreen for in ms, and the maximum amount of time any interjections are
+ // allowed to play
+ const int shout_static_time = 724;
+ const int shout_max_time = 1500;
// the amount of time non-animated guilty/not guilty images stay onscreen for
- // in ms
- const int verdict_stay_time = 3000;
+ // in ms, and the maximum amount of time g/ng images are allowed to play
+ const int verdict_static_time = 3000;
+ const int verdict_max_time = 4000;
// the amount of time non-animated witness testimony/cross-examination images
- // stay onscreen for in ms
- const int wtce_stay_time = 1500;
+ // stay onscreen for in ms, and the maximum time any wt/ce image is allowed to
+ // play
+ const int wtce_static_time = 1500;
+ const int wtce_max_time = 4000;
// characters we consider punctuation
const QString punctuation_chars = ".,?!:;";
@@ -441,7 +451,7 @@ private:
bool is_muted = false;
// state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 =
- // noniterrupting preanim
+ // noniterrupting preanim, 5 = (c) animation
int anim_state = 3;
// whether or not current color is a talking one
@@ -512,6 +522,7 @@ private:
// is the message we're about to send supposed to present evidence?
bool is_presenting_evidence = false;
+ bool c_played = false; // whether we've played a (c)-style postanimation yet
// have we already presented evidence for this message?
bool evidence_presented = false;
@@ -579,21 +590,20 @@ private:
AOImage *ui_background;
QWidget *ui_viewport;
- AOScene *ui_vp_background;
- AOMovie *ui_vp_speedlines;
- AOCharMovie *ui_vp_player_char;
- AOCharMovie *ui_vp_sideplayer_char;
- AOScene *ui_vp_desk;
- AOScene *ui_vp_legacy_desk;
+ BackgroundLayer *ui_vp_background;
+ ForegroundLayer *ui_vp_speedlines;
+ CharLayer *ui_vp_player_char;
+ CharLayer *ui_vp_sideplayer_char;
+ BackgroundLayer *ui_vp_desk;
AOEvidenceDisplay *ui_vp_evidence_display;
AOImage *ui_vp_chatbox;
QLabel *ui_vp_showname;
- AOMovie *ui_vp_chat_arrow;
+ InterfaceLayer *ui_vp_chat_arrow;
QTextEdit *ui_vp_message;
- AOMovie *ui_vp_effect;
- AOMovie *ui_vp_testimony;
- AOMovie *ui_vp_wtce;
- AOMovie *ui_vp_objection;
+ EffectLayer *ui_vp_effect;
+ InterfaceLayer *ui_vp_testimony;
+ InterjectionLayer *ui_vp_wtce;
+ InterjectionLayer *ui_vp_objection;
QTextEdit *ui_ic_chatlog;
@@ -605,7 +615,7 @@ private:
QTreeWidget *ui_music_list;
ScrollText *ui_music_name;
- AOMovie *ui_music_display;
+ InterfaceLayer *ui_music_display;
AOButton *ui_pair_button;
QListWidget *ui_pair_list;
@@ -759,6 +769,7 @@ private:
void regenerate_ic_chatlog();
public slots:
void objection_done();
+ void effect_done();
void preanim_done();
void do_screenshake();
void do_flash();