diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index 354b7de2b..758eb2e53 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -316,7 +316,9 @@ labels = STR, PROJ, EVENT, - setmetatable(shallow_copy(SFLAG), { __metatable="noffiC" }), +-- setmetatable( + shallow_copy(SFLAG), +-- { __metatable="noffiC" }), STAT, GAMEFUNC, } diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index cf77fba80..c796fb187 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -518,6 +518,7 @@ ffi.cdef[[ const int32_t screenpeek; hudweapon_t hudweap; int32_t g_logoFlags; +int32_t g_RETURN; // deprecated from Lua ]] -- INTERNAL VARIABLES/FUNCTIONS @@ -528,7 +529,6 @@ const char *s_buildRev; const char *g_sizes_of_what[]; int32_t g_sizes_of[]; int32_t g_elCallDepth; -int32_t g_elEventRETURN; const char **g_argv; char g_modDir[]; actor_t actor[MAXSPRITES]; @@ -1143,8 +1143,8 @@ local camera_mt = { gv_access.cam = setmtonce({}, camera_mt) gv_access._ud = ffiC.ud --- Support for some CON global system gamevars -gv_access._csv = ffi.new "struct { int32_t RETURN, LOTAG, HITAG, TEXTURE; }" +-- Support for some CON global system gamevars. RETURN handled separately. +gv_access._csv = ffi.new "struct { int32_t LOTAG, HITAG, TEXTURE; }" function gv_access._get_yxaspect() return ffiC.yxaspect @@ -1170,14 +1170,6 @@ function gv_access._set_guniqhudid(id) ffiC.guniqhudid = id end -function gv_access._RETURN(setval) - if (setval ~= nil) then - ffiC.g_elEventRETURN = setval - else - return ffiC.g_elEventRETURN - end -end - -- TODO: make return 1-based index function gv_access.currentEpisode() return ffiC.ud.volume_number diff --git a/polymer/eduke32/source/lunatic/dynsymlist b/polymer/eduke32/source/lunatic/dynsymlist index 4d09793e2..ca75a067e 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist +++ b/polymer/eduke32/source/lunatic/dynsymlist @@ -50,6 +50,7 @@ krand; ksqrt; inside; getangle; +Mulscale; cansee; hitscan; neartag; @@ -82,10 +83,12 @@ s_buildRev; g_sizes_of_what; g_sizes_of; g_elCallDepth; -g_elEventRETURN; +g_RETURN; g_argv; g_modDir; +MapInfo; + kopen4loadfrommod; g_scriptModules; @@ -130,6 +133,7 @@ g_scriptVersion; g_currentFrameRate; g_currentMenu; g_earthquakeTime; +CheatKeys; g_logoFlags; luaJIT_BC_lunacon; diff --git a/polymer/eduke32/source/lunatic/dynsymlist_m32 b/polymer/eduke32/source/lunatic/dynsymlist_m32 index 6dddae265..aef9d79e3 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist_m32 +++ b/polymer/eduke32/source/lunatic/dynsymlist_m32 @@ -50,6 +50,7 @@ krand; ksqrt; inside; getangle; +Mulscale; cansee; hitscan; neartag; diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index 1840e4c15..dc2376a61 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -207,7 +207,7 @@ local function new_initial_gvartab() -- NOTE: THISACTOR can mean different things in some contexts. THISACTOR = RO "_aci", - RETURN = RW(CSV".RETURN"), + RETURN = RW "_gv.g_RETURN", HITAG = RW(CSV".HITAG"), LOTAG = RW(CSV".LOTAG"), TEXTURE = RW(CSV".TEXTURE"), @@ -420,9 +420,7 @@ function on.event_end(eventidx, codetab) assert(type(codetab)=="table") addcodef("gameevent(%d, function (_aci, _pli, _dist)", eventidx) addcode(get_cache_sap_code()) - addcode(CSV".RETURN=gv._RETURN()") addcode(codetab) - addcodef("gv._RETURN(%s)", CSV".RETURN") addcode("end)") g_code.event[eventidx] = codetab @@ -1913,7 +1911,7 @@ local Cinner = { operatemasterswitches = cmd(R) / "_con._G_OperateMasterSwitches(%1)", checkactivatormotion = cmd(R) - / CSV".RETURN=_con._checkactivatormotion(%1)", + / "_gv.g_RETURN=_con._checkactivatormotion(%1)", time = cmd(R) -- no-op / "", inittimer = cmd(R) @@ -1984,17 +1982,17 @@ local Cinner = { spawn = cmd(D) / "_con.spawn(_aci,%1)", espawn = cmd(D) - / CSV".RETURN=_con.spawn(_aci,%1)", + / "_gv.g_RETURN=_con.spawn(_aci,%1)", espawnvar = cmd(R) - / CSV".RETURN=_con.spawn(_aci,%1)", + / "_gv.g_RETURN=_con.spawn(_aci,%1)", qspawn = cmd(D) / "_con.spawn(_aci,%1,true)", qspawnvar = cmd(R) / "_con.spawn(_aci,%1,true)", eqspawn = cmd(D) - / CSV".RETURN=_con.spawn(_aci,%1,true)", + / "_gv.g_RETURN=_con.spawn(_aci,%1,true)", eqspawnvar = cmd(R) - / CSV".RETURN=_con.spawn(_aci,%1,true)", + / "_gv.g_RETURN=_con.spawn(_aci,%1,true)", angoff = cmd(D) / "spriteext[_aci].angoff=%1", @@ -2022,13 +2020,13 @@ local Cinner = { / ACS".timetosleep=%1", eshoot = cmd(D) - / CSV".RETURN=_con._shoot(_aci,%1)", + / "_gv.g_RETURN=_con._shoot(_aci,%1)", eshootvar = cmd(R) - / CSV".RETURN=_con._shoot(_aci,%1)", + / "_gv.g_RETURN=_con._shoot(_aci,%1)", ezshoot = cmd(R,D) - / CSV".RETURN=_con._shoot(_aci,%2,%1)", + / "_gv.g_RETURN=_con._shoot(_aci,%2,%1)", ezshootvar = cmd(R,R) - / CSV".RETURN=_con._shoot(_aci,%2,%1)", + / "_gv.g_RETURN=_con._shoot(_aci,%2,%1)", shoot = cmd(D) / "_con._shoot(_aci,%1)", shootvar = cmd(R) @@ -2071,9 +2069,9 @@ local Cinner = { -- player/sprite searching findplayer = cmd(W) - / CSV".RETURN,%1=_con._findplayer(_pli,_aci)", -- player index, distance + / "_gv.g_RETURN,%1=_con._findplayer(_pli,_aci)", -- player index, distance findotherplayer = cmd(W) - / CSV".RETURN,%1=0,0x7fffffff", -- TODO_MP + / "_gv.g_RETURN,%1=0,0x7fffffff", -- TODO_MP findnearspritezvar = cmd(D,R,R,W) / "%4=_con._findnear(_aci,true,'z',%1,%2,%3)", findnearspritez = cmd(D,D,D,W) diff --git a/polymer/eduke32/source/lunatic/lunatic_game.c b/polymer/eduke32/source/lunatic/lunatic_game.c index 440d10a98..afe52a149 100644 --- a/polymer/eduke32/source/lunatic/lunatic_game.c +++ b/polymer/eduke32/source/lunatic/lunatic_game.c @@ -27,7 +27,7 @@ el_actor_t g_elActors[MAXTILES]; int32_t g_elEventError; int32_t g_elCallDepth = 0; -int32_t g_elEventRETURN; +int32_t g_RETURN; // for timing events and actors uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES]; @@ -489,13 +489,15 @@ int32_t El_CallEvent(L_State *estate, int32_t eventidx, int32_t iActor, int32_t lua_State *const L = estate->L; int32_t i; - g_elEventRETURN = *iReturn; + const int32_t o_RETURN = g_RETURN; + g_RETURN = *iReturn; g_elCallDepth++; i = call_regd_function3(L, &g_elEvents[eventidx], iActor, iPlayer, lDist); g_elCallDepth--; - *iReturn = g_elEventRETURN; + *iReturn = g_RETURN; + g_RETURN = o_RETURN; if (i != 0) {