comparison 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
comparison
equal deleted inserted replaced
58:0aaa5bb3dde5 59:36d92d21300f
330 } 330 }
331 } 331 }
332 cmd.SetSysvar(timers_active); 332 cmd.SetSysvar(timers_active);
333 } 333 }
334 334
335 #include "math.h"
336
335 void Text::impl_rnd(Cmd& cmd) 337 void Text::impl_rnd(Cmd& cmd)
336 { 338 {
337 /* rand() */ 339 /* rand() */
338 int min, max; 340 int min, max;
339 if (cmd.args.size() == 2) 341 if (cmd.args.size() == 2)
370 cmd.SetSysvar(abs(cmd.args[0].value)); 372 cmd.SetSysvar(abs(cmd.args[0].value));
371 } 373 }
372 374
373 void Text::impl_power(Cmd& cmd) 375 void Text::impl_power(Cmd& cmd)
374 { 376 {
375 //TODO 377 cmd.SetSysvar(pow(cmd.args[0].value, cmd.args[1].value));
376 //cmd.SetSysvar(pow(cmd.args[0].value, cmd.args[1].value)); 378 }
379
380 void Text::impl_sin(Cmd& cmd)
381 {
382 cmd.SetSysvar(sin(cmd.args[0].value * M_PI / 180) * 32640 / cmd.args[1].value);
377 } 383 }
378 384
379 void Text::impl_min(Cmd& cmd) 385 void Text::impl_min(Cmd& cmd)
380 { 386 {
381 int a = cmd.args[0].value; 387 int a = cmd.args[0].value;