diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..403e745ff
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,10 @@
+BasedOnStyle: LLVM
+BreakBeforeBraces: Allman
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: None
+AllowShortLoopsOnASingleLine: false
+AllowShortEnumsOnASingleLine: false
+ColumnLimit: 120
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 000000000..b99a6e34a
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,215 @@
+name: Build
+
+env:
+ # Multi-threaded compilation for MSVC
+ CL: /MP
+
+on: [workflow_dispatch, push]
+
+jobs:
+ Build:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [windows-latest, ubuntu-latest, macos-latest]
+ version: [5.15.2]
+ include:
+ - os: windows-latest
+ os-caption: Windows
+ - os: ubuntu-latest
+ os-caption: Ubuntu
+ - os: macos-latest
+ os-caption: MacOS
+
+ runs-on: ${{matrix.os}}
+ steps:
+ - name: Clone Project
+ uses: actions/checkout@v2.4.2
+
+ - name: Fetch Git Info
+ shell: bash
+ working-directory: ${{github.workspace}}
+ run: |
+ git_hash=$(git rev-parse --short "$GITHUB_SHA")
+ git_branch=${GITHUB_REF##*/}
+ echo "$git_hash" >> ./res/git/git_hash.txt
+ echo "$git_branch" >> ./res/git/git_branch.txt
+
+ - name: Setup externals
+ run: |
+ mkdir ./3rd
+ mkdir ./3rd/bass
+ mkdir ./3rd/discord-rpc
+ mkdir ./3rd/openssl
+
+ - name: Install OpenSSL (Windows)
+ if: contains(matrix.os, 'windows')
+ run: |
+ curl -L https://mirror.firedaemon.com/OpenSSL/openssl-1.1.1q.zip -o openssl.zip
+ unzip -d ./openssl -o ./openssl.zip
+ cp ./openssl/openssl-1.1/x64/bin/*.dll ./3rd
+
+ - name: Install BASS (Windows)
+ if: contains(matrix.os, 'windows')
+ run: |
+ curl http://www.un4seen.com/files/bass24.zip -o ./bass.zip
+ unzip -d ./bass -o ./bass.zip
+ cp ./bass/c/bass.h ./3rd/bass
+ cp ./bass/c/x64/bass.lib ./3rd
+ cp ./bass/x64/bass.dll ./3rd
+
+ curl http://www.un4seen.com/files/bassopus24.zip -o ./bassopus.zip
+ unzip -d ./bass -o ./bassopus.zip
+ cp ./bass/c/bassopus.h ./3rd/bass
+ cp ./bass/c/x64/bassopus.lib ./3rd
+ cp ./bass/x64/bassopus.dll ./3rd
+
+ - name: Install BASS (Ubuntu)
+ if: contains(matrix.os, 'ubuntu')
+ run: |
+ curl http://www.un4seen.com/files/bass24-linux.zip -o ./bass.zip
+ unzip -d ./bass -o ./bass.zip
+ cp ./bass/bass.h ./3rd/bass/bass.h
+ cp ./bass/x64/libbass.so ./3rd/libbass.so
+
+ curl http://www.un4seen.com/files/bassopus24-linux.zip -o ./bassopus.zip
+ unzip -d ./bass -o ./bassopus.zip
+ cp ./bass/bassopus.h ./3rd/bass/bassopus.h
+ cp ./bass/x64/libbassopus.so ./3rd/libbassopus.so
+
+ - name: Install BASS (MacOS)
+ if: contains(matrix.os, 'macos')
+ run: |
+ curl http://www.un4seen.com/files/bass24-osx.zip -o ./bass.zip
+ unzip -d ./bass -o ./bass.zip
+ cp ./bass/bass.h ./3rd/bass
+ cp ./bass/libbass.dylib ./3rd
+
+ curl http://www.un4seen.com/files/bassopus24-osx.zip -o ./bassopus.zip
+ unzip -d ./bass -o ./bassopus.zip
+ cp ./bass/bassopus.h ./3rd/bass
+ cp ./bass/libbassopus.dylib ./3rd
+
+ - name: Install Discord-RPC (Windows)
+ if: contains(matrix.os, 'windows')
+ run: |
+ curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-win.zip -o ./discord-rpc.zip
+ unzip ./discord-rpc.zip
+ cp ./discord-rpc/win64-dynamic/include/discord_register.h ./3rd/discord-rpc
+ cp ./discord-rpc/win64-dynamic/include/discord_rpc.h ./3rd/discord-rpc
+ cp ./discord-rpc/win64-dynamic/bin/discord-rpc.dll ./3rd
+ cp ./discord-rpc/win64-dynamic/lib/discord-rpc.lib ./3rd
+
+ - name: Install Discord-RPC (Ubuntu)
+ if: contains(matrix.os, 'ubuntu')
+ run: |
+ curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-linux.zip -o ./discord-rpc.zip
+ unzip ./discord-rpc.zip
+ cp ./discord-rpc/linux-dynamic/include/discord_register.h ./3rd/discord-rpc/discord_register.h
+ cp ./discord-rpc/linux-dynamic/include/discord_rpc.h ./3rd/discord-rpc/discord_rpc.h
+ cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./3rd/libdiscord-rpc.so
+
+ - name: Install Discord-RPC (MacOS)
+ if: contains(matrix.os, 'macos')
+ run: |
+ curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-osx.zip -o ./discord-rpc.zip
+ unzip ./discord-rpc.zip
+ cp ./discord-rpc/osx-dynamic/include/discord_register.h ./3rd/discord-rpc
+ cp ./discord-rpc/osx-dynamic/include/discord_rpc.h ./3rd/discord-rpc
+ cp ./discord-rpc/osx-dynamic/lib/libdiscord-rpc.dylib ./3rd
+
+ - name: Update packages (Ubuntu)
+ if: contains(matrix.os, 'ubuntu')
+ run: |
+ sudo apt-get update
+ sudo apt-get upgrade
+
+ - name: Install Qt (Ubuntu)
+ if: contains(matrix.os, 'ubuntu')
+ run: |
+ sudo apt-get install qt5-default libqt5designer5 qttools5-dev libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediawidgets5 qtmultimedia5-dev
+
+ - name: Install Qt (Others)
+ if: contains(matrix.os, 'ubuntu') != true
+ uses: jurplel/install-qt-action@v2.14.0
+ with:
+ version: ${{matrix.version}}
+
+ - name: Configure MSVC (Windows)
+ if: contains(matrix.os, 'windows')
+ uses: ilammy/msvc-dev-cmd@v1
+
+ - name: Clone QtApng
+ uses: actions/checkout@v2
+ with:
+ repository: Skycoder42/QtApng
+ path: ./qtapng
+
+ - name: Build QtApng (Windows)
+ if: contains(matrix.os, 'windows')
+ run: |
+ cd ./qtapng
+ qmake
+ nmake
+
+ - name: Build QtApng (Others)
+ if: contains(matrix.os, 'windows') != true
+ run: |
+ cd ./qtapng
+ qmake
+ make -j3
+
+ - name: Make Project
+ run: |
+ cp ./data/.qmake.conf .
+ qmake
+
+ - name: Build Project (Windows)
+ if: contains(matrix.os, 'windows')
+ run: |
+ nmake
+
+ - name: Build Project (Others)
+ if: contains(matrix.os, 'windows') != true
+ run: |
+ make -j3
+
+ - name: Packing (Windows)
+ if: contains(matrix.os, 'windows')
+ run: |
+ cd ./bin
+ windeployqt dro-client.exe --compiler-runtime --no-quick-import --no-translations
+ cp ../qtapng/plugins/imageformats/qapng.dll ./imageformats
+ cp ../3rd/*.dll .
+ cd ..
+
+ - name: Packing (Ubuntu)
+ if: contains(matrix.os, 'ubuntu')
+ run: |
+ cd ./bin
+ mkdir ./depends
+ cp ../3rd/*.so ./depends
+ mkdir ./imageformats
+ cp ../qtapng/plugins/imageformats/libqapng.so ./imageformats
+ cp ../data/dro-client.sh .
+ cp ../data/README-LINUX.md ./README.md
+ cd ..
+
+ - name: Packing (MacOS)
+ if: contains(matrix.os, 'macos')
+ run: |
+ cd ./bin
+ mv ./dro-client.app "./Danganronpa Online.app"
+ macdeployqt "./Danganronpa Online.app"
+ cp ../qtapng/plugins/imageformats/libqapng.dylib "./Danganronpa Online.app/Contents/PlugIns/imageformats"
+ cp ../3rd/*.dylib "./Danganronpa Online.app/Contents/Frameworks"
+ hdiutil create -volname "Danganronpa Online" -srcfolder "./Danganronpa Online.app" -ov -format UDZO "Danganronpa Online.dmg"
+ rm -rf "./Danganronpa Online.app"
+ cp ../data/README-MACOS.txt ./README.txt
+ cd ..
+
+ - name: Create Artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: "Danganronpa Online (${{matrix.os-caption}})"
+ path: ./bin
diff --git a/.gitignore b/.gitignore
index 9028beab7..08f5ea69f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,15 @@
+3rd/
+3rd_x86/
+3rdparty/
+base/
+docs/
+.qmake.conf
+.gitignore
*~
*.db
*.user
*.dll
*.so
-base_override.h
-
-base-full/
-bass.lib
-discord-rpc.lib
-send-presence.exe
+*.autosave
+*DS_Store
+*.swp
diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro
deleted file mode 100644
index a42821f65..000000000
--- a/Attorney_Online_remake.pro
+++ /dev/null
@@ -1,117 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2016-12-29T01:14:46
-#
-#-------------------------------------------------
-
-QT += core gui multimedia network
-
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-RC_ICONS = logo.ico
-
-TARGET = Attorney_Online_remake
-TEMPLATE = app
-
-VERSION = 2.4.8.0
-
-SOURCES += main.cpp\
- lobby.cpp \
- text_file_functions.cpp \
- path_functions.cpp \
- aoimage.cpp \
- file_functions.cpp \
- aobutton.cpp \
- debug_functions.cpp \
- networkmanager.cpp \
- aoapplication.cpp \
- aopacket.cpp \
- packet_distribution.cpp \
- hex_functions.cpp \
- encryption_functions.cpp \
- courtroom.cpp \
- aocharbutton.cpp \
- hardware_functions.cpp \
- aoscene.cpp \
- aomovie.cpp \
- misc_functions.cpp \
- aocharmovie.cpp \
- aoemotebutton.cpp \
- emotes.cpp \
- aosfxplayer.cpp \
- aomusicplayer.cpp \
- aoblipplayer.cpp \
- evidence.cpp \
- aoevidencebutton.cpp \
- charselect.cpp \
- aotextarea.cpp \
- aolineedit.cpp \
- aotextedit.cpp \
- aoevidencedisplay.cpp \
- discord_rich_presence.cpp \
- aonotepad.cpp \
- aobasshandle.cpp \
- aoexception.cpp \
- aoabstractplayer.cpp \
- aoshoutplayer.cpp \
- aonotearea.cpp \
- aonotepicker.cpp \
- aolabel.cpp
-
-HEADERS += lobby.h \
- aoimage.h \
- file_functions.h \
- aobutton.h \
- debug_functions.h \
- networkmanager.h \
- aoapplication.h \
- datatypes.h \
- aopacket.h \
- hex_functions.h \
- encryption_functions.h \
- courtroom.h \
- aocharbutton.h \
- hardware_functions.h \
- aoscene.h \
- aomovie.h \
- misc_functions.h \
- aocharmovie.h \
- aoemotebutton.h \
- bass.h \
- aosfxplayer.h \
- aomusicplayer.h \
- aoblipplayer.h \
- aoevidencebutton.h \
- aotextarea.h \
- aolineedit.h \
- aotextedit.h \
- aoevidencedisplay.h \
- discord_rich_presence.h \
- discord-rpc.h \
- aonotepad.h \
- aobasshandle.hpp \
- aoexception.hpp \
- aoabstractplayer.hpp \
- aoshoutplayer.hpp \
- aonotearea.hpp \
- aonotepicker.hpp \
- aolabel.hpp
-
-# 1. You need to get BASS and put the x86 bass DLL/headers in the project root folder
-# AND the compilation output folder. If you want a static link, you'll probably
-# need the .lib file too. MinGW-GCC is really finicky finding BASS, it seems.
-# 2. You need to compile the Discord Rich Presence SDK separately and add the lib/headers
-# in the same way as BASS. Discord RPC uses CMake, which does not play nicely with
-# QMake, so this step must be manual.
-unix:LIBS += -L$$PWD -lbass -ldiscord-rpc
-win32:LIBS += -L$$PWD "$$PWD/bass.lib" -ldiscord-rpc #"$$PWD/discord-rpc.dll"
-android:LIBS += -L$$PWD\android\libs\armeabi-v7a\ -lbass
-
-CONFIG += c++11
-
-ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
-
-RESOURCES += \
- resources.qrc
-
-DISTFILES +=
diff --git a/README.md b/README.md
index b034d333f..4c9a5fe80 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,12 @@
-# Attorney-Online-Client-Remake
-This is a remake of Attorney Online made by FanatSors, licensed under GPLv3.
+# Danganronpa-Online-Client
+This is the official client used, it is a derivative of [Attorney-Online-Client-Remake](https://github.com/AttorneyOnline/AO2-Client).
## Qt
-This project uses Qt 5.7, which is licensed under the [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl-3.0.txt) with [certain licensing restrictions and exceptions](https://www.qt.io/qt-licensing-terms/). To comply with licensing requirements for static linking, object code is available if you would like to relink with an alternative version of Qt, and the source code for Qt may be found at https://github.com/qt/qtbase, http://code.qt.io/cgit/, or at https://qt.io.
+This project uses Qt 5.15.2 (5.12.8 for Linux), which is licensed under the [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl-3.0.txt) with [certain licensing restrictions and exceptions](https://www.qt.io/qt-licensing-terms/). To comply with licensing requirements for static linking, object code is available if you would like to relink with an alternative version of Qt, and the source code for Qt may be found at https://github.com/qt/qtbase, http://code.qt.io/cgit/, or at https://qt.io.
-Copyright (C) 2016 The Qt Company Ltd.
+Copyright (C) 2022 The Qt Company Ltd.
## BASS
+This project uses [BASS shared library](http://www.un4seen.com/).
-This project depends on the BASS shared library. Get it here: http://www.un4seen.com/
-
-Copyright (c) 1999-2016 Un4seen Developments Ltd. All rights reserved.
+Copyright (c) 1999-2022 Un4seen Developments Ltd. All rights reserved.
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
deleted file mode 100644
index f458c6a78..000000000
--- a/android/AndroidManifest.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android/project.properties b/android/project.properties
deleted file mode 100644
index a08f37edd..000000000
--- a/android/project.properties
+++ /dev/null
@@ -1 +0,0 @@
-target=android-21
\ No newline at end of file
diff --git a/aoabstractplayer.cpp b/aoabstractplayer.cpp
deleted file mode 100644
index a371a3625..000000000
--- a/aoabstractplayer.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "aoabstractplayer.hpp"
-
-AOAbstractPlayer::AOAbstractPlayer(QObject *p_parent, AOApplication *p_ao_app)
- : QObject(p_parent), ao_app(p_ao_app)
-{}
-
-int AOAbstractPlayer::get_volume()
-{
- return m_volume;
-}
-
-void AOAbstractPlayer::set_volume(int p_volume)
-{
- m_volume = p_volume;
-
- emit new_volume(m_volume);
-}
diff --git a/aoabstractplayer.hpp b/aoabstractplayer.hpp
deleted file mode 100644
index 0e7d9fc13..000000000
--- a/aoabstractplayer.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef AOABSTRACTPLAYER_HPP
-#define AOABSTRACTPLAYER_HPP
-
-#include
-#include
-
-#include "aoapplication.h"
-#include "aobasshandle.hpp"
-
-class AOAbstractPlayer : public QObject
-{
- Q_OBJECT
-
-public:
- AOAbstractPlayer(QObject *p_parent, AOApplication *p_ao_app);
-
- int get_volume();
-
-public slots:
- void set_volume(int p_volume);
-
-signals:
- void starting();
- void stopping();
- void new_volume(int p_volume);
-
-protected:
- AOApplication* ao_app = nullptr;
-
-private:
- int m_volume = 0;
-};
-
-#endif // AOABSTRACTPLAYER_HPP
diff --git a/aoapplication.cpp b/aoapplication.cpp
deleted file mode 100644
index 35259bc2f..000000000
--- a/aoapplication.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-#include "aoapplication.h"
-
-#include "lobby.h"
-#include "courtroom.h"
-#include "networkmanager.h"
-#include "debug_functions.h"
-
-#include
-#include
-#include
-
-AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
-{
- net_manager = new NetworkManager(this);
- discord = new AttorneyOnline::Discord();
- QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)),
- SLOT(ms_connect_finished(bool, bool)));
-}
-
-AOApplication::~AOApplication()
-{
- destruct_lobby();
- destruct_courtroom();
- delete discord;
-}
-
-void AOApplication::construct_lobby()
-{
- if (lobby_constructed)
- {
- qDebug() << "W: lobby was attempted constructed when it already exists";
- return;
- }
-
- w_lobby = new Lobby(this);
- lobby_constructed = true;
-
- QRect screenGeometry = QApplication::desktop()->screenGeometry();
- int x = (screenGeometry.width()-w_lobby->width()) / 2;
- int y = (screenGeometry.height()-w_lobby->height()) / 2;
- w_lobby->move(x, y);
-
- discord->state_lobby();
-
- w_lobby->show();
-}
-
-void AOApplication::destruct_lobby()
-{
- if(!lobby_constructed)
- {
- qDebug() << "W: lobby was attempted destructed when it did not exist";
- return;
- }
-
- delete w_lobby;
- lobby_constructed = false;
-}
-
-void AOApplication::construct_courtroom()
-{
- if (courtroom_constructed)
- {
- qDebug() << "W: courtroom was attempted constructed when it already exists";
- return;
- }
-
- w_courtroom = new Courtroom(this);
- courtroom_constructed = true;
-
- QRect screenGeometry = QApplication::desktop()->screenGeometry();
- int x = (screenGeometry.width()-w_courtroom->width()) / 2;
- int y = (screenGeometry.height()-w_courtroom->height()) / 2;
- w_courtroom->move(x, y);
-}
-
-void AOApplication::destruct_courtroom()
-{
- if (!courtroom_constructed)
- {
- qDebug() << "W: courtroom was attempted destructed when it did not exist";
- return;
- }
-
- delete w_courtroom;
- courtroom_constructed = false;
-}
-
-QString AOApplication::get_version_string()
-{
- return
- QString::number(RELEASE) + "." +
- QString::number(MAJOR_VERSION) + "." +
- QString::number(MINOR_VERSION);
-}
-
-void AOApplication::reload_theme()
-{
- current_theme = read_theme();
-}
-
-void AOApplication::set_favorite_list()
-{
- favorite_list = read_serverlist_txt();
-}
-
-QString AOApplication::get_current_char()
-{
- if (courtroom_constructed)
- return w_courtroom->get_current_char();
- else
- return "";
-}
-
-void AOApplication::add_favorite_server(int p_server)
-{
- if (p_server < 0 || p_server >= server_list.size())
- return;
-
- server_type fav_server = server_list.at(p_server);
-
- QString str_port = QString::number(fav_server.port);
-
- QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name;
-
- write_to_serverlist_txt(server_line);
-}
-
-void AOApplication::server_disconnected()
-{
- if (courtroom_constructed)
- {
- call_notice("Disconnected from server.");
- construct_lobby();
- destruct_courtroom();
- }
-}
-
-void AOApplication::loading_cancelled()
-{
- destruct_courtroom();
-
- w_lobby->hide_loading_overlay();
-}
-
-void AOApplication::ms_connect_finished(bool connected, bool will_retry)
-{
- if (connected)
- {
- AOPacket *f_packet = new AOPacket("ALL#%");
- send_ms_packet(f_packet);
- }
- else
- {
- if (!lobby_constructed)
- {
- return;
- }
- else if (will_retry)
- {
- w_lobby->append_error("Error connecting to master server. Will try again in "
- + QString::number(net_manager->ms_reconnect_delay_ms / 1000.f) + " seconds.");
- }
- else
- {
- call_error("There was an error connecting to the master server.\n"
- "We deploy multiple master servers to mitigate any possible downtime, "
- "but the client appears to have exhausted all possible methods of finding "
- "and connecting to one.\n"
- "Please check your Internet connection and firewall, and please try again.");
- }
- }
-}
diff --git a/aoapplication.h b/aoapplication.h
deleted file mode 100644
index b28ea7af9..000000000
--- a/aoapplication.h
+++ /dev/null
@@ -1,276 +0,0 @@
-#ifndef AOAPPLICATION_H
-#define AOAPPLICATION_H
-
-#include "aopacket.h"
-#include "datatypes.h"
-#include "discord_rich_presence.h"
-
-#include
-#include
-#include
-
-class NetworkManager;
-class Lobby;
-class Courtroom;
-
-class AOApplication : public QApplication
-{
- Q_OBJECT
-
-public:
- AOApplication(int &argc, char **argv);
- ~AOApplication();
-
- NetworkManager *net_manager;
- Lobby *w_lobby;
- Courtroom *w_courtroom;
- AttorneyOnline::Discord *discord;
-
- bool lobby_constructed = false;
- bool courtroom_constructed = false;
-
- void construct_lobby();
- void destruct_lobby();
-
- void construct_courtroom();
- void destruct_courtroom();
-
- void ms_packet_received(AOPacket *p_packet);
- void server_packet_received(AOPacket *p_packet);
-
- void send_ms_packet(AOPacket *p_packet);
- void send_server_packet(AOPacket *p_packet, bool encoded = true);
-
- /////////////////server metadata//////////////////
-
- unsigned int s_decryptor = 5;
- bool encryption_needed = true;
-
- bool yellow_text_enabled = false;
- bool prezoom_enabled = false;
- bool flipping_enabled = false;
- bool custom_objection_enabled = false;
- bool improved_loading_enabled = false;
- bool desk_mod_enabled = false;
- bool evidence_enabled = false;
-
- ///////////////loading info///////////////////
-
- //player number, it's hardly used but might be needed for some old servers
- int s_pv = 0;
-
- QString server_software = "";
-
- int char_list_size = 0;
- int loaded_chars = 0;
- int evidence_list_size = 0;
- int loaded_evidence = 0;
- int music_list_size = 0;
- int loaded_music = 0;
-
- bool courtroom_loaded = false;
-
- //////////////////versioning///////////////
-
- int get_release() {return RELEASE;}
- int get_major_version() {return MAJOR_VERSION;}
- int get_minor_version() {return MINOR_VERSION;}
- QString get_version_string();
-
- ///////////////////////////////////////////
-
- void set_favorite_list();
- QVector& get_favorite_list() {return favorite_list;}
- void add_favorite_server(int p_server);
-
- void set_server_list();
- QVector& get_server_list() {return server_list;}
-
- //reads the theme from config.ini and sets it accordingly
- void reload_theme();
-
- //Returns the character the player has currently selected
- QString get_current_char();
-
- //implementation in path_functions.cpp
- QString get_base_path();
- QString get_data_path();
- QString get_theme_path();
- QString get_default_theme_path();
- QString get_character_path(QString p_character);
- QString get_demothings_path();
- QString get_sounds_path();
- QString get_music_path(QString p_song);
- QString get_background_path();
- QString get_default_background_path();
- QString get_evidence_path();
-
- ////// Functions for reading and writing files //////
- // Implementations file_functions.cpp
-
- //Returns the config value for the passed searchline from a properly formatted config ini file
- QString read_config(QString searchline);
-
- //Returns text from note file
- QString read_note(QString filename);
-
- //Reads the theme from config.ini and loads it into the current_theme variable
- QString read_theme();
-
- //Returns the blip rate from config.ini
- int read_blip_rate();
-
- //Returns true if blank blips is enabled in config.ini and false otherwise
- bool get_blank_blip();
-
- //Returns the value of default_music in config.ini
- int get_default_music();
-
- //Returns the value of default_sfx in config.ini
- int get_default_sfx();
-
- //Returns the value of default_blip in config.ini
- int get_default_blip();
-
- //Returns the list of words in callwords.ini
- QStringList get_call_words();
-
- QStringList get_sfx_list();
-
- //Appends the argument string to serverlist.txt
- void write_to_serverlist_txt(QString p_line);
-
- //Writes to note file
- void write_note(QString p_text, QString filename);
-
- //appends to note file
- void append_note(QString p_line, QString filename);
-
- //Overwrites config.ini with new theme
- void write_theme(QString theme);
-
-
- //Returns the contents of serverlist.txt
- QVector read_serverlist_txt();
-
- //Returns the value of p_identifier in the design.ini file in p_design_path
- QString read_design_ini(QString p_identifier, QString p_design_path);
-
- //Helper function for returning an int in a file inside of the theme folder
- int get_design_ini_value(QString p_identifier, QString p_design_file);
-
- //Returns the coordinates of widget with p_identifier from p_file
- QPoint get_button_spacing(QString p_identifier, QString p_file);
-
- //Returns the dimensions of widget with specified identifier from p_file
- pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
-
- //Returns the value of font_size with p_identifier from p_file
- int get_font_size(QString p_identifier, QString p_file);
-
- //Returns the name of the font with p_identifier from p_file
- QString get_font_name(QString p_identifier, QString p_file);
-
- //Returns the color with p_identifier from p_file
- QColor get_color(QString p_identifier, QString p_file);
-
- //Returns the sfx with p_identifier from sounds.ini in the current theme path
- QString get_sfx(QString p_identifier);
-
- //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, QString terminator_tag);
-
- //Returns the text between target_tag and terminator_tag in p_file
- QString get_stylesheet(QString target_tag, QString p_file);
-
- //Returns string list (characters, color) from p_file
- QVector get_highlight_color();
-
- //Returns special button on cc_config according to index
- QString get_spbutton(QString p_tag, int index);
-
- //Returns effect on cc_config according to index
- QStringList get_effect(int index);
-
- //Returns wtce on cc_config according to index
- QStringList get_wtce(int index);
-
- //Returns the side of the p_char character from that characters ini file
- QString get_char_side(QString p_char);
-
- //Returns the showname from the ini of p_char
- QString get_showname(QString p_char);
-
- //Returns showname from showname.ini
- QString read_showname(QString p_char);
-
- //Returns the value of chat from the specific p_char's ini file
- QString get_chat(QString p_char);
-
- //Returns the value of shouts from the specified p_char's ini file
- QString get_char_shouts(QString p_char);
-
- //Returns the preanim duration of p_char's p_emote
- int get_preanim_duration(QString p_char, QString p_emote);
-
- //Same as above, but only returns if it has a % in front(refer to Preanims section in the manual)
- int get_ao2_preanim_duration(QString p_char, QString p_emote);
-
- //Not in use
- int get_text_delay(QString p_char, QString p_emote);
-
- //Returns the name of p_char
- QString get_char_name(QString p_char);
-
- //Returns the total amount of emotes of p_char
- int get_emote_number(QString p_char);
-
- //Returns the emote comment of p_char's p_emote
- QString get_emote_comment(QString p_char, int p_emote);
-
- //Returns the base name of p_char's p_emote
- QString get_emote(QString p_char, int p_emote);
-
- //Returns the preanimation name of p_char's p_emote
- QString get_pre_emote(QString p_char, int p_emote);
-
- //Returns x,y offset for effect p_effect
- QStringList get_effect_offset(QString p_char, int p_effect);
-
- //Returns overlay at p_effect in char_path/overlay
- QStringList get_overlay(QString p_char, int p_effect);
-
- //Returns the sfx of p_char's p_emote
- QString get_sfx_name(QString p_char, int p_emote);
-
- //Not in use
- int get_sfx_delay(QString p_char, int p_emote);
-
- //Returns the modifier for p_char's p_emote
- int get_emote_mod(QString p_char, int p_emote);
-
- //Returns the desk modifier for p_char's p_emote
- int get_desk_mod(QString p_char, int p_emote);
-
- //Returns p_char's gender
- QString get_gender(QString p_char);
-
-private:
- const int RELEASE = 2;
- const int MAJOR_VERSION = 4;
- const int MINOR_VERSION = 8;
-
- QString current_theme = "default";
-
- QVector server_list;
- QVector favorite_list;
-
-private slots:
- void ms_connect_finished(bool connected, bool will_retry);
-
-public slots:
- void server_disconnected();
- void loading_cancelled();
-};
-
-#endif // AOAPPLICATION_H
diff --git a/aobasshandle.cpp b/aobasshandle.cpp
deleted file mode 100644
index 468d3c524..000000000
--- a/aobasshandle.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-#include "aobasshandle.hpp"
-
-AOBassHandle::AOBassHandle(QObject *p_parent)
- : QObject(p_parent)
-{}
-
-AOBassHandle::AOBassHandle(QString p_file, bool p_suicide, QObject *p_parent) noexcept(false)
- : QObject(p_parent)
-{
- set_file(p_file, p_suicide);
-}
-
-AOBassHandle::~AOBassHandle()
-{
- if (m_handle && m_sync)
- {
- BASS_ChannelRemoveSync(m_handle, m_sync);
- }
-
- // nothing will go wrong if the handle isn't initialized, I promise...!
- if (m_handle)
- {
- BASS_StreamFree(m_handle);
- }
-}
-
-void AOBassHandle::suicide()
-{
- // safety first
- disconnect();
-
- // suicide note
- emit body_discovery();
-
- delete this;
-}
-
-QString AOBassHandle::get_file()
-{
- return m_file;
-}
-
-void AOBassHandle::set_file(QString p_file, bool p_suicide) noexcept(false)
-{
- if (m_handle)
- return; // already created
-
- m_file = p_file;
-
- // create a handle based on the file
- m_handle = BASS_StreamCreateFile(FALSE, m_file.utf16(), 0, 0, BASS_UNICODE|BASS_ASYNCFILE);
- if (!m_handle)
- throw AOException(QString("%1 could not be initialized to play").arg(p_file));
-
- m_sync = BASS_ChannelSetSync(m_handle, BASS_SYNC_END, 0, &AOBassHandle::static_sync, this);
- if (!m_sync)
- {
- // free stream since we can't sync
- BASS_StreamFree(m_handle);
-
- throw AOException(QString("could not set sync for %1").arg(m_file));
- }
-
- m_suicide = p_suicide;
- if (m_suicide)
- connect(this, &AOBassHandle::stopped, this, &AOBassHandle::suicide);
-}
-
-void AOBassHandle::set_volume(int p_volume)
-{
- BASS_ChannelSetAttribute(m_handle, BASS_ATTRIB_VOL, p_volume/100.0f);
-}
-
-void AOBassHandle::play()
-{
- BASS_ChannelPlay(m_handle, FALSE);
-}
-
-void AOBassHandle::stop()
-{
- BASS_ChannelStop(m_handle);
-}
-
-void CALLBACK AOBassHandle::static_sync(HSYNC handle, DWORD channel, DWORD data, void *user)
-{
- if (auto self = static_cast(user))
- {
- self->sync(data);
- }
-}
-
-void AOBassHandle::sync(DWORD data)
-{
- Q_UNUSED(data)
-
- emit stopped();
-}
diff --git a/aobasshandle.hpp b/aobasshandle.hpp
deleted file mode 100644
index 3ff50cd26..000000000
--- a/aobasshandle.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef AOBASSHANDLE_HPP
-#define AOBASSHANDLE_HPP
-
-#include
-#include
-
-#include
-
-#include "aoexception.hpp"
-
-/**
- * @brief The AOBassHandle is a small class to play sounds.
- * The class may destroy itself once the audio provided is done playing.
- */
-
-class AOBassHandle : public QObject
-{
- Q_OBJECT
-
-public:
- AOBassHandle(QObject *p_parent = nullptr);
- AOBassHandle(QString p_file, bool p_suicide, QObject *p_parent = nullptr) noexcept(false);
- ~AOBassHandle();
-
- QString get_file();
- void set_file(QString p_file, bool p_suicide = false) noexcept(false);
-
- // static
- static void CALLBACK static_sync(HSYNC handle, DWORD channel, DWORD data, void *user);
-
-public slots:
- void play();
- void stop();
-
- void set_volume(int p_volume);
-
-signals:
- void stopped();
- void body_discovery();
-
-private:
- QString m_file;
- HSTREAM m_handle = 0;
- HSYNC m_sync = 0;
- bool m_suicide = false;
-
- void sync(DWORD data);
-
-private slots:
- void suicide();
-};
-
-#endif // AOBASSHANDLE_HPP
diff --git a/aoblipplayer.cpp b/aoblipplayer.cpp
deleted file mode 100644
index 9e7d0e5d9..000000000
--- a/aoblipplayer.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "aoblipplayer.h"
-
-AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
-{
- m_parent = parent;
- ao_app = p_ao_app;
-}
-
-void AOBlipPlayer::set_blips(QString p_sfx)
-{
- QString f_path = ao_app->get_sounds_path() + p_sfx.toLower();
-
- for (int n_stream = 0 ; n_stream < BLIP_COUNT ; ++n_stream)
- {
- BASS_StreamFree(m_stream_list[n_stream]);
-
- m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
- }
-
- set_volume(m_volume);
-}
-
-void AOBlipPlayer::blip_tick()
-{
- int f_cycle = m_cycle++;
-
- if (m_cycle == BLIP_COUNT)
- m_cycle = 0;
-
- HSTREAM f_stream = m_stream_list[f_cycle];
-
- BASS_ChannelPlay(f_stream, false);
-}
-
-void AOBlipPlayer::set_volume(int p_value)
-{
- m_volume = p_value;
-
- float volume = p_value / 100.0f;
-
- for (int n_stream = 0 ; n_stream < BLIP_COUNT ; ++n_stream)
- {
- BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
- }
-}
diff --git a/aoblipplayer.h b/aoblipplayer.h
deleted file mode 100644
index 6b75ba289..000000000
--- a/aoblipplayer.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef AOBLIPPLAYER_H
-#define AOBLIPPLAYER_H
-
-#include "bass.h"
-#include "aoapplication.h"
-
-#include
-#include
-#include
-
-const int BLIP_COUNT = 5;
-
-class AOBlipPlayer
-{
-public:
- AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app);
-
- void set_blips(QString p_sfx);
- void blip_tick();
- void set_volume(int p_volume);
-
- int m_cycle = 0;
-
-private:
- QWidget *m_parent;
- AOApplication *ao_app;
-
- int m_volume;
- HSTREAM m_stream_list[BLIP_COUNT];
-};
-
-#endif // AOBLIPPLAYER_H
diff --git a/aobutton.cpp b/aobutton.cpp
deleted file mode 100644
index 6ba97caa0..000000000
--- a/aobutton.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "aobutton.h"
-
-#include "debug_functions.h"
-#include "file_functions.h"
-
-#include
-
-AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent)
-{
- ao_app = p_ao_app;
-}
-
-AOButton::~AOButton()
-{
-
-}
-
-void AOButton::set_image(QString p_image)
-{
- QString f_image_name = p_image.left(p_image.lastIndexOf(QChar('.')));
- QString image_path = ao_app->get_theme_path() + p_image;
- QString hover_image_path = ao_app->get_theme_path() + f_image_name + "_hover.png";
- QString default_image_path = ao_app->get_default_theme_path() + p_image;
-
- if (file_exists(image_path))
- {
- if(file_exists(hover_image_path))
- this->setStyleSheet("QPushButton {border-image:url(\"" + image_path + "\");}"
- "QPushButton:hover {border-image:url(\"" + hover_image_path + "\");}");
- else
- this->setStyleSheet("border-image:url(\"" + image_path + "\")");
- }
-
- else
- this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
-}
diff --git a/aocharbutton.cpp b/aocharbutton.cpp
deleted file mode 100644
index 07eca3086..000000000
--- a/aocharbutton.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "aocharbutton.h"
-
-#include "file_functions.h"
-
-#include
-
-AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos) : QPushButton(parent)
-{
- ao_app = p_ao_app;
-
- this->resize(60, 60);
- this->move(x_pos, y_pos);
-
- ui_taken = new AOImage(this, ao_app);
- ui_taken->resize(60, 60);
- ui_taken->set_image("char_taken.png");
- ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_taken->hide();
-
- ui_passworded = new AOImage(this, ao_app);
- ui_passworded->resize(60, 60);
- ui_passworded->set_image("char_passworded");
- ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_passworded->hide();
-
- ui_selector = new AOImage(parent, ao_app);
- ui_selector->resize(62, 62);
- ui_selector->move(x_pos - 1, y_pos - 1);
- ui_selector->set_image("char_selector.png");
- ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_selector->hide();
-}
-
-void AOCharButton::reset()
-{
- ui_taken->hide();
- ui_passworded->hide();
- ui_selector->hide();
-}
-
-void AOCharButton::set_taken()
-{
- ui_taken->show();
-}
-
-void AOCharButton::set_passworded()
-{
- ui_passworded->show();
-}
-
-void AOCharButton::set_image(QString p_character)
-{
- QString image_path = ao_app->get_character_path(p_character) + "char_icon.png";
- QString legacy_path = ao_app->get_demothings_path() + p_character.toLower() + "_char_icon.png";
- QString alt_path = ao_app->get_demothings_path() + p_character.toLower() + "_off.png";
-
- this->setText("");
-
- if (file_exists(image_path))
- this->setStyleSheet("border-image:url(\"" + image_path + "\")");
- else if (file_exists(legacy_path))
- {
- this->setStyleSheet("border-image:url(\"" + legacy_path + "\")");
- //ninja optimization
- QFile::copy(legacy_path, image_path);
- }
- else
- {
- this->setStyleSheet("border-image:url()");
- this->setText(p_character);
- }
-}
-
-void AOCharButton::enterEvent(QEvent * e)
-{
- ui_selector->raise();
- ui_selector->show();
-
- setFlat(false);
- QPushButton::enterEvent(e);
-}
-
-void AOCharButton::leaveEvent(QEvent * e)
-{
- ui_selector->hide();
- QPushButton::leaveEvent(e);
-}
-
-
diff --git a/aocharmovie.cpp b/aocharmovie.cpp
deleted file mode 100644
index 0c144a0ea..000000000
--- a/aocharmovie.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-#include "aocharmovie.h"
-#include "courtroom.h"
-
-#include "misc_functions.h"
-#include "file_functions.h"
-#include "aoapplication.h"
-
-#include
-#include
-
-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);
- preanim_timer->setSingleShot(true);
-
- connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
- connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done()));
-}
-
-void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix, bool show)
-{
- QStringList f_vec;
-
- QString original_path = ao_app->get_character_path(p_char) + emote_prefix + p_emote.toLower(); // .gif
- QString alt_path = ao_app->get_character_path(p_char) + p_emote.toLower(); // .png
- 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;
-
-// if (file_exists(original_path))
-// gif_path = original_path;
-// else if (file_exists(alt_path))
-// gif_path = alt_path;
-// else if (file_exists(placeholder_path))
-// gif_path = placeholder_path;
-// else
-// gif_path = placeholder_default_path;
-
- f_vec.push_back(original_path);
- f_vec.push_back(alt_path);
- f_vec.push_back(placeholder_path);
- f_vec.push_back(placeholder_default_path);
-
- for(auto &f_file : f_vec)
- {
- bool found = false;
- for (auto &ext : decltype(f_vec){".apng", ".gif", ".png"})
- {
- QString fullPath = f_file + ext;
- found = file_exists(fullPath);
- if (found)
- {
- gif_path = fullPath;
- break;
- }
- }
-
- if (found)
- break;
- }
-
- m_movie->stop();
- 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;
-
- this->show();
- if(!show) this->hide();
-
- m_movie->start();
-}
-
-void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration, bool show)
-{
- QString gif_path = ao_app->get_character_path(p_char) + p_emote.toLower();
-
- 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)
- {
- real_duration += m_movie->nextFrameDelay();
- m_movie->jumpToFrame(n_frame + 1);
- }
- qDebug() << "full_duration: " << full_duration;
- qDebug() << "real_duration: " << real_duration;
-
- double percentage_modifier = 100.0;
-
- if (real_duration != 0 && duration != 0)
- {
- double modifier = full_duration / static_cast(real_duration);
- percentage_modifier = 100 / modifier;
-
- if (percentage_modifier > 100.0)
- percentage_modifier = 100.0;
- }
- qDebug() << "% mod: " << percentage_modifier;
-
- if (full_duration == 0 || full_duration >= real_duration)
- {
- play_once = true;
- }
- else
- {
- play_once = false;
- preanim_timer->start(full_duration);
- }
-
-
- m_movie->setSpeed(static_cast(percentage_modifier));
- play(p_char, p_emote, "", show);
-}
-
-void AOCharMovie::play_talking(QString p_char, QString p_emote, bool show)
-{
- QString gif_path = ao_app->get_character_path(p_char) + "(b)" + p_emote.toLower();
-
- m_movie->stop();
- this->clear();
- m_movie->setFileName(gif_path);
-
- play_once = false;
- m_movie->setSpeed(100);
- play(p_char, p_emote, "(b)", show);
-}
-
-void AOCharMovie::play_idle(QString p_char, QString p_emote, bool show)
-{
- QString gif_path = ao_app->get_character_path(p_char) + "(a)" + p_emote.toLower();
-
- m_movie->stop();
- this->clear();
- m_movie->setFileName(gif_path);
-
- play_once = false;
- m_movie->setSpeed(100);
- play(p_char, p_emote, "(a)", show);
-}
-
-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();
- this->hide();
-}
-
-void AOCharMovie::combo_resize(int w, int h)
-{
- QSize f_size(w, h);
- this->resize(f_size);
- m_movie->setScaledSize(f_size);
-}
-
-void AOCharMovie::frame_change(int n_frame)
-{
- if (movie_frames.size() > n_frame)
- {
- QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame));
-
- this->setPixmap(f_pixmap.scaled(this->width(), this->height()));
- }
-
- 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/aocharmovie.h b/aocharmovie.h
deleted file mode 100644
index 7ceb293ea..000000000
--- a/aocharmovie.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef AOCHARMOVIE_H
-#define AOCHARMOVIE_H
-
-#include
-#include
-#include
-
-class AOApplication;
-
-class AOCharMovie : public QLabel
-{
- Q_OBJECT
-
-public:
- AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app);
-
- void play(QString p_char, QString p_emote, QString emote_prefix, bool show);
- void play_pre(QString p_char, QString p_emote, int duration, bool show);
- void play_talking(QString p_char, QString p_emote, bool show);
- void play_idle(QString p_char, QString p_emote, bool show);
-
- void set_flipped(bool p_flipped) {m_flipped = p_flipped;}
-
- void stop();
-
- void combo_resize(int w, int h);
-
-private:
- AOApplication *ao_app = nullptr;
-
- QMovie *m_movie;
- QVector movie_frames;
- QTimer *preanim_timer;
-
- const int time_mod = 62;
-
- bool m_flipped = false;
-
- bool play_once = true;
-
-signals:
- void done();
-
-private slots:
- void frame_change(int n_frame);
- void timer_done();
-};
-
-#endif // AOCHARMOVIE_H
diff --git a/aoemotebutton.cpp b/aoemotebutton.cpp
deleted file mode 100644
index 81a73d7a4..000000000
--- a/aoemotebutton.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "aoemotebutton.h"
-
-#include "file_functions.h"
-#include
-
-AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
-{
- ao_app = p_ao_app;
-
- this->move(p_x, p_y);
- this->resize(40, 40);
-
- connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
-}
-
-void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix)
-{
- QString emotion_number = QString::number(p_emote + 1);
- QString image_path = ao_app->get_character_path(p_char) + "emotions/ao2/button" + emotion_number + suffix;
- QString alt_path = ao_app->get_character_path(p_char) + "emotions/button" + emotion_number + suffix;
- QString hover_path = ao_app->get_character_path(p_char) + "emotions/hovers/button" + emotion_number + "_hover" + suffix;
-
- if (file_exists(image_path))
- {
- this->setText("");
- this->setStyleSheet("border-image:url(\"" + image_path + "\")");
- }
- else if (file_exists(alt_path))
- {
- this->setText("");
- if(file_exists(hover_path))
- {
- this->setStyleSheet("QPushButton {border-image:url(\"" + alt_path + "\");}"
- "QPushButton:hover {border-image:url(\"" + hover_path + "\");}");
- }
- else this->setStyleSheet("border-image:url(\"" + alt_path + "\")");
- }
- else
- {
- this->setText(ao_app->get_emote_comment(p_char, p_emote));
- this->setStyleSheet("border-image:url(\"\")");
- }
-}
-
-void AOEmoteButton::on_clicked()
-{
- emote_clicked(m_id);
-}
diff --git a/aoemotebutton.h b/aoemotebutton.h
deleted file mode 100644
index edc528c08..000000000
--- a/aoemotebutton.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef AOEMOTEBUTTON_H
-#define AOEMOTEBUTTON_H
-
-#include
-
-#include "aoapplication.h"
-
-class AOEmoteButton : public QPushButton
-{
- Q_OBJECT
-
-public:
- AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
-
- //void set_on(QString p_char, int p_emote);
- //void set_off(QString p_char, int p_emote);
- void set_image(QString p_char, int p_emote, QString suffix);
-
- void set_id(int p_id) {m_id = p_id;}
- int get_id() {return m_id;}
-
-private:
- AOApplication *ao_app = nullptr;
-
- int m_id = 0;
-
-signals:
- void emote_clicked(int p_id);
-
-private slots:
- void on_clicked();
-};
-
-#endif // AOEMOTEBUTTON_H
diff --git a/aoevidencebutton.cpp b/aoevidencebutton.cpp
deleted file mode 100644
index 7c8abb66d..000000000
--- a/aoevidencebutton.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-#include "aoevidencebutton.h"
-
-#include "file_functions.h"
-
-#include
-
-AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
-{
- ao_app = p_ao_app;
-
- ui_selected = new AOImage(p_parent, ao_app);
- ui_selected->resize(70, 70);
- ui_selected->move(p_x, p_y);
- ui_selected->set_image("evidence_selected.png");
- ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_selected->hide();
-
- ui_selector = new AOImage(p_parent, ao_app);
- ui_selector->resize(71, 71);
- ui_selector->move(p_x - 1, p_y - 1);
- ui_selector->set_image("evidence_selector.png");
- ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_selector->hide();
-
- this->move(p_x, p_y);
- this->resize(70, 70);
- this->setAcceptDrops(true);
-
- connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
-}
-
-void AOEvidenceButton::reset()
-{
- this->hide();
- ui_selected->hide();
- ui_selector->hide();
-}
-
-void AOEvidenceButton::set_image(QString p_image)
-{
- QString image_path = ao_app->get_evidence_path() + p_image;
-
- if (file_exists(image_path))
- {
- this->setText("");
- this->setStyleSheet("border-image:url(\"" + image_path + "\")");
- }
- else
- {
- this->setText(p_image);
- this->setStyleSheet("");
- }
-}
-
-void AOEvidenceButton::set_theme_image(QString p_image)
-{
- QString theme_image_path = ao_app->get_theme_path() + p_image;
- QString default_image_path = ao_app->get_default_theme_path() + p_image;
-
- QString final_image_path;
-
- if (file_exists(theme_image_path))
- final_image_path = theme_image_path;
- else
- final_image_path = default_image_path;
-
- this->setText("");
- this->setStyleSheet("border-image:url(\"" + final_image_path + "\")");
-}
-
-void AOEvidenceButton::set_selected(bool p_selected)
-{
- if (p_selected)
- ui_selected->show();
- else
- ui_selected->hide();
-}
-
-void AOEvidenceButton::on_clicked()
-{
- evidence_clicked(m_id);
-}
-
-void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
-{
- QPushButton::mouseDoubleClickEvent(e);
- evidence_double_clicked(m_id);
-}
-
-void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e)
-{
- //QWidget::dragLeaveEvent(e);
-
- qDebug() << "drag leave event";
-}
-
-void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
-{
- //QWidget::dragEnterEvent(e);
-
- qDebug() << "drag enter event";
-}
-
-void AOEvidenceButton::enterEvent(QEvent * e)
-{
- ui_selector->show();
-
- on_hover(m_id, true);
-
- setFlat(false);
- QPushButton::enterEvent(e);
-}
-
-void AOEvidenceButton::leaveEvent(QEvent * e)
-{
- ui_selector->hide();
-
- on_hover(m_id, false);
- QPushButton::leaveEvent(e);
-}
diff --git a/aoevidencebutton.h b/aoevidencebutton.h
deleted file mode 100644
index 8af8999d6..000000000
--- a/aoevidencebutton.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef AOEVIDENCEBUTTON_H
-#define AOEVIDENCEBUTTON_H
-
-#include "aoapplication.h"
-#include "aoimage.h"
-
-#include
-#include
-
-class AOEvidenceButton : public QPushButton
-{
- Q_OBJECT
-
-public:
- AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
-
- void reset();
- void set_image(QString p_image);
- void set_theme_image(QString p_image);
- void set_id(int p_id) {m_id = p_id;}
-
- void set_selected(bool p_selected);
-
-private:
- AOApplication *ao_app = nullptr;
-
- AOImage *ui_selected;
- AOImage *ui_selector;
-
- int m_id = 0;
-
-protected:
- void enterEvent(QEvent *e);
- void leaveEvent(QEvent *e);
- void mouseDoubleClickEvent(QMouseEvent *e);
- void dragLeaveEvent(QMouseEvent *e);
- void dragEnterEvent(QMouseEvent *e);
-
-signals:
- void evidence_clicked(int p_id);
- void evidence_double_clicked(int p_id);
- void on_hover(int p_id, bool p_state);
-
-private slots:
- void on_clicked();
-};
-
-#endif // AOEVIDENCEBUTTON_H
diff --git a/aoevidencedisplay.cpp b/aoevidencedisplay.cpp
deleted file mode 100644
index cbe37c0e5..000000000
--- a/aoevidencedisplay.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-#include
-
-#include "aoevidencedisplay.h"
-
-#include "file_functions.h"
-#include "datatypes.h"
-#include "misc_functions.h"
-
-AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
-{
- ao_app = p_ao_app;
-
- evidence_movie = new QMovie(this);
- evidence_icon = new QLabel(this);
- sfx_player = new AOSfxPlayer(this, ao_app);
-
- connect(evidence_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
-}
-
-void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_side, int p_volume)
-{
- this->reset();
-
- sfx_player->set_volume(p_volume);
-
- QString f_evidence_path = ao_app->get_evidence_path() + p_evidence_image;
-
- QPixmap f_pixmap(f_evidence_path);
-
- QString final_gif_path;
- QString gif_name;
- QString icon_identifier;
-
- if (is_left_side)
- {
- icon_identifier = "left_evidence_icon";
- gif_name = "evidence_appear_left.gif";
- }
- else
- {
- icon_identifier = "right_evidence_icon";
- gif_name = "evidence_appear_right.gif";
- }
-
- pos_size_type icon_dimensions = ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini");
-
- evidence_icon->move(icon_dimensions.x, icon_dimensions.y);
- evidence_icon->resize(icon_dimensions.width, icon_dimensions.height);
-
- evidence_icon->setPixmap(f_pixmap.scaled(evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio));
-
- QString f_default_gif_path = ao_app->get_default_theme_path() + gif_name;
- QString f_gif_path = ao_app->get_theme_path() + gif_name;
-
- if (file_exists(f_gif_path))
- final_gif_path = f_gif_path;
- else
- final_gif_path = f_default_gif_path;
-
- evidence_movie->setFileName(final_gif_path);
-
- if(evidence_movie->frameCount() < 1)
- return;
-
- this->setMovie(evidence_movie);
-
- evidence_movie->start();
- sfx_player->play(ao_app->get_sfx("evidence_present"));
-}
-
-void AOEvidenceDisplay::frame_change(int p_frame)
-{
- if (p_frame == (evidence_movie->frameCount() - 1))
- {
- //we need this or else the last frame wont show
- delay(evidence_movie->nextFrameDelay());
-
- evidence_movie->stop();
- this->clear();
-
- evidence_icon->show();
- }
-}
-
-void AOEvidenceDisplay::reset()
-{
- sfx_player->stop();
- evidence_movie->stop();
- evidence_icon->hide();
- this->clear();
-}
-
-QLabel* AOEvidenceDisplay::get_evidence_icon()
-{
- return evidence_icon;
-}
-
-
diff --git a/aoevidencedisplay.h b/aoevidencedisplay.h
deleted file mode 100644
index b90cf0678..000000000
--- a/aoevidencedisplay.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef AOEVIDENCEDISPLAY_H
-#define AOEVIDENCEDISPLAY_H
-
-#include
-#include
-
-#include "aoapplication.h"
-#include "aosfxplayer.h"
-
-class AOEvidenceDisplay : public QLabel
-{
- Q_OBJECT
-
-public:
- AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app);
-
- void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume);
- QLabel* get_evidence_icon();
- void reset();
-
-private:
- AOApplication *ao_app = nullptr;
- QMovie *evidence_movie;
- QLabel *evidence_icon;
- AOSfxPlayer *sfx_player;
-
-private slots:
- void frame_change(int p_frame);
-};
-
-#endif // AOEVIDENCEDISPLAY_H
diff --git a/aoexception.cpp b/aoexception.cpp
deleted file mode 100644
index 93618dd9f..000000000
--- a/aoexception.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "aoexception.hpp"
-
-AOException::AOException(QString p_msg)
- : m_msg(p_msg)
-{}
-
-const char *AOException::what() const noexcept
-{
- return m_msg.toStdString().c_str();
-}
diff --git a/aoexception.hpp b/aoexception.hpp
deleted file mode 100644
index de0a55d84..000000000
--- a/aoexception.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef AOEXCEPTION_HPP
-#define AOEXCEPTION_HPP
-
-#include
-
-#include
-
-class AOException : public std::exception
-{
-public:
- AOException() = default;
- AOException(QString p_msg);
- virtual ~AOException() noexcept = default;
-
- virtual const char *what() const noexcept;
-
-private:
- QString m_msg;
-};
-
-#endif // AOEXCEPTION_HPP
diff --git a/aoimage.cpp b/aoimage.cpp
deleted file mode 100644
index 03e6ebcb3..000000000
--- a/aoimage.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "file_functions.h"
-
-#include "aoimage.h"
-
-#include
-
-AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
-{
- ao_app = p_ao_app;
-}
-
-AOImage::~AOImage()
-{
-
-}
-
-void AOImage::set_image(QString p_image)
-{
- QString theme_image_path = ao_app->get_theme_path() + p_image;
- QString default_image_path = ao_app->get_default_theme_path() + p_image;
-
- QString final_image_path;
-
- if (file_exists(theme_image_path))
- final_image_path = theme_image_path;
- else
- final_image_path = default_image_path;
-
- QPixmap f_pixmap(final_image_path);
-
- this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
-}
-
-void AOImage::set_image_from_path(QString p_path)
-{
- QString default_path = ao_app->get_default_theme_path() + "chatmed.png";
-
- QString final_path;
-
- if (file_exists(p_path))
- final_path = p_path;
- else
- final_path = default_path;
-
- QPixmap f_pixmap(final_path);
-
- this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
-}
diff --git a/aoimage.h b/aoimage.h
deleted file mode 100644
index edc1efe48..000000000
--- a/aoimage.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//This class represents a static theme-dependent image
-
-#ifndef AOIMAGE_H
-#define AOIMAGE_H
-
-#include "aoapplication.h"
-
-#include
-
-class AOImage : public QLabel
-{
-public:
- AOImage(QWidget *parent, AOApplication *p_ao_app);
- ~AOImage();
-
- AOApplication *ao_app = nullptr;
-
- void set_image(QString p_image);
- void set_image_from_path(QString p_path);
- void set_size_and_pos(QString identifier);
-};
-
-#endif // AOIMAGE_H
diff --git a/aolabel.cpp b/aolabel.cpp
deleted file mode 100644
index 0e893751d..000000000
--- a/aolabel.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "aolabel.hpp"
-
-#include "file_functions.h"
-
-AOLabel::AOLabel(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
-{
- ao_app = p_ao_app;
-}
-
-void AOLabel::set_image(QString p_image)
-{
- QString image_path = ao_app->get_theme_path() + p_image;
- QString default_image_path = ao_app->get_default_theme_path() + p_image;
-
- if (file_exists(image_path))
- {
- this->setStyleSheet("border-image:url(\"" + image_path + "\")");
- }
- else
- this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
-}
diff --git a/aomovie.cpp b/aomovie.cpp
deleted file mode 100644
index 72cbb435a..000000000
--- a/aomovie.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-#include "aomovie.h"
-
-#include "file_functions.h"
-#include "courtroom.h"
-#include "misc_functions.h"
-
-AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
-{
- ao_app = p_ao_app;
-
- m_movie = new QMovie();
-
- this->setMovie(m_movie);
-
- connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
-}
-
-void AOMovie::set_play_once(bool p_play_once)
-{
- play_once = p_play_once;
-}
-
-void AOMovie::play(QString p_file, QString p_char, QString p_custom_theme)
-{
- m_movie->stop();
-
- QVector f_vec;
-
- QString file_path = "";
-
- QString custom_path;
- if (p_file == "custom")
- custom_path = ao_app->get_character_path(p_char) + p_file;
- else
- custom_path = ao_app->get_character_path(p_char) + p_file + "_bubble";
-
- f_vec.push_back(custom_path);
-
- QString overlay_path = ao_app->get_character_path(p_char) + "overlay/" + p_file;
- QString custom_theme_path = ao_app->get_base_path() + "themes/" + p_custom_theme + "/" + p_file;
- QString theme_path = ao_app->get_theme_path() + p_file;
- QString default_theme_path = ao_app->get_default_theme_path() + p_file;
- QString placeholder_path = ao_app->get_theme_path() + "placeholder";
- QString default_placeholder_path = ao_app->get_default_theme_path() + "placeholder";
-
- f_vec.push_back(overlay_path);
- f_vec.push_back(custom_theme_path);
- f_vec.push_back(theme_path);
- f_vec.push_back(default_theme_path);
- f_vec.push_back(placeholder_path);
- f_vec.push_back(default_placeholder_path);
-
- for(auto &f_file : f_vec)
- {
- bool found = false;
- for (auto &ext : decltype(f_vec){".apng", ".gif", ".png"})
- {
- QString fullPath = f_file + ext;
- found = file_exists(fullPath);
- if (found)
- {
- file_path = fullPath;
- break;
- }
- }
-
- if (found)
- break;
- }
-
- m_movie->setFileName(file_path);
-
- this->show();
- m_movie->setScaledSize(this->size());
- m_movie->start();
-}
-
-void AOMovie::stop()
-{
- m_movie->stop();
- this->hide();
-}
-
-void AOMovie::frame_change(int n_frame)
-{
- if (n_frame == (m_movie->frameCount() - 1) && play_once)
- {
- //we need this or else the last frame wont show
- delay(m_movie->nextFrameDelay());
-
- this->stop();
-
- //signal connected to courtroom object, let it figure out what to do
- emit done();
- }
-}
-
-void AOMovie::combo_resize(int w, int h)
-{
- QSize f_size(w, h);
- this->resize(f_size);
- m_movie->setScaledSize(f_size);
-}
diff --git a/aomovie.h b/aomovie.h
deleted file mode 100644
index e116b6837..000000000
--- a/aomovie.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef AOMOVIE_H
-#define AOMOVIE_H
-
-#include
-#include
-
-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_file, QString p_char = "", QString p_custom_theme = "");
- void combo_resize(int w, int h);
- void stop();
-
-private:
- QMovie *m_movie;
- AOApplication *ao_app = nullptr;
- bool play_once = true;
-
-signals:
- void done();
-
-private slots:
- void frame_change(int n_frame);
-};
-
-#endif // AOMOVIE_H
diff --git a/aomusicplayer.cpp b/aomusicplayer.cpp
deleted file mode 100644
index 47f2a26f8..000000000
--- a/aomusicplayer.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "aomusicplayer.h"
-
-#include
-
-#include
-
-AOMusicPlayer::AOMusicPlayer(QObject *p_parent, AOApplication *p_ao_app)
- : AOAbstractPlayer(p_parent, p_ao_app)
-{}
-
-void AOMusicPlayer::play(QString p_file)
-{
- QString f_file = ao_app->get_music_path(p_file);
-
- stop();
-
- m_file = f_file;
-
- try { // create new song
- AOBassHandle *handle = new AOBassHandle(m_file, false, this);
- connect(this, &AOMusicPlayer::new_volume, handle, &AOBassHandle::set_volume);
- connect(this, &AOMusicPlayer::stopping, handle, &AOBassHandle::stop);
-
- // delete previous
- if (m_handle)
- delete m_handle;
-
- m_handle = handle;
- m_handle->set_volume(get_volume());
- m_handle->play();
- } catch(const std::exception &e_exception) {
- qDebug() << e_exception.what();
- }
-}
-
-void AOMusicPlayer::stop()
-{
- emit stopping();
-}
diff --git a/aomusicplayer.h b/aomusicplayer.h
deleted file mode 100644
index ed2cc05e5..000000000
--- a/aomusicplayer.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef AOMUSICPLAYER_H
-#define AOMUSICPLAYER_H
-
-#include "aoabstractplayer.hpp"
-
-class AOMusicPlayer : public AOAbstractPlayer
-{
- Q_OBJECT
-
-public:
- AOMusicPlayer(QObject *p_parent, AOApplication *p_ao_app);
-
- void play(QString p_file);
- void stop();
-
-private:
- AOBassHandle* m_handle = nullptr;
- QString m_file;
-};
-
-#endif // AOMUSICPLAYER_H
diff --git a/aonotearea.cpp b/aonotearea.cpp
deleted file mode 100644
index 884a26a69..000000000
--- a/aonotearea.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-#include "aonotepicker.hpp"
-#include "aonotearea.hpp"
-
-#include "courtroom.h"
-
-#include
-
-AONoteArea::AONoteArea(QWidget *p_parent, AOApplication *p_ao_app) : AOImage(p_parent, p_ao_app)
-{
- ao_app = p_ao_app;
-}
-
-AONoteArea::~AONoteArea()
-{
-}
-
-void Courtroom::on_add_button_clicked()
-{
- if(ui_note_area->m_layout->count() > 6)
- return;
-
- AONotePicker *f_notepicker = new AONotePicker(ui_note_area, ao_app);
- AOButton *f_button = new AOButton(f_notepicker, ao_app);
- AOButton *f_delete = new AOButton(f_notepicker, ao_app);
- QLineEdit *f_line = new QLineEdit(f_notepicker);
- AOButton *f_hover = new AOButton(f_notepicker, ao_app);
- QHBoxLayout *f_layout = new QHBoxLayout(f_notepicker);
-
- f_notepicker->m_line = f_line;
- f_notepicker->m_button = f_button;
- f_notepicker->m_layout = f_layout;
- f_notepicker->m_delete_button = f_delete;
- f_notepicker->m_hover = f_hover;
- f_notepicker->setProperty("index", ui_note_area->m_layout->count()-1);
-
- f_button->set_image("note_edit.png");
- f_delete->set_image("note_delete.png");
- f_hover->set_image("note_select.png");
-
- f_line->setReadOnly(true);
-
- f_layout->setSizeConstraint(QLayout::SetFixedSize);
-
- f_layout->addWidget(f_hover);
- f_layout->addWidget(f_line);
- f_layout->addWidget(f_button);
- f_layout->addWidget(f_delete);
- f_notepicker->setLayout(f_layout);
- ui_note_area->m_layout->addWidget(f_notepicker);
-
- if(contains_add_button)
- {
- ui_note_area->m_layout->removeWidget(ui_note_area->add_button);
- ui_note_area->m_layout->addWidget(ui_note_area->add_button);
- set_note_files();
- }
-
- set_dropdown(f_line, "[LINE EDIT]");
-
- connect(f_button, SIGNAL(clicked(bool)), this, SLOT(on_set_file_button_clicked()));
- connect(f_delete, SIGNAL(clicked(bool)), this, SLOT(on_delete_button_clicked()));
- connect(f_hover, SIGNAL(clicked(bool)), this, SLOT(on_file_selected()));
-}
-
-void Courtroom::set_note_files()
-{
- QString filename = ao_app->get_base_path() + "configs/filesabstract.ini";
- QFile config_file(filename);
-
- if(!config_file.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- qDebug() << "Couldn't open" << filename;
- return;
- }
-
- QTextStream in(&config_file);
-
- QByteArray t = "";
-
- for(int i = 0; i < ui_note_area->m_layout->count()-1; ++i)
- {
- AONotePicker *f_notepicker = static_cast(ui_note_area->m_layout->itemAt(i)->widget());
- QString f_filestring = f_notepicker->real_file;
- QString f_filename = f_notepicker->m_line->text();
-
- t += QString::number(i) + " = " + f_filestring + " = " + f_filename + "\n\n";
- }
-
-
- config_file.close();
-
- QFile ex(filename);
- if(!ex.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
- {
- qDebug() << "Couldn't open" << filename;
- return;
- }
-
- ex.write(t);
- ex.close();
-}
diff --git a/aonotearea.hpp b/aonotearea.hpp
deleted file mode 100644
index 40a72c4e8..000000000
--- a/aonotearea.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef AONOTEAREA_HPP
-#define AONOTEAREA_HPP
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "aoapplication.h"
-
-class AONoteArea : public AOImage
-{
- Q_OBJECT
-
-public:
- AONoteArea(QWidget *p_parent, AOApplication *p_ao_app);
- ~AONoteArea();
-
- AOButton *add_button;
- QVBoxLayout *m_layout;
- AOButton *f_button;
-
-private:
- AOApplication *ao_app;
- void set_layout();
-
-};
-
-#endif // AONOTEAREA_HPP
diff --git a/aonotepad.cpp b/aonotepad.cpp
deleted file mode 100644
index 8a1297168..000000000
--- a/aonotepad.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "aonotepad.h"
-
-AONotepad::AONotepad(QWidget* p_parent, AOApplication *p_ao_app)
- : QTextEdit(p_parent), ao_app(p_ao_app)
-{}
diff --git a/aonotepad.h b/aonotepad.h
deleted file mode 100644
index de04e182f..000000000
--- a/aonotepad.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef AONOTEPAD_H
-#define AONOTEPAD_H
-
-#include
-
-#include "aoapplication.h"
-
-class AONotepad : public QTextEdit
-{
- Q_OBJECT
-
-public:
- AONotepad(QWidget* p_parent, AOApplication *p_ao_app);
-
-private:
- AOApplication *ao_app = nullptr;
-};
-
-#endif // AONOTEPAD_H
diff --git a/aonotepicker.cpp b/aonotepicker.cpp
deleted file mode 100644
index ba3585afe..000000000
--- a/aonotepicker.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "aonotepicker.hpp"
-
-#include "courtroom.h"
-
-#include
-#include
-
-AONotePicker::AONotePicker(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
-{
- ao_app = p_ao_app;
-}
-
-AONotePicker::~AONotePicker()
-{}
-
-void Courtroom::on_file_selected()
-{
- for(int i=0; i < ui_note_area->m_layout->count() -1; ++i)
- {
- AONotePicker *f_notepicker = static_cast(ui_note_area->m_layout->itemAt(i)->widget());
- f_notepicker->m_hover->set_image("note_select.png");
- }
-
- AOButton *f_button = static_cast(sender());
- AONotePicker *f_notepicker = static_cast(f_button->parent());
- current_file = f_notepicker->real_file;
- load_note();
- f_button->set_image("note_select_selected.png");
-}
-
-
-void Courtroom::on_set_file_button_clicked()
-{
- AOButton *f_button = static_cast(sender());
- AONotePicker *f_notepicker = static_cast(f_button->parent());
- QString f_filename = QFileDialog::getOpenFileName(this, "Open File");
- if(f_filename != "")
- {
- f_notepicker->m_line->setText(f_filename);
- f_notepicker->real_file = f_filename;
-
- set_note_files();
- }
-}
-
-void Courtroom::on_delete_button_clicked()
-{
- AOButton *f_button = static_cast(sender());
- AONotePicker *f_notepicker = static_cast(f_button->parent());
- ui_note_area->m_layout->removeWidget(f_notepicker);
- delete f_notepicker;
- set_note_files();
-}
diff --git a/aonotepicker.hpp b/aonotepicker.hpp
deleted file mode 100644
index cfc8881b4..000000000
--- a/aonotepicker.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef AONOTEPICKER_HPP
-#define AONOTEPICKER_HPP
-
-#include
-#include
-#include
-#include "aobutton.h"
-
-class AONotePicker : public QLabel
-{
- Q_OBJECT
-
-public:
- AONotePicker(QWidget *p_parent, AOApplication *p_ao_app);
- ~AONotePicker();
-
- QLineEdit *m_line;
- AOButton *m_button;
- AOButton *m_delete_button;
- AOButton *m_hover;
- QHBoxLayout *m_layout;
- QString real_file = "";
-
-private:
- AOApplication *ao_app;
-};
-
-#endif // AONOTEPICKER_HPP
diff --git a/aopacket.cpp b/aopacket.cpp
deleted file mode 100644
index fa8f5be11..000000000
--- a/aopacket.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "aopacket.h"
-
-#include "encryption_functions.h"
-
-#include
-
-AOPacket::AOPacket(QString p_packet_string)
-{
- QStringList packet_contents = p_packet_string.split("#");
-
- m_header = packet_contents.at(0);
-
- for(int n_string = 1 ; n_string < packet_contents.size() - 1 ; ++n_string)
- {
- m_contents.append(packet_contents.at(n_string));
- }
-}
-
-AOPacket::AOPacket(QString p_header, QStringList &p_contents)
-{
- m_header = p_header;
- m_contents = p_contents;
-}
-
-AOPacket::~AOPacket()
-{
-
-}
-
-QString AOPacket::to_string()
-{
- QString f_string = m_header;
-
- for (QString i_string : m_contents)
- {
- f_string += ("#" + i_string);
- }
-
- f_string += "#%";
-
-
- if (encrypted)
- return "#" + f_string;
- else
- return f_string;
-}
-
-void AOPacket::encrypt_header(unsigned int p_key)
-{
- m_header = fanta_encrypt(m_header, p_key);
-
- encrypted = true;
-}
-
-void AOPacket::decrypt_header(unsigned int p_key)
-{
- m_header = fanta_decrypt(m_header, p_key);
-
- encrypted = false;
-}
-
-void AOPacket::net_encode()
-{
- for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
- {
- QString f_element = m_contents.at(n_element);
- f_element.replace("#", "").replace("%", "").replace("$", "").replace("&", "");
-
- m_contents.removeAt(n_element);
- m_contents.insert(n_element, f_element);
- }
-}
-
-void AOPacket::net_decode()
-{
- for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
- {
- QString f_element = m_contents.at(n_element);
- f_element.replace("", "#").replace("", "%").replace("", "$").replace("", "&");
-
- m_contents.removeAt(n_element);
- m_contents.insert(n_element, f_element);
- }
-}
-
diff --git a/aopacket.h b/aopacket.h
deleted file mode 100644
index 40dd3ec38..000000000
--- a/aopacket.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef AOPACKET_H
-#define AOPACKET_H
-
-#include
-#include
-
-class AOPacket
-{
-public:
- AOPacket(QString p_packet_string);
- AOPacket(QString header, QStringList &p_contents);
- ~AOPacket();
-
- QString get_header() {return m_header;}
- QStringList &get_contents() {return m_contents;}
- QString to_string();
-
- void encrypt_header(unsigned int p_key);
- void decrypt_header(unsigned int p_key);
-
- void net_encode();
- void net_decode();
-
-private:
- bool encrypted = false;
-
- QString m_header;
- QStringList m_contents;
-};
-
-#endif // AOPACKET_H
diff --git a/aoscene.cpp b/aoscene.cpp
deleted file mode 100644
index d86b849b4..000000000
--- a/aoscene.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "aoscene.h"
-
-#include "courtroom.h"
-
-#include "file_functions.h"
-
-// core
-#include
-
-// gui
-#include
-
-AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
-{
- m_parent = parent;
- m_movie = new QMovie(this);
- ao_app = p_ao_app;
-}
-
-void AOScene::set_image(QString p_image)
-{
- QString animated_background_path = ao_app->get_background_path() + p_image;
- QString background_path = ao_app->get_background_path() + p_image + ".png";
- QString default_path = ao_app->get_default_background_path() + p_image;
-
- for (auto& ext : QVector{".apng", ".gif"})
- {
- QString full_path = animated_background_path + ext;
- if (file_exists(full_path))
- {
- animated_background_path = full_path;
- break;
- }
- }
-
- QPixmap animated_background(animated_background_path);
- QPixmap background(background_path);
- QPixmap default_bg(default_path);
-
- int w = this->width();
- int h = this->height();
-
- // remove movie
- this->clear();
- this->setMovie(nullptr);
- // stop current movie
- m_movie->stop();
- m_movie->setFileName(animated_background_path);
- m_movie->setScaledSize(QSize(w, h));
-
- if (m_movie->isValid())
- {
- this->setMovie(m_movie);
- m_movie->start();
- }
- else if (file_exists(background_path))
- {
- this->setPixmap(background.scaled(w, h));
- }
- else
- {
- this->setPixmap(default_bg.scaled(w, h));
- }
-}
-
-void AOScene::set_legacy_desk(QString p_image)
-{
- //vanilla desks vary in both width and height. in order to make that work with viewport rescaling,
- //some INTENSE math is needed.
-
- QString desk_path = ao_app->get_background_path() + p_image;
- QString default_path = ao_app->get_default_background_path() + p_image;
-
- QPixmap f_desk;
-
- if (file_exists(desk_path))
- f_desk.load(desk_path);
- else
- f_desk.load(default_path);
-
- int vp_width = m_parent->width();
- int vp_height = m_parent->height();
-
- //double y_modifier = 147 / 192;
- //double w_modifier = vp_width / 256;
- double h_modifier = vp_height / 192;
-
- //int final_y = y_modifier * vp_height;
- //int final_w = w_modifier * f_desk.width();
- int final_h = h_modifier * f_desk.height();
-
- //this->resize(final_w, final_h);
- //this->setPixmap(f_desk.scaled(final_w, final_h));
- this->resize(vp_width, final_h);
- this->setPixmap(f_desk.scaled(vp_width, final_h));
-}
diff --git a/aoscene.h b/aoscene.h
deleted file mode 100644
index 468b0778b..000000000
--- a/aoscene.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef AOSCENE_H
-#define AOSCENE_H
-
-#include
-
-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);
-
-private:
- QWidget* m_parent = nullptr;
- QMovie* m_movie = nullptr;
- AOApplication* ao_app = nullptr;
-
-};
-
-#endif // AOSCENE_H
diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp
deleted file mode 100644
index cd191a67e..000000000
--- a/aosfxplayer.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "aosfxplayer.h"
-
-#include
-
-#include
-
-AOSfxPlayer::AOSfxPlayer(QObject *p_parent, AOApplication *p_ao_app)
- : AOAbstractPlayer(p_parent, p_ao_app)
-{}
-
-void AOSfxPlayer::play(QString p_name)
-{
- QString f_file = ao_app->get_sounds_path() + p_name.toLower();
-
- try {
- AOBassHandle *handle = new AOBassHandle(f_file, true, this);
- connect(this, &AOSfxPlayer::new_volume, handle, &AOBassHandle::set_volume);
- connect(this, &AOSfxPlayer::stopping, handle, &AOBassHandle::stop);
- handle->set_volume(get_volume());
- handle->play();
- } catch(const std::exception &e_exception) {
- qDebug() << e_exception.what();
- }
-}
-
-void AOSfxPlayer::stop()
-{
- emit stopping();
-}
diff --git a/aosfxplayer.h b/aosfxplayer.h
deleted file mode 100644
index 57ee3aeac..000000000
--- a/aosfxplayer.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef AOSFXPLAYER_H
-#define AOSFXPLAYER_H
-
-#include "aoabstractplayer.hpp"
-
-class AOSfxPlayer : public AOAbstractPlayer
-{
- Q_OBJECT
-
-public:
- AOSfxPlayer(QObject *p_parent, AOApplication *p_ao_app);
-
- void play(QString p_file);
- void stop();
-};
-
-#endif // AOSFXPLAYER_H
diff --git a/aoshoutplayer.cpp b/aoshoutplayer.cpp
deleted file mode 100644
index c82a29ee7..000000000
--- a/aoshoutplayer.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "aoshoutplayer.hpp"
-#include "file_functions.h"
-
-#include
-
-AOShoutPlayer::AOShoutPlayer(QObject *p_parent, AOApplication *p_ao_app)
- : AOAbstractPlayer(p_parent, p_ao_app)
-{}
-
-void AOShoutPlayer::play(QString p_name, QString p_char)
-{
- QString f_file;
-
- QString char_path = ao_app->get_character_path(p_char) + p_name.toLower();
- QString theme_path = ao_app->get_theme_path() + p_name.toLower();
- QString default_theme_path = ao_app->get_default_theme_path() + p_name.toLower();
-
- qDebug() << char_path;
- qDebug() << theme_path;
- qDebug() << default_theme_path;
-
- if(file_exists(char_path))
- f_file = char_path;
- else if (file_exists(theme_path))
- f_file = theme_path;
- else if (file_exists(default_theme_path))
- f_file = default_theme_path;
- else
- f_file = "";
-
- try {
- AOBassHandle *handle = new AOBassHandle(f_file, true, this);
- connect(this, &AOShoutPlayer::new_volume, handle, &AOBassHandle::set_volume);
- connect(this, &AOShoutPlayer::stopping, handle, &AOBassHandle::stop);
- handle->set_volume(get_volume());
- handle->play();
- } catch(const std::exception &e_exception) {
- qDebug() << e_exception.what();
- }
-}
-
-void AOShoutPlayer::stop()
-{
- emit stopping();
-}
diff --git a/aoshoutplayer.hpp b/aoshoutplayer.hpp
deleted file mode 100644
index b5d7b4e22..000000000
--- a/aoshoutplayer.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef AOSHOUTPLAYER_HPP
-#define AOSHOUTPLAYER_HPP
-
-#include "aoabstractplayer.hpp"
-
-class AOShoutPlayer : public AOAbstractPlayer
-{
- Q_OBJECT
-
-public:
- AOShoutPlayer(QObject *p_parent, AOApplication *p_ao_app);
-
- void play(QString p_name, QString p_char);
- void stop();
-};
-
-#endif // AOSHOUTPLAYER_HPP
diff --git a/aotextarea.cpp b/aotextarea.cpp
deleted file mode 100644
index 40cc31480..000000000
--- a/aotextarea.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "aotextarea.h"
-
-#include
-#include
-#include
-#include
-
-AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent)
-{
-
-}
-
-void AOTextArea::append_chatmessage(QString p_name, QString p_message)
-{
- const QTextCursor old_cursor = this->textCursor();
- const int old_scrollbar_value = this->verticalScrollBar()->value();
- const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum();
-
- this->moveCursor(QTextCursor::End);
-
- this->append("");
- this->insertHtml("" + p_name.toHtmlEscaped() + ": ");
-
- //cheap workarounds ahoy
- p_message += " ";
- QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(omnis_dank_url_regex, "\\1" );
-
- this->insertHtml(result);
-
- this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);
-}
-
-void AOTextArea::append_error(QString p_message)
-{
- const QTextCursor old_cursor = this->textCursor();
- const int old_scrollbar_value = this->verticalScrollBar()->value();
- const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum();
-
- this->moveCursor(QTextCursor::End);
-
- this->append("");
-
- p_message += " ";
- QString result = p_message.replace("\n", "
").replace(omnis_dank_url_regex, "\\1" );
-
- this->insertHtml("" + result + "");
-
- this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);
-}
-
-void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value, bool is_scrolled_down)
-{
- if (old_cursor.hasSelection() || !is_scrolled_down)
- {
- // The user has selected text or scrolled away from the bottom: maintain position.
- this->setTextCursor(old_cursor);
- this->verticalScrollBar()->setValue(old_scrollbar_value);
- }
- else
- {
- // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom.
- this->moveCursor(QTextCursor::End);
- this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
- }
-}
diff --git a/aotextarea.h b/aotextarea.h
deleted file mode 100644
index 32635fdb0..000000000
--- a/aotextarea.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef AOTEXTAREA_H
-#define AOTEXTAREA_H
-
-#include
-
-class AOTextArea : public QTextBrowser
-{
-public:
- AOTextArea(QWidget *p_parent = nullptr);
-
- void append_chatmessage(QString p_name, QString p_message);
- void append_error(QString p_message);
-
-private:
- const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
-
- void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down);
-};
-
-#endif // AOTEXTAREA_H
diff --git a/aotextedit.cpp b/aotextedit.cpp
deleted file mode 100644
index 30e48b733..000000000
--- a/aotextedit.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "aotextedit.h"
-
-AOTextEdit::AOTextEdit(QWidget *parent) : QPlainTextEdit(parent)
-{
- this->setReadOnly(true);
-
- //connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed()));
-}
-
-void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
-{
- QPlainTextEdit::mouseDoubleClickEvent(e);
-
- this->setReadOnly(false);
-}
-
-void AOTextEdit::on_enter_pressed()
-{
- this->setReadOnly(true);
-}
-
diff --git a/aotextedit.h b/aotextedit.h
deleted file mode 100644
index 85909c6e1..000000000
--- a/aotextedit.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef AOTEXTEDIT_H
-#define AOTEXTEDIT_H
-
-#include
-
-class AOTextEdit : public QPlainTextEdit
-{
- Q_OBJECT
-public:
- AOTextEdit(QWidget *parent);
-
-protected:
- void mouseDoubleClickEvent(QMouseEvent *e);
-
-signals:
- void double_clicked();
-
-private slots:
- void on_enter_pressed();
-
-};
-
-#endif // AOTEXTEDIT_H
diff --git a/bass.h b/bass.h
deleted file mode 100644
index 06195de2f..000000000
--- a/bass.h
+++ /dev/null
@@ -1,1051 +0,0 @@
-/*
- BASS 2.4 C/C++ header file
- Copyright (c) 1999-2016 Un4seen Developments Ltd.
-
- See the BASS.CHM file for more detailed documentation
-*/
-
-#ifndef BASS_H
-#define BASS_H
-
-#ifdef _WIN32
-#include
-typedef unsigned __int64 QWORD;
-#else
-#include
-#define WINAPI
-#define CALLBACK
-typedef uint8_t BYTE;
-typedef uint16_t WORD;
-typedef uint32_t DWORD;
-typedef uint64_t QWORD;
-#ifndef __OBJC__
-typedef int BOOL;
-#endif
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-#define LOBYTE(a) (BYTE)(a)
-#define HIBYTE(a) (BYTE)((a)>>8)
-#define LOWORD(a) (WORD)(a)
-#define HIWORD(a) (WORD)((a)>>16)
-#define MAKEWORD(a,b) (WORD)(((a)&0xff)|((b)<<8))
-#define MAKELONG(a,b) (DWORD)(((a)&0xffff)|((b)<<16))
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BASSVERSION 0x204 // API version
-#define BASSVERSIONTEXT "2.4"
-
-#ifndef BASSDEF
-#define BASSDEF(f) WINAPI f
-#else
-#define NOBASSOVERLOADS
-#endif
-
-typedef DWORD HMUSIC; // MOD music handle
-typedef DWORD HSAMPLE; // sample handle
-typedef DWORD HCHANNEL; // playing sample's channel handle
-typedef DWORD HSTREAM; // sample stream handle
-typedef DWORD HRECORD; // recording handle
-typedef DWORD HSYNC; // synchronizer handle
-typedef DWORD HDSP; // DSP handle
-typedef DWORD HFX; // DX8 effect handle
-typedef DWORD HPLUGIN; // Plugin handle
-
-// Error codes returned by BASS_ErrorGetCode
-#define BASS_OK 0 // all is OK
-#define BASS_ERROR_MEM 1 // memory error
-#define BASS_ERROR_FILEOPEN 2 // can't open the file
-#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver
-#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost
-#define BASS_ERROR_HANDLE 5 // invalid handle
-#define BASS_ERROR_FORMAT 6 // unsupported sample format
-#define BASS_ERROR_POSITION 7 // invalid position
-#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called
-#define BASS_ERROR_START 9 // BASS_Start has not been successfully called
-#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available
-#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever
-#define BASS_ERROR_NOCHAN 18 // can't get a free channel
-#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified
-#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified
-#define BASS_ERROR_NO3D 21 // no 3D support
-#define BASS_ERROR_NOEAX 22 // no EAX support
-#define BASS_ERROR_DEVICE 23 // illegal device number
-#define BASS_ERROR_NOPLAY 24 // not playing
-#define BASS_ERROR_FREQ 25 // illegal sample rate
-#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream
-#define BASS_ERROR_NOHW 29 // no hardware voices available
-#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data
-#define BASS_ERROR_NONET 32 // no internet connection could be opened
-#define BASS_ERROR_CREATE 33 // couldn't create the file
-#define BASS_ERROR_NOFX 34 // effects are not available
-#define BASS_ERROR_NOTAVAIL 37 // requested data is not available
-#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel"
-#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed
-#define BASS_ERROR_TIMEOUT 40 // connection timedout
-#define BASS_ERROR_FILEFORM 41 // unsupported file format
-#define BASS_ERROR_SPEAKER 42 // unavailable speaker
-#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons)
-#define BASS_ERROR_CODEC 44 // codec is not available/supported
-#define BASS_ERROR_ENDED 45 // the channel/file has ended
-#define BASS_ERROR_BUSY 46 // the device is busy
-#define BASS_ERROR_UNKNOWN -1 // some other mystery problem
-
-// BASS_SetConfig options
-#define BASS_CONFIG_BUFFER 0
-#define BASS_CONFIG_UPDATEPERIOD 1
-#define BASS_CONFIG_GVOL_SAMPLE 4
-#define BASS_CONFIG_GVOL_STREAM 5
-#define BASS_CONFIG_GVOL_MUSIC 6
-#define BASS_CONFIG_CURVE_VOL 7
-#define BASS_CONFIG_CURVE_PAN 8
-#define BASS_CONFIG_FLOATDSP 9
-#define BASS_CONFIG_3DALGORITHM 10
-#define BASS_CONFIG_NET_TIMEOUT 11
-#define BASS_CONFIG_NET_BUFFER 12
-#define BASS_CONFIG_PAUSE_NOPLAY 13
-#define BASS_CONFIG_NET_PREBUF 15
-#define BASS_CONFIG_NET_PASSIVE 18
-#define BASS_CONFIG_REC_BUFFER 19
-#define BASS_CONFIG_NET_PLAYLIST 21
-#define BASS_CONFIG_MUSIC_VIRTUAL 22
-#define BASS_CONFIG_VERIFY 23
-#define BASS_CONFIG_UPDATETHREADS 24
-#define BASS_CONFIG_DEV_BUFFER 27
-#define BASS_CONFIG_VISTA_TRUEPOS 30
-#define BASS_CONFIG_IOS_MIXAUDIO 34
-#define BASS_CONFIG_DEV_DEFAULT 36
-#define BASS_CONFIG_NET_READTIMEOUT 37
-#define BASS_CONFIG_VISTA_SPEAKERS 38
-#define BASS_CONFIG_IOS_SPEAKER 39
-#define BASS_CONFIG_MF_DISABLE 40
-#define BASS_CONFIG_HANDLES 41
-#define BASS_CONFIG_UNICODE 42
-#define BASS_CONFIG_SRC 43
-#define BASS_CONFIG_SRC_SAMPLE 44
-#define BASS_CONFIG_ASYNCFILE_BUFFER 45
-#define BASS_CONFIG_OGG_PRESCAN 47
-#define BASS_CONFIG_MF_VIDEO 48
-#define BASS_CONFIG_AIRPLAY 49
-#define BASS_CONFIG_DEV_NONSTOP 50
-#define BASS_CONFIG_IOS_NOCATEGORY 51
-#define BASS_CONFIG_VERIFY_NET 52
-#define BASS_CONFIG_DEV_PERIOD 53
-#define BASS_CONFIG_FLOAT 54
-#define BASS_CONFIG_NET_SEEK 56
-
-// BASS_SetConfigPtr options
-#define BASS_CONFIG_NET_AGENT 16
-#define BASS_CONFIG_NET_PROXY 17
-#define BASS_CONFIG_IOS_NOTIFY 46
-
-// BASS_Init flags
-#define BASS_DEVICE_8BITS 1 // 8 bit
-#define BASS_DEVICE_MONO 2 // mono
-#define BASS_DEVICE_3D 4 // enable 3D functionality
-#define BASS_DEVICE_16BITS 8 // limit output to 16 bit
-#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct)
-#define BASS_DEVICE_CPSPEAKERS 0x400 // detect speakers via Windows control panel
-#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment
-#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement
-#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin
-#define BASS_DEVICE_FREQ 0x4000 // set device sample rate
-#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo
-
-// DirectSound interfaces (for use with BASS_GetDSoundObject)
-#define BASS_OBJECT_DS 1 // IDirectSound
-#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener
-
-// Device info structure
-typedef struct {
-#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
- const wchar_t *name; // description
- const wchar_t *driver; // driver
-#else
- const char *name; // description
- const char *driver; // driver
-#endif
- DWORD flags;
-} BASS_DEVICEINFO;
-
-// BASS_DEVICEINFO flags
-#define BASS_DEVICE_ENABLED 1
-#define BASS_DEVICE_DEFAULT 2
-#define BASS_DEVICE_INIT 4
-
-#define BASS_DEVICE_TYPE_MASK 0xff000000
-#define BASS_DEVICE_TYPE_NETWORK 0x01000000
-#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000
-#define BASS_DEVICE_TYPE_LINE 0x03000000
-#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000
-#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000
-#define BASS_DEVICE_TYPE_HEADSET 0x06000000
-#define BASS_DEVICE_TYPE_HANDSET 0x07000000
-#define BASS_DEVICE_TYPE_DIGITAL 0x08000000
-#define BASS_DEVICE_TYPE_SPDIF 0x09000000
-#define BASS_DEVICE_TYPE_HDMI 0x0a000000
-#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000
-
-// BASS_GetDeviceInfo flags
-#define BASS_DEVICES_AIRPLAY 0x1000000
-
-typedef struct {
- DWORD flags; // device capabilities (DSCAPS_xxx flags)
- DWORD hwsize; // size of total device hardware memory
- DWORD hwfree; // size of free device hardware memory
- DWORD freesam; // number of free sample slots in the hardware
- DWORD free3d; // number of free 3D sample slots in the hardware
- DWORD minrate; // min sample rate supported by the hardware
- DWORD maxrate; // max sample rate supported by the hardware
- BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
- DWORD minbuf; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
- DWORD dsver; // DirectSound version
- DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
- DWORD initflags; // BASS_Init "flags" parameter
- DWORD speakers; // number of speakers available
- DWORD freq; // current output rate
-} BASS_INFO;
-
-// BASS_INFO flags (from DSOUND.H)
-#define DSCAPS_CONTINUOUSRATE 0x00000010 // supports all sample rates between min/maxrate
-#define DSCAPS_EMULDRIVER 0x00000020 // device does NOT have hardware DirectSound support
-#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft
-#define DSCAPS_SECONDARYMONO 0x00000100 // mono
-#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo
-#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit
-#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit
-
-// Recording device info structure
-typedef struct {
- DWORD flags; // device capabilities (DSCCAPS_xxx flags)
- DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags)
- DWORD inputs; // number of inputs
- BOOL singlein; // TRUE = only 1 input can be set at a time
- DWORD freq; // current input rate
-} BASS_RECORDINFO;
-
-// BASS_RECORDINFO flags (from DSOUND.H)
-#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording support
-#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED // device driver has been certified by Microsoft
-
-// defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
-#ifndef WAVE_FORMAT_1M08
-#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */
-#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */
-#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */
-#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */
-#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */
-#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */
-#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */
-#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */
-#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */
-#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */
-#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */
-#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */
-#endif
-
-// Sample info structure
-typedef struct {
- DWORD freq; // default playback rate
- float volume; // default volume (0-1)
- float pan; // default pan (-1=left, 0=middle, 1=right)
- DWORD flags; // BASS_SAMPLE_xxx flags
- DWORD length; // length (in bytes)
- DWORD max; // maximum simultaneous playbacks
- DWORD origres; // original resolution bits
- DWORD chans; // number of channels
- DWORD mingap; // minimum gap (ms) between creating channels
- DWORD mode3d; // BASS_3DMODE_xxx mode
- float mindist; // minimum distance
- float maxdist; // maximum distance
- DWORD iangle; // angle of inside projection cone
- DWORD oangle; // angle of outside projection cone
- float outvol; // delta-volume outside the projection cone
- DWORD vam; // voice allocation/management flags (BASS_VAM_xxx)
- DWORD priority; // priority (0=lowest, 0xffffffff=highest)
-} BASS_SAMPLE;
-
-#define BASS_SAMPLE_8BITS 1 // 8 bit
-#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point
-#define BASS_SAMPLE_MONO 2 // mono
-#define BASS_SAMPLE_LOOP 4 // looped
-#define BASS_SAMPLE_3D 8 // 3D functionality
-#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing
-#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only)
-#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management
-#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects
-#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume
-#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing
-#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only)
-
-#define BASS_STREAM_PRESCAN 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1)
-#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN
-#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends
-#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams
-#define BASS_STREAM_BLOCK 0x100000 // download/play internet file stream in small blocks
-#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode (BASS_ChannelGetData)
-#define BASS_STREAM_STATUS 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC
-
-#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT
-#define BASS_MUSIC_MONO BASS_SAMPLE_MONO
-#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP
-#define BASS_MUSIC_3D BASS_SAMPLE_3D
-#define BASS_MUSIC_FX BASS_SAMPLE_FX
-#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE
-#define BASS_MUSIC_DECODE BASS_STREAM_DECODE
-#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length
-#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN
-#define BASS_MUSIC_RAMP 0x200 // normal ramping
-#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping
-#define BASS_MUSIC_SURROUND 0x800 // surround sound
-#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2)
-#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files
-#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does
-#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does
-#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing
-#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing
-#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position
-#define BASS_MUSIC_POSRESETEX 0x400000 // stop all notes and reset bmp/etc when moving position
-#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect
-#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples
-
-// Speaker assignment flags
-#define BASS_SPEAKER_FRONT 0x1000000 // front speakers
-#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers
-#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1)
-#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1)
-#define BASS_SPEAKER_N(n) ((n)<<24) // n'th pair of speakers (max 15)
-#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left
-#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right
-#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT
-#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT
-#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT
-#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT
-#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT
-#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT
-#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT
-#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT
-
-#define BASS_ASYNCFILE 0x40000000
-#define BASS_UNICODE 0x80000000
-
-#define BASS_RECORD_PAUSE 0x8000 // start recording paused
-#define BASS_RECORD_ECHOCANCEL 0x2000
-#define BASS_RECORD_AGC 0x4000
-
-// DX7 voice allocation & management flags
-#define BASS_VAM_HARDWARE 1
-#define BASS_VAM_SOFTWARE 2
-#define BASS_VAM_TERM_TIME 4
-#define BASS_VAM_TERM_DIST 8
-#define BASS_VAM_TERM_PRIO 16
-
-// Channel info structure
-typedef struct {
- DWORD freq; // default playback rate
- DWORD chans; // channels
- DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
- DWORD ctype; // type of channel
- DWORD origres; // original resolution
- HPLUGIN plugin; // plugin
- HSAMPLE sample; // sample
- const char *filename; // filename
-} BASS_CHANNELINFO;
-
-// BASS_CHANNELINFO types
-#define BASS_CTYPE_SAMPLE 1
-#define BASS_CTYPE_RECORD 2
-#define BASS_CTYPE_STREAM 0x10000
-#define BASS_CTYPE_STREAM_OGG 0x10002
-#define BASS_CTYPE_STREAM_MP1 0x10003
-#define BASS_CTYPE_STREAM_MP2 0x10004
-#define BASS_CTYPE_STREAM_MP3 0x10005
-#define BASS_CTYPE_STREAM_AIFF 0x10006
-#define BASS_CTYPE_STREAM_CA 0x10007
-#define BASS_CTYPE_STREAM_MF 0x10008
-#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec
-#define BASS_CTYPE_STREAM_WAV_PCM 0x50001
-#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003
-#define BASS_CTYPE_MUSIC_MOD 0x20000
-#define BASS_CTYPE_MUSIC_MTM 0x20001
-#define BASS_CTYPE_MUSIC_S3M 0x20002
-#define BASS_CTYPE_MUSIC_XM 0x20003
-#define BASS_CTYPE_MUSIC_IT 0x20004
-#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag
-
-typedef struct {
- DWORD ctype; // channel type
-#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
- const wchar_t *name; // format description
- const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...)
-#else
- const char *name; // format description
- const char *exts; // file extension filter (*.ext1;*.ext2;etc...)
-#endif
-} BASS_PLUGINFORM;
-
-typedef struct {
- DWORD version; // version (same form as BASS_GetVersion)
- DWORD formatc; // number of formats
- const BASS_PLUGINFORM *formats; // the array of formats
-} BASS_PLUGININFO;
-
-// 3D vector (for 3D positions/velocities/orientations)
-typedef struct BASS_3DVECTOR {
-#ifdef __cplusplus
- BASS_3DVECTOR() {};
- BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {};
-#endif
- float x; // +=right, -=left
- float y; // +=up, -=down
- float z; // +=front, -=behind
-} BASS_3DVECTOR;
-
-// 3D channel modes
-#define BASS_3DMODE_NORMAL 0 // normal 3D processing
-#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener
-#define BASS_3DMODE_OFF 2 // no 3D processing
-
-// software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM)
-#define BASS_3DALG_DEFAULT 0
-#define BASS_3DALG_OFF 1
-#define BASS_3DALG_FULL 2
-#define BASS_3DALG_LIGHT 3
-
-// EAX environments, use with BASS_SetEAXParameters
-enum
-{
- EAX_ENVIRONMENT_GENERIC,
- EAX_ENVIRONMENT_PADDEDCELL,
- EAX_ENVIRONMENT_ROOM,
- EAX_ENVIRONMENT_BATHROOM,
- EAX_ENVIRONMENT_LIVINGROOM,
- EAX_ENVIRONMENT_STONEROOM,
- EAX_ENVIRONMENT_AUDITORIUM,
- EAX_ENVIRONMENT_CONCERTHALL,
- EAX_ENVIRONMENT_CAVE,
- EAX_ENVIRONMENT_ARENA,
- EAX_ENVIRONMENT_HANGAR,
- EAX_ENVIRONMENT_CARPETEDHALLWAY,
- EAX_ENVIRONMENT_HALLWAY,
- EAX_ENVIRONMENT_STONECORRIDOR,
- EAX_ENVIRONMENT_ALLEY,
- EAX_ENVIRONMENT_FOREST,
- EAX_ENVIRONMENT_CITY,
- EAX_ENVIRONMENT_MOUNTAINS,
- EAX_ENVIRONMENT_QUARRY,
- EAX_ENVIRONMENT_PLAIN,
- EAX_ENVIRONMENT_PARKINGLOT,
- EAX_ENVIRONMENT_SEWERPIPE,
- EAX_ENVIRONMENT_UNDERWATER,
- EAX_ENVIRONMENT_DRUGGED,
- EAX_ENVIRONMENT_DIZZY,
- EAX_ENVIRONMENT_PSYCHOTIC,
-
- EAX_ENVIRONMENT_COUNT // total number of environments
-};
-
-// EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx)
-#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F
-#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F
-#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F
-#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F
-#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F
-#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F
-#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F
-#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F
-#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F
-#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F
-#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F
-#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F
-#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F
-#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F
-#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F
-#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F
-#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F
-#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F
-#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F
-#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F
-#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F
-#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F
-#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F
-#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F
-#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F
-#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F
-
-typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *user);
-/* User stream callback function. NOTE: A stream function should obviously be as quick
-as possible, other streams (and MOD musics) can't be mixed until it's finished.
-handle : The stream that needs writing
-buffer : Buffer to write the samples in
-length : Number of bytes to write
-user : The 'user' parameter value given when calling BASS_StreamCreate
-RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end
- the stream. */
-
-#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag
-
-// special STREAMPROCs
-#define STREAMPROC_DUMMY (STREAMPROC*)0 // "dummy" stream
-#define STREAMPROC_PUSH (STREAMPROC*)-1 // push stream
-
-// BASS_StreamCreateFileUser file systems
-#define STREAMFILE_NOBUFFER 0
-#define STREAMFILE_BUFFER 1
-#define STREAMFILE_BUFFERPUSH 2
-
-// User file stream callback functions
-typedef void (CALLBACK FILECLOSEPROC)(void *user);
-typedef QWORD (CALLBACK FILELENPROC)(void *user);
-typedef DWORD (CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user);
-typedef BOOL (CALLBACK FILESEEKPROC)(QWORD offset, void *user);
-
-typedef struct {
- FILECLOSEPROC *close;
- FILELENPROC *length;
- FILEREADPROC *read;
- FILESEEKPROC *seek;
-} BASS_FILEPROCS;
-
-// BASS_StreamPutFileData options
-#define BASS_FILEDATA_END 0 // end & close the file
-
-// BASS_StreamGetFilePosition modes
-#define BASS_FILEPOS_CURRENT 0
-#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT
-#define BASS_FILEPOS_DOWNLOAD 1
-#define BASS_FILEPOS_END 2
-#define BASS_FILEPOS_START 3
-#define BASS_FILEPOS_CONNECTED 4
-#define BASS_FILEPOS_BUFFER 5
-#define BASS_FILEPOS_SOCKET 6
-#define BASS_FILEPOS_ASYNCBUF 7
-#define BASS_FILEPOS_SIZE 8
-
-typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user);
-/* Internet stream download callback function.
-buffer : Buffer containing the downloaded data... NULL=end of download
-length : Number of bytes in the buffer
-user : The 'user' parameter value given when calling BASS_StreamCreateURL */
-
-// BASS_ChannelSetSync types
-#define BASS_SYNC_POS 0
-#define BASS_SYNC_END 2
-#define BASS_SYNC_META 4
-#define BASS_SYNC_SLIDE 5
-#define BASS_SYNC_STALL 6
-#define BASS_SYNC_DOWNLOAD 7
-#define BASS_SYNC_FREE 8
-#define BASS_SYNC_SETPOS 11
-#define BASS_SYNC_MUSICPOS 10
-#define BASS_SYNC_MUSICINST 1
-#define BASS_SYNC_MUSICFX 3
-#define BASS_SYNC_OGG_CHANGE 12
-#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime
-#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously
-
-typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user);
-/* Sync callback function. NOTE: a sync callback function should be very
-quick as other syncs can't be processed until it has finished. If the sync
-is a "mixtime" sync, then other streams and MOD musics can't be mixed until
-it's finished either.
-handle : The sync that has occured
-channel: Channel that the sync occured in
-data : Additional data associated with the sync's occurance
-user : The 'user' parameter given when calling BASS_ChannelSetSync */
-
-typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user);
-/* DSP callback function. NOTE: A DSP function should obviously be as quick as
-possible... other DSP functions, streams and MOD musics can not be processed
-until it's finished.
-handle : The DSP handle
-channel: Channel that the DSP is being applied to
-buffer : Buffer to apply the DSP to
-length : Number of bytes in the buffer
-user : The 'user' parameter given when calling BASS_ChannelSetDSP */
-
-typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *user);
-/* Recording callback function.
-handle : The recording handle
-buffer : Buffer containing the recorded sample data
-length : Number of bytes
-user : The 'user' parameter value given when calling BASS_RecordStart
-RETURN : TRUE = continue recording, FALSE = stop */
-
-// BASS_ChannelIsActive return values
-#define BASS_ACTIVE_STOPPED 0
-#define BASS_ACTIVE_PLAYING 1
-#define BASS_ACTIVE_STALLED 2
-#define BASS_ACTIVE_PAUSED 3
-
-// Channel attributes
-#define BASS_ATTRIB_FREQ 1
-#define BASS_ATTRIB_VOL 2
-#define BASS_ATTRIB_PAN 3
-#define BASS_ATTRIB_EAXMIX 4
-#define BASS_ATTRIB_NOBUFFER 5
-#define BASS_ATTRIB_VBR 6
-#define BASS_ATTRIB_CPU 7
-#define BASS_ATTRIB_SRC 8
-#define BASS_ATTRIB_NET_RESUME 9
-#define BASS_ATTRIB_SCANINFO 10
-#define BASS_ATTRIB_NORAMP 11
-#define BASS_ATTRIB_BITRATE 12
-#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100
-#define BASS_ATTRIB_MUSIC_PANSEP 0x101
-#define BASS_ATTRIB_MUSIC_PSCALER 0x102
-#define BASS_ATTRIB_MUSIC_BPM 0x103
-#define BASS_ATTRIB_MUSIC_SPEED 0x104
-#define BASS_ATTRIB_MUSIC_VOL_GLOBAL 0x105
-#define BASS_ATTRIB_MUSIC_ACTIVE 0x106
-#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel #
-#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument #
-
-// BASS_ChannelGetData flags
-#define BASS_DATA_AVAILABLE 0 // query how much data is buffered
-#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data
-#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data
-#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT
-#define BASS_DATA_FFT512 0x80000001 // 512 FFT
-#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT
-#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT
-#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT
-#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT
-#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT
-#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT
-#define BASS_DATA_FFT_INDIVIDUAL 0x10 // FFT flag: FFT for each channel, else all combined
-#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window
-#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias
-#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data
-
-// BASS_ChannelGetLevelEx flags
-#define BASS_LEVEL_MONO 1
-#define BASS_LEVEL_STEREO 2
-#define BASS_LEVEL_RMS 4
-
-// BASS_ChannelGetTags types : what's returned
-#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure
-#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block
-#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings
-#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings
-#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings
-#define BASS_TAG_META 5 // ICY metadata : ANSI string
-#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings
-#define BASS_TAG_MP4 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings
-#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings
-#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string
-#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string
-#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure
-#define BASS_TAG_MF 13 // Media Foundation tags : series of null-terminated UTF-8 strings
-#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure
-#define BASS_TAG_RIFF_INFO 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings
-#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure
-#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure
-#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string
-#define BASS_TAG_APE_BINARY 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure
-#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string
-#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string
-#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers
-#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string
-#define BASS_TAG_MUSIC_INST 0x10100 // + instrument #, MOD instrument name : ANSI string
-#define BASS_TAG_MUSIC_SAMPLE 0x10300 // + sample #, MOD sample name : ANSI string
-
-// ID3v1 tag structure
-typedef struct {
- char id[3];
- char title[30];
- char artist[30];
- char album[30];
- char year[4];
- char comment[30];
- BYTE genre;
-} TAG_ID3;
-
-// Binary APE tag structure
-typedef struct {
- const char *key;
- const void *data;
- DWORD length;
-} TAG_APE_BINARY;
-
-// BWF "bext" tag structure
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4200)
-#endif
-#pragma pack(push,1)
-typedef struct {
- char Description[256]; // description
- char Originator[32]; // name of the originator
- char OriginatorReference[32]; // reference of the originator
- char OriginationDate[10]; // date of creation (yyyy-mm-dd)
- char OriginationTime[8]; // time of creation (hh-mm-ss)
- QWORD TimeReference; // first sample count since midnight (little-endian)
- WORD Version; // BWF version (little-endian)
- BYTE UMID[64]; // SMPTE UMID
- BYTE Reserved[190];
-#if defined(__GNUC__) && __GNUC__<3
- char CodingHistory[0]; // history
-#elif 1 // change to 0 if compiler fails the following line
- char CodingHistory[]; // history
-#else
- char CodingHistory[1]; // history
-#endif
-} TAG_BEXT;
-#pragma pack(pop)
-
-// BWF "cart" tag structures
-typedef struct
-{
- DWORD dwUsage; // FOURCC timer usage ID
- DWORD dwValue; // timer value in samples from head
-} TAG_CART_TIMER;
-
-typedef struct
-{
- char Version[4]; // version of the data structure
- char Title[64]; // title of cart audio sequence
- char Artist[64]; // artist or creator name
- char CutID[64]; // cut number identification
- char ClientID[64]; // client identification
- char Category[64]; // category ID, PSA, NEWS, etc
- char Classification[64]; // classification or auxiliary key
- char OutCue[64]; // out cue text
- char StartDate[10]; // yyyy-mm-dd
- char StartTime[8]; // hh:mm:ss
- char EndDate[10]; // yyyy-mm-dd
- char EndTime[8]; // hh:mm:ss
- char ProducerAppID[64]; // name of vendor or application
- char ProducerAppVersion[64]; // version of producer application
- char UserDef[64]; // user defined text
- DWORD dwLevelReference; // sample value for 0 dB reference
- TAG_CART_TIMER PostTimer[8]; // 8 time markers after head
- char Reserved[276];
- char URL[1024]; // uniform resource locator
-#if defined(__GNUC__) && __GNUC__<3
- char TagText[0]; // free form text for scripts or tags
-#elif 1 // change to 0 if compiler fails the following line
- char TagText[]; // free form text for scripts or tags
-#else
- char TagText[1]; // free form text for scripts or tags
-#endif
-} TAG_CART;
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-// CoreAudio codec info structure
-typedef struct {
- DWORD ftype; // file format
- DWORD atype; // audio format
- const char *name; // description
-} TAG_CA_CODEC;
-
-#ifndef _WAVEFORMATEX_
-#define _WAVEFORMATEX_
-#pragma pack(push,1)
-typedef struct tWAVEFORMATEX
-{
- WORD wFormatTag;
- WORD nChannels;
- DWORD nSamplesPerSec;
- DWORD nAvgBytesPerSec;
- WORD nBlockAlign;
- WORD wBitsPerSample;
- WORD cbSize;
-} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX;
-typedef const WAVEFORMATEX *LPCWAVEFORMATEX;
-#pragma pack(pop)
-#endif
-
-// BASS_ChannelGetLength/GetPosition/SetPosition modes
-#define BASS_POS_BYTE 0 // byte position
-#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row)
-#define BASS_POS_OGG 3 // OGG bitstream number
-#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position
-#define BASS_POS_DECODE 0x10000000 // flag: get the decoding (not playing) position
-#define BASS_POS_DECODETO 0x20000000 // flag: decode to the position instead of seeking
-#define BASS_POS_SCAN 0x40000000 // flag: scan to the position
-
-// BASS_RecordSetInput flags
-#define BASS_INPUT_OFF 0x10000
-#define BASS_INPUT_ON 0x20000
-
-#define BASS_INPUT_TYPE_MASK 0xff000000
-#define BASS_INPUT_TYPE_UNDEF 0x00000000
-#define BASS_INPUT_TYPE_DIGITAL 0x01000000
-#define BASS_INPUT_TYPE_LINE 0x02000000
-#define BASS_INPUT_TYPE_MIC 0x03000000
-#define BASS_INPUT_TYPE_SYNTH 0x04000000
-#define BASS_INPUT_TYPE_CD 0x05000000
-#define BASS_INPUT_TYPE_PHONE 0x06000000
-#define BASS_INPUT_TYPE_SPEAKER 0x07000000
-#define BASS_INPUT_TYPE_WAVE 0x08000000
-#define BASS_INPUT_TYPE_AUX 0x09000000
-#define BASS_INPUT_TYPE_ANALOG 0x0a000000
-
-// DX8 effect types, use with BASS_ChannelSetFX
-enum
-{
- BASS_FX_DX8_CHORUS,
- BASS_FX_DX8_COMPRESSOR,
- BASS_FX_DX8_DISTORTION,
- BASS_FX_DX8_ECHO,
- BASS_FX_DX8_FLANGER,
- BASS_FX_DX8_GARGLE,
- BASS_FX_DX8_I3DL2REVERB,
- BASS_FX_DX8_PARAMEQ,
- BASS_FX_DX8_REVERB
-};
-
-typedef struct {
- float fWetDryMix;
- float fDepth;
- float fFeedback;
- float fFrequency;
- DWORD lWaveform; // 0=triangle, 1=sine
- float fDelay;
- DWORD lPhase; // BASS_DX8_PHASE_xxx
-} BASS_DX8_CHORUS;
-
-typedef struct {
- float fGain;
- float fAttack;
- float fRelease;
- float fThreshold;
- float fRatio;
- float fPredelay;
-} BASS_DX8_COMPRESSOR;
-
-typedef struct {
- float fGain;
- float fEdge;
- float fPostEQCenterFrequency;
- float fPostEQBandwidth;
- float fPreLowpassCutoff;
-} BASS_DX8_DISTORTION;
-
-typedef struct {
- float fWetDryMix;
- float fFeedback;
- float fLeftDelay;
- float fRightDelay;
- BOOL lPanDelay;
-} BASS_DX8_ECHO;
-
-typedef struct {
- float fWetDryMix;
- float fDepth;
- float fFeedback;
- float fFrequency;
- DWORD lWaveform; // 0=triangle, 1=sine
- float fDelay;
- DWORD lPhase; // BASS_DX8_PHASE_xxx
-} BASS_DX8_FLANGER;
-
-typedef struct {
- DWORD dwRateHz; // Rate of modulation in hz
- DWORD dwWaveShape; // 0=triangle, 1=square
-} BASS_DX8_GARGLE;
-
-typedef struct {
- int lRoom; // [-10000, 0] default: -1000 mB
- int lRoomHF; // [-10000, 0] default: 0 mB
- float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0
- float flDecayTime; // [0.1, 20.0] default: 1.49s
- float flDecayHFRatio; // [0.1, 2.0] default: 0.83
- int lReflections; // [-10000, 1000] default: -2602 mB
- float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s
- int lReverb; // [-10000, 2000] default: 200 mB
- float flReverbDelay; // [0.0, 0.1] default: 0.011 s
- float flDiffusion; // [0.0, 100.0] default: 100.0 %
- float flDensity; // [0.0, 100.0] default: 100.0 %
- float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz
-} BASS_DX8_I3DL2REVERB;
-
-typedef struct {
- float fCenter;
- float fBandwidth;
- float fGain;
-} BASS_DX8_PARAMEQ;
-
-typedef struct {
- float fInGain; // [-96.0,0.0] default: 0.0 dB
- float fReverbMix; // [-96.0,0.0] default: 0.0 db
- float fReverbTime; // [0.001,3000.0] default: 1000.0 ms
- float fHighFreqRTRatio; // [0.001,0.999] default: 0.001
-} BASS_DX8_REVERB;
-
-#define BASS_DX8_PHASE_NEG_180 0
-#define BASS_DX8_PHASE_NEG_90 1
-#define BASS_DX8_PHASE_ZERO 2
-#define BASS_DX8_PHASE_90 3
-#define BASS_DX8_PHASE_180 4
-
-typedef void (CALLBACK IOSNOTIFYPROC)(DWORD status);
-/* iOS notification callback function.
-status : The notification (BASS_IOSNOTIFY_xxx) */
-
-#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started
-#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended
-
-BOOL BASSDEF(BASS_SetConfig)(DWORD option, DWORD value);
-DWORD BASSDEF(BASS_GetConfig)(DWORD option);
-BOOL BASSDEF(BASS_SetConfigPtr)(DWORD option, const void *value);
-void *BASSDEF(BASS_GetConfigPtr)(DWORD option);
-DWORD BASSDEF(BASS_GetVersion)();
-int BASSDEF(BASS_ErrorGetCode)();
-BOOL BASSDEF(BASS_GetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info);
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
-BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win, const GUID *dsguid);
-#else
-BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, void *dsguid);
-#endif
-BOOL BASSDEF(BASS_SetDevice)(DWORD device);
-DWORD BASSDEF(BASS_GetDevice)();
-BOOL BASSDEF(BASS_Free)();
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
-void *BASSDEF(BASS_GetDSoundObject)(DWORD object);
-#endif
-BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info);
-BOOL BASSDEF(BASS_Update)(DWORD length);
-float BASSDEF(BASS_GetCPU)();
-BOOL BASSDEF(BASS_Start)();
-BOOL BASSDEF(BASS_Stop)();
-BOOL BASSDEF(BASS_Pause)();
-BOOL BASSDEF(BASS_SetVolume)(float volume);
-float BASSDEF(BASS_GetVolume)();
-
-HPLUGIN BASSDEF(BASS_PluginLoad)(const char *file, DWORD flags);
-BOOL BASSDEF(BASS_PluginFree)(HPLUGIN handle);
-const BASS_PLUGININFO *BASSDEF(BASS_PluginGetInfo)(HPLUGIN handle);
-
-BOOL BASSDEF(BASS_Set3DFactors)(float distf, float rollf, float doppf);
-BOOL BASSDEF(BASS_Get3DFactors)(float *distf, float *rollf, float *doppf);
-BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos, const BASS_3DVECTOR *vel, const BASS_3DVECTOR *front, const BASS_3DVECTOR *top);
-BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top);
-void BASSDEF(BASS_Apply3D)();
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
-BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, float damp);
-BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, float *damp);
-#endif
-
-HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD flags, DWORD freq);
-BOOL BASSDEF(BASS_MusicFree)(HMUSIC handle);
-
-HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD max, DWORD flags);
-HSAMPLE BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD chans, DWORD max, DWORD flags);
-BOOL BASSDEF(BASS_SampleFree)(HSAMPLE handle);
-BOOL BASSDEF(BASS_SampleSetData)(HSAMPLE handle, const void *buffer);
-BOOL BASSDEF(BASS_SampleGetData)(HSAMPLE handle, void *buffer);
-BOOL BASSDEF(BASS_SampleGetInfo)(HSAMPLE handle, BASS_SAMPLE *info);
-BOOL BASSDEF(BASS_SampleSetInfo)(HSAMPLE handle, const BASS_SAMPLE *info);
-HCHANNEL BASSDEF(BASS_SampleGetChannel)(HSAMPLE handle, BOOL onlynew);
-DWORD BASSDEF(BASS_SampleGetChannels)(HSAMPLE handle, HCHANNEL *channels);
-BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle);
-
-HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, STREAMPROC *proc, void *user);
-HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags);
-HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user);
-HSTREAM BASSDEF(BASS_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *proc, void *user);
-BOOL BASSDEF(BASS_StreamFree)(HSTREAM handle);
-QWORD BASSDEF(BASS_StreamGetFilePosition)(HSTREAM handle, DWORD mode);
-DWORD BASSDEF(BASS_StreamPutData)(HSTREAM handle, const void *buffer, DWORD length);
-DWORD BASSDEF(BASS_StreamPutFileData)(HSTREAM handle, const void *buffer, DWORD length);
-
-BOOL BASSDEF(BASS_RecordGetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info);
-BOOL BASSDEF(BASS_RecordInit)(int device);
-BOOL BASSDEF(BASS_RecordSetDevice)(DWORD device);
-DWORD BASSDEF(BASS_RecordGetDevice)();
-BOOL BASSDEF(BASS_RecordFree)();
-BOOL BASSDEF(BASS_RecordGetInfo)(BASS_RECORDINFO *info);
-const char *BASSDEF(BASS_RecordGetInputName)(int input);
-BOOL BASSDEF(BASS_RecordSetInput)(int input, DWORD flags, float volume);
-DWORD BASSDEF(BASS_RecordGetInput)(int input, float *volume);
-HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, RECORDPROC *proc, void *user);
-
-double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos);
-QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos);
-DWORD BASSDEF(BASS_ChannelGetDevice)(DWORD handle);
-BOOL BASSDEF(BASS_ChannelSetDevice)(DWORD handle, DWORD device);
-DWORD BASSDEF(BASS_ChannelIsActive)(DWORD handle);
-BOOL BASSDEF(BASS_ChannelGetInfo)(DWORD handle, BASS_CHANNELINFO *info);
-const char *BASSDEF(BASS_ChannelGetTags)(DWORD handle, DWORD tags);
-DWORD BASSDEF(BASS_ChannelFlags)(DWORD handle, DWORD flags, DWORD mask);
-BOOL BASSDEF(BASS_ChannelUpdate)(DWORD handle, DWORD length);
-BOOL BASSDEF(BASS_ChannelLock)(DWORD handle, BOOL lock);
-BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart);
-BOOL BASSDEF(BASS_ChannelStop)(DWORD handle);
-BOOL BASSDEF(BASS_ChannelPause)(DWORD handle);
-BOOL BASSDEF(BASS_ChannelSetAttribute)(DWORD handle, DWORD attrib, float value);
-BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, float *value);
-BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, float value, DWORD time);
-BOOL BASSDEF(BASS_ChannelIsSliding)(DWORD handle, DWORD attrib);
-BOOL BASSDEF(BASS_ChannelSetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size);
-DWORD BASSDEF(BASS_ChannelGetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size);
-BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol);
-BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, float *outvol);
-BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, const BASS_3DVECTOR *orient, const BASS_3DVECTOR *vel);
-BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
-QWORD BASSDEF(BASS_ChannelGetLength)(DWORD handle, DWORD mode);
-BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos, DWORD mode);
-QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle, DWORD mode);
-DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle);
-BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, DWORD flags);
-DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length);
-HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user);
-BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync);
-HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, int priority);
-BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp);
-BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan);
-BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan);
-HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD type, int priority);
-BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx);
-
-BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, const void *params);
-BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *params);
-BOOL BASSDEF(BASS_FXReset)(HFX handle);
-BOOL BASSDEF(BASS_FXSetPriority)(HFX handle, int priority);
-
-#ifdef __cplusplus
-}
-
-#if defined(_WIN32) && !defined(NOBASSOVERLOADS)
-static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags)
-{
- return BASS_PluginLoad((const char*)file, flags|BASS_UNICODE);
-}
-
-static inline HMUSIC BASS_MusicLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD flags, DWORD freq)
-{
- return BASS_MusicLoad(mem, (const void*)file, offset, length, flags|BASS_UNICODE, freq);
-}
-
-static inline HSAMPLE BASS_SampleLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD max, DWORD flags)
-{
- return BASS_SampleLoad(mem, (const void*)file, offset, length, max, flags|BASS_UNICODE);
-}
-
-static inline HSTREAM BASS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags)
-{
- return BASS_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE);
-}
-
-static inline HSTREAM BASS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user)
-{
- return BASS_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user);
-}
-
-static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value)
-{
- return BASS_SetConfigPtr(option|BASS_UNICODE, (const void*)value);
-}
-#endif
-#endif
-
-#endif
diff --git a/charselect.cpp b/charselect.cpp
deleted file mode 100644
index 4e4bccbf3..000000000
--- a/charselect.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-#include "courtroom.h"
-
-#include "file_functions.h"
-#include "debug_functions.h"
-#include "hardware_functions.h"
-
-#include
-
-void Courtroom::construct_char_select()
-{
- ui_char_select_background = new AOImage(this, ao_app);
-
- ui_char_buttons = new QWidget(ui_char_select_background);
-
- ui_selector = new AOImage(ui_char_select_background, ao_app);
- ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
- ui_selector->resize(62, 62);
-
- ui_back_to_lobby = new AOButton(ui_char_select_background, ao_app);
-
- ui_char_password = new QLineEdit(ui_char_select_background);
-
- ui_char_select_left = new AOButton(ui_char_select_background, ao_app);
- ui_char_select_right = new AOButton(ui_char_select_background, ao_app);
-
- ui_spectator = new AOButton(ui_char_select_background, ao_app);
- ui_spectator->setText("Spectator");
-
- QPoint f_spacing = ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini");
-
- const int button_width = 60;
- int x_spacing = f_spacing.x();
- int x_mod_count = 0;
-
- const int button_height = 60;
- int y_spacing = f_spacing.y();
- int y_mod_count = 0;
-
- set_size_and_pos(ui_char_buttons, "char_buttons");
-
- char_columns = ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) + 1;
- char_rows = ((ui_char_buttons->height() - button_height) / (y_spacing + button_height)) + 1;
-
- max_chars_on_page = char_columns * char_rows;
-
- for (int n = 0 ; n < max_chars_on_page ; ++n)
- {
- int x_pos = (button_width + x_spacing) * x_mod_count;
- int y_pos = (button_height + y_spacing) * y_mod_count;
-
- ui_char_button_list.append(new AOCharButton(ui_char_buttons, ao_app, x_pos, y_pos));
-
- connect(ui_char_button_list.at(n), SIGNAL(clicked()), char_button_mapper, SLOT(map())) ;
- char_button_mapper->setMapping (ui_char_button_list.at(n), n) ;
-
- ++x_mod_count;
-
- if (x_mod_count == char_columns)
- {
- ++y_mod_count;
- x_mod_count = 0;
- }
- }
-
- connect (char_button_mapper, SIGNAL(mapped(int)), this, SLOT(char_clicked(int)));
- connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
-
- connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked()));
- connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked()));
-
- connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked()));
-}
-
-void Courtroom::set_char_select()
-{
- QString filename = "courtroom_design.ini";
-
- pos_size_type f_charselect = ao_app->get_element_dimensions("char_select", filename);
-
- if (f_charselect.width < 0 || f_charselect.height < 0)
- {
- qDebug() << "W: did not find courtroom width or height in courtroom_design.ini!";
- this->resize(714, 668);
- }
- else
- this->resize(f_charselect.width, f_charselect.height);
-
- ui_char_select_background->resize(f_charselect.width, f_charselect.height);
- ui_char_select_background->set_image("charselect_background.png");
-}
-
-void Courtroom::set_char_select_page()
-{
- ui_char_select_background->show();
-
- ui_char_select_left->hide();
- ui_char_select_right->hide();
-
- for (AOCharButton *i_button : ui_char_button_list)
- i_button->hide();
-
- int total_pages = char_list.size() / max_chars_on_page;
- int chars_on_page = 0;
-
- if (char_list.size() % max_chars_on_page != 0)
- {
- ++total_pages;
- //i. e. not on the last page
- if (total_pages > current_char_page + 1)
- chars_on_page = max_chars_on_page;
- else
- chars_on_page = char_list.size() % max_chars_on_page;
-
- }
- else
- chars_on_page = max_chars_on_page;
-
- if (total_pages > current_char_page + 1)
- ui_char_select_right->show();
-
- if (current_char_page > 0)
- ui_char_select_left->show();
-
- for (int n_button = 0 ; n_button < chars_on_page ; ++n_button)
- {
- int n_real_char = n_button + current_char_page * max_chars_on_page;
- AOCharButton *f_button = ui_char_button_list.at(n_button);
-
- f_button->reset();
- f_button->set_image(char_list.at(n_real_char).name);
- f_button->show();
-
- if (char_list.at(n_real_char).taken)
- f_button->set_taken();
- }
-
-}
-
-void Courtroom::char_clicked(int n_char)
-{
- int n_real_char = n_char + current_char_page * max_chars_on_page;
-
- QString char_ini_path = ao_app->get_character_path(char_list.at(n_real_char).name) + "char.ini";
- qDebug() << "char_ini_path" << char_ini_path;
-
- if (!file_exists(char_ini_path))
- {
- qDebug() << "did not find " << char_ini_path;
- call_notice("Could not find " + char_ini_path);
- return;
- }
-
- if (n_real_char == m_cid)
- {
- enter_courtroom(m_cid);
- }
- else
- {
- ao_app->send_server_packet(new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" + QString::number(n_real_char) + "#" + get_hdid() + "#%"));
- }
-}
-
diff --git a/courtroom.cpp b/courtroom.cpp
deleted file mode 100644
index 25f8ccfbd..000000000
--- a/courtroom.cpp
+++ /dev/null
@@ -1,3556 +0,0 @@
-#include "courtroom.h"
-
-#include "aoapplication.h"
-#include "lobby.h"
-#include "hardware_functions.h"
-#include "file_functions.h"
-#include "datatypes.h"
-#include "debug_functions.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
-{
- ao_app = p_ao_app;
-
- //initializing sound device
- BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL);
- BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
-
- keepalive_timer = new QTimer(this);
- keepalive_timer->start(60000);
-
- chat_tick_timer = new QTimer(this);
-
- text_delay_timer = new QTimer(this);
- text_delay_timer->setSingleShot(true);
-
- sfx_delay_timer = new QTimer(this);
- sfx_delay_timer->setSingleShot(true);
-
- realization_timer = new QTimer(this);
- realization_timer->setSingleShot(true);
-
- testimony_show_timer = new QTimer(this);
- testimony_show_timer->setSingleShot(true);
-
- testimony_hide_timer = new QTimer(this);
- testimony_hide_timer->setSingleShot(true);
-
- char_button_mapper = new QSignalMapper(this);
-
- m_blip_player = new AOBlipPlayer(this, ao_app);
- m_blip_player->set_volume(0);
- m_sfx_player = new AOSfxPlayer(this, ao_app);
- m_sfx_player->set_volume(0);
- m_shout_player = new AOShoutPlayer(this, ao_app);
- m_shout_player->set_volume(0);
- m_mod_player = new AOSfxPlayer(this, ao_app);
- m_mod_player->set_volume(50);
- m_cycle_player = new AOSfxPlayer(this, ao_app);
- m_cycle_player->set_volume(0);
- m_music_player = new AOMusicPlayer(this, ao_app);
- m_music_player->set_volume(0);
-
- ui_background = new AOImage(this, ao_app);
-
- ui_viewport = new QWidget(this);
- ui_vp_background = new AOScene(ui_viewport, ao_app);
- 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_desk = new AOScene(ui_viewport, ao_app);
- ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app);
-
- ui_vp_music_display_a = new AOImage(this, ao_app);
- ui_vp_music_display_b = new AOImage(this, ao_app);
- ui_vp_music_area = new QWidget(ui_vp_music_display_a);
- ui_vp_music_name = new QTextEdit(ui_vp_music_area);
- ui_vp_music_name->setText("DANGANRONPA ONLINE");
- ui_vp_music_name->setFrameStyle(QFrame::NoFrame);
- ui_vp_music_name->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui_vp_music_name->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui_vp_music_name->setReadOnly(true);
- music_anim = new QPropertyAnimation(ui_vp_music_name, "geometry", this);
-
- ui_vp_clock = new AOMovie(this, ao_app);
- ui_vp_clock->set_play_once(true);
-
- ui_vp_evidence_display = new AOEvidenceDisplay(this, ao_app);
-
- ui_vp_chatbox = new AOImage(this, ao_app);
- ui_vp_showname = new QLabel(ui_vp_chatbox);
- ui_vp_message = new QTextEdit(ui_vp_chatbox);
- ui_vp_message->setFrameStyle(QFrame::NoFrame);
- ui_vp_message->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui_vp_message->setReadOnly(true);
-
- ui_vp_showname_image = new AOImage(this, ao_app);
-
- ui_vp_testimony = new AOImage(this, ao_app);
- ui_vp_effect = new AOMovie(this, ao_app);
- ui_vp_wtce = new AOMovie(this, ao_app);
- ui_vp_objection = new AOMovie(this, ao_app);
-
- ui_ic_chatlog = new QTextEdit(this);
- ui_ic_chatlog->setReadOnly(true);
-
- ui_ms_chatlog = new AOTextArea(this);
- ui_ms_chatlog->setReadOnly(true);
- ui_ms_chatlog->setOpenExternalLinks(true);
- ui_ms_chatlog->hide();
-
- ui_server_chatlog = new AOTextArea(this);
- ui_server_chatlog->setReadOnly(true);
- ui_server_chatlog->setOpenExternalLinks(true);
-
- ui_mute_list = new QListWidget(this);
- ui_area_list = new QListWidget(this);
- ui_music_list = new QListWidget(this);
- ui_sfx_list = new QListWidget(this);
-
- ui_ic_chat_message = new QLineEdit(this);
- ui_ic_chat_message->setFrame(false);
-
- ui_muted = new AOImage(ui_ic_chat_message, ao_app);
- ui_muted->hide();
-
- ui_ooc_chat_message = new QLineEdit(this);
- ui_ooc_chat_message->setFrame(false);
-
- ui_ooc_chat_name = new QLineEdit(this);
- ui_ooc_chat_name->setFrame(false);
- ui_ooc_chat_name->setPlaceholderText("Name");
-
- //ui_area_password = new QLineEdit(this);
- //ui_area_password->setFrame(false);
- ui_music_search = new QLineEdit(this);
- ui_music_search->setFrame(false);
-
- ui_sfx_search = new QLineEdit(this);
- ui_sfx_search->setFrame(false);
-
- ui_note_area = new AONoteArea(this, ao_app);
- ui_note_area->add_button = new AOButton(ui_note_area, ao_app);
- ui_note_area->m_layout = new QVBoxLayout(ui_note_area);
- note_scroll_area = new QScrollArea(this);
-
- note_scroll_area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
- note_scroll_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- note_scroll_area->setWidgetResizable(false);
-
- ui_set_notes = new AOButton(this, ao_app);
-
- construct_emotes();
-
- ui_emote_left = new AOButton(this, ao_app);
- ui_emote_right = new AOButton(this, ao_app);
-
- ui_emote_dropdown = new QComboBox(this);
- ui_pos_dropdown = new QComboBox(this);
- ui_pos_dropdown->addItem("wit");
- ui_pos_dropdown->addItem("def");
- ui_pos_dropdown->addItem("pro");
- ui_pos_dropdown->addItem("jud");
- ui_pos_dropdown->addItem("hld");
- ui_pos_dropdown->addItem("hlp");
-
- ui_defense_bar = new AOImage(this, ao_app);
- ui_prosecution_bar = new AOImage(this, ao_app);
-
- ui_music_label = new AOLabel(this, ao_app);
- ui_sfx_label = new AOLabel(this, ao_app);
- ui_blip_label = new AOLabel(this, ao_app);
-
-
- int shout_number = ao_app->get_design_ini_value("shout_number", cc_config_ini);
- shouts_enabled.resize(shout_number);
- ui_shouts.resize(shout_number);
-
- for(int i = 0; i < ui_shouts.size(); ++i)
- {
- ui_shouts[i] = new AOButton(this, ao_app);
- ui_shouts[i]->setProperty("shout_id", i+1);
- }
-
- ui_shout_up = new AOButton(this, ao_app);
- ui_shout_up->setProperty("cycle_id", 1);
- ui_shout_down = new AOButton(this, ao_app);
- ui_shout_down->setProperty("cycle_id", 0);
-
- ui_ooc_toggle = new AOButton(this, ao_app);
-
- ui_change_character = new AOButton(this, ao_app);
- ui_reload_theme = new AOButton(this, ao_app);
- ui_call_mod = new AOButton(this, ao_app);
- ui_switch_area_music = new AOButton(this, ao_app);
-
- ui_theme_list = new QComboBox(this);
- ui_confirm_theme = new AOButton(this, ao_app);
- ui_note_button = new AOButton(this, ao_app);
-
- ui_label_images.resize(7);
- for(int i = 0; i < ui_label_images.size(); ++i)
- {
- ui_label_images[i] = new AOImage(this, ao_app);
- }
-
- ui_pre = new QCheckBox(this);
- ui_pre->setText("Pre");
- ui_flip = new QCheckBox(this);
- ui_flip->setText("Flip");
- ui_flip->hide();
- ui_guard = new QCheckBox(this);
- ui_guard->setText("Guard");
- ui_guard->hide();
- ui_hidden = new QCheckBox(this);
- ui_hidden->setText("Hidden");
-
- // filling vectors with existing label/checkbox pointers
- ui_checks.push_back(ui_pre);
- ui_checks.push_back(ui_flip);
- ui_checks.push_back(ui_guard);
- ui_checks.push_back(ui_hidden);
- ui_labels.push_back(ui_music_label);
- ui_labels.push_back(ui_sfx_label);
- ui_labels.push_back(ui_blip_label);
- //
-
- int effect_number = ao_app->get_design_ini_value("effect_number", cc_config_ini);
- effects_enabled.resize(effect_number);
- ui_effects.resize(effect_number);
- for(int i = 0; i < ui_effects.size(); ++i)
- {
- ui_effects[i] = new AOButton(this, ao_app);
- ui_effects[i]->setProperty("effect_id", i+1);
- }
-
- ui_effect_down = new AOButton(this, ao_app);
- ui_effect_down->setProperty("cycle_id", 2);
- ui_effect_up = new AOButton(this, ao_app);
- ui_effect_up->setProperty("cycle_id", 3);
-
- int wtce_number = ao_app->get_design_ini_value("wtce_number", cc_config_ini);
- wtce_enabled.resize(wtce_number);
- ui_wtce.resize(wtce_number);
-
- for(int i = 0; i < ui_wtce.size(); ++i)
- {
- ui_wtce[i] = new AOButton(this, ao_app);
- ui_wtce[i]->setProperty("wtce_id", i+1);
- }
-
- ui_wtce_up = new AOButton(this, ao_app);
- ui_wtce_up->setProperty("cycle_id", 5);
- ui_wtce_down = new AOButton(this, ao_app);
- ui_wtce_down->setProperty("cycle_id", 4);
-
- ui_mute = new AOButton(this, ao_app);
-
- ui_defense_plus = new AOButton(this, ao_app);
- ui_defense_minus = new AOButton(this, ao_app);
-
- ui_prosecution_plus = new AOButton(this, ao_app);
- ui_prosecution_minus = new AOButton(this, ao_app);
-
- ui_text_color = new QComboBox(this);
- ui_text_color->addItem("White");
- ui_text_color->addItem("Green");
- ui_text_color->addItem("Red");
- ui_text_color->addItem("Orange");
- ui_text_color->addItem("Blue");
- if (ao_app->yellow_text_enabled)
- ui_text_color->addItem("Yellow");
-
- ui_music_slider = new QSlider(Qt::Horizontal, this);
- ui_music_slider->setRange(0, 100);
- ui_music_slider->setValue(ao_app->get_default_music());
-
- ui_sfx_slider = new QSlider(Qt::Horizontal, this);
- ui_sfx_slider->setRange(0, 100);
- ui_sfx_slider->setValue(ao_app->get_default_sfx());
-
- ui_blip_slider = new QSlider(Qt::Horizontal, this);
- ui_blip_slider->setRange(0, 100);
- ui_blip_slider->setValue(ao_app->get_default_blip());
-
- ui_evidence_button = new AOButton(this, ao_app);
-
- ui_vp_notepad_image = new AOImage(this, ao_app);
- ui_vp_notepad = new QTextEdit(this);
- ui_vp_notepad->setFrameStyle(QFrame::NoFrame);
-
- construct_evidence();
-
- construct_char_select();
-
- connect(keepalive_timer, SIGNAL(timeout()), this, SLOT(ping_server()));
-
- connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done()));
- connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done()));
-
- connect(text_delay_timer, SIGNAL(timeout()), this, SLOT(start_chat_ticking()));
- connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx()));
-
- connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick()));
-
- connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done()));
-
- connect(testimony_show_timer, SIGNAL(timeout()), this, SLOT(hide_testimony()));
- connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony()));
-
- connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked()));
- connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked()));
-
- connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int)));
- connect(ui_pos_dropdown, SIGNAL(activated(int)), this, SLOT(on_pos_dropdown_changed(int)));
-
- connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex)));
-
- connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed()));
-
- connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed()));
-
- connect(ui_music_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_music_list_clicked()));
- connect(ui_area_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_area_list_clicked()));
- connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_music_list_double_clicked(QModelIndex)));
- connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_area_list_double_clicked(QModelIndex)));
-
- for(auto & shout : ui_shouts)
- connect(shout, SIGNAL(clicked(bool)), this, SLOT(on_shout_clicked()));
-
- connect(ui_shout_up, SIGNAL(clicked(bool)), this, SLOT(on_cycle_clicked()));
- connect(ui_shout_down, SIGNAL(clicked(bool)), this, SLOT(on_cycle_clicked()));
-
- for(auto & effect : ui_effects)
- connect(effect, SIGNAL(clicked(bool)), this, SLOT(on_effect_button_clicked()));
-
- connect(ui_effect_up, SIGNAL(clicked(bool)), this, SLOT(on_cycle_clicked()));
- connect(ui_effect_down, SIGNAL(clicked(bool)), this, SLOT(on_cycle_clicked()));
-
- for(auto & wtce : ui_wtce)
- connect(wtce, SIGNAL(clicked(bool)), this, SLOT(on_wtce_clicked()));
-
- connect(ui_wtce_up, SIGNAL(clicked(bool)), this, SLOT(on_cycle_clicked()));
- connect(ui_wtce_down, SIGNAL(clicked(bool)), this, SLOT(on_cycle_clicked()));
-
- connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked()));
-
- connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked()));
- connect(ui_defense_plus, SIGNAL(clicked()), this, SLOT(on_defense_plus_clicked()));
- connect(ui_prosecution_minus, SIGNAL(clicked()), this, SLOT(on_prosecution_minus_clicked()));
- connect(ui_prosecution_plus, SIGNAL(clicked()), this, SLOT(on_prosecution_plus_clicked()));
-
- connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this, SLOT(on_text_color_changed(int)));
-
- connect(ui_music_slider, SIGNAL(valueChanged(int)), this, SLOT(on_music_slider_moved(int)));
- connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this, SLOT(on_sfx_slider_moved(int)));
- connect(ui_blip_slider, SIGNAL(valueChanged(int)), this, SLOT(on_blip_slider_moved(int)));
-
- connect(ui_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked()));
-
- connect(ui_music_search, SIGNAL(textChanged(QString)), this, SLOT(on_music_search_edited(QString)));
- connect(ui_sfx_search, SIGNAL(textChanged(QString)), this, SLOT(on_sfx_search_edited(QString)));
-
- connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked()));
- connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked()));
- connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked()));
-
- connect(ui_switch_area_music, SIGNAL(clicked()), this, SLOT(on_switch_area_music_clicked()));
-
- connect(ui_confirm_theme, SIGNAL(clicked()), this, SLOT(on_confirm_theme_clicked()));
- connect(ui_note_button, SIGNAL(clicked()), this, SLOT(on_note_button_clicked()));
-
- connect(ui_vp_notepad, SIGNAL(textChanged()), this, SLOT(on_note_text_changed()));
-
- connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked()));
- connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked()));
- connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked()));
-
- connect(ui_hidden, SIGNAL(clicked()), this, SLOT(on_hidden_clicked()));
-
- connect(ui_sfx_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_sfx_list_clicked()));
-
- connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked()));
-
- connect(ui_note_area->add_button, SIGNAL(clicked(bool)), this, SLOT(on_add_button_clicked()));
- connect(ui_set_notes, SIGNAL(clicked(bool)), this, SLOT(on_set_notes_clicked()));
- set_widgets();
-
- set_bullets();
-
- set_char_select();
-}
-
-void Courtroom::set_mute_list()
-{
- mute_map.clear();
-
- //maps which characters are muted based on cid, none are muted by default
- for (int n_cid = 0 ; n_cid < char_list.size() ; n_cid++)
- {
- mute_map.insert(n_cid, false);
- }
-
- QStringList sorted_mute_list;
-
- for (char_type i_char : char_list)
- sorted_mute_list.append(i_char.name);
-
- sorted_mute_list.sort();
-
- for (QString i_name : sorted_mute_list)
- {
- //mute_map.insert(i_name, false);
- ui_mute_list->addItem(i_name);
- }
-}
-
-void Courtroom::set_widgets()
-{
- blip_rate = ao_app->read_blip_rate();
- blank_blip = ao_app->get_blank_blip();
-
- QString filename = design_ini;
- pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename);
-
- if (f_courtroom.width < 0 || f_courtroom.height < 0)
- {
- qDebug() << "W: did not find courtroom width or height in " << filename;
-
- this->resize(714, 668);
- }
- else
- {
- m_courtroom_width = f_courtroom.width;
- m_courtroom_height = f_courtroom.height;
-
- this->resize(f_courtroom.width, f_courtroom.height);
- }
-
- shout_names.clear();
- for(int i = 1; i <= ui_shouts.size(); ++i)
- {
- QString name = ao_app->get_spbutton("[SHOUTS]", i);
- if(!name.isEmpty())
- shout_names.append(name.trimmed());
- }
-
- effect_names.clear();
- for(int i = 1; i <= ui_effects.size(); ++i)
- {
- QStringList names = ao_app->get_effect(i);
- if(!names.isEmpty())
- effect_names.append(names.at(0).trimmed());
- }
-
- wtce_names.clear();
- for(int i = 1; i <= ui_wtce.size(); ++i)
- {
- QString name = ao_app->get_spbutton("[WTCE]", i);
- if(!name.isEmpty())
- wtce_names.append(name.trimmed());
- }
-
- set_fonts();
-
- ui_background->move(0, 0);
- ui_background->resize(m_courtroom_width, m_courtroom_height);
- ui_background->set_image("courtroombackground.png");
-
- set_size_and_pos(ui_viewport, "viewport");
-
- ui_vp_background->move(0, 0);
- ui_vp_background->resize(ui_viewport->width(), ui_viewport->height());
-
- ui_vp_speedlines->move(0, 0);
- ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height());
-
- ui_vp_player_char->move(0, 0);
- ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height());
-
- //the AO2 desk element
- ui_vp_desk->move(0, 0);
- ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height());
-
- //the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene()
-
- double y_modifier = 147.0 / 192.0;
- int final_y = static_cast(y_modifier * ui_viewport->height());
- ui_vp_legacy_desk->move(0, final_y);
- ui_vp_legacy_desk->hide();
-
- ui_vp_evidence_display->move(0, 0);
- ui_vp_evidence_display->resize(ui_viewport->width(), ui_viewport->height());
-
- set_size_and_pos(ui_vp_notepad_image, "notepad_image");
- ui_vp_notepad_image->set_image("notepad_image.png");
- ui_vp_notepad_image->hide();
-
- set_size_and_pos(ui_vp_notepad, "notepad");
- ui_vp_notepad->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui_vp_notepad->verticalScrollBar()->hide();
- ui_vp_notepad->verticalScrollBar()->resize(0, 0);
- ui_vp_notepad->hide();
-
- set_size_and_pos(ui_vp_showname, "showname");
-
- set_size_and_pos(ui_vp_showname_image, "showname_image");
- ui_vp_showname_image->hide();
-
- set_size_and_pos(ui_vp_message, "message");
- ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction);
- ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: white");
-
- ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y());
- ui_vp_testimony->resize(ui_viewport->width(), ui_viewport->height());
- ui_vp_testimony->set_image("testimony.png");
- ui_vp_testimony->hide();
-
- ui_vp_effect->move(ui_viewport->x(), ui_viewport->y());
- ui_vp_effect->resize(ui_viewport->width(), ui_viewport->height());
- ui_vp_effect->hide();
-
- ui_vp_wtce->move(ui_viewport->x(), ui_viewport->y());
- ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height());
-
- ui_vp_objection->move(ui_viewport->x(), ui_viewport->y());
- ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height());
-
- set_size_and_pos(ui_ic_chatlog, "ic_chatlog");
-
- set_size_and_pos(ui_ms_chatlog, "ms_chatlog");
-
- set_size_and_pos(ui_server_chatlog, "server_chatlog");
-
- set_size_and_pos(ui_mute_list, "mute_list");
- ui_mute_list->hide();
-
- set_size_and_pos(ui_area_list, "area_list");
- ui_area_list->hide();
-// ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
-
- set_size_and_pos(ui_music_list, "music_list");
-
- set_size_and_pos(ui_sfx_list, "sfx_list");
-
- if (is_ao2_bg)
- {
- set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message");
- set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
- }
- else
- {
- set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
- set_size_and_pos(ui_vp_chatbox, "chatbox");
- }
-
- set_size_and_pos(ui_vp_music_area, "music_area");
- ui_vp_music_area->show();
- set_size_and_pos(ui_vp_music_name, "music_name");
-
- set_size_and_pos(ui_vp_music_display_a, "music_display_a");
- ui_vp_music_display_a->set_image("music_display_a.png");
- ui_vp_music_display_a->show();
-
- set_size_and_pos(ui_vp_music_display_b, "music_display_b");
- ui_vp_music_display_b->set_image("music_display_b.png");
- ui_vp_music_display_b->show();
-
- set_size_and_pos(ui_vp_clock, "clock");
- ui_vp_clock->show();
-
- ui_ic_chat_message->setStyleSheet("QLineEdit{background-color: rgba(100, 100, 100, 255);}");
-
- ui_vp_chatbox->set_image("chatmed.png");
- ui_vp_chatbox->hide();
-
- ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height());
- ui_muted->set_image("muted.png");
-
- set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message");
- ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
-
- set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name");
- ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
-
- //set_size_and_pos(ui_area_password, "area_password");
- set_size_and_pos(ui_music_search, "music_search");
-
- set_size_and_pos(ui_sfx_search, "sfx_search");
-
- set_size_and_pos(ui_emotes, "emotes");
-
- set_size_and_pos(ui_emote_left, "emote_left");
- ui_emote_left->set_image("arrow_left.png");
-
- set_size_and_pos(ui_emote_right, "emote_right");
- ui_emote_right->set_image("arrow_right.png");
-
- set_size_and_pos(ui_emote_dropdown, "emote_dropdown");
-
- set_size_and_pos(ui_pos_dropdown, "pos_dropdown");
-
- set_size_and_pos(ui_defense_bar, "defense_bar");
- ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) + ".png");
-
- set_size_and_pos(ui_prosecution_bar, "prosecution_bar");
- ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state) + ".png");
-
- set_size_and_pos(ui_music_label, "music_label");
- ui_music_label->setText("Music");
- set_size_and_pos(ui_sfx_label, "sfx_label");
- ui_sfx_label->setText("Sfx");
- set_size_and_pos(ui_blip_label, "blip_label");
- ui_blip_label->setText("Blips");
-
-// set_size_and_pos(ui_shouts[0], "hold_it");
-// ui_shouts[0]->show();
-// set_size_and_pos(ui_shouts[1], "objection");
-// ui_shouts[1]->show();
-// set_size_and_pos(ui_shouts[2], "take_that");
-// ui_shouts[2]->show();
-// set_size_and_pos(ui_shouts[3], "custom_objection");
-// set_size_and_pos(ui_shouts[4], "got_it");
-// set_size_and_pos(ui_shouts[5], "cross_swords");
-// set_size_and_pos(ui_shouts[6], "counter_alt");
- for(int i = 0; i < shout_names.size(); ++i)
- {
- set_size_and_pos(ui_shouts[i], shout_names[i]);
- }
-// ui_shouts[0]->show();
-// ui_shouts[1]->show();
-// ui_shouts[2]->show();
- reset_shout_buttons();
-
- set_size_and_pos(ui_shout_up, "shout_up");
- ui_shout_up->set_image("shoutup.png");
- ui_shout_up->hide();
- set_size_and_pos(ui_shout_down, "shout_down");
- ui_shout_down->set_image("shoutdown.png");
- ui_shout_down->hide();
-
- if (ao_app->read_design_ini( "enable_single_shout", ao_app->get_theme_path() + cc_config_ini ) == "true" && ui_shouts.size() > 0) // courtroom_config.ini necessary + check for crash
- {
- for(auto & shout : ui_shouts) move_widget(shout, "bullet");
-
- set_shouts();
-
- ui_shout_up->show();
- ui_shout_down->show();
- }
-
-// set_size_and_pos(ui_effects[0], "effect_flash");
-// set_size_and_pos(ui_effects[1], "effect_gloom");
-// set_size_and_pos(ui_effects[2], "effect_question");
-// set_size_and_pos(ui_effects[3], "effect_pow");
- for(int i = 0; i < effect_names.size(); ++i)
- {
- set_size_and_pos(ui_effects[i], effect_names[i]);
- }
- reset_effect_buttons();
-
- set_size_and_pos(ui_effect_up, "effect_up");
- ui_effect_up->set_image("effectup.png");
- ui_effect_up->hide();
- set_size_and_pos(ui_effect_down, "effect_down");
- ui_effect_down->set_image("effectdown.png");
- ui_effect_down->hide();
-
- if (ao_app->read_design_ini( "enable_single_effect", ao_app->get_theme_path() + cc_config_ini ) == "true" && ui_effects.size() > 0) // check to prevent crashing
- {
- for(auto & effect : ui_effects) move_widget(effect, "effect");
-
- set_effects();
-
- ui_effect_up->show();
- ui_effect_down->show();
- }
-
- for(int i = 0; i < wtce_names.size(); ++i)
- {
- set_size_and_pos(ui_wtce[i], wtce_names[i]);
- }
-
- set_size_and_pos(ui_wtce_up, "wtce_up");
- ui_wtce_up->set_image("wtceup.png");
- ui_wtce_up->hide();
- set_size_and_pos(ui_wtce_down, "wtce_down");
- ui_wtce_down->set_image("wtcedown.png");
- ui_wtce_down->hide();
-
- if( ao_app->read_design_ini( "enable_single_wtce", ao_app->get_theme_path() + cc_config_ini ) == "true" ) // courtroom_config.ini necessary
- {
- for(auto & wtce : ui_wtce) move_widget(wtce, "wtce");
- qDebug() << "AA: single wtce";
- set_wtce();
- }
-
- set_size_and_pos(ui_ooc_toggle, "ooc_toggle");
- ui_ooc_toggle->setText("Server");
-
- set_size_and_pos(ui_call_mod, "call_mod");
-
-
- set_size_and_pos(ui_change_character, "change_character");
- set_size_and_pos(ui_reload_theme, "reload_theme");
- set_size_and_pos(ui_call_mod, "call_mod");
- set_size_and_pos(ui_confirm_theme, "confirm_theme");
- set_size_and_pos(ui_note_button, "note_button");
-
- set_size_and_pos(ui_switch_area_music, "switch_area_music");
-// ui_switch_area_music->setText("A/M");
-
- if(ao_app->read_design_ini("enable_button_images", ao_app->get_theme_path() + cc_config_ini) == "true")
- {
- if(file_exists(ao_app->get_theme_path() + "changecharacter.png"))
- {
- ui_change_character->set_image("changecharacter.png");
- ui_change_character->setText("");
- }
- else
- {
- ui_change_character->setStyleSheet("");
- ui_change_character->setText("Change character");
- }
-
- if(file_exists(ao_app->get_theme_path() + "reloadtheme.png"))
- {
- ui_reload_theme->set_image("reloadtheme.png");
- ui_reload_theme->setText("");
- }
- else
- {
- ui_reload_theme->setStyleSheet("");
- ui_reload_theme->setText("Reload theme");
- }
-
- if(file_exists(ao_app->get_theme_path() + "callmod.png"))
- {
- ui_call_mod->set_image("callmod.png");
- ui_call_mod->setText("");
- }
- else
- {
- ui_call_mod->setStyleSheet("");
- ui_call_mod->setText("Call mod");
- }
-
- if(file_exists(ao_app->get_theme_path() + "switch_area_music.png"))
- {
- ui_switch_area_music->set_image("switch_area_music.png");
- ui_switch_area_music->setText("");
- }
- else
- {
- ui_switch_area_music->setStyleSheet("");
- ui_switch_area_music->setText("A/M");
- }
-
- if(file_exists(ao_app->get_theme_path() + "confirmtheme.png"))
- {
- ui_confirm_theme->set_image("confirmtheme.png");
- ui_confirm_theme->setText("");
- }
- else
- {
- ui_confirm_theme->setStyleSheet("");
- ui_confirm_theme->setText("^");
- }
-
- if(file_exists(ao_app->get_theme_path() + "notebutton.png"))
- {
- ui_note_button->set_image("notebutton.png");
- ui_note_button->setText("");
- }
- else
- {
- ui_note_button->setStyleSheet("");
- ui_note_button->setText("><:");
- }
- }
- else
- {
- ui_change_character->setText("Change character");
- ui_change_character->setStyleSheet("");
-
- ui_reload_theme->setText("Reload theme");
- ui_reload_theme->setStyleSheet("");
-
- ui_call_mod->setText("Call mod");
- ui_call_mod->setStyleSheet("");
-
- ui_switch_area_music->setText("A/M");
- ui_switch_area_music->setStyleSheet("");
-
- ui_confirm_theme->setText("^");
- ui_confirm_theme->setStyleSheet("");
-
- ui_note_button->setText("><:");
- ui_note_button->setStyleSheet("");
- }
-
- set_size_and_pos(ui_theme_list, "theme_list");
-
- set_size_and_pos(ui_pre, "pre");
- ui_pre->setText("Pre");
-
- set_size_and_pos(ui_flip, "flip");
-
- set_size_and_pos(ui_guard, "guard");
-
- set_size_and_pos(ui_hidden, "hidden");
-
- for(int i = 0; i < ui_label_images.size(); ++i)
- {
- set_size_and_pos(ui_label_images[i], label_images[i].toLower() + "_image");
- }
-
- if(ao_app->read_design_ini("enable_label_images", ao_app->get_theme_path() + cc_config_ini) == "true")
- {
- for(int i = 0 ; i < ui_checks.size(); ++i) // loop through checks
- {
- QString image = label_images[i].toLower() + ".png";
- QString path = ao_app->get_theme_path() + image;
- if(file_exists(path))
- {
- ui_label_images[i]->set_image(image);
- ui_checks[i]->setText("");
- }
- else
- {
- ui_label_images[i]->set_image("");
- ui_checks[i]->setText(label_images[i]);
- }
- }
-
- for(int i = 0 ; i < ui_labels.size(); ++i) // now through labels..........
- {
- int j = i + ui_checks.size();
- QString image = label_images[j].toLower() + ".png";
- QString path = ao_app->get_theme_path() + image;
- if(file_exists(path))
- {
- ui_label_images[j]->set_image(image);
- ui_labels[i]->setText("");
- }
- else
- {
- ui_label_images[j]->set_image("");
- ui_labels[i]->setText(label_images[j]);
- }
- }
- }
- else
- {
- for(int i = 0; i < ui_checks.size(); ++i) //same thing
- {
- ui_checks[i]->setText(label_images[i]);
- ui_label_images[i]->set_image("");
- }
-
- for(int i = 0; i < ui_labels.size(); ++i) //same thing
- {
- int j = i + ui_checks.size();
- ui_labels[i]->setText(label_images[j]);
- ui_label_images[j]->set_image("");
- }
- }
-
- set_size_and_pos(ui_mute, "mute_button");
- ui_mute->set_image("mute.png");
-
- set_size_and_pos(ui_defense_plus, "defense_plus");
- ui_defense_plus->set_image("defplus.png");
-
- set_size_and_pos(ui_defense_minus, "defense_minus");
- ui_defense_minus->set_image("defminus.png");
-
- set_size_and_pos(ui_prosecution_plus, "prosecution_plus");
- ui_prosecution_plus->set_image("proplus.png");
-
- set_size_and_pos(ui_prosecution_minus, "prosecution_minus");
- ui_prosecution_minus->set_image("prominus.png");
-
- set_size_and_pos(ui_text_color, "text_color");
-
- set_size_and_pos(ui_music_slider, "music_slider");
- set_size_and_pos(ui_sfx_slider, "sfx_slider");
- set_size_and_pos(ui_blip_slider, "blip_slider");
-
- set_size_and_pos(ui_evidence_button, "evidence_button");
- ui_evidence_button->set_image("evidencebutton.png");
-
- set_size_and_pos(ui_evidence, "evidence_background");
- ui_evidence->set_image("evidencebackground.png");
-
- set_size_and_pos(ui_evidence_name, "evidence_name");
-
- set_size_and_pos(ui_evidence_buttons, "evidence_buttons");
-
- set_size_and_pos(ui_evidence_left, "evidence_left");
- ui_evidence_left->set_image("arrow_left.png");
-
- set_size_and_pos(ui_evidence_right, "evidence_right");
- ui_evidence_right->set_image("arrow_right.png");
-
- set_size_and_pos(ui_evidence_present, "evidence_present");
- ui_evidence_present->set_image("present_disabled.png");
-
- set_size_and_pos(ui_evidence_overlay, "evidence_overlay");
- ui_evidence_overlay->set_image("evidenceoverlay.png");
-
- set_size_and_pos(ui_evidence_delete, "evidence_delete");
- ui_evidence_delete->set_image("deleteevidence.png");
-
- set_size_and_pos(ui_evidence_image_name, "evidence_image_name");
-
- set_size_and_pos(ui_evidence_image_button, "evidence_image_button");
-
- set_size_and_pos(ui_evidence_x, "evidence_x");
- ui_evidence_x->set_image("evidencex.png");
-
- set_size_and_pos(ui_evidence_description, "evidence_description");
-
- ui_selector->set_image("char_selector.png");
- ui_selector->hide();
-
- set_size_and_pos(ui_back_to_lobby, "back_to_lobby");
- ui_back_to_lobby->setText("Back to Lobby");
-
- set_size_and_pos(ui_char_password, "char_password");
-
- set_size_and_pos(ui_char_buttons, "char_buttons");
-
- set_size_and_pos(ui_char_select_left, "char_select_left");
- ui_char_select_left->set_image("arrow_left.png");
-
- set_size_and_pos(ui_char_select_right, "char_select_right");
- ui_char_select_right->set_image("arrow_right.png");
-
- set_size_and_pos(ui_spectator, "spectator");
-
- handle_music_anim();
-
- set_size_and_pos(ui_set_notes, "set_notes_button");
- ui_set_notes->set_image("set_notes.png");
- ui_note_area->m_layout->setSpacing(10);
- set_size_and_pos(ui_note_area, "note_area");
- set_size_and_pos(note_scroll_area, "note_area");
- note_scroll_area->setWidget(ui_note_area);
- ui_note_area->set_image("note_area.png");
- ui_note_area->add_button->set_image("add_button.png");
- ui_note_area->add_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- ui_note_area->setLayout(ui_note_area->m_layout);
- ui_note_area->show();
- note_scroll_area->hide();
-
- list_note_files();
-
- if(!contains_add_button)
- {
- ui_note_area->m_layout->addWidget(ui_note_area->add_button);
- contains_add_button = true;
- }
-
- set_dropdowns();
-}
-
-void Courtroom::set_fonts()
-{
- set_font(ui_vp_showname, "showname");
- set_font(ui_vp_message, "message");
- set_font(ui_ic_chatlog, "ic_chatlog");
- set_font(ui_ms_chatlog, "ms_chatlog");
- set_font(ui_server_chatlog, "server_chatlog");
- set_font(ui_music_list, "music_list");
- set_font(ui_area_list, "area_list");
- set_font(ui_sfx_list, "sfx_list");
- set_font(ui_vp_music_name, "music_name");
- set_font(ui_vp_notepad, "notepad");
-}
-
-void Courtroom::set_font(QWidget *widget, QString p_identifier)
-{
- QString design_file = fonts_ini;
- int f_weight = ao_app->get_font_size(p_identifier, design_file);
- QString class_name = widget->metaObject()->className();
-
- QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file);
-
- widget->setFont(QFont(font_name, f_weight));
-
- QColor f_color = ao_app->get_color(p_identifier + "_color", design_file);
-
- int bold = ao_app->get_font_size(p_identifier + "_bold", design_file); // is the font bold or not?
-
- QString is_bold = "";
- if(bold == 1) is_bold = "bold";
-
- QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" +
- "color: rgba(" +
- QString::number(f_color.red()) + ", " +
- QString::number(f_color.green()) + ", " +
- QString::number(f_color.blue()) + ", 255);\n"
- "font: " + is_bold + "; }";
-
- widget->setStyleSheet(style_sheet_string);
-}
-
-void Courtroom::set_dropdown(QWidget *widget, QString target_tag)
-{
- QString f_file = "courtroom_stylesheets.css";
- QString style_sheet_string = ao_app->get_stylesheet(target_tag, f_file);
- if (style_sheet_string != "")
- widget->setStyleSheet(style_sheet_string);
-}
-
-void Courtroom::set_dropdowns()
-{
- set_dropdown(ui_text_color, "[TEXT COLOR]");
- set_dropdown(ui_pos_dropdown, "[POS DROPDOWN]");
- set_dropdown(ui_theme_list, "[THEME LIST]");
- set_dropdown(ui_emote_dropdown, "[EMOTE DROPDOWN]");
- set_dropdown(ui_mute_list, "[MUTE LIST]");
- set_dropdown(ui_ic_chat_message, "[IC LINE]");
- set_dropdown(ui_ooc_chat_message, "[OOC LINE]");
-}
-
-void Courtroom::move_widget(QWidget *p_widget, QString p_identifier)
-{
- QString filename = 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;
- p_widget->hide();
- }
- else
- {
- p_widget->move(design_ini_result.x, design_ini_result.y);
- }
-}
-
-void Courtroom::set_shouts()
-{
- for(auto & shout : ui_shouts) shout->hide();
- if (ui_shouts.size() > 0) ui_shouts[m_shout_state]->show(); // check to prevent crashing
-}
-
-void Courtroom::set_effects()
-{
- for(auto & effect : ui_effects) effect->hide();
- if (ui_effects.size() > 0) ui_effects[m_effect_current]->show(); // check to prevent crashing
-}
-
-void Courtroom::set_wtce()
-{
- for(auto & wtce : ui_wtce) wtce->hide();
-
- if(is_judge && ui_wtce.size() > 0) // check to prevent crashing
- {
- if( ao_app->read_design_ini( "enable_single_wtce", ao_app->get_theme_path() + cc_config_ini ) == "true" )
- {
- ui_wtce[m_wtce_current]->show();
- ui_wtce_up->show();
- ui_wtce_down->show();
- }
- else
- {
- for(auto & wtce : ui_wtce) wtce->show();
- ui_wtce_up->hide();
- ui_wtce_down->hide();
- }
- }
-}
-
-void Courtroom::handle_music_anim()
-{
- QString file_a = design_ini;
- QString file_b = fonts_ini;
- pos_size_type res_a = ao_app->get_element_dimensions("music_name", file_a);
- pos_size_type res_b = ao_app->get_element_dimensions("music_area", file_a);
- float speed = static_cast(ao_app->get_font_size("music_name_speed", file_b));
-
- QFont f_font = ui_vp_music_name->font();
- QFontMetrics fm(f_font);
- int dist;
- if ( ao_app->read_design_ini( "enable_const_music_speed", ao_app->get_theme_path() + cc_config_ini ) == "true")
- dist = res_b.width;
- else dist = fm.width(ui_vp_music_name->toPlainText());
- int time = static_cast(1000000*dist/speed);
- music_anim->setLoopCount(-1);
- music_anim->setDuration(time);
- music_anim->setStartValue(QRect(res_b.width + res_b.x, res_a.y, res_a.width, res_a.height));
- music_anim->setEndValue(QRect(-dist + res_a.x, res_a.y, res_a.width, res_a.height));
- music_anim->start();
-}
-
-void Courtroom::handle_clock(QString time)
-{
- current_clock = time.toInt();
-
- QString string = "hours\\" + time; // expected to be 0, 1, 2...
- qDebug() << "hours:" << string;
- ui_vp_clock->play(string);
-}
-
-void Courtroom::set_window_title(QString p_title)
-{
- this->setWindowTitle(p_title);
-}
-
-void Courtroom::set_char_rpc()
-{
- rpc_char_list.clear();
-
- QFile config_file(ao_app->get_base_path() + rpc_ini);
- if (!config_file.open(QIODevice::ReadOnly))
- { qDebug() << "Error reading" << ao_app->get_base_path() + rpc_ini; return; }
-
- QTextStream in(&config_file);
-
- while(!in.atEnd())
- {
- QString f_line = in.readLine().trimmed();
-
- QStringList line_elements = f_line.split("-");
-
- rpc_char_list.append(line_elements.at(1).trimmed().toLower());
- }
-
- config_file.close();
-}
-
-void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
-{
- QString filename = 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;
- p_widget->hide();
- }
- else
- {
- p_widget->move(design_ini_result.x, design_ini_result.y);
- p_widget->resize(design_ini_result.width, design_ini_result.height);
- }
-}
-
-void Courtroom::set_taken(int n_char, bool p_taken)
-{
- if (n_char >= char_list.size())
- {
- qDebug() << "W: set_taken attempted to set an index bigger than char_list size";
- return;
- }
-
- char_type f_char;
- f_char.name = char_list.at(n_char).name;
- f_char.description = char_list.at(n_char).description;
- f_char.taken = p_taken;
- f_char.evidence_string = char_list.at(n_char).evidence_string;
-
- char_list.replace(n_char, f_char);
-}
-
-void Courtroom::done_received()
-{
- m_cid = -1;
-
- m_music_player->set_volume(0);
- m_sfx_player->set_volume(0);
- m_shout_player->set_volume(0);
- m_blip_player->set_volume(0);
-
- set_char_select_page();
-
- set_mute_list();
-
- set_char_select();
-
- show();
-
- ui_spectator->show();
-}
-
-void Courtroom::set_background(QString p_background)
-{
- testimony_in_progress = false;
-
- current_background = p_background;
- QString bg_path = get_background_path();
- QVector exts{".apng", ".gif", ".png"};
-
- QString ini_path = ao_app->get_background_path() + "backgrounds.ini";
-
- if (file_exists(ini_path))
- {
- is_ao2_bg = true;
- }
- else
- {
- is_ao2_bg = file_exists(bg_path + "defensedesk", exts) != "" &&
- file_exists(bg_path + "prosecutiondesk", exts) != "" &&
- file_exists(bg_path + "stand", exts) != "";
- }
-
- if (is_ao2_bg)
- {
- set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
- set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message");
- }
- else
- {
- set_size_and_pos(ui_vp_chatbox, "chatbox");
- set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
- }
-}
-
-void Courtroom::enter_courtroom(int p_cid)
-{
- m_cid = p_cid;
-
- QString f_char;
-
- set_char_rpc();
-
- if (m_cid == -1)
- {
- ao_app->discord->state_spectate();
- f_char = "";
- }
- else
- {
- f_char = ao_app->get_char_name(char_list.at(m_cid).name);
- QString r_char = f_char;
- QRegularExpression re(QString::fromUtf8("[-`~!@#$%^&*()—+=|:;<>«»,.?/{}\'\"\\[\\]]")); // regex for removing non letter (except _) characters
- r_char.remove(re);
-
- if(!rpc_char_list.contains(f_char.toLower()))
- {
- ao_app->discord->toggle(1);
- }
- else
- {
- ao_app->discord->toggle(0);
- }
-
- ao_app->discord->state_character(r_char.toStdString());
- }
-
- current_char = f_char;
-
- current_emote_page = 0;
- current_emote = 0;
-
- if (m_cid == -1)
- ui_emotes->hide();
- else
- ui_emotes->show();
-
- set_emote_page();
- set_emote_dropdown();
-
- current_evidence_page = 0;
- current_evidence = 0;
-
- m_shout_state = 0;
- m_wtce_current = 0;
- reset_wtce_buttons();
-
- if(const int log_limit = ao_app->read_config("chatlog_limit").toInt())
- m_log_limit = log_limit;
-
- m_scroll_down = ao_app->read_config("scroll_type") == "down";
- if(m_previously_scroll_down != m_scroll_down)
- m_scroll_type_changed = !m_scroll_type_changed;
-
- m_previously_scroll_down = m_scroll_down;
-
- set_evidence_page();
-
- QString side = ao_app->get_char_side(f_char);
-
- if (side == "jud")
- {
- is_judge = true;
- //set_wtce();
- //ui_wtce_down->show();
- //ui_wtce_up->show();
-
- ui_defense_minus->show();
- ui_defense_plus->show();
- ui_prosecution_minus->show();
- ui_prosecution_plus->show();
- }
- else
- {
- is_judge = false;
- //set_wtce();
- //ui_wtce_down->hide();
- //ui_wtce_up->hide();
-
- ui_defense_minus->hide();
- ui_defense_plus->hide();
- ui_prosecution_minus->hide();
- ui_prosecution_plus->hide();
- }
-
- check_shouts();
- check_effects();
- check_wtce();
-
- if (ao_app->custom_objection_enabled)
- {
-
- for(int i = 0; i < ui_shouts.size(); ++i)
- {
- if(shouts_enabled[i])
- {
- ui_shouts[i]->show();
- }
- else
- {
- ui_shouts[i]->hide();
- }
- }
- }
- else
- {
- for(int i = 3; i < ui_shouts.size(); i++) // the non-official shouts
- ui_shouts[i]->hide();
- }
-
- for(int i = 0; i < ui_effects.size(); ++i)
- {
- if(effects_enabled[i])
- {
- ui_effects[i]->show();
- }
- else
- {
- ui_effects[i]->hide();
- }
- }
-
- for(int i = 0; i < ui_wtce.size(); ++i)
- {
- if(wtce_enabled[i] && is_judge)
- {
- ui_wtce[i]->show();
- }
- else
- {
- ui_wtce[i]->hide();
- }
- }
-
- if (ao_app->flipping_enabled)
- ui_flip->show();
- else
- ui_flip->hide();
-
- list_music();
- list_areas();
- list_sfx();
- list_themes();
-
- ui_sfx_list->setCurrentItem(ui_sfx_list->item(0)); // prevents undefined errors
-
- m_music_player->set_volume(ui_music_slider->value());
- m_sfx_player->set_volume(ui_sfx_slider->value());
- m_cycle_player->set_volume(ui_sfx_slider->value());
- m_shout_player->set_volume(ui_sfx_slider->value());
- m_blip_player->set_volume(ui_blip_slider->value());
-
- testimony_in_progress = false;
-
- set_widgets();
-
- //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml());
-
- ui_char_select_background->hide();
-
- bool ok;
- chat_tick_interval = ao_app->read_config("chat_tick_interval").toInt(&ok, 10); // ok will be set to false and this will return 0 if goes bad
- if(!ok) chat_tick_interval = 60;
-
- ui_ic_chat_message->setEnabled(m_cid != -1);
- ui_ic_chat_message->setFocus();
-
- set_bullets();
-}
-
-void Courtroom::list_music()
-{
- ui_music_list->clear();
-
- QString f_file = design_ini;
-
- QBrush found_brush(ao_app->get_color("found_song_color", f_file));
- QBrush missing_brush(ao_app->get_color("missing_song_color", f_file));
-
- int n_listed_songs = 0;
-
- for (int n_song = 0 ; n_song < music_list.size() ; ++n_song)
- {
- QString i_song = music_list.at(n_song);
- bool found = false;
-
- for (auto& ext : QStringList { "", ".wav", ".ogg", ".mp3" })
- {
- QString r_song = i_song + ext;
- QString song_path = ao_app->get_base_path() + "sounds/music/" + r_song.toLower();
- if (file_exists(song_path))
- {
- found = true;
- break;
- }
- }
-
- if (i_song.toLower().contains(ui_music_search->text().toLower()))
- {
- ui_music_list->addItem(i_song);
-
- if (found)
- ui_music_list->item(n_listed_songs)->setBackground(found_brush);
- else
- ui_music_list->item(n_listed_songs)->setBackground(missing_brush);
-
- ++n_listed_songs;
- }
- }
-}
-
-void Courtroom::list_areas()
-{
- ui_area_list->clear();
-// area_names.clear();
-
- QString f_file = "courtroom_design.ini";
-
- QBrush free_brush(ao_app->get_color("area_free_color", f_file));
- QBrush lfp_brush(ao_app->get_color("area_lfp_color", f_file));
- QBrush casing_brush(ao_app->get_color("area_casing_color", f_file));
- QBrush recess_brush(ao_app->get_color("area_recess_color", f_file));
- QBrush rp_brush(ao_app->get_color("area_rp_color", f_file));
- QBrush gaming_brush(ao_app->get_color("area_gaming_color", f_file));
- QBrush locked_brush(ao_app->get_color("area_locked_color", f_file));
-
- int n_listed_areas = 0;
-
- for (int n_area = 0 ; n_area < area_list.size() ; ++n_area)
- {
- QString i_area = "";
-
- i_area.append(area_list.at(n_area));
-
- if (i_area.toLower().contains(ui_music_search->text().toLower()))
- {
- ui_area_list->addItem(i_area);
-// area_names.append(i_);
-
-
- ui_area_list->item(n_listed_areas)->setBackground(free_brush);
-
- ++n_listed_areas;
- }
- }
-}
-
-void Courtroom::list_sfx()
-{
- ui_sfx_list->clear();
- sfx_names.clear();
-
- QString f_file = design_ini;
-
- QStringList sfx_list = ao_app->get_sfx_list();
-
- QBrush found_brush(ao_app->get_color("found_song_color", f_file));
- QBrush missing_brush(ao_app->get_color("missing_song_color", f_file));
-
- ui_sfx_list->addItem("Default");
- ui_sfx_list->addItem("Silence");
-
- sfx_names.append("1"); // Default
- sfx_names.append("1"); // Silence
-
- int n_listed_sfxs = 0;
-
- for (int n_sfx = 0 ; n_sfx < sfx_list.size() ; ++n_sfx)
- {
- QStringList sfx = sfx_list.at(n_sfx).split("=");
- QString i_sfx = sfx.at(0).trimmed();
- QString d_sfx = "";
- sfx_names.append(i_sfx);
- if(sfx_list.at(n_sfx).split("=").size() < 2)
- d_sfx = i_sfx;
- else d_sfx = sfx.at(1).trimmed();
-
- // qDebug() << "isfx=" << i_sfx << "dsfx=" << d_sfx << "sfx=" << sfx;
-
- if (i_sfx.toLower().contains(ui_sfx_search->text().toLower()))
- {
- ui_sfx_list->addItem(d_sfx);
- ui_sfx_list->item(ui_sfx_list->count()-1)->setStatusTip(QString::number(n_sfx+2));
-
- QString sfx_path = ao_app->get_base_path() + "sounds/general/" + i_sfx.toLower();
-
- if (file_exists(sfx_path))
- ui_sfx_list->item(n_listed_sfxs)->setBackground(found_brush);
- else
- ui_sfx_list->item(n_listed_sfxs)->setBackground(missing_brush);
-
- ++n_listed_sfxs;
- }
- }
-}
-
-void Courtroom::list_note_files()
-{
- QString f_config = ao_app->get_base_path() + file_select_ini;
- QFile f_file(f_config);
- if(!f_file.open(QIODevice::ReadOnly))
- { qDebug() << "Couldn't open" << f_config; return; }
-
- note_list.clear();
-
- QString f_filestring = "";
- QString f_filename = "";
-
- QTextStream in(&f_file);
-
- QVBoxLayout *f_layout = ui_note_area->m_layout;
-
- while(!in.atEnd())
- {
- QString line = in.readLine().trimmed();
-
- QStringList f_contents = line.split("=");
- if(f_contents.size() < 2)
- continue;
-
- int f_index = f_contents.at(0).toInt();
- f_filestring = f_filename = f_contents.at(1).trimmed();
-
- if(f_contents.size() > 2)
- f_filename = f_contents.at(2).trimmed();
-
- while(f_index >= f_layout->count())
- on_add_button_clicked();
-
- AONotePicker *f_notepicker = static_cast(f_layout->itemAt(f_index)->widget());
- f_notepicker->m_line->setText(f_filename);
- f_notepicker->real_file = f_filestring;
- }
-}
-
-void Courtroom::load_note()
-{
- QString f_text = ao_app->read_note(current_file);
- ui_vp_notepad->setText(f_text);
-}
-
-void Courtroom::save_note()
-{
- QString f_text = ui_vp_notepad->toPlainText();
-
- ao_app->write_note(f_text, current_file);
-}
-
-void Courtroom::save_textlog(QString p_text)
-{
- QString f_file = ao_app->get_base_path() + icchatlogsfilename;
-
- ao_app->append_note(p_text, f_file);
-}
-
-void Courtroom::list_themes()
-{
- QString themes = ao_app->get_base_path() + "themes/";
- QDir dir(themes);
- ui_theme_list->clear();
-
- QStringList lis = dir.entryList();
- for(QString s : lis)
- {
- if(s != "." && s != "..")
- ui_theme_list->addItem(s);
- }
-}
-
-void Courtroom::append_ms_chatmessage(QString f_name, QString f_message)
-{
- ui_ms_chatlog->append_chatmessage(f_name, f_message);
-}
-
-void Courtroom::append_server_chatmessage(QString p_name, QString p_message)
-{
- ui_server_chatlog->append_chatmessage(p_name, p_message);
- if(ao_app->read_config("enable_logging") == "true")
- save_textlog("(OOC)[" + QTime::currentTime().toString() + "] " + p_name + ": " + p_message);
-}
-
-void Courtroom::on_chat_return_pressed()
-{
- if (ui_ic_chat_message->text() == "" || is_muted)
- return;
-
- if ((anim_state < 3 || text_state < 2) &&
- m_objection_state == 0)
- return;
-
- // qDebug() << "prev_emote = " << prev_emote << "current_emote = " << current_emote;
-
- // qDebug() << "same_emote = " << same_emote;
- //MS#
- //deskmod#
- //pre-emote#
- //character#
- //emote#
- //message#
- //side#
- //sfx-name#
- //emote_modifier#
- //char_id#
- //sfx_delay#
- //objection_modifier#
- //evidence#
- //placeholder#
- //realization#
- //text_color#%
-
- QStringList packet_contents;
-
- QString f_side = ao_app->get_char_side(current_char);
-
- QString f_desk_mod = "chat";
-
- if (ao_app->desk_mod_enabled)
- {
- f_desk_mod = QString::number(ao_app->get_desk_mod(current_char, current_emote));
- if (f_desk_mod == "-1")
- f_desk_mod = "chat";
- }
-
- packet_contents.append(f_desk_mod);
-
- packet_contents.append(ao_app->get_pre_emote(current_char, current_emote));
-
- packet_contents.append(current_char);
-
- if(ui_hidden->isChecked())
- packet_contents.append("../../misc/blank");
- else
- packet_contents.append(ao_app->get_emote(current_char, current_emote));
-
-
-
- packet_contents.append(ui_ic_chat_message->text());
-
- packet_contents.append(f_side);
-
- // packet_contents.append(ao_app->get_sfx_name(current_char, current_emote));
- // packet_contents.append(ui_sfx_search->text());
-
- int row = ui_sfx_list->currentRow();
- if (row == -1 || row == 0) // default
- packet_contents.append(ao_app->get_sfx_name(current_char, current_emote));
- else if (QListWidgetItem *item = ui_sfx_list->item(row)) // selection
- {
- double d_ind = item->statusTip().toDouble();
- int ind = int(d_ind);
- qDebug() << ind;
- packet_contents.append(sfx_names.at(ind));
- // packet_contents.append(sfx_names.at(row));
- }
-
- int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote);
-
- //needed or else legacy won't understand what we're saying
- if (m_objection_state > 0)
- {
- if (f_emote_mod == 5)
- f_emote_mod = 6;
- else
- f_emote_mod = 2;
- }
- else if (ui_pre->isChecked())
- {
- if (f_emote_mod == 0)
- f_emote_mod = 1;
- else if (f_emote_mod == 5 && ao_app->prezoom_enabled)
- f_emote_mod = 4;
- }
- else
- {
- if (f_emote_mod == 1)
- f_emote_mod = 0;
- else if (f_emote_mod == 4)
- f_emote_mod = 5;
- }
-
- packet_contents.append(QString::number(f_emote_mod));
- packet_contents.append(QString::number(m_cid));
-
- packet_contents.append(QString::number(ao_app->get_sfx_delay(current_char, current_emote)));
-
- QString f_obj_state;
-
- if (m_objection_state < 0 || (!ao_app->custom_objection_enabled && m_objection_state > 3))
- f_obj_state = "0";
- else
- f_obj_state = QString::number(m_objection_state);
-
- packet_contents.append(f_obj_state);
-
- if (is_presenting_evidence)
- //the evidence index is shifted by 1 because 0 is no evidence per legacy standards
- //besides, older clients crash if we pass -1
- packet_contents.append(QString::number(current_evidence + 1));
- else
- packet_contents.append("0");
-
- QString f_flip;
-
- if (ao_app->flipping_enabled)
- {
- if (ui_flip->isChecked())
- f_flip = "1";
- else
- f_flip = "0";
- }
- else
- f_flip = QString::number(m_cid);
-
- packet_contents.append(f_flip);
-
- packet_contents.append(QString::number(m_effect_state));
-
- QString f_text_color;
-
- if (m_text_color < 0)
- f_text_color = "0";
- else if (m_text_color > 4 && !ao_app->yellow_text_enabled)
- f_text_color = "0";
- else
- f_text_color = QString::number(m_text_color);
-
- packet_contents.append(f_text_color);
-
- prev_emote = current_emote;
-
- ao_app->send_server_packet(new AOPacket("MS", packet_contents));
-}
-
-void Courtroom::handle_char_anim(AOCharMovie *charPlayer)
-{
- int time = ao_app->read_config("opacity_time").toInt();
- int op = ao_app->read_config("char_opacity").toInt();
-
- QGraphicsOpacityEffect *opacity = new QGraphicsOpacityEffect;
- QPropertyAnimation *anim = new QPropertyAnimation(opacity, "opacity");
-
- charPlayer->setGraphicsEffect(opacity);
-
- anim->setDuration(time);
- anim->setStartValue(1.0);
- anim->setEndValue(op);
- anim->setEasingCurve(QEasingCurve::InCubic);
- anim->start();
-}
-
-void Courtroom::handle_char_anim_2(AOCharMovie *charPlayer)
-{
- int time = ao_app->read_config("opacity_time").toInt();
- int op = ao_app->read_config("char_opacity").toInt();
-
- QGraphicsOpacityEffect *opacity = new QGraphicsOpacityEffect;
- QPropertyAnimation *anim = new QPropertyAnimation(opacity, "opacity");
-
- charPlayer->setGraphicsEffect(opacity);
-
- anim->setDuration(time);
- anim->setStartValue(op);
- anim->setEndValue(1.0);
- anim->setEasingCurve(QEasingCurve::InCubic);
- anim->start();
-}
-
-void Courtroom::handle_chatmessage(QStringList *p_contents)
-{
- if (p_contents->size() < 15)
- return;
- else if (p_contents->size() == 15)
- p_contents->append("");
-
- for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string)
- {
- m_chatmessage[n_string] = p_contents->at(n_string);
- // qDebug() << "m_chatmessage[" << n_string << "] = " << m_chatmessage[n_string];
- }
-
- int f_char_id = m_chatmessage[CHAR_ID].toInt();
-
- if (f_char_id == -1)
- {
- is_system_speaking = true;
- m_chatmessage[CHAR_ID] = "0";
- f_char_id = 0;
- }
- else is_system_speaking = false;
-
- if (f_char_id < 0 || f_char_id >= char_list.size())
- return;
-
- if (mute_map.value(m_chatmessage[CHAR_ID].toInt()))
- return;
-
- QString f_showname;
- qDebug() << "handle_chatmessage";
- qDebug() << m_chatmessage[SHOWNAME] << ao_app->get_showname(char_list.at(f_char_id).name);
-
- if(m_chatmessage[SHOWNAME].isEmpty())
- {
- f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
- }
- else
- {
- f_showname = m_chatmessage[SHOWNAME];
- }
-
- QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + "\n";
-
- if (f_message == previous_ic_message && is_system_speaking == false)
- return;
-
- text_state = 0;
- anim_state = 0;
- ui_vp_objection->stop();
- chat_tick_timer->stop();
- ui_vp_evidence_display->reset();
-
- // reset effect
- ui_vp_effect->stop();
-
- chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
- showed = true;
-
- if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text())
- {
- ui_ic_chat_message->clear();
- ui_sfx_list->setCurrentItem(ui_sfx_list->item(0));
-
- m_objection_state = 0;
- reset_shout_buttons();
-
- m_effect_state = 0;
- reset_effect_buttons();
-
- m_wtce_current = 0;
- reset_wtce_buttons();
-
- is_presenting_evidence = false;
- ui_evidence_present->set_image("present_disabled.png");
-
- // if(ao_app->read_config("first_person") == "true"){
- // ui_vp_player_char->hide();
- // qDebug() << "wow!";
- // }
- // else ui_vp_player_char->show();
-
- if(ao_app->read_config("first_person") == "true") showed = false;
- else showed = true;
- }
-
- if (is_system_speaking)
- append_system_text(m_chatmessage[MESSAGE]);
- else append_ic_text(m_chatmessage[MESSAGE], f_showname);
-
- if(ao_app->read_config("enable_logging") == "true")
- save_textlog("[" + QTime::currentTime().toString() + "] " + f_showname + ": " + m_chatmessage[MESSAGE]);
-
- previous_ic_message = f_message;
-
- int objection_mod = m_chatmessage[OBJECTION_MOD].toInt();
- QString f_char = m_chatmessage[CHAR_NAME];
- QString f_custom_theme = ao_app->get_char_shouts(f_char);
-
- //if an objection is used
- if (objection_mod > 0)
- {
- int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
- if (emote_mod == 0)
- m_chatmessage[EMOTE_MOD] = 1;
-
- //handles cases 1-7 (5-7 are DRO only)
- if(objection_mod >= 1 && objection_mod <= ui_shouts.size() && ui_shouts.size() > 0) // check to prevent crashing
- {
- ui_vp_objection->play(shout_names.at(objection_mod-1), f_char, f_custom_theme);
- m_shout_player->play(shout_names.at(objection_mod-1) + ".wav", f_char);
- }
- else
- qDebug() << "W: Shout identifier unknown" << objection_mod;
-
- }
- else
- handle_chatmessage_2();
-}
-
-void Courtroom::objection_done()
-{
- handle_chatmessage_2();
-}
-
-void Courtroom::handle_chatmessage_2() // handles IC
-{
- ui_vp_speedlines->stop();
- ui_vp_player_char->stop();
-
- qDebug() << "handle_chatmessage_2";
-
- QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name;
-
- QString f_showname;
-
- if(m_chatmessage[SHOWNAME].isEmpty())
- {
- f_showname = ao_app->get_showname(real_name);
- }
- else
- {
- f_showname = m_chatmessage[SHOWNAME];
- }
-
- QString f_color = ao_app->read_char_ini(real_name, "color", "[Options]", "[Time]");
- if (f_color == "")
- f_color = "rgb(" + ao_app->read_design_ini("showname_color" , ao_app->get_theme_path() + "courtroom_fonts.ini") + ")";
-
- int bold = ao_app->get_font_size("showname_bold", fonts_ini); // is the font bold or not? // taken directly from function up there lol // kinda hacky
- QString is_bold = "";
- if(bold == 1) is_bold = "bold";
-
- ui_vp_showname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: " + f_color + ";font: " + is_bold);
- ui_vp_showname->setText(f_showname);
-
- ui_vp_message->clear();
- ui_vp_chatbox->hide();
- ui_vp_showname_image->hide();
-
- QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]);
-
- if (chatbox == "")
- if (ao_app->read_design_ini("daynight_theme", ao_app->get_theme_path() + cc_config_ini) == "true")
- {
- if (current_clock < 0)
- ui_vp_chatbox->set_image("chatmed.png");
- else if (current_clock >= 7 && current_clock < 22)
- ui_vp_chatbox->set_image("chatmed_day.png");
- else
- ui_vp_chatbox->set_image("chatmed_night.png");
- }
- else
- ui_vp_chatbox->set_image("chatmed.png");
- else
- {
- QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + ".png";
- ui_vp_chatbox->set_image_from_path(chatbox_path);
- }
-
- set_scene();
- set_text_color();
-
- int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
-
- if (ao_app->flipping_enabled && m_chatmessage[FLIP].toInt() == 1)
- ui_vp_player_char->set_flipped(true);
- else
- ui_vp_player_char->set_flipped(false);
-
-
- switch (emote_mod)
- {
- case 1: case 2: case 6:
- play_preanim();
- break;
- default:
- qDebug() << "W: invalid emote mod: " << QString::number(emote_mod);
- //intentional fallthru
- case 0: case 5:
- handle_chatmessage_3();
- }
-}
-
-void Courtroom::handle_chatmessage_3()
-{
- qDebug() << "handle_chatmessage_3";
-
- start_chat_ticking();
-
- int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt();
- QString f_side = m_chatmessage[SIDE];
-
- if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size())
- {
- //shifted by 1 because 0 is no evidence per legacy standards
- QString f_image = local_evidence_list.at(f_evi_id - 1).image;
- //def jud and hlp should display the evidence icon on the RIGHT side
- bool is_left_side = !(f_side == "def" || f_side == "hlp" || f_side == "jud");
- ui_vp_evidence_display->show_evidence(f_image, is_left_side, ui_sfx_slider->value());
- }
-
- int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
-
- if (emote_mod == 5 ||
- emote_mod == 6)
- {
- QString side = m_chatmessage[SIDE];
- ui_vp_desk->hide();
- ui_vp_legacy_desk->hide();
-
- if (side == "pro" ||
- side == "hlp" ||
- side == "wit")
- ui_vp_speedlines->play("prosecution_speedlines");
- else
- ui_vp_speedlines->play("defense_speedlines");
-
- }
-
- int f_anim_state = 0;
- //BLUE is from an enum in datatypes.h
- bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE;
-
- if (!text_is_blue && text_state == 1)
- //talking
- f_anim_state = 2;
- else
- //idle
- f_anim_state = 3;
-
- if (f_anim_state <= anim_state)
- return;
-
- ui_vp_player_char->stop();
- QString f_char = m_chatmessage[CHAR_NAME];
- QString f_emote = m_chatmessage[EMOTE];
-
- ui_vp_showname_image->show();
- QVector exts = {".png", ".jpg", ".bmp"};
-
- QString ext = file_exists(ao_app->get_character_path(f_char) + "showname", exts);
- if(ext != "" && !chatmessage_is_empty && ao_app->read_design_ini("enable_showname_image", ao_app->get_theme_path() + cc_config_ini) == "true")
- {
- ui_vp_showname->hide();
- QString path = ao_app->get_character_path(f_char) + "showname" + ext;
- ui_vp_showname_image->set_image_from_path(path);
- ui_vp_showname_image->show();
- }
- else
- {
- ui_vp_showname->show();
- ui_vp_showname_image->hide();
- }
-
-
- switch (f_anim_state)
- {
- case 2:
- ui_vp_player_char->play_talking(f_char, f_emote, showed);
- anim_state = 2;
- break;
- default:
- qDebug() << "W: invalid anim_state: " << f_anim_state;
- case 3:
- ui_vp_player_char->play_idle(f_char, f_emote, showed);
- anim_state = 3;
- }
-
- int effect = m_chatmessage[EFFECT_STATE].toInt();
- QStringList offset = ao_app->get_effect_offset(f_char, effect);
-
- ui_vp_effect->move(ui_viewport->x() + offset.at(0).toInt(), ui_viewport->y() + offset.at(1).toInt());
-
- QStringList overlay = ao_app->get_overlay(f_char, effect);
- QString overlay_name = overlay.at(0);
- QString overlay_sfx = overlay.at(1);
-
- QString design_ini = ao_app->get_theme_path() + cc_config_ini;
- bool do_it = ao_app->read_design_ini("non_vanilla_effects", design_ini) == "true";
-
- if (effect == 1 && !do_it)
- {
- if (overlay_sfx == "")
- overlay_sfx = ao_app->get_sfx("effect_flash");
- m_sfx_player->play(overlay_sfx);
- ui_vp_effect->set_play_once(true);
- if (overlay_name == "")
- overlay_name = "effect_flash";
- ui_vp_effect->play(overlay_name, f_char);
- realization_timer->start(60);
- }
-// else if (effect == 2)
-// {
-// if (overlay_sfx == "")
-// overlay_sfx = ao_app->get_sfx("effect_gloom");
-// m_sfx_player->play(overlay_sfx);
-// ui_vp_effect->set_play_once(false);
-// if (overlay_name == "")
-// overlay_name = "effect_gloom";
-// ui_vp_effect->play(overlay_name, f_char);
-// }
- else if (do_it && effect > 0 && effect <= ui_effects.size() && effect_names.size() > 0) // check to prevent crashing
- {
- QString s_eff = effect_names.at(effect - 1);
- QStringList f_eff = ao_app->get_effect(effect);
-
-// QString s_eff = f_eff.at(0).trimmed();
- bool once = f_eff.at(1).trimmed().toInt();
-
- if (overlay_sfx == "")
- overlay_sfx = ao_app->get_sfx(s_eff);
- // qDebug() << overlay_sfx << ao_app->get_sfx(s_eff);
- m_sfx_player->play(overlay_sfx);
- ui_vp_effect->set_play_once(once);
- if (overlay_name == "")
- overlay_name = s_eff;
- ui_vp_effect->play(overlay_name, f_char);
- }
-
- QString f_message = m_chatmessage[MESSAGE];
- QStringList call_words = ao_app->get_call_words();
-
- for (QString word : call_words)
- {
- if (f_message.contains(word, Qt::CaseInsensitive))
- {
- m_mod_player->play(ao_app->get_sfx("word_call"));
- ao_app->alert(this);
-
- break;
- }
- }
-
-}
-
-void Courtroom::append_ic_text(QString p_text, QString p_name)
-{
- QTextCharFormat bold;
- QTextCharFormat normal;
- QString color = ao_app->read_design_ini("chatlog_showname", ao_app->get_theme_path() + fonts_ini);
- bold.setFontWeight(QFont::Bold);
- normal.setFontWeight(QFont::Normal);
- const QTextCursor old_cursor = ui_ic_chatlog->textCursor();
- const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value();
- const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum();
- const QTextCursor::MoveOperation f_operation = m_scroll_down ? QTextCursor::End : QTextCursor::Start;
-
- //rewrite everything that was written before
- if(m_scroll_type_changed)
- {
- ui_ic_chatlog->clear();
-
- for (record_type_ptr record : m_ic_records)
- {
- ui_ic_chatlog->moveCursor(f_operation);
- if (record->system == false)
- {
- ui_ic_chatlog->insertHtml("color + "\">" + record->name + "");
- ui_ic_chatlog->textCursor().insertText("\n");
- ui_ic_chatlog->textCursor().insertText(record->line + "\n\n", normal);
- }
- else
- {
- ui_ic_chatlog->insertHtml("color + "\">" + record->line + "");
- ui_ic_chatlog->textCursor().insertText("\n\n");
- }
- }
- m_scroll_type_changed = false;
- }
-
- // new record
- m_ic_records.append(std::make_shared(p_name, p_text, color, false));
-
- int len = m_ic_records.length();
-
- if (len > m_log_limit) // magic numbers, woo!
- {
- m_ic_records = m_ic_records.mid(len - m_log_limit);
- }
-
-
- if(m_scroll_down)
- {
- ui_ic_chatlog->moveCursor(QTextCursor::End);
- ui_ic_chatlog->insertHtml("" + p_name + "");
- ui_ic_chatlog->textCursor().insertText("\n" + p_text + "\n\n", normal);
- }
- else
- {
- ui_ic_chatlog->clear();
-
- for (record_type_ptr record : m_ic_records)
- {
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
- if (record->system == false)
- {
- ui_ic_chatlog->insertHtml("color + "\">" + record->name + "");
- ui_ic_chatlog->textCursor().insertText("\n");
- ui_ic_chatlog->textCursor().insertText(record->line + "\n\n", normal);
- }
- else
- {
- ui_ic_chatlog->insertHtml("color + "\">" + record->line + "");
- ui_ic_chatlog->textCursor().insertText("\n\n");
- }
- }
- }
-
- if (old_cursor.hasSelection() || !is_scrolled_up)
- {
- // The user has selected text or scrolled away from the top: maintain position.
- ui_ic_chatlog->setTextCursor(old_cursor);
- ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
- }
- else
- {
- // The user hasn't selected any text and the scrollbar is at the top: scroll to the top.
- ui_ic_chatlog->moveCursor(f_operation);
- ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum());
- }
-}
-
-void Courtroom::append_system_text(QString p_text)
-{
- if (chatmessage_is_empty) return;
-
- QTextCharFormat bold;
- QTextCharFormat normal;
- QString color = ao_app->read_design_ini("system_msg", ao_app->get_theme_path() + fonts_ini);
- bold.setFontWeight(QFont::Bold);
- normal.setFontWeight(QFont::Normal);
- const QTextCursor old_cursor = ui_ic_chatlog->textCursor();
- const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value();
- const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum();
- const QTextCursor::MoveOperation f_operation = m_scroll_down ? QTextCursor::End : QTextCursor::Start;
-
- //rewrite everything that was written before
- if(m_scroll_type_changed)
- {
- ui_ic_chatlog->clear();
-
- for (record_type_ptr record : m_ic_records)
- {
- ui_ic_chatlog->moveCursor(f_operation);
- if (record->system == false)
- {
- ui_ic_chatlog->insertHtml("color + "\">" + record->name + "");
- ui_ic_chatlog->textCursor().insertText("\n" + record->line + "\n\n", normal);
-
- }
- else
- {
- ui_ic_chatlog->insertHtml("color + "\">" + record->line + "");
- ui_ic_chatlog->textCursor().insertText("\n\n");
- }
- }
- m_scroll_type_changed = false;
- }
-
- // new record
- m_ic_records.append(std::make_shared("", p_text, color, true));
-
- int len = m_ic_records.length();
-
- if (len > m_log_limit) // magic numbers, woo!
- {
- m_ic_records = m_ic_records.mid(len - m_log_limit);
- }
-
- if(m_scroll_down)
- {
- ui_ic_chatlog->moveCursor(QTextCursor::End);
- ui_ic_chatlog->insertHtml("" + p_text + "");
- ui_ic_chatlog->textCursor().insertText("\n\n");
- }
- else
- {
- ui_ic_chatlog->clear();
-
- for (record_type_ptr record : m_ic_records)
- {
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
- if (record->system == false)
- {
- ui_ic_chatlog->insertHtml("color + "\">" + record->name + "");
- ui_ic_chatlog->textCursor().insertText("\n" + record->line + "\n\n", normal);
- }
- else
- {
- qDebug() << "color + ">" + record->line + "";
- ui_ic_chatlog->insertHtml("color + "\">" + record->line + "");
- ui_ic_chatlog->textCursor().insertText("\n\n");
- }
- }
- }
-
- ui_ic_chatlog->setTextColor("#000000");
-
- if (old_cursor.hasSelection() || !is_scrolled_up)
- {
- // The user has selected text or scrolled away from the top: maintain position.
- ui_ic_chatlog->setTextCursor(old_cursor);
- ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
- }
- else
- {
- // The user hasn't selected any text and the scrollbar is at the top: scroll to the top.
- ui_ic_chatlog->moveCursor(f_operation);
- ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum());
- }
-}
-
-void Courtroom::play_preanim()
-{
- QString f_char = m_chatmessage[CHAR_NAME];
- QString f_preanim = m_chatmessage[PRE_EMOTE];
-
- //all time values in char.inis are multiplied by a constant(time_mod) to get the actual time
- 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;
-
- int preanim_duration;
-
- if (ao2_duration < 0)
- preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim);
- else
- preanim_duration = ao2_duration;
-
- sfx_delay_timer->start(sfx_delay);
-
- if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif") ||
- preanim_duration < 0)
- {
- anim_state = 1;
- preanim_done();
- qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif";
- return;
- }
-
- ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration, showed);
-
- anim_state = 1;
- if (text_delay >= 0)
- text_delay_timer->start(text_delay);
-
-}
-
-void Courtroom::preanim_done()
-{
- handle_chatmessage_3();
-}
-
-void Courtroom::realization_done()
-{
- ui_vp_effect->stop();
-}
-
-QString Courtroom::parse_message(QString message)
-{
- QVector f_vec = ao_app->get_highlight_color();
-
- for(int i=0; i"));
- message.remove(i, 1);
- message.insert(i, QString(""));
- }
- }
- break;
- }
- }
- }
-
- return message;
-}
-
-void Courtroom::start_chat_ticking()
-{
- ui_vp_message->clear();
- set_text_color();
- rainbow_counter = 0;
- //we need to ensure that the text isn't already ticking because this function can be called by two logic paths
- if (text_state != 0)
- return;
-
- if (chatmessage_is_empty)
- {
- //since the message is empty, it's technically done ticking
- text_state = 2;
- return;
- }
-
- ui_vp_chatbox->show();
-
- tick_pos = 0;
- blip_pos = 0;
- chat_tick_timer->start(chat_tick_interval);
-
- QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]);
-
- // m_blip_player->set_file(f_gender);
- m_blip_player->set_blips("sfx-blip" + f_gender + ".wav");
-
- //means text is currently ticking
- text_state = 1;
-}
-
-void Courtroom::chat_tick()
-{
- //note: this is called fairly often(every 60 ms when char is talking)
- //do not perform heavy operations here
-
- QString f_message = m_chatmessage[MESSAGE];
-// QString parsed_message = parse_message(f_message);
-// qDebug() << "parsed:" << parsed_message;
-
- if (tick_pos >= f_message.size())
- {
- text_state = 2;
- chat_tick_timer->stop();
- anim_state = 3;
- ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE], showed);
- m_string_color = "";
- m_color_stack.clear();
- }
-
- else
- {
- QString f_character = f_message.at(tick_pos);
- f_character = f_character.toHtmlEscaped();
- //qDebug() << f_character;
-
- if (f_character == " ")
- ui_vp_message->insertPlainText(" ");
- else if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW)
- {
- QString html_color;
-
- switch (rainbow_counter)
- {
- case 0:
- html_color = "#FF0000";
- break;
- case 1:
- html_color = "#FF7F00";
- break;
- case 2:
- html_color = "#FFFF00";
- break;
- case 3:
- html_color = "#00FF00";
- break;
- default:
- html_color = "#2d96ff";
- rainbow_counter = -1;
- }
-
- ++rainbow_counter;
-
- ui_vp_message->insertHtml("" + f_character + "");
- }
- else if(ao_app->read_design_ini("enable_highlighting", ao_app->get_theme_path() + cc_config_ini) == "true")
- {
- bool found = false;
- QVector f_vec = ao_app->get_highlight_color();
- if(m_color_stack.isEmpty()) m_color_stack.push("");
-
- for(const auto& col : f_vec)
- {
- if(f_character == col[0].trimmed()[0] && m_string_color != col[1].trimmed())
- {
- m_color_stack.push(col[1].trimmed());
- m_string_color = m_color_stack.top();
- found = true;
- break;
- }
- }
-
- //qDebug() << "character = " << f_character << "color=" << m_string_color;
- ui_vp_message->insertHtml("" + f_character + "");
-
- for(const auto& col : f_vec)
- {
- if(f_character == col[0].trimmed()[1] && !found)
- {
- if(m_color_stack.size() > 1) m_color_stack.pop();
- m_string_color = m_color_stack.top();
- break;
- }
-
- }
- }
-// else if(ao_app->read_design_ini("enable_highlighting", ao_app->get_theme_path() + cc_config_ini) == "extra")
-// {
-// QString ch = parsed_message.at(tick_pos);
-// ui_vp_message->insertHtml(ch);
-// }
- else
- {
- ui_vp_message->insertHtml(f_character);
- }
- QScrollBar *scroll = ui_vp_message->verticalScrollBar();
- scroll->setValue(scroll->maximum());
-
- if(blank_blip)
- qDebug() << "blank_blip found true";
-
- if ((f_message.at(tick_pos) != ' ' || blank_blip))
- {
-
- if (blip_pos % blip_rate == 0)
- {
- blip_pos = 0;
-
- // play blip
- // m_blip_player->play();
- m_blip_player->blip_tick();
- }
-
- ++blip_pos;
- }
-
- ++tick_pos;
- }
-}
-
-void Courtroom::show_testimony()
-{
- if (!testimony_in_progress || m_chatmessage[SIDE] != "wit")
- return;
-
- ui_vp_testimony->show();
-
- testimony_show_timer->start(testimony_show_time);
-}
-
-void Courtroom::hide_testimony()
-{
- ui_vp_testimony->hide();
-
- if (!testimony_in_progress)
- return;
-
- testimony_hide_timer->start(testimony_hide_time);
-}
-
-void Courtroom::play_sfx()
-{
- QString sfx_name = m_chatmessage[SFX_NAME];
- if (sfx_name == "1")
- return;
-
- QString f_ext = file_exists(ao_app->get_base_path() + "/sounds/general/" + sfx_name, QVector{ "", ".ogg", ".wav", ".mp3"});
-
- m_sfx_player->play(sfx_name + f_ext);
-}
-
-void Courtroom::set_scene()
-{
- if (testimony_in_progress)
- show_testimony();
-
- //witness is default if pos is invalid
- QString f_background = "witnessempty";
- QString f_desk_image = "stand";
- QString f_desk_mod = m_chatmessage[DESK_MOD];
- QString f_side = m_chatmessage[SIDE];
- QString ini_path = ao_app->get_background_path() + "backgrounds.ini";
-
- if (file_exists(ini_path))
- {
- f_background = ao_app->read_design_ini(f_side, ini_path);
- f_desk_image = ao_app->read_design_ini(f_side + "_desk", ini_path);
-
- if (f_desk_mod == "0") // keeping a bit of the functionality for now
- {
- ui_vp_desk->hide();
- ui_vp_legacy_desk->hide();
- }
- }
- else
- {
- if (f_side == "def")
- {
- f_background = "defenseempty";
- if (is_ao2_bg)
- f_desk_image = "defensedesk";
- else
- f_desk_image = "bancodefensa";
- }
- else if (f_side == "pro")
- {
- f_background = "prosecutorempty";
- if (is_ao2_bg)
- f_desk_image = "prosecutiondesk";
- else
- f_desk_image = "bancoacusacion";
- }
- else if (f_side == "jud")
- {
- f_background = "judgestand";
- f_desk_image = "judgedesk";
- }
- else if (f_side == "hld")
- {
- f_background = "helperstand";
- f_desk_image = "helperdesk";
- }
- else if (f_side == "hlp")
- {
- f_background = "prohelperstand";
- f_desk_image = "prohelperdesk";
- }
- else
- {
- if (is_ao2_bg)
- f_desk_image = "stand";
- else
- f_desk_image = "estrado";
- }
-
- if (f_desk_mod == "0" || (f_desk_mod != "1" &&
- (f_side == "jud" ||
- f_side == "hld" ||
- f_side == "hlp")))
- {
- ui_vp_desk->hide();
- ui_vp_legacy_desk->hide();
- }
- else if (is_ao2_bg || (f_side == "jud" ||
- f_side == "hld" ||
- f_side == "hlp"))
- {
- ui_vp_legacy_desk->hide();
- ui_vp_desk->show();
- }
- else
- {
- if (f_side == "wit")
- {
- ui_vp_desk->show();
- ui_vp_legacy_desk->hide();
- }
- else
- {
- ui_vp_desk->hide();
- ui_vp_legacy_desk->show();
- }
- }
- }
-
- ui_vp_background->set_image(f_background);
- ui_vp_desk->set_image(f_desk_image);
- ui_vp_legacy_desk->set_legacy_desk(f_desk_image);
-}
-
-void Courtroom::set_text_color()
-{
- switch (m_chatmessage[TEXT_COLOR].toInt())
- {
- case GREEN:
- ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: rgb(0, 255, 0)");
- break;
- case RED:
- ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: red");
- break;
- case ORANGE:
- ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: orange");
- break;
- case BLUE:
- ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: rgb(45, 150, 255)");
- break;
- case YELLOW:
- ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: yellow");
- break;
- default:
- qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR];
- case WHITE:
- ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: white");
-
- }
-}
-
-void Courtroom::set_ip_list(QString p_list)
-{
- QString f_list = p_list.replace("|", ":").replace("*", "\n");
-
- ui_server_chatlog->append(f_list);
-}
-
-void Courtroom::set_mute(bool p_muted, int p_cid)
-{
- if (p_cid != m_cid && p_cid != -1)
- return;
-
- if (p_muted)
- ui_muted->show();
- else
- {
- ui_muted->hide();
- ui_ic_chat_message->setFocus();
- }
-
- ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height());
- ui_muted->set_image("muted.png");
-
- is_muted = p_muted;
- ui_ic_chat_message->setEnabled(!p_muted);
-}
-
-void Courtroom::set_ban(int p_cid)
-{
- if (p_cid != m_cid && p_cid != -1)
- return;
-
- call_notice("You have been banned.");
-
- ao_app->construct_lobby();
- ao_app->destruct_courtroom();
-}
-
-void Courtroom::handle_song(QStringList *p_contents)
-{
-
- QStringList f_contents = *p_contents;
-
- if (f_contents.size() < 2)
- return;
-
- QString f_song = f_contents.at(0);
- int n_char = f_contents.at(1).toInt();
-
- for (auto& ext : QStringList { "", ".wav", ".ogg", ".mp3" })
- {
- QString r_song = f_song + ext;
- QString song_path = ao_app->get_base_path() + "sounds/music/" + r_song.toLower();
- if (file_exists(song_path))
- {
- f_song = r_song;
- break;
- }
- }
-
- if (n_char < 0 || n_char >= char_list.size())
- {
- m_music_player->play(f_song);
- }
- else
- {
- // This 2th argument corresponds to the showname to use when displaying the
- // music change message in IC
- // Backwards compatibility is explicitly kept for older versions of tsuserver
- // that do not send such an argument by assuming an empty showname
- // If there is an empty showname, the client will use instead the default
- // showname of the character.
- QString f_showname;
- if (f_contents.size() == 3) {
- f_showname = f_contents.at(2);
- } else {
- f_showname = "";
- }
-
- QString str_char;
- if (f_showname.isEmpty()) {
- str_char = ao_app->get_showname(char_list.at(n_char).name);
- } else {
- str_char = f_showname;
- }
-
- if (!mute_map.value(n_char))
- {
- QString music_change_log = ao_app->read_config("music_change_log");
-
- if (music_change_log == ("false"))
- {
- m_music_player->play(f_song);
- }
- else
- {
- append_ic_text("has played a song: " + f_song, str_char);
- m_music_player->play(f_song);
- }
- }
- }
-
- int pos = f_song.lastIndexOf(QChar('.'));
- QString r_song = f_song.left(pos);
-
- ui_vp_music_name->setText(r_song);
-
- handle_music_anim();
-}
-
-void Courtroom::handle_wtce(QString p_wtce)
-{
- QString sfx_file = cc_sounds_ini;
-
- int index = p_wtce.at(p_wtce.size() - 1).digitValue();
- if (index > 0 && index < wtce_names.size() + 1 && wtce_names.size() > 0) // check to prevent crash
- {
- p_wtce.chop(1); // looking for the 'testimony' part
- if (p_wtce == "testimony")
- {
- m_sfx_player->play(ao_app->get_sfx(wtce_names[index-1]));
- ui_vp_wtce->play(wtce_names[index-1]);
- if (index == 1)
- {
- testimony_in_progress = true;
- }
- else if (index == 2)
- testimony_in_progress = false;
- }
- }
-}
-
-void Courtroom::set_hp_bar(int p_bar, int p_state)
-{
- if (p_state < 0 || p_state > 10)
- return;
-
- if (p_bar == 1)
- {
- ui_defense_bar->set_image("defensebar" + QString::number(p_state) + ".png");
- defense_bar_state = p_state;
- }
- else if (p_bar == 2)
- {
- ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + ".png");
- prosecution_bar_state = p_state;
- }
-}
-
-void Courtroom::check_shouts()
-{
- QString char_path = ao_app->get_character_path(current_char);
- QString theme_path = ao_app->get_theme_path();
- for(int i = 0; i < ui_shouts.size(); ++i)
- {
- if(file_exists(char_path + shout_names.at(i) + ".gif") || file_exists(theme_path + shout_names.at(i) + ".gif") || file_exists(theme_path + shout_names.at(i) + ".apng"))
- shouts_enabled[i] = true;
- else shouts_enabled[i] = false;
- }
-}
-
-void Courtroom::check_effects()
-{
- QString char_path = ao_app->get_character_path(current_char);
- QString theme_path = ao_app->get_theme_path();
- for(int i = 0; i < effect_names.size(); ++i)
- {
- if(file_exists(theme_path + effect_names.at(i) + ".gif") || file_exists(theme_path + effect_names.at(i) + ".apng"))
- effects_enabled[i] = true;
- else effects_enabled[i] = false;
- }
-}
-
-void Courtroom::check_wtce()
-{
- QString char_path = ao_app->get_character_path(current_char);
- QString theme_path = ao_app->get_theme_path();
- for(int i = 0; i < ui_wtce.size(); ++i)
- {
- if(file_exists(char_path + wtce_names.at(i) + ".gif") || file_exists(theme_path + wtce_names.at(i) + ".gif") || file_exists(theme_path + wtce_names.at(i) + ".apng"))
- wtce_enabled[i] = true;
- else wtce_enabled[i] = false;
- }
-}
-
-void Courtroom::mod_called(QString p_ip)
-{
- ui_server_chatlog->append(p_ip);
- if (ui_guard->isChecked())
- {
- m_mod_player->play(ao_app->get_sfx("mod_call"));
- ao_app->alert(this);
- }
-}
-
-void Courtroom::on_ooc_return_pressed()
-{
- QString ooc_message = ui_ooc_chat_message->text();
-
- if (ooc_message == "" || ui_ooc_chat_name->text() == "")
- return;
-
- if (ooc_message.startsWith("/pos"))
- {
- if (ooc_message.startsWith("/pos jud"))
- {
- is_judge = true;
- set_wtce();
-
- ui_defense_minus->show();
- ui_defense_plus->show();
- ui_prosecution_minus->show();
- ui_prosecution_plus->show();
- }
- else
- {
- is_judge = false;
- set_wtce();
-
- ui_defense_minus->hide();
- ui_defense_plus->hide();
- ui_prosecution_minus->hide();
- ui_prosecution_plus->hide();
- }
- }
- else if (ooc_message.startsWith("/login"))
- ui_guard->show();
- else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended)
- {
- ui_text_color->addItem("Rainbow");
- ui_ooc_chat_message->clear();
- rainbow_appended = true;
- return;
- }
- else if (ooc_message.startsWith("/switch_am"))
- {
- on_switch_area_music_clicked();
- ui_ooc_chat_message->clear();
- return;
- }
- else if (ooc_message.startsWith("/roll"))
- {
- m_sfx_player->play(ao_app->get_sfx("dice"));
- }
- else if (ooc_message.startsWith("/rollp"))
- {
- m_sfx_player->play(ao_app->get_sfx("dice"));
- }
- else if (ooc_message.startsWith("/coinflip"))
- {
- m_sfx_player->play(ao_app->get_sfx("coinflip"));
- }
- QStringList packet_contents;
- packet_contents.append(ui_ooc_chat_name->text());
- packet_contents.append(ooc_message);
-
- AOPacket *f_packet = new AOPacket("CT", packet_contents);
-
- if (server_ooc)
- ao_app->send_server_packet(f_packet);
- else
- ao_app->send_ms_packet(f_packet);
-
- ui_ooc_chat_message->clear();
-
- ui_ooc_chat_message->setFocus();
-}
-
-void Courtroom::on_ooc_toggle_clicked()
-{
- if (server_ooc)
- {
- ui_ms_chatlog->show();
- ui_server_chatlog->hide();
- ui_ooc_toggle->setText("Master");
-
- server_ooc = false;
- }
- else
- {
- ui_ms_chatlog->hide();
- ui_server_chatlog->show();
- ui_ooc_toggle->setText("Server");
-
- server_ooc = true;
- }
-}
-
-void Courtroom::on_music_search_edited(QString p_text)
-{
- //preventing compiler warnings
- p_text += "a";
- list_music();
- list_areas();
-}
-
-void Courtroom::on_sfx_search_edited(QString p_text)
-{
- //preventing compiler warnings
- p_text += "a";
- list_sfx();
-}
-
-void Courtroom::on_pos_dropdown_changed(int p_index)
-{
- ui_ic_chat_message->setFocus();
-
- if (p_index < 0 || p_index > 5)
- return;
-
- QString f_pos;
-
- switch (p_index)
- {
- case 0:
- f_pos = "wit";
- break;
- case 1:
- f_pos = "def";
- break;
- case 2:
- f_pos = "pro";
- break;
- case 3:
- f_pos = "jud";
- break;
- case 4:
- f_pos = "hld";
- break;
- case 5:
- f_pos = "hlp";
- break;
- default:
- f_pos = "";
- }
-
- if (f_pos == "" || ui_ooc_chat_name->text() == "")
- return;
-
- ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%"));
-}
-
-void Courtroom::on_mute_list_clicked(QModelIndex p_index)
-{
- QListWidgetItem *f_item = ui_mute_list->item(p_index.row());
- QString f_char = f_item->text();
- QString real_char;
-
- if (f_char.endsWith(" [x]"))
- real_char = f_char.left(f_char.size() - 4);
- else
- real_char = f_char;
-
- int f_cid = -1;
-
- for (int n_char = 0 ; n_char < char_list.size() ; n_char++)
- {
- if (char_list.at(n_char).name == real_char)
- f_cid = n_char;
- }
-
- if (f_cid < 0 || f_cid >= char_list.size())
- {
- qDebug() << "W: " << real_char << " not present in char_list";
- return;
- }
-
- if (mute_map.value(f_cid))
- {
- mute_map.insert(f_cid, false);
- f_item->setText(real_char);
- }
- else
- {
- mute_map.insert(f_cid, true);
- f_item->setText(real_char + " [x]");
- }
-
-
-
- /*
- if (f_char.endsWith(" [x]"))
- {
- real_char = f_char.left(f_char.size() - 4);
- mute_map.remove(real_char);
- mute_map.insert(real_char, false);
- f_item->setText(real_char);
- }
- else
- {
- real_char = f_char;
- mute_map.remove(real_char);
- mute_map.insert(real_char, true);
- f_item->setText(real_char + " [x]");
- }
- */
-}
-
-void Courtroom::on_music_list_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_area_list_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_music_list_double_clicked(QModelIndex p_model)
-{
- if (is_muted)
- return;
-
- QString p_song = ui_music_list->item(p_model.row())->text();
-
- ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false);
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_area_list_double_clicked(QModelIndex p_model)
-{
- QString p_area = ui_area_list->item(p_model.row())->text();
-
- ao_app->send_server_packet(new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"), false);
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::reset_shout_buttons()
-{
- for(int i = 0; i < ui_shouts.size(); ++i)
- ui_shouts[i]->set_image(shout_names.at(i) + ".png");
-
- if(m_objection_state != 0 && ui_shouts.size() > 0) // check to prevent crashing
- ui_shouts.at(m_objection_state-1)->set_image(shout_names.at(m_objection_state-1) + "_selected.png");
-}
-
-void Courtroom::on_shout_clicked()
-{
- AOButton *f_shout_button = static_cast(sender());
- int f_shout_id = f_shout_button->property("shout_id").toInt();
-
- // update based on current button selected
- if (f_shout_id == m_objection_state)
- m_objection_state = 0;
- else
- m_objection_state = f_shout_id;
-
- reset_shout_buttons();
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_cycle_clicked()
-{
- AOButton *f_cycle_button = static_cast(sender());
- int f_cycle_id = f_cycle_button->property("cycle_id").toInt();
-
- switch(f_cycle_id)
- {
- case 5:
- cycle_wtce(-1);
- break;
- case 4:
- cycle_wtce(1);
- break;
- case 3:
- cycle_effect(-1);
- break;
- case 2:
- cycle_effect(1);
- break;
- case 1:
- cycle_shout(-1);
- break;
- case 0:
- cycle_shout(1);
- break;
- default:
- break;
- }
-
- if(ao_app->read_design_ini("enable_cycle_ding", ao_app->get_theme_path() + cc_config_ini) == "true")
- m_cycle_player->play(ao_app->get_sfx("cycle"));
-
- set_shouts();
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::cycle_shout(int p_index)
-{
- int n = ui_shouts.size();
- do { m_shout_state = (m_shout_state - p_index + n) % n; } while( !shouts_enabled[m_shout_state] );
-
- set_shouts();
-}
-
-void Courtroom::cycle_effect(int p_index)
-{
- int n = ui_effects.size();
- do { m_effect_current = (m_effect_current - p_index + n) % n; } while( !effects_enabled[m_effect_current] );
-
- set_effects();
-}
-
-void Courtroom::cycle_wtce(int p_index)
-{
- int n = ui_wtce.size();
- do { m_wtce_current = (m_wtce_current - p_index + n) % n; } while( !wtce_enabled[m_wtce_current] );
-
- set_wtce();
-}
-
-void Courtroom::reset_effect_buttons()
-{
- for(int i = 0; i < effect_names.size(); ++i) // effect names does not necessarily have the same size as ui effects
- {
-// qDebug() << effect_names << i;
- ui_effects[i]->set_image(effect_names.at(i) + ".png");
- }
-
- if(m_effect_state != 0 && ui_effects.size() > 0) // check to prevent crashing
- ui_effects[m_effect_state-1]->set_image(effect_names.at(m_effect_state-1) + "_pressed.png");
-}
-
-void Courtroom::on_effect_button_clicked()
-{
- AOButton *f_button = static_cast(this->sender());
-
- int f_effect_id = f_button->property("effect_id").toInt();
- if (m_effect_state == f_effect_id)
- m_effect_state = 0;
- else
- m_effect_state = f_effect_id;
-
- reset_effect_buttons();
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_mute_clicked()
-{
- if (ui_mute_list->isHidden())
- {
- ui_mute_list->show();
- ui_mute->set_image("mute_pressed.png");
- }
- else
- {
- ui_mute_list->hide();
- ui_mute->set_image("mute.png");
- }
-}
-
-void Courtroom::on_defense_minus_clicked()
-{
- int f_state = defense_bar_state - 1;
-
- if (f_state >= 0)
- ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
-}
-
-void Courtroom::on_defense_plus_clicked()
-{
- int f_state = defense_bar_state + 1;
-
- if (f_state <= 10)
- ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
-}
-
-void Courtroom::on_prosecution_minus_clicked()
-{
- int f_state = prosecution_bar_state - 1;
-
- if (f_state >= 0)
- ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
-}
-
-void Courtroom::on_prosecution_plus_clicked()
-{
- int f_state = prosecution_bar_state + 1;
-
- if (f_state <= 10)
- ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
-}
-
-void Courtroom::on_text_color_changed(int p_color)
-{
- m_text_color = p_color;
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_music_slider_moved(int p_value)
-{
- m_music_player->set_volume(p_value);
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_sfx_slider_moved(int p_value)
-{
- m_sfx_player->set_volume(p_value);
- m_shout_player->set_volume(p_value);
- m_cycle_player->set_volume(p_value);
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_blip_slider_moved(int p_value)
-{
- m_blip_player->set_volume(p_value);
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_witness_testimony_clicked()
-{
- if (is_muted)
- return;
-
- ao_app->send_server_packet(new AOPacket("RT#testimony1#%"));
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_cross_examination_clicked()
-{
- if (is_muted)
- return;
-
- ao_app->send_server_packet(new AOPacket("RT#testimony2#%"));
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::reset_wtce_buttons() // kind of an unnecessary function, but I added it just in case
-{
- for(int i = 0; i < wtce_names.size(); ++i) // effect names does not necessarily have the same size as ui effects
- {
- ui_wtce[i]->set_image(wtce_names.at(i) + ".png");
- }
-}
-
-void Courtroom::on_wtce_clicked()
-{
-// qDebug() << "AA: wtce clicked!";
- if (is_muted)
- return;
-
- AOButton* f_sig = static_cast(sender());
- QString id = f_sig->property("wtce_id").toString();
-
- QString packet = QString("RT#testimony%1#%").arg(id);
-
- ao_app->send_server_packet(new AOPacket(packet));
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_change_character_clicked()
-{
- m_music_player->set_volume(0);
- m_sfx_player->set_volume(0);
- m_sfx_player->set_volume(0);
- m_blip_player->set_volume(0);
-
- set_char_select();
-
- ui_char_select_background->show();
- ui_spectator->hide();
-}
-
-void Courtroom::on_reload_theme_clicked()
-{
- ao_app->reload_theme();
-
- //to update status on the background
- set_background(current_background);
- enter_courtroom(m_cid);
-
- anim_state = 4;
- text_state = 3;
-}
-
-void Courtroom::on_back_to_lobby_clicked()
-{
- ao_app->construct_lobby();
- ao_app->w_lobby->list_servers();
- ao_app->destruct_courtroom();
-}
-
-void Courtroom::on_confirm_theme_clicked()
-{
- ao_app->write_theme(ui_theme_list->currentText());
-}
-
-void Courtroom::on_char_select_left_clicked()
-{
- --current_char_page;
- set_char_select_page();
-}
-
-void Courtroom::on_char_select_right_clicked()
-{
- ++current_char_page;
- set_char_select_page();
-}
-
-void Courtroom::on_spectator_clicked()
-{
- enter_courtroom(-1);
-
- ui_emotes->hide();
-
- ui_char_select_background->hide();
-}
-
-void Courtroom::on_call_mod_clicked()
-{
- QMessageBox::StandardButton reply;
- reply = QMessageBox::warning(this, "Warning", "Are you sure you want to call a mod? They will get angry at you if the reason is no good.", QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
-
- if(reply == QMessageBox::Yes)
- {
- ao_app->send_server_packet(new AOPacket("ZZ#%"));
- qDebug() << "Called mod";
- }
- else
- qDebug() << "Did not call mod";
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_switch_area_music_clicked()
-{
- if (ui_area_list->isHidden())
- {
- ui_area_list->show();
- ui_music_list->hide();
- }
- else
- {
- ui_area_list->hide();
- ui_music_list->show();
- }
-}
-
-
-void Courtroom::on_pre_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_flip_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_guard_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_hidden_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_evidence_button_clicked()
-{
- if (ui_evidence->isHidden())
- {
- ui_evidence->show();
- ui_evidence_overlay->hide();
- }
- else
- {
- ui_evidence->hide();
- }
-}
-
-void Courtroom::on_note_button_clicked()
-{
- if(!note_shown)
- {
- load_note();
- ui_vp_notepad_image->show();
- ui_vp_notepad->show();
- ui_vp_notepad->setFocus();
- note_shown = true;
- }
- else
- {
- save_note();
- ui_vp_notepad_image->hide();
- ui_vp_notepad->hide();
- ui_ic_chat_message->setFocus();
- note_shown = false;
- }
-}
-
-void Courtroom::on_note_text_changed()
-{
- ao_app->write_note(ui_vp_notepad->toPlainText(), current_file);
-}
-
-void Courtroom::ping_server()
-{
- ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%"));
-}
-
-void Courtroom::on_sfx_list_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_set_notes_clicked()
-{
- if(note_scroll_area->isHidden())
- note_scroll_area->show();
- else
- note_scroll_area->hide();
-}
-
-void Courtroom::set_bullets()
-{
- QString somethingsomethingpath = ao_app->get_base_path() + "configs/" + "wow.ini";
-
- QString thing = "";
- int i = 0;
- do
- {
- thing = ao_app->read_design_ini(QString::number(++i), somethingsomethingpath);
- //qDebug() << QString::number(i) << thing;
- } while(thing != "");
-}
diff --git a/courtroom.h b/courtroom.h
deleted file mode 100644
index 27393ef21..000000000
--- a/courtroom.h
+++ /dev/null
@@ -1,739 +0,0 @@
-#ifndef COURTROOM_H
-#define COURTROOM_H
-
-#include "aoimage.h"
-#include "aobutton.h"
-#include "aocharbutton.h"
-#include "aoemotebutton.h"
-#include "aopacket.h"
-#include "aoscene.h"
-#include "aomovie.h"
-#include "aocharmovie.h"
-
-#include "aobasshandle.hpp"
-#include "aoblipplayer.h"
-#include "aomusicplayer.h"
-#include "aosfxplayer.h"
-#include "aoshoutplayer.hpp"
-
-#include "aoevidencebutton.h"
-#include "aotextarea.h"
-#include "aolineedit.h"
-#include "aotextedit.h"
-#include "aoevidencedisplay.h"
-#include "aonotepad.h"
-#include "aonotearea.hpp"
-#include "aolabel.hpp"
-#include "datatypes.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-class AOApplication;
-
-class Courtroom : public QMainWindow
-{
- Q_OBJECT
-public:
- explicit Courtroom(AOApplication *p_ao_app);
-
- void append_char(char_type p_char){char_list.append(p_char);}
- 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 clear_music(){music_list.clear();}
- void clear_areas(){area_list.clear();}
-
- void fix_last_area()
- {
- if (area_list.size() > 0)
- {
- QString malplaced = area_list.last();
- area_list.removeLast();
- append_music(malplaced);
-// qDebug() << "what" << malplaced;
- }
- }
-
- //sets position of widgets based on theme ini files
- void set_widgets();
- //sets font size based on theme ini files
- void set_font(QWidget *widget, QString p_identifier);
- //helper function that calls above function on the relevant widgets
- void set_fonts();
-
- //sets dropdown menu stylesheet
- void set_dropdown(QWidget *widget, QString target_tag);
-
- //helper funciton that call above function on the relevant widgets
- void set_dropdowns();
-
- void set_window_title(QString p_title);
-
- //reads theme inis and sets size and pos based on the identifier
- void set_size_and_pos(QWidget *p_widget, 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);
-
- //sets the current background to argument. also does some checks to see if it's a legacy bg
- void set_background(QString p_background);
-
- //sets the evidence list member variable to argument
- void set_evidence_list(QVector &p_evi_list);
-
- //called when a DONE#% from the server was received
- void done_received();
-
- //sets the local mute list based on characters available on the server
- void set_mute_list();
-
- //sets desk and bg based on pos in chatmessage
- void set_scene();
-
- //sets text color based on text color in chatmessage
- void set_text_color();
-
- //takes in serverD-formatted IP list as prints a converted version to server OOC
- //admittedly poorly named
- void set_ip_list(QString p_list);
-
- //disables chat if current cid matches second argument
- //enables if p_muted is false
- void set_mute(bool p_muted, int p_cid);
-
- //send a message that the player is banned and quits the server
- void set_ban(int p_cid);
-
- //implementations in path_functions.cpp
- QString get_background_path();
- QString get_default_background_path();
-
- //cid = character id, returns the cid of the currently selected character
- int get_cid() {return m_cid;}
- QString get_current_char() {return current_char;}
-
- //properly sets up some varibles: resets user state
- void enter_courtroom(int p_cid);
-
- //helper function that populates ui_music_list with the contents of music_list
- void list_music();
-
- void list_areas();
-
- void list_sfx();
-
- void list_themes();
-
- void list_note_files();
-
- void set_note_files();
-
- void move_widget(QWidget *p_widget, QString p_identifier);
-
- void set_shouts();
-
- void set_effects();
-
- void set_wtce();
-
- //these are for OOC chat
- void append_ms_chatmessage(QString f_name, QString f_message);
- void append_server_chatmessage(QString p_name, QString p_message);
-
- //these functions handle chatmessages sequentially.
- //The process itself is very convoluted and merits separate documentation
- //But the general idea is objection animation->pre animation->talking->idle
- void handle_chatmessage(QStringList *p_contents);
- void handle_chatmessage_2();
- void handle_chatmessage_3();
-
- //handles character portrait animation
- void handle_char_anim(AOCharMovie *charPlayer);
- void handle_char_anim_2(AOCharMovie *charPlayer);
-
- //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 selected
- // or the user isn't already scrolled to the top
- void append_ic_text(QString p_text, QString p_name = "");
-
- void append_system_text(QString p_text);
-
- //prints who played the song to IC chat and plays said song(if found on local filesystem)
- //takes in a list where the first element is the song name and the second is the char id of who played it
- void handle_song(QStringList *p_contents);
-
- //animates music text
- void handle_music_anim();
-
- //handle server-side clock animation and display
- void handle_clock(QString time);
-
- void play_preanim();
-
- QString parse_message(QString message);
-
- //plays the witness testimony or cross examination animation based on argument
- void handle_wtce(QString p_wtce);
-
- //sets the hp bar of defense(p_bar 1) or pro(p_bar 2)
- //state is an number between 0 and 10 inclusive
- void set_hp_bar(int p_bar, int p_state);
-
- void check_connection_received();
-
- //checks whether shout/effect files are found
- void check_shouts();
- void check_effects();
- void check_wtce();
-
-private:
- AOApplication *ao_app = nullptr;
-
- int m_courtroom_width = 714;
- int m_courtroom_height = 668;
-
- int m_viewport_x = 0;
- int m_viewport_y = 0;
-
- int m_viewport_width = 256;
- int m_viewport_height = 192;
-
- QVector char_list;
- QVector evidence_list;
- QVector music_list;
- QVector area_list;
- QVector sfx_names;
- QVector area_names;
- QVector note_list;
-
- QSignalMapper *char_button_mapper;
-
- //triggers ping_server() every 60 seconds
- QTimer *keepalive_timer;
-
- //determines how fast messages tick onto screen
- QTimer *chat_tick_timer;
- int chat_tick_interval = 60;
- //which tick position(character in chat message) we are at
- int tick_pos = 0;
- //used to determine how often blips sound
- int blip_pos = 0;
- int blip_rate = 1;
- int rainbow_counter = 0;
- bool rainbow_appended = false;
- bool blank_blip = false;
- bool note_shown = false;
- bool contains_add_button = false;
-
- //////////////
- QScrollArea *note_scroll_area;
-
- //delay before chat messages starts ticking
- QTimer *text_delay_timer;
-
- //delay before sfx plays
- QTimer *sfx_delay_timer;
-
- //keeps track of how long realization is visible(it's just a white square and should be visible less than a second)
- QTimer *realization_timer;
-
- //times how long the blinking testimony should be shown(green one in the corner)
- QTimer *testimony_show_timer;
- //times how long the blinking testimony should be hidden
- QTimer *testimony_hide_timer;
-
- //Generate a File Name based on the time you launched the client
- QString icchatlogsfilename = QDateTime::currentDateTime().toString("'logs/'ddd MMMM yyyy hh.mm.ss.z'.txt'");
-
- //configuration files locations
- QString rpc_ini = "configs/rpccharlist.ini";
- QString file_select_ini = "configs/filesabstract.ini";
- QString shownames_ini = "configs/shownames.ini";
- //theme files locations
- QString design_ini = "courtroom_design.ini";
- QString fonts_ini = "courtroom_fonts.ini";
- QString cc_config_ini = "courtroom_config.ini";
- QString cc_sounds_ini = "courtroom_sounds.ini";
-
- //every time point in char.inis times this equals the final time
- const int time_mod = 40;
-
- static const int chatmessage_size = 16;
- QString m_chatmessage[chatmessage_size];
- bool chatmessage_is_empty = false;
-
- QString previous_ic_message = "";
-
- QString m_string_color = "";
-
- QStack m_color_stack;
-
- bool testimony_in_progress = false;
-
- //in milliseconds
- const int testimony_show_time = 1500;
-
- //in milliseconds
- const int testimony_hide_time = 500;
-
- //char id, muted or not
- QMap mute_map;
-
- //QVector muted_cids;
-
- bool is_muted = false;
-
- //state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle
- int anim_state = 3;
-
- //state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = ticking done
- int text_state = 2;
-
- //character id, which index of the char_list the player is
- int m_cid = -1;
-
- bool showed = true;
-
- //cid and this may differ in cases of ini-editing
- QString current_char = "";
-
- QString current_file = "";
-
- int m_objection_state = 0;
- int m_effect_state = 0;
- int m_text_color = 0;
- int m_shout_state = 0;
- int m_effect_current = 0;
- int m_wtce_current = 0;
- bool is_presenting_evidence = false;
- bool is_judge = false;
- bool is_system_speaking = false;
-
- int defense_bar_state = 0;
- int prosecution_bar_state = 0;
-
- int current_char_page = 0;
- int char_columns = 10;
- int char_rows = 9;
- int max_chars_on_page = 90;
-
- int current_emote_page = 0;
- int current_emote = 0;
- int prev_emote = 0;
- int emote_columns = 5;
- int emote_rows = 2;
- int max_emotes_on_page = 10;
-
- int m_log_limit = 200;
- bool m_scroll_down = false;
- bool m_previously_scroll_down = false;
- bool m_scroll_type_changed = false;
-
-// int note_amount = 0;
-
- QVector local_evidence_list;
-
- int current_evidence_page = 0;
- int current_evidence = 0;
- int evidence_columns = 6;
- int evidence_rows = 3;
- int max_evidence_on_page = 18;
-
- //is set to true if the bg folder contains defensedesk.png, prosecutiondesk.png and stand.png
- bool is_ao2_bg = false;
-
- //whether the ooc chat is server or master chat, true is server
- bool server_ooc = true;
-
- int current_clock = -1;
-
- QString current_background = "gs4";
-
- AOBlipPlayer* m_blip_player = nullptr;
- AOSfxPlayer* m_mod_player = nullptr;
- AOMusicPlayer* m_music_player = nullptr;
- AOSfxPlayer* m_sfx_player = nullptr;
- AOSfxPlayer* m_cycle_player = nullptr;
- AOShoutPlayer* m_shout_player = nullptr;
-
- AOImage *ui_background;
-
- QWidget *ui_viewport;
- AOScene *ui_vp_background;
- AOMovie *ui_vp_speedlines;
- AOCharMovie *ui_vp_player_char;
- AOScene *ui_vp_desk;
- AOScene *ui_vp_legacy_desk;
- AOEvidenceDisplay *ui_vp_evidence_display;
-
- AONoteArea *ui_note_area;
-
-// AONotepad *ui_vp_notepad;
-
- // list of characters that require a second application ID
- // note that since it's hardcoded, it won't be of much use in other servers
- QVector rpc_char_list;
-
- AOImage *ui_vp_notepad_image;
- QTextEdit *ui_vp_notepad;
-
- AOImage* ui_vp_chatbox = nullptr;
- QLabel* ui_vp_showname = nullptr;
- QTextEdit* ui_vp_message = nullptr;
- AOImage* ui_vp_testimony = nullptr;
- AOMovie* ui_vp_effect = nullptr;
- AOMovie* ui_vp_wtce = nullptr;
- AOMovie* ui_vp_objection = nullptr;
-
- AOImage* ui_vp_music_display_a = nullptr;
- AOImage* ui_vp_music_display_b = nullptr;
-
- AOImage* ui_vp_showname_image = nullptr;
-
- QTextEdit* ui_vp_music_name = nullptr;
- QPropertyAnimation* music_anim = nullptr;
-
- QWidget *ui_vp_music_area;
-
- AOMovie *ui_vp_clock;
-
- QTextEdit* ui_ic_chatlog = nullptr;
- QVector m_ic_records;
-
- AOTextArea *ui_ms_chatlog;
- AOTextArea *ui_server_chatlog;
-
- QListWidget *ui_mute_list;
- QListWidget *ui_area_list;
- QListWidget *ui_music_list;
- QListWidget *ui_sfx_list;
-
-// QListWidget *ui_sfx_list;
-
- QLineEdit *ui_ic_chat_message;
-
- QLineEdit *ui_ooc_chat_message;
- QLineEdit *ui_ooc_chat_name;
-
- //QLineEdit *ui_area_password;
- QLineEdit *ui_music_search;
-
- QLineEdit *ui_sfx_search;
-
- QWidget *ui_emotes = nullptr;
- QVector ui_emote_list;
- AOButton *ui_emote_left;
- AOButton *ui_emote_right;
-
- QComboBox *ui_emote_dropdown;
- QComboBox *ui_pos_dropdown;
-
- AOImage *ui_defense_bar;
- AOImage *ui_prosecution_bar;
-
- AOLabel *ui_music_label;
- AOLabel *ui_sfx_label;
- AOLabel *ui_blip_label;
-
- //buttons to cycle through shouts
- AOButton* ui_shout_up = nullptr;
- AOButton* ui_shout_down = nullptr;
- //buttons to cycle through effects
- AOButton* ui_effect_up = nullptr;
- AOButton* ui_effect_down = nullptr;
- //buttons to cycle through wtce
- AOButton* ui_wtce_up = nullptr;
- AOButton* ui_wtce_down = nullptr;
-
- //holds all the shout button objects
- QVector ui_shouts;
- //holds all the effect button objects
- QVector ui_effects;
- //holds all the shout buttons objects
- QVector ui_wtce;
-
- //holds all the names for sound files for the shouts
-// QVector shout_names = {"holdit", "objection", "takethat", "custom", "gotit", "crossswords", "counteralt"};
- QVector shout_names;
-
- //holds all the names for sound/anim files for the effects
- //QVector effect_names = {"effect_flash", "effect_gloom", "effect_question", "effect_pow"};
- QVector effect_names;
-
- //holds all the names for sound/anim files for the shouts
- //QVector shout_names = {"witnesstestimony", "crossexamination", "investigation", "nonstop"};
- QVector wtce_names;
-
- //holds whether the animation file exists for a determined shout/effect
- QVector shouts_enabled;
- QVector effects_enabled;
- QVector wtce_enabled;
-
-// AOButton* ui_shout_hold_it = nullptr; // 1
-// AOButton* ui_shout_objection = nullptr; // 2
-// AOButton* ui_shout_take_that = nullptr; // 3
-// AOButton* ui_shout_custom = nullptr; // 4
-// AOButton* ui_shout_got_it = nullptr; // 5
-// AOButton* ui_shout_cross_swords = nullptr; // 6
-// AOButton* ui_shout_counter_alt = nullptr; // 7
-
- AOButton *ui_ooc_toggle;
-
- AOButton *ui_witness_testimony;
- AOButton *ui_cross_examination;
- AOButton *ui_investigation;
- AOButton *ui_nonstop;
-
- AOButton *ui_change_character;
- AOButton *ui_reload_theme;
- AOButton *ui_call_mod;
- AOButton *ui_switch_area_music;
-
-
- QComboBox *ui_theme_list;
-
- AOButton *ui_confirm_theme;
-
- AOButton *ui_set_notes;
-
- QCheckBox *ui_pre;
- QCheckBox *ui_flip;
- QCheckBox *ui_guard;
- QCheckBox *ui_hidden;
-
- QVector ui_checks; // 0 = pre, 1 = flip, 2 = guard, 3 = hidden
- QVector ui_labels; // 0 = music, 1 = sfx, 2 = blip
- QVector ui_label_images;
- QVector label_images = {"Pre", "Flip", "Guard", "Hidden", "Music", "SFX", "Blip"};
-
- AOButton* ui_effect_flash = nullptr;
- AOButton* ui_effect_gloom = nullptr;
-
- AOButton* ui_mute = nullptr;
-
- AOButton *ui_defense_plus;
- AOButton *ui_defense_minus;
-
- AOButton *ui_prosecution_plus;
- AOButton *ui_prosecution_minus;
-
- QComboBox *ui_text_color;
-
- QSlider *ui_music_slider;
- QSlider *ui_sfx_slider;
- QSlider *ui_blip_slider;
-
- AOImage *ui_muted;
-
- AOButton *ui_note_button;
-
- AOButton *ui_evidence_button;
- AOImage *ui_evidence;
- AOLineEdit *ui_evidence_name;
- QWidget *ui_evidence_buttons;
- QVector ui_evidence_list;
- AOButton *ui_evidence_left;
- AOButton *ui_evidence_right;
- AOButton *ui_evidence_present;
- AOImage *ui_evidence_overlay;
- AOButton *ui_evidence_delete;
- AOLineEdit *ui_evidence_image_name;
- AOButton *ui_evidence_image_button;
- AOButton *ui_evidence_x;
- AOTextEdit *ui_evidence_description;
-
- AOImage *ui_char_select_background;
-
- //abstract widget to hold char buttons
- QWidget *ui_char_buttons = nullptr;
-
- QVector ui_char_button_list;
- AOImage *ui_selector;
-
- AOButton *ui_back_to_lobby;
-
- QLineEdit *ui_char_password;
-
- AOButton *ui_char_select_left;
- AOButton *ui_char_select_right;
-
- AOButton *ui_spectator;
-
- void construct_char_select();
- void set_char_select();
- void set_char_select_page();
-
- void construct_emotes();
- void set_emote_page();
- void set_emote_dropdown();
-
- void construct_evidence();
- void set_evidence_page();
-
- void load_note();
- void save_note();
- void save_textlog(QString p_text);
-
- void set_bullets();
-
- void set_char_rpc();
-
-
-public slots:
- void objection_done();
- void preanim_done();
-
- void realization_done();
-
- void show_testimony();
- void hide_testimony();
-
- void mod_called(QString p_ip);
-
-private slots:
- void start_chat_ticking();
- void play_sfx();
-
- void chat_tick();
-
- void on_mute_list_clicked(QModelIndex p_index);
-
- void on_chat_return_pressed();
-
- void on_ooc_return_pressed();
-
- void on_music_search_edited(QString p_text);
- void on_music_list_clicked();
- void on_area_list_clicked();
- void on_music_list_double_clicked(QModelIndex p_model);
- void on_area_list_double_clicked(QModelIndex p_model);
-
- void on_sfx_search_edited(QString p_text);
-
- void select_emote(int p_id);
-
- void on_emote_clicked(int p_id);
-
- void on_emote_left_clicked();
- void on_emote_right_clicked();
-
- void on_emote_dropdown_changed(int p_index);
- void on_pos_dropdown_changed(int p_index);
-
- void on_evidence_name_edited();
- void on_evidence_image_name_edited();
- void on_evidence_image_button_clicked();
- void on_evidence_clicked(int p_id);
- void on_evidence_double_clicked(int p_id);
-
- void on_evidence_hover(int p_id, bool p_state);
-
- void on_evidence_left_clicked();
- void on_evidence_right_clicked();
- void on_evidence_present_clicked();
-
- void on_cycle_clicked();
-
- void cycle_shout(int p_index);
-
- void cycle_effect(int p_index);
-
- void cycle_wtce(int p_index);
-
- void on_add_button_clicked();
-
- void on_delete_button_clicked();
-
- void on_set_file_button_clicked();
-
- void on_file_selected();
-
- /**
- * @brief reset the shout button's texture to default
- * DOES NOT MODIFY OBJECTION_STATE
- */
- void reset_shout_buttons();
-
- /**
- * @brief a general purpose function to toggle button selection
- */
- void on_shout_clicked();
-
- void reset_effect_buttons();
- void on_effect_button_clicked();
-
- void on_mute_clicked();
-
- void on_defense_minus_clicked();
- void on_defense_plus_clicked();
- void on_prosecution_minus_clicked();
- void on_prosecution_plus_clicked();
-
- void on_text_color_changed(int p_color);
-
- void on_music_slider_moved(int p_value);
- void on_sfx_slider_moved(int p_value);
- void on_blip_slider_moved(int p_value);
-
- void on_ooc_toggle_clicked();
-
- void on_witness_testimony_clicked();
- void on_cross_examination_clicked();
- void reset_wtce_buttons();
- void on_wtce_clicked();
-
- void on_change_character_clicked();
- void on_reload_theme_clicked();
- void on_call_mod_clicked();
-
- void on_switch_area_music_clicked();
-
- void on_confirm_theme_clicked();
- void on_note_button_clicked();
-
- void on_set_notes_clicked();
-
- void on_note_text_changed();
-
- void on_pre_clicked();
- void on_flip_clicked();
- void on_guard_clicked();
-
- void on_hidden_clicked();
-
- void on_sfx_list_clicked();
-
- void on_evidence_button_clicked();
-
- void on_evidence_delete_clicked();
- void on_evidence_x_clicked();
-
- void on_back_to_lobby_clicked();
-
- void on_char_select_left_clicked();
- void on_char_select_right_clicked();
-
- void on_spectator_clicked();
-
- void char_clicked(int n_char);
-
- void ping_server();
-};
-
-#endif // COURTROOM_H
diff --git a/data/.qmake.conf b/data/.qmake.conf
new file mode 100644
index 000000000..89cd07d0d
--- /dev/null
+++ b/data/.qmake.conf
@@ -0,0 +1 @@
+DESTDIR = $$PWD/bin
diff --git a/data/README-LINUX.md b/data/README-LINUX.md
new file mode 100644
index 000000000..7af0b109a
--- /dev/null
+++ b/data/README-LINUX.md
@@ -0,0 +1,21 @@
+# Installation instructions
+1. Open your terminal and run the following commands in order.
+
+For Ubuntu 20.04 and lower:
+```
+sudo apt-get install qt5-default libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediawidgets5 gstreamer1.0-libav
+```
+For Ubuntu 21.10 and higher:
+```
+sudo apt-get install libqt5core5a libqt5concurrent5 libqt5multimedia5 libqt5multimedia5-plugins libqt5widgets5 libqt5x11extras5 gstreamer1.0-libav
+```
+
+2. Update dro-client and dro-client.sh permissions
+```
+chmod +x dro-client.sh
+chmod +x dro-client
+```
+3. Launch
+```
+./dro-client.sh
+```
diff --git a/data/README-MACOS.txt b/data/README-MACOS.txt
new file mode 100644
index 000000000..2eec8ebad
--- /dev/null
+++ b/data/README-MACOS.txt
@@ -0,0 +1,5 @@
+To extract the application properly, double click Danganronpa Online.dmg, drag "Danganronpa Online" to your Danganronpa Online folder, and delete the dmg file.
+
+If you attempt to open the application as is, MacOS will give you a warning indicating it has blocked the launch of the application as the developer could not be verified. If you downloaded these files from the Danganronpa Online discord, you can trust these files. To open Danganronpa Online for the first time, you have to Right Click the application while holding the Control key, then click Open, and on the prompt click Open again.
+
+If at some point you get a prompt indicating application would like to access files in your Desktop folder (or wherever you put your files), accept. Otherwise, the application will be unable to display images or play audio files.
\ No newline at end of file
diff --git a/data/dro-client.sh b/data/dro-client.sh
new file mode 100644
index 000000000..33baddbdd
--- /dev/null
+++ b/data/dro-client.sh
@@ -0,0 +1 @@
+LD_LIBRARY_PATH=.:./depends:$LD_LIBRARY_PATH ./dro-client
diff --git a/data/sample.avi b/data/sample.avi
new file mode 100644
index 000000000..3e4ab0eab
Binary files /dev/null and b/data/sample.avi differ
diff --git a/datatypes.h b/datatypes.h
deleted file mode 100644
index ec44accc0..000000000
--- a/datatypes.h
+++ /dev/null
@@ -1,126 +0,0 @@
-#ifndef DATATYPES_H
-#define DATATYPES_H
-
-#include
-#include
-
-struct record_type
-{
- record_type() = default;
- record_type(QString p_name, QString p_line, QString p_color, bool p_system)
- : name(p_name), line(p_line), color(p_color), system(p_system)
- {}
-
- QString name;
- QString line;
- QString color;
- bool system;
-};
-
-typedef std::shared_ptr record_type_ptr;
-
-struct server_type
-{
- QString name;
- QString desc;
- QString ip;
- int port;
-};
-
-struct emote_type
-{
- QString comment;
- QString preanim;
- QString anim;
- int mod;
- QString sfx_name;
- int sfx_delay;
- int sfx_duration;
-};
-
-struct char_type
-{
- QString name;
- QString description;
- QString evidence_string;
- bool taken;
-};
-
-struct evi_type
-{
- QString name;
- QString description;
- QString image;
-};
-
-struct chatmessage_type
-{
- QString message;
- QString character;
- QString side;
- QString sfx_name;
- QString pre_emote;
- QString emote;
- int emote_modifier;
- int objection_modifier;
- int realization;
- int text_color;
- int evidence;
- int cid;
- int sfx_delay;
- int flip;
-};
-
-struct area_type
-{
- QString name;
- QString background;
- bool passworded;
-};
-
-struct pos_type
-{
- int x;
- int y;
-};
-
-struct pos_size_type
-{
- int x = 0;
- int y = 0;
- int width = 0;
- int height = 0;
-};
-
-enum CHAT_MESSAGE
-{
- DESK_MOD = 0,
- PRE_EMOTE,
- CHAR_NAME,
- EMOTE,
- MESSAGE,
- SIDE,
- SFX_NAME,
- EMOTE_MOD,
- CHAR_ID,
- SFX_DELAY,
- OBJECTION_MOD,
- EVIDENCE_ID,
- FLIP,
- EFFECT_STATE,
- TEXT_COLOR,
- SHOWNAME
-};
-
-enum COLOR
-{
- WHITE = 0,
- GREEN,
- RED,
- ORANGE,
- BLUE,
- YELLOW,
- RAINBOW
-};
-
-#endif // DATATYPES_H
diff --git a/debug_functions.cpp b/debug_functions.cpp
deleted file mode 100644
index 0ff1ccd75..000000000
--- a/debug_functions.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include
-
-#include "debug_functions.h"
-
-void call_error(QString p_message)
-{
- QMessageBox *f_box = new QMessageBox;
-
- f_box->setText("Error: " + p_message);
- f_box->setWindowTitle("Error");
-
- //msgBox->setWindowModality(Qt::NonModal);
- f_box->exec();
- delete f_box;
-}
-
-void call_notice(QString p_message)
-{
- QMessageBox *f_box = new QMessageBox;
-
- f_box->setText(p_message);
- f_box->setWindowTitle("Notice");
-
- //msgBox->setWindowModality(Qt::NonModal);
- f_box->exec();
- delete f_box;
-}
diff --git a/discord-rpc.h b/discord-rpc.h
deleted file mode 100644
index feb874b20..000000000
--- a/discord-rpc.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#pragma once
-#include
-
-// clang-format off
-
-#if defined(DISCORD_DYNAMIC_LIB)
-# if defined(_WIN32)
-# if defined(DISCORD_BUILDING_SDK)
-# define DISCORD_EXPORT __declspec(dllexport)
-# else
-# define DISCORD_EXPORT __declspec(dllimport)
-# endif
-# else
-# define DISCORD_EXPORT __attribute__((visibility("default")))
-# endif
-#else
-# define DISCORD_EXPORT
-#endif
-
-// clang-format on
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct DiscordRichPresence {
- const char* state; /* max 128 bytes */
- const char* details; /* max 128 bytes */
- int64_t startTimestamp;
- int64_t endTimestamp;
- const char* largeImageKey; /* max 32 bytes */
- const char* largeImageText; /* max 128 bytes */
- const char* smallImageKey; /* max 32 bytes */
- const char* smallImageText; /* max 128 bytes */
- const char* partyId; /* max 128 bytes */
- int partySize;
- int partyMax;
- const char* matchSecret; /* max 128 bytes */
- const char* joinSecret; /* max 128 bytes */
- const char* spectateSecret; /* max 128 bytes */
- int8_t instance;
-} DiscordRichPresence;
-
-typedef struct DiscordJoinRequest {
- const char* userId;
- const char* username;
- const char* discriminator;
- const char* avatar;
-} DiscordJoinRequest;
-
-typedef struct DiscordEventHandlers {
- void (*ready)(void);
- void (*disconnected)(int errorCode, const char* message);
- void (*errored)(int errorCode, const char* message);
- void (*joinGame)(const char* joinSecret);
- void (*spectateGame)(const char* spectateSecret);
- void (*joinRequest)(const DiscordJoinRequest* request);
-} DiscordEventHandlers;
-
-#define DISCORD_REPLY_NO 0
-#define DISCORD_REPLY_YES 1
-#define DISCORD_REPLY_IGNORE 2
-
-DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
- DiscordEventHandlers* handlers,
- int autoRegister,
- const char* optionalSteamId);
-DISCORD_EXPORT void Discord_Shutdown(void);
-
-/* checks for incoming messages, dispatches callbacks */
-DISCORD_EXPORT void Discord_RunCallbacks(void);
-
-/* If you disable the lib starting its own io thread, you'll need to call this from your own */
-#ifdef DISCORD_DISABLE_IO_THREAD
-DISCORD_EXPORT void Discord_UpdateConnection(void);
-#endif
-
-DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
-DISCORD_EXPORT void Discord_ClearPresence(void);
-
-DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
diff --git a/discord_register.h b/discord_register.h
deleted file mode 100644
index 2058cc4c6..000000000
--- a/discord_register.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-
-#if defined(DISCORD_DYNAMIC_LIB)
-# if defined(_WIN32)
-# if defined(DISCORD_BUILDING_SDK)
-# define DISCORD_EXPORT __declspec(dllexport)
-# else
-# define DISCORD_EXPORT __declspec(dllimport)
-# endif
-# else
-# define DISCORD_EXPORT __attribute__((visibility("default")))
-# endif
-#else
-# define DISCORD_EXPORT
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
-DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/discord_rich_presence.cpp b/discord_rich_presence.cpp
deleted file mode 100644
index ab9772628..000000000
--- a/discord_rich_presence.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-#include "discord_rich_presence.h"
-
-#include
-#include
-
-#include
-
-namespace AttorneyOnline {
-
-Discord::Discord()
-{
-// DiscordEventHandlers handlers;
-// std::memset(&handlers, 0, sizeof(handlers));
-// handlers = {};
-// handlers.ready = [] {
-// qInfo() << "Discord RPC ready";
-// };
-// handlers.disconnected = [](int errorCode, const char* message) {
-// qInfo() << "Discord RPC disconnected! " << message;
-// };
-// handlers.errored = [](int errorCode, const char* message) {
-// qWarning() << "Discord RPC errored out! " << message;
-// };
-// qInfo() << "Initializing Discord RPC";
-// Discord_Initialize(APPLICATION_ID1, &handlers, 1, nullptr);
-
- start(APPLICATION_ID[0]);
-}
-
-void Discord::start(const char *APPLICATION_ID)
-{
- DiscordEventHandlers handlers;
- std::memset(&handlers, 0, sizeof(handlers));
- handlers = {};
- handlers.ready = [] {
- qInfo() << "Discord RPC ready";
- };
- handlers.disconnected = [](int errorCode, const char* message) {
- qInfo() << "Discord RPC disconnected! " << message;
- };
- handlers.errored = [](int errorCode, const char* message) {
- qWarning() << "Discord RPC errored out! " << message;
- };
- qInfo() << "Initializing Discord RPC";
- Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr);
-}
-
-Discord::~Discord()
-{
- Discord_Shutdown();
-}
-
-void Discord::restart(const char *APPLICATION_ID)
-{
- Discord_Shutdown();
- start(APPLICATION_ID);
-}
-
-void Discord::toggle(int p_index)
-{
- if(p_index >=0 && p_index < 2)
- {
- if(p_index!=m_index) { restart(APPLICATION_ID[p_index]); m_index = p_index; }
- }
- else qDebug() << p_index << "is not a valid APPLICATION_ID Index";
-}
-
-void Discord::state_lobby()
-{
- DiscordRichPresence presence;
- std::memset(&presence, 0, sizeof(presence));
- presence.largeImageKey = "danganronpa_online";
- presence.largeImageText = "Sore Wa Chigau Yo!";
- presence.instance = 1;
-
- presence.state = "In Lobby";
- presence.details = "Idle";
- Discord_UpdatePresence(&presence);
-}
-
-void Discord::state_server(std::string name, std::string server_id)
-{
- qDebug() << "Discord RPC: Setting server state";
-
- DiscordRichPresence presence;
- std::memset(&presence, 0, sizeof(presence));
- presence.largeImageKey = "danganronpa_online";
- presence.largeImageText = "Sore Wa Chigau Yo!";
- presence.instance = 1;
-
- auto timestamp = static_cast(std::time(nullptr));
-
- presence.state = "In a Server";
- presence.details = name.c_str();
- presence.matchSecret = server_id.c_str();
- presence.startTimestamp = this->timestamp;
-
- this->server_id = server_id;
- this->server_name = name;
- this->timestamp = timestamp;
- Discord_UpdatePresence(&presence);
-}
-
-void Discord::state_character(std::string name)
-{
- auto name_internal = QString(name.c_str()).toLower().replace(' ', '_').toStdString();
- auto name_friendly = QString(name.c_str()).replace('_', ' ').toStdString();
- const std::string playing_as = "Playing as " + name_friendly;
- qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str() << ")";
-
- DiscordRichPresence presence;
- std::memset(&presence, 0, sizeof(presence));
- presence.largeImageKey = name_internal.c_str();
- presence.instance = 1;
- presence.details = this->server_name.c_str();
- presence.matchSecret = this->server_id.c_str();
- presence.startTimestamp = this->timestamp;
-
- presence.state = playing_as.c_str();
-// presence.smallImageKey = "danganronpa_online";
- presence.smallImageKey = "danganronpa_online";
- presence.smallImageText = "Danganronpa Online";
- Discord_UpdatePresence(&presence);
-}
-
-void Discord::state_spectate()
-{
- qDebug() << "Discord RPC: Setting specator state";
-
- DiscordRichPresence presence;
- std::memset(&presence, 0, sizeof(presence));
- presence.largeImageKey = "danganronpa_online";
- presence.largeImageText = "Sore Wa Chigau Yo!";
- presence.instance = 1;
- presence.details = this->server_name.c_str();
- presence.matchSecret = this->server_id.c_str();
- presence.startTimestamp = this->timestamp;
-
- presence.state = "Spectating";
- Discord_UpdatePresence(&presence);
-}
-
-}
diff --git a/discord_rich_presence.h b/discord_rich_presence.h
deleted file mode 100644
index 3e8ec47d6..000000000
--- a/discord_rich_presence.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef DISCORD_RICH_PRESENCE_H
-#define DISCORD_RICH_PRESENCE_H
-
-#include
-#include
-
-namespace AttorneyOnline {
-
-class Discord
-{
-private:
- const char* APPLICATION_ID[2] = { "538080629535801347" , "538080629535801347", }; // insert second one here blah blah
- int m_index = 0;
- std::string server_name, server_id;
- int64_t timestamp;
-public:
- Discord();
- ~Discord();
-
- void state_lobby();
- void state_server(std::string name, std::string server_id);
- void state_character(std::string name);
- void state_spectate();
- void start(const char *APPLICATION_ID);
- void restart(const char *APPLICATION_ID);
- void toggle(int p_index);
-};
-
-}
-#endif // DISCORD_RICH_PRESENCE_H
diff --git a/discord_rpc.h b/discord_rpc.h
deleted file mode 100644
index 97a6e9ec8..000000000
--- a/discord_rpc.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#pragma once
-#include
-
-// clang-format off
-
-#if defined(DISCORD_DYNAMIC_LIB)
-# if defined(_WIN32)
-# if defined(DISCORD_BUILDING_SDK)
-# define DISCORD_EXPORT __declspec(dllexport)
-# else
-# define DISCORD_EXPORT __declspec(dllimport)
-# endif
-# else
-# define DISCORD_EXPORT __attribute__((visibility("default")))
-# endif
-#else
-# define DISCORD_EXPORT
-#endif
-
-// clang-format on
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct DiscordRichPresence {
- const char* state; /* max 128 bytes */
- const char* details; /* max 128 bytes */
- int64_t startTimestamp;
- int64_t endTimestamp;
- const char* largeImageKey; /* max 32 bytes */
- const char* largeImageText; /* max 128 bytes */
- const char* smallImageKey; /* max 32 bytes */
- const char* smallImageText; /* max 128 bytes */
- const char* partyId; /* max 128 bytes */
- int partySize;
- int partyMax;
- const char* matchSecret; /* max 128 bytes */
- const char* joinSecret; /* max 128 bytes */
- const char* spectateSecret; /* max 128 bytes */
- int8_t instance;
-} DiscordRichPresence;
-
-typedef struct DiscordJoinRequest {
- const char* userId;
- const char* username;
- const char* discriminator;
- const char* avatar;
-} DiscordJoinRequest;
-
-typedef struct DiscordEventHandlers {
- void (*ready)(void);
- void (*disconnected)(int errorCode, const char* message);
- void (*errored)(int errorCode, const char* message);
- void (*joinGame)(const char* joinSecret);
- void (*spectateGame)(const char* spectateSecret);
- void (*joinRequest)(const DiscordJoinRequest* request);
-} DiscordEventHandlers;
-
-#define DISCORD_REPLY_NO 0
-#define DISCORD_REPLY_YES 1
-#define DISCORD_REPLY_IGNORE 2
-
-DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
- DiscordEventHandlers* handlers,
- int autoRegister,
- const char* optionalSteamId);
-DISCORD_EXPORT void Discord_Shutdown(void);
-
-/* checks for incoming messages, dispatches callbacks */
-DISCORD_EXPORT void Discord_RunCallbacks(void);
-
-/* If you disable the lib starting its own io thread, you'll need to call this from your own */
-#ifdef DISCORD_DISABLE_IO_THREAD
-DISCORD_EXPORT void Discord_UpdateConnection(void);
-#endif
-
-DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
-DISCORD_EXPORT void Discord_ClearPresence(void);
-
-DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
diff --git a/dronline-client.pro b/dronline-client.pro
new file mode 100644
index 000000000..ee06906ab
--- /dev/null
+++ b/dronline-client.pro
@@ -0,0 +1,185 @@
+QT += core gui widgets uitools network multimedia multimediawidgets
+
+CONFIG += c++17
+
+TEMPLATE = app
+VERSION = 1.2.3
+TARGET = dro-client
+
+RC_ICONS = icon.ico
+
+INCLUDEPATH += $$PWD/include $$PWD/src $$PWD/3rd
+DEPENDPATH += $$PWD/include $$PWD/src $$PWD/3rd
+
+HEADERS += \
+ src/aoapplication.h \
+ src/aoblipplayer.h \
+ src/aobutton.h \
+ src/aocharbutton.h \
+ src/aoconfig.h \
+ src/aoconfigpanel.h \
+ src/aoemotebutton.h \
+ src/aoguiloader.h \
+ src/aoimagedisplay.h \
+ src/aolabel.h \
+ src/aolineedit.h \
+ src/aomusicplayer.h \
+ src/aonotearea.h \
+ src/aonotepad.h \
+ src/aonotepicker.h \
+ src/aoobject.h \
+ src/aopixmap.h \
+ src/aosfxplayer.h \
+ src/aoshoutplayer.h \
+ src/aosystemplayer.h \
+ src/aotimer.h \
+ src/commondefs.h \
+ src/courtroom.h \
+ src/datatypes.h \
+ src/debug_functions.h \
+ src/draudio.h \
+ src/draudiodevice.h \
+ src/draudioengine.h \
+ src/draudioengine_p.h \
+ src/draudioerror.h \
+ src/draudiostream.h \
+ src/draudiostreamfamily.h \
+ src/draudiotrackmetadata.h \
+ src/drcharactermovie.h \
+ src/drchatlog.h \
+ src/drdiscord.h \
+ src/dreffectmovie.h \
+ src/drgraphicscene.h \
+ src/drmasterclient.h \
+ src/drmediatester.h \
+ src/drmovie.h \
+ src/drpacket.h \
+ src/drpather.h \
+ src/drposition.h \
+ src/drscenemovie.h \
+ src/drserverinfoeditor.h \
+ src/drserversocket.h \
+ src/drshoutmovie.h \
+ src/drsplashmovie.h \
+ src/drstickerviewer.h \
+ src/drtextedit.h \
+ src/drthememovie.h \
+ src/file_functions.h \
+ src/hardware_functions.h \
+ src/lobby.h \
+ src/logger.h \
+ src/misc_functions.h \
+ src/mk2/graphicsspriteitem.h \
+ src/mk2/graphicsvideoscreen.h \
+ src/mk2/spritecachingreader.h \
+ src/mk2/spritedynamicreader.h \
+ src/mk2/spriteplayer.h \
+ src/mk2/spritereader.h \
+ src/mk2/spritereadersynchronizer.h \
+ src/mk2/spriteseekingreader.h \
+ src/mk2/spriteviewer.h \
+ src/theme.h \
+ src/utils.h \
+ src/version.h
+
+SOURCES += \
+ src/aoapplication.cpp \
+ src/aoblipplayer.cpp \
+ src/aobutton.cpp \
+ src/aocharbutton.cpp \
+ src/aoconfig.cpp \
+ src/aoconfigpanel.cpp \
+ src/aoemotebutton.cpp \
+ src/aoguiloader.cpp \
+ src/aoimagedisplay.cpp \
+ src/aolabel.cpp \
+ src/aolineedit.cpp \
+ src/aomusicplayer.cpp \
+ src/aonotearea.cpp \
+ src/aonotepad.cpp \
+ src/aonotepicker.cpp \
+ src/aoobject.cpp \
+ src/aopixmap.cpp \
+ src/aosfxplayer.cpp \
+ src/aoshoutplayer.cpp \
+ src/aosystemplayer.cpp \
+ src/aotimer.cpp \
+ src/audio_functions.cpp \
+ src/charselect.cpp \
+ src/commondefs.cpp \
+ src/courtroom.cpp \
+ src/courtroom_character.cpp \
+ src/courtroom_sfx.cpp \
+ src/courtroom_widgets.cpp \
+ src/datatypes.cpp \
+ src/debug_functions.cpp \
+ src/draudio.cpp \
+ src/draudiodevice.cpp \
+ src/draudioengine.cpp \
+ src/draudioengine_p.cpp \
+ src/draudioerror.cpp \
+ src/draudiostream.cpp \
+ src/draudiostreamfamily.cpp \
+ src/draudiotrackmetadata.cpp \
+ src/drcharactermovie.cpp \
+ src/drchatlog.cpp \
+ src/dreffectmovie.cpp \
+ src/drgraphicscene.cpp \
+ src/drmasterclient.cpp \
+ src/drmediatester.cpp \
+ src/drmovie.cpp \
+ src/drpacket.cpp \
+ src/drpather.cpp \
+ src/drposition.cpp \
+ src/drscenemovie.cpp \
+ src/drserverinfoeditor.cpp \
+ src/drserversocket.cpp \
+ src/drshoutmovie.cpp \
+ src/drsplashmovie.cpp \
+ src/drstickerviewer.cpp \
+ src/drtextedit.cpp \
+ src/drdiscord.cpp \
+ src/drthememovie.cpp \
+ src/emotes.cpp \
+ src/file_functions.cpp \
+ src/hardware_functions.cpp \
+ src/lobby.cpp \
+ src/logger.cpp \
+ src/main.cpp \
+ src/misc_functions.cpp \
+ src/mk2/graphicsspriteitem.cpp \
+ src/mk2/graphicsvideoscreen.cpp \
+ src/mk2/spritecachingreader.cpp \
+ src/mk2/spritedynamicreader.cpp \
+ src/mk2/spriteplayer.cpp \
+ src/mk2/spriteseekingreader.cpp \
+ src/path_functions.cpp \
+ src/server_socket.cpp \
+ src/mk2/spritereader.cpp \
+ src/mk2/spritereadersynchronizer.cpp \
+ src/mk2/spriteviewer.cpp \
+ src/text_file_functions.cpp \
+ src/theme.cpp \
+ src/utils.cpp \
+ src/version.cpp
+
+# 1. You need to get BASS and put the x86 bass DLL/headers in the project root folder
+# AND the compilation output folder. If you want a static link, you'll probably
+# need the .lib file too. MinGW-GCC is really finicky finding BASS, it seems.
+# 2. You need to compile the Discord Rich Presence SDK separately and add the lib/headers
+# in the same way as BASS. Discord RPC uses CMake, which does not play nicely with
+# QMake, so this step must be manual.
+LIBS += -L$$PWD/3rd -lbass -lbassopus -ldiscord-rpc
+
+RESOURCES += \
+ res.qrc
+
+DISTFILES +=
+
+FORMS += \
+ res/ui/config_panel.ui \
+ src/drserverinfoeditor.ui
+
+# Mac stuff
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.13
+ICON = icon.icns
diff --git a/emotes.cpp b/emotes.cpp
deleted file mode 100644
index 12f41a3b2..000000000
--- a/emotes.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-#include "courtroom.h"
-
-#include "aoemotebutton.h"
-
-#include
-
-void Courtroom::construct_emotes()
-{
- ui_emotes = new QWidget(this);
-
- set_size_and_pos(ui_emotes, "emotes");
-
- QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini");
-
- const int button_width = 40;
- int x_spacing = f_spacing.x();
- int x_mod_count = 0;
-
- const int button_height = 40;
- int y_spacing = f_spacing.y();
- int y_mod_count = 0;
-
- emote_columns = ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
- emote_rows = ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
-
- max_emotes_on_page = emote_columns * emote_rows;
-
- for (int n = 0 ; n < max_emotes_on_page ; ++n)
- {
- int x_pos = (button_width + x_spacing) * x_mod_count;
- int y_pos = (button_height + y_spacing) * y_mod_count;
-
- AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos);
-
- ui_emote_list.append(f_emote);
-
- f_emote->set_id(n);
-
- connect(f_emote, SIGNAL(emote_clicked(int)), this, SLOT(on_emote_clicked(int)));
-
- ++x_mod_count;
-
- if (x_mod_count == emote_columns)
- {
- ++y_mod_count;
- x_mod_count = 0;
- }
- }
-}
-
-void Courtroom::set_emote_page()
-{
- if (m_cid == -1)
- return;
-
- int total_emotes = ao_app->get_emote_number(current_char);
-
- ui_emote_left->hide();
- ui_emote_right->hide();
-
- for (AOEmoteButton *i_button : ui_emote_list)
- {
- i_button->hide();
- }
-
- int total_pages = total_emotes / max_emotes_on_page;
- int emotes_on_page = 0;
-
- if (total_emotes % max_emotes_on_page != 0)
- {
- ++total_pages;
- //i. e. not on the last page
- if (total_pages > current_emote_page + 1)
- emotes_on_page = max_emotes_on_page;
- else
- emotes_on_page = total_emotes % max_emotes_on_page;
-
- }
- else
- emotes_on_page = max_emotes_on_page;
-
- if (total_pages > current_emote_page + 1)
- ui_emote_right->show();
-
- if (current_emote_page > 0)
- ui_emote_left->show();
-
- for (int n_emote = 0 ; n_emote < emotes_on_page ; ++n_emote)
- {
- int n_real_emote = n_emote + current_emote_page * max_emotes_on_page;
- AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
-
- if (n_real_emote == current_emote)
- f_emote->set_image(current_char, n_real_emote, "_on.png");
- else
- f_emote->set_image(current_char, n_real_emote, "_off.png");
-
- f_emote->show();
- }
-
-}
-
-void Courtroom::set_emote_dropdown()
-{
- ui_emote_dropdown->clear();
-
- int total_emotes = ao_app->get_emote_number(current_char);
- QStringList emote_list;
-
- for (int n = 0 ; n < total_emotes ; ++n)
- {
- emote_list.append(ao_app->get_emote_comment(current_char, n));
- }
-
- ui_emote_dropdown->addItems(emote_list);
-}
-
-void Courtroom::select_emote(int p_id)
-{
- int min = current_emote_page * max_emotes_on_page;
- int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page;
-
- if (current_emote >= min && current_emote <= max)
- ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off.png");
-
- int old_emote = current_emote;
-
- current_emote = p_id;
-
- if (current_emote >= min && current_emote <= max)
- ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png");
-
- int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
-
- if (old_emote == current_emote) // toggle
- ui_pre->setChecked(!ui_pre->isChecked());
- else if (emote_mod == 1 || ao_app->read_config("always_pre") == "true")
- ui_pre->setChecked(true);
- else
- ui_pre->setChecked(false);
-
- ui_emote_dropdown->setCurrentIndex(current_emote);
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_emote_clicked(int p_id)
-{
- select_emote(p_id + max_emotes_on_page * current_emote_page);
-}
-
-void Courtroom::on_emote_left_clicked()
-{
- --current_emote_page;
-
- set_emote_page();
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_emote_right_clicked()
-{
- qDebug() << "emote right clicked";
- ++current_emote_page;
-
- set_emote_page();
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_emote_dropdown_changed(int p_index)
-{
- select_emote(p_index);
-}
diff --git a/encryption_functions.cpp b/encryption_functions.cpp
deleted file mode 100644
index 56b6e34cd..000000000
--- a/encryption_functions.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "encryption_functions.h"
-
-#include "hex_functions.h"
-
-#include
-#include
-#include
-#include
-#include
-
-QString fanta_encrypt(QString temp_input, unsigned int p_key)
-{
- //using standard stdlib types is actually easier here because of implicit char<->int conversion
- //which in turn makes encryption arithmetic easier
-
- unsigned int key = p_key;
- unsigned int C1 = 53761;
- unsigned int C2 = 32618;
-
- QVector temp_result;
- std::string input = temp_input.toUtf8().constData();
-
- for (unsigned int pos = 0 ; pos < input.size() ; ++pos)
- {
- uint_fast8_t output = input.at(pos) ^ (key >> 8) % 256;
- temp_result.append(output);
- key = (temp_result.at(pos) + key) * C1 + C2;
- }
-
- std::string result = "";
-
- for (uint_fast8_t i_int : temp_result)
- {
- result += omni::int_to_hex(i_int);
- }
-
- QString final_result = QString::fromStdString(result);
-
- return final_result;
-}
-
-QString fanta_decrypt(QString temp_input, unsigned int key)
-{
- std::string input = temp_input.toUtf8().constData();
-
- QVector unhexed_vector;
-
- for(unsigned int i=0; i< input.length(); i+=2)
- {
- std::string byte = input.substr(i,2);
- unsigned int hex_int = strtoul(byte.c_str(), nullptr, 16);
- unhexed_vector.append(hex_int);
- }
-
- unsigned int C1 = 53761;
- unsigned int C2 = 32618;
-
- std::string result = "";
-
- for (int pos = 0 ; pos < unhexed_vector.size() ; ++pos)
- {
- unsigned char output = unhexed_vector.at(pos) ^ (key >> 8) % 256;
- result += output;
- key = (unhexed_vector.at(pos) + key) * C1 + C2;
- }
-
- return QString::fromStdString(result);
-
-}
diff --git a/encryption_functions.h b/encryption_functions.h
deleted file mode 100644
index b6ea1d708..000000000
--- a/encryption_functions.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef ENCRYPTION_FUNCTIONS_H
-#define ENCRYPTION_FUNCTIONS_H
-
-#include
-
-QString fanta_encrypt(QString p_input, unsigned int key);
-QString fanta_decrypt(QString p_input, unsigned int key);
-
-#endif // ENCRYPTION_FUNCTIONS_H
diff --git a/evidence.cpp b/evidence.cpp
deleted file mode 100644
index 19ffecf22..000000000
--- a/evidence.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-#include "courtroom.h"
-
-#include
-#include
-
-void Courtroom::construct_evidence()
-{
- ui_evidence = new AOImage(this, ao_app);
-
- //ui_evidence_name = new QLabel(ui_evidence);
- ui_evidence_name = new AOLineEdit(ui_evidence);
- ui_evidence_name->setAlignment(Qt::AlignCenter);
- ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold));
- ui_evidence_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: rgba(255, 128, 0, 255);");
-
- ui_evidence_buttons = new QWidget(ui_evidence);
-
- ui_evidence_left = new AOButton(ui_evidence, ao_app);
- ui_evidence_right = new AOButton(ui_evidence, ao_app);
- ui_evidence_present = new AOButton(ui_evidence, ao_app);
-
- ui_evidence_overlay = new AOImage(ui_evidence, ao_app);
-
- ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app);
- ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay);
- ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app);
- ui_evidence_image_button->setText("Choose..");
- ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app);
-
- ui_evidence_description = new AOTextEdit(ui_evidence_overlay);
- ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: white;");
-
- set_size_and_pos(ui_evidence, "evidence_background");
- set_size_and_pos(ui_evidence_buttons, "evidence_buttons");
-
- QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini");
-
- const int button_width = 70;
- int x_spacing = f_spacing.x();
- int x_mod_count = 0;
-
- const int button_height = 70;
- int y_spacing = f_spacing.y();
- int y_mod_count = 0;
-
- evidence_columns = ((ui_evidence_buttons->width() - button_width) / (x_spacing + button_width)) + 1;
- evidence_rows = ((ui_evidence_buttons->height() - button_height) / (y_spacing + button_height)) + 1;
-
- max_evidence_on_page = evidence_columns * evidence_rows;
-
- for (int n = 0 ; n < max_evidence_on_page ; ++n)
- {
- int x_pos = (button_width + x_spacing) * x_mod_count;
- int y_pos = (button_height + y_spacing) * y_mod_count;
-
- AOEvidenceButton *f_evidence = new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos);
-
- ui_evidence_list.append(f_evidence);
-
- f_evidence->set_id(n);
-
- connect(f_evidence, SIGNAL(evidence_clicked(int)), this, SLOT(on_evidence_clicked(int)));
- connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this, SLOT(on_evidence_double_clicked(int)));
- connect(f_evidence, SIGNAL(on_hover(int, bool)), this, SLOT(on_evidence_hover(int, bool)));
-
- ++x_mod_count;
-
- if (x_mod_count == evidence_columns)
- {
- ++y_mod_count;
- x_mod_count = 0;
- }
- }
-
- connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited()));
- connect(ui_evidence_left, SIGNAL(clicked()), this, SLOT(on_evidence_left_clicked()));
- connect(ui_evidence_right, SIGNAL(clicked()), this, SLOT(on_evidence_right_clicked()));
- connect(ui_evidence_present, SIGNAL(clicked()), this, SLOT(on_evidence_present_clicked()));
- connect(ui_evidence_delete, SIGNAL(clicked()), this, SLOT(on_evidence_delete_clicked()));
- connect(ui_evidence_image_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_image_name_edited()));
- connect(ui_evidence_image_button, SIGNAL(clicked()), this, SLOT(on_evidence_image_button_clicked()));
- connect(ui_evidence_x, SIGNAL(clicked()), this, SLOT(on_evidence_x_clicked()));
-
- ui_evidence->hide();
-}
-
-void Courtroom::set_evidence_list(QVector &p_evi_list)
-{
- local_evidence_list.clear();
- local_evidence_list = p_evi_list;
-
- set_evidence_page();
-}
-
-void Courtroom::set_evidence_page()
-{
- int total_evidence = local_evidence_list.size();
-
- ui_evidence_left->hide();
- ui_evidence_right->hide();
-
- for (AOEvidenceButton *i_button : ui_evidence_list)
- {
- i_button->reset();
- }
-
- //to account for the "add evidence" button
- ++total_evidence;
-
- int total_pages = total_evidence / max_evidence_on_page;
- int evidence_on_page = 0;
-
- if ((total_evidence % max_evidence_on_page) != 0)
- {
- ++total_pages;
- //i. e. not on the last page
- if (total_pages > current_evidence_page + 1)
- evidence_on_page = max_evidence_on_page;
- else
- evidence_on_page = total_evidence % max_evidence_on_page;
-
- }
- else
- evidence_on_page = max_evidence_on_page;
-
- if (total_pages > current_evidence_page + 1)
- ui_evidence_right->show();
-
- if (current_evidence_page > 0)
- ui_evidence_left->show();
-
- for (int n_evidence_button = 0 ; n_evidence_button < evidence_on_page ; ++n_evidence_button)
- {
- int n_real_evidence = n_evidence_button + current_evidence_page * max_evidence_on_page;
- AOEvidenceButton *f_evidence_button = ui_evidence_list.at(n_evidence_button);
-
- //ie. the add evidence button
- if (n_real_evidence == (total_evidence - 1))
- f_evidence_button->set_theme_image("addevidence.png");
- else if (n_real_evidence < (total_evidence - 1))
- {
- f_evidence_button->set_image(local_evidence_list.at(n_real_evidence).image);
-
- if (n_real_evidence == current_evidence)
- f_evidence_button->set_selected(true);
- else
- f_evidence_button->set_selected(false);
- }
- else
- f_evidence_button->set_image("");
-
- f_evidence_button->show();
- }
-}
-
-void Courtroom::on_evidence_name_edited()
-{
- if (current_evidence >= local_evidence_list.size())
- return;
-
- QStringList f_contents;
-
- evi_type f_evi = local_evidence_list.at(current_evidence);
-
- f_contents.append(QString::number(current_evidence));
- f_contents.append(ui_evidence_name->text());
- f_contents.append(f_evi.description);
- f_contents.append(f_evi.image);
-
- ao_app->send_server_packet(new AOPacket("EE", f_contents));
-}
-
-void Courtroom::on_evidence_image_name_edited()
-{
- if (current_evidence >= local_evidence_list.size())
- return;
-
- QStringList f_contents;
-
- evi_type f_evi = local_evidence_list.at(current_evidence);
-
- f_contents.append(QString::number(current_evidence));
- f_contents.append(f_evi.name);
- f_contents.append(f_evi.description);
- f_contents.append(ui_evidence_image_name->text());
-
- ao_app->send_server_packet(new AOPacket("EE", f_contents));
-}
-
-void Courtroom::on_evidence_image_button_clicked()
-{
- QFileDialog dialog(this);
- dialog.setFileMode(QFileDialog::ExistingFile);
- dialog.setNameFilter(tr("Images (*.png)"));
- dialog.setViewMode(QFileDialog::List);
- dialog.setDirectory(ao_app->get_evidence_path());
-
- QStringList filenames;
-
- if (dialog.exec())
- filenames = dialog.selectedFiles();
-
- if (filenames.size() != 1)
- return;
-
- QString filename = filenames.at(0);
-
- QStringList split_filename = filename.split("/");
-
- filename = split_filename.at(split_filename.size() - 1);
-
- ui_evidence_image_name->setText(filename);
-
- on_evidence_image_name_edited();
-}
-
-void Courtroom::on_evidence_clicked(int p_id)
-{
- ui_evidence_name->setReadOnly(true);
-
- int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
-
- if (f_real_id == local_evidence_list.size())
- {
- ao_app->send_server_packet(new AOPacket("PE###empty.png#%"));
- return;
- }
- else if (f_real_id > local_evidence_list.size())
- return;
-
- ui_evidence_name->setText(local_evidence_list.at(f_real_id).name);
-
- for (AOEvidenceButton *i_button : ui_evidence_list)
- i_button->set_selected(false);
-
- ui_evidence_list.at(p_id)->set_selected(true);
-
- current_evidence = f_real_id;
-
- ui_ic_chat_message->setFocus();
-
-}
-
-void Courtroom::on_evidence_double_clicked(int p_id)
-{
- int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
-
- if (f_real_id >= local_evidence_list.size())
- return;
-
- current_evidence = f_real_id;
-
- evi_type f_evi = local_evidence_list.at(f_real_id);
-
- ui_evidence_description->clear();
- ui_evidence_description->appendPlainText(f_evi.description);
-
- ui_evidence_image_name->setText(f_evi.image);
-
- ui_evidence_overlay->show();
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_evidence_hover(int p_id, bool p_state)
-{
- ui_evidence_name->setReadOnly(true);
- int final_id = p_id + max_evidence_on_page * current_evidence_page;
-
- if (p_state)
- {
- if (final_id == local_evidence_list.size())
- ui_evidence_name->setText("Add new evidence...");
- else if (final_id < local_evidence_list.size())
- ui_evidence_name->setText(local_evidence_list.at(final_id).name);
- }
- else if (current_evidence < local_evidence_list.size())
- ui_evidence_name->setText(local_evidence_list.at(current_evidence).name);
- else
- ui_evidence_name->setText("");
-}
-
-void Courtroom::on_evidence_left_clicked()
-{
- --current_evidence_page;
-
- set_evidence_page();
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_evidence_right_clicked()
-{
- ++current_evidence_page;
-
- set_evidence_page();
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_evidence_present_clicked()
-{
- if (is_presenting_evidence)
- ui_evidence_present->set_image("present_disabled.png");
- else
- ui_evidence_present->set_image("present.png");
-
- is_presenting_evidence = !is_presenting_evidence;
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_evidence_delete_clicked()
-{
- ui_evidence_description->setReadOnly(true);
- ui_evidence_overlay->hide();
-
- ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
-
- current_evidence = 0;
-
- ui_ic_chat_message->setFocus();
-}
-
-void Courtroom::on_evidence_x_clicked()
-{
- ui_evidence_description->setReadOnly(true);
- ui_evidence_overlay->hide();
-
- if (current_evidence >= local_evidence_list.size())
- return;
-
- QStringList f_contents;
-
- evi_type f_evi = local_evidence_list.at(current_evidence);
-
- f_contents.append(QString::number(current_evidence));
- f_contents.append(f_evi.name);
- f_contents.append(ui_evidence_description->toPlainText());
- f_contents.append(f_evi.image);
-
- ao_app->send_server_packet(new AOPacket("EE", f_contents));
-
- ui_ic_chat_message->setFocus();
-}
-
diff --git a/file_functions.cpp b/file_functions.cpp
deleted file mode 100644
index f3a634fa5..000000000
--- a/file_functions.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include
-#include
-
-#include "file_functions.h"
-
-bool file_exists(QString file_path)
-{
- QFileInfo check_file(file_path);
-
- return check_file.exists() && check_file.isFile();
-}
-
-QString file_exists(QString file_path, QVector p_exts)
-{
- for(auto &ext : p_exts)
- {
- if(file_exists(file_path + ext))
- return ext;
- }
- return "";
-}
-
-bool dir_exists(QString dir_path)
-{
- QDir check_dir(dir_path);
-
- return check_dir.exists();
-}
diff --git a/file_functions.h b/file_functions.h
deleted file mode 100644
index 97b4da7a8..000000000
--- a/file_functions.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef FILE_FUNCTIONS_H
-#define FILE_FUNCTIONS_H
-
-#include
-#include
-
-bool file_exists(QString file_path);
-QString file_exists(QString file_path, QVector p_exts);
-bool dir_exists(QString file_path);
-
-#endif // FILE_FUNCTIONS_H
diff --git a/hardware_functions.cpp b/hardware_functions.cpp
deleted file mode 100644
index 29823cdfb..000000000
--- a/hardware_functions.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "hardware_functions.h"
-
-#include
-
-#if (defined (_WIN32) || defined (_WIN64))
-#include
-
-DWORD dwVolSerial;
-BOOL bIsRetrieved;
-
-QString get_hdid()
-{
- bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), NULL, NULL, &dwVolSerial, NULL, NULL, NULL, NULL);
-
- if (bIsRetrieved)
- return QString::number(dwVolSerial, 16);
- else
- //a totally random string
- //what could possibly go wrong
- return "gxsps32sa9fnwic92mfbs0";
-
-}
-
-#elif (defined (LINUX) || defined (__linux__))
-
-#include
-#include
-
-QString get_hdid()
-{
- QFile fstab_file("/etc/fstab");
- if (!fstab_file.open(QIODevice::ReadOnly))
- return "gxcps32sa9fnwic92mfbs0";
-
- QTextStream in(&fstab_file);
-
- while(!in.atEnd())
- {
- QString line = in.readLine();
-
- if (line.startsWith("UUID"))
- {
- QStringList line_elements = line.split("=");
-
- if (line_elements.size() > 1)
- return line_elements.at(1).left(23).trimmed();
- }
- }
-
- return "gxcpz32sa9fnwic92mfbs0";
-}
-
-#else
-
-#error This operating system is unsupported for hardware functions.
-
-#endif
diff --git a/hex_functions.cpp b/hex_functions.cpp
deleted file mode 100644
index 9db2b0a73..000000000
--- a/hex_functions.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//WELCOME TO THE EXTREMELY GHETTO HEX CONVERSION KLUDGE BECAUSE I COULDNT MAKE ANYTHING ELSE WORK
-
-#include "hex_functions.h"
-
-namespace omni
-{
- char halfword_to_hex_char(unsigned int input)
- {
- if (input > 127)
- return 'F';
-
- switch (input)
- {
- case 0:
- return '0';
- case 1:
- return '1';
- case 2:
- return '2';
- case 3:
- return '3';
- case 4:
- return '4';
- case 5:
- return '5';
- case 6:
- return '6';
- case 7:
- return '7';
- case 8:
- return '8';
- case 9:
- return '9';
- case 10:
- return 'A';
- case 11:
- return 'B';
- case 12:
- return 'C';
- case 13:
- return 'D';
- case 14:
- return 'E';
- case 15:
- return 'F';
- default:
- return 'F';
- }
- }
-
- std::string int_to_hex(unsigned int input)
- {
- if (input > 255)
- return "FF";
-
- std::bitset<8> whole_byte(input);
- //240 represents 11110000, our needed bitmask
- uint8_t left_mask_int = 240;
- std::bitset<8> left_mask(left_mask_int);
- std::bitset<8> left_halfword((whole_byte & left_mask) >> 4);
- //likewise, 15 represents 00001111
- uint8_t right_mask_int = 15;
- std::bitset<8> right_mask(right_mask_int);
- std::bitset<8> right_halfword((whole_byte & right_mask));
-
- unsigned int left = left_halfword.to_ulong();
- unsigned int right = right_halfword.to_ulong();
-
- //std::cout << "now have have " << left << " and " << right << '\n';
-
- char a = halfword_to_hex_char(left);
- char b = halfword_to_hex_char(right);
-
- std::string left_string(1, a);
- std::string right_string(1, b);
-
- std::string final_byte = left_string + right_string;
-
- //std::string final_byte = halfword_to_hex_char(left) + "" + halfword_to_hex_char(right);
-
- return final_byte;
- }
-} //namespace omni
diff --git a/hex_functions.h b/hex_functions.h
deleted file mode 100644
index 47d9466b7..000000000
--- a/hex_functions.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef HEX_OPERATIONS_H
-#define HEX_OPERATIONS_H
-
-#include
-#include
-#include
-
-namespace omni
-{
- char halfword_to_hex_char(unsigned int input);
- std::string int_to_hex(unsigned int input);
-}
-
-#endif //HEX_OPERATIONS_H
diff --git a/icon-2x.png b/icon-2x.png
new file mode 100644
index 000000000..9c46fb462
Binary files /dev/null and b/icon-2x.png differ
diff --git a/icon-filled.png b/icon-filled.png
new file mode 100644
index 000000000..40119dddf
Binary files /dev/null and b/icon-filled.png differ
diff --git a/logo.ico b/icon-transparent.ico
similarity index 100%
rename from logo.ico
rename to icon-transparent.ico
diff --git a/logo.png b/icon-transparent.png
similarity index 100%
rename from logo.png
rename to icon-transparent.png
diff --git a/icon.icns b/icon.icns
new file mode 100644
index 000000000..c03b205f7
Binary files /dev/null and b/icon.icns differ
diff --git a/icon.ico b/icon.ico
new file mode 100644
index 000000000..cd9d4b7d4
Binary files /dev/null and b/icon.ico differ
diff --git a/icon.png b/icon.png
new file mode 100644
index 000000000..3e423a018
Binary files /dev/null and b/icon.png differ
diff --git a/lobby.cpp b/lobby.cpp
deleted file mode 100644
index bba8dddee..000000000
--- a/lobby.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-#include "lobby.h"
-
-#include "debug_functions.h"
-#include "aoapplication.h"
-#include "networkmanager.h"
-#include "aosfxplayer.h"
-
-#include
-#include
-
-Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
-{
- ao_app = p_ao_app;
-
- this->setWindowTitle("Danganronpa Online");
-
- ui_background = new AOImage(this, ao_app);
- ui_public_servers = new AOButton(this, ao_app);
- ui_favorites = new AOButton(this, ao_app);
- ui_refresh = new AOButton(this, ao_app);
- ui_add_to_fav = new AOButton(this, ao_app);
- ui_connect = new AOButton(this, ao_app);
- ui_version = new QLabel(this);
- ui_about = new AOButton(this, ao_app);
- ui_server_list = new QListWidget(this);
- ui_player_count = new QLabel(this);
- ui_description = new AOTextArea(this);
- ui_chatbox = new AOTextArea(this);
- ui_chatbox->setOpenExternalLinks(true);
- ui_chatname = new QLineEdit(this);
- ui_chatname->setPlaceholderText("Name");
- ui_chatmessage = new QLineEdit(this);
- ui_loading_background = new AOImage(this, ao_app);
- ui_loading_text = new QTextEdit(ui_loading_background);
- ui_progress_bar = new QProgressBar(ui_loading_background);
- ui_progress_bar->setMinimum(0);
- ui_progress_bar->setMaximum(100);
- ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }");
- ui_cancel = new AOButton(ui_loading_background, ao_app);
-
- connect(ui_public_servers, SIGNAL(clicked()), this, SLOT(on_public_servers_clicked()));
- connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_clicked()));
- connect(ui_refresh, SIGNAL(pressed()), this, SLOT(on_refresh_pressed()));
- connect(ui_refresh, SIGNAL(released()), this, SLOT(on_refresh_released()));
- connect(ui_add_to_fav, SIGNAL(pressed()), this, SLOT(on_add_to_fav_pressed()));
- connect(ui_add_to_fav, SIGNAL(released()), this, SLOT(on_add_to_fav_released()));
- connect(ui_connect, SIGNAL(pressed()), this, SLOT(on_connect_pressed()));
- connect(ui_connect, SIGNAL(released()), this, SLOT(on_connect_released()));
- connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked()));
- connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_server_list_clicked(QModelIndex)));
- connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed()));
- connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
-
- set_widgets();
-}
-
-//sets images, position and size
-void Lobby::set_widgets()
-{
- ao_app->reload_theme();
-
- QString filename = "lobby_design.ini";
-
- pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
-
- if (f_lobby.width < 0 || f_lobby.height < 0)
- {
- qDebug() << "W: did not find lobby width or height in " << filename;
-
- // Most common symptom of bad config files and missing assets.
- call_notice("It doesn't look like your client is set up correctly.\n"
- "Did you download all resources correctly from tiny.cc/getao, "
- "including the large 'base' folder?");
-
- this->resize(517, 666);
- }
- else
- {
- this->resize(f_lobby.width, f_lobby.height);
- }
-
- set_size_and_pos(ui_background, "lobby");
- ui_background->set_image("lobbybackground.png");
-
- set_size_and_pos(ui_public_servers, "public_servers");
- ui_public_servers->set_image("publicservers_selected.png");
-
- set_size_and_pos(ui_favorites, "favorites");
- ui_favorites->set_image("favorites.png");
-
- set_size_and_pos(ui_refresh, "refresh");
- ui_refresh->set_image("refresh.png");
-
- set_size_and_pos(ui_add_to_fav, "add_to_fav");
- ui_add_to_fav->set_image("addtofav.png");
-
- set_size_and_pos(ui_connect, "connect");
- ui_connect->set_image("connect.png");
-
- set_size_and_pos(ui_version, "version");
- ui_version->setText("Version: " + ao_app->get_version_string());
-
- set_size_and_pos(ui_about, "about");
- ui_about->set_image("about.png");
-
- set_size_and_pos(ui_server_list, "server_list");
- ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "font: bold;");
-
- set_size_and_pos(ui_player_count, "player_count");
- ui_player_count->setText("Offline");
- ui_player_count->setStyleSheet("font: bold;"
- "color: white;"
- "qproperty-alignment: AlignCenter;");
-
- set_size_and_pos(ui_description, "description");
- ui_description->setReadOnly(true);
- ui_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: white;");
-
- set_size_and_pos(ui_chatbox, "chatbox");
- ui_chatbox->setReadOnly(true);
- ui_chatbox->setStyleSheet("QTextBrowser{background-color: rgba(0, 0, 0, 0);}");
-
- set_size_and_pos(ui_chatname, "chatname");
- ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "selection-background-color: rgba(0, 0, 0, 0);");
-
- set_size_and_pos(ui_chatmessage, "chatmessage");
- ui_chatmessage->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "selection-background-color: rgba(0, 0, 0, 0);");
-
- ui_loading_background->resize(this->width(), this->height());
- ui_loading_background->set_image("loadingbackground.png");
-
-
- set_size_and_pos(ui_loading_text, "loading_label");
- ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold));
- ui_loading_text->setReadOnly(true);
- ui_loading_text->setAlignment(Qt::AlignCenter);
- ui_loading_text->setFrameStyle(QFrame::NoFrame);
- ui_loading_text->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "color: rgba(255, 128, 0, 255);");
- ui_loading_text->append("Loading");
-
- set_size_and_pos(ui_progress_bar, "progress_bar");
- set_size_and_pos(ui_cancel, "cancel");
- ui_cancel->setText("Cancel");
-
- ui_loading_background->hide();
-
- set_fonts();
- set_stylesheets();
-}
-
-void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
-{
- QString filename = "lobby_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;
- p_widget->hide();
- }
- else
- {
- p_widget->move(design_ini_result.x, design_ini_result.y);
- p_widget->resize(design_ini_result.width, design_ini_result.height);
- }
-}
-
-void Lobby::set_fonts()
-{
- set_font(ui_player_count, "player_count");
- set_font(ui_description, "description");
- set_font(ui_chatbox, "chatbox");
- set_font(ui_chatname, "chatname");
- set_font(ui_chatmessage, "chatmessage");
- set_font(ui_loading_text, "loading_text");
- set_font(ui_server_list, "server_list");
-}
-
-void Lobby::set_stylesheet(QWidget *widget, QString target_tag)
-{
- QString f_file = "lobby_stylesheets.css";
- QString style_sheet_string = ao_app->get_stylesheet(target_tag, f_file);
- if (style_sheet_string != "")
- widget->setStyleSheet(style_sheet_string);
-}
-
-void Lobby::set_stylesheets()
-{
- set_stylesheet(ui_player_count, "[PLAYER COUNT]");
- set_stylesheet(ui_description, "[DESCRIPTION]");
- set_stylesheet(ui_chatbox, "[CHAT BOX]");
- set_stylesheet(ui_chatname, "[CHAT NAME]");
- set_stylesheet(ui_chatmessage, "[CHAT MESSAGE]");
- set_stylesheet(ui_loading_text, "[LOADING TEXT]");
- set_stylesheet(ui_server_list, "[SERVER LIST]");
-}
-
-void Lobby::set_font(QWidget *widget, QString p_identifier)
-{
- QString design_file = "lobby_fonts.ini";
- int f_weight = ao_app->get_font_size(p_identifier, design_file);
- QString class_name = widget->metaObject()->className();
-
- QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file);
-
- QFont font(font_name, f_weight);
-
- bool use = (bool)ao_app->get_font_size("use_custom_fonts", design_file);
-
- if(use)
- {
- widget->setFont(font);
-
- QColor f_color = ao_app->get_color(p_identifier + "_color", design_file);
-
- bool bold = (bool)ao_app->get_font_size(p_identifier + "_bold", design_file); // is the font bold or not?
- bool center = (bool)ao_app->get_font_size(p_identifier + "_center", design_file); // should it be centered?
-
-
- QString is_bold = "";
- if(bold) is_bold = "bold";
-
- QString is_center = "";
- if(center) is_center = "qproperty-alignment: AlignCenter;";
-
- QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" +
- "color: rgba(" +
- QString::number(f_color.red()) + ", " +
- QString::number(f_color.green()) + ", " +
- QString::number(f_color.blue()) + ", 255);\n" +
- is_center + "\n" +
- "font: " + is_bold + "; }";
-
- widget->setStyleSheet(style_sheet_string);
- }
-
-
- return;
-}
-
-void Lobby::set_loading_text(QString p_text)
-{
- ui_loading_text->clear();
- ui_loading_text->setAlignment(Qt::AlignCenter);
- ui_loading_text->append(p_text);
-}
-
-QString Lobby::get_chatlog()
-{
- QString return_value = ui_chatbox->toPlainText();
-
- return return_value;
-}
-
-int Lobby::get_selected_server()
-{
- return ui_server_list->currentRow();
-}
-
-void Lobby::set_loading_value(int p_value)
-{
- ui_progress_bar->setValue(p_value);
-}
-
-void Lobby::on_public_servers_clicked()
-{
- ui_public_servers->set_image("publicservers_selected.png");
- ui_favorites->set_image("favorites.png");
-
- list_servers();
-
- public_servers_selected = true;
-}
-
-void Lobby::on_favorites_clicked()
-{
- ui_favorites->set_image("favorites_selected.png");
- ui_public_servers->set_image("publicservers.png");
-
- ao_app->set_favorite_list();
- //ao_app->favorite_list = read_serverlist_txt();
-
- list_favorites();
-
- public_servers_selected = false;
-}
-
-void Lobby::on_refresh_pressed()
-{
- ui_refresh->set_image("refresh_pressed.png");
-}
-
-void Lobby::on_refresh_released()
-{
- ui_refresh->set_image("refresh.png");
-
- AOPacket *f_packet = new AOPacket("ALL#%");
-
- ao_app->send_ms_packet(f_packet);
-}
-
-void Lobby::on_add_to_fav_pressed()
-{
- ui_add_to_fav->set_image("addtofav_pressed.png");
-}
-
-void Lobby::on_add_to_fav_released()
-{
- ui_add_to_fav->set_image("addtofav.png");
-
- //you cant add favorites from favorites m8
- if (!public_servers_selected)
- return;
-
- ao_app->add_favorite_server(ui_server_list->currentRow());
-}
-
-void Lobby::on_connect_pressed()
-{
- ui_connect->set_image("connect_pressed.png");
-}
-
-void Lobby::on_connect_released()
-{
- ui_connect->set_image("connect.png");
-
- AOPacket *f_packet;
-
- f_packet = new AOPacket("askchaa#%");
-
- ao_app->send_server_packet(f_packet);
-}
-
-void Lobby::on_about_clicked()
-{
- call_notice("Attorney Online 2 is built using Qt 5.7\n\n"
- "Lead development:\n"
- "OmniTroid\n\n"
- "stonedDiscord\n"
- "longbyte1\n"
- "Supporting development:\n"
- "Fiercy\n\n"
- "UI design:\n"
- "Ruekasu\n"
- "Draxirch\n\n"
- "Special thanks:\n"
- "Unishred\n"
- "Argoneus\n"
- "Noevain\n"
- "Cronnicossy");
-}
-
-void Lobby::on_server_list_clicked(QModelIndex p_model)
-{
- server_type f_server;
- int n_server = p_model.row();
-
- if (n_server < 0)
- return;
-
- if (public_servers_selected)
- {
- QVector f_server_list = ao_app->get_server_list();
-
- if (n_server >= f_server_list.size())
- return;
-
- f_server = f_server_list.at(p_model.row());
- }
- else
- {
- if (n_server >= ao_app->get_favorite_list().size())
- return;
-
- f_server = ao_app->get_favorite_list().at(p_model.row());
- }
-
- ui_description->clear();
- ui_description->append(f_server.desc);
-
- ui_description->moveCursor(QTextCursor::Start);
- ui_description->ensureCursorVisible();
-
- ui_player_count->setText("Offline");
-
- ao_app->net_manager->connect_to_server(f_server);
-}
-
-void Lobby::on_chatfield_return_pressed()
-{
- //no you can't send empty messages
- if (ui_chatname->text() == "" || ui_chatmessage->text() == "")
- return;
-
-
- QString f_header = "CT";
- QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
-
- AOPacket *f_packet = new AOPacket(f_header, f_contents);
-
- ao_app->send_ms_packet(f_packet);
-
- ui_chatmessage->clear();
-}
-
-void Lobby::list_servers()
-{
- public_servers_selected = true;
- ui_favorites->set_image("favorites.png");
- ui_public_servers->set_image("publicservers_selected.png");
-
- ui_server_list->clear();
-
- for (server_type i_server : ao_app->get_server_list())
- {
- ui_server_list->addItem(i_server.name);
- }
-}
-
-void Lobby::list_favorites()
-{
- ui_server_list->clear();
-
- for (server_type i_server : ao_app->get_favorite_list())
- {
- ui_server_list->addItem(i_server.name);
- }
-}
-
-void Lobby::append_chatmessage(QString f_name, QString f_message)
-{
- ui_chatbox->append_chatmessage(f_name, f_message);
-}
-
-void Lobby::append_error(QString f_message)
-{
- ui_chatbox->append_error(f_message);
-}
-
-void Lobby::set_player_count(int players_online, int max_players)
-{
- QString f_string = "Online: " + QString::number(players_online) + "/" + QString::number(max_players);
- ui_player_count->setText(f_string);
-}
-
-Lobby::~Lobby()
-{
-
-}
diff --git a/lobby.h b/lobby.h
deleted file mode 100644
index e0eb0bfa0..000000000
--- a/lobby.h
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef LOBBY_H
-#define LOBBY_H
-
-#include "aoimage.h"
-#include "aobutton.h"
-#include "aopacket.h"
-#include "aotextarea.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-class AOApplication;
-
-class Lobby : public QMainWindow
-{
- Q_OBJECT
-
-public:
- Lobby(AOApplication *p_ao_app);
-
- void set_widgets();
- void list_servers();
- void list_favorites();
- void append_chatmessage(QString f_name, QString f_message);
- void append_error(QString f_message);
- void set_player_count(int players_online, int max_players);
- void set_loading_text(QString p_text);
- void set_stylesheet(QWidget *widget, QString target_tag);
- void set_stylesheets();
- void set_fonts();
- void set_font(QWidget *widget, QString p_identifier);
- void show_loading_overlay(){ui_loading_background->show();}
- void hide_loading_overlay(){ui_loading_background->hide();}
- QString get_chatlog();
- int get_selected_server();
-
- void set_loading_value(int p_value);
-
- bool public_servers_selected = true;
-
- ~Lobby();
-
-private:
- AOApplication *ao_app = nullptr;
-
- AOImage *ui_background;
-
- AOButton *ui_public_servers;
- AOButton *ui_favorites;
-
- AOButton *ui_refresh;
- AOButton *ui_add_to_fav;
- AOButton *ui_connect;
-
- QLabel *ui_version;
- AOButton *ui_about;
-
- QListWidget *ui_server_list;
-
- QLabel *ui_player_count;
- AOTextArea *ui_description;
-
- AOTextArea *ui_chatbox;
-
- QLineEdit *ui_chatname;
- QLineEdit *ui_chatmessage;
-
- AOImage *ui_loading_background;
- QTextEdit *ui_loading_text;
- QProgressBar *ui_progress_bar;
- AOButton *ui_cancel;
-
- void set_size_and_pos(QWidget *p_widget, QString p_identifier);
-
-private slots:
- void on_public_servers_clicked();
- void on_favorites_clicked();
-
- void on_refresh_pressed();
- void on_refresh_released();
- void on_add_to_fav_pressed();
- void on_add_to_fav_released();
- void on_connect_pressed();
- void on_connect_released();
- void on_about_clicked();
- void on_server_list_clicked(QModelIndex p_model);
- void on_chatfield_return_pressed();
-};
-
-#endif // LOBBY_H
diff --git a/main.cpp b/main.cpp
deleted file mode 100644
index 46a870339..000000000
--- a/main.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "aoapplication.h"
-
-#include "datatypes.h"
-#include "networkmanager.h"
-#include "lobby.h"
-#include "courtroom.h"
-#include
-#include
-#include
-
-int main(int argc, char *argv[])
-{
-#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
- // High-DPI support is for Qt version >=5.6.
- // However, many Linux distros still haven't brought their stable/LTS
- // packages up to Qt 5.6, so this is conditional.
- AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
-#endif
-
- QPluginLoader apng("imageformats/qapng.dll");
- if (!apng.load())
- {
- qDebug() << apng.errorString();
- }
-
- AOApplication main_app(argc, argv);
- main_app.construct_lobby();
-#ifndef INDEV
- main_app.net_manager->connect_to_master();
-#endif
- main_app.w_lobby->show();
-
- return main_app.exec();
-}
diff --git a/networkmanager.cpp b/networkmanager.cpp
deleted file mode 100644
index 0c97cef2b..000000000
--- a/networkmanager.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-#include "networkmanager.h"
-
-#include "datatypes.h"
-#include "debug_functions.h"
-#include "lobby.h"
-
-#include
-
-NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent)
-{
- ao_app = parent;
-
- ms_socket = new QTcpSocket(this);
- server_socket = new QTcpSocket(this);
-
- ms_reconnect_timer = new QTimer(this);
- ms_reconnect_timer->setSingleShot(true);
- QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect()));
-
- QObject::connect(ms_socket, SIGNAL(readyRead()), this, SLOT(handle_ms_packet()));
- QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet()));
- QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected()));
-}
-
-NetworkManager::~NetworkManager()
-{
-
-}
-
-void NetworkManager::connect_to_master()
-{
- ms_socket->close();
- ms_socket->abort();
-
-#ifdef MS_FAILOVER_SUPPORTED
- perform_srv_lookup();
-#else
- connect_to_master_nosrv();
-#endif
-}
-
-void NetworkManager::connect_to_master_nosrv()
-{
- QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
-
- QObject::connect(ms_socket, SIGNAL(connected()),
- this, SLOT(on_ms_nosrv_connect_success()));
- ms_socket->connectToHost(ms_nosrv_hostname, ms_port);
-}
-
-void NetworkManager::connect_to_server(server_type p_server)
-{
- server_socket->close();
- server_socket->abort();
-
- server_socket->connectToHost(p_server.ip, p_server.port);
-}
-
-void NetworkManager::ship_ms_packet(QString p_packet)
-{
- if (!ms_socket->isOpen())
- {
- retry_ms_connect();
- }
- else
- {
- ms_socket->write(p_packet.toUtf8());
- }
-}
-
-void NetworkManager::ship_server_packet(QString p_packet)
-{
- server_socket->write(p_packet.toUtf8());
-}
-
-void NetworkManager::handle_ms_packet()
-{
- QByteArray buffer = ms_socket->readAll();
- QString in_data = QString::fromUtf8(buffer, buffer.size());
-
- if (!in_data.endsWith("%"))
- {
- ms_partial_packet = true;
- ms_temp_packet += in_data;
- return;
- }
-
- else
- {
- if (ms_partial_packet)
- {
- in_data = ms_temp_packet + in_data;
- ms_temp_packet = "";
- ms_partial_packet = false;
- }
- }
-
- QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
-
- for (QString packet : packet_list)
- {
- AOPacket *f_packet = new AOPacket(packet);
-
- ao_app->ms_packet_received(f_packet);
- }
-}
-
-
-void NetworkManager::perform_srv_lookup()
-{
- #ifdef MS_FAILOVER_SUPPORTED
- ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this);
-
- connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup()));
- ms_dns->lookup();
- #endif
-}
-
-void NetworkManager::on_srv_lookup()
-{
- #ifdef MS_FAILOVER_SUPPORTED
- bool connected = false;
- if (ms_dns->error() != QDnsLookup::NoError)
- {
- qWarning("SRV lookup of the master server DNS failed.");
- ms_dns->deleteLater();
- }
- else
- {
- const auto srv_records = ms_dns->serviceRecords();
-
- for (const QDnsServiceRecord &record : srv_records)
- {
- qDebug() << "Connecting to " << record.target() << ":" << record.port();
- ms_socket->connectToHost(record.target(), record.port());
- QTime timer;
- timer.start();
- do
- {
- ao_app->processEvents();
- if (ms_socket->state() == QAbstractSocket::ConnectedState)
- {
- connected = true;
- break;
- }
- else if (ms_socket->state() != QAbstractSocket::ConnectingState
- && ms_socket->state() != QAbstractSocket::HostLookupState
- && ms_socket->error() != -1)
- {
- qDebug() << ms_socket->error();
- qWarning() << "Error connecting to master server:" << ms_socket->errorString();
- ms_socket->abort();
- ms_socket->close();
- break;
- }
- } while (timer.elapsed() < timeout_milliseconds); // Very expensive spin-wait loop - it will bring CPU to 100%!
- if (connected)
- {
- // Connect a one-shot signal in case the master server disconnects randomly
- QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
- break;
- }
- else
- {
- ms_socket->abort();
- ms_socket->close();
- }
- }
- }
-
- // Failover to non-SRV connection
- if (!connected)
- connect_to_master_nosrv();
- else
- emit ms_connect_finished(connected, false);
- #endif
-}
-
-void NetworkManager::on_ms_nosrv_connect_success()
-{
- emit ms_connect_finished(true, false);
-
- QObject::disconnect(ms_socket, SIGNAL(connected()),
- this, SLOT(on_ms_nosrv_connect_success()));
-
- QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
-}
-
-void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error)
-{
- qWarning() << "Master server socket error:" << ms_socket->errorString()
- << "(" << error << ")";
-
- // Disconnect the one-shot signal - this way, failover connect attempts
- // don't trigger a full retry
- QObject::disconnect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
-
- emit ms_connect_finished(false, true);
-
- ms_reconnect_timer->start(ms_reconnect_delay_ms);
-}
-
-void NetworkManager::retry_ms_connect()
-{
- if (!ms_reconnect_timer->isActive() && ms_socket->state() != QAbstractSocket::ConnectingState)
- connect_to_master();
-}
-
-void NetworkManager::handle_server_packet()
-{
- QByteArray buffer = server_socket->readAll();
- QString in_data = QString::fromUtf8(buffer, buffer.size());
-
- if (!in_data.endsWith("%"))
- {
- partial_packet = true;
- temp_packet += in_data;
- return;
- }
-
- else
- {
- if (partial_packet)
- {
- in_data = temp_packet + in_data;
- temp_packet = "";
- partial_packet = false;
- }
- }
-
- QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
-
- for (QString packet : packet_list)
- {
- AOPacket *f_packet = new AOPacket(packet);
-
- ao_app->server_packet_received(f_packet);
- }
-}
-
diff --git a/networkmanager.h b/networkmanager.h
deleted file mode 100644
index 5003883a4..000000000
--- a/networkmanager.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef NETWORKMANAGER_H
-#define NETWORKMANAGER_H
-
-// Qt for Android has stubbed QDnsLookup. This is not documented in any part of their wiki.
-// This prevents SRV lookup/failover behavior from functioning.
-// https://bugreports.qt.io/browse/QTBUG-56143
-#ifndef ANDROID
-#define MS_FAILOVER_SUPPORTED
-#endif
-
-//#define LOCAL_MS
-
-#ifdef LOCAL_MS
-#undef MS_FAILOVER_SUPPORTED
-#endif
-
-#include "aopacket.h"
-#include "aoapplication.h"
-
-#include
-#include
-#include
-#include
-
-class NetworkManager : public QObject
-{
- Q_OBJECT
-
-public:
- NetworkManager(AOApplication *parent);
- ~NetworkManager();
-
- AOApplication *ao_app = nullptr;
- QTcpSocket *ms_socket;
- QTcpSocket *server_socket;
- QDnsLookup *ms_dns;
- QTimer *ms_reconnect_timer;
-
- const QString ms_srv_hostname = "_aoms._tcp.aceattorneyonline.com";
-#ifdef LOCAL_MS
- const QString ms_nosrv_hostname = "localhost";
-#else
- const QString ms_nosrv_hostname = "master.aceattorneyonline.com";
-#endif
-
- static const int ms_port = 27016;
- static const int timeout_milliseconds = 2000;
-
- static const int ms_reconnect_delay_ms = 7000;
-
- bool ms_partial_packet = false;
- QString ms_temp_packet = "";
-
- bool partial_packet = false;
- QString temp_packet = "";
-
- unsigned int s_decryptor = 5;
-
- void connect_to_master();
- void connect_to_master_nosrv();
- void connect_to_server(server_type p_server);
-
-public slots:
- void ship_ms_packet(QString p_packet);
- void ship_server_packet(QString p_packet);
-
-signals:
- void ms_connect_finished(bool success, bool will_retry);
-
-private:
- void perform_srv_lookup();
-
-private slots:
- void on_srv_lookup();
- void handle_ms_packet();
- void handle_server_packet();
- void on_ms_nosrv_connect_success();
- void on_ms_socket_error(QAbstractSocket::SocketError error);
- void retry_ms_connect();
-};
-
-#endif // NETWORKMANAGER_H
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
deleted file mode 100644
index 2f030918f..000000000
--- a/packet_distribution.cpp
+++ /dev/null
@@ -1,707 +0,0 @@
-#include "aoapplication.h"
-
-#include "lobby.h"
-#include "courtroom.h"
-#include "networkmanager.h"
-#include "encryption_functions.h"
-#include "hardware_functions.h"
-#include "debug_functions.h"
-
-#include
-#include
-
-void AOApplication::ms_packet_received(AOPacket *p_packet)
-{
- p_packet->net_decode();
-
- QString header = p_packet->get_header();
- QStringList f_contents = p_packet->get_contents();
-
- if (header != "CHECK")
- qDebug() << "R(ms):" << p_packet->to_string();
-
- if (header == "ALL")
- {
- server_list.clear();
-
- for (QString i_string : p_packet->get_contents())
- {
- server_type f_server;
- QStringList sub_contents = i_string.split("&");
-
- if (sub_contents.size() < 4)
- {
- qDebug() << "W: malformed packet";
- continue;
- }
-
- f_server.name = sub_contents.at(0);
- f_server.desc = sub_contents.at(1);
- f_server.ip = sub_contents.at(2);
- f_server.port = sub_contents.at(3).toInt();
-
- server_list.append(f_server);
- }
-
- if (lobby_constructed)
- {
- w_lobby->list_servers();
- }
- }
- else if (header == "CT")
- {
- QString f_name, f_message;
-
- if (f_contents.size() == 1)
- {
- f_name = "";
- f_message = f_contents.at(0);
- }
- else if (f_contents.size() >= 2)
- {
- f_name = f_contents.at(0);
- f_message = f_contents.at(1);
- }
- else
- goto end;
-
- if (lobby_constructed)
- {
- w_lobby->append_chatmessage(f_name, f_message);
- }
- if (courtroom_constructed && courtroom_loaded)
- {
- w_courtroom->append_ms_chatmessage(f_name, f_message);
- }
- }
- else if (header == "AO2CHECK")
- {
- send_ms_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
- send_ms_packet(new AOPacket("HI#" + get_hdid() + "#%"));
-
- if (f_contents.size() < 1)
- goto end;
-
- QStringList version_contents = f_contents.at(0).split(".");
-
- if (version_contents.size() < 3)
- goto end;
-
- int f_release = version_contents.at(0).toInt();
- int f_major = version_contents.at(1).toInt();
- int f_minor = version_contents.at(2).toInt();
-
- if (get_release() > f_release)
- goto end;
- else if (get_release() == f_release)
- {
- if (get_major_version() > f_major)
- goto end;
- else if (get_major_version() == f_major)
- {
- if (get_minor_version() >= f_minor)
- goto end;
- }
- }
-
- call_notice("Outdated version! Your version: " + get_version_string()
- + "\nPlease go to aceattorneyonline.com to update.");
- destruct_courtroom();
- destruct_lobby();
- }
- else if (header == "DOOM")
- {
- call_notice("You have been exiled from AO."
- "Have a nice day.");
- destruct_courtroom();
- destruct_lobby();
- }
-
- end:
-
- delete p_packet;
-}
-
-void AOApplication::server_packet_received(AOPacket *p_packet)
-{
- p_packet->net_decode();
-
- QString header = p_packet->get_header();
- QStringList f_contents = p_packet->get_contents();
- QString f_packet = p_packet->to_string();
-
- if (header != "checkconnection")
- qDebug() << "R:" << f_packet;
-
- if (header == "decryptor")
- {
- if (f_contents.size() == 0)
- goto end;
-
- //you may ask where 322 comes from. that would be a good question.
- s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt();
-
- //default(legacy) values
- encryption_needed = true;
- yellow_text_enabled = false;
- prezoom_enabled = false;
- flipping_enabled = false;
- custom_objection_enabled = false;
- improved_loading_enabled = false;
- desk_mod_enabled = false;
- evidence_enabled = false;
-
- //workaround for tsuserver4
- if (f_contents.at(0) == "NOENCRYPT")
- encryption_needed = false;
-
- QString f_hdid;
- f_hdid = get_hdid();
-
- AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%");
- send_server_packet(hi_packet);
- }
- else if (header == "ID")
- {
- if (f_contents.size() < 2)
- goto end;
-
- s_pv = f_contents.at(0).toInt();
- server_software = f_contents.at(1);
-
- send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
- }
- else if (header == "CT")
- {
- if (f_contents.size() < 2)
- goto end;
-
- if (courtroom_constructed)
- w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1));
- }
- else if (header == "FL")
- {
- if (f_packet.contains("yellowtext",Qt::CaseInsensitive))
- yellow_text_enabled = true;
- if (f_packet.contains("flipping",Qt::CaseInsensitive))
- flipping_enabled = true;
- if (f_packet.contains("customobjections",Qt::CaseInsensitive))
- custom_objection_enabled = true;
- if (f_packet.contains("fastloading",Qt::CaseInsensitive))
- improved_loading_enabled = true;
- if (f_packet.contains("noencryption",Qt::CaseInsensitive))
- encryption_needed = false;
- if (f_packet.contains("deskmod",Qt::CaseInsensitive))
- desk_mod_enabled = true;
- if (f_packet.contains("evidence",Qt::CaseInsensitive))
- evidence_enabled = true;
- }
- else if (header == "PN")
- {
- if (f_contents.size() < 2)
- goto end;
-
- w_lobby->set_player_count(f_contents.at(0).toInt(), f_contents.at(1).toInt());
- }
- else if (header == "SI")
- {
- if (f_contents.size() != 3)
- goto end;
-
- char_list_size = f_contents.at(0).toInt();
- evidence_list_size = f_contents.at(1).toInt();
- music_list_size = f_contents.at(2).toInt();
-
- if (char_list_size < 1 || evidence_list_size < 0 || music_list_size < 0)
- goto end;
-
- loaded_chars = 0;
- loaded_evidence = 0;
- loaded_music = 0;
-
- destruct_courtroom();
- construct_courtroom();
-
- courtroom_loaded = false;
-
- QString window_title = "Danganronpa Online";
- int selected_server = w_lobby->get_selected_server();
-
- QString server_address = "", server_name = "";
- if (w_lobby->public_servers_selected)
- {
- if (selected_server >= 0 && selected_server < server_list.size()) {
- auto info = server_list.at(selected_server);
- server_name = info.name;
- server_address = info.ip + info.port;
- window_title += ": " + server_name;
- }
- }
- else
- {
- if (selected_server >= 0 && selected_server < favorite_list.size()) {
- auto info = favorite_list.at(selected_server);
- server_name = info.name;
- server_address = info.ip + info.port;
- window_title += ": " + server_name;
- }
- }
-
- w_courtroom->set_window_title(window_title);
-
- w_lobby->show_loading_overlay();
- w_lobby->set_loading_text("Loading");
- w_lobby->set_loading_value(0);
-
- AOPacket *f_packet;
-
- if(improved_loading_enabled)
- f_packet = new AOPacket("RC#%");
- else
- f_packet = new AOPacket("askchar2#%");
-
- send_server_packet(f_packet);
-
- QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256);
- hash.addData(server_address.toUtf8());
- 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 + evidence_list_size + music_list_size;
- int loading_value = (loaded_chars / static_cast(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)
- goto end;
-
-
- // +1 because evidence starts at 1 rather than 0 for whatever reason
- //enjoy fanta
- if (f_contents.at(0).toInt() != loaded_evidence + 1)
- goto end;
-
- if (f_contents.size() < 2)
- goto end;
-
- QStringList sub_elements = f_contents.at(1).split("&");
- if (sub_elements.size() < 4)
- goto end;
-
- evi_type f_evi;
- f_evi.name = sub_elements.at(0);
- f_evi.description = sub_elements.at(1);
- //no idea what the number at position 2 is. probably an identifier?
- f_evi.image = sub_elements.at(3);
-
- ++loaded_evidence;
-
- w_lobby->set_loading_text("Loading evidence:\n" + QString::number(loaded_evidence) + "/" + QString::number(evidence_list_size));
-
- w_courtroom->append_evidence(f_evi);
-
- int total_loading_size = char_list_size + evidence_list_size + music_list_size;
- int loading_value = ((loaded_chars + loaded_evidence) / static_cast(total_loading_size)) * 100;
- w_lobby->set_loading_value(loading_value);
-
- QString next_packet_number = QString::number(loaded_evidence);
- send_server_packet(new AOPacket("AE#" + next_packet_number + "#%"));
-
- }
- else if (header == "EM")
- {
- if (!courtroom_constructed)
- goto end;
-
- bool music_turn = false;
- int areas = 0;
-
- for (int n_element = 0 ; n_element < f_contents.size() ; n_element += 2)
- {
- if (f_contents.at(n_element).toInt() != loaded_music)
- break;
-
- if (n_element == f_contents.size() - 1)
- break;
-
- QString f_music = f_contents.at(n_element + 1);
-
- ++loaded_music;
-
- w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size));
-
- if (music_turn)
- {
- w_courtroom->append_music(f_music);
- }
- else
- {
- if (f_music.endsWith(".wav") ||
- f_music.endsWith(".mp3") ||
- f_music.endsWith(".mp4") ||
- f_music.endsWith(".ogg") ||
- f_music.endsWith(".opus"))
- {
- music_turn = true;
- areas--;
- w_courtroom->fix_last_area();
- w_courtroom->append_music(f_music);
- }
- else
- {
- w_courtroom->append_area(f_music);
- areas++;
- }
- }
- qDebug() << f_music;
-
- int total_loading_size = char_list_size + evidence_list_size + music_list_size;
- int loading_value = ((loaded_chars + loaded_evidence + loaded_music) / static_cast(total_loading_size)) * 100;
- w_lobby->set_loading_value(loading_value);
-
- }
-
- QString next_packet_number = QString::number(((loaded_music - 1) / 10) + 1);
- send_server_packet(new AOPacket("AM#" + next_packet_number + "#%"));
- }
- else if (header == "CharsCheck")
- {
- if (!courtroom_constructed)
- goto end;
-
- for (int n_char = 0 ; n_char < f_contents.size() ; ++n_char)
- {
- if (f_contents.at(n_char) == "-1")
- w_courtroom->set_taken(n_char, true);
- else
- w_courtroom->set_taken(n_char, false);
- }
- }
-
- else if (header == "SC")
- {
- if (!courtroom_constructed)
- goto end;
-
- for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
- {
- QStringList sub_elements = f_contents.at(n_element).split("&");
-
- char_type f_char;
- f_char.name = sub_elements.at(0);
- if (sub_elements.size() >= 2)
- f_char.description = sub_elements.at(1);
-
- //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 + evidence_list_size + music_list_size;
- int loading_value = (loaded_chars / static_cast(total_loading_size)) * 100;
- w_lobby->set_loading_value(loading_value);
-
- send_server_packet(new AOPacket("RM#%"));
- }
- else if (header == "SM")
- {
- if (!courtroom_constructed)
- goto end;
-
- bool musics_time = false;
- int areas = 0;
-
- for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
- {
- ++loaded_music;
-
- w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size));
-
- if (musics_time)
- {
- w_courtroom->append_music(f_contents.at(n_element));
- }
- else
- {
- if (f_contents.at(n_element).endsWith(".wav") ||
- f_contents.at(n_element).endsWith(".mp3") ||
- f_contents.at(n_element).endsWith(".mp4") ||
- f_contents.at(n_element).endsWith(".ogg") ||
- f_contents.at(n_element).endsWith(".opus"))
- {
- musics_time = true;
- w_courtroom->fix_last_area();
- w_courtroom->append_music(f_contents.at(n_element));
- areas--;
- }
- else
- {
- w_courtroom->append_area(f_contents.at(n_element));
- areas++;
- }
- }
-
- int total_loading_size = char_list_size + evidence_list_size + music_list_size;
- int loading_value = (loaded_chars / static_cast(total_loading_size)) * 100;
- w_lobby->set_loading_value(loading_value);
-
- }
-
- send_server_packet(new AOPacket("RD#%"));
- }
- else if (header == "FM")
- {
- if (!courtroom_constructed)
- goto end;
-
- w_courtroom->clear_music();
- w_courtroom->clear_areas();
-
- bool musics_time = false;
- int areas = 0;
-
- for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
- {
- if (musics_time)
- {
- w_courtroom->append_music(f_contents.at(n_element));
- }
- else
- {
- if (f_contents.at(n_element).endsWith(".wav") ||
- f_contents.at(n_element).endsWith(".mp3") ||
- f_contents.at(n_element).endsWith(".mp4") ||
- f_contents.at(n_element).endsWith(".ogg") ||
- f_contents.at(n_element).endsWith(".opus"))
- {
- musics_time = true;
- w_courtroom->fix_last_area();
- w_courtroom->append_music(f_contents.at(n_element));
- areas--;
-// qDebug() << "wtf!!" << f_contents.at(n_element);
- }
- else
- {
- w_courtroom->append_area(f_contents.at(n_element));
- areas++;
- }
- }
- }
-
- w_courtroom->list_music();
- w_courtroom->list_areas();
- }
- else if (header == "DONE")
- {
- if (!courtroom_constructed)
- goto end;
-
- if (lobby_constructed)
- w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog());
-
- w_courtroom->done_received();
-
- courtroom_loaded = true;
-
- destruct_lobby();
- }
- else if (header == "BN")
- {
- if (f_contents.size() < 1)
- goto end;
-
- if (courtroom_constructed)
- w_courtroom->set_background(f_contents.at(0));
- }
- //server accepting char request(CC) packet
- else if (header == "PV")
- {
- if (f_contents.size() < 3)
- goto end;
-
- if (courtroom_constructed)
- w_courtroom->enter_courtroom(f_contents.at(2).toInt());
- }
- else if (header == "MS")
- {
- if (courtroom_constructed && courtroom_loaded)
- w_courtroom->handle_chatmessage(&p_packet->get_contents());
- }
- else if (header == "MC")
- {
- if (courtroom_constructed && courtroom_loaded)
- w_courtroom->handle_song(&p_packet->get_contents());
- }
- else if (header == "RT")
- {
- if (f_contents.size() < 1)
- goto end;
- if (courtroom_constructed)
- w_courtroom->handle_wtce(f_contents.at(0));
- }
- else if (header == "HP")
- {
- if (courtroom_constructed && f_contents.size() > 1)
- w_courtroom->set_hp_bar(f_contents.at(0).toInt(), f_contents.at(1).toInt());
- }
- else if (header == "LE")
- {
- if (courtroom_constructed)
- {
- QVector f_evi_list;
-
- for (QString f_string : f_contents)
- {
- QStringList sub_contents = f_string.split("&");
-
- if (sub_contents.size() < 3)
- continue;
-
- evi_type f_evi;
- f_evi.name = sub_contents.at(0);
- f_evi.description = sub_contents.at(1);
- f_evi.image = sub_contents.at(2);
-
- f_evi_list.append(f_evi);
- }
-
- w_courtroom->set_evidence_list(f_evi_list);
- }
- }
- else if (header == "IL")
- {
- if (courtroom_constructed && f_contents.size() > 0)
- w_courtroom->set_ip_list(f_contents.at(0));
- }
- else if (header == "MU")
- {
- if (courtroom_constructed && f_contents.size() > 0)
- w_courtroom->set_mute(true, f_contents.at(0).toInt());
- }
- else if (header == "UM")
- {
- if (courtroom_constructed && f_contents.size() > 0)
- w_courtroom->set_mute(false, f_contents.at(0).toInt());
- }
- else if (header == "KK")
- {
- if (courtroom_constructed && f_contents.size() > 0)
- {
- int f_cid = w_courtroom->get_cid();
- int remote_cid = f_contents.at(0).toInt();
-
- if (f_cid != remote_cid && remote_cid != -1)
- goto end;
-
- call_notice("You have been kicked.");
- construct_lobby();
- destruct_courtroom();
- }
-
- }
- else if (header == "KB")
- {
- if (courtroom_constructed && f_contents.size() > 0)
- w_courtroom->set_ban(f_contents.at(0).toInt());
- }
- else if (header == "BD")
- {
- call_notice("You are banned on this server.");
- }
- else if (header == "ZZ")
- {
- if (courtroom_constructed && f_contents.size() > 0)
- w_courtroom->mod_called(f_contents.at(0));
- }
- else if (header == "CL")
- {
- w_courtroom->handle_clock(f_contents.at(1));
- }
-
- end:
-
- delete p_packet;
-}
-
-void AOApplication::send_ms_packet(AOPacket *p_packet)
-{
- p_packet->net_encode();
-
- QString f_packet = p_packet->to_string();
-
- net_manager->ship_ms_packet(f_packet);
-
- qDebug() << "S(ms):" << f_packet;
-
- delete p_packet;
-}
-
-void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded)
-{
- if (encoded)
- p_packet->net_encode();
-
- QString f_packet = p_packet->to_string();
-
- if (encryption_needed)
- {
- qDebug() << "S(e):" << f_packet;
-
- p_packet->encrypt_header(s_decryptor);
- f_packet = p_packet->to_string();
- }
- else
- {
- qDebug() << "S:" << f_packet;
- }
-
- net_manager->ship_server_packet(f_packet);
-
- delete p_packet;
-}
diff --git a/path_functions.cpp b/path_functions.cpp
deleted file mode 100644
index 6e772dbb7..000000000
--- a/path_functions.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-#include "aoapplication.h"
-#include "courtroom.h"
-#include "file_functions.h"
-#include
-#include
-#include
-
-#ifdef BASE_OVERRIDE
-#include "base_override.h"
-#endif
-QString base_path = "";
-
-QString AOApplication::get_base_path()
-{
- if (base_path == "")
- {
-#ifdef BASE_OVERRIDE
- base_path = base_override;
-#elif defined(ANDROID)
- QString sdcard_storage = getenv("SECONDARY_STORAGE");
- if (dir_exists(sdcard_storage + "/AO2/")){
- base_path = sdcard_storage + "/AO2/";
- }else{
- QString external_storage = getenv("EXTERNAL_STORAGE");
- base_path = external_storage + "/AO2/";
- }
-#else
- base_path = QDir::currentPath() + "/base/";
-#endif
-}
- return base_path;
- /*
-#ifdef OMNI_DEBUG
- return "/media/omnitroid/Data/winshare/AO/client/base/";
-#elif OMNI_DEBUG2
- return "/home/omnitroid/winshare/AO/client/base/";
-#elif defined(OMNI_WIN_DEBUG)
- return "E:/AO/client/base/";
-#elif defined(OMNI_WIN_DEBUG2)
- return "F:/winshare/AO/client/base/";
-#elif defined(ANDROID)
- return "/storage/extSdCard/AO2/";
-#else
- return QDir::currentPath() + "/base/";
-#endif
-*/
-}
-
-QString AOApplication::get_data_path()
-{
- return get_base_path() + "data/";
-}
-
-QString AOApplication::get_theme_path()
-{
- return get_base_path() + "themes/" + current_theme.toLower() + "/";
-}
-
-QString AOApplication::get_default_theme_path()
-{
- return get_base_path() + "themes/default/";
-}
-
-QString AOApplication::get_character_path(QString p_character)
-{
- return get_base_path() + "characters/" + p_character.toLower() + "/";
-}
-
-QString AOApplication::get_demothings_path()
-{
- QString default_path = "misc/demothings/";
- QString alt_path = "misc/RosterImages";
- if (dir_exists(default_path))
- return get_base_path() + default_path;
- else if (dir_exists(alt_path))
- return get_base_path() + alt_path;
- else
- return get_base_path() + default_path;
-}
-QString AOApplication::get_sounds_path()
-{
- return get_base_path() + "sounds/general/";
-}
-QString AOApplication::get_music_path(QString p_song)
-{
- return get_base_path() + "sounds/music/" + p_song.toLower();
-}
-
-QString AOApplication::get_background_path()
-{
- if (courtroom_constructed)
- return w_courtroom->get_background_path();
- //this function being called when the courtroom isn't constructed makes no sense
- return "";
-}
-
-QString AOApplication::get_default_background_path()
-{
- return get_base_path() + "background/gs4/";
-}
-
-QString AOApplication::get_evidence_path()
-{
- QString default_path = "evidence/";
- QString alt_path = "items/";
- if (dir_exists(default_path))
- return get_base_path() + default_path;
- else if (dir_exists(alt_path))
- return get_base_path() + alt_path;
- else
- return get_base_path() + default_path;
-}
-
-QString Courtroom::get_background_path()
-{
- return ao_app->get_base_path() + "background/" + current_background.toLower() + "/";
-}
-
-QString Courtroom::get_default_background_path()
-{
- return ao_app->get_base_path() + "background/gs4/";
-}
diff --git a/res.qrc b/res.qrc
new file mode 100644
index 000000000..814586b27
--- /dev/null
+++ b/res.qrc
@@ -0,0 +1,10 @@
+
+
+ res/fonts/Ace-Attorney.ttf
+ res/ui/config_panel.ui
+ res/git/git_branch.txt
+ res/git/git_hash.txt
+ src/drserverinfoeditor.ui
+ data/sample.avi
+
+
diff --git a/resource/fonts/Ace-Attorney.ttf b/res/fonts/Ace-Attorney.ttf
similarity index 100%
rename from resource/fonts/Ace-Attorney.ttf
rename to res/fonts/Ace-Attorney.ttf
diff --git a/res/git/git_branch.txt b/res/git/git_branch.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/res/git/git_hash.txt b/res/git/git_hash.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/res/ui/config_panel.ui b/res/ui/config_panel.ui
new file mode 100644
index 000000000..b78bf2e23
--- /dev/null
+++ b/res/ui/config_panel.ui
@@ -0,0 +1,1629 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 487
+ 514
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 487
+ 0
+
+
+
+ Form
+
+
+
+ QLayout::SetMaximumSize
+
+ -
+
+
+ 1
+
+
+
+ General
+
+
+
-
+
+