Add option to switch to the original music
This commit is contained in:
parent
8e6faa6d26
commit
cbaec90dd1
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
@ -369,6 +371,11 @@ def main():
|
|||
parser.add_argument(
|
||||
'--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))
|
||||
|
|
|
@ -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
|
||||
|
|
Binary file not shown.
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit 1e2a1adb64d33e14d506dfcd4e9b9513693721bf
|
||||
Subproject commit cdd2e0ceaa6a97ae96544a110868fcd70bc2bff7
|
Loading…
Reference in New Issue