Suffix-independent Music, Mod Music List, looping bugfixes, easter eggs, etc.
This commit is contained in:
parent
c44832a707
commit
1043699214
BIN
base/sounds/music/failed_login.opus
Normal file
BIN
base/sounds/music/failed_login.opus
Normal file
Binary file not shown.
@ -21,6 +21,7 @@ public:
|
|||||||
|
|
||||||
void kill_loop();
|
void kill_loop();
|
||||||
QString get_path();
|
QString get_path();
|
||||||
|
bool enable_looping = true;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
|
@ -68,14 +68,10 @@ public:
|
|||||||
void append_evidence(evi_type p_evi){evidence_list.append(p_evi);}
|
void append_evidence(evi_type p_evi){evidence_list.append(p_evi);}
|
||||||
void append_music(QString f_music){music_list.append(f_music);}
|
void append_music(QString f_music){music_list.append(f_music);}
|
||||||
void append_area(QString f_area){area_list.append(f_area);}
|
void append_area(QString f_area){area_list.append(f_area);}
|
||||||
void fix_last_area()
|
void handle_failed_login();
|
||||||
|
void reset_music_list()
|
||||||
{
|
{
|
||||||
if (area_list.size() > 0)
|
music_list.clear();
|
||||||
{
|
|
||||||
QString malplaced = area_list.last();
|
|
||||||
area_list.removeLast();
|
|
||||||
append_music(malplaced);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void arup_append(int players, QString status, QString cm, QString locked)
|
void arup_append(int players, QString status, QString cm, QString locked)
|
||||||
|
@ -29,6 +29,8 @@ void AOMusicPlayer::play(QString p_song)
|
|||||||
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
||||||
BASS_ChannelPlay(m_stream, false);
|
BASS_ChannelPlay(m_stream, false);
|
||||||
music_loop_timer->stop();
|
music_loop_timer->stop();
|
||||||
|
if(enable_looping)
|
||||||
|
{
|
||||||
QWORD len=BASS_ChannelGetLength(m_stream, BASS_POS_BYTE); // the length in bytes
|
QWORD len=BASS_ChannelGetLength(m_stream, BASS_POS_BYTE); // the length in bytes
|
||||||
double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds
|
double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds
|
||||||
if(time > 0)
|
if(time > 0)
|
||||||
@ -36,6 +38,8 @@ void AOMusicPlayer::play(QString p_song)
|
|||||||
qDebug() << "Will loop in " << time << " seconds.";
|
qDebug() << "Will loop in " << time << " seconds.";
|
||||||
music_loop_timer->start(time*1000);
|
music_loop_timer->start(time*1000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2760,10 +2760,23 @@ void Courtroom::handle_song(QStringList *p_contents)
|
|||||||
QString str_show = char_list.at(n_char).name;
|
QString str_show = char_list.at(n_char).name;
|
||||||
|
|
||||||
if (p_contents->length() > 2)
|
if (p_contents->length() > 2)
|
||||||
|
{
|
||||||
|
if(p_contents->at(2) != "")
|
||||||
{
|
{
|
||||||
str_show = p_contents->at(2);
|
str_show = p_contents->at(2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (p_contents->length() > 3)
|
||||||
|
{
|
||||||
|
if(p_contents->at(3) != "-1")
|
||||||
|
{
|
||||||
|
music_player->enable_looping = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
music_player->enable_looping = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!mute_map.value(n_char))
|
if (!mute_map.value(n_char))
|
||||||
{
|
{
|
||||||
chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true);
|
chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true);
|
||||||
@ -2780,6 +2793,12 @@ void Courtroom::handle_song(QStringList *p_contents)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Courtroom::handle_failed_login()
|
||||||
|
{
|
||||||
|
music_player->enable_looping = false;
|
||||||
|
music_player->play("failed_login");
|
||||||
|
}
|
||||||
|
|
||||||
void Courtroom::handle_wtce(QString p_wtce, int variant)
|
void Courtroom::handle_wtce(QString p_wtce, int variant)
|
||||||
{
|
{
|
||||||
QString sfx_file = "courtroom_sounds.ini";
|
QString sfx_file = "courtroom_sounds.ini";
|
||||||
|
@ -106,13 +106,6 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
|
|||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
destruct_lobby();
|
destruct_lobby();
|
||||||
}
|
}
|
||||||
else if (header == "DOOM")
|
|
||||||
{
|
|
||||||
call_notice("You have been exiled from AO."
|
|
||||||
"Have a nice day.");
|
|
||||||
destruct_courtroom();
|
|
||||||
destruct_lobby();
|
|
||||||
}
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
@ -398,16 +391,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (f_music.endsWith(".wav") ||
|
if (f_contents.at(n_element) == "===MUSIC START===.mp3")
|
||||||
f_music.endsWith(".mp3") ||
|
|
||||||
f_music.endsWith(".mp4") ||
|
|
||||||
f_music.endsWith(".ogg") ||
|
|
||||||
f_music.endsWith(".opus"))
|
|
||||||
{
|
{
|
||||||
musics_time = true;
|
musics_time = true;
|
||||||
areas--;
|
|
||||||
w_courtroom->fix_last_area();
|
|
||||||
w_courtroom->append_music(f_music);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -493,16 +479,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (f_contents.at(n_element).endsWith(".wav") ||
|
if (f_contents.at(n_element) == "===MUSIC START===.mp3")
|
||||||
f_contents.at(n_element).endsWith(".mp3") ||
|
|
||||||
f_contents.at(n_element).endsWith(".mp4") ||
|
|
||||||
f_contents.at(n_element).endsWith(".ogg") ||
|
|
||||||
f_contents.at(n_element).endsWith(".opus"))
|
|
||||||
{
|
{
|
||||||
musics_time = true;
|
musics_time = true;
|
||||||
w_courtroom->fix_last_area();
|
|
||||||
w_courtroom->append_music(f_contents.at(n_element));
|
|
||||||
areas--;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -538,6 +517,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
|
|
||||||
destruct_lobby();
|
destruct_lobby();
|
||||||
}
|
}
|
||||||
|
else if (header == "REFMUSIC")
|
||||||
|
{
|
||||||
|
if (courtroom_constructed)
|
||||||
|
w_courtroom->reset_music_list();
|
||||||
|
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
|
||||||
|
{
|
||||||
|
w_courtroom->append_music(f_contents.at(n_element));
|
||||||
|
}
|
||||||
|
w_courtroom->list_music();
|
||||||
|
}
|
||||||
else if (header == "BN")
|
else if (header == "BN")
|
||||||
{
|
{
|
||||||
if (f_contents.size() < 1)
|
if (f_contents.size() < 1)
|
||||||
@ -618,6 +607,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (header == "FAILEDLOGIN")
|
||||||
|
{
|
||||||
|
if (courtroom_constructed)
|
||||||
|
w_courtroom->handle_failed_login();
|
||||||
|
}
|
||||||
else if (header == "IL")
|
else if (header == "IL")
|
||||||
{
|
{
|
||||||
if (courtroom_constructed && f_contents.size() > 0)
|
if (courtroom_constructed && f_contents.size() > 0)
|
||||||
|
@ -94,11 +94,28 @@ QString AOApplication::get_sounds_path(QString p_file)
|
|||||||
|
|
||||||
QString AOApplication::get_music_path(QString p_song)
|
QString AOApplication::get_music_path(QString p_song)
|
||||||
{
|
{
|
||||||
QString path = get_base_path() + "sounds/music/" + p_song;
|
QString mp3_check = get_base_path() + "sounds/music/" + p_song + ".mp3";
|
||||||
|
QString opus_check = get_base_path() + "sounds/music/" + p_song + ".opus";
|
||||||
|
if (file_exists(opus_check))
|
||||||
|
{
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
return path;
|
return get_base_path() + "sounds/music/" + p_song + ".opus";
|
||||||
#else
|
#else
|
||||||
return get_case_sensitive_path(path);
|
return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".opus");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (file_exists(mp3_check))
|
||||||
|
{
|
||||||
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
|
return get_base_path() + "sounds/music/" + p_song + ".mp3";
|
||||||
|
#else
|
||||||
|
return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".mp3");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
|
return get_base_path() + "sounds/music/" + p_song + ".wav";
|
||||||
|
#else
|
||||||
|
return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".wav");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user