The angle_hud variable currently displays the angle to the objective, relative to the player's current view angle. The only thing I am missing now is how to correctly translate that angle integer into a compass.
Code: Select all
angle_to_monster = FindTIDAngle(0, 999) / 182; //finds angle to objective
angle_player = GetActorAngle(0) / 182; //finds player angle
angle_hud = (angle_player - angle_to_monster); //final result, angle to obj relative to player viewangle
if (angle_hud < 0)
{
angle_hud += 360;
}
SetHudSize(640,480,1);
//for test purposes. up to here, everything works fine
hudmessage (s: "ANGLE: ", d: angle_hud;
HUDMSG_PLAIN,
998,
CR_WHITE,
160.0,
120.1,
0.0);
//======================= BEGIN DRAW RADAR ==========================================
int drawdist = 88; //how large to draw the compass
int radians = angle_hud * (3.1415926 / 180);
drawx = sin(radians) * drawdist;
drawy = cos(radians * drawdist;
drawx = (drawx + 320); //compass is in center of screen (640 / 2)
drawy = (drawy + 240); //compass is in center of screen (480 / 2)
SetFont("h_pack"); //the objective icon
hudmessage (s:"a";
HUDMSG_PLAIN,
910,
CR_UNTRANSLATED,
drawx,
drawy,
0.0);
//========================== END DRAW RADAR ==========================================