added objection sfx

This commit is contained in:
OmniTroid 2017-02-14 00:36:58 +01:00
parent cd0384a241
commit c37a99a58a
5 changed files with 39 additions and 11 deletions

View File

@ -10,11 +10,16 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
ao_app = p_ao_app;
}
void AOSfxPlayer::play(QString p_sfx, int p_volume)
void AOSfxPlayer::play(QString p_sfx, int p_volume, QString p_char)
{
BASS_ChannelStop(m_stream);
QString f_path = ao_app->get_sounds_path() + p_sfx;
QString f_path;
if (p_char != "")
f_path = ao_app->get_character_path(p_char) + p_sfx;
else
f_path = ao_app->get_sounds_path() + p_sfx;
qDebug() << "sfx path: " << f_path;

View File

@ -11,7 +11,7 @@ class AOSfxPlayer
public:
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
void play(QString p_sfx, int p_volume);
void play(QString p_sfx, int p_volume, QString p_char = "");
void set_volume(int p_volume);
private:

View File

@ -34,8 +34,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
char_button_mapper = new QSignalMapper(this);
music_player = new AOMusicPlayer(this, ao_app);
music_player->set_volume(0);
sfx_player = new AOSfxPlayer(this, ao_app);
sfx_player->set_volume(0);
blip_player = new AOBlipPlayer(this, ao_app);
blip_player->set_volume(0);
ui_background = new AOImage(this, ao_app);
@ -135,15 +138,15 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_music_slider = new QSlider(Qt::Horizontal, this);
ui_music_slider->setRange(0, 100);
ui_music_slider->setValue(50);
ui_music_slider->setValue(0);
ui_sfx_slider = new QSlider(Qt::Horizontal, this);
ui_sfx_slider->setRange(0, 100);
ui_sfx_slider->setValue(50);
ui_sfx_slider->setValue(0);
ui_blip_slider = new QSlider(Qt::Horizontal, this);
ui_blip_slider->setRange(0, 100);
ui_blip_slider->setValue(50);
ui_blip_slider->setValue(0);
/////////////char select widgets under here///////////////
@ -298,6 +301,7 @@ void Courtroom::set_widgets()
if (f_courtroom.width < 0 || f_courtroom.height < 0)
{
qDebug() << "ERROR: did not find courtroom width or height in courtroom_design.ini!";
//T0D0: add error box then quit application, this is not recoverable
}
}
@ -663,9 +667,15 @@ void Courtroom::enter_courtroom(int p_cid)
if (ao_app->flipping_enabled)
ui_flip->show();
else
ui_flip->hide();
list_music();
ui_music_slider->setValue(50);
ui_sfx_slider->setValue(50);
ui_blip_slider->setValue(50);
ui_char_select_background->hide();
ui_ic_chat_message->setEnabled(true);
@ -831,7 +841,7 @@ void Courtroom::on_chat_return_pressed()
QString f_flip;
if (ao_app->ao2_features)
if (ao_app->flipping_enabled)
{
if (ui_flip->isChecked())
f_flip = "1";
@ -907,16 +917,20 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
{
case 1:
ui_vp_objection->play("holdit");
sfx_player->play("holdit.wav", ui_sfx_slider->value(), m_chatmessage[CHAR_NAME]);
break;
case 2:
ui_vp_objection->play("objection");
sfx_player->play("objection.wav", ui_sfx_slider->value(), m_chatmessage[CHAR_NAME]);
break;
case 3:
ui_vp_objection->play("takethat");
sfx_player->play("takethat.wav", ui_sfx_slider->value(), m_chatmessage[CHAR_NAME]);
break;
//case 4 is AO2 only
case 4:
ui_vp_objection->play("custom", m_chatmessage[CHAR_NAME]);
sfx_player->play("custom.wav", ui_sfx_slider->value(), m_chatmessage[CHAR_NAME]);
break;
default:
qDebug() << "W: Logic error in objection switch statement!";
@ -1034,7 +1048,7 @@ void Courtroom::handle_chatmessage_3()
{
realization_timer->start(60);
ui_vp_realization->show();
sfx_player->play("sfx-realization.wav", ui_sfx_slider->value());
//T0D0: add realization sfx
}
}
@ -1119,6 +1133,7 @@ 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
@ -1158,6 +1173,9 @@ void Courtroom::play_sfx()
return;
sfx_player->play(sfx_name + ".wav", ui_sfx_slider->value());
//T0D0: add audio implementation
//QString sfx_name = m_chatmessage[SFX_NAME];
}
void Courtroom::set_scene()

View File

@ -111,12 +111,12 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
{
encryption_needed = false;
yellow_text_enabled = true;
//still needs some tweaking to work
//prezoom still needs some tweaking to work
prezoom_enabled = false;
flipping_enabled = true;
//same goes for flipping, sadly
flipping_enabled = false;
custom_objection_enabled = true;
//improved loading disabled for now
//improved_loading_enabled = true;
improved_loading_enabled = false;
}
else
@ -128,6 +128,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
custom_objection_enabled = false;
improved_loading_enabled = false;
}
send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
}
else if (header == "CT")
{

View File

@ -10,11 +10,14 @@
QString AOApplication::get_base_path(){
return "E:/AO/client/base/";
/*
#ifdef OMNI_DEBUG
return "/media/omnitroid/Data/winshare/AO/client/base/";
#else
return (QDir::currentPath() + "/base/");
#endif
*/
}