[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-cvs] enigma/data startup.lua,1.18,1.19
From: |
Daniel Heck <address@hidden> |
Subject: |
[Enigma-cvs] enigma/data startup.lua,1.18,1.19 |
Date: |
Sun, 16 Nov 2003 18:03:34 +0000 |
Update of /cvsroot/enigma/enigma/data
In directory subversions:/tmp/cvs-serv15384/data
Modified Files:
startup.lua
Log Message:
- Added default definition of options
- Changed options.LevelStat[2] to work with new options code
- Added LoadOptions(), SaveOptions()
Index: startup.lua
===================================================================
RCS file: /cvsroot/enigma/enigma/data/startup.lua,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** startup.lua 24 Oct 2003 14:53:55 -0000 1.18
--- startup.lua 16 Nov 2003 18:03:32 -0000 1.19
***************
*** 23,30 ****
end
! ------------------------------
! -- Extensions to C packages --
! ------------------------------
function options.LevelStat2 (key, stat)
if stat[1] < 0 then stat[1] = -1 end
--- 23,62 ----
end
! ---------------------
! -- Option handling --
! ---------------------
!
! -- Set default values for options
! options = {
! MouseSpeed = 5.0,
! FullScreen = 1,
! Nozoom = 1,
! InGameMusic = 0,
! Difficulty = 2,
! VideoMode = 0,
! LevelMenuPosition = 0.0,
! WizardMode = 0,
!
! SoundSet = 0,
! -- 0 = 'enigma' for enigma, appropriate oxyd sound sets for oxyd
versions
! -- 1 = 'enigma'
! -- 2.. = OxydVersion-2
+ SkipSolvedLevels = 0,
+ TimeHunting = 0,
+
+ SoundVolume = 1.0,
+ MusicVolume = 1.0,
+ StereoSeparation = 10.0,
+
+ MenuMusicFile = "sound/menu.s3m",
+ LevelMusicFile = "sound/Emilie.xm",
+ }
+
+ -- Table of level stats is initially empty
+ stats = {}
+
+
+ -- For backwards compatibility only --
function options.LevelStat2 (key, stat)
if stat[1] < 0 then stat[1] = -1 end
***************
*** 32,42 ****
if stat[3] < 0 then stat[3] = 0 end
! local status = LevelStatus:new(stat[1], stat[2], stat[3], stat[4] or 0)
! gsub(key, "([^#]*)#(.+)", function (pack,lev)
! options.SetLevelStatus(pack,lev, %status)
! end)
! status:delete()
end
function options.LevelStat (key, stat)
-- old level status (containing modtime of .lua file)
--- 64,71 ----
if stat[3] < 0 then stat[3] = 0 end
! gsub(key, "([^#]*)#(.+)", function (pack,lev) stats[lev] = %stat end)
end
+ -- For backwards compatibility only --
function options.LevelStat (key, stat)
-- old level status (containing modtime of .lua file)
***************
*** 50,60 ****
stat[4] = stat[4] or 0
! if stat[4] > 0 then stat[4] = 1 end -- level status has 'solved_at' time
-> default to revision 1
! local status = LevelStatus:new(stat[1], stat[2], stat[3], stat[4])
! gsub(key, "([^#]*)#(.+)", function (pack,lev)
! options.SetLevelStatus(pack,lev, %status)
! end)
! status:delete()
end
--- 79,115 ----
stat[4] = stat[4] or 0
! if stat[4] > 0 then
! stat[4] = 1
! end -- level status has 'solved_at' time -> default to revision 1
! gsub(key, "([^#]*)#(.+)", function (pack,lev) stats[lev] = %stat end)
! end
!
! function LoadOptions (filename)
! dofile(filename)
! end
!
! function SaveOptions (filename)
! function writeoption (key, val)
! local t = type(val)
! if t == "number" then
! write(format("options[\"%s\"] = %f\n", key,val))
! elseif t == "string" then
! write(format("options[\"%s\"] = \"%s\"\n", key, val))
! end
! end
!
! function writestat (leveltag, val)
! write(format("stats[\"%s\"] = { %d, %d, %d, %d }\n",
! leveltag, val[1], val[2], val[3], val[4]))
! end
!
! f = writeto(filename)
! if not f then error("Could not open options file for writing") end
!
! foreach(options, writeoption) -- Write options --
! foreach(stats, writestat) -- Write level stats --
!
! writeto()
end
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Enigma-cvs] enigma/data startup.lua,1.18,1.19,
Daniel Heck <address@hidden> <=