From c37a99a58afae3de0c68342afbcc38328ba66dd8 Mon Sep 17 00:00:00 2001 From: OmniTroid Date: Tue, 14 Feb 2017 00:36:58 +0100 Subject: [PATCH] added objection sfx --- aosfxplayer.cpp | 9 +++++++-- aosfxplayer.h | 2 +- courtroom.cpp | 28 +++++++++++++++++++++++----- packet_distribution.cpp | 8 +++++--- path_functions.cpp | 3 +++ 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index e458802..a2d89b0 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -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; diff --git a/aosfxplayer.h b/aosfxplayer.h index 376e225..bae1100 100644 --- a/aosfxplayer.h +++ b/aosfxplayer.h @@ -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: diff --git a/courtroom.cpp b/courtroom.cpp index fee83f3..c4a76c6 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -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() diff --git a/packet_distribution.cpp b/packet_distribution.cpp index 63e137e..a526acf 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -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") { diff --git a/path_functions.cpp b/path_functions.cpp index 5c58e3d..3f9b6d8 100644 --- a/path_functions.cpp +++ b/path_functions.cpp @@ -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 +*/ }