diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 8925e72ea..16f402eee 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -101,6 +101,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = { CON_DEFINEVOLUMEFLAGS, 20150222 }, { CON_RESETPLAYERFLAGS, 20150303 }, { CON_APPENDEVENT, 20150325 }, + { CON_DEFSTATE, 20150923 }, }; #endif @@ -566,6 +567,7 @@ const char *keyw[] = "definevolumeflags", // 380 "resetplayerflags", // 381 "appendevent", // 382 + "defstate", // 383 "" }; #endif @@ -2783,9 +2785,18 @@ static int32_t C_ParseCommand(int32_t loop) case -1: case -2: return 1; //End + case CON_DEFSTATE: + if (EDUKE32_PREDICT_FALSE(g_processingState || g_parsingActorPtr)) + { + C_ReportError(ERROR_FOUNDWITHIN); + g_numCompilerErrors++; + continue; + } + goto DO_DEFSTATE; case CON_STATE: if (g_parsingActorPtr == NULL && g_processingState == 0) { +DO_DEFSTATE: C_GetNextLabelName(); g_scriptPtr--; labelcode[g_numLabels] = g_scriptPtr-script; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index b885299e0..08f21ac2d 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -1045,6 +1045,7 @@ enum ScriptKeywords_t CON_DEFINEVOLUMEFLAGS, // 380 CON_RESETPLAYERFLAGS, // 381 CON_APPENDEVENT, // 382 + CON_DEFSTATE, // 383 CON_END }; // KEEPINSYNC with the keyword list in lunatic/con_lang.lua diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index 29199b68a..e20e054a7 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -1277,6 +1277,7 @@ lpeg.P(false) + "displayrand" + "digitalnumberz" + "digitalnumber" + +"defstate" + "definevolumename" + "definevolumeflags" + "definesound" + diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index 985751e7a..48e6b7ba2 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -3437,6 +3437,9 @@ local Cblock = { state = POS() * sp1 * (lpeg.Cmt(tok.identifier, on.state_begin_Cmt)) * sp1 * stmt_list_or_eps * tok.state_ends / on.state_end, + defstate = POS() * sp1 * (lpeg.Cmt(tok.identifier, on.state_begin_Cmt)) + * sp1 * stmt_list_or_eps * tok.state_ends + / on.state_end, } for cmdname, cmdpat in pairs(Cblock) do