mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Lunatic translator: warn if setting reserved bits in some system gamevar redef.
git-svn-id: https://svn.eduke32.com/eduke32@3563 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c02199be48
commit
9285a9054b
1 changed files with 13 additions and 1 deletions
|
@ -271,11 +271,18 @@ local function new_initial_gvartab()
|
||||||
LEVEL = RO "_gv.currentLevel()",
|
LEVEL = RO "_gv.currentLevel()",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Reserved bits
|
||||||
|
gamevar.LOGO_FLAGS.rbits = bit.bnot(2047)
|
||||||
|
|
||||||
for w=0,MAX_WEAPONS-1 do
|
for w=0,MAX_WEAPONS-1 do
|
||||||
for i=1,#wmembers do
|
for i=1,#wmembers do
|
||||||
local member = wmembers[i]:gsub(".* ","") -- strip e.g. "int32_t "
|
local member = wmembers[i]:gsub(".* ","") -- strip e.g. "int32_t "
|
||||||
local name = format("WEAPON%d_%s", w, member:upper())
|
local name = format("WEAPON%d_%s", w, member:upper())
|
||||||
gamevar[name] = PRW(format(PLSX".weapon[%d].%s", w, member))
|
gamevar[name] = PRW(format(PLSX".weapon[%d].%s", w, member))
|
||||||
|
|
||||||
|
if (member=="flags") then
|
||||||
|
gamevar[name].rbits = bit.bnot(0x1ffff)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1050,10 +1057,15 @@ function Cmd.gamevar(identifier, initval, flags)
|
||||||
"flags (%d)", identifier, flagsnosys)
|
"flags (%d)", identifier, flagsnosys)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (ogv.rbits and bit.band(ogv.rbits, initval)~=0) then
|
||||||
|
warnprintf("set one or more reserved bits (0x%s) in overriding `%s'",
|
||||||
|
bit.tohex(bit.band(ogv.rbits, initval)), identifier)
|
||||||
|
end
|
||||||
|
|
||||||
-- Emit code to set the variable at Lua parse time.
|
-- Emit code to set the variable at Lua parse time.
|
||||||
if (bit.band(oflags, GVFLAG.PERPLAYER) ~= 0) then
|
if (bit.band(oflags, GVFLAG.PERPLAYER) ~= 0) then
|
||||||
-- Replace player index by 0.
|
-- Replace player index by 0.
|
||||||
-- TODO: init for all players.
|
-- TODO_MP: init for all players.
|
||||||
local pvar, numrepls = ogv.name:gsub("_pli", "0")
|
local pvar, numrepls = ogv.name:gsub("_pli", "0")
|
||||||
assert(numrepls>=1)
|
assert(numrepls>=1)
|
||||||
addcodef("%s=%d", pvar, initval)
|
addcodef("%s=%d", pvar, initval)
|
||||||
|
|
Loading…
Reference in a new issue