Added sound effects for users entering and leaving the game lobby,
and different sound effects for messages
This commit is contained in:
parent
ea8f2d0bd1
commit
2b1d55fb98
9 changed files with 28 additions and 3 deletions
BIN
sounds/arrive.wav
Normal file
BIN
sounds/arrive.wav
Normal file
Binary file not shown.
BIN
sounds/leave.wav
Normal file
BIN
sounds/leave.wav
Normal file
Binary file not shown.
BIN
sounds/receive.wav
Normal file
BIN
sounds/receive.wav
Normal file
Binary file not shown.
|
@ -55,6 +55,15 @@ namespace game_config
|
|||
std::string unchecked_menu_image = "buttons/checkbox.png";
|
||||
std::string checked_menu_image = "buttons/checkbox-pressed.png";
|
||||
|
||||
namespace sounds {
|
||||
const std::string turn_bell = "bell.wav",
|
||||
receive_message = "receive.wav",
|
||||
user_arrive = "arrive.wav",
|
||||
user_leave = "leave.wav";
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef WESNOTH_PATH
|
||||
std::string path = WESNOTH_PATH;
|
||||
#else
|
||||
|
|
|
@ -45,6 +45,10 @@ namespace game_config
|
|||
|
||||
extern int title_logo_x, title_logo_y, title_buttons_x, title_buttons_y, title_buttons_padding;
|
||||
|
||||
namespace sounds {
|
||||
extern const std::string turn_bell, receive_message, user_arrive, user_leave;
|
||||
}
|
||||
|
||||
void load_config(const config* cfg);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "events.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "font.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "hotkeys.hpp"
|
||||
#include "image.hpp"
|
||||
#include "key.hpp"
|
||||
|
@ -9,6 +10,7 @@
|
|||
#include "network.hpp"
|
||||
#include "preferences.hpp"
|
||||
#include "show_dialog.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "widgets/textbox.hpp"
|
||||
#include "widgets/button.hpp"
|
||||
#include "widgets/menu.hpp"
|
||||
|
@ -344,11 +346,21 @@ RESULT enter(display& disp, config& game_data, const config& terrain_data, dialo
|
|||
game_data = data;
|
||||
break;
|
||||
} else if(data.child("gamelist_diff")) {
|
||||
const int old_users = game_data.get_children("user").size();
|
||||
game_data.apply_diff(*data.child("gamelist_diff"));
|
||||
const int new_users = game_data.get_children("user").size();
|
||||
if(new_users < old_users) {
|
||||
sound::play_sound(game_config::sounds::user_leave);
|
||||
} else if(new_users > old_users) {
|
||||
sound::play_sound(game_config::sounds::user_arrive);
|
||||
}
|
||||
|
||||
break;
|
||||
} else if(data.child("error")) {
|
||||
throw network::error((*data.child("error"))["message"]);
|
||||
} else if(data.child("message")) {
|
||||
sound::play_sound(game_config::sounds::receive_message);
|
||||
|
||||
const config& msg = *data.child("message");
|
||||
std::stringstream message;
|
||||
message << "<" << msg["sender"] << "> " << msg["message"];
|
||||
|
|
|
@ -70,7 +70,7 @@ void play_turn(game_data& gameinfo, game_state& state_of_game,
|
|||
const paths_wiper wiper(gui);
|
||||
|
||||
if(preferences::turn_bell()) {
|
||||
sound::play_sound("bell.wav");
|
||||
sound::play_sound(game_config::sounds::turn_bell);
|
||||
}
|
||||
|
||||
if(preferences::turn_dialog()) {
|
||||
|
|
|
@ -611,7 +611,7 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
|
|||
const std::string& team_name = (*child)["team_name"];
|
||||
if(team_name == "" || teams[disp.viewing_team()].team_name() == team_name) {
|
||||
if(preferences::message_bell()) {
|
||||
sound::play_sound("bell.wav");
|
||||
sound::play_sound(game_config::sounds::receive_message);
|
||||
}
|
||||
|
||||
const int side = lexical_cast_default<int>((*child)["side"].c_str());
|
||||
|
|
|
@ -197,7 +197,7 @@ report generate_report(TYPE type, const gamemap& map, const unit_map& units,
|
|||
|
||||
for(std::map<int,std::vector<std::string> >::reverse_iterator resist = resistances.rbegin(); resist != resistances.rend(); ++resist) {
|
||||
std::sort(resist->second.begin(),resist->second.end());
|
||||
tooltip << (resist->first >= 0 ? "+" : "") << resist->first << "% vs ";
|
||||
tooltip << (resist->first >= 0 ? "+" : "") << resist->first << "% " << string_table["versus"] << " ";
|
||||
for(std::vector<std::string>::const_iterator i = resist->second.begin(); i != resist->second.end(); ++i) {
|
||||
if(i != resist->second.begin()) {
|
||||
tooltip << ",";
|
||||
|
|
Loading…
Add table
Reference in a new issue