mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Lunatic: sync with preceding change, fix r3419.
git-svn-id: https://svn.eduke32.com/eduke32@3427 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
dec5445880
commit
f10063eec3
4 changed files with 16 additions and 14 deletions
|
@ -183,6 +183,7 @@ local SFLAG = {
|
|||
-- SFLAG_BADGUYSTAYPUT = 0x00008000,
|
||||
-- SFLAG_CACHE = 0x00010000,
|
||||
-- SFLAG_ROTFIXED = 0x00020000,
|
||||
-- SPRITE_HARDCODED_BADGUY= 0x00040000,
|
||||
}
|
||||
|
||||
STAT = {
|
||||
|
|
|
@ -235,6 +235,9 @@ function _spawnmany(ow, tilenum, n)
|
|||
end
|
||||
|
||||
function isenemytile(tilenum)
|
||||
if (bit.band(ffiC.g_tile[tilenum].flags, 0x00040000)~=0) then
|
||||
return true
|
||||
end
|
||||
return (bit.band(ffiC.g_tile[tilenum].flags, ffiC.SFLAG_BADGUY)~=0)
|
||||
end
|
||||
|
||||
|
|
|
@ -569,13 +569,6 @@ if (not good) then
|
|||
error("Some sizes don't match between C and LuaJIT/FFI.")
|
||||
end
|
||||
|
||||
-- Add game-side metamethods to "spritetype" and register it with "metatype"
|
||||
defs_c.spritetype_mt.__index.isenemy = function(s)
|
||||
-- CODEDUP control.lua: isenemytile
|
||||
return (bit.band(ffiC.g_tile[s.picnum].flags, ffiC.SFLAG_BADGUY)~=0)
|
||||
end
|
||||
ffi.metatype("spritetype", defs_c.spritetype_mt)
|
||||
|
||||
-- "player" global, needed by the "control" module
|
||||
local tmpmt = {
|
||||
__index = function(tab, key)
|
||||
|
@ -598,6 +591,12 @@ actor = defs_c.creategtab(ffiC.actor, ffiC.MAXSPRITES, "actor[]")
|
|||
local con = require("control")
|
||||
local MV, AC, AI = con.MV, con.AC, con.AI
|
||||
|
||||
-- Add game-side metamethods to "spritetype" and register it with "metatype"
|
||||
defs_c.spritetype_mt.__index.isenemy = function(s)
|
||||
return con.isenemytile(s.picnum)
|
||||
end
|
||||
ffi.metatype("spritetype", defs_c.spritetype_mt)
|
||||
|
||||
-- All-zero action and move
|
||||
local nullac, nullmv = ffi.new("const struct action"), ffi.new("const struct move")
|
||||
|
||||
|
|
|
@ -780,17 +780,15 @@ end
|
|||
--- GAMEVARS / GAMEARRAYS
|
||||
|
||||
function Cmd.gamevar(identifier, initval, flags)
|
||||
local failure_code = "local _INVALIDGV"
|
||||
|
||||
if (bit.band(flags, bit.bnot(GVFLAG.PERX_MASK)) ~= 0) then
|
||||
-- TODO: a couple of the presumably safe ones
|
||||
errprintf("gamevar flags other than PERPLAYER or PERACTOR: NYI or forbidden")
|
||||
return failure_code
|
||||
return
|
||||
end
|
||||
|
||||
if (flags==GVFLAG.PERPLAYER+GVFLAG.PERACTOR) then
|
||||
errprintf("invalid gamevar flags: must be either PERPLAYER or PERACTOR, not both")
|
||||
return failure_code
|
||||
return
|
||||
end
|
||||
|
||||
local ogv = g_gamevar[identifier]
|
||||
|
@ -802,7 +800,7 @@ function Cmd.gamevar(identifier, initval, flags)
|
|||
-- Attempt to override a system gamevar. See if it's read-only...
|
||||
if (bit.band(oflags, GVFLAG.READONLY) ~= 0) then
|
||||
errprintf("attempt to override read-only system gamevar `%s'", identifier)
|
||||
return failure_code
|
||||
return
|
||||
end
|
||||
|
||||
local flagsnosys = bit.band(oflags, bit.bnot(GVFLAG.SYSTEM))
|
||||
|
@ -821,13 +819,14 @@ function Cmd.gamevar(identifier, initval, flags)
|
|||
else
|
||||
addcodef("%s=%d", ogv.name, initval)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
errprintf("duplicate gamevar definition `%s' has different flags", identifier)
|
||||
return failure_code
|
||||
return
|
||||
else
|
||||
warnprintf("duplicate gamevar definition `%s' ignored", identifier)
|
||||
return ""
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue