diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 1c1263765..b14807a11 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -577,6 +577,8 @@ const char *keyw[] = "nextsectorneighborz", // 397 "clamp", // 398 "ifplaybackon", // 399 + "divscale", // 400 + "scalevar", // 401 "" }; #endif @@ -4315,6 +4317,8 @@ DO_DEFSTATE: case CON_GETINCANGLE: case CON_GETANGLE: case CON_MULSCALE: + case CON_DIVSCALE: + case CON_SCALEVAR: case CON_SETASPECT: // get the ID of the DEF switch (tw) @@ -4324,6 +4328,8 @@ DO_DEFSTATE: case CON_GETANGLE: case CON_GETINCANGLE: case CON_MULSCALE: + case CON_DIVSCALE: + case CON_SCALEVAR: C_GetNextVarType(GAMEVAR_READONLY); break; default: @@ -4345,6 +4351,8 @@ DO_DEFSTATE: C_GetNextVar(); break; case CON_MULSCALE: + case CON_DIVSCALE: + case CON_SCALEVAR: C_GetManyVars(2); break; } diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index ab22309ae..cc9af1b55 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -1129,6 +1129,8 @@ enum ScriptKeywords_t CON_NEXTSECTORNEIGHBORZ,// 397 CON_CLAMP, // 398 CON_IFPLAYBACKON, // 399 + CON_DIVSCALE, // 400 + CON_SCALEVAR, // 401 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 bbdb1e431..4e50bcdad 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2567,6 +2567,28 @@ nullquote: continue; } + case CON_DIVSCALE: + insptr++; + { + int const out = *insptr++; + vec3_t in; + + Gv_GetManyVars(3, (int32_t *)&in); + Gv_SetVarX(out, divscale(in.x, in.y, in.z)); + continue; + } + + case CON_SCALEVAR: + insptr++; + { + int const out = *insptr++; + vec3_t in; + + Gv_GetManyVars(3, (int32_t *)&in); + Gv_SetVarX(out, scale(in.x, in.y, in.z)); + continue; + } + case CON_INITTIMER: insptr++; G_InitTimer(Gv_GetVarX(*insptr++)); diff --git a/polymer/eduke32/source/m32def.c b/polymer/eduke32/source/m32def.c index 1473c9c30..42cfe2fee 100644 --- a/polymer/eduke32/source/m32def.c +++ b/polymer/eduke32/source/m32def.c @@ -244,6 +244,7 @@ const char *keyw[] = "sqrt", "mulscale", "divscale", + "scalevar", "dist", "ldist", "calchypotenuse", @@ -2820,6 +2821,7 @@ repeatcase: case CON_MULSCALE: case CON_DIVSCALE: + case CON_SCALEVAR: C_GetNextVarType(GV_WRITABLE); C_GetManyVars(3); return 0; diff --git a/polymer/eduke32/source/m32def.h b/polymer/eduke32/source/m32def.h index bb328e08a..5c8be0c3d 100644 --- a/polymer/eduke32/source/m32def.h +++ b/polymer/eduke32/source/m32def.h @@ -372,6 +372,7 @@ enum ScriptKeywords_t CON_SQRT, CON_MULSCALE, CON_DIVSCALE, + CON_SCALEVAR, CON_DIST, CON_LDIST, CON_CALCHYPOTENUSE, diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index 5272a4e68..4e642ca64 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -973,6 +973,15 @@ skip_check: Gv_SetVarX(var1, divscale(var2, var3, var4)); continue; } + case CON_SCALEVAR: + insptr++; + { + int32_t var1 = *insptr++, var2 = Gv_GetVarX(*insptr++); + int32_t var3 = Gv_GetVarX(*insptr++), var4 = Gv_GetVarX(*insptr++); + + Gv_SetVarX(var1, scale(var2, var3, var4)); + continue; + } // *** if & while case CON_IFVARVARAND: