diff --git a/polymer/eduke32/source/m32def.c b/polymer/eduke32/source/m32def.c index e52d74ac0..1471e6be3 100644 --- a/polymer/eduke32/source/m32def.c +++ b/polymer/eduke32/source/m32def.c @@ -1274,7 +1274,7 @@ static void C_GetNextVarType(int32_t type) { // if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) // initprintf("%s:%d: debug: accepted defined label `%s' instead of gamevar.\n",g_szScriptFileName,g_lineNumber,label+(id*MAXLABELLEN)); - num = (1-!!(flags&M32_FLAG_NEGATE))*labelval[id]; + num = (1-2*!!(flags&M32_FLAG_NEGATE))*labelval[id]; if (type==GV_SIMPLE && (num<0 || num>=65536)) { diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index 13c929d15..60e1142f0 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -2373,6 +2373,8 @@ badindex: if (max==0) max = INT32_MAX; + else + max = klabs(max); //OSD_Printf("max:%d, sign:%d\n", max, sign); if (tw==CON_GETNUMBERFROMUSER) diff --git a/polymer/eduke32/source/m32vars.c b/polymer/eduke32/source/m32vars.c index b8a566501..2b9367a67 100644 --- a/polymer/eduke32/source/m32vars.c +++ b/polymer/eduke32/source/m32vars.c @@ -266,6 +266,8 @@ int32_t __fastcall Gv_GetVarX(register int32_t id) if (id == M32_THISACTOR_VAR_ID) return vm.g_i; + id &= ~M32_FLAG_NEGATE; + if ((id & M32_BITS_MASK) == M32_FLAG_CONSTANT) { switch (id&3)