Changeset 59:36d92d21300f
- Timestamp:
- 12/18/09 18:51:44 (2 years ago)
- Author:
- Thibaut GIRKA <thib@…>
- Branch:
- default
- Message:
-
Implemented sin opcode
- Location:
- scn2k
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r58
|
r59
|
|
| 153 | 153 | RegisterCommand(1, 4, 510, "ReadFrame", (CmdImpl) &Text::impl_ReadFrame); |
| 154 | 154 | 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); |
| 156 | 156 | RegisterCommand(1, 4, 630, "ReadExFrames", (CmdImpl) &Text::impl_ReadFrames); |
| 157 | 157 | |
| … |
… |
|
| 165 | 165 | RegisterCommand(1, 4, 1001, "pcnt", (CmdImpl) &Text::impl_pcnt); |
| 166 | 166 | 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); |
| 169 | 169 | RegisterCommand(1, 4, 1007, "min", (CmdImpl) &Text::impl_min); |
| 170 | 170 | RegisterCommand(1, 4, 1008, "max", (CmdImpl) &Text::impl_max); |
-
|
r58
|
r59
|
|
| 278 | 278 | void impl_abs(Cmd& cmd); |
| 279 | 279 | void impl_power(Cmd& cmd); |
| | 280 | void impl_sin(Cmd& cmd); |
| 280 | 281 | void impl_min(Cmd& cmd); |
| 281 | 282 | void impl_max(Cmd& cmd); |
-
|
r58
|
r59
|
|
| 335 | 335 | } |
| 336 | 336 | |
| | 337 | #include "math.h" |
| | 338 | |
| 337 | 339 | void Text::impl_rnd(Cmd& cmd) |
| 338 | 340 | { |
| … |
… |
|
| 375 | 377 | void Text::impl_power(Cmd& cmd) |
| 376 | 378 | { |
| 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 | |
| | 382 | void Text::impl_sin(Cmd& cmd) |
| | 383 | { |
| | 384 | cmd.SetSysvar(sin(cmd.args[0].value * M_PI / 180) * 32640 / cmd.args[1].value); |
| 379 | 385 | } |
| 380 | 386 | |