From 661ec87646fe57a0081d49e428267b0dfe3f0d65 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 20:02:24 +0300 Subject: Implement networking for frame-specific effects data sending/parsing if the server supports it Reorganize charmovie.h a bit and make some functions private Add a new helper function "read_char_ini_tag" which returns a qstringlist of all key=value strings associated with the tag --- include/aoapplication.h | 3 +++ include/aocharmovie.h | 41 ++++++++++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/aoapplication.h b/include/aoapplication.h index 88855968..eb12b0c1 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -232,6 +232,9 @@ public: //Returns the value of p_search_line within target_tag and terminator_tag QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); + //Returns a QStringList of all key=value definitions on a given tag. + QStringList read_char_ini_tag(QString p_char, QString target_tag); + //Returns the side of the p_char character from that characters ini file QString get_char_side(QString p_char); diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 5eaafaf6..d066a399 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -17,12 +17,6 @@ class AOCharMovie : public QLabel public: AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); - //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 hat.gif - style preanimation void play_pre(QString p_char, QString p_emote, int duration); @@ -32,15 +26,6 @@ public: //Play an (a)normal.gif - style animation (not talking) void play_idle(QString p_char, QString p_emote); - //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); - //Stop the movie, clearing the image void stop(); @@ -59,6 +44,8 @@ public: //Return the frame delay adjusted for speed int get_frame_delay(int delay); + QStringList network_strings; + private: AOApplication *ao_app; @@ -75,6 +62,9 @@ private: QString last_path; QImageReader *m_reader = new QImageReader(); + QString m_char; + QString m_emote; + QElapsedTimer actual_time; const int time_mod = 60; @@ -90,6 +80,27 @@ private: 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(); -- cgit