mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Shortcut function for getting angle difference, so that I don't need (INT32) in front of all of the angle_t's :V
This commit is contained in:
parent
9ba3e07417
commit
4718c1993a
3 changed files with 11 additions and 3 deletions
|
|
@ -782,7 +782,7 @@ void K_ObjectTracking(trackingResult_t *result, vector3_t *point, UINT8 cameraNu
|
|||
player_t *player;
|
||||
|
||||
fixed_t viewpointX, viewpointY, viewpointZ;
|
||||
INT32 viewpointAngle, viewpointAiming;
|
||||
angle_t viewpointAngle, viewpointAiming;
|
||||
|
||||
INT32 screenWidth, screenHeight;
|
||||
fixed_t screenHalfW, screenHalfH;
|
||||
|
|
@ -873,7 +873,7 @@ void K_ObjectTracking(trackingResult_t *result, vector3_t *point, UINT8 cameraNu
|
|||
|
||||
// Determine viewpoint factors.
|
||||
h = R_PointToDist2(point->x, point->y, viewpointX, viewpointY);
|
||||
da = viewpointAngle - (INT32)(R_PointToAngle2(point->x, point->y, viewpointX, viewpointY));
|
||||
da = AngleDifference(viewpointAngle, R_PointToAngle2(point->x, point->y, viewpointX, viewpointY));
|
||||
|
||||
// Set results!
|
||||
result->x = screenHalfW + FixedMul(NEWTAN(da), fg);
|
||||
|
|
@ -881,7 +881,7 @@ void K_ObjectTracking(trackingResult_t *result, vector3_t *point, UINT8 cameraNu
|
|||
|
||||
result->scale = FixedDiv(screenHalfW, h+1);
|
||||
|
||||
result->onScreen = ((abs(da) > ANG60) || (abs(viewpointAiming - R_PointToAngle2(0, 0, h, viewpointZ)) > ANGLE_45));
|
||||
result->onScreen = ((abs(da) > ANG60) || (abs(AngleDifference(viewpointAiming, R_PointToAngle2(0, 0, h, viewpointZ))) > ANGLE_45));
|
||||
|
||||
if (encoremode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -167,6 +167,12 @@ angle_t FixedAngle(fixed_t fa)
|
|||
return AngleAdj(cfa, cwf, ra);
|
||||
}
|
||||
|
||||
INT32 AngleDifference(angle_t a1, angle_t a2)
|
||||
{
|
||||
// Silly but easy way to do it through integer conversion.
|
||||
return (INT32)(a1) - (INT32)(a2);
|
||||
}
|
||||
|
||||
|
||||
#include "t_ftan.c"
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ FUNCMATH fixed_t AngleFixed(angle_t af);
|
|||
FUNCMATH angle_t FixedAngle(fixed_t fa);
|
||||
// and with a factor, with +factor for (fa/factor) and -factor for (fa*factor)
|
||||
FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor);
|
||||
// difference between two angle_t
|
||||
FUNCMATH INT32 AngleDifference(angle_t a1, angle_t a2);
|
||||
|
||||
/// The FixedAcos function
|
||||
FUNCMATH angle_t FixedAcos(fixed_t x);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue