Cos

From Unofficial QEdit Wiki Guide
Jump to: navigation, search

Syntax

Syntax: Cos register, dword

  • register = Register to write float value to.
  • dword = Angle input. The value is decimal 0 - 65535. Can also be a register.

Use

Applies the trig function Cos using an angle. The value will be between -1 and 1.

You can then apply arithmetic to modify its amplitude (fmuli/fdivi) and center (faddi/fsubi).

Example


100:      leti R4, 00000000 //Makes register 4 equal 0, defaulting to 0 degrees
101:      sync
         cos  R1, R4 //Makes register 1 equal Cos (R4).
         fleti  R2, 10
         fleti  R3, 0
         fmuli  R1, 20  //Multiplies the Cos output by 20.
         addi R4, 182 //Increases R4 by 182 (1 degree)
         particle2 R1, 000001AC, 1 //Spawns a Demons symbol for 1 frame that will rotate on the X-coord axis between -20 and 20.
         jmp  101

Also see

particle2, faddi, fsubi, fmuli, fdivi