aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Attorney_Online_remake.pro6
-rw-r--r--aoapplication.h2
-rw-r--r--aoemotebutton.cpp5
-rw-r--r--aoevidencebutton.cpp24
-rw-r--r--aoevidencebutton.h20
-rw-r--r--courtroom.cpp5
-rw-r--r--courtroom.h9
-rw-r--r--evidence.cpp31
-rw-r--r--path_functions.cpp5
-rw-r--r--text_file_functions.cpp14
10 files changed, 111 insertions, 10 deletions
diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro
index 6938e4de..3e701283 100644
--- a/Attorney_Online_remake.pro
+++ b/Attorney_Online_remake.pro
@@ -41,7 +41,8 @@ SOURCES += main.cpp\
aosfxplayer.cpp \
aomusicplayer.cpp \
aoblipplayer.cpp \
- evidence.cpp
+ evidence.cpp \
+ aoevidencebutton.cpp
HEADERS += lobby.h \
aoimage.h \
@@ -65,7 +66,8 @@ HEADERS += lobby.h \
bass.h \
aosfxplayer.h \
aomusicplayer.h \
- aoblipplayer.h
+ aoblipplayer.h \
+ aoevidencebutton.h
unix:LIBS += -L/home/omnitroid/Project/Attorney_Online_2/src -lbass
win32:LIBS += "$$PWD/bass.dll"
diff --git a/aoapplication.h b/aoapplication.h
index 48a18587..4db6e454 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -91,6 +91,7 @@ public:
QString get_music_path(QString p_song);
QString get_background_path();
QString get_default_background_path();
+ QString get_evidence_path();
//implementation in text_file_functions.cpp
QString read_user_theme();
@@ -105,6 +106,7 @@ public:
int get_text_delay(QString p_char, QString p_emote);
QString get_char_name(QString p_char);
int get_emote_number(QString p_char);
+ QString get_emote_comment(QString p_char, int p_emote);
QString get_emote(QString p_char, int p_emote);
QString get_pre_emote(QString p_char, int p_emote);
QString get_sfx_name(QString p_char, int p_emote);
diff --git a/aoemotebutton.cpp b/aoemotebutton.cpp
index 142adb40..5eb5d758 100644
--- a/aoemotebutton.cpp
+++ b/aoemotebutton.cpp
@@ -1,6 +1,7 @@
#include "aoemotebutton.h"
#include "file_functions.h"
+#include <QDebug>
AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
{
@@ -26,7 +27,7 @@ void AOEmoteButton::set_on(QString p_char, int p_emote)
}
else
{
- this->setText(emotion_number);
+ this->setText(ao_app->get_emote_comment(p_char, p_emote));
this->setStyleSheet("border-image:url(\"\")");
}
}
@@ -43,7 +44,7 @@ void AOEmoteButton::set_off(QString p_char, int p_emote)
}
else
{
- this->setText(emotion_number);
+ this->setText(ao_app->get_emote_comment(p_char, p_emote));
this->setStyleSheet("border-image:url(\"\")");
}
}
diff --git a/aoevidencebutton.cpp b/aoevidencebutton.cpp
new file mode 100644
index 00000000..d4adce86
--- /dev/null
+++ b/aoevidencebutton.cpp
@@ -0,0 +1,24 @@
+#include "aoevidencebutton.h"
+
+#include "file_functions.h"
+
+AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app) : QPushButton(p_parent)
+{
+ ao_app = p_ao_app;
+}
+
+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("evi");
+ this->setStyleSheet("");
+ }
+}
diff --git a/aoevidencebutton.h b/aoevidencebutton.h
new file mode 100644
index 00000000..1ac9878b
--- /dev/null
+++ b/aoevidencebutton.h
@@ -0,0 +1,20 @@
+#ifndef AOEVIDENCEBUTTON_H
+#define AOEVIDENCEBUTTON_H
+
+#include "aoapplication.h"
+
+#include <QPushButton>
+#include <QString>
+
+class AOEvidenceButton : public QPushButton
+{
+public:
+ AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app);
+
+ void set_image(QString p_image);
+
+private:
+ AOApplication *ao_app;
+};
+
+#endif // AOEVIDENCEBUTTON_H
diff --git a/courtroom.cpp b/courtroom.cpp
index 9a67bb94..5d15d99c 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -61,6 +61,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_vp_showname = new QLabel(ui_vp_chatbox);
ui_vp_message = new QPlainTextEdit(ui_vp_chatbox);
ui_vp_message->setFrameStyle(QFrame::NoFrame);
+ ui_vp_message->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui_vp_testimony = new AOImage(ui_viewport, ao_app);
ui_vp_realization = new AOImage(this, ao_app);
ui_vp_wtce = new AOMovie(ui_viewport, ao_app);
@@ -332,6 +334,7 @@ void Courtroom::set_widgets()
m_courtroom_width = f_courtroom.width;
m_courtroom_height = f_courtroom.height;
+ this->resize(m_courtroom_width, m_courtroom_height);
this->setFixedSize(m_courtroom_width, m_courtroom_height);
ui_background->set_image("courtroombackground.png");
@@ -1184,7 +1187,6 @@ void Courtroom::start_chat_ticking()
void Courtroom::chat_tick()
{
- //T0D0: play tick sound based on gender
//note: this is called fairly often(every 60 ms when char is talking)
//do not perform heavy operations here
@@ -1204,6 +1206,7 @@ void Courtroom::chat_tick()
else
{
ui_vp_message->insertPlainText(f_message.at(tick_pos));
+ //ui_vp_message->app
QScrollBar *scroll = ui_vp_message->verticalScrollBar();
scroll->setValue(scroll->maximum());
diff --git a/courtroom.h b/courtroom.h
index d567b281..5755485d 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -12,6 +12,7 @@
#include "aomusicplayer.h"
#include "aosfxplayer.h"
#include "aoblipplayer.h"
+#include "aoevidencebutton.h"
#include "datatypes.h"
#include <QMainWindow>
@@ -172,7 +173,10 @@ private:
int max_emotes_on_page = 10;
int current_evidence_page = 0;
- //int current_evidence
+ 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;
@@ -269,6 +273,9 @@ private:
AOImage *ui_muted;
AOButton *ui_evidence_button;
+ QVector<AOEvidenceButton*> ui_evidence_list;
+ AOImage *ui_evidence_left;
+ AOImage *ui_evidence_right;
AOImage *ui_evidence;
diff --git a/evidence.cpp b/evidence.cpp
index ec598dfa..51a568f8 100644
--- a/evidence.cpp
+++ b/evidence.cpp
@@ -2,7 +2,7 @@
void Courtroom::construct_evidence()
{
- //constructing emote button grid
+ //constructing evidence button grid
const int base_x_pos{10};
const int base_y_pos{0};
@@ -12,8 +12,31 @@ void Courtroom::construct_evidence()
const int y_modifier{49};
int y_mod_count{0};
- emote_columns = ui_emotes->width() / x_modifier;
- emote_rows = ui_emotes->height() / y_modifier;
+ evidence_columns = ui_evidence->width() / x_modifier;
+ evidence_rows = ui_evidence->height() / y_modifier;
- max_emotes_on_page = emote_columns * emote_rows;
+ max_evidence_on_page = evidence_columns * evidence_rows;
+
+ for (int n = 0 ; n < max_emotes_on_page ; ++n)
+ {
+ int x_pos = base_x_pos + (x_modifier * x_mod_count);
+ int y_pos = base_y_pos + (y_modifier * 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 emote number is divisible by columns with rest columns -1 then the next emote button should start on a new line
+ if ((n % emote_columns) == (emote_columns - 1) && (n != 0))
+ {
+ ++y_mod_count;
+ x_mod_count = 0;
+ }
+ }
}
diff --git a/path_functions.cpp b/path_functions.cpp
index 518da434..cab87523 100644
--- a/path_functions.cpp
+++ b/path_functions.cpp
@@ -58,6 +58,11 @@ QString AOApplication::get_default_background_path()
return get_base_path() + "background/gs4/";
}
+QString AOApplication::get_evidence_path()
+{
+ return get_base_path() + "evidence/";
+}
+
QString Courtroom::get_background_path()
{
return ao_app->get_base_path() + "background/" + current_background.toLower() + "/";
diff --git a/text_file_functions.cpp b/text_file_functions.cpp
index 388a0d0d..0812dedd 100644
--- a/text_file_functions.cpp
+++ b/text_file_functions.cpp
@@ -256,6 +256,20 @@ int AOApplication::get_emote_number(QString p_char)
else return f_result.toInt();
}
+QString AOApplication::get_emote_comment(QString p_char, int p_emote)
+{
+ QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "[Emotions]", "[SoundN]");
+
+ QStringList result_contents = f_result.split("#");
+
+ if (result_contents.size() < 4)
+ {
+ qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
+ return "normal";
+ }
+ else return result_contents.at(0);
+}
+
QString AOApplication::get_pre_emote(QString p_char, int p_emote)
{
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "[Emotions]", "[SoundN]");