Skip to content

Commit 3527ede

Browse files
authored
Add files via upload
1 parent 61663ae commit 3527ede

10 files changed

Lines changed: 178 additions & 12 deletions

Attorney_Online_remake.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ HEADERS += lobby.h \
8888
# in the same way as BASS. Discord RPC uses CMake, which does not play nicely with
8989
# QMake, so this step must be manual.
9090
unix:LIBS += -L$$PWD -lbass -ldiscord-rpc
91-
win32:LIBS += -L$$PWD "$$PWD/bass.dll" -ldiscord-rpc #"$$PWD/discord-rpc.dll"
91+
win32:LIBS += -L$$PWD "$$PWD/bass.lib" -ldiscord-rpc #"$$PWD/discord-rpc.dll"
9292
android:LIBS += -L$$PWD\android\libs\armeabi-v7a\ -lbass
9393

9494
CONFIG += c++11

aoapplication.h

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,19 @@ class AOApplication : public QApplication
7777
int get_minor_version() {return MINOR_VERSION;}
7878
QString get_version_string();
7979

80+
///////////////////////////////////////////
81+
8082
void set_favorite_list();
8183
QVector<server_type>& get_favorite_list() {return favorite_list;}
8284
void add_favorite_server(int p_server);
8385

8486
void set_server_list();
8587
QVector<server_type>& get_server_list() {return server_list;}
8688

87-
void set_user_theme();
88-
QString get_user_theme() {return user_theme;}
89+
//reads the theme from config.ini and sets it accordingly
90+
void reload_theme();
8991

92+
//Returns the character the player has currently selected
9093
QString get_current_char();
9194

9295
//implementation in path_functions.cpp
@@ -102,48 +105,120 @@ class AOApplication : public QApplication
102105
QString get_default_background_path();
103106
QString get_evidence_path();
104107

105-
//implementation in text_file_functions.cpp
108+
////// Functions for reading and writing files //////
109+
// Implementations file_functions.cpp
110+
111+
//Returns the config value for the passed searchline from a properly formatted config ini file
106112
QString read_config(QString searchline);
107-
QString read_user_theme();
113+
114+
//Reads the theme from config.ini and loads it into the current_theme variable
115+
QString read_theme();
116+
117+
//Returns the blip rate from config.ini
108118
int read_blip_rate();
119+
120+
//Returns true if blank blips is enabled in config.ini and false otherwise
109121
bool get_blank_blip();
122+
123+
//Returns the value of default_music in config.ini
110124
int get_default_music();
125+
126+
//Returns the value of default_sfx in config.ini
111127
int get_default_sfx();
128+
129+
//Returns the value of default_blip in config.ini
112130
int get_default_blip();
131+
132+
//Returns the list of words in callwords.ini
113133
QStringList get_call_words();
134+
135+
//Appends the argument string to serverlist.txt
114136
void write_to_serverlist_txt(QString p_line);
137+
138+
//Returns the contents of serverlist.txt
115139
QVector<server_type> read_serverlist_txt();
140+
141+
//Returns the value of p_identifier in the design.ini file in p_design_path
116142
QString read_design_ini(QString p_identifier, QString p_design_path);
143+
144+
//Returns the coordinates of widget with p_identifier from p_file
117145
QPoint get_button_spacing(QString p_identifier, QString p_file);
146+
147+
//Returns the dimensions of widget with specified identifier from p_file
118148
pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
149+
150+
//Returns the value of font_size with p_identifier from p_file
119151
int get_font_size(QString p_identifier, QString p_file);
152+
153+
//Returns the name of the font with p_identifier from p_file
154+
QString get_font_name(QString p_identifier, QString p_file);
155+
156+
//Returns the color with p_identifier from p_file
120157
QColor get_color(QString p_identifier, QString p_file);
158+
159+
//Returns the sfx with p_identifier from sounds.ini in the current theme path
121160
QString get_sfx(QString p_identifier);
161+
162+
//Returns the value of p_search_line within target_tag and terminator_tag
122163
QString read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag);
164+
165+
//Returns the side of the p_char character from that characters ini file
123166
QString get_char_side(QString p_char);
167+
168+
//Returns the showname from the ini of p_char
124169
QString get_showname(QString p_char);
170+
171+
//Returns the value of chat from the specific p_char's ini file
125172
QString get_chat(QString p_char);
173+
174+
//Returns the value of shouts from the specified p_char's ini file
126175
QString get_char_shouts(QString p_char);
176+
177+
//Returns the preanim duration of p_char's p_emote
127178
int get_preanim_duration(QString p_char, QString p_emote);
179+
180+
//Same as above, but only returns if it has a % in front(refer to Preanims section in the manual)
128181
int get_ao2_preanim_duration(QString p_char, QString p_emote);
182+
183+
//Not in use
129184
int get_text_delay(QString p_char, QString p_emote);
185+
186+
//Returns the name of p_char
130187
QString get_char_name(QString p_char);
188+
189+
//Returns the total amount of emotes of p_char
131190
int get_emote_number(QString p_char);
191+
192+
//Returns the emote comment of p_char's p_emote
132193
QString get_emote_comment(QString p_char, int p_emote);
194+
195+
//Returns the base name of p_char's p_emote
133196
QString get_emote(QString p_char, int p_emote);
197+
198+
//Returns the preanimation name of p_char's p_emote
134199
QString get_pre_emote(QString p_char, int p_emote);
200+
201+
//Returns the sfx of p_char's p_emote
135202
QString get_sfx_name(QString p_char, int p_emote);
203+
204+
//Not in use
136205
int get_sfx_delay(QString p_char, int p_emote);
206+
207+
//Returns the modifier for p_char's p_emote
137208
int get_emote_mod(QString p_char, int p_emote);
209+
210+
//Returns the desk modifier for p_char's p_emote
138211
int get_desk_mod(QString p_char, int p_emote);
212+
213+
//Returns p_char's gender
139214
QString get_gender(QString p_char);
140215

141216
private:
142217
const int RELEASE = 2;
143218
const int MAJOR_VERSION = 4;
144219
const int MINOR_VERSION = 8;
145220

146-
QString user_theme = "default";
221+
QString current_theme = "default";
147222

148223
QVector<server_type> server_list;
149224
QVector<server_type> favorite_list;

aotextarea.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message)
2525
p_message += " ";
2626
QString result = p_message.toHtmlEscaped().replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" );
2727

28+
qDebug() << "STRING IS: " << result;
29+
2830
this->insertHtml(result);
2931

3032
this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);

courtroom.cpp

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <QBrush>
1414
#include <QTextCharFormat>
1515
#include <QFont>
16+
#include <QPropertyAnimation>
1617

1718
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
1819
{
@@ -66,6 +67,16 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
6667
ui_vp_desk = new AOScene(ui_viewport, ao_app);
6768
ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app);
6869

70+
ui_vp_music_display_a = new AOImage(this, ao_app);
71+
ui_vp_music_display_b = new AOImage(this, ao_app);
72+
ui_vp_music_area = new QWidget(ui_vp_music_display_a);
73+
ui_vp_music_name = new QTextEdit(ui_vp_music_area);
74+
ui_vp_music_name->setText("hewwo OwO");
75+
ui_vp_music_name->setFrameStyle(QFrame::NoFrame);
76+
ui_vp_music_name->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
77+
ui_vp_music_name->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
78+
ui_vp_music_name->setReadOnly(true);
79+
6980
ui_vp_evidence_display = new AOEvidenceDisplay(this, ao_app);
7081

7182
ui_vp_chatbox = new AOImage(this, ao_app);
@@ -391,6 +402,18 @@ void Courtroom::set_widgets()
391402
set_size_and_pos(ui_vp_chatbox, "chatbox");
392403
}
393404

405+
set_size_and_pos(ui_vp_music_area, "music_area");
406+
ui_vp_music_area->show();
407+
set_size_and_pos(ui_vp_music_name, "music_name");
408+
409+
set_size_and_pos(ui_vp_music_display_a, "music_display_a");
410+
ui_vp_music_display_a->set_image("music_display_a.png");
411+
ui_vp_music_display_a->show();
412+
413+
set_size_and_pos(ui_vp_music_display_b, "music_display_b");
414+
ui_vp_music_display_b->set_image("music_display_b.png");
415+
ui_vp_music_display_b->show();
416+
394417
ui_ic_chat_message->setStyleSheet("QLineEdit{background-color: rgba(100, 100, 100, 255);}");
395418

396419
ui_vp_chatbox->set_image("chatmed.png");
@@ -541,6 +564,8 @@ void Courtroom::set_widgets()
541564
ui_char_select_right->set_image("arrow_right.png");
542565

543566
set_size_and_pos(ui_spectator, "spectator");
567+
568+
handle_music_anim(ui_vp_music_name, "music_name", "music_area");
544569
}
545570

546571
void Courtroom::set_fonts()
@@ -551,6 +576,7 @@ void Courtroom::set_fonts()
551576
set_font(ui_ms_chatlog, "ms_chatlog");
552577
set_font(ui_server_chatlog, "server_chatlog");
553578
set_font(ui_music_list, "music_list");
579+
set_font(ui_vp_music_name, "music_name");
554580
}
555581

556582
void Courtroom::set_font(QWidget *widget, QString p_identifier)
@@ -559,19 +585,47 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier)
559585
int f_weight = ao_app->get_font_size(p_identifier, design_file);
560586
QString class_name = widget->metaObject()->className();
561587

562-
widget->setFont(QFont("Sans", f_weight));
588+
QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file);
589+
590+
widget->setFont(QFont(font_name, f_weight));
563591

564592
QColor f_color = ao_app->get_color(p_identifier + "_color", design_file);
565593

594+
int bold = ao_app->get_font_size(p_identifier + "_bold", design_file); // is the font bold or not?
595+
596+
QString is_bold = "";
597+
if(bold == 1) is_bold = "bold";
598+
566599
QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" +
567600
"color: rgba(" +
568601
QString::number(f_color.red()) + ", " +
569602
QString::number(f_color.green()) + ", " +
570-
QString::number(f_color.blue()) + ", 255); }";
603+
QString::number(f_color.blue()) + ", 255);\n"
604+
"font: " + is_bold + "; }";
571605

572606
widget->setStyleSheet(style_sheet_string);
573607
}
574608

609+
void Courtroom::handle_music_anim(QWidget *p_widget, QString p_identifier_a, QString p_identifier_b)
610+
{
611+
QString file_a = "courtroom_design.ini";
612+
QString file_b = "courtroom_fonts.ini";
613+
pos_size_type res_a = ao_app->get_element_dimensions(p_identifier_a, file_a);
614+
pos_size_type res_b = ao_app->get_element_dimensions(p_identifier_b, file_a);
615+
int speed = ao_app->get_font_size(p_identifier_a + "_speed", file_b);
616+
int nchar = ui_vp_music_name->toPlainText().size();
617+
618+
int time = nchar/speed*1000;
619+
620+
QPropertyAnimation *animation = new QPropertyAnimation(p_widget, "geometry");
621+
animation->setLoopCount(-1);
622+
animation->setDuration(time);
623+
animation->setStartValue(QRect(-res_a.width + res_a.x, res_a.y, res_a.width, res_a.height));
624+
animation->setEndValue(QRect(res_b.width + res_a.x, res_a.y, res_a.width, res_a.height));
625+
626+
animation->start();
627+
}
628+
575629
void Courtroom::set_window_title(QString p_title)
576630
{
577631
this->setWindowTitle(p_title);
@@ -923,6 +977,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
923977
for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string)
924978
{
925979
m_chatmessage[n_string] = p_contents->at(n_string);
980+
// qDebug() << "m_chatmessage[" << n_string << "] = " << m_chatmessage[n_string];
926981
}
927982

928983
int f_char_id = m_chatmessage[CHAR_ID].toInt();
@@ -1156,7 +1211,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
11561211
normal.setFontWeight(QFont::Normal);
11571212
const QTextCursor old_cursor = ui_ic_chatlog->textCursor();
11581213
const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value();
1159-
const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum();
1214+
const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum();
11601215

11611216
ui_ic_chatlog->moveCursor(QTextCursor::Start);
11621217

@@ -1173,7 +1228,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
11731228
{
11741229
// The user hasn't selected any text and the scrollbar is at the top: scroll to the top.
11751230
ui_ic_chatlog->moveCursor(QTextCursor::Start);
1176-
ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum());
1231+
ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum());
11771232
}
11781233
}
11791234

@@ -1535,6 +1590,11 @@ void Courtroom::handle_song(QStringList *p_contents)
15351590
music_player->play(f_song);
15361591
}
15371592
}
1593+
1594+
int pos = f_song.lastIndexOf(QChar('.'));
1595+
QString r_song = f_song.left(pos);
1596+
1597+
ui_vp_music_name->setText(r_song);
15381598
}
15391599

15401600
void Courtroom::handle_wtce(QString p_wtce)

courtroom.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <QSignalMapper>
3232
#include <QMap>
3333
#include <QTextBrowser>
34+
#include <QRect>
3435

3536
class AOApplication;
3637

@@ -122,6 +123,9 @@ class Courtroom : public QMainWindow
122123
//takes in a list where the first element is the song name and the second is the char id of who played it
123124
void handle_song(QStringList *p_contents);
124125

126+
//animates music text
127+
void handle_music_anim(QWidget *p_widget, QString p_identifier_a, QString p_identifier_b);
128+
125129
void play_preanim();
126130

127131
//plays the witness testimony or cross examination animation based on argument
@@ -276,6 +280,11 @@ class Courtroom : public QMainWindow
276280
AOMovie *ui_vp_wtce;
277281
AOMovie *ui_vp_objection;
278282

283+
AOImage *ui_vp_music_display_a;
284+
AOImage *ui_vp_music_display_b;
285+
QTextEdit *ui_vp_music_name;
286+
QWidget *ui_vp_music_area;
287+
279288
QTextEdit *ui_ic_chatlog;
280289

281290
AOTextArea *ui_ms_chatlog;

lobby.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
1212
{
1313
ao_app = p_ao_app;
1414

15-
this->setWindowTitle("Attorney Online 2");
15+
this->setWindowTitle("Danganronpa Online");
1616

1717
ui_background = new AOImage(this, ao_app);
1818
ui_public_servers = new AOButton(this, ao_app);

logo.ico

-31.3 KB
Binary file not shown.

logo.png

-20.2 KB
Loading

packet_distribution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
224224

225225
courtroom_loaded = false;
226226

227-
QString window_title = "Attorney Online 2";
227+
QString window_title = "Danganronpa Online";
228228
int selected_server = w_lobby->get_selected_server();
229229

230230
QString server_address = "", server_name = "";

text_file_functions.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,26 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file)
314314
return return_color;
315315
}
316316

317+
QString AOApplication::get_font_name(QString p_identifier, QString p_file)
318+
{
319+
QString design_ini_path = get_theme_path() + p_file;
320+
QString default_path = get_default_theme_path() + p_file;
321+
QString f_result = read_design_ini(p_identifier, design_ini_path);
322+
323+
if(f_result == "")
324+
{
325+
f_result = read_design_ini(p_identifier, default_path);
326+
327+
if(f_result == "")
328+
{
329+
qDebug() << "Failure retreiving font name";
330+
return f_result;
331+
}
332+
}
333+
334+
return f_result;
335+
}
336+
317337
QString AOApplication::get_sfx(QString p_identifier)
318338
{
319339
QString design_ini_path = get_theme_path() + "courtroom_sounds.ini";

0 commit comments

Comments
 (0)