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
"clamp", // 398
"ifplaybackon", // 399
"divscale", // 400
"scalevar", // 401
"<null>"
};
#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;
}

View file

@ -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

View file

@ -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++));

View file

@ -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;

View file

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

View file

@ -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: