about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2018-05-22 21:15:01 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2018-05-22 21:15:01 +0700
commitcbaec90dd12bc5d9bea63c315ce835c8207e6fa0 (patch)
tree9009a0660f61912999896cc6163304842b370b7d
parent8e6faa6d267afd96de1b5996712888c5ede497aa (diff)
downloadbrutalmaze-cbaec90dd12bc5d9bea63c315ce835c8207e6fa0.tar.gz
Add option to switch to the original music 0.7.3
-rw-r--r--brutalmaze/constants.py1
-rw-r--r--brutalmaze/game.py13
-rw-r--r--brutalmaze/settings.ini2
-rw-r--r--brutalmaze/soundfx/noise.oggbin0 -> 1422997 bytes
m---------wiki0
5 files changed, 13 insertions, 3 deletions
diff --git a/brutalmaze/constants.py b/brutalmaze/constants.py
index e2c8e43..37ed569 100644
--- a/brutalmaze/constants.py
+++ b/brutalmaze/constants.py
@@ -28,6 +28,7 @@ from pygame.mixer import Sound
 SETTINGS = pkg_file('brutalmaze', 'settings.ini')
 ICON = pygame.image.load(pkg_file('brutalmaze', 'icon.png'))
 MUSIC = pkg_file('brutalmaze', 'soundfx/music.ogg')
+NOISE = pkg_file('brutalmaze', 'soundfx/noise.ogg')
 
 mixer = pygame.mixer.get_init()
 if mixer is None: pygame.mixer.init(frequency=44100)
diff --git a/brutalmaze/game.py b/brutalmaze/game.py
index 74d6225..7240439 100644
--- a/brutalmaze/game.py
+++ b/brutalmaze/game.py
@@ -37,7 +37,8 @@ from pygame import KEYDOWN, QUIT, VIDEORESIZE
 from pygame.time import Clock, get_ticks
 from appdirs import AppDirs
 
-from .constants import SETTINGS, ICON, MUSIC, HERO_SPEED, COLORS, MIDDLE, WALL
+from .constants import (
+    SETTINGS, ICON, MUSIC, NOISE, HERO_SPEED, COLORS, MIDDLE, WALL)
 from .maze import Maze
 from .misc import deg, round2, sign
 
@@ -71,6 +72,7 @@ class ConfigReader:
         self.max_fps = self.config.getint('Graphics', 'Maximum FPS')
         self.muted = self.config.getboolean('Sound', 'Muted')
         self.musicvol = self.config.getfloat('Sound', 'Music volume')
+        self.space = self.config.getboolean('Sound', 'Space theme')
         self.server = self.config.getboolean('Server', 'Enable')
         self.host = self.config.get('Server', 'Host')
         self.port = self.config.getint('Server', 'Port')
@@ -96,7 +98,7 @@ class ConfigReader:
 
     def read_args(self, arguments):
         """Read and parse a ArgumentParser.Namespace."""
-        for option in ('size', 'max_fps', 'muted', 'musicvol',
+        for option in ('size', 'max_fps', 'muted', 'musicvol', 'space',
                        'server', 'host', 'port', 'timeout', 'headless'):
             value = getattr(arguments, option)
             if value is not None: setattr(self, option, value)
@@ -111,7 +113,7 @@ class Game:
         if config.muted or self.headless:
             pygame.mixer.quit()
         else:
-            pygame.mixer.music.load(MUSIC)
+            pygame.mixer.music.load(NOISE if config.space else MUSIC)
             pygame.mixer.music.set_volume(config.musicvol)
             pygame.mixer.music.play(-1)
         pygame.display.set_icon(ICON)
@@ -370,6 +372,11 @@ def main():
         '--music-volume', type=float, metavar='VOL', dest='musicvol',
         help='between 0.0 and 1.0 (fallback: {})'.format(config.musicvol))
     parser.add_argument(
+        '--space-music', action='store_true', default=None, dest='space',
+        help='use space music background'.format(config.muted))
+    parser.add_argument('--default-music', action='store_false', dest='space',
+                        help='use default music background')
+    parser.add_argument(
         '--server', action='store_true', default=None,
         help='enable server (fallback: {})'.format(config.server))
     parser.add_argument('--no-server', action='store_false', dest='server',
diff --git a/brutalmaze/settings.ini b/brutalmaze/settings.ini
index aaa6d98..60cd53c 100644
--- a/brutalmaze/settings.ini
+++ b/brutalmaze/settings.ini
@@ -8,6 +8,8 @@ Maximum FPS: 60
 Muted: no
 # Volume must be between 0.0 and 1.0
 Music volume: 1.0
+# Use space music background, which sounds cold and creepy
+Space theme: no
 
 [Control]
 # Input values should be either from Mouse1 to Mouse3 or a keyboard key
diff --git a/brutalmaze/soundfx/noise.ogg b/brutalmaze/soundfx/noise.ogg
new file mode 100644
index 0000000..73e2157
--- /dev/null
+++ b/brutalmaze/soundfx/noise.ogg
Binary files differdiff --git a/wiki b/wiki
-Subproject 1e2a1adb64d33e14d506dfcd4e9b9513693721b
+Subproject cdd2e0ceaa6a97ae96544a110868fcd70bc2bff