aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Attorney_Online.pro2
-rw-r--r--README.md8
-rw-r--r--base/sounds/general/adminhelp.oggbin0 -> 17220 bytes
-rw-r--r--base/sounds/general/case_announced.oggbin0 -> 15790 bytes
-rw-r--r--base/sounds/music/failed_login.opusbin0 -> 396160 bytes
-rw-r--r--base/themes/default/courtroom_design.ini5
-rw-r--r--base/themes/default/courtroom_sounds.ini5
-rw-r--r--base/themes/default/screenshake.pngbin0 -> 3507 bytes
-rw-r--r--base/themes/default/screenshake_pressed.pngbin0 -> 3324 bytes
-rw-r--r--include/aoapplication.h35
-rw-r--r--include/aocaseannouncerdialog.h1
-rw-r--r--include/aocharmovie.h31
-rw-r--r--include/aomusicplayer.h21
-rw-r--r--include/aooptionsdialog.h8
-rw-r--r--include/aosfxplayer.h6
-rw-r--r--include/courtroom.h93
-rw-r--r--include/datatypes.h7
-rw-r--r--include/lobby.h3
-rw-r--r--src/aocaseannouncerdialog.cpp6
-rw-r--r--src/aocharmovie.cpp261
-rw-r--r--src/aoevidencebutton.cpp4
-rw-r--r--src/aomusicplayer.cpp54
-rw-r--r--src/aooptionsdialog.cpp54
-rw-r--r--src/aosfxplayer.cpp21
-rw-r--r--src/charselect.cpp109
-rw-r--r--src/courtroom.cpp479
-rw-r--r--src/lobby.cpp4
-rw-r--r--src/main.cpp2
-rw-r--r--src/packet_distribution.cpp134
-rw-r--r--src/path_functions.cpp23
-rw-r--r--src/text_file_functions.cpp63
31 files changed, 1106 insertions, 333 deletions
diff --git a/Attorney_Online.pro b/Attorney_Online.pro
index c64ba473..488ddd1d 100644
--- a/Attorney_Online.pro
+++ b/Attorney_Online.pro
@@ -3,7 +3,7 @@ QT += core gui widgets network
TARGET = Attorney_Online
TEMPLATE = app
-VERSION = 2.6.2.0
+VERSION = 2.7.2.0
INCLUDEPATH += $$PWD/include
DESTDIR = $$PWD/bin
diff --git a/README.md b/README.md
index 0416e4a3..5d8e2c64 100644
--- a/README.md
+++ b/README.md
@@ -100,6 +100,14 @@ If you begin a message with `~~` (two tildes), the two tildes are removed and th
If two players are in the same position and select each other's characters using the in-game pair list (or with `/pair [id]`), they will appear alongside each other. You can set the offset of your character using the provided spinbox (or with `/offset [percentage]`).
+### Screenflash (2.6+)
+
+Placing a `$` (dollar symbol) at any point in the message will cause a white flash to appear at that point, and the symbol will disappear. You can do this multiple times in one message and stack it up with any other markup symbol. The flash will be silent, unlike the equivalent button.
+
+### Screenshake (2.6+)
+
+Placing an `@` (at symbol) at any point in the message will cause the screen to shake at that point, and the symbol will disappear. You can do this multiple times in one message and stack it up with any other markup symbol (including the screenflash).
+
### Non-interrupting preanimations (2.6+)
When checked, this will force text to immediately begin displaying without waiting for the preanimation to finish.
diff --git a/base/sounds/general/adminhelp.ogg b/base/sounds/general/adminhelp.ogg
new file mode 100644
index 00000000..704c0fd6
--- /dev/null
+++ b/base/sounds/general/adminhelp.ogg
Binary files differ
diff --git a/base/sounds/general/case_announced.ogg b/base/sounds/general/case_announced.ogg
new file mode 100644
index 00000000..1e9c3d4e
--- /dev/null
+++ b/base/sounds/general/case_announced.ogg
Binary files differ
diff --git a/base/sounds/music/failed_login.opus b/base/sounds/music/failed_login.opus
new file mode 100644
index 00000000..33532ee5
--- /dev/null
+++ b/base/sounds/music/failed_login.opus
Binary files differ
diff --git a/base/themes/default/courtroom_design.ini b/base/themes/default/courtroom_design.ini
index eee76251..f2dd2d78 100644
--- a/base/themes/default/courtroom_design.ini
+++ b/base/themes/default/courtroom_design.ini
@@ -107,7 +107,7 @@ pre = 5, 490, 80, 21
flip = 104, 490, 51, 21
; Guard button
-guard = 200, 580, 61, 21
+guard = 200, 580, 81, 21
pre_no_interrupt = 200, 490, 80, 21
@@ -132,6 +132,9 @@ call_mod = 104, 637, 64, 23
; Mute button
mute_button = 150, 515, 42, 42
+; Screenshake
+screenshake = 51, 515, 42, 42
+
; Where the Mute list pops up when you click Mute
mute_list = 280, 469, 210, 198
diff --git a/base/themes/default/courtroom_sounds.ini b/base/themes/default/courtroom_sounds.ini
index b24e2ce9..eba07a6c 100644
--- a/base/themes/default/courtroom_sounds.ini
+++ b/base/themes/default/courtroom_sounds.ini
@@ -3,6 +3,7 @@ witness_testimony = sfx-testimony2.wav
cross_examination = sfx-testimony.wav
evidence_present = sfx-evidenceshoop.wav
word_call = sfx-gaspen-yeah!.wav
-mod_call = sfx-gallery.wav
+mod_call = adminhelp.ogg
not_guilty = sfx-notguilty.wav
-guilty = sfx-guilty.wav \ No newline at end of file
+guilty = sfx-guilty.wav
+case_call = case_announced.ogg \ No newline at end of file
diff --git a/base/themes/default/screenshake.png b/base/themes/default/screenshake.png
new file mode 100644
index 00000000..5b71e3bc
--- /dev/null
+++ b/base/themes/default/screenshake.png
Binary files differ
diff --git a/base/themes/default/screenshake_pressed.png b/base/themes/default/screenshake_pressed.png
new file mode 100644
index 00000000..43e01c85
--- /dev/null
+++ b/base/themes/default/screenshake_pressed.png
Binary files differ
diff --git a/include/aoapplication.h b/include/aoapplication.h
index 5475eb7b..280b7314 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -27,6 +27,11 @@
#include <QAudioDeviceInfo>
#endif
+#include <QtConcurrent/QtConcurrent>
+#include <QThread>
+#include <QThreadPool>
+#include <QFuture>
+
class NetworkManager;
class Lobby;
class Courtroom;
@@ -78,6 +83,7 @@ public:
bool arup_enabled = false;
bool casing_alerts_enabled = false;
bool modcall_reason_enabled = false;
+ bool looping_sfx_support_enabled = false;
///////////////loading info///////////////////
@@ -93,6 +99,7 @@ public:
int loaded_evidence = 0;
int music_list_size = 0;
int loaded_music = 0;
+ int area_count = 0;
bool courtroom_loaded = false;
@@ -150,6 +157,12 @@ public:
//Returns true if blank blips is enabled in config.ini and false otherwise
bool get_blank_blip();
+ //Returns true if looping sound effects are enabled in the config.ini
+ bool get_looping_sfx();
+
+ //Returns true if kill music on object is enabled in the config.ini
+ bool get_objectmusic();
+
//Returns the value of default_music in config.ini
int get_default_music();
@@ -163,6 +176,10 @@ public:
// from the config.ini.
bool is_discord_enabled();
+ // Returns the value of whether shaking and flashing should be enabled.
+ // from the config.ini.
+ bool is_shakeandflash_enabled();
+
// Returns the value of the maximum amount of lines the IC chatlog
// may contain, from config.ini.
int get_max_log_size();
@@ -267,6 +284,18 @@ public:
//Returns the sfx of p_char's p_emote
QString get_sfx_name(QString p_char, int p_emote);
+ //Returns if an emote loops it's SFX
+ QString get_sfx_looping(QString p_char, int p_emote);
+
+ //Returns if an emote has a frame specific SFX for it
+ QString get_frame_sfx_name(QString p_char, QString p_emote, int n_frame);
+
+ //Returns if an emote has a frame specific SFX for it
+ QString get_realization_frame(QString p_char, QString p_emote, int n_frame);
+
+ //Returns if an emote has a frame specific SFX for it
+ QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame);
+
//Not in use
int get_sfx_delay(QString p_char, int p_emote);
@@ -304,13 +333,15 @@ public:
// Same for CM.
bool get_casing_cm_enabled();
+ // Same for witnesses.
+ bool get_casing_wit_enabled();
+
// Get the message for the CM for casing alerts.
QString get_casing_can_host_cases();
private:
const int RELEASE = 2;
- const int MAJOR_VERSION = 6;
- const int MINOR_VERSION = 2;
+ const int MAJOR_VERSION = 7;
QString current_theme = "default";
diff --git a/include/aocaseannouncerdialog.h b/include/aocaseannouncerdialog.h
index a238c3f2..da26fab0 100644
--- a/include/aocaseannouncerdialog.h
+++ b/include/aocaseannouncerdialog.h
@@ -36,6 +36,7 @@ private:
QCheckBox *ui_judge_needed;
QCheckBox *ui_juror_needed;
QCheckBox *ui_steno_needed;
+ QCheckBox *ui_witness_needed;
public slots:
void ok_pressed();
diff --git a/include/aocharmovie.h b/include/aocharmovie.h
index 7ef7da3f..6c127a66 100644
--- a/include/aocharmovie.h
+++ b/include/aocharmovie.h
@@ -6,9 +6,12 @@
#include <QTimer>
#include <QDebug>
#include <QImageReader>
+#include <QPainter>
+#include "include/aosfxplayer.h"
+#include "include/courtroom.h"
-class AOApplication;
+class AOApplication;
class AOCharMovie : public QLabel
{
Q_OBJECT
@@ -22,36 +25,52 @@ public:
void play_idle(QString p_char, QString p_emote);
void set_flipped(bool p_flipped) {m_flipped = p_flipped;}
-
+ void LoadImageWithStupidMethodForFlipSupport(QImage image);
void stop();
void move(int ax, int ay);
-
void combo_resize(int w, int h);
-
+ void play_frame_sfx();
+
+ void sfx_two_network_boogaloo();
+ void screenshake_two_network_boogaloo();
+ void realization_two_network_boogaloo();
+
+ AOSfxPlayer *frame_specific_sfx_player;
+ Courtroom *mycourtroom;
+ QString frame_sfx_hellstring = "";
+ QString frame_screenshake_hellstring = "";
+ QString frame_realization_hellstring = "";
+ bool use_networked_framehell = false;
private:
AOApplication *ao_app;
QMovie *m_movie;
QVector<QImage> movie_frames;
QTimer *preanim_timer;
+ QTimer *ticker;
+ QString last_path;
+ QString current_emote;
+ QString current_char;
const int time_mod = 62;
// These are the X and Y values before they are fixed based on the sprite's width.
int x = 0;
int y = 0;
+ int default_w;
+ int default_h;
bool m_flipped = false;
bool play_once = true;
+ bool apng = false;
signals:
void done();
private slots:
- void frame_change(int n_frame);
void timer_done();
+ void movie_ticker();
};
-
#endif // AOCHARMOVIE_H
diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h
index b34267c9..71ae6045 100644
--- a/include/aomusicplayer.h
+++ b/include/aomusicplayer.h
@@ -11,26 +11,33 @@
#include <QWidget>
#include <string.h>
#include <QDebug>
+#include <QTimer>
+#include <QObject>
-#if defined(BASSAUDIO)
-class AOMusicPlayer
+class AOMusicPlayer : public QObject
{
+ Q_OBJECT
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
- ~AOMusicPlayer();
-
+ virtual ~AOMusicPlayer();
void play(QString p_song);
void set_volume(int p_value);
+ void kill_loop();
+ QString get_path();
+ bool enable_looping = true;
+
private:
QWidget *m_parent;
AOApplication *ao_app;
-
int m_volume = 0;
+ QString f_path;
+
HSTREAM m_stream;
+
};
#elif defined(QTAUDIO)
-class AOMusicPlayer
+class AOMusicPlayer : public QObject
{
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
@@ -47,7 +54,7 @@ private:
int m_volume = 0;
};
#else
-class AOMusicPlayer
+class AOMusicPlayer : public QObject
{
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h
index 934d2577..233d079a 100644
--- a/include/aooptionsdialog.h
+++ b/include/aooptionsdialog.h
@@ -61,6 +61,8 @@ private:
QLineEdit *ui_ms_textbox;
QLabel *ui_discord_lbl;
QCheckBox *ui_discord_cb;
+ QLabel *ui_epilepsy_lbl;
+ QCheckBox *ui_epilepsy_cb;
QLabel *ui_language_label;
QComboBox *ui_language_combobox;
@@ -88,6 +90,10 @@ private:
QLabel *ui_bliprate_lbl;
QCheckBox *ui_blank_blips_cb;
QLabel *ui_blank_blips_lbl;
+ QLabel *ui_loopsfx_lbl;
+ QCheckBox *ui_loopsfx_cb;
+ QLabel *ui_objectmusic_lbl;
+ QCheckBox *ui_objectmusic_cb;
QDialogButtonBox *ui_settings_buttons;
QWidget *ui_casing_tab;
@@ -108,6 +114,8 @@ private:
QCheckBox *ui_casing_steno_cb;
QLabel *ui_casing_cm_lbl;
QCheckBox *ui_casing_cm_cb;
+ QLabel *ui_casing_wit_lbl;
+ QCheckBox *ui_casing_wit_cb;
QLabel *ui_casing_cm_cases_lbl;
QLineEdit *ui_casing_cm_cases_textbox;
diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h
index 19d4bdf3..5b4d2ece 100644
--- a/include/aosfxplayer.h
+++ b/include/aosfxplayer.h
@@ -12,20 +12,24 @@
#include <QWidget>
#include <string.h>
#include <QDebug>
+#include <QTimer>
-class AOSfxPlayer
+class AOSfxPlayer : public QObject
{
+ Q_OBJECT
public:
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
void play(QString p_sfx, QString p_char = "", QString shout = "");
void stop();
void set_volume(qreal p_volume);
+ void setLooping(bool is_looping);
private:
QWidget *m_parent;
AOApplication *ao_app;
qreal m_volume = 0;
+ bool looping_sfx = false;
void set_volume_internal(qreal p_volume);
diff --git a/include/courtroom.h b/include/courtroom.h
index f0b69967..587d9630 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -26,6 +26,7 @@
#include "datatypes.h"
#include "debug_functions.h"
#include "chatlogpiece.h"
+#include "aocharmovie.h"
#include <QMainWindow>
#include <QLineEdit>
@@ -39,7 +40,7 @@
#include <QMap>
#include <QTextBrowser>
#include <QSpinBox>
-
+#include <QMovie>
#include <QDebug>
#include <QScrollBar>
#include <QRegExp>
@@ -48,12 +49,23 @@
#include <QFont>
#include <QInputDialog>
#include <QFileDialog>
+#include <QWidget>
+#include <QPropertyAnimation>
+#include <QTransform>
+#include <QParallelAnimationGroup>
+#include <QtConcurrent/QtConcurrent>
+#include <QtConcurrent/QtConcurrentRun>
+#include <QThread>
+#include <QThreadPool>
+#include <QFuture>
+#include <QMetaObject>
+#include <QLayout>
#include <QTextBoundaryFinder>
#include <stack>
class AOApplication;
-
+class AOCharMovie;
class Courtroom : public QMainWindow
{
Q_OBJECT
@@ -64,15 +76,32 @@ public:
void append_evidence(evi_type p_evi){evidence_list.append(p_evi);}
void append_music(QString f_music){music_list.append(f_music);}
void append_area(QString f_area){area_list.append(f_area);}
-
- void fix_last_area()
+ void handle_failed_login();
+ QString threading_sfx = "";
+ QString threading_shake = "";
+ QString threading_flash = "";
+ QString threading_prefix = "";
+ //cid and this may differ in cases of ini-editing
+ QString current_char = "";
+ int current_emote = 0;
+ AOApplication *ao_app;
+ //abstract widget to hold char buttons
+ QWidget *ui_char_buttons;
+ QVector<char_type> char_list;
+ QVector<evi_type> evidence_list;
+ QVector<QString> music_list;
+ QVector<QString> area_list;
+ QSignalMapper *char_button_mapper;
+ QVector<AOCharButton*> ui_char_button_list;
+ QVector<AOCharButton*> ui_char_button_list_filtered;
+ QLineEdit *ui_char_search;
+ QCheckBox *ui_char_passworded;
+ QCheckBox *ui_char_taken;
+ void mt_pre_framegetter(int frameNumber);
+ void mt_framegetter(int frameNumber);
+ void reset_music_list()
{
- if (area_list.size() > 0)
- {
- QString malplaced = area_list.last();
- area_list.removeLast();
- append_music(malplaced);
- }
+ music_list.clear();
}
void arup_append(int players, QString status, QString cm, QString locked)
@@ -121,7 +150,7 @@ public:
//reads theme inis and sets size and pos based on the identifier
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
-
+ QPoint get_theme_pos(QString p_identifier);
//sets status as taken on character with cid n_char and places proper shading on charselect
void set_taken(int n_char, bool p_taken);
@@ -168,6 +197,9 @@ public:
//properly sets up some varibles: resets user state
void enter_courtroom(int p_cid);
+ // mfw this didnt fucking exist yet
+ void set_character(int char_id);
+
//helper function that populates ui_music_list with the contents of music_list
void list_music();
void list_areas();
@@ -208,14 +240,15 @@ public:
//Toggles the judge buttons, whether they should appear or not.
void toggle_judge_buttons(bool is_on);
- void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno);
+ void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno, bool wit);
void check_connection_received();
+ void doScreenShake();
+ void doRealization();
~Courtroom();
private:
- AOApplication *ao_app;
int m_courtroom_width = 714;
int m_courtroom_height = 668;
@@ -228,7 +261,10 @@ private:
bool first_message_sent = false;
int maximumMessages = 0;
-
+ QPropertyAnimation *screenshake_animation;
+ QPropertyAnimation *chatbox_screenshake_animation;
+ QParallelAnimationGroup *screenshake_group;
+ QMovie *frame_emote_checker;
// This is for inline message-colouring.
enum INLINE_COLOURS {
@@ -247,7 +283,7 @@ private:
bool message_is_centered = false;
int current_display_speed = 3;
- int message_display_speed[7] = {30, 40, 50, 60, 75, 100, 120};
+ int message_display_speed[7] = {10, 20, 30, 40, 50, 60, 75};
// This is for checking if the character should start talking again
// when an inline blue text ends.
@@ -263,11 +299,6 @@ private:
// The offset this user has given if they want to appear alongside someone.
int offset_with_pair = 0;
- QVector<char_type> char_list;
- QVector<evi_type> evidence_list;
- QVector<QString> music_list;
- QVector<QString> area_list;
-
QVector<int> arup_players;
QVector<QString> arup_statuses;
QVector<QString> arup_cms;
@@ -317,7 +348,7 @@ private:
//every time point in char.inis times this equals the final time
const int time_mod = 40;
- static const int chatmessage_size = 23;
+ static const int chatmessage_size = 28;
QString m_chatmessage[chatmessage_size];
bool chatmessage_is_empty = false;
@@ -346,11 +377,10 @@ private:
//character id, which index of the char_list the player is
int m_cid = -1;
- //cid and this may differ in cases of ini-editing
- QString current_char = "";
int objection_state = 0;
int realization_state = 0;
+ int screenshake_state = 0;
int text_color = 0;
bool is_presenting_evidence = false;
@@ -366,7 +396,6 @@ private:
const int button_height = 60;
int current_emote_page = 0;
- int current_emote = 0;
int emote_columns = 5;
int emote_rows = 2;
int max_emotes_on_page = 10;
@@ -389,6 +418,9 @@ private:
AOMusicPlayer *music_player;
AOSfxPlayer *sfx_player;
+ AOSfxPlayer *misc_sfx_player;
+ AOSfxPlayer *frame_emote_sfx_player;
+ AOSfxPlayer *pair_frame_emote_sfx_player;
AOSfxPlayer *objection_player;
AOBlipPlayer *blip_player;
@@ -477,6 +509,7 @@ private:
AOButton *ui_custom_objection;
AOButton *ui_realization;
+ AOButton *ui_screenshake;
AOButton *ui_mute;
AOButton *ui_defense_plus;
@@ -513,11 +546,6 @@ private:
AOImage *ui_char_select_background;
- //abstract widget to hold char buttons
- QWidget *ui_char_buttons;
-
- QVector<AOCharButton*> ui_char_button_list;
- QVector<AOCharButton*> ui_char_button_list_filtered;
AOImage *ui_selector;
AOButton *ui_back_to_lobby;
@@ -529,10 +557,6 @@ private:
AOButton *ui_spectator;
- QLineEdit *ui_char_search;
- QCheckBox *ui_char_passworded;
- QCheckBox *ui_char_taken;
-
void construct_char_select();
void set_char_select();
void set_char_select_page();
@@ -558,7 +582,7 @@ public slots:
void mod_called(QString p_ip);
- void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno);
+ void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness);
private slots:
void start_chat_ticking();
@@ -605,6 +629,7 @@ private slots:
void on_custom_objection_clicked();
void on_realization_clicked();
+ void on_screenshake_clicked();
void on_mute_clicked();
void on_pair_clicked();
diff --git a/include/datatypes.h b/include/datatypes.h
index aaa5de52..1b76f725 100644
--- a/include/datatypes.h
+++ b/include/datatypes.h
@@ -100,7 +100,12 @@ enum CHAT_MESSAGE
SELF_OFFSET,
OTHER_OFFSET,
OTHER_FLIP,
- NONINTERRUPTING_PRE
+ NONINTERRUPTING_PRE,
+ LOOPING_SFX,
+ SCREENSHAKE,
+ FRAME_SCREENSHAKE,
+ FRAME_REALIZATION,
+ FRAME_SFX
};
enum COLOR
diff --git a/include/lobby.h b/include/lobby.h
index 4293ac36..06cd798b 100644
--- a/include/lobby.h
+++ b/include/lobby.h
@@ -78,7 +78,8 @@ private:
QModelIndex last_model;
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
-
+public slots:
+ void fucking_threading_goddamn_it(QString fuckshitassgoddamnfuck);
private slots:
void on_public_servers_clicked();
void on_favorites_clicked();
diff --git a/src/aocaseannouncerdialog.cpp b/src/aocaseannouncerdialog.cpp
index 5b82b64f..4b36fe62 100644
--- a/src/aocaseannouncerdialog.cpp
+++ b/src/aocaseannouncerdialog.cpp
@@ -54,12 +54,15 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
ui_juror_needed->setText(tr("Jurors needed"));
ui_steno_needed = new QCheckBox(this);
ui_steno_needed->setText(tr("Stenographer needed"));
+ ui_witness_needed = new QCheckBox(this);
+ ui_witness_needed->setText(tr("Witness needed"));
ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed);
ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed);
ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed);
ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed);
ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed);
+ ui_form_layout->setWidget(6, QFormLayout::FieldRole, ui_witness_needed);
setUpdatesEnabled(true);
}
@@ -71,7 +74,8 @@ void AOCaseAnnouncerDialog::ok_pressed()
ui_prosecutor_needed->isChecked(),
ui_judge_needed->isChecked(),
ui_juror_needed->isChecked(),
- ui_steno_needed->isChecked());
+ ui_steno_needed->isChecked(),
+ ui_witness_needed->isChecked());
done(0);
}
diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp
index 57487233..7fed6b06 100644
--- a/src/aocharmovie.cpp
+++ b/src/aocharmovie.cpp
@@ -7,27 +7,31 @@
AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
{
ao_app = p_ao_app;
-
m_movie = new QMovie(this);
-
preanim_timer = new QTimer(this);
+ ticker = new QTimer(this);
preanim_timer->setSingleShot(true);
-
- connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
- connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done()));
+ ticker->setSingleShot(true);
+ connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker()));
+ this->setUpdatesEnabled(true);
}
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
{
+ apng = false;
QString original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif");
- QString alt_path = ao_app->get_character_path(p_char, p_emote + ".png");
+ QString alt_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".png");
QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng");
QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
QString placeholder_default_path = ao_app->get_default_theme_path("placeholder.gif");
QString gif_path;
-
+ current_emote = emote_prefix + p_emote;
+ current_char = p_char;
if (file_exists(apng_path))
+ {
gif_path = apng_path;
+ apng = true;
+ }
else if (file_exists(original_path))
gif_path = original_path;
else if (file_exists(alt_path))
@@ -36,107 +40,184 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
gif_path = placeholder_path;
else
gif_path = placeholder_default_path;
-
+ last_path = gif_path;
+ delete m_movie;
+ m_movie = new QMovie(this);
m_movie->stop();
+ this->clear();
m_movie->setFileName(gif_path);
-
- QImageReader *reader = new QImageReader(gif_path);
-
- movie_frames.clear();
- QImage f_image = reader->read();
- while (!f_image.isNull())
- {
- if (m_flipped)
- movie_frames.append(f_image.mirrored(true, false));
- else
- movie_frames.append(f_image);
- f_image = reader->read();
- }
-
- delete reader;
-
+ m_movie->jumpToFrame(0);
+ this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
this->show();
- m_movie->start();
+ this->play_frame_sfx();
+ ticker->start(m_movie->nextFrameDelay());
}
-void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
+void AOCharMovie::play_frame_sfx()
{
- QString gif_path = ao_app->get_character_path(p_char, p_emote);
-
- m_movie->stop();
- this->clear();
- m_movie->setFileName(gif_path);
- m_movie->jumpToFrame(0);
-
- int full_duration = duration * time_mod;
- int real_duration = 0;
-
- play_once = false;
-
- for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame)
+ int current_frame = m_movie->currentFrameNumber();
+ QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, current_emote, current_frame);
+ QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, current_emote, current_frame);
+ QString realization_to_play = ao_app->get_realization_frame(current_char, current_emote, current_frame);
+ if(sfx_to_play != "" && !use_networked_framehell)
{
- real_duration += m_movie->nextFrameDelay();
- m_movie->jumpToFrame(n_frame + 1);
+ frame_specific_sfx_player->play(ao_app->get_sfx_suffix(sfx_to_play));
}
+ else if(use_networked_framehell)
+ {
+ this->sfx_two_network_boogaloo();
+ }
+ if(screenshake_to_play != "" && !use_networked_framehell)
+ {
+ mycourtroom->doScreenShake();
+ }
+ else if(use_networked_framehell)
+ {
+ this->screenshake_two_network_boogaloo();
+ }
+ if(realization_to_play != "" && !use_networked_framehell)
+ {
+ mycourtroom->doRealization();
+ }
+ else if(use_networked_framehell)
+ {
+ this->realization_two_network_boogaloo();
+ }
+}
-#ifdef DEBUG_GIF
- qDebug() << "full_duration: " << full_duration;
- qDebug() << "real_duration: " << real_duration;
-#endif
-
- double percentage_modifier = 100.0;
+void AOCharMovie::realization_two_network_boogaloo()
+{
+ int current_frame = m_movie->currentFrameNumber();
+ QStringList fucking_garbage = this->frame_realization_hellstring.split("^");
+ for (int i = 0; i < fucking_garbage.length(); i++) {
+ QString fucking_christ = fucking_garbage.at(i);
+ QStringList extra_garbage = fucking_christ.split("|");
+ if(extra_garbage.at(0) != current_emote){
+ continue;
+ }
+ for (int ii = 1; ii < extra_garbage.length(); ii++) {
+ QString levels_of_garbage = extra_garbage.at(ii);
+ QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
+ if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
+ mycourtroom->doRealization();
+ }
+ }
+ }
+}
- if (real_duration != 0 && duration != 0)
- {
- double modifier = full_duration / static_cast<double>(real_duration);
- percentage_modifier = 100 / modifier;
+void AOCharMovie::screenshake_two_network_boogaloo()
+{
+ int current_frame = m_movie->currentFrameNumber();
+ QStringList fucking_garbage = this->frame_screenshake_hellstring.split("^");
+ for (int i = 0; i < fucking_garbage.length(); i++) {
+ QString fucking_christ = fucking_garbage.at(i);
+ QStringList extra_garbage = fucking_christ.split("|");
+ if(extra_garbage.at(0) != current_emote){
+ continue;
+ }
+ for (int ii = 1; ii < extra_garbage.length(); ii++) {
+ QString levels_of_garbage = extra_garbage.at(ii);
+ QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
+ if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
+ mycourtroom->doScreenShake();
+ }
+ }
+ }
+}
- if (percentage_modifier > 100.0)
- percentage_modifier = 100.0;
- }
+void AOCharMovie::sfx_two_network_boogaloo()
+{
+ int current_frame = m_movie->currentFrameNumber();
+ QStringList fucking_garbage = this->frame_sfx_hellstring.split("^");
+ for (int i = 0; i < fucking_garbage.length(); i++) {
+ QString fucking_christ = fucking_garbage.at(i);
+ QStringList extra_garbage = fucking_christ.split("|");
+ if(extra_garbage.at(0) != current_emote){
+ continue;
+ }
+ for (int ii = 1; ii < extra_garbage.length(); ii++) {
+ QString levels_of_garbage = extra_garbage.at(ii);
+ QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
+ if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
+ frame_specific_sfx_player->play(ao_app->get_sfx_suffix(that_shouldnt_be_possible.at(1)));
+ }
+ }
+ }
+}
-#ifdef DEBUG_GIF
- qDebug() << "% mod: " << percentage_modifier;
-#endif
- if (full_duration == 0 || full_duration >= real_duration)
+void AOCharMovie::movie_ticker()
+{
+ if(apng){
+ ticker->start(m_movie->nextFrameDelay());
+ }
+ if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1)
{
- play_once = true;
+ delete m_movie;
+ m_movie = new QMovie(this);
+ m_movie->stop();
+ this->clear();
+ m_movie->setFileName(last_path);
+ m_movie->jumpToFrame(0);
+ if(play_once)
+ {
+ timer_done();
+ }
}
else
{
- play_once = false;
- preanim_timer->start(full_duration);
+ m_movie->jumpToNextFrame();
+ }
+ this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage()); // imagine if QT had sane stuff like "mirror on QMovie" or "resize the image on QT" or "interface with the current QMovie image" or anything else
+ // ps: fuck private functions/variables as a concept, freedom 2 do dangerous things 5ever
+ this->play_frame_sfx();
+ if(!apng){
+ ticker->start(m_movie->nextFrameDelay());
}
+}
- m_movie->setSpeed(static_cast<int>(percentage_modifier));
- play(p_char, p_emote, "");
+void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image)
+{
+ QPixmap f_pixmap;
+ if(m_flipped) // imagine if QT wasn't handicapped harder than people who think MLP is good
+ f_pixmap = QPixmap::fromImage(image.mirrored(true, false));
+ else
+ f_pixmap = QPixmap::fromImage(image);
+ auto aspect_ratio = Qt::KeepAspectRatio;
+
+ if (f_pixmap.size().width() > f_pixmap.size().height())
+ aspect_ratio = Qt::KeepAspectRatioByExpanding;
+
+ if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height())
+ this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation));
+ else
+ this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation));
+
+ QLabel::move(x + (this->width() - this->pixmap()->width())/2, y);
}
-void AOCharMovie::play_talking(QString p_char, QString p_emote)
+void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
{
- QString gif_path = ao_app->get_character_path(p_char, "(b)" + p_emote);
+ QString gif_path = ao_app->get_character_path(p_char, p_emote);
m_movie->stop();
- this->clear();
m_movie->setFileName(gif_path);
+ m_movie->jumpToFrame(0);
+ int real_duration = 0;
+ play_once = true;
+ play(p_char, p_emote, "");
+}
+void AOCharMovie::play_talking(QString p_char, QString p_emote)
+{
play_once = false;
- m_movie->setSpeed(100);
play(p_char, p_emote, "(b)");
}
void AOCharMovie::play_idle(QString p_char, QString p_emote)
{
- QString gif_path = ao_app->get_character_path(p_char, "(a)" + p_emote);
-
- m_movie->stop();
- this->clear();
- m_movie->setFileName(gif_path);
-
play_once = false;
- m_movie->setSpeed(100);
play(p_char, p_emote, "(a)");
}
@@ -144,7 +225,7 @@ void AOCharMovie::stop()
{
//for all intents and purposes, stopping is the same as hiding. at no point do we want a frozen gif to display
m_movie->stop();
- preanim_timer->stop();
+ frame_specific_sfx_player->stop();
this->hide();
}
@@ -152,9 +233,8 @@ void AOCharMovie::combo_resize(int w, int h)
{
QSize f_size(w, h);
this->resize(f_size);
- m_movie->setScaledSize(f_size);
+ m_movie->setScaledSize(this->size());
}
-
void AOCharMovie::move(int ax, int ay)
{
x = ax;
@@ -162,34 +242,7 @@ void AOCharMovie::move(int ax, int ay)
QLabel::move(x, y);
}
-void AOCharMovie::frame_change(int n_frame)
-{
-
- if (movie_frames.size() > n_frame)
- {
- QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame));
- auto aspect_ratio = Qt::KeepAspectRatio;
-
- if (f_pixmap.size().width() > f_pixmap.size().height())
- aspect_ratio = Qt::KeepAspectRatioByExpanding;
-
- if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height())
- this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation));
- else
- this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation));
-
- QLabel::move(x + (this->width() - this->pixmap()->width())/2, y);
- }
-
- if (m_movie->frameCount() - 1 == n_frame && play_once)
- {
- preanim_timer->start(m_movie->nextFrameDelay());
- m_movie->stop();
- }
-}
-
void AOCharMovie::timer_done()
{
-
done();
}
diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp
index 15b598fc..4dc03959 100644
--- a/src/aoevidencebutton.cpp
+++ b/src/aoevidencebutton.cpp
@@ -90,15 +90,11 @@ void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e)
{
//QWidget::dragLeaveEvent(e);
-
- qDebug() << "drag leave event";
}
void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
{
//QWidget::dragEnterEvent(e);
-
- qDebug() << "drag enter event";
}
*/
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp
index 27918092..32848fb0 100644
--- a/src/aomusicplayer.cpp
+++ b/src/aomusicplayer.cpp
@@ -1,7 +1,7 @@
#include "aomusicplayer.h"
#if defined(BASSAUDIO)
-AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
+AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
{
m_parent = parent;
ao_app = p_ao_app;
@@ -9,14 +9,14 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
AOMusicPlayer::~AOMusicPlayer()
{
- BASS_ChannelStop(m_stream);
+ kill_loop();
}
void AOMusicPlayer::play(QString p_song)
{
BASS_ChannelStop(m_stream);
- QString f_path = ao_app->get_music_path(p_song);
+ f_path = ao_app->get_music_path(p_song);
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
@@ -24,7 +24,18 @@ void AOMusicPlayer::play(QString p_song)
if (ao_app->get_audio_output_device() != "default")
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
+ if(enable_looping)
+ {
+ BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
+ }
+ else
+ {
+ BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
+ }
BASS_ChannelPlay(m_stream, false);
+
+
+
}
void AOMusicPlayer::set_volume(int p_value)
@@ -33,8 +44,19 @@ void AOMusicPlayer::set_volume(int p_value)
float volume = m_volume / 100.0f;
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
}
+
+QString AOMusicPlayer::get_path()
+{
+ return f_path;
+}
+
+void AOMusicPlayer::kill_loop()
+{
+ BASS_ChannelStop(m_stream);
+}
+
#elif defined(QTAUDIO)
-AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
+AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
{
m_parent = parent;
ao_app = p_ao_app;
@@ -63,8 +85,18 @@ void AOMusicPlayer::set_volume(int p_value)
m_volume = p_value;
m_player.setVolume(m_volume);
}
+
+QString AOMusicPlayer::get_path()
+{
+ return f_path;
+}
+
+void AOMusicPlayer::kill_loop()
+{
+ // TODO QTAUDIO
+}
#else
-AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
+AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
{
m_parent = parent;
ao_app = p_ao_app;
@@ -84,4 +116,14 @@ void AOMusicPlayer::set_volume(int p_value)
{
}
-#endif
+
+QString AOMusicPlayer::get_path()
+{
+ return f_path;
+}
+
+void AOMusicPlayer::kill_loop()
+{
+
+}
+#endif \ No newline at end of file
diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp
index 82507a1f..30146c90 100644
--- a/src/aooptionsdialog.cpp
+++ b/src/aooptionsdialog.cpp
@@ -166,6 +166,17 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb);
+ ui_epilepsy_lbl = new QLabel(ui_form_layout_widget);
+ ui_epilepsy_lbl->setText(tr("Allow Shake/Flash:"));
+ ui_epilepsy_lbl->setToolTip(tr("Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures."));
+
+ ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_epilepsy_lbl);
+
+ ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget);
+ ui_epilepsy_cb->setChecked(ao_app->is_shakeandflash_enabled());
+
+ ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_epilepsy_cb);
+
ui_language_label = new QLabel(ui_form_layout_widget);
ui_language_label->setText(tr("Language:"));
ui_language_label->setToolTip(tr("Sets the language if you don't want to use your system language."));
@@ -334,6 +345,29 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb);
+ ui_loopsfx_lbl = new QLabel(ui_audio_widget);
+ ui_loopsfx_lbl->setText(tr("Enable Looping SFX:"));
+ ui_loopsfx_lbl->setToolTip(tr("If true, the game will allow looping sound effects to play on preanimations."));
+
+ ui_audio_layout->setWidget(8, QFormLayout::LabelRole, ui_loopsfx_lbl);
+
+ ui_loopsfx_cb = new QCheckBox(ui_audio_widget);
+ ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx());
+
+ ui_audio_layout->setWidget(8, QFormLayout::FieldRole, ui_loopsfx_cb);
+
+
+ ui_objectmusic_lbl = new QLabel(ui_audio_widget);
+ ui_objectmusic_lbl->setText(tr("Kill Music On Objection:"));
+ ui_objectmusic_lbl->setToolTip(tr("If true, the game will stop music when someone objects, like in the actual games."));
+
+ ui_audio_layout->setWidget(9, QFormLayout::LabelRole, ui_objectmusic_lbl);
+
+ ui_objectmusic_cb = new QCheckBox(ui_audio_widget);
+ ui_objectmusic_cb->setChecked(p_ao_app->get_objectmusic());
+
+ ui_audio_layout->setWidget(9, QFormLayout::FieldRole, ui_objectmusic_cb);
+
// The casing tab!
ui_casing_tab = new QWidget();
ui_settings_tabs->addTab(ui_casing_tab, tr("Casing"));
@@ -455,6 +489,18 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb);
+ ui_casing_wit_lbl = new QLabel(ui_casing_widget);
+ ui_casing_wit_lbl->setText(tr("Witness:"));
+ ui_casing_wit_lbl->setToolTip(tr("If checked, you will appear amongst the potential "
+ "witnesses on the server."));
+
+ ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_wit_lbl);
+
+ ui_casing_wit_cb = new QCheckBox(ui_casing_widget);
+ ui_casing_wit_cb->setChecked(ao_app->get_casing_wit_enabled());
+
+ ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_wit_cb);
+
// -- CM CASES ANNOUNCEMENTS
ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget);
@@ -462,12 +508,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
ui_casing_cm_cases_lbl->setToolTip(tr("If you're a CM, enter what cases you are "
"willing to host."));
- ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_cm_cases_lbl);
+ ui_casing_layout->setWidget(9, QFormLayout::LabelRole, ui_casing_cm_cases_lbl);
ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget);
ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases());
- ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_cm_cases_textbox);
+ ui_casing_layout->setWidget(9, QFormLayout::FieldRole, ui_casing_cm_cases_textbox);
// When we're done, we should continue the updates!
setUpdatesEnabled(true);
@@ -485,6 +531,7 @@ void AOOptionsDialog::save_pressed()
configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
configini->setValue("master", ui_ms_textbox->text());
configini->setValue("discord", ui_discord_cb->isChecked());
+ configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked());
configini->setValue("language", ui_language_combobox->currentText().left(2));
QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
@@ -506,6 +553,8 @@ void AOOptionsDialog::save_pressed()
configini->setValue("default_blip", ui_blips_volume_spinbox->value());
configini->setValue("blip_rate", ui_bliprate_spinbox->value());
configini->setValue("blank_blip", ui_blank_blips_cb->isChecked());
+ configini->setValue("looping_sfx", ui_loopsfx_cb->isChecked());
+ configini->setValue("kill_music_on_object", ui_objectmusic_cb->isChecked());
configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked());
configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked());
@@ -514,6 +563,7 @@ void AOOptionsDialog::save_pressed()
configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked());
configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked());
configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked());
+ configini->setValue("casing_wit_enabled", ui_casing_wit_cb->isChecked());
configini->setValue("casing_can_host_cases", ui_casing_cm_cases_textbox->text());
callwordsini->close();
diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp
index ad8ced60..80b6ea3c 100644
--- a/src/aosfxplayer.cpp
+++ b/src/aosfxplayer.cpp
@@ -2,7 +2,7 @@
#include "file_functions.h"
#if defined(BASSAUDIO) //Using bass.dll for sfx
-AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
+AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
{
m_parent = parent;
ao_app = p_ao_app;
@@ -29,7 +29,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
f_path = misc_path;
else
f_path = sound_path;
-
+ BASS_ChannelStop(m_stream);
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
set_volume_internal(m_volume);
@@ -37,6 +37,19 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
if (ao_app->get_audio_output_device() != "default")
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
BASS_ChannelPlay(m_stream, false);
+ if(looping_sfx && ao_app->get_looping_sfx())
+ {
+ BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
+ }
+ else
+ {
+ BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
+ }
+}
+
+void AOSfxPlayer::setLooping(bool is_looping)
+{
+ this->looping_sfx = is_looping;
}
void AOSfxPlayer::stop()
@@ -56,7 +69,7 @@ void AOSfxPlayer::set_volume_internal(qreal p_value)
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
}
#elif defined(QTAUDIO) //Using Qt's QSoundEffect class
-AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
+AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
{
m_parent = parent;
ao_app = p_ao_app;
@@ -110,7 +123,7 @@ void AOSfxPlayer::set_volume_internal(qreal p_value)
m_sfx.setVolume(m_volume);
}
#else
-AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
+AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
{
m_parent = parent;
ao_app = p_ao_app;
diff --git a/src/charselect.cpp b/src/charselect.cpp
index 0cfb7753..875c8a51 100644
--- a/src/charselect.cpp
+++ b/src/charselect.cpp
@@ -5,6 +5,59 @@
#include "debug_functions.h"
#include "hardware_functions.h"
+class AOCharSelectGenerationThreading : public QRunnable
+{
+public:
+ Courtroom *mycourt_fuck;
+ int char_num;
+ AOCharButton *char_button;
+ AOCharSelectGenerationThreading(Courtroom *my_courtroom, int character_number, AOCharButton *charbut){
+ mycourt_fuck = my_courtroom;
+ char_num = character_number;
+ char_button = charbut;
+ }
+ void run()
+ {
+ AOCharButton* character = char_button;
+ character->reset();
+ character->hide();
+ character->set_image(mycourt_fuck->char_list.at(char_num).name);
+ mycourt_fuck->ui_char_button_list.append(character);
+
+ mycourt_fuck->connect(character, SIGNAL(clicked()), mycourt_fuck->char_button_mapper, SLOT(map()));
+ mycourt_fuck->char_button_mapper->setMapping(character, mycourt_fuck->ui_char_button_list.size() - 1);
+ }
+};
+
+class AOCharSelectFilterThreading : public QRunnable
+{
+public:
+ Courtroom *mycourt_fuck;
+ int char_num;
+ AOCharSelectFilterThreading(Courtroom *my_courtroom, int character_number){
+ mycourt_fuck = my_courtroom;
+ char_num = character_number;
+ }
+ void run()
+ {
+ AOCharButton* current_char = mycourt_fuck->ui_char_button_list.at(char_num);
+
+ if (!mycourt_fuck->ui_char_taken->isChecked() && mycourt_fuck->char_list.at(char_num).taken)
+ return;
+
+ if (!mycourt_fuck->char_list.at(char_num).name.contains(mycourt_fuck->ui_char_search->text(), Qt::CaseInsensitive))
+ return;
+
+ // We only really need to update the fact that a character is taken
+ // for the buttons that actually appear.
+ // You'd also update the passwordedness and etc. here later.
+ current_char->reset();
+ current_char->set_taken(mycourt_fuck->char_list.at(char_num).taken);
+
+ mycourt_fuck->ui_char_button_list_filtered.append(current_char);
+ }
+};
+
void Courtroom::construct_char_select()
{
ui_char_select_background = new AOImage(this, ao_app);
@@ -197,28 +250,15 @@ void Courtroom::character_loading_finished()
// Later on, we'll be revealing buttons as we need them.
for (int n = 0; n < char_list.size(); n++)
{
- AOCharButton* char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
- char_button->reset();
- char_button->hide();
- char_button->set_image(char_list.at(n).name);
- ui_char_button_list.append(char_button);
-
- connect(char_button, &AOCharButton::clicked, [this, n](){
- this->char_clicked(n);
- });
-
- // This part here serves as a way of showing to the player that the game is still running, it is
- // just loading the pictures of the characters.
- if (ao_app->lobby_constructed)
- {
- ao_app->generated_chars++;
- int total_loading_size = ao_app->char_list_size * 2 + ao_app->evidence_list_size + ao_app->music_list_size;
- int loading_value = int(((ao_app->loaded_chars + ao_app->generated_chars + ao_app->loaded_music + ao_app->loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
- ao_app->w_lobby->set_loading_value(loading_value);
- ao_app->w_lobby->set_loading_text(tr("Generating chars:\n%1/%2").arg(QString::number(ao_app->generated_chars)).arg(QString::number(ao_app->char_list_size)));
- }
+ AOCharButton* character = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
+ AOCharSelectGenerationThreading *char_generate = new AOCharSelectGenerationThreading(this, n, character);
+ QThreadPool::globalInstance()->start(char_generate);
+ if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount())
+ {
+ QThreadPool::globalInstance()->waitForDone();
+ }
}
-
+ QThreadPool::globalInstance()->waitForDone();
filter_character_list();
}
@@ -227,27 +267,14 @@ void Courtroom::filter_character_list()
ui_char_button_list_filtered.clear();
for (int i = 0; i < char_list.size(); i++)
{
- AOCharButton* current_char = ui_char_button_list.at(i);
-
- // It seems passwording characters is unimplemented yet?
- // Until then, this will stay here, I suppose.
- //if (ui_char_passworded->isChecked() && character_is_passworded??)
- // continue;
-
- if (!ui_char_taken->isChecked() && char_list.at(i).taken)
- continue;
-
- if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive))
- continue;
-
- // We only really need to update the fact that a character is taken
- // for the buttons that actually appear.
- // You'd also update the passwordedness and etc. here later.
- current_char->reset();
- current_char->set_taken(char_list.at(i).taken);
-
- ui_char_button_list_filtered.append(current_char);
+ AOCharSelectFilterThreading *char_filter = new AOCharSelectFilterThreading(this, i);
+ QThreadPool::globalInstance()->start(char_filter);
+ if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount())
+ {
+ QThreadPool::globalInstance()->waitForDone();
+ }
}
+ QThreadPool::globalInstance()->waitForDone();
current_char_page = 0;
set_char_select_page();
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index a1714163..054603d3 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1,5 +1,4 @@
#include "courtroom.h"
-
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
{
ao_app = p_ao_app;
@@ -73,6 +72,13 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
objection_player = new AOSfxPlayer(this, ao_app);
objection_player->set_volume(0);
+ misc_sfx_player = new AOSfxPlayer(this, ao_app);
+ misc_sfx_player->set_volume(0);
+ frame_emote_sfx_player = new AOSfxPlayer(this, ao_app);
+ frame_emote_sfx_player->set_volume(0);
+ pair_frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); // todo: recode pair // todo: recode fucking everything
+ pair_frame_emote_sfx_player->set_volume(0);
+
blip_player = new AOBlipPlayer(this, ao_app);
blip_player->set_volume(0);
@@ -86,7 +92,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_vp_speedlines = new AOMovie(ui_viewport, ao_app);
ui_vp_speedlines->set_play_once(false);
ui_vp_player_char = new AOCharMovie(ui_viewport, ao_app);
+ ui_vp_player_char->frame_specific_sfx_player = frame_emote_sfx_player;
+ ui_vp_player_char->mycourtroom = this;
ui_vp_sideplayer_char = new AOCharMovie(ui_viewport, ao_app);
+ ui_vp_sideplayer_char->frame_specific_sfx_player = pair_frame_emote_sfx_player;
+ ui_vp_sideplayer_char->mycourtroom = this;
ui_vp_sideplayer_char->hide();
ui_vp_desk = new AOScene(ui_viewport, ao_app);
ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app);
@@ -201,7 +211,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_flip->hide();
ui_guard = new QCheckBox(this);
- ui_guard->setText(tr("Guard"));
+
+ ui_guard->setText(tr("Disable Modcalls"));
+
ui_guard->hide();
ui_casing = new QCheckBox(this);
@@ -219,6 +231,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_custom_objection = new AOButton(this, ao_app);
ui_realization = new AOButton(this, ao_app);
+ ui_screenshake = new AOButton(this, ao_app);
ui_mute = new AOButton(this, ao_app);
ui_defense_plus = new AOButton(this, ao_app);
@@ -304,7 +317,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(ui_custom_objection, SIGNAL(clicked()), this, SLOT(on_custom_objection_clicked()));
connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked()));
-
+ connect(ui_screenshake, SIGNAL(clicked()), this, SLOT(on_screenshake_clicked()));
connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked()));
connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked()));
@@ -642,6 +655,9 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_realization, "realization");
ui_realization->set_image("realization.png");
+ set_size_and_pos(ui_screenshake, "screenshake");
+ ui_screenshake->set_image("screenshake.png");
+
set_size_and_pos(ui_mute, "mute_button");
ui_mute->set_image("mute.png");
@@ -784,6 +800,24 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
}
}
+QPoint Courtroom::get_theme_pos(QString p_identifier)
+{
+ QString filename = "courtroom_design.ini";
+
+ pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename);
+
+ if (design_ini_result.width < 0 || design_ini_result.height < 0)
+ {
+ qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename;
+ return QPoint(0,0);
+ }
+ else
+ {
+ return QPoint(design_ini_result.x, design_ini_result.y);
+ }
+}
+
+
void Courtroom::set_taken(int n_char, bool p_taken)
{
if (n_char >= char_list.size())
@@ -844,45 +878,58 @@ void Courtroom::set_background(QString p_background)
}
}
-void Courtroom::enter_courtroom(int p_cid)
-{
- m_cid = p_cid;
+void Courtroom::set_character(int char_id) // can you fucking believe this didn't exist yet
+{
+ m_cid = char_id;
- QString f_char;
+ QString f_char;
- if (m_cid == -1)
- {
- if (ao_app->is_discord_enabled())
- ao_app->discord->state_spectate();
- f_char = "";
- }
- else
- {
- f_char = ao_app->get_char_name(char_list.at(m_cid).name);
+ if (m_cid == -1)
+ {
+ if (ao_app->is_discord_enabled())
+ ao_app->discord->state_spectate();
+ f_char = "";
+ }
+ else
+ {
+ f_char = ao_app->get_char_name(char_list.at(m_cid).name);
- if (ao_app->is_discord_enabled())
- ao_app->discord->state_character(f_char.toStdString());
- }
+ if (ao_app->is_discord_enabled())
+ ao_app->discord->state_character(f_char.toStdString());
+ }
- current_char = f_char;
+ current_char = f_char;
- current_emote_page = 0;
- current_emote = 0;
+ current_emote_page = 0;
+ current_emote = 0;
- if (m_cid == -1)
- ui_emotes->hide();
- else
- ui_emotes->show();
+ if (m_cid == -1)
+ ui_emotes->hide();
+ else
+ ui_emotes->show();
- set_emote_page();
- set_emote_dropdown();
+ set_emote_page();
+ set_emote_dropdown();
+
+ if (ao_app->custom_objection_enabled &&
+ (file_exists(ao_app->get_character_path(current_char, "custom.gif")) ||
+ file_exists(ao_app->get_character_path(current_char, "custom.apng"))) &&
+ file_exists(ao_app->get_character_path(current_char, "custom.wav")))
+ ui_custom_objection->show();
+ else
+ ui_custom_objection->hide();
+}
+
+void Courtroom::enter_courtroom(int p_cid)
+{
+ this->set_character(p_cid);
current_evidence_page = 0;
current_evidence = 0;
set_evidence_page();
- QString side = ao_app->get_char_side(f_char);
+ QString side = ao_app->get_char_side(current_char);
if (side == "jud")
{
@@ -931,6 +978,9 @@ void Courtroom::enter_courtroom(int p_cid)
music_player->set_volume(ui_music_slider->value());
sfx_player->set_volume(ui_sfx_slider->value());
objection_player->set_volume(ui_sfx_slider->value());
+ misc_sfx_player->set_volume(ui_sfx_slider->value());
+ frame_emote_sfx_player->set_volume(ui_sfx_slider->value());
+ pair_frame_emote_sfx_player->set_volume(ui_sfx_slider->value());
blip_player->set_volume(ui_blip_slider->value());
testimony_in_progress = false;
@@ -960,12 +1010,10 @@ void Courtroom::list_music()
for (int n_song = 0 ; n_song < music_list.size() ; ++n_song)
{
QString i_song = music_list.at(n_song);
- QString i_song_listname = i_song;
- i_song_listname = i_song_listname.left(i_song_listname.lastIndexOf("."));
if (i_song.toLower().contains(ui_music_search->text().toLower()))
{
- ui_music_list->addItem(i_song_listname);
+ ui_music_list->addItem(i_song);
music_row_to_number.append(n_song);
QString song_path = ao_app->get_music_path(i_song);
@@ -1072,10 +1120,75 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt
colour = ao_app->get_color("ooc_default_color", "courtroom_design.ini").name();
if (p_colour == "1")
colour = ao_app->get_color("ooc_server_color", "courtroom_design.ini").name();
+ if(p_message == "Logged in as a moderator.")
+ {
+ ui_guard->show();
+ append_server_chatmessage("CLIENT", "You were granted the Disable Modcalls button.", "1");
+ }
ui_server_chatlog->append_chatmessage(p_name, p_message, colour);
}
+class AOFrameThreadingBullshitPre : public QRunnable
+{
+public:
+ Courtroom *mycourt_fuck;
+ int my_frameNumber;
+ AOFrameThreadingBullshitPre(Courtroom *my_courtroom, int frameNumber){
+ mycourt_fuck = my_courtroom;
+ my_frameNumber = frameNumber;
+ }
+ void run()
+ {
+ qDebug() << my_frameNumber << " FRAME NUMBER" << " from" << QThread::currentThread();
+ QString sfx_to_play = mycourt_fuck->ao_app->get_frame_sfx_name(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber);
+ QString screenshake_to_play = mycourt_fuck->ao_app->get_screenshake_frame(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber);
+ QString realization_to_play = mycourt_fuck->ao_app->get_realization_frame(mycourt_fuck->current_char, mycourt_fuck->ao_app->get_pre_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber);
+ if(sfx_to_play != "")
+ {
+ mycourt_fuck->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play;
+ }
+ if(screenshake_to_play != "")
+ {
+ mycourt_fuck->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play;
+ }
+ if(realization_to_play != "")
+ {
+ mycourt_fuck->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play;
+ }
+ }
+};
+
+
+class AOFrameThreadingBullshit : public QRunnable
+{
+public:
+ Courtroom *mycourt_fuck;
+ int my_frameNumber;
+ AOFrameThreadingBullshit(Courtroom *my_courtroom, int frameNumber){
+ mycourt_fuck = my_courtroom;
+ my_frameNumber = frameNumber;
+ }
+ void run()
+ {
+ QString sfx_to_play = mycourt_fuck->ao_app->get_frame_sfx_name(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber);
+ QString screenshake_to_play = mycourt_fuck->ao_app->get_screenshake_frame(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber);
+ QString realization_to_play = mycourt_fuck->ao_app->get_realization_frame(mycourt_fuck->current_char, mycourt_fuck->threading_prefix + mycourt_fuck->ao_app->get_emote(mycourt_fuck->current_char, mycourt_fuck->current_emote), my_frameNumber);
+ if(sfx_to_play != "")
+ {
+ mycourt_fuck->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play;
+ }
+ if(screenshake_to_play != "")
+ {
+ mycourt_fuck->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play;
+ }
+ if(realization_to_play != "")
+ {
+ mycourt_fuck->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play;
+ }
+ }
+};
+
void Courtroom::on_chat_return_pressed()
{
if (ui_ic_chat_message->text() == "" || is_muted)
@@ -1249,10 +1362,133 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append("0");
}
}
+ // If the server we're on supports Looping SFX and Screenshake, use it if the emote uses it.
+ if (ao_app->looping_sfx_support_enabled)
+ {
+ packet_contents.append(ao_app->get_sfx_looping(current_char, current_emote));
+ qDebug() << "Are we looping this? " << ao_app->get_sfx_looping(current_char, current_emote);
+ packet_contents.append(QString::number(screenshake_state));
+ qDebug() << "Are we screen shaking this one? " << screenshake_state;
+ qDebug() << "MAX THREAD COUNT " << QThreadPool::globalInstance()->maxThreadCount();
+ QString frame_screenshake = "";
+ QString frame_realization = "";
+ QString frame_sfx = "";
+
+ QString preemote_sfx = "";
+ QString preemote_shake = "";
+ QString preemote_flash = "";
+
+ QString talkemote_sfx = "";
+ QString talkemote_shake = "";
+ QString talkemote_flash = "";
+
+ QString idleemote_sfx = "";
+ QString idleemote_shake = "";
+ QString idleemote_flash = "";
+
+ QString preemote = ao_app->get_image_suffix(ao_app->get_character_path(current_char, ao_app->get_pre_emote(current_char, current_emote)));
+ QString talkemote_to_check = ao_app->get_image_suffix(ao_app->get_character_path(current_char, "(b)" + ao_app->get_emote(current_char, current_emote)));
+ QString idleemote_to_check = ao_app->get_image_suffix(ao_app->get_character_path(current_char, "(a)" + ao_app->get_emote(current_char, current_emote)));
+
+ frame_emote_checker = new QMovie(this);
+ frame_emote_checker->setFileName(preemote);
+ frame_emote_checker->jumpToFrame(0);
+ qDebug() << "Premote fuck: " << frame_emote_checker->frameCount();
+
+ preemote_sfx += ao_app->get_pre_emote(current_char, current_emote);
+ preemote_shake += ao_app->get_pre_emote(current_char, current_emote);
+ preemote_flash += ao_app->get_pre_emote(current_char, current_emote);
+
+ threading_sfx = preemote_sfx;
+ threading_shake = preemote_shake;
+ threading_flash = preemote_flash;
+
+ for(int i=0; i < frame_emote_checker->frameCount(); i++){
+ AOFrameThreadingBullshitPre *testfuck = new AOFrameThreadingBullshitPre(this, i);
+ QThreadPool::globalInstance()->start(testfuck);
+ }
+ QThreadPool::globalInstance()->waitForDone();
+ preemote_sfx = threading_sfx;
+ preemote_shake = threading_shake;
+ preemote_flash = threading_flash;
+ preemote_sfx += "^";
+ preemote_shake += "^";
+ preemote_flash += "^";
+ delete frame_emote_checker;
+
+
+
+ talkemote_sfx += "(b)" + ao_app->get_emote(current_char, current_emote);
+ talkemote_shake += "(b)" + ao_app->get_emote(current_char, current_emote);
+ talkemote_flash += "(b)" + ao_app->get_emote(current_char, current_emote);
+
+ frame_emote_checker = new QMovie(this);
+ frame_emote_checker->setFileName(talkemote_to_check);
+ frame_emote_checker->jumpToFrame(0);
+ qDebug() << "TALK fuck: " << frame_emote_checker->frameCount();
+
+ threading_sfx = talkemote_sfx;
+ threading_shake = talkemote_shake;
+ threading_flash = talkemote_flash;
+ threading_prefix = QString("(b)");
+
+ for(int i=0; i < frame_emote_checker->frameCount(); i++){
+ AOFrameThreadingBullshit *testfuck = new AOFrameThreadingBullshit(this, i);
+ QThreadPool::globalInstance()->start(testfuck);
+ }
+ QThreadPool::globalInstance()->waitForDone();
+
+ talkemote_sfx = threading_sfx;
+ talkemote_shake = threading_shake;
+ talkemote_flash = threading_flash;
+ talkemote_sfx += "^";
+ talkemote_shake += "^";
+ talkemote_flash += "^";
+ delete frame_emote_checker;
+
+
+
+ idleemote_sfx += "(a)" + ao_app->get_emote(current_char, current_emote);
+ idleemote_shake += "(a)" + ao_app->get_emote(current_char, current_emote);
+ idleemote_flash += "(a)" + ao_app->get_emote(current_char, current_emote);
+
+ frame_emote_checker = new QMovie(this);
+ frame_emote_checker->setFileName(idleemote_to_check);
+ frame_emote_checker->jumpToFrame(0);
+ qDebug() << "idle fuck: " << frame_emote_checker->frameCount();
+
+ threading_sfx = idleemote_sfx;
+ threading_shake = idleemote_shake;
+ threading_flash = idleemote_flash;
+ threading_prefix = QString("(a)");
+ for(int i=0; i < frame_emote_checker->frameCount(); i++){
+ AOFrameThreadingBullshit *testfuck = new AOFrameThreadingBullshit(this, i);
+ QThreadPool::globalInstance()->start(testfuck);
+ }
+ QThreadPool::globalInstance()->waitForDone();
+ idleemote_sfx = threading_sfx;
+ idleemote_shake = threading_shake;
+ idleemote_flash = threading_flash;
+ delete frame_emote_checker;
+
+ frame_screenshake += preemote_shake;
+ frame_screenshake += talkemote_shake;
+ frame_screenshake += idleemote_shake;
+
+ frame_realization += preemote_flash;
+ frame_realization += talkemote_flash;
+ frame_realization += idleemote_flash;
+ frame_sfx += preemote_sfx;
+ frame_sfx += talkemote_sfx;
+ frame_sfx += idleemote_sfx;
+
+ packet_contents.append(frame_screenshake);
+ packet_contents.append(frame_realization);
+ packet_contents.append(frame_sfx);
+ }
ao_app->send_server_packet(new AOPacket("MS", packet_contents));
}
-
void Courtroom::handle_chatmessage(QStringList *p_contents)
{
// Instead of checking for whether a message has at least chatmessage_size
@@ -1307,7 +1543,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
text_state = 0;
anim_state = 0;
ui_vp_objection->stop();
- ui_vp_player_char->stop();
chat_tick_timer->stop();
ui_vp_evidence_display->reset();
@@ -1318,6 +1553,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
ui_ic_chat_message->clear();
objection_state = 0;
realization_state = 0;
+ screenshake_state = 0;
is_presenting_evidence = false;
ui_pre->setChecked(false);
ui_hold_it->set_image("holdit.png");
@@ -1325,6 +1561,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
ui_take_that->set_image("takethat.png");
ui_custom_objection->set_image("custom.png");
ui_realization->set_image("realization.png");
+ ui_screenshake->set_image("screenshake.png");
ui_evidence_present->set_image("present_disabled.png");
}
@@ -1356,6 +1593,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
case 2:
ui_vp_objection->play("objection", f_char, f_custom_theme);
objection_player->play("objection.wav", f_char, f_custom_theme);
+ if(ao_app->get_objectmusic())
+ music_player->kill_loop();
break;
case 3:
ui_vp_objection->play("takethat", f_char, f_custom_theme);
@@ -1388,7 +1627,10 @@ void Courtroom::handle_chatmessage_2()
{
ui_vp_speedlines->stop();
ui_vp_player_char->stop();
-
+ ui_vp_player_char->frame_sfx_hellstring = m_chatmessage[FRAME_SFX];
+ ui_vp_player_char->frame_realization_hellstring = m_chatmessage[FRAME_REALIZATION];
+ ui_vp_player_char->frame_screenshake_hellstring = m_chatmessage[FRAME_SCREENSHAKE];
+ ui_vp_player_char->use_networked_framehell = true;
if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
{
QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name;
@@ -1570,6 +1812,7 @@ void Courtroom::handle_chatmessage_2()
ui_vp_sideplayer_char->set_flipped(true);
else
ui_vp_sideplayer_char->set_flipped(false);
+ ui_vp_sideplayer_char->use_networked_framehell = false;
ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE]);
}
else
@@ -1577,13 +1820,17 @@ void Courtroom::handle_chatmessage_2()
// If the server understands other characters, but there
// really is no second character, hide 'em, and center the first.
ui_vp_sideplayer_char->hide();
+ ui_vp_sideplayer_char->stop();
ui_vp_sideplayer_char->move(0,0);
ui_vp_player_char->move(0,0);
}
}
}
-
+ if (m_chatmessage[SCREENSHAKE] == "1")
+ {
+ this->doScreenShake();
+ }
switch (emote_mod)
{
case 1: case 2: case 6:
@@ -1600,6 +1847,55 @@ void Courtroom::handle_chatmessage_2()
}
}
+void Courtroom::doScreenShake()
+{
+ if(!ao_app->is_shakeandflash_enabled())
+ return;
+ screenshake_group = new QParallelAnimationGroup;
+ screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this);
+ chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this);
+ int screen_x = get_theme_pos("viewport").x();
+ int screen_y = get_theme_pos("viewport").y();
+ QPoint pos_default = QPoint(screen_x, screen_y);
+ QPoint pos1 = QPoint(screen_x + 3, screen_y + -5);
+ QPoint pos2 = QPoint(screen_x + 3, screen_y + -5);
+ QPoint pos3 = QPoint(screen_x + -3, screen_y + 5);
+ QPoint pos4 = QPoint(screen_x + 3, screen_y + -5);
+ QPoint pos5 = QPoint(screen_x + -3,screen_y + -5);
+
+ int chatbox_x = get_theme_pos("ao2_chatbox").x();
+ int chatbox_y = get_theme_pos("ao2_chatbox").y();
+ QPoint chatbox_pos_default = QPoint(chatbox_x, chatbox_y);
+ QPoint chatbox_pos1 = QPoint(chatbox_x + 3, chatbox_y + -5);
+ QPoint chatbox_pos2 = QPoint(chatbox_x + 3, chatbox_y + -5);
+ QPoint chatbox_pos3 = QPoint(chatbox_x + -3, chatbox_y + 5);
+ QPoint chatbox_pos4 = QPoint(chatbox_x + 3, chatbox_y + -5);
+ QPoint chatbox_pos5 = QPoint(chatbox_x + -3,chatbox_y + -5);
+
+ screenshake_animation->setDuration(200);
+ screenshake_animation->setKeyValueAt(0, pos_default);
+ screenshake_animation->setKeyValueAt(0.1, pos1);
+ screenshake_animation->setKeyValueAt(0.3, pos2);
+ screenshake_animation->setKeyValueAt(0.5, pos3);
+ screenshake_animation->setKeyValueAt(0.7, pos4);
+ screenshake_animation->setKeyValueAt(0.9, pos5);
+ screenshake_animation->setEndValue(pos_default);
+ screenshake_animation->setEasingCurve(QEasingCurve::Linear);
+ chatbox_screenshake_animation->setDuration(200);
+ chatbox_screenshake_animation->setKeyValueAt(0, chatbox_pos_default);
+ chatbox_screenshake_animation->setKeyValueAt(0.1, chatbox_pos3);
+ chatbox_screenshake_animation->setKeyValueAt(0.3, chatbox_pos5);
+ chatbox_screenshake_animation->setKeyValueAt(0.5, chatbox_pos2);
+ chatbox_screenshake_animation->setKeyValueAt(0.7, chatbox_pos1);
+ chatbox_screenshake_animation->setKeyValueAt(0.9, chatbox_pos4);
+ chatbox_screenshake_animation->setEndValue(chatbox_pos_default);
+ chatbox_screenshake_animation->setEasingCurve(QEasingCurve::Linear);
+
+ screenshake_group->addAnimation(screenshake_animation);
+ screenshake_group->addAnimation(chatbox_screenshake_animation);
+ screenshake_group->start(QAbstractAnimation::DeletionPolicy::DeleteWhenStopped);
+}
+
void Courtroom::handle_chatmessage_3()
{
start_chat_ticking();
@@ -1731,6 +2027,17 @@ QString Courtroom::filter_ic_text(QString p_text)
p_text.remove(trick_check_pos,1);
}
+ else if (f_character == "$" and !ic_next_is_not_special)
+ {
+ p_text.remove(trick_check_pos,1);
+ }
+
+ else if (f_character == "@" and !ic_next_is_not_special)
+ {
+ p_text.remove(trick_check_pos,1);
+ }
+
+
// Orange inline colourisation.
else if (f_character == "|" and !ic_next_is_not_special)
{
@@ -1941,14 +2248,14 @@ void Courtroom::play_preanim(bool noninterrupting)
int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim);
int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod;
int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60;
-
+ bool looping_sfx = m_chatmessage[LOOPING_SFX] == "1";
int preanim_duration;
if (ao2_duration < 0)
preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim);
else
preanim_duration = ao2_duration;
-
+ sfx_player->setLooping(looping_sfx);
sfx_delay_timer->start(sfx_delay);
QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim));
if (!file_exists(anim_to_find) ||
@@ -1964,7 +2271,6 @@ void Courtroom::play_preanim(bool noninterrupting)
}
ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration);
-
if (noninterrupting)
anim_state = 4;
else
@@ -1988,6 +2294,15 @@ void Courtroom::realization_done()
ui_vp_realization->hide();
}
+void Courtroom::doRealization()
+{
+ if(!ao_app->is_shakeandflash_enabled())
+ return;
+ realization_timer->start(60);
+ ui_vp_realization->show();
+
+}
+
void Courtroom::start_chat_ticking()
{
//we need to ensure that the text isn't already ticking because this function can be called by two logic paths
@@ -1996,11 +2311,9 @@ void Courtroom::start_chat_ticking()
if (m_chatmessage[REALIZATION] == "1")
{
- realization_timer->start(60);
- ui_vp_realization->show();
- sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME]));
+ this->doRealization();
+ misc_sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME]));
}
-
ui_vp_message->clear();
set_text_color();
rainbow_counter = 0;
@@ -2111,6 +2424,18 @@ void Courtroom::chat_tick()
formatting_char = true;
}
+ else if (f_character == "@" and !next_character_is_not_special)
+ {
+ this->doScreenShake();
+ formatting_char = true;
+ }
+
+ else if (f_character == "$" and !next_character_is_not_special)
+ {
+ this->doRealization();
+ formatting_char = true;
+ }
+
// Orange inline colourisation.
else if (f_character == "|" and !next_character_is_not_special)
{
@@ -2533,7 +2858,6 @@ void Courtroom::handle_song(QStringList *p_contents)
QString f_song = f_contents.at(0);
QString f_song_clear = f_song;
- f_song_clear = f_song_clear.left(f_song_clear.lastIndexOf("."));
int n_char = f_contents.at(1).toInt();
if (n_char < 0 || n_char >= char_list.size())
@@ -2547,9 +2871,22 @@ void Courtroom::handle_song(QStringList *p_contents)
if (p_contents->length() > 2)
{
- str_show = p_contents->at(2);
+ if(p_contents->at(2) != "")
+ {
+ str_show = p_contents->at(2);
+ }
+ }
+ if (p_contents->length() > 3)
+ {
+ if(p_contents->at(3) != "-1")
+ {
+ music_player->enable_looping = false;
+ }
+ else
+ {
+ music_player->enable_looping = true;
+ }
}
-
if (!mute_map.value(n_char))
{
chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true);
@@ -2560,12 +2897,18 @@ void Courtroom::handle_song(QStringList *p_contents)
ic_chatlog_history.removeFirst();
}
- append_ic_text(f_song_clear, str_show, true);
+ append_ic_text(f_song, str_show, true);
music_player->play(f_song);
}
}
}
+void Courtroom::handle_failed_login()
+{
+ music_player->enable_looping = false;
+ music_player->play("failed_login");
+}
+
void Courtroom::handle_wtce(QString p_wtce, int variant)
{
QString sfx_file = "courtroom_sounds.ini";
@@ -2573,7 +2916,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
//witness testimony
if (p_wtce == "testimony1")
{
- sfx_player->play(ao_app->get_sfx("witness_testimony"));
+ misc_sfx_player->play(ao_app->get_sfx("witness_testimony"));
ui_vp_wtce->play("witnesstestimony");
testimony_in_progress = true;
show_testimony();
@@ -2581,7 +2924,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
//cross examination
else if (p_wtce == "testimony2")
{
- sfx_player->play(ao_app->get_sfx("cross_examination"));
+ misc_sfx_player->play(ao_app->get_sfx("cross_examination"));
ui_vp_wtce->play("crossexamination");
testimony_in_progress = false;
}
@@ -2589,12 +2932,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
{
if (variant == 0)
{
- sfx_player->play(ao_app->get_sfx("not_guilty"));
+ misc_sfx_player->play(ao_app->get_sfx("not_guilty"));
ui_vp_wtce->play("notguilty");
testimony_in_progress = false;
}
else if (variant == 1) {
- sfx_player->play(ao_app->get_sfx("guilty"));
+ misc_sfx_player->play(ao_app->get_sfx("guilty"));
ui_vp_wtce->play("guilty");
testimony_in_progress = false;
}
@@ -2647,14 +2990,14 @@ void Courtroom::toggle_judge_buttons(bool is_on)
void Courtroom::mod_called(QString p_ip)
{
ui_server_chatlog->append(p_ip);
- if (ui_guard->isChecked())
+ if (!ui_guard->isChecked())
{
modcall_player->play(ao_app->get_sfx("mod_call"));
ao_app->alert(this);
}
}
-void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno)
+void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness)
{
if (ui_casing->isChecked())
{
@@ -2663,7 +3006,8 @@ void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur,
(ao_app->get_casing_prosecution_enabled() && pro) ||
(ao_app->get_casing_judge_enabled() && jud) ||
(ao_app->get_casing_juror_enabled() && jur) ||
- (ao_app->get_casing_steno_enabled() && steno))
+ (ao_app->get_casing_steno_enabled() && steno) ||
+ (ao_app->get_casing_wit_enabled() && witness))
{
modcall_player->play(ao_app->get_sfx("case_call"));
ao_app->alert(this);
@@ -3232,6 +3576,22 @@ void Courtroom::on_realization_clicked()
ui_ic_chat_message->setFocus();
}
+void Courtroom::on_screenshake_clicked()
+{
+ if (screenshake_state == 0)
+ {
+ screenshake_state = 1;
+ ui_screenshake->set_image("screenshake_pressed.png");
+ }
+ else
+ {
+ screenshake_state = 0;
+ ui_screenshake->set_image("screenshake.png");
+ }
+
+ ui_ic_chat_message->setFocus();
+}
+
void Courtroom::on_mute_clicked()
{
if (ui_mute_list->isHidden())
@@ -3315,6 +3675,9 @@ void Courtroom::on_sfx_slider_moved(int p_value)
{
sfx_player->set_volume(p_value);
objection_player->set_volume(p_value);
+ misc_sfx_player->set_volume(p_value);
+ frame_emote_sfx_player->set_volume(p_value);
+ pair_frame_emote_sfx_player->set_volume(p_value);
ui_ic_chat_message->setFocus();
}
@@ -3419,7 +3782,7 @@ void Courtroom::on_char_select_right_clicked()
void Courtroom::on_spectator_clicked()
{
- enter_courtroom(-1);
+ this->set_character(-1);
ui_emotes->hide();
@@ -3557,15 +3920,16 @@ void Courtroom::on_casing_clicked()
f_packet.append(QString::number(ao_app->get_casing_judge_enabled()));
f_packet.append(QString::number(ao_app->get_casing_juror_enabled()));
f_packet.append(QString::number(ao_app->get_casing_steno_enabled()));
+ f_packet.append(QString::number(ao_app->get_casing_wit_enabled()));
ao_app->send_server_packet(new AOPacket("SETCASE", f_packet));
}
else
- ao_app->send_server_packet(new AOPacket("SETCASE#\"\"#0#0#0#0#0#0#%"));
+ ao_app->send_server_packet(new AOPacket("SETCASE#\"\"#0#0#0#0#0#0#0#%"));
}
}
-void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno)
+void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno, bool wit)
{
if (ao_app->casing_alerts_enabled)
{
@@ -3577,6 +3941,7 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool
f_packet.append(QString::number(jud));
f_packet.append(QString::number(jur));
f_packet.append(QString::number(steno));
+ f_packet.append(QString::number(wit));
ao_app->send_server_packet(new AOPacket("CASEA", f_packet));
}
diff --git a/src/lobby.cpp b/src/lobby.cpp
index 6f257cec..17a07a7a 100644
--- a/src/lobby.cpp
+++ b/src/lobby.cpp
@@ -173,6 +173,10 @@ void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
}
}
+void Lobby::fucking_threading_goddamn_it(QString text){
+ this->set_loading_text(text);
+}
+
void Lobby::set_loading_text(QString p_text)
{
ui_loading_text->clear();
diff --git a/src/main.cpp b/src/main.cpp
index 6c7b1513..778323fc 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
main_app.installTranslator(&appTranslator);
main_app.construct_lobby();
- main_app.net_manager->connect_to_master();
main_app.w_lobby->show();
+ main_app.net_manager->connect_to_master();
return main_app.exec();
}
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index 40015fda..fe26849f 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -7,6 +7,35 @@
#include "hardware_functions.h"
#include "debug_functions.h"
+class AOPacketLoadMusicThreading : public QRunnable
+{
+public:
+ AOApplication *myapp;
+ QString filename;
+ bool ismusic;
+ AOPacketLoadMusicThreading(AOApplication *my_app, QString file_name, bool is_music){
+ myapp = my_app;
+ filename = file_name;
+ ismusic = is_music;
+ }
+ void run()
+ {
+ if(ismusic)
+ {
+ myapp->w_courtroom->append_music(filename);
+ }
+ else
+ {
+ myapp->w_courtroom->append_area(filename);
+ myapp->area_count++;
+ }
+ for (int area_n = 0; area_n < myapp->area_count; area_n++)
+ {
+ myapp->w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
+ }
+ }
+};
+
void AOApplication::ms_packet_received(AOPacket *p_packet)
{
p_packet->net_decode();
@@ -156,6 +185,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
arup_enabled = false;
casing_alerts_enabled = false;
modcall_reason_enabled = false;
+ looping_sfx_support_enabled = false;
//workaround for tsuserver4
if (f_contents.at(0) == "NOENCRYPT")
@@ -216,6 +246,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
casing_alerts_enabled = true;
if (f_packet.contains("modcall_reason",Qt::CaseInsensitive))
modcall_reason_enabled = true;
+ if (f_packet.contains("looping_sfx",Qt::CaseInsensitive))
+ looping_sfx_support_enabled = true;
+
+ w_lobby->enable_connect_button();
}
else if (header == "PN")
{
@@ -289,51 +323,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (is_discord_enabled())
discord->state_server(server_name.toStdString(), hash.result().toBase64().toStdString());
}
- else if (header == "CI")
- {
- if (!courtroom_constructed)
- goto end;
-
- for (int n_element = 0 ; n_element < f_contents.size() ; n_element += 2)
- {
- if (f_contents.at(n_element).toInt() != loaded_chars)
- break;
-
- //this means we are on the last element and checking n + 1 element will be game over so
- if (n_element == f_contents.size() - 1)
- break;
-
- QStringList sub_elements = f_contents.at(n_element + 1).split("&");
- if (sub_elements.size() < 2)
- break;
-
- char_type f_char;
- f_char.name = sub_elements.at(0);
- f_char.description = sub_elements.at(1);
- f_char.evidence_string = sub_elements.at(3);
- //temporary. the CharsCheck packet sets this properly
- f_char.taken = false;
-
- ++loaded_chars;
-
- w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size));
-
- w_courtroom->append_char(f_char);
-
- int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
- int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
- w_lobby->set_loading_value(loading_value);
- }
-
- if (improved_loading_enabled)
- send_server_packet(new AOPacket("RE#%"));
- else
- {
- QString next_packet_number = QString::number(((loaded_chars - 1) / 10) + 1);
- send_server_packet(new AOPacket("AN#" + next_packet_number + "#%"));
- }
-
- }
else if (header == "EI")
{
if (!courtroom_constructed)
@@ -481,7 +470,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
goto end;
bool musics_time = false;
- int areas = 0;
+ area_count = 0;
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
{
@@ -515,13 +504,22 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
for (int area_n = 0; area_n < areas; area_n++)
{
- w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
+ musics_time = true;
+ continue;
}
-
+ AOPacketLoadMusicThreading *music_load = new AOPacketLoadMusicThreading(this, f_contents.at(n_element), musics_time);
+ QThreadPool::globalInstance()->start(music_load);
+ ++loaded_music;
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
w_lobby->set_loading_value(loading_value);
+ w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size));
+ if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount())
+ {
+ QThreadPool::globalInstance()->waitForDone(); //out of order music is bad
+ }
}
+ QThreadPool::globalInstance()->waitForDone();
send_server_packet(new AOPacket("RD#%"));
}
@@ -540,6 +538,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
destruct_lobby();
}
+ else if (header == "REFMUSIC")
+ {
+ if (courtroom_constructed)
+ w_courtroom->reset_music_list();
+ for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
+ {
+ w_courtroom->append_music(f_contents.at(n_element));
+ }
+ w_courtroom->list_music();
+ }
else if (header == "BN")
{
if (f_contents.size() < 1)
@@ -553,9 +561,24 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
{
if (f_contents.size() < 3)
goto end;
-
- if (courtroom_constructed)
- w_courtroom->enter_courtroom(f_contents.at(2).toInt());
+ if(f_contents.size() < 4){
+ if (courtroom_constructed)
+ w_courtroom->enter_courtroom(f_contents.at(2).toInt());
+ }
+ else
+ {
+ if (courtroom_constructed)
+ {
+ if(f_contents.at(3) == "True")
+ {
+ w_courtroom->set_character(f_contents.at(2).toInt());
+ }
+ else
+ {
+ w_courtroom->enter_courtroom(f_contents.at(2).toInt());
+ }
+ }
+ }
}
else if (header == "MS")
{
@@ -620,6 +643,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
}
}
}
+ else if (header == "FAILEDLOGIN")
+ {
+ if (courtroom_constructed)
+ w_courtroom->handle_failed_login();
+ }
else if (header == "IL")
{
if (courtroom_constructed && f_contents.size() > 0)
@@ -665,8 +693,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
}
else if (header == "CASEA")
{
- if (courtroom_constructed && f_contents.size() > 6)
- w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1");
+ if (courtroom_constructed && f_contents.size() > 7)
+ w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1", f_contents.at(6) == "1");
}
end:
diff --git a/src/path_functions.cpp b/src/path_functions.cpp
index 5eb97a32..c2c15a26 100644
--- a/src/path_functions.cpp
+++ b/src/path_functions.cpp
@@ -96,11 +96,28 @@ QString AOApplication::get_sounds_path(QString p_file)
QString AOApplication::get_music_path(QString p_song)
{
- QString path = get_base_path() + "sounds/music/" + p_song;
+ QString mp3_check = get_base_path() + "sounds/music/" + p_song + ".mp3";
+ QString opus_check = get_base_path() + "sounds/music/" + p_song + ".opus";
+ if (file_exists(opus_check))
+ {
+ #ifndef CASE_SENSITIVE_FILESYSTEM
+ return get_base_path() + "sounds/music/" + p_song + ".opus";
+ #else
+ return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".opus");
+ #endif
+ }
+ else if (file_exists(mp3_check))
+ {
+ #ifndef CASE_SENSITIVE_FILESYSTEM
+ return get_base_path() + "sounds/music/" + p_song + ".mp3";
+ #else
+ return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".mp3");
+ #endif
+ }
#ifndef CASE_SENSITIVE_FILESYSTEM
- return path;
+ return get_base_path() + "sounds/music/" + p_song + ".wav";
#else
- return get_case_sensitive_path(path);
+ return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".wav");
#endif
}
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index 5a34ac8b..1e1c4744 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -8,7 +8,7 @@ QString AOApplication::read_theme()
int AOApplication::read_blip_rate()
{
- int result = configini->value("blip_rate", 1).toInt();
+ int result = configini->value("blip_rate", 2).toInt();
if (result < 1)
return 1;
@@ -568,6 +568,42 @@ QString AOApplication::get_sfx_name(QString p_char, int p_emote)
else return f_result;
}
+QString AOApplication::get_sfx_looping(QString p_char, int p_emote)
+{
+ QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundL");
+
+ if (f_result == "")
+ return "0";
+ else return f_result;
+}
+
+QString AOApplication::get_frame_sfx_name(QString p_char, QString p_emote, int n_frame)
+{
+ QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameSFX"));
+ if (f_result == "")
+ return "";
+ else return f_result;
+}
+
+QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, int n_frame)
+{
+ QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameScreenshake"));
+ if (f_result == "")
+ return "";
+ else return f_result;
+}
+
+
+QString AOApplication::get_realization_frame(QString p_char, QString p_emote, int n_frame)
+{
+ QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameRealization"));
+ if (f_result == "")
+ return "";
+ else return f_result;
+}
+
+
+
int AOApplication::get_sfx_delay(QString p_char, int p_emote)
{
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundT");
@@ -601,12 +637,31 @@ bool AOApplication::get_blank_blip()
return result.startsWith("true");
}
+bool AOApplication::get_looping_sfx()
+{
+ QString result = configini->value("looping_sfx", "true").value<QString>();
+ return result.startsWith("true");
+}
+
+bool AOApplication::get_objectmusic()
+{
+ QString result = configini->value("kill_music_on_object", "false").value<QString>();
+ return result.startsWith("true");
+}
+
bool AOApplication::is_discord_enabled()
{
QString result = configini->value("discord", "true").value<QString>();
return result.startsWith("true");
}
+bool AOApplication::is_shakeandflash_enabled()
+{
+ QString result = configini->value("shakeandflash", "true").value<QString>();
+ return result.startsWith("true");
+}
+
+
bool AOApplication::get_casing_enabled()
{
QString result = configini->value("casing_enabled", "false").value<QString>();
@@ -643,6 +698,12 @@ bool AOApplication::get_casing_steno_enabled()
return result.startsWith("true");
}
+bool AOApplication::get_casing_wit_enabled()
+{
+ QString result = configini->value("casing_wit_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+
bool AOApplication::get_casing_cm_enabled()
{
QString result = configini->value("casing_cm_enabled", "false").value<QString>();