From 165c569cbe2f3640e75ab67e776c664fe28e52a6 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 18 May 2012 12:45:52 +0000 Subject: [PATCH] Lunatic: v7 engine support, event updates git-svn-id: https://svn.eduke32.com/eduke32@2668 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 6 +++ polymer/eduke32/source/lunatic/defs.ilua | 52 +++++++++++++++------- polymer/eduke32/source/lunatic/dynsymlist | 4 +- polymer/eduke32/source/lunatic/lunacon.lua | 1 - 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index e9eecbfab..278ce4bc7 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -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) diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index 1fc42dd21..1ed7e0b84 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -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 }; ]] diff --git a/polymer/eduke32/source/lunatic/dynsymlist b/polymer/eduke32/source/lunatic/dynsymlist index 2f266c442..3a69ee326 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist +++ b/polymer/eduke32/source/lunatic/dynsymlist @@ -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_*; }; diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index b7652a876..0dab24242 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -95,7 +95,6 @@ local function cmd(...) local pat = Pat(true) local vartypes = {...} - local spat = "" for i=1,#vartypes do assert(vartypes[i] < 0)