diff scn2k/scn2k_textimpl.cc @ 59:36d92d21300f

Implemented sin opcode
author Thibaut GIRKA <thib@sitedethib.com>
date Fri, 18 Dec 2009 18:51:44 +0100
parents 0aaa5bb3dde5
children 043d5db57474
line wrap: on
line diff
--- a/scn2k/scn2k_textimpl.cc
+++ b/scn2k/scn2k_textimpl.cc
@@ -332,6 +332,8 @@ void Text::impl_ReadFrames(Cmd& cmd) {
 	cmd.SetSysvar(timers_active);
 }
 
+#include "math.h"
+
 void Text::impl_rnd(Cmd& cmd)
 {
 	/* rand() */
@@ -372,8 +374,12 @@ void Text::impl_abs(Cmd& cmd)
 
 void Text::impl_power(Cmd& cmd)
 {
-	//TODO
-	//cmd.SetSysvar(pow(cmd.args[0].value, cmd.args[1].value));
+	cmd.SetSysvar(pow(cmd.args[0].value, cmd.args[1].value));
+}
+
+void Text::impl_sin(Cmd& cmd)
+{
+	cmd.SetSysvar(sin(cmd.args[0].value * M_PI / 180) * 32640 / cmd.args[1].value);
 }
 
 void Text::impl_min(Cmd& cmd)