Lunatic: fix setup under Mapster32, remove a few obsolete lines in defs_common.lua.

git-svn-id: https://svn.eduke32.com/eduke32@4234 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-12-31 11:51:55 +00:00
parent 8a4c5259a8
commit 2174b17901
2 changed files with 22 additions and 21 deletions

View file

@ -4,8 +4,6 @@ local ffiC = require("ffi").C
local type = type local type = type
local error = error local error = error
local con_lang = require("con_lang")
local bcheck = {} local bcheck = {}
--== ENGINE ==-- --== ENGINE ==--
@ -38,7 +36,27 @@ function bcheck.tile_idx(tilenum)
end end
--== HELPERS ==--
function bcheck.number(val, errlev)
if (type(val)~="number" or val~=val) then
error("invalid argument: must be a non-NaN number", errlev or 3)
end
end
function bcheck.type(val, typestr, errlev)
if (type(val)~=typestr) then
error("invalid argument: must be a "..typestr, errlev or 3)
end
end
--== GAME ==-- --== GAME ==--
if (ffiC.LUNATIC_CLIENT == ffiC.LUNATIC_CLIENT_MAPSTER32) then
return bcheck
end
local con_lang = require("con_lang")
function bcheck.player_idx(snum) function bcheck.player_idx(snum)
if (not (snum >= 0 and snum < ffiC.playerswhenstarted)) then if (not (snum >= 0 and snum < ffiC.playerswhenstarted)) then
@ -99,16 +117,4 @@ function bcheck.top_level(funcname)
end end
end end
function bcheck.number(val, errlev)
if (type(val)~="number" or val~=val) then
error("invalid argument: must be a non-NaN number", errlev or 3)
end
end
function bcheck.type(val, typestr, errlev)
if (type(val)~=typestr) then
error("invalid argument: must be a "..typestr, errlev or 3)
end
end
return bcheck return bcheck

View file

@ -290,13 +290,8 @@ ffi.typeof(maybe_strip_const(SPRITE_STRUCT)))
if (not _LUNATIC_AUX) then if (not _LUNATIC_AUX) then
-- Define the "palette_t" type, which for us has .{r,g,b} fields and a -- Define the "palette_t" type, which for us has .{r,g,b} fields and a
-- bound-checking array of length 3 overlaid. -- bound-checking array of length 3 overlaid.
local rgbarray_t = require("bcarray").new("uint8_t", 3, "RGB array", "palette_t", require("bcarray").new("uint8_t", 3, "RGB array", "palette_t",
{ "r", "g", "b", "f" }) { "r", "g", "b", "f" })
ffi.cdef("typedef union { \
struct { uint8_t r, g, b, f; }; \
$ col; \
} palette_t", rgbarray_t)
assert(ffi.alignof("palette_t")==1) assert(ffi.alignof("palette_t")==1)
end end