added witness testimony blinking

This commit is contained in:
OmniTroid 2017-02-14 01:44:08 +01:00
parent ff215c3492
commit 229d2d4de5
2 changed files with 49 additions and 0 deletions

View File

@ -31,6 +31,12 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
realization_timer = new QTimer(this); realization_timer = new QTimer(this);
realization_timer->setSingleShot(true); 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); char_button_mapper = new QSignalMapper(this);
music_player = new AOMusicPlayer(this, ao_app); 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(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 //emote signals are set in emotes.cpp
connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); 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->move(0, 0);
ui_vp_testimony->resize(ui_viewport->width(), ui_viewport->height()); 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->move(0, 0);
ui_vp_realization->resize(ui_viewport->width(), ui_viewport->height()); 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_sfx_slider->setValue(50);
ui_blip_slider->setValue(50); ui_blip_slider->setValue(50);
testimony_in_progress = false;
ui_char_select_background->hide(); ui_char_select_background->hide();
ui_ic_chat_message->setEnabled(true); ui_ic_chat_message->setEnabled(true);
@ -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() void Courtroom::play_sfx()
{ {
QString sfx_name = m_chatmessage[SFX_NAME]; QString sfx_name = m_chatmessage[SFX_NAME];
@ -1180,6 +1212,9 @@ void Courtroom::play_sfx()
void Courtroom::set_scene() void Courtroom::set_scene()
{ {
if (testimony_in_progress)
show_testimony();
//witness is default if pos is invalid //witness is default if pos is invalid
QString f_image = "witnessempty.png"; 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()); sfx_player->play("sfx-testimony2.wav", ui_sfx_slider->value());
ui_vp_wtce->play("witnesstestimony"); ui_vp_wtce->play("witnesstestimony");
testimony_in_progress = true;
show_testimony();
} }
//cross examination //cross examination
else if (p_wtce == "testimony2") else if (p_wtce == "testimony2")
{ {
sfx_player->play("sfx-testimony.wav", ui_sfx_slider->value()); sfx_player->play("sfx-testimony.wav", ui_sfx_slider->value());
ui_vp_wtce->play("crossexamination"); ui_vp_wtce->play("crossexamination");
testimony_in_progress = false;
} }
} }

View File

@ -122,6 +122,9 @@ private:
QTimer *realization_timer; QTimer *realization_timer;
QTimer *testimony_show_timer;
QTimer *testimony_hide_timer;
//every time point in char.inis times this equals the final time //every time point in char.inis times this equals the final time
const int time_mod = 40; const int time_mod = 40;
@ -131,6 +134,11 @@ private:
QString previous_ic_message = ""; 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; QMap<QString, bool> mute_map;
bool is_muted = false; bool is_muted = false;
@ -278,6 +286,9 @@ public slots:
void realization_done(); void realization_done();
void show_testimony();
void hide_testimony();
private slots: private slots:
void start_chat_ticking(); void start_chat_ticking();
void play_sfx(); void play_sfx();