mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Lunatic: error on invalid static data read like 'sprite.picnum'.
git-svn-id: https://svn.eduke32.com/eduke32@4209 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
02e0929ca7
commit
a4510e35a1
4 changed files with 28 additions and 8 deletions
|
@ -755,7 +755,7 @@ end
|
|||
|
||||
--== "player" global, needed by the "control" module ==--
|
||||
|
||||
local player_static_members = {}
|
||||
local player_static_members = defs_c.static_members_tab()
|
||||
|
||||
--[[
|
||||
player_static_members._INPUT_BITS = defs_c.conststruct
|
||||
|
@ -837,7 +837,7 @@ end
|
|||
local player_holdskey = player_static_members.holdskey
|
||||
|
||||
-- Actor flags
|
||||
local actor_static_members = {}
|
||||
local actor_static_members = defs_c.static_members_tab()
|
||||
do
|
||||
local our_SFLAG = {}
|
||||
local ext_SFLAG = con_lang.labels[4] -- external actor flags only
|
||||
|
@ -923,7 +923,7 @@ function actor_static_members.delete(i)
|
|||
CF.A_DeleteSprite(i)
|
||||
end
|
||||
|
||||
local tile_static_members = {}
|
||||
local tile_static_members = defs_c.static_members_tab()
|
||||
do
|
||||
tile_static_members.sizx = defs_c.creategtab(ffiC.tilesizx, ffiC.MAXTILES, "tilesizx[]")
|
||||
tile_static_members.sizy = defs_c.creategtab(ffiC.tilesizy, ffiC.MAXTILES, "tilesizy[]")
|
||||
|
@ -2430,6 +2430,7 @@ if (ffiC._DEBUG_LUNATIC ~= 0) then
|
|||
local codestr = [[
|
||||
do
|
||||
local _bit,_math=require'bit',require'math'
|
||||
local _con=require'con'
|
||||
local _band,_gv=_bit.band,gv
|
||||
local tmp=]]..
|
||||
membaccode:gsub("%%s","0").." end"
|
||||
|
|
|
@ -878,9 +878,25 @@ function conststruct(tab)
|
|||
return ffi.new(table.concat(strtab))
|
||||
end
|
||||
|
||||
do
|
||||
local smt_mt = {
|
||||
__index = function()
|
||||
error("invalid access to static data", 2)
|
||||
end
|
||||
}
|
||||
|
||||
function static_members_tab()
|
||||
return setmtonce({}, smt_mt)
|
||||
end
|
||||
end
|
||||
|
||||
-- Static, non-instance members. Used to hold constants, for example
|
||||
-- sprite.CSTAT.TRANS1
|
||||
local static_members = { sector={}, wall={}, sprite={} }
|
||||
local static_members = {
|
||||
sector = static_members_tab(),
|
||||
wall = static_members_tab(),
|
||||
sprite = static_members_tab(),
|
||||
}
|
||||
|
||||
static_members.sector.STAT = conststruct
|
||||
{
|
||||
|
|
|
@ -1769,10 +1769,10 @@ The total number of frames in the animation.
|
|||
The number of consecutive tiles used to construct one frame of the animation,
|
||||
as viewed from different angles. Valid values are 1, 3, 5, 7 and 8. In
|
||||
addition, -5 and -7 are allowed, which behave like the corresponding positive
|
||||
++viewtype++s, but effectively mirror the actor on the vertical axis. This can
|
||||
be useful if tile data is available that has the opposite orientation of what
|
||||
EDuke32 uses. See the {wiki_action}[Action entry] in the EDuke32 wiki for how
|
||||
the views are constructed for different `viewtype` values.
|
||||
++viewtype++s, but effectively mirror the actor around the vertical axis. This
|
||||
can be useful if tile data is available that has the opposite orientation of
|
||||
what EDuke32 uses. See the {wiki_action}[Action entry] in the EDuke32 wiki for
|
||||
how the views are constructed for different `viewtype` values.
|
||||
|
||||
`[4] incval` (default: 1)::
|
||||
The value to add the actor's _current frame_ on each frame advance. May be -1,
|
||||
|
|
|
@ -141,6 +141,9 @@ gameevent
|
|||
|
||||
-- actor[].t_data[] is not accessible for now
|
||||
checkfail('local i = actor[0].t_data[15]', "has no member named 't_data'")
|
||||
|
||||
-- sprite.picnum may happen as a thinko/typo kind of error (spr.picnum was meant)
|
||||
checkfail("local pic = sprite.picnum", "invalid access to static data")
|
||||
end
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue