Mercurial > parpg-source
changeset 167:b3b82c2aebee
Using fife settings module again instead of our own.
author | Beliar <KarstenBock@gmx.net> |
---|---|
date | Mon, 20 Feb 2012 16:50:10 +0100 |
parents | a6bbb732b27b |
children | bfd3a4ef7f2b |
files | application.py charactercreationcontroller.py controllerbase.py gamemap.py gamemodel.py gamescenecontroller.py gui/menus.py main.py settings.py |
diffstat | 9 files changed, 42 insertions(+), 584 deletions(-) [+] |
line wrap: on
line diff
--- a/application.py Thu Jan 12 18:42:48 2012 +0100 +++ b/application.py Mon Feb 20 16:50:10 2012 +0100 @@ -112,14 +112,12 @@ def __init__(self, setting): """Initialise the instance. @return: None""" - self._setting = setting + ApplicationBase.__init__(self, setting) self.manager = FifeManager() - self.engine = fife.Engine() - self.loadSettings() - self.engine.init() # KLUDGE M. George Hansen 2011-06-04: See parpg/vfs.py. vfs.VFS = self.engine.getVFS() - vfs.VFS.addNewSource(setting.parpg.DataPath) + print(vfs.VFS) + vfs.VFS.addNewSource(setting.get("parpg","DataPath")) pychan.init(self.engine, debug = True) pychan.setupModalExecution(self.mainLoop,self.breakFromMainLoop) @@ -136,7 +134,7 @@ self.model.getDialogues() # KLUDGE M. George Hansen 2011-06-04: Hack to allow loaded PyChan XML # scripts to locate their resources. - os.chdir(setting.parpg.DataPath) + os.chdir(setting.get("parpg","DataPath")) self.view = MainMenuView(self.engine, self.model) self.loadFonts() self.event_listener = EventListener(self.engine) @@ -148,12 +146,10 @@ self.engine, self.view, self.model) - #start_map = self._setting.fife.get("PARPG", "Map") - #self.model.changeMap(start_map) def loadFonts(self): # add the fonts path to the system path to import font definitons - sys.path.insert(0, os.path.join(self._setting.parpg.DataPath, 'fonts')) + sys.path.insert(0, os.path.join(self._setting.get("parpg", "DataPath"), 'fonts')) from oldtypewriter import fontdefs for fontdef in fontdefs: @@ -161,47 +157,6 @@ self._setting)) - def loadSettings(self): - """ - Load the settings from a python file and load them into the engine. - Called in the ApplicationBase constructor. - """ - - engineSetting = self.engine.getSettings() - assert(isinstance(engineSetting, fife.EngineSettings)) - engineSetting.setDefaultFontGlyphs(self._setting.fife.FontGlyphs) - engineSetting.setDefaultFontPath( - '{0}/fonts/{1}'.format(self._setting.parpg.DataPath, - self._setting.fife.Font) - ) - engineSetting.setDefaultFontSize(self._setting.fife.DefaultFontSize) - engineSetting.setBitsPerPixel(self._setting.fife.BitsPerPixel) - engineSetting.setInitialVolume(self._setting.fife.InitialVolume) - engineSetting.setSDLRemoveFakeAlpha( - self._setting.fife.SDLRemoveFakeAlpha - ) - engineSetting.setGLUseFramebuffer(self._setting.fife.GLUseFramebuffer) - engineSetting.setGLUseNPOT(self._setting.fife.GLUseNPOT) - engineSetting.setScreenWidth(self._setting.fife.ScreenWidth) - engineSetting.setScreenHeight(self._setting.fife.ScreenHeight) - engineSetting.setRenderBackend(self._setting.fife.RenderBackend) - engineSetting.setFullScreen(self._setting.fife.FullScreen) - engineSetting.setVideoDriver(self._setting.fife.VideoDriver) - engineSetting.setLightingModel(self._setting.fife.Lighting) - engineSetting.setColorKeyEnabled(self._setting.fife.ColorKeyEnabled) - engineSetting.setMouseSensitivity(self._setting.fife.MouseSensitivity) - engineSetting.setMouseAcceleration( - self._setting.fife.MouseAcceleration - ) - - engineSetting.setColorKey(*[int(digit) - for digit in self._setting.fife.ColorKey]) - - engineSetting.setWindowTitle(self._setting.fife.WindowTitle) - engineSetting.setWindowIcon( - '/'.join(['gui/icons', self._setting.fife.WindowIcon]) - ) - def createListener(self): """ __init__ takes care of creating an event listener, so basicapplication's createListener is harmful. Without @@ -217,4 +172,4 @@ if self.listener.quit: self.breakRequested = True #pylint: disable-msg=C0103 else: - self.manager._pump() \ No newline at end of file + self.manager._pump()
--- a/charactercreationcontroller.py Thu Jan 12 18:42:48 2012 +0100 +++ b/charactercreationcontroller.py Mon Feb 20 16:50:10 2012 +0100 @@ -120,7 +120,7 @@ self.application) self.application.view = view self.application.manager.swap_modes(controller) - start_map = self.settings.parpg.Map + start_map = self.settings.get("parpg", "Map") self.model.changeMap(start_map) def cancelNewGame(self):
--- a/controllerbase.py Thu Jan 12 18:42:48 2012 +0100 +++ b/controllerbase.py Mon Feb 20 16:50:10 2012 +0100 @@ -84,7 +84,7 @@ """Reset cursor to default image. @return: None""" image = '/'.join(['gui/cursors/', - self.model.settings.parpg.CursorDefault]) + self.model.settings.get("parpg", "CursorDefault")]) self.setMouseCursor(image, image) def pump(self, dt):
--- a/gamemap.py Thu Jan 12 18:42:48 2012 +0100 +++ b/gamemap.py Mon Feb 20 16:50:10 2012 +0100 @@ -92,8 +92,8 @@ the proper camera is set as the 'main' camera. At this point we also set the viewport to the current resolution.""" for cam in self.map.getCameras(): - width = self.settings.fife.ScreenWidth - height = self.settings.fife.ScreenHeight + width = self.engine.getSettings().getScreenWidth() + height = self.engine.getSettings().getScreenHeight() viewport = fife.Rect(0, 0, width, height) cam.setViewPort(viewport) self.my_cam_id = cam.getId() @@ -113,7 +113,7 @@ font = pychan.manager.hook.guimanager.createFont( 'fonts/rpgfont.png', 0, - self.settings.fife.FontGlyphs + self.settings.get("FIFE", "FontGlyphs") ) rend.setFont(font)
--- a/gamemodel.py Thu Jan 12 18:42:48 2012 +0100 +++ b/gamemodel.py Mon Feb 20 16:50:10 2012 +0100 @@ -68,7 +68,7 @@ self.map_change = False self.load_saver = False self.savegame = None - quests_directory = settings.parpg.QuestsPath + quests_directory = settings.get("parpg", "QuestsPath") self.game_state = GameState(quests_dir=quests_directory) #self.game_state.quest_engine = #self.game_state.quest_engine.readQuests() @@ -85,16 +85,16 @@ self.fife_model = engine.getModel() # set values from settings - maps_directory = settings.parpg.MapsPath + maps_directory = settings.get("parpg", "MapsPath") self.game_state.maps_file = '/'.join([maps_directory, - settings.parpg.MapsFile]) + settings.get("parpg", "MapsFile")]) self.all_agents_file = '/'.join([maps_directory, - settings.parpg.AllAgentsFile]) - objects_directory = self.settings.parpg.ObjectsPath + settings.get("parpg", "AllAgentsFile")]) + objects_directory = self.settings.get("parpg", "ObjectsPath") self.objects_directory = objects_directory self.object_db_file = '/'.join([objects_directory, - settings.parpg.ObjectDatabaseFile]) - self.dialogue_directory = settings.parpg.DialoguesPath + settings.get("parpg", "ObjectDatabaseFile")]) + self.dialogue_directory = settings.get("parpg", "DialoguesPath") self.dialogues = {} self.agent_import_files = {} self.obj_loader = XMLObjectLoader(self.engine) @@ -703,7 +703,7 @@ if obj.fifeagent.behaviour: obj.fifeagent.behaviour.parent = obj fifeagent.setup_behaviour(obj.fifeagent) - obj.fifeagent.behaviour.speed = self.settings.parpg.PCSpeed + obj.fifeagent.behaviour.speed = self.settings.get("parpg", "PCSpeed") #Start the behaviour obj.fifeagent.behaviour.idle() # create the agent
--- a/gamescenecontroller.py Thu Jan 12 18:42:48 2012 +0100 +++ b/gamescenecontroller.py Mon Feb 20 16:50:10 2012 +0100 @@ -100,7 +100,7 @@ self.resetMouseCursor() self.paused = False - if model.settings.fife.EnableSound: + if model.settings.get("fife", "PlaySounds"): if not self.view.sounds.music_init: music_path = 'music' music_file = random.choice( @@ -309,22 +309,22 @@ #up if mouse_y <= pixle_edge: direction.append("up") - image = '/'.join(['gui/cursors', settings.parpg.CursorUp]) + image = '/'.join(['gui/cursors', settings.get("parpg", "CursorUp")]) #right if mouse_x >= screen_width - pixle_edge: direction.append("right") - image = '/'.join(['gui/cursors', settings.parpg.CursorRight]) + image = '/'.join(['gui/cursors', settings.get("parpg", "CursorRight")]) #down if mouse_y >= screen_height - pixle_edge: direction.append("down") - image = '/'.join(['gui/cursors', settings.parpg.CursorDown]) + image = '/'.join(['gui/cursors', settings.get("parpg", "CursorDown")]) #left if mouse_x <= pixle_edge: direction.append("left") - image = '/'.join(['gui/cursors', settings.parpg.CursorLeft]) + image = '/'.join(['gui/cursors', settings.get("parpg", "CursorLeft")]) if image is not None and not data_drag.dragging: self.setMouseCursor(image, image) @@ -387,7 +387,7 @@ mouse = self.scroll_data["mouse"] keyboard = self.scroll_data["kb"] - speed = self.model.settings.parpg.ScrollSpeed + speed = self.model.settings.get("parpg", "ScrollSpeed") #adds a value to the offset depending on the contents of each # of the controllers: set() removes doubles
--- a/gui/menus.py Thu Jan 12 18:42:48 2012 +0100 +++ b/gui/menus.py Mon Feb 20 16:50:10 2012 +0100 @@ -77,9 +77,6 @@ self.engine = engine self.settings = settings - width = self.settings.fife.ScreenWidth - height = self.settings.fife.ScreenHeight - # available options screen_modes = self.engine.getDeviceCaps().getSupportedScreenModes() resolutions = list(set([(mode.getWidth(), mode.getHeight()) @@ -91,12 +88,12 @@ self.lighting_models = range(3) # selected options - self.resolution = "{0}x{1}".format(width, height) - self.render_backend = self.settings.fife.RenderBackend - self.lighting_model = self.settings.fife.Lighting - self.fullscreen = self.settings.fife.FullScreen - self.sound = self.settings.fife.EnableSound - self.scroll_speed = self.settings.parpg.ScrollSpeed + self.resolution = self.settings.get("FIFE", "ScreenResolution") + self.render_backend = self.settings.get("FIFE", "RenderBackend") + self.lighting_model = self.settings.get("FIFE", "Lighting") + self.fullscreen = self.settings.get("FIFE", "FullScreen") + self.sound = self.settings.get("FIFE", "PlaySounds") + self.scroll_speed = self.settings.get("parpg", "ScrollSpeed") xml_file = vfs.VFS.open('gui/settings_menu.xml') self.window = pychan.loadXML(xml_file) @@ -157,16 +154,13 @@ self.window.collectData('screen_resolution', 'render_backend', 'lighting_model', 'enable_fullscreen', 'enable_sound', 'scroll_speed') - - width, height = self.resolutions[resolution].split('x') - self.settings.fife.ScreenWidth = width - self.settings.fife.ScreenHeight = height - self.settings.fife.RenderBackend = self.render_backends[backend] - self.settings.fife.Lighting = self.lighting_models[lighting] - self.settings.fife.FullScreen = fullscreen - self.settings.fife.EnableSound = sound - self.settings.parpg.ScrollSpeed = scroll_speed - self.settings.write() + self.settings.set("FIFE", "ScreenResolution", self.resolutions[resolution]) + self.settings.set("FIFE", "RenderBackend", self.render_backends[backend]) + self.settings.set("FIFE", "Lighting", self.lighting_models[lighting]) + self.settings.set("FIFE", "FullScreen", fullscreen) + self.settings.set("FIFE", "EnableSound", sound) + self.settings.set("FIFE", "ScrollSpeed", scroll_speed) + self.settings.saveSettings("../settings.xml") self.restart_dialog.show() self.hide()
--- a/main.py Thu Jan 12 18:42:48 2012 +0100 +++ b/main.py Mon Feb 20 16:50:10 2012 +0100 @@ -15,13 +15,13 @@ import sys from os.path import abspath -from parpg.settings import Settings +from fife.extensions.fife_settings import Setting def main(args, opts): - settings = Settings(*args) + settings = Setting(settings_file="settings.xml") - settings.parpg.DataPath = abspath(settings.parpg.DataPath) + settings.set("parpg","DataPath", abspath(settings.get("parpg","DataPath"))) levels = {'debug': logging.DEBUG, 'info': logging.INFO, @@ -57,7 +57,7 @@ logger.warning('Psyco Acceleration unavailable') psyco_available = False - if settings.fife.UsePsyco: + if settings.get("fife", "UsePsyco"): if psyco_available: psyco.full() logger.info('Psyco Acceleration enabled')
--- a/settings.py Thu Jan 12 18:42:48 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,491 +0,0 @@ -#!/usr/bin/env python2 - -# Copyright (C) 2011 Edwin Marshall <emarshall85@gmail.com> - -# This file is part of PARPG. -# -# PARPG is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# PARPG is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with PARPG. If not, see <http://www.gnu.org/licenses/>. - -""" Provides a class used for reading and writing various configurable options - throughout the game - - This class produces an INI formated settings file as opposed to an XML - formatted one. The reason that python's built-in ConfigurationParser isn't - sufficient is because comments aren't preserved when writing a settings - file, the order in which the options are written isn't preserved, and the - interface used with this class is arguably more convenient that - ConfigParser's. - - Default Settings may be generated by envoking this module from the - command line: - python -m settings.py [system] [data_directory] - - where [system] is one of local, windows, or linux (mac coming soon), - and data_directory is the base path for the data files to be loaded. - - Both [system] and [data_directory] are option. If omitted, both - default to whichever what is reasonable based on the system settings.py - is run on -""" - -import os -import sys -import platform - -#TODO: add logging to replace print statements -class Section(object): - """ An object that represents a section in a settings file. - - Options can be added to a section by simply assigning a value to an - attribute: - section.foo = baz - would produce: - [section] - foo = baz - in the settings file. Options that do not exist on assignment - are created dynamcially. - - Values are automatically converted to the appropriate python type. - Options that begin and end with brackets([, ]) are converted to lists, - and options that are double-quoted (") are converted to strings. - Section also recognizes booleans regardless of case, in addition to the - literals 'yes' and 'no' of any case. Except in the case of - double-quoted strings, extra white-space is trimmed, so you need not - worry. For example: - foo = bar - is equivalent to : - foo = baz - """ - def __init__(self, name): - """ Initialize a new section. - - @param name: name of the section. In the INI file, sections are surrounded - by brackets ([name]) - @type name: string - """ - self.name = name - - def __setattr__(self, option, value): - """ Assign a value to an option, converting types when appropriate. - - @param option: name of the option to assign a value to. - @type option: string @param value: value to be assigned to the option. - @type value: int, float, string, boolean, or list - """ - value = str(value) - if value.startswith('[') and value.endswith(']'): - value = [item.strip() for item in value[1:-1].split(',')] - elif value.lower() == 'true' or value.lower() == 'yes': - value = True - elif value.lower() == 'false' or value.lower() == 'no': - value = False - elif value.isdigit(): - value = int(value) - else: - try: - value = float(value) - except ValueError: - # leave as string - pass - - self.__dict__[option] = value - - def __getattribute__(self, option): - """ Returns the option's value""" - # Remove leading and trailing quotes from strings that have them - return_value = object.__getattribute__(self, option) - try: - for key, value in return_value.iteritems(): - if (hasattr(value, 'split') and - value.startswith("\"") and value.endswith("\"")): - return_value[key] = value[1:-1] - except AttributeError: - pass - - return return_value - - @property - def options(self): - """ Returns a dictionary of existing options """ - options = self.__dict__ - # get rid of properties that aren't actually options - if options.has_key('name'): - options.pop('name') - - return options - -class Settings(object): - """ An object that represents a settings file, its sectons, - and the options defined within those sections. - """ - def __init__(self, settings_path='', system_path='', user_path='', - filename='parpg.cfg'): - """ initializes a new settings object. If no paths are given, they are - guessed based on whatever platform the script was run on. - - Examples: - paths = ['/etc/parpg', '/home/user_name/.config/parpg'] - settings = Settings(*paths) - - paths = {'system': '/etc/parpg', - 'user': '/home/user_name/.config/parpg'} - settings = Settings(**paths) - - settings = Settings('.') - - settigns = Settings() - - @param system_path: Path to the system settings file. - @type system_path: string (must be a valid path) - - @param user_path: Path to the user settings file. Options that - are missing from this file are propogated - from the system settings file and saved on - request - @type user_path: string (must be a valid path) - - @param suffix: Suffix of the settings file that will be generated. - @type suffix: string - """ - self.filename = filename - self.settings_file = '' - - self.paths = {} - if not system_path and not user_path and not settings_path: - # use platform-specific values as paths - (self.paths['system'], self.paths['user'], - self.paths['settings']) = self.platform_paths() - else: - # convert supplied paths to absolute paths - abs_paths = [os.path.expanduser(path) - for path in [system_path, user_path, settings_path]] - (self.paths['system'], self.paths['user'], - self.paths['settings']) = abs_paths - - self.read() - - - def __getattr__(self, name): - """ Returns a Section object to be used for assignment, creating one - if it doesn't exist. - - @param name: name of section to be retrieved - @type name: string - """ - if name in ['get', 'set']: - raise AttributeError("{0} is deprecated. Please consult Settings' " - "documentation for information on how to " - "create/modify sections and their respective " - "options".format(name)) - else: - if not self.__dict__.has_key(name): - setattr(self, name, Section(name)) - - return getattr(self, name) - - def platform_paths(self, system=None): - if system is None: - system = platform.system().lower() - - if system == 'linux': - return (os.path.join(os.sep, 'usr', 'share', 'parpg'), - os.path.join(os.environ['XDG_CONFIG_HOME'], 'parpg'), - os.path.join(os.sep, 'etc', 'parpg')) - elif system == 'windows': - return (os.path.join(os.environ['PROGRAMFILES'], 'PARPG'), - os.path.join(os.environ['USERDATA'], 'PARPG'), - os.path.join(os.environ['PROGRAMFILES'], 'PARPG')) - else: - # TODO: determine values for Mac - return None - - def read(self, filenames=None): - """ Reads a settings file and populates the settings object - with its sections and options. Calling this method without - any arguments simply re-reads the previously defined filename - and paths - - @param filenames: name of files to be parsed. - @type path: string or list - """ - - if filenames is None: - filenames = [os.path.join(self.paths['settings'], self.filename), - os.path.join(self.paths['user'], self.filename)] - elif hasattr(filenames, 'split'): - filenames = [filenames] - - for filename in filenames: - section = None - if os.path.exists(filename): - try: - self.settings_file = open(filename, 'r').readlines() - except IOError as (errno, strerror): - if errno == 2: - if os.path.basename(filename).startswith('system'): - print ('{0} could not be found. Please supply a ' - 'different path or generate a system settings ' - 'file with:\n' - 'python2 -m parpg.settings').format(filename) - sys.exit(1) - else: - print 'Error No. {0}: {1} {2}'.format(errno, filename, strerror) - sys.exit(1) - - for line in self.settings_file: - if line.startswith('#') or line.strip() == '': - continue - elif line.startswith('[') and line.endswith(']\n'): - getattr(self, line[1:-2]) - section = line[1:-2] - else: - option, value = [item.strip() - for item in line.split('=', 1)] - setattr(getattr(self, section), option, value) - - def write(self, filename=None): - """ Writes a settings file based on the settings object's - sections and options - - @param filename: Name of file to save to. By default, this is - the user settings file. - @type path: string - """ - if filename is None: - filename = os.path.join(self.paths['user'], - 'user{0}'.format(self.suffix)) - - for section in self.sections: - - if '[{0}]\n'.format(section) not in self.settings_file: - self.settings_file.append('\n[{0}]\n'.format(section)) - for option, value in getattr(self, section).options.iteritems(): - template = '{0} = {1}\n'.format(option, value) - self.settings_file.append(template) - else: - start_of_section = (self.settings_file - .index('[{0}]\n'.format(section)) + 1) - - for option, value in getattr(self, - section).options.iteritems(): - if hasattr(value, 'sort'): - value = '[{0}]'.format(', '.join(value)) - - new_option = False - template = '{0} = {1}\n'.format(option, value) - for index, line in enumerate(self.settings_file[:]): - if option in line: - new_option = False - if str(value) not in line: - self.settings_file[index] = template - - break - else: - new_option = True - if new_option: - while self.settings_file[start_of_section].startswith('#'): - start_of_section += 1 - - self.settings_file.insert(start_of_section, template) - - with open(filename, 'w') as out_stream: - for line in self.settings_file: - out_stream.write(line) - - @property - def sections(self): - """ Returns a list of existing sections""" - sections = self.__dict__.keys() - sections.pop(sections.index('settings_file')) - sections.pop(sections.index('paths')) - sections.pop(sections.index('suffix')) - sections.pop(sections.index('filename')) - - return sections - - @property - def system_path(self): - return self.paths['system'] - - @property - def user_path(self): - return self.paths['user'] - - @property - def settings_path(self): - return self.paths['settings'] - -DEFAULT_SETTINGS = """\ -[fife] -#------------------------------------------------------------------------------ -# Options marked with ? are untested/unknown - -# Game window's title (string) DO NOT EDIT! -WindowTitle = PARPG Techdemo 2 - -# Icon to use for the game window's border (filename) DO NOT EDIT! -WindowIcon = window_icon.png - -# Video driver to use. (?) -VideoDriver = "" - -# Backend to use for graphics (OpenGL|OpenGLe|SDL) -RenderBackend = OpenGL - -# Run the game in fullscreen mode or not. (True|False) -FullScreen = False - -# Screen Resolution's width. Not used if FullScreen is set to False -# (800|1024|etc) -ScreenWidth = 1024 - -# Screen Resolution's height. Not used if FullScreen is set to False -# (600|768|etc) -ScreenHeight = 768 - -# Screen DPI? (?) -BitsPerPixel = 0 - -# ? (?) -SDLRemoveFakeAlpha = 1 - -# Use Framebuffer Objects (True|False) -GLUseFramebuffer = True - -# Use NPOT textures (True|False) -GLUseNPOT = True - -# The Sensitivity of the mouse. (-0.99 to 10.0) -MouseSensitivity = 0.0 - -# Sets whether the mouse should be accelerated. (True|False) -MouseAcceleration = False - -# Subdirectory to load icons from (path) -IconsPath = icons - -# ? ([R, G, B]) -ColorKey = [250, 0, 250] - -# ? (True|False) -ColorKeyEnabled = False - -# Turn on sound effects and music (True|False) -EnableSound = True - -# Initial volume of sound effects and music (0.0-100.0?) -InitialVolume = 5.0 - -# Characters to use to render fonts. DO NOT EDIT! -FontGlyphs = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\"" - -# Subdirectory to load fronts from (path) -FontsPath = fonts - -# Font to load when game starts -Font = oldtypewriter.ttf - -# Size of in-game fonts -DefaultFontSize = 12 - -# ? (?) -LogModules = [controller] - -# ? (?) -PychanDebug = False - -# use Psyco Acceperation (True|False) -UsePsyco = False - -# ? (?) -ProfilingOn = False - -# Lighting Model to use (0-2) -Lighting = 0 - -[parpg] -#------------------------------------------------------------------------------ - -# System subdirectory to load maps from (path) -MapsPath = maps - -# YAML file that contains the available maps (filename) -MapsFile = maps.yaml - -# Map to load when game starts (filename) -Map = Mall - -# ? (filename) -AllAgentsFile = all_agents.yaml - -# System subdirectory to load objects from (path) -ObjectsPath = objects - -# YAML file that contains the database of availabel objects (filename) -ObjectDatabaseFile = object_database.yaml - -# System subdirectory to load dialogues from (path) -DialoguesPath = dialogue - -# System subdirectory to load quests from (path) -QuestsPath = quests - -# User subdirectory to save screenshots to -ScreenshotsPath = screenshots - -# User subdirectory to save games to -SavesPath = saves - -# System subdirectory where gui files are loaded from (path) -GuiPath = gui - -# System subdirectory where cursors are loaded from (path) -CursorPath = cursors - -# File to use for default cursor (filename) -CursorDefault = cursor_plain.png - -# File to use for up cursor (filename) -CursorUp = cursor_up.png - -# File to use for right cursor (filename) -CursorRight = cursor_right.png - -# File to use for down cursor (filename) -CursorDown = cursor_down.png - -# File to use for left cursor (filename) -CursorLeft = cursor_left.png - -# how many pixles to move the camera per time frame (digit) -ScrollSpeed = 1.0 - -# Player walk speed (digit) -PCSpeed = 3\ -""" - -if __name__ == '__main__': - from optparse import OptionParser - - usage = "usage: %prog [options] system[, system, ...]" - parser = OptionParser(usage=usage) - - parser.add_option('-f', '--filename', default='system.cfg', - help='Filename of output configuration file') - - opts, args = parser.parse_args() - - with open(opts.filename, 'w') as f: - for line in DEFAULT_SETTINGS: - f.write(line)