aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-02-14 02:09:56 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-02-14 02:09:56 +0100
commit0da10f73d87205b6ca4f1932d995f4048b657069 (patch)
tree8659a0805397126f70934eec2691bbc04e90a826
parent2c6d011d66e739a0dce68aa938d81263702b8f4a (diff)
parent6f9329efac5c00c1e5226b44b23e8ed2a149d3c7 (diff)
Merge branch 'master' of https://github.com/Attorney-Online-Engineering-Task-Force/Attorney-Online-Client-Remake
-rw-r--r--courtroom.cpp40
-rw-r--r--courtroom.h11
2 files changed, 50 insertions, 1 deletions
diff --git a/courtroom.cpp b/courtroom.cpp
index c4a76c66..1fef0526 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -31,6 +31,12 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
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);
music_player = new AOMusicPlayer(this, ao_app);
@@ -209,6 +215,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
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()));
//emote signals are set in emotes.cpp
connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex)));
@@ -357,6 +365,8 @@ void Courtroom::set_widgets()
ui_vp_testimony->move(0, 0);
ui_vp_testimony->resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_testimony->set_image("testimony.png");
+ ui_vp_testimony->hide();
ui_vp_realization->move(0, 0);
ui_vp_realization->resize(ui_viewport->width(), ui_viewport->height());
@@ -676,6 +686,8 @@ void Courtroom::enter_courtroom(int p_cid)
ui_sfx_slider->setValue(50);
ui_blip_slider->setValue(50);
+ testimony_in_progress = false;
+
ui_char_select_background->hide();
ui_ic_chat_message->setEnabled(true);
@@ -1048,7 +1060,7 @@ void Courtroom::handle_chatmessage_3()
{
realization_timer->start(60);
ui_vp_realization->show();
- //T0D0: add realization sfx
+ sfx_player->play("sfx-realization.wav", ui_sfx_slider->value());
}
}
@@ -1165,6 +1177,26 @@ void Courtroom::chat_tick()
}
}
+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];
@@ -1180,6 +1212,9 @@ void Courtroom::play_sfx()
void Courtroom::set_scene()
{
+ if (testimony_in_progress)
+ show_testimony();
+
//witness is default if pos is invalid
QString f_image = "witnessempty.png";
@@ -1336,12 +1371,15 @@ void Courtroom::handle_wtce(QString p_wtce)
{
sfx_player->play("sfx-testimony2.wav", ui_sfx_slider->value());
ui_vp_wtce->play("witnesstestimony");
+ testimony_in_progress = true;
+ show_testimony();
}
//cross examination
else if (p_wtce == "testimony2")
{
sfx_player->play("sfx-testimony.wav", ui_sfx_slider->value());
ui_vp_wtce->play("crossexamination");
+ testimony_in_progress = false;
}
}
diff --git a/courtroom.h b/courtroom.h
index 3ffbf548..d1a77d00 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -122,6 +122,9 @@ private:
QTimer *realization_timer;
+ QTimer *testimony_show_timer;
+ QTimer *testimony_hide_timer;
+
//every time point in char.inis times this equals the final time
const int time_mod = 40;
@@ -131,6 +134,11 @@ private:
QString previous_ic_message = "";
+ bool testimony_in_progress = false;
+
+ const int testimony_show_time = 1500;
+ const int testimony_hide_time = 500;
+
QMap<QString, bool> mute_map;
bool is_muted = false;
@@ -278,6 +286,9 @@ public slots:
void realization_done();
+ void show_testimony();
+ void hide_testimony();
+
private slots:
void start_chat_ticking();
void play_sfx();