Makes math helpers defines for performance (#5654)

This commit is contained in:
kevinz000
2018-12-06 13:13:59 -08:00
committed by Atermonera
parent ec57465a5c
commit 8da11c17a2
48 changed files with 911 additions and 849 deletions

View File

@@ -78,13 +78,13 @@ return_location()
return
// calculate the angle
angle = Atan2(dx, dy) + angle_offset
angle = ATAN2(dx, dy) + angle_offset
// and some rounding to stop the increments jumping whole turfs - because byond favours certain angles
if(angle > -135 && angle < 45)
angle = Ceiling(angle)
angle = CEILING(angle, 1)
else
angle = Floor(angle)
angle = FLOOR(angle, 1)
// calculate the offset per increment step
if(abs(angle) in list(0, 45, 90, 135, 180)) // check if the angle is a cardinal
@@ -93,11 +93,11 @@ return_location()
if(abs(angle) in list(45, 90, 135))
offset_y = sign(dy)
else if(abs(dy) > abs(dx))
offset_x = Cot(abs(angle)) // otherwise set the offsets
offset_x = COT(abs(angle)) // otherwise set the offsets
offset_y = sign(dy)
else
offset_x = sign(dx)
offset_y = Tan(angle)
offset_y = TAN(angle)
if(dx < 0)
offset_y = -offset_y