Skip to content

Commit

Permalink
Cleanup|Scripting: Use the “record foo()” syntax for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 4, 2017
1 parent e24bce8 commit 156b899
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 84 deletions.
82 changes: 45 additions & 37 deletions doomsday/apps/client/net.dengine.client.pack/modules/appconfig.de
Expand Up @@ -37,6 +37,7 @@ def setDefaults(d)
# Additional Log defaults.
d.log.filterBySubsystem = False
d.log.showMetadata = False

record d.alert()
generic = Log.WARNING
resource = Log.WARNING
Expand All @@ -52,20 +53,23 @@ def setDefaults(d)
end

# Home.
record d.home
record d.home.columns
d.home.showUnplayableGames = True
d.home.showColumnDescription = True
d.home.columns.doom = True
d.home.columns.heretic = True
d.home.columns.hexen = True
d.home.columns.otherGames = True
d.home.columns.multiplayer = True
record d.home()
showUnplayableGames = True
showColumnDescription = True

record columns
columns.doom = True
columns.heretic = True
columns.hexen = True
columns.otherGames = True
columns.multiplayer = True
end

# Input defaults.
record d.input
record d.input.mouse
d.input.mouse.syncSensitivity = True
record d.input()
record mouse
mouse.syncSensitivity = True
end

# Defaults for the automatic updater.
record d.updater()
Expand All @@ -90,37 +94,41 @@ def setDefaults(d)
end

# Resource settings.
record d.resource
d.resource.iwadFolder = ''
d.resource.packageFolder = ''
d.resource.noHighResTex = False
d.resource.noHighResPatches = False
d.resource.highResWithPWAD = True
record d.resource()
iwadFolder = ''
packageFolder = ''
noHighResTex = False
noHighResPatches = False
highResWithPWAD = True
end

# Renderer settings.
record d.render
d.render.pixelDensity = 1.0 # Overall pixel density.
record d.render()
pixelDensity = 1.0 # Overall pixel density.

# LensFx settings.
record d.render.fx
record d.render.fx.resize
d.render.fx.resize.factor = 1.0
# LensFx settings.
record fx
record fx.resize
fx.resize.factor = 1.0
end

# VR/3D settings.
record d.vr
record d.vr.oculusRift
d.vr.oculusRift.pixelDensity = 1.0
record d.vr()
record oculusRift
oculusRift.pixelDensity = 1.0
end

# Audio settings.
record d.audio
d.audio.soundPlugin = 'fmod'
if Version.OS == 'macx'
d.audio.musicPlugin = 'fluidsynth'
d.audio.cdPlugin = 'dummy'
else
d.audio.musicPlugin = 'fmod'
d.audio.cdPlugin = 'fmod'
record d.audio()
soundPlugin = 'fmod'
if Version.OS == 'macx'
musicPlugin = 'fluidsynth'
cdPlugin = 'dummy'
else
musicPlugin = 'fmod'
cdPlugin = 'fmod'
end
record fmod
fmod.speakerMode = '' # defaults to stereo
end
record d.audio.fmod
d.audio.fmod.speakerMode = '' # defaults to stereo
end
56 changes: 30 additions & 26 deletions doomsday/sdk/libcore/net.dengine.stdlib.pack/modules/Config.de
Expand Up @@ -43,31 +43,34 @@ def setDefaults(d = None)
d.importPath = ['']

# Log parameters.
record d.log

# Log message levels.
d.log.file = '/home/doomsday.out'
d.log.bufferSize = 1000
record d.log()
# Log message levels.
file = '/home/doomsday.out'
bufferSize = 1000
end

# Default log filtering.
def initFilter(flt, level, dev)
flt.minLevel = level
flt.allowDev = dev
end
import Log
record d.log.filter
initFilter(record d.log.filter.generic, Log.MESSAGE, False)
initFilter(record d.log.filter.resource, Log.MESSAGE, False)
initFilter(record d.log.filter.map, Log.MESSAGE, False)
initFilter(record d.log.filter.script, Log.MESSAGE, False)
initFilter(record d.log.filter.gl, Log.MESSAGE, False)
initFilter(record d.log.filter.audio, Log.MESSAGE, False)
initFilter(record d.log.filter.input, Log.MESSAGE, False)
initFilter(record d.log.filter.network, Log.MESSAGE, False)
record d.log.filter()
initFilter(record generic, Log.MESSAGE, False)
initFilter(record resource, Log.MESSAGE, False)
initFilter(record map, Log.MESSAGE, False)
initFilter(record script, Log.MESSAGE, False)
initFilter(record gl, Log.MESSAGE, False)
initFilter(record audio, Log.MESSAGE, False)
initFilter(record input, Log.MESSAGE, False)
initFilter(record network, Log.MESSAGE, False)
end

# File system settings.
record d.fs
d.fs.selectedPackages = {}
record d.fs()
# Optional package contents that are currently selected.
selectedPackages = {}
end

# Network settings.
d.apiUrl = 'http://api.dengine.net/1/'
Expand All @@ -80,17 +83,18 @@ def setDefaults(d = None)

# Game mode related information (one for each game plugin):
# TODO: plugins should have their own Config scripts (when libcore loads them)
record d.plugin
record d.plugin.doom
record d.plugin.heretic
record d.plugin.hexen
record d.plugin.doom64
record d.plugin()
record doom
record heretic
record hexen
record doom64

# Single-shot load hooks.
d.plugin.doom.onNextLoad = []
d.plugin.heretic.onNextLoad = []
d.plugin.hexen.onNextLoad = []
d.plugin.doom64.onNextLoad = []
# Single-shot load hooks.
doom.onNextLoad = []
heretic.onNextLoad = []
hexen.onNextLoad = []
doom64.onNextLoad = []
end
end

def updateWithDefaults()
Expand Down
44 changes: 23 additions & 21 deletions doomsday/sdk/libgui/net.dengine.stdlib.gui.pack/modules/gui.de
Expand Up @@ -30,43 +30,45 @@ def setDefaults(d)
d.video = 'opengl'

# Generic user interface settings.
record d.ui
d.ui.scaleFactor = 1.0 # Overall factor (both rules and fonts).
d.ui.showAnnotations = True
record d.ui()
scaleFactor = 1.0 # Overall factor (both rules and fonts).
showAnnotations = True
end

# Window manager defaults.
record d.window
d.window.fsaa = False # Remove this (should be window-specific).
record d.window()
fsaa = False # Remove this (should be window-specific).

# Configure the main window.
record d.window.main
d.window.main.showFps = False
d.window.main.center = True
d.window.main.fsaa = False
d.window.main.vsync = True
# Configure the main window.
record main()
showFps = False
center = True
fsaa = False
vsync = True
end
end

# The default window parameters depend on the original display mode.
mode = DisplayMode.originalMode()

# By default the fullscreen resolution is the desktop resolution.
d.window.main.fullSize = [mode['width'], mode['height']]
mainWin = d.window.main
mainWin.fullSize = [mode['width'], mode['height']]

# In windowed mode mode, leave some space on the sides so that
# the first switch to windowed mode does not place the window in an
# inconvenient location. The reduction is done proportionally.
offx = mode['width'] * 0.15
offy = mode['height'] * 0.15
d.window.main.rect = [offx, offy,
mode['width'] - 2*offx,
mode['height'] - 2*offy]
d.window.main.colorDepth = mode['depth']
mainWin.rect = [offx, offy, mode['width'] - 2*offx, mode['height'] - 2*offy]
mainWin.colorDepth = mode['depth']

if Version.OS == 'windows' or Version.OS == 'macx'
d.window.main.fullscreen = True
d.window.main.maximize = False
mainWin.fullscreen = True
mainWin.maximize = False
else
d.window.main.fullscreen = False
d.window.main.maximize = True
mainWin.fullscreen = False
mainWin.maximize = True
end

catch NotFoundError
Expand Down

0 comments on commit 156b899

Please sign in to comment.