Difference between revisions of "Cos"

From Unofficial QEdit Wiki Guide
Jump to: navigation, search
(Created page with "==Syntax== ''Syntax:'' <span style='font-size:12px;font-family:courier'><span style='color:red'>Cos </span>register, dword</span> * ''register'' = Register to write float val...")
 
 
Line 24: Line 24:
  
 
==Also see==
 
==Also see==
[[particle2]], [[faddi]],[[fsubi]], [[fmuli]], [[fdivi]]
+
[[particle2]], [[faddi]], [[fsubi]], [[fmuli]], [[fdivi]]

Latest revision as of 18:58, 5 February 2022

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