Add an option to engine for turning music off
authorunc0rr
Sun, 27 Jul 2008 22:09:40 +0000
changeset 1128 9b3f42bf4eef
parent 1127 7e1b94a0fc1f
child 1129 b74ffca22762
Add an option to engine for turning music off
QTfrontend/game.cpp
hedgewars/hwengine.dpr
hedgewars/uMisc.pas
hedgewars/uSound.pas
--- a/QTfrontend/game.cpp	Sun Jul 27 21:58:46 2008 +0000
+++ b/QTfrontend/game.cpp	Sun Jul 27 22:09:40 2008 +0000
@@ -267,6 +267,7 @@
 	arguments << (config->isShowFPSEnabled() ? "1" : "0");
 	arguments << (config->isAltDamageEnabled() ? "1" : "0");
 	arguments << config->netNick().toUtf8().toBase64();
+	arguments << "1";
 	return arguments;
 }
 
--- a/hedgewars/hwengine.dpr	Sun Jul 27 21:58:46 2008 +0000
+++ b/hedgewars/hwengine.dpr	Sun Jul 27 22:09:40 2008 +0000
@@ -184,7 +184,7 @@
 {$ENDIF}
 
 case ParamCount of
-14: begin
+15: begin
      val(ParamStr(2), cScreenWidth);
      val(ParamStr(3), cScreenHeight);
      cInitWidth:= cScreenWidth;
@@ -201,6 +201,7 @@
      cShowFPS:= ParamStr(12) = '1';
      cAltDamage:= ParamStr(13) = '1';
      UserNick:= DecodeBase64(ParamStr(14));
+     isMusicEnabled:= ParamStr(15) = '1';
      for p:= Succ(Low(TPathType)) to High(TPathType) do
          if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
      end;
--- a/hedgewars/uMisc.pas	Sun Jul 27 21:58:46 2008 +0000
+++ b/hedgewars/uMisc.pas	Sun Jul 27 22:09:40 2008 +0000
@@ -26,6 +26,7 @@
 	isInLag         : boolean = false;
 	isPaused        : boolean = false;
 	isSoundEnabled  : boolean = true;
+	isMusicEnabled  : boolean = false;
 	isSEBackup      : boolean = true;
 	isInMultiShoot  : boolean = false;
 	isSpeed         : boolean = false;
--- a/hedgewars/uSound.pas	Sun Jul 27 21:58:46 2008 +0000
+++ b/hedgewars/uSound.pas	Sun Jul 27 22:09:40 2008 +0000
@@ -48,7 +48,7 @@
 if isSoundEnabled then WriteLnToConsole(msgOK)
                   else WriteLnToConsole(msgFailed);
 Mix_AllocateChannels(Succ(chanTPU));
-Mix_VolumeMusic(64);
+if isMusicEnabled then Mix_VolumeMusic(64);
 
 Volume:= cInitVolume;
 if Volume < 0 then Volume:= 0;
@@ -99,7 +99,8 @@
 var s: string;
 begin
 if (not isSoundEnabled)
-	or (MusicFN = '') then exit;
+	or (MusicFN = '')
+	or (not isMusicEnabled)then exit;
 
 s:= PathPrefix + '/Music/' + MusicFN;
 WriteToConsole(msgLoading + s + ' ');
@@ -120,7 +121,7 @@
 if Volume < 0 then Volume:= 0;
 Mix_Volume(-1, Volume);
 Volume:= Mix_Volume(-1, -1);
-Mix_VolumeMusic(Volume * 5 div 8);
+if isMusicEnabled then Mix_VolumeMusic(Volume * 5 div 8);
 ChangeVolume:= Volume * 100 div MIX_MAX_VOLUME
 end;