Sin

From Unofficial QEdit Wiki Guide
Revision as of 18:58, 5 February 2022 by Pheonixmog (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Syntax

Syntax: Sin 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 Sin 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
         sin  R1, R4 //Makes register 1 equal Sin (R4).
         fleti  R2, 10
         fleti  R3, 0
         fmuli  R1, 20  //Multiplies the Sin 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