Updated CoordInRadar function which somehow did not make it into r6410 (rotating radar). This fixes an assert in CalcRadarPosition.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6418 4a71c877-e1ca-e34f-864e-861f7616d084
master
Gerard Krol 2008-11-30 22:44:58 +00:00
parent 0dc0addab9
commit bb7e111e00
1 changed files with 12 additions and 3 deletions

View File

@ -590,12 +590,21 @@ static void DrawRadarExtras(float radarX, float radarY, float pixSizeH, float pi
/** Does a screen coordinate lie within the radar area? */ /** Does a screen coordinate lie within the radar area? */
BOOL CoordInRadar(int x,int y) BOOL CoordInRadar(int x,int y)
{ {
if (x >= radarX && x < radarX + radarWidth && y >= radarY && y < radarY + radarHeight) Vector2f pos;
pos.x = x - radarX - radarWidth/2;
pos.y = y - radarY - radarHeight/2;
if (rotateRadar)
{ {
return true; pos = Vector2f_Rotate2f(pos, -player.r.y/DEG(1));
} }
pos.x += radarWidth/2;
pos.y += radarHeight/2;
return false; if (pos.x<0 || pos.y<0 || pos.x>=radarWidth || pos.y>=radarHeight)
{
return false;
}
return true;
} }
void radarColour(UDWORD tileNumber, uint8_t r, uint8_t g, uint8_t b) void radarColour(UDWORD tileNumber, uint8_t r, uint8_t g, uint8_t b)