Changeset 59:36d92d21300f

Show
Ignore:
Timestamp:
12/18/09 18:51:44 (2 years ago)
Author:
Thibaut GIRKA <thib@…>
Branch:
default
Message:
Implemented sin opcode
Location:
scn2k
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • scn2k/scn2k_text.cc

    r58 r59  
    153153        RegisterCommand(1, 4, 510, "ReadFrame", (CmdImpl) &Text::impl_ReadFrame); 
    154154        RegisterCommand(1, 4, 620, "InitExFrames", (CmdImpl) &Text::impl_InitFrames); 
    155         RegisterCommand(1, 4, 624, "InitExFramesDecel", NULL); 
     155        RegisterCommand(1, 4, 624, "InitExFramesDecel", (CmdImpl) &Text::impl_InitFrames); 
    156156        RegisterCommand(1, 4, 630, "ReadExFrames", (CmdImpl) &Text::impl_ReadFrames); 
    157157 
     
    165165        RegisterCommand(1, 4, 1001, "pcnt", (CmdImpl) &Text::impl_pcnt); 
    166166        RegisterCommand(1, 4, 1002, "abs", (CmdImpl) &Text::impl_abs); 
    167         RegisterCommand(1, 4, 1003, "power", NULL); 
    168         RegisterCommand(1, 4, 1004, "sin", NULL); 
     167        RegisterCommand(1, 4, 1003, "power", (CmdImpl) &Text::impl_power); 
     168        RegisterCommand(1, 4, 1004, "sin", (CmdImpl) &Text::impl_sin); 
    169169        RegisterCommand(1, 4, 1007, "min", (CmdImpl) &Text::impl_min); 
    170170        RegisterCommand(1, 4, 1008, "max", (CmdImpl) &Text::impl_max); 
  • scn2k/scn2k_text.h

    r58 r59  
    278278                void impl_abs(Cmd& cmd); 
    279279                void impl_power(Cmd& cmd); 
     280                void impl_sin(Cmd& cmd); 
    280281                void impl_min(Cmd& cmd); 
    281282                void impl_max(Cmd& cmd); 
  • scn2k/scn2k_textimpl.cc

    r58 r59  
    335335} 
    336336 
     337#include "math.h" 
     338 
    337339void Text::impl_rnd(Cmd& cmd) 
    338340{ 
     
    375377void Text::impl_power(Cmd& cmd) 
    376378{ 
    377         //TODO 
    378         //cmd.SetSysvar(pow(cmd.args[0].value, cmd.args[1].value)); 
     379        cmd.SetSysvar(pow(cmd.args[0].value, cmd.args[1].value)); 
     380} 
     381 
     382void Text::impl_sin(Cmd& cmd) 
     383{ 
     384        cmd.SetSysvar(sin(cmd.args[0].value * M_PI / 180) * 32640 / cmd.args[1].value); 
    379385} 
    380386