Lunatic: keep status number symbols in actor.STAT instead of gv.STAT_*.

git-svn-id: https://svn.eduke32.com/eduke32@3860 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-06-07 14:26:30 +00:00
parent a57ce255e7
commit 5e5f80d61b
5 changed files with 24 additions and 12 deletions

View file

@ -318,17 +318,15 @@ local function shallow_copy(tab)
end end
-- KEEPINSYNC with gamedef.c:C_AddDefaultDefinitions() and the respective -- KEEPINSYNC with gamedef.c:C_AddDefaultDefinitions() and the respective
-- defines. These are exported to the ffi.C namespace and as literal defines -- defines. These are exported to the ffi.C namespace (except STAT) and as
-- in lunacon.lua. -- literal defines in lunacon.lua.
labels = labels =
{ {
STR, STR,
PROJ, PROJ,
EVENT, EVENT,
-- setmetatable( shallow_copy(SFLAG),
shallow_copy(SFLAG), setmetatable(STAT, { __metatable="noffiC" }),
-- { __metatable="noffiC" }),
STAT,
GAMEFUNC, GAMEFUNC,
} }

View file

@ -448,8 +448,10 @@ function _findplayer(pli, spritenum)
return 0, A_FP_ManhattanDist(player[pli], sprite[spritenum]) return 0, A_FP_ManhattanDist(player[pli], sprite[spritenum])
end end
local STAT = actor.STAT
local FN_STATNUMS = { local FN_STATNUMS = {
[false] = { con_lang.STAT.STAT_ACTOR }, [false] = { STAT.ACTOR },
[true] = {}, [true] = {},
} }
@ -1303,7 +1305,7 @@ function _cansee(aci, ps)
actor[aci].lastvy = s.y actor[aci].lastvy = s.y
end end
if (can and (spr.statnum==ffiC.STAT_ACTOR or spr.statnum==ffiC.STAT_STANDABLE)) then if (can and (spr.statnum==STAT.ACTOR or spr.statnum==STAT.STANDABLE)) then
actor[aci].timetosleep = SLEEPTIME actor[aci].timetosleep = SLEEPTIME
end end
@ -1546,7 +1548,7 @@ function _flash(spr, ps)
end end
function _G_OperateRespawns(tag) function _G_OperateRespawns(tag)
for i in spritesofstat(ffiC.STAT_FX) do for i in spritesofstat(STAT.FX) do
local spr = sprite[i] local spr = sprite[i]
if (spr.lotag==tag and spr.picnum==D.RESPAWN) then if (spr.lotag==tag and spr.picnum==D.RESPAWN) then
@ -1564,7 +1566,7 @@ function _G_OperateRespawns(tag)
end end
function _G_OperateMasterSwitches(tag) function _G_OperateMasterSwitches(tag)
for i in spritesofstat(ffiC.STAT_STANDABLE) do for i in spritesofstat(STAT.STANDABLE) do
local spr = sprite[i] local spr = sprite[i]
if (spr.picnum==D.MASTERSWITCH and spr.lotag==tag and spr.yvel==0) then if (spr.picnum==D.MASTERSWITCH and spr.lotag==tag and spr.yvel==0) then
spr:_set_yvel(1) spr:_set_yvel(1)

View file

@ -799,6 +799,18 @@ do
our_SFLAG.USER_MASK = bit.bor(USER_MASK, our_SFLAG.enemystayput, our_SFLAG.rotfixed) our_SFLAG.USER_MASK = bit.bor(USER_MASK, our_SFLAG.enemystayput, our_SFLAG.rotfixed)
actor_static_members.FLAGS = defs_c.conststruct(our_SFLAG) actor_static_members.FLAGS = defs_c.conststruct(our_SFLAG)
-- Sprite status numbers. Kept in 'actor', because it's more of a game-side
-- concept (event though status lists are implemented in the engine), and
-- to prevent confusion with sprite.CSTAT.
local our_STAT = {}
for name, statnum in pairs(con_lang.STAT) do
-- Strip 'STAT_'.
our_STAT[name:sub(6)] = statnum
end
actor_static_members.STAT = defs_c.conststruct(our_STAT)
end end
-- Delete sprite with index <i>. -- Delete sprite with index <i>.

View file

@ -321,7 +321,7 @@ gameevent(gv.EVENT_ENTERLEVEL,
-- Make the DUKECAR in E1L1 into a zombie actor (temporarily) -- Make the DUKECAR in E1L1 into a zombie actor (temporarily)
if (sprite[24].picnum==2491) then if (sprite[24].picnum==2491) then
sprite.changestat(24, gv.STAT_ZOMBIEACTOR) sprite.changestat(24, actor.STAT.ZOMBIEACTOR)
end end
checkfail("gameevent('GAME', function() print('qwe') end)", checkfail("gameevent('GAME', function() print('qwe') end)",

View file

@ -54,7 +54,7 @@ function(aci, pli)
local nearestdst = Inf local nearestdst = Inf
local nearesti = -1 local nearesti = -1
for i in spritesofstat(gv.STAT_FX) do for i in spritesofstat(actor.STAT.FX) do
local dst = (sprite[i]-ps.pos):len2() local dst = (sprite[i]-ps.pos):len2()
if (nearesti == -1 or (dst < nearestdst and dst < sprite[i].hitag)) then if (nearesti == -1 or (dst < nearestdst and dst < sprite[i].hitag)) then
printf("MSFX %d dist %d", i, dst) printf("MSFX %d dist %d", i, dst)