- added in-game sound toggle hotkey (thanks Nebososo)
This commit is contained in:
parent
792150e3dd
commit
db25b5391e
|
@ -40,6 +40,7 @@ HotKeySelectedUnitsAttack=A
|
||||||
HotKeySelectedUnitsStop=S
|
HotKeySelectedUnitsStop=S
|
||||||
HotKeyToggleOSMouseEnabled=/
|
HotKeyToggleOSMouseEnabled=/
|
||||||
ChatTeamMode=H
|
ChatTeamMode=H
|
||||||
|
ToggleMusic=K
|
||||||
|
|
||||||
; === propertyMap File ===
|
; === propertyMap File ===
|
||||||
|
|
||||||
|
|
|
@ -958,6 +958,24 @@ void Game::keyDown(char key){
|
||||||
else if(key == configKeys.getCharKey("ShowFullConsole")) {
|
else if(key == configKeys.getCharKey("ShowFullConsole")) {
|
||||||
showFullConsole= true;
|
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")) {
|
else if(key == configKeys.getCharKey("Screenshot")) {
|
||||||
string path = GameConstants::folder_path_screenshots;
|
string path = GameConstants::folder_path_screenshots;
|
||||||
if(isdir(path.c_str()) == true) {
|
if(isdir(path.c_str()) == true) {
|
||||||
|
|
Loading…
Reference in New Issue