dev icon indicating copy to clipboard operation
dev copied to clipboard

Add `KeepAngle(var)` to Built-in Commands

Open MatiDragon-YT opened this issue 2 years ago • 2 comments

This function should be in charge of maintaining the value of a floating variable, within 360 degrees, in the form of endless tape. That is to say, that if it is passed of the 360, this one must pass to value 0 and vice versa.

KeepAngle(@18) // float
/** Parameter:
 * 1 - var or lvar
*/

translate to

if @18 > 360.0
then @18 -= 360.0
end
if @18 < 0.0
then @18 += 360.0
end

MatiDragon-YT avatar Nov 11 '22 19:11 MatiDragon-YT

As far as I'm concerned, doesn't the GTA 3D games use radians?

NicusorN5 avatar Nov 11 '22 21:11 NicusorN5

@NicusorN5 Not natively, not with some opcode. But on the part of SAMPFuncs yes, 2 are added

0C01: samp math 1@ = radian_to_angle 0@ // (float)
0C02: samp math 0@ = angle_to_radian 1@ // (float)

MatiDragon-YT avatar Nov 13 '22 15:11 MatiDragon-YT

can be implemented with #206

x87 avatar Aug 07 '24 03:08 x87