diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index cfab9f6c5..8de0705db 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -182,6 +182,7 @@ labels = SFLAG_NOTELEPORT = 0x00004000, -- SFLAG_BADGUYSTAYPUT = 0x00008000, -- SFLAG_CACHE = 0x00010000, +-- SFLAG_ROTFIXED = 0x00020000, }, { diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index f8677595c..46a78ac79 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -743,7 +743,7 @@ end local Ci = { -- these can appear anywhere in the script ["break"] = cmd() - / "do return end", -- TODO: more exact semantics + / "do return end", ["return"] = cmd() -- NLCF / "_con.longjmp()", -- TODO: test with code from Wiki "return" entry diff --git a/polymer/eduke32/source/lunatic/test/nlcf_break.con b/polymer/eduke32/source/lunatic/test/nlcf_break.con new file mode 100644 index 000000000..4f0f50c49 --- /dev/null +++ b/polymer/eduke32/source/lunatic/test/nlcf_break.con @@ -0,0 +1,22 @@ +state teststate_break + ifvare 1 1 + { + redefinequote 114 BEFORE + echo 114 + + break + + redefinequote 114 AFTER + echo 114 + } + + redefinequote 114 STILL LIVE INNER + echo 114 +ends + +onevent EVENT_INIT + state teststate_break + + redefinequote 114 STILL LIVE OUTER + echo 114 +endevent diff --git a/polymer/eduke32/source/lunatic/test/nlcf_return.con b/polymer/eduke32/source/lunatic/test/nlcf_return.con new file mode 100644 index 000000000..cb851062e --- /dev/null +++ b/polymer/eduke32/source/lunatic/test/nlcf_return.con @@ -0,0 +1,25 @@ +definequote 125 SPAWNED HEAVYHBOMB +definequote 126 RAN EVENT_EGS +definequote 127 RAN TEST STATE + +state teststate1 + return + userquote 127 +ends + +onevent EVENT_EGS + ifactor HEAVYHBOMB + { + state teststate1 // after teststate1's return, return from EVENT_EGS! + userquote 126 + } +endevent + +onevent EVENT_LOADACTOR + ifvarvare THISACTOR 0 + { + // the concrete actor is irrelevant, only placeholder + spawn HEAVYHBOMB // --> EVENT_EGS + userquote 125 + } +endevent diff --git a/polymer/eduke32/source/lunatic/test/rotfixed_actor.con b/polymer/eduke32/source/lunatic/test/rotfixed_actor.con new file mode 100644 index 000000000..9b77a8359 --- /dev/null +++ b/polymer/eduke32/source/lunatic/test/rotfixed_actor.con @@ -0,0 +1,6 @@ +useractor 4 58 1 NO NO 0 + // usertype 4 is "rotation-fixed actor" + // tile 58 is the space suit + + state killme +enda