mirror of
https://github.com/glest/glest-source.git
synced 2025-09-24 22:51:27 +02:00
- added in-game sound toggle hotkey (thanks Nebososo)
This commit is contained in:
@@ -40,6 +40,7 @@ HotKeySelectedUnitsAttack=A
|
||||
HotKeySelectedUnitsStop=S
|
||||
HotKeyToggleOSMouseEnabled=/
|
||||
ChatTeamMode=H
|
||||
ToggleMusic=K
|
||||
|
||||
; === propertyMap File ===
|
||||
|
||||
|
@@ -958,6 +958,24 @@ void Game::keyDown(char key){
|
||||
else if(key == configKeys.getCharKey("ShowFullConsole")) {
|
||||
showFullConsole= true;
|
||||
}
|
||||
//Toggle music
|
||||
else if(key == configKeys.getCharKey("ToggleMusic")) {
|
||||
Config &config = Config::getInstance();
|
||||
StrSound *gameMusic = world.getThisFaction()->getType()->getMusic();
|
||||
if(gameMusic != NULL) {
|
||||
float configVolume = (config.getInt("SoundVolumeMusic") / 100.f);
|
||||
float currentVolume = gameMusic->getVolume();
|
||||
if(currentVolume > 0) {
|
||||
gameMusic->setVolume(0);
|
||||
console.addLine(lang.get("GameMusic") + " " + lang.get("Off"));
|
||||
}
|
||||
else {
|
||||
//If the config says zero, use the default music volume
|
||||
gameMusic->setVolume(configVolume ? configVolume : 0.9);
|
||||
console.addLine(lang.get("GameMusic"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(key == configKeys.getCharKey("Screenshot")) {
|
||||
string path = GameConstants::folder_path_screenshots;
|
||||
if(isdir(path.c_str()) == true) {
|
||||
|
Reference in New Issue
Block a user