From bbcf6d635381b76360a35a2d79df6a9edcd4b993 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 12 Jun 2013 17:49:51 +0000 Subject: [PATCH] LunaCON: implement qgetsysstr/STR_VOLUMENAME. git-svn-id: https://svn.eduke32.com/eduke32@3872 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/lunatic/control.lua | 4 +++- polymer/eduke32/source/lunatic/defs.ilua | 6 +++--- polymer/eduke32/source/lunatic/dynsymlist | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/source/lunatic/control.lua b/polymer/eduke32/source/lunatic/control.lua index 939124ac7..1c45140c9 100644 --- a/polymer/eduke32/source/lunatic/control.lua +++ b/polymer/eduke32/source/lunatic/control.lua @@ -762,7 +762,9 @@ function _qgetsysstr(qdst, what, pli) elseif (what == ffiC.STR_GAMETYPE) then ffi.copy(dst, "multiplayer not yet implemented") -- TODO_MP elseif (what == ffiC.STR_VOLUMENAME) then - ffi.copy(dst, "STR_VOLUMENAME: NYI") + local vol = ffiC.ud.volume_number + assert(vol+0ULL < con_lang.MAXVOLUMES) + ffi.copy(dst, ffiC.EpisodeNames[vol], ffi.sizeof(ffiC.EpisodeNames[0])) else error("unknown system string ID "..what, 2) end diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index f15bc5932..d41158545 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -570,6 +570,7 @@ int32_t g_RETURN; // deprecated from Lua -- INTERNAL VARIABLES/FUNCTIONS decl("map_t MapInfo[$*$];", con_lang.MAXVOLUMES+1, con_lang.MAXLEVELS) +decl("char EpisodeNames[$][33];", con_lang.MAXVOLUMES) decl[[ int32_t g_elCONSize; @@ -1741,9 +1742,8 @@ local event_funcs = {} local gameevent_internal = gameevent_internal -- included in lunatic.c -- gameevent( [, flags], ) local function our_gameevent(event, flags, func) - if (ffiC.g_elCallDepth > 0) then - error("Invalid use of gameevent: must be called from top level", 2) - end + bcheck.top_level("gameevent") + if (type(event) == "string") then if (event:sub(1,6) ~= "EVENT_") then event = "EVENT_"..event diff --git a/polymer/eduke32/source/lunatic/dynsymlist b/polymer/eduke32/source/lunatic/dynsymlist index a355e4754..fc6e607ae 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist +++ b/polymer/eduke32/source/lunatic/dynsymlist @@ -108,6 +108,7 @@ g_elModules; g_modDir; MapInfo; +EpisodeNames; kopen4loadfrommod;