Skip to content

Commit

Permalink
Merge branch 'master' into feature/demo-playback
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/courtroom.cpp
#	src/packet_distribution.cpp
  • Loading branch information
Crystalwarrior committed Jan 8, 2021
2 parents aee47d4 + cbf8391 commit 662a9e2
Show file tree
Hide file tree
Showing 30 changed files with 395 additions and 506 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Version:**
- OS: (e.g. Windows 10)
- Version or branch: (e.g. 2.8.5, master, ui-files, etc.)

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: cpp
os: osx
osx_image: xcode12
addons:
homebrew:
update: true
Expand Down
4 changes: 4 additions & 0 deletions Attorney_Online.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ SOURCES += $$files($$PWD/src/*.cpp)
HEADERS += $$files($$PWD/include/*.h)

LIBS += -L$$PWD/lib
QMAKE_LFLAGS += -Wl,-rpath,"'\$$ORIGIN/lib'"

# Uncomment for verbose network logging
# DEFINES += DEBUG_NETWORK

# Uncomment to enable Discord Rich Presence
# DEFINES += DISCORD
Expand Down
5 changes: 1 addition & 4 deletions include/aoapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,10 @@ class AOApplication : public QApplication {

/////////////////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;
bool cccc_ic_support_enabled = false;
Expand All @@ -83,6 +79,7 @@ class AOApplication : public QApplication {
bool looping_sfx_support_enabled = false;
bool additive_enabled = false;
bool effects_enabled = false;
bool y_offset_enabled = false;

///////////////loading info///////////////////

Expand Down
3 changes: 0 additions & 3 deletions include/aoblipplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ class AOBlipPlayer {
int m_cycle = 0;

private:
const int max_blip_ms = 60;

QWidget *m_parent;
AOApplication *ao_app;
qreal m_volume;
QElapsedTimer delay;

void set_volume_internal(qreal p_volume);

Expand Down
7 changes: 1 addition & 6 deletions include/aopacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,16 @@
class AOPacket {
public:
AOPacket(QString p_packet_string);
AOPacket(QString header, QStringList &p_contents);
~AOPacket();
AOPacket(QString header, QStringList &p_contents) : m_header(header), m_contents(p_contents){}

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;
Expand Down
3 changes: 1 addition & 2 deletions include/aosfxplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class AOSfxPlayer {

void clear();
void loop_clear();
void play(QString p_sfx, QString p_char = "", QString shout = "",
int channel = -1);
void play(QString p_sfx, QString p_char = "", QString shout = "");
void stop(int channel = -1);
void set_volume(qreal p_volume);
void set_looping(bool toggle, int channel = -1);
Expand Down
19 changes: 15 additions & 4 deletions include/courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include <QTextCharFormat>
//#include <QRandomGenerator>

#include <algorithm>
#include <stack>

class AOApplication;
Expand Down Expand Up @@ -225,7 +226,7 @@ class Courtroom : public QMainWindow {
// selected
// or the user isn't already scrolled to the top
void append_ic_text(QString p_text, QString p_name = "", QString action = "",
int color = 0);
int color = 0, QDateTime timestamp = QDateTime::currentDateTime());

// 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
Expand Down Expand Up @@ -275,14 +276,17 @@ class Courtroom : public QMainWindow {
bool message_is_centered = false;

int current_display_speed = 3;
int message_display_speed[7] = {0, 10, 25, 40, 50, 70, 90};
int message_display_speed[7] = {5, 10, 25, 40, 50, 70, 90};

// The character ID of the character this user wants to appear alongside with.
int other_charid = -1;

// The offset this user has given if they want to appear alongside someone.
// The horizontal offset this user has given if they want to appear alongside someone.
int char_offset = 0;

// The vertical offset this user has given.
int char_vert_offset = 0;

// 0 = in front, 1 = behind
int pair_order = 0;

Expand Down Expand Up @@ -311,7 +315,7 @@ class Courtroom : public QMainWindow {
int real_tick_pos = 0;
// used to determine how often blips sound
int blip_ticker = 0;
int blip_rate = 1;
int blip_rate = 2;
int rainbow_counter = 0;
bool rainbow_appended = false;
bool blank_blip = false;
Expand Down Expand Up @@ -424,8 +428,12 @@ class Courtroom : public QMainWindow {
// List of all currently available pos
QStringList pos_dropdown_list;

// is the message we're about to send supposed to present evidence?
bool is_presenting_evidence = false;

// have we already presented evidence for this message?
bool evidence_presented = false;

QString effect = "";

// Music effect flags we want to send to server when we play music
Expand Down Expand Up @@ -520,6 +528,7 @@ class Courtroom : public QMainWindow {
AOButton *ui_pair_button;
QListWidget *ui_pair_list;
QSpinBox *ui_pair_offset_spinbox;
QSpinBox *ui_pair_vert_offset_spinbox;

QComboBox *ui_pair_order_dropdown;

Expand Down Expand Up @@ -701,6 +710,7 @@ private slots:
void music_random();
void music_list_expand_all();
void music_list_collapse_all();
void music_stop();
void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column);

void select_emote(int p_id);
Expand Down Expand Up @@ -774,6 +784,7 @@ private slots:

void on_log_limit_changed(int value);
void on_pair_offset_changed(int value);
void on_pair_vert_offset_changed(int value);

void on_ooc_toggle_clicked();

Expand Down
15 changes: 0 additions & 15 deletions include/encryption_functions.h

This file was deleted.

16 changes: 0 additions & 16 deletions include/hex_functions.h

This file was deleted.

1 change: 1 addition & 0 deletions include/lobby.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Lobby : public QMainWindow {
void set_loading_value(int p_value);

bool public_servers_selected = true;
bool doubleclicked = false;

~Lobby();

Expand Down
3 changes: 3 additions & 0 deletions scripts/configure_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ cd tmp

#get the bass prebuilt
curl http://www.un4seen.com/files/bass24-linux.zip -o bass_linux.zip
curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus_linux.zip

unzip bass_linux.zip
unzip bassopus_linux.zip

cp x64/libbass.so ../../lib
cp x64/libbassopus.so ../../lib

#get the discord-rpc prebuilt
curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-linux.zip -o discord_rpc_linux.zip
Expand Down
4 changes: 0 additions & 4 deletions src/aoblipplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ void AOBlipPlayer::set_blips(QString p_sfx)

void AOBlipPlayer::blip_tick()
{
if (delay.isValid() && delay.elapsed() < max_blip_ms)
return;

delay.start();
int f_cycle = m_cycle++;

if (m_cycle == 5)
Expand Down
2 changes: 1 addition & 1 deletion src/aocaseannouncerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent,
AOApplication *p_ao_app,
Courtroom *p_court)
: QDialog(parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
{
ao_app = p_ao_app;
court = p_court;
Expand Down
9 changes: 9 additions & 0 deletions src/aocharmovie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ void AOCharMovie::load_image(QString p_char, QString p_emote,
return;

m_reader->setFileName(emote_path);

// set format to apng if png supports animation
if (emote_path.endsWith("png")) {
m_reader->setFormat("apng");
if (!m_reader->supportsAnimation()) {
m_reader->setFormat("png");
}
}

QPixmap f_pixmap = this->get_pixmap(m_reader->read());
int f_delay = m_reader->nextImageDelay();

Expand Down
15 changes: 10 additions & 5 deletions src/aoimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "aoimage.h"

#include <QBitmap>

AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
{
m_parent = parent;
Expand Down Expand Up @@ -29,9 +31,10 @@ bool AOImage::set_image(QString p_image)
}

QPixmap f_pixmap(final_image_path);

this->setPixmap(
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
f_pixmap =
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio);
this->setPixmap(f_pixmap);
this->setMask(f_pixmap.mask());
return true;
}

Expand All @@ -45,7 +48,9 @@ bool AOImage::set_chatbox(QString p_path)

QPixmap f_pixmap(p_path);

this->setPixmap(
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
f_pixmap =
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio);
this->setPixmap(f_pixmap);
this->setMask(f_pixmap.mask());
return true;
}
22 changes: 17 additions & 5 deletions src/aomusicplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,26 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop,

unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE |
BASS_UNICODE | BASS_ASYNCFILE;
if (loop)
unsigned int streaming_flags = BASS_STREAM_AUTOFREE;
if (loop) {
flags |= BASS_SAMPLE_LOOP;
streaming_flags |= BASS_SAMPLE_LOOP;
}

DWORD newstream;
if (f_path.endsWith(".opus"))
newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
else
newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
if (f_path.startsWith("http")) {
if (f_path.endsWith(".opus"))
newstream = BASS_OPUS_StreamCreateURL(f_path.toStdString().c_str(), 0, streaming_flags, nullptr, 0);
else
newstream = BASS_StreamCreateURL(f_path.toStdString().c_str(), 0, streaming_flags, nullptr, 0);

} else {
if (f_path.endsWith(".opus"))
newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
else
newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
}


if (ao_app->get_audio_output_device() != "default")
BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice());
Expand Down
2 changes: 1 addition & 1 deletion src/aooptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "bass.h"

AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
: QDialog(parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
{
ao_app = p_ao_app;

Expand Down
Loading

0 comments on commit 662a9e2

Please sign in to comment.