Lunatic: v7 engine support, event updates

git-svn-id: https://svn.eduke32.com/eduke32@2668 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-05-18 12:45:52 +00:00
parent 2963e2874d
commit 165c569cbe
4 changed files with 45 additions and 18 deletions

View file

@ -54,6 +54,12 @@ const int32_t engine_main_arrays_are_static = 0; // for Lunatic
const int32_t engine_main_arrays_are_static = 1;
#endif
#if MAXSECTORS==MAXSECTORSV8
const int32_t engine_v8 = 1;
#else
const int32_t engine_v8 = 0;
#endif
float debug1, debug2;
static void drawpixel_safe(void *s, char a)

View file

@ -64,19 +64,6 @@ typedef struct {
int32_t x, y, z;
} vec3_t;
#pragma pack(pop)
enum
{
MAXSECTORS = 4096,
MAXWALLS = 16384,
MAXSPRITES = 16384,
MAXSTATUS = 1024,
MAXBUNCHES = 256,
CEILING = 0,
FLOOR = 1,
};
]]
assert(ffi.sizeof('sectortype')==40)
@ -85,7 +72,7 @@ assert(ffi.sizeof('spritetype')==44)
---- engine data and functions ----
ffi.cdef[[int32_t engine_main_arrays_are_static;]]
ffi.cdef[[int32_t engine_main_arrays_are_static, engine_v8;]]
-- NOTE TO SELF: This is not C, never EVER write
-- if (x)
@ -108,6 +95,38 @@ spriteext_t *spriteext;
]]
end
if (ffi.C.engine_v8 == 0) then
-- V7
ffi.cdef[[
enum
{
MAXSECTORS = 1024,
MAXWALLS = 8192,
MAXSPRITES = 4096,
}
]]
else
-- V8
ffi.cdef[[
enum
{
MAXSECTORS = 4096,
MAXWALLS = 16384,
MAXSPRITES = 16384,
}
]]
end
ffi.cdef[[
enum {
MAXSTATUS = 1024,
MAXBUNCHES = 256,
CEILING = 0,
FLOOR = 1,
};
]]
ffi.cdef[[
const int16_t numsectors, numwalls;
const int32_t numyaxbunches;
@ -126,7 +145,7 @@ int16_t yax_getbunch(int16_t i, int16_t cf);
---- game structs ----
ffi.cdef[[
#pragma pack(push,1)
// ACTOR_T, might still need to make some fields read-only
// XXX: might still need to make some fields read-only
typedef struct
{
const int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
@ -342,6 +361,9 @@ enum GameEvent_t {
EVENT_DISPLAYLOADINGSCREEN,
EVENT_ANIMATESPRITES,
EVENT_NEWGAME,
EVENT_SOUND,
EVENT_CHECKTOUCHDAMAGE,
EVENT_CHECKFLOORDAMAGE,
MAXEVENTS
};
]]

View file

@ -1,5 +1,6 @@
{
engine_main_arrays_are_static;
engine_v8;
sector;
wall;
@ -25,6 +26,5 @@ nextsectbunch;
actor;
ud;
luaJIT_BC_con_lang;
luaJIT_BC_lunacon;
luaJIT_BC_*;
};

View file

@ -95,7 +95,6 @@ local function cmd(...)
local pat = Pat(true)
local vartypes = {...}
local spat = ""
for i=1,#vartypes do
assert(vartypes[i] < 0)