|
@@ -14,6 +14,20 @@
|
|
FLOAT_FUNCTION(Sin, sinf)
|
|
FLOAT_FUNCTION(Sin, sinf)
|
|
FLOAT_FUNCTION(Cos, cosf)
|
|
FLOAT_FUNCTION(Cos, cosf)
|
|
FLOAT_FUNCTION(Tan, tanf)
|
|
FLOAT_FUNCTION(Tan, tanf)
|
|
|
|
+FLOAT_FUNCTION(ASin, asinf)
|
|
|
|
+FLOAT_FUNCTION(ACos, acosf)
|
|
|
|
+FLOAT_FUNCTION(ATan, atanf)
|
|
|
|
+FLOAT_FUNCTION(Ln, logf)
|
|
|
|
+FLOAT_FUNCTION(Log, log10f)
|
|
|
|
+FLOAT_FUNCTION(SquareRoot, sqrtf)
|
|
|
|
+
|
|
|
|
+static void lPow(Script* sc) {
|
|
|
|
+ float x;
|
|
|
|
+ float y;
|
|
|
|
+ if(sPopFloat(sc, &x) && sPopFloat(sc, &y)) {
|
|
|
|
+ sPushFloat(sc, powf(y, x));
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
void lAddFloatFunction(const char* name, ScriptFunction sf) {
|
|
void lAddFloatFunction(const char* name, ScriptFunction sf) {
|
|
Function f;
|
|
Function f;
|
|
@@ -26,4 +40,16 @@ void lMathRegister() {
|
|
lAddFloatFunction("sin", lSin);
|
|
lAddFloatFunction("sin", lSin);
|
|
lAddFloatFunction("cos", lCos);
|
|
lAddFloatFunction("cos", lCos);
|
|
lAddFloatFunction("tan", lTan);
|
|
lAddFloatFunction("tan", lTan);
|
|
|
|
+ lAddFloatFunction("asin", lASin);
|
|
|
|
+ lAddFloatFunction("acos", lACos);
|
|
|
|
+ lAddFloatFunction("atan", lATan);
|
|
|
|
+ lAddFloatFunction("ln", lLn);
|
|
|
|
+ lAddFloatFunction("log", lLog);
|
|
|
|
+ lAddFloatFunction("sqrt", lSquareRoot);
|
|
|
|
+
|
|
|
|
+ Function f;
|
|
|
|
+ gfInit(&f, "pow", dtFloat(), lPow);
|
|
|
|
+ gfAddArgument(&f, dtFloat());
|
|
|
|
+ gfAddArgument(&f, dtFloat());
|
|
|
|
+ gfsAdd(&f);
|
|
}
|
|
}
|