mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 09:20:51 +00:00
Lunatic: fix _digitalnumber, remove player._INPUT_BITS, add sprite.all().
git-svn-id: https://svn.eduke32.com/eduke32@4047 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3b69417792
commit
1b7c622f31
5 changed files with 32 additions and 9 deletions
|
@ -903,7 +903,7 @@ end
|
||||||
|
|
||||||
function _digitalnumber(tilenum, x, y, num, shade, pal,
|
function _digitalnumber(tilenum, x, y, num, shade, pal,
|
||||||
orientation, cx1, cy1, cx2, cy2, zoom)
|
orientation, cx1, cy1, cx2, cy2, zoom)
|
||||||
if (not (tilenum >= 0 and tilenum >= ffiC.MAXTILES-9)) then
|
if (not (tilenum >= 0 and tilenum < ffiC.MAXTILES-9)) then
|
||||||
error("invalid base tile number "..tilenum, 2)
|
error("invalid base tile number "..tilenum, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -749,6 +749,7 @@ end
|
||||||
|
|
||||||
local player_static_members = {}
|
local player_static_members = {}
|
||||||
|
|
||||||
|
--[[
|
||||||
player_static_members._INPUT_BITS = defs_c.conststruct
|
player_static_members._INPUT_BITS = defs_c.conststruct
|
||||||
{
|
{
|
||||||
JUMP = 1,
|
JUMP = 1,
|
||||||
|
@ -791,6 +792,7 @@ player_static_members._INPUT_EXT_BITS = defs_c.conststruct
|
||||||
TURN_LEFT = 16,
|
TURN_LEFT = 16,
|
||||||
TURN_RIGHT = 32,
|
TURN_RIGHT = 32,
|
||||||
}
|
}
|
||||||
|
--]]
|
||||||
|
|
||||||
local band = bit.band
|
local band = bit.band
|
||||||
local lsh = bit.lshift
|
local lsh = bit.lshift
|
||||||
|
@ -2424,17 +2426,17 @@ end
|
||||||
|
|
||||||
--printkv('_G AFTER DECLS', _G)
|
--printkv('_G AFTER DECLS', _G)
|
||||||
|
|
||||||
|
local index_error_mt = {
|
||||||
|
__index = function(_, key)
|
||||||
|
error("attempt to read undeclared variable '"..key.."'", 2)
|
||||||
|
end,
|
||||||
|
|
||||||
|
__metatable = true,
|
||||||
|
}
|
||||||
|
|
||||||
-- PiL 14.2 continued
|
-- PiL 14.2 continued
|
||||||
-- We need this at the end because we were previously doing just that!
|
-- We need this at the end because we were previously doing just that!
|
||||||
setmetatable(
|
setmetatable(G_, index_error_mt)
|
||||||
G_, {
|
|
||||||
__index = function (_, n)
|
|
||||||
error("attempt to read undeclared variable '"..n.."'", 2)
|
|
||||||
end,
|
|
||||||
|
|
||||||
__metatable = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
local global_mt = {
|
local global_mt = {
|
||||||
__index = G_,
|
__index = G_,
|
||||||
|
@ -2479,6 +2481,9 @@ if (concode) then
|
||||||
table.remove(modname_stack)
|
table.remove(modname_stack)
|
||||||
|
|
||||||
local function protect_con_table(tab)
|
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()
|
||||||
|
-- tab = setmetatable(tab, index_error_mt)
|
||||||
return setmtonce({}, { __index=tab, __newindex=basemod_newidx })
|
return setmtonce({}, { __index=tab, __newindex=basemod_newidx })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -897,6 +897,18 @@ local bitar = require("bitar")
|
||||||
-- machines. This sucks.
|
-- machines. This sucks.
|
||||||
static_members.sector.showbitmap = bitar.new(ffiC.MAXSECTORS-1, ffi.cast("int32_t *", ffiC.show2dsector))
|
static_members.sector.showbitmap = bitar.new(ffiC.MAXSECTORS-1, ffi.cast("int32_t *", ffiC.show2dsector))
|
||||||
|
|
||||||
|
local function iter_allsprites(_, curi)
|
||||||
|
for i=curi+1,ffiC.MAXSPRITES-1 do
|
||||||
|
if (ffiC.sprite[i].statnum ~= ffiC.MAXSTATUS) then
|
||||||
|
return i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function static_members.sprite.all()
|
||||||
|
return iter_allsprites, nil, -1
|
||||||
|
end
|
||||||
|
|
||||||
local sms = static_members.sprite
|
local sms = static_members.sprite
|
||||||
sms._headspritesect = creategtab(ffiC.headspritesect, ffiC.MAXSECTORS, 'headspritesect[]')
|
sms._headspritesect = creategtab(ffiC.headspritesect, ffiC.MAXSECTORS, 'headspritesect[]')
|
||||||
-- NOTE: don't allow freelist access
|
-- NOTE: don't allow freelist access
|
||||||
|
|
|
@ -812,6 +812,10 @@ _`index_of_spr`_ is the sprite index corresponding to `spr`. This method is
|
||||||
provided for convenience, but may be slower than the static function
|
provided for convenience, but may be slower than the static function
|
||||||
`updatesect`.
|
`updatesect`.
|
||||||
|
|
||||||
|
===== `sprite` iterators
|
||||||
|
|
||||||
|
+*for* i *in* sprite.all()+::
|
||||||
|
Iterates over all sprites currently in the game world.
|
||||||
|
|
||||||
===== `sprite` static functions
|
===== `sprite` static functions
|
||||||
|
|
||||||
|
|
|
@ -226,6 +226,7 @@ gameevent{gv.EVENT_JUMP,
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--[[
|
||||||
gameevent
|
gameevent
|
||||||
{
|
{
|
||||||
"PROCESSINPUT",
|
"PROCESSINPUT",
|
||||||
|
@ -244,6 +245,7 @@ gameevent
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
--]]
|
||||||
|
|
||||||
local D = require("CON.DEFS")
|
local D = require("CON.DEFS")
|
||||||
local WEAPON = gv.WEAPON
|
local WEAPON = gv.WEAPON
|
||||||
|
|
Loading…
Reference in a new issue