From 972a4f08b2a4673993e774245f2091523b961850 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 10 Dec 2005 00:21:45 +0000 Subject: [PATCH] added sin, cos, atan2 builtins. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1695 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/plugin.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 227d46dd8..4d4b9c0a5 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -1148,6 +1148,24 @@ int VARGS Plug_sqrt(void *offset, unsigned int mask, const long *arg) VM_FLOAT(ret) = sqrt(VM_FLOAT(arg[0])); return ret; } +int VARGS Plug_sin(void *offset, unsigned int mask, const long *arg) +{ + int ret; + VM_FLOAT(ret) = sin(VM_FLOAT(arg[0])); + return ret; +} +int VARGS Plug_cos(void *offset, unsigned int mask, const long *arg) +{ + int ret; + VM_FLOAT(ret) = cos(VM_FLOAT(arg[0])); + return ret; +} +int VARGS Plug_atan2(void *offset, unsigned int mask, const long *arg) +{ + int ret; + VM_FLOAT(ret) = atan2(VM_FLOAT(arg[0]), VM_FLOAT(arg[1])); + return ret; +} int VARGS Plug_Net_Recv(void *offset, unsigned int mask, const long *arg) { @@ -1405,6 +1423,9 @@ void Plug_Init(void) Plug_RegisterBuiltin("memcpy", Plug_memcpy, 0); Plug_RegisterBuiltin("memmove", Plug_memmove, 0); Plug_RegisterBuiltin("sqrt", Plug_sqrt, 0); + Plug_RegisterBuiltin("sin", Plug_sin, 0); + Plug_RegisterBuiltin("cos", Plug_cos, 0); + Plug_RegisterBuiltin("atan2", Plug_atan2, 0); Plug_RegisterBuiltin("LocalSound", Plug_LocalSound, 0);