CLEO Help Cleo to C++

CLEO related
Status
Not open for further replies.
Joined
Jun 4, 2019
Messages
13
Solutions
1
Reaction score
0
I'm making cheats in c++, and I want to know how I get the Z angle, What calculations does it use?
in Cleo is:
Code:
0604: get_Z_angle_for_point $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 store_to $TEMPVAR_ANGLE
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
that's it sir
C++:
#include <iostream>
#include <math.h>

#define M_PI    3.14159265358979323846

using namespace std;

double get_z_angle_for_point(double x, double y) {
    double z = atan2(x, y) * -180.0 / M_PI + 360;
    if (z >= 360.0)
        z -= 360.0;
    return z;
}

int main()
{
    cout << get_z_angle_for_point(-1.0, 1.0) << endl <<
            get_z_angle_for_point(-1.0, -1.0) << endl <<
            get_z_angle_for_point(1.0, -1.0) << endl <<
            get_z_angle_for_point(1.0, 1.0) << endl;

/*
equivalent to:
// 0604: get_Z_angle_for_point -1.0 1.0 store_to 0@      // 45 
//0604: get_Z_angle_for_point -1.0 -1.0 store_to 0@     //  135
//0604: get_Z_angle_for_point 1.0 -1.0 store_to 0@      // 225
//0604: get_Z_angle_for_point 1.0 1.0 store_to 0@        //  315
*/

    return 0;
}
 
Last edited:
Joined
Jun 4, 2019
Messages
13
Solutions
1
Reaction score
0
that's it sir
C++:
#include <iostream>
#include <math.h>

#define M_PI    3.14159265358979323846

using namespace std;

double get_z_angle_for_point(double x, double y) {
    double z = atan2(x, y) * -180.0 / M_PI + 360;
    if (z >= 360.0)
        z -= 360.0;
    return z;
}

int main()
{
    cout << get_z_angle_for_point(-1.0, 1.0) << endl <<
            get_z_angle_for_point(-1.0, -1.0) << endl <<
            get_z_angle_for_point(1.0, -1.0) << endl <<
            get_z_angle_for_point(1.0, 1.0) << endl;

/*
equivalent to:
// 0604: get_Z_angle_for_point -1.0 1.0 store_to 0@      // 45
//0604: get_Z_angle_for_point -1.0 -1.0 store_to 0@     //  135
//0604: get_Z_angle_for_point 1.0 -1.0 store_to 0@      // 225
//0604: get_Z_angle_for_point 1.0 1.0 store_to 0@        //  315
*/

    return 0;
}
Thank a lot
 
Status
Not open for further replies.
Top