Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 4569 → Rev 4570

/polymer/eduke32/source/lunatic/con_lang.lua
431,7 → 431,6
xpanning = SX".xpanning",
ypanning = SX".ypanning",
 
-- Read access differs from write, write not available:
alpha = { "_math.floor(spriteext[%s].alpha*255)", "spriteext[%s].alpha=(%%s)/255" },
 
isvalid = { "_con._isvalid(%s)" },
/polymer/eduke32/source/lunatic/defs.ilua
1684,7 → 1684,7
-- 200 is the max. number of locals at one level
for i=1,200 do
-- level:
-- 0 is getlocal() itself.
-- 0 is debug.getlocal() itself.
-- 1 is this function (getnumlocals).
-- 2 is the function calling getnumlocals()
-- 3 is the function calling that one.
2288,12 → 2288,14
 
-- XXX: System gamevars? Most of them ought to be saved with C data.
for modname, modvars in pairs(module_gamevars) do
local isCON = (modname==CON_MODULE_NAME)
 
sb:startmod(modname)
 
-- Handle global gamevars first.
for i=1,#modvars do
local varname = modvars[i]
local excludedVars = modname==CON_MODULE_NAME and varname=="_V" and
local excludedVars = isCON and varname=="_V" and
package_loaded[CON_MODULE_NAME]._V._IS_NORESET_GAMEVAR or nil
 
-- Serialize gamevar named 'varname' from module named 'modname'.
2303,7 → 2305,7
-- We couldn't serialize that gamevar.
slenptr[0] = -1
-- Signal which gamevar that was.
return (modname==CON_MODULE_NAME and "<CON>" or modname).."."..varname
return (isCON and "<CON>" or modname).."."..varname
end
end
 
2335,8 → 2337,8
local savecode = sb:getcode()
 
if (ffiC._DEBUG_LUNATIC ~= 0) then
-- Dump the code if Lunatic debugging is enabled and there is a
-- LUNATIC_SAVECODE_FN variable in the environment.
-- Dump the code if Lunatic debugging is enabled (-Lopts=diag) and
-- there is a LUNATIC_SAVECODE_FN variable in the environment.
local os = require("os")
local fn = os.getenv("LUNATIC_SAVECODE_FN")
 
2538,7 → 2540,7
 
local function protect_con_table(tab)
-- NOTE: Some of our code specifically excepts the name tables to be
-- indexable with nonexistent keys. See e.g. control.c: _A_SpawnGlass()
-- indexable with nonexistent keys. See e.g. control.lua: _A_SpawnGlass()
if (ffiC._LUNATIC_STRICT ~= 0) then
tab = setmetatable(tab, index_error_mt)
end
2588,3 → 2590,8
 
ffiC.g_elFirstTime = 0
end
 
if (g_restorefunc) then
-- Clear it so that it may be garbage-collected.
g_restorefunc = nil
end
/polymer/eduke32/source/lunatic/doc/lunatic.txt
121,8 → 121,8
permanent message to appear on the screen, containing the source file name and
line number.
 
*`print(...)`*::
The messages are printed to the OSD and the log. Color codes available in
*`print(str)`*::
Prints a single message to the OSD and the log. Color codes available in
EDuke32 (e.g. `^10` for dark red) are interpreted. Overriding `tostring` has no
effect on Lunatic's `print` as it uses the initial, built-in `tostring`
function instead of looking it up in the global environment.
/polymer/eduke32/source/lunatic/lunacon.lua
1476,7 → 1476,6
return
end
 
-- TODO: handle user bits like NORESET or NODEFAULT
if (bit.band(flags, bit.bnot(GVFLAG.USER_MASK)) ~= 0) then
-- TODO: a couple of the presumably safe ones
errprintf("gamevar flags other than 1, 2, 1024 or 131072: NYI or forbidden")
1492,6 → 1491,7
end
 
local ogv = g_gamevar[identifier]
-- handle NORESET or NODEFAULT
local isSessionVar = (bit.band(flags, GVFLAG.NODEFAULT) ~= 0)
local storeWithSavegames = (bit.band(flags, GVFLAG.NORESET) == 0)
 
1573,9 → 1573,15
end
 
-- Declare new session gamevar.
g_gamevar[identifier] = { name=format("_gv._sessionVar[%d]", g_numSessionVars),
flags=flags, loc=getLocation(), used=0 }
local gv = { name=format("_gv._sessionVar[%d]", g_numSessionVars),
flags=flags, loc=getLocation(), used=0 }
g_numSessionVars = g_numSessionVars+1
 
g_gamevar[identifier] = gv;
-- Initialize it (i.e. set to the declared initial value) on first run,
-- but not from savegames.
addcodef("if _S then %s=%d end", gv.name, initval)
 
return
end