Implement "divscale" and "scalevar" (scale()) in C-CON and "scalevar" in M32script.

git-svn-id: https://svn.eduke32.com/eduke32@5901 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-10-20 06:26:10 +00:00
parent 60231e53a4
commit 942964ec3d
6 changed files with 44 additions and 0 deletions

View file

@ -577,6 +577,8 @@ const char *keyw[] =
"nextsectorneighborz", // 397 "nextsectorneighborz", // 397
"clamp", // 398 "clamp", // 398
"ifplaybackon", // 399 "ifplaybackon", // 399
"divscale", // 400
"scalevar", // 401
"<null>" "<null>"
}; };
#endif #endif
@ -4315,6 +4317,8 @@ DO_DEFSTATE:
case CON_GETINCANGLE: case CON_GETINCANGLE:
case CON_GETANGLE: case CON_GETANGLE:
case CON_MULSCALE: case CON_MULSCALE:
case CON_DIVSCALE:
case CON_SCALEVAR:
case CON_SETASPECT: case CON_SETASPECT:
// get the ID of the DEF // get the ID of the DEF
switch (tw) switch (tw)
@ -4324,6 +4328,8 @@ DO_DEFSTATE:
case CON_GETANGLE: case CON_GETANGLE:
case CON_GETINCANGLE: case CON_GETINCANGLE:
case CON_MULSCALE: case CON_MULSCALE:
case CON_DIVSCALE:
case CON_SCALEVAR:
C_GetNextVarType(GAMEVAR_READONLY); C_GetNextVarType(GAMEVAR_READONLY);
break; break;
default: default:
@ -4345,6 +4351,8 @@ DO_DEFSTATE:
C_GetNextVar(); C_GetNextVar();
break; break;
case CON_MULSCALE: case CON_MULSCALE:
case CON_DIVSCALE:
case CON_SCALEVAR:
C_GetManyVars(2); C_GetManyVars(2);
break; break;
} }

View file

@ -1129,6 +1129,8 @@ enum ScriptKeywords_t
CON_NEXTSECTORNEIGHBORZ,// 397 CON_NEXTSECTORNEIGHBORZ,// 397
CON_CLAMP, // 398 CON_CLAMP, // 398
CON_IFPLAYBACKON, // 399 CON_IFPLAYBACKON, // 399
CON_DIVSCALE, // 400
CON_SCALEVAR, // 401
CON_END CON_END
}; };
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua // KEEPINSYNC with the keyword list in lunatic/con_lang.lua

View file

@ -2567,6 +2567,28 @@ nullquote:
continue; 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: case CON_INITTIMER:
insptr++; insptr++;
G_InitTimer(Gv_GetVarX(*insptr++)); G_InitTimer(Gv_GetVarX(*insptr++));

View file

@ -244,6 +244,7 @@ const char *keyw[] =
"sqrt", "sqrt",
"mulscale", "mulscale",
"divscale", "divscale",
"scalevar",
"dist", "dist",
"ldist", "ldist",
"calchypotenuse", "calchypotenuse",
@ -2820,6 +2821,7 @@ repeatcase:
case CON_MULSCALE: case CON_MULSCALE:
case CON_DIVSCALE: case CON_DIVSCALE:
case CON_SCALEVAR:
C_GetNextVarType(GV_WRITABLE); C_GetNextVarType(GV_WRITABLE);
C_GetManyVars(3); C_GetManyVars(3);
return 0; return 0;

View file

@ -372,6 +372,7 @@ enum ScriptKeywords_t
CON_SQRT, CON_SQRT,
CON_MULSCALE, CON_MULSCALE,
CON_DIVSCALE, CON_DIVSCALE,
CON_SCALEVAR,
CON_DIST, CON_DIST,
CON_LDIST, CON_LDIST,
CON_CALCHYPOTENUSE, CON_CALCHYPOTENUSE,

View file

@ -973,6 +973,15 @@ skip_check:
Gv_SetVarX(var1, divscale(var2, var3, var4)); Gv_SetVarX(var1, divscale(var2, var3, var4));
continue; 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 // *** if & while
case CON_IFVARVARAND: case CON_IFVARVARAND: