2012-10-07 15:25:52 +00:00
|
|
|
-- INTERNAL
|
|
|
|
-- definitions of BUILD and game types for the Lunatic Interpreter
|
|
|
|
|
|
|
|
local ffi = require("ffi")
|
|
|
|
local ffiC = ffi.C
|
|
|
|
|
|
|
|
--== First, load the definitions common to the game's and editor's Lua interface.
|
|
|
|
decl = ffi.cdef
|
|
|
|
local defs_c = require("defs_common")
|
|
|
|
|
|
|
|
-- structs
|
|
|
|
sector = defs_c.sector;
|
|
|
|
wall = defs_c.wall;
|
|
|
|
sprite = defs_c.sprite
|
|
|
|
spriteext = defs_c.spriteext
|
|
|
|
|
|
|
|
headspritesect = defs_c.headspritesect
|
|
|
|
headspritestat = defs_c.headspritestat
|
|
|
|
nextspritesect = defs_c.nextspritesect
|
|
|
|
nextspritestat = defs_c.nextspritestat
|
|
|
|
prevspritesect = defs_c.prevspritesect
|
|
|
|
prevspritestat = defs_c.prevspritestat
|
|
|
|
|
|
|
|
-- functions
|
|
|
|
spritesofsect = defs_c.spritesofsect
|
|
|
|
spritesofstat = defs_c.spritesofstat
|
|
|
|
sectorsofbunch = defs_c.sectorsofbunch
|
|
|
|
|
|
|
|
getbunch = defs_c.getbunch
|
|
|
|
|
|
|
|
hitscan = defs_c.hitscan
|
2012-10-07 15:26:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
--== Mapster32-specific initialization
|
|
|
|
|
|
|
|
ffi.cdef "char *listsearchpath(int32_t initp);"
|
|
|
|
|
|
|
|
-- Add the search path directories to the Lua load path.
|
|
|
|
local initp = 1
|
|
|
|
while (true) do
|
|
|
|
local sp_c = ffiC.listsearchpath(initp)
|
|
|
|
|
|
|
|
if (sp_c == nil) then
|
|
|
|
break
|
|
|
|
end
|
|
|
|
|
|
|
|
local sp = ffi.string(sp_c)
|
|
|
|
assert(sp:sub(-1)=='/')
|
|
|
|
package.path = sp..'?.lua;'..package.path
|
|
|
|
|
|
|
|
initp = 0
|
|
|
|
end
|
|
|
|
|
|
|
|
--print('Lua load path: '..package.path)
|