diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 738049752..4dfada3ad 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -81,7 +81,6 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = { CON_IFVARVAREITHER, 20080907 }, { CON_SAVENN, 20080915 }, { CON_COPY, 20090219 }, -// { CON_INV, 20090619 }, { CON_QSTRNCAT, 20090712 }, { CON_STOPACTORSOUND, 20090715 }, { CON_IFSERVER, 20100722 }, @@ -110,6 +109,8 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = { CON_IFVARVARBOTH, 20160101 }, { CON_WHILEVARL, 20160101 }, { CON_WHILEVARVARL, 20160101 }, + { CON_KLABS, 20160101 }, + { CON_INV, 20160101 }, }; #endif @@ -226,6 +227,7 @@ const tokenmap_t altkeyw [] = { "ifboth", CON_IFVARVARBOTH }, { "whilen", CON_WHILEVARVARN }, { "whilel", CON_WHILEVARVARL }, + { "abs", CON_KLABS }, }; const char *keyw[] = @@ -576,7 +578,7 @@ const char *keyw[] = "getarraysize", // 343 "savenn", // 344 "copy", // 345 - "", // 346 internal inversion function + "inv", // 346 "sectorofwall", // 347 "qstrncat", // 348 "ifactorsound", // 349 @@ -621,6 +623,7 @@ const char *keyw[] = "ifvarvarboth", // 388 "whilevarl", // 389 "whilevarvarl", // 390 + "klabs", // 391 "" }; #endif @@ -4474,6 +4477,8 @@ DO_DEFSTATE: case CON_GETTICKS: case CON_GETCURRADDRESS: case CON_GETMUSICPOSITION: + case CON_KLABS: + case CON_INV: C_GetNextVarType(GAMEVAR_READONLY); continue; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index cf46b0dd7..e6149ddd2 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -1058,6 +1058,7 @@ enum ScriptKeywords_t CON_IFVARVARBOTH, // 388 CON_WHILEVARL, // 389 CON_WHILEVARVARL, // 390 + CON_KLABS, // 391 CON_END }; // KEEPINSYNC with the keyword list in lunatic/con_lang.lua diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 709cc1bb2..584faeb9c 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -4536,6 +4536,14 @@ finish_qsprintf: insptr += 2; continue; + case CON_KLABS: + if ((aGameVars[*(insptr + 1)].dwFlags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) == 0) + aGameVars[*(insptr + 1)].val.lValue = klabs(aGameVars[*(insptr + 1)].val.lValue); + else + Gv_SetVarX(*(insptr + 1), klabs(Gv_GetVarX(*(insptr + 1)))); + insptr += 2; + continue; + case CON_SETARRAY: insptr++; {