Try to fix bug #12083: radar's frustum is drawn incorrectly, by making sure different parts

of the code agree on exactly where the radar beings and ends. Please verify if this fixes the bug.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5738 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-08-02 15:17:22 +00:00
parent 81ba4bec25
commit b974fe2e01
5 changed files with 13 additions and 18 deletions

View File

@ -345,7 +345,7 @@ BOOL dispInitialise(void)
void ProcessRadarInput(void)
{
SDWORD PosX,PosY;
int PosX, PosY;
int x = mouseX();
int y = mouseY();
UDWORD temp1,temp2;
@ -369,7 +369,7 @@ void ProcessRadarInput(void)
// {
// camToggleStatus();
// }
CalcRadarPosition(x,y,(UDWORD *)&PosX,(UDWORD *)&PosY);
CalcRadarPosition(x, y, &PosX, &PosY);
if(mouseOverRadar)
{
// requestRadarTrack(PosX*TILE_UNITS,PosY*TILE_UNITS);
@ -389,7 +389,7 @@ void ProcessRadarInput(void)
if(mouseDrag(MOUSE_RMB,&temp1,&temp2) && !rotActive)
{
CalcRadarPosition(x,y,(UDWORD*)&PosX,(UDWORD*)&PosY);
CalcRadarPosition(x, y, &PosX, &PosY);
setViewPos(PosX,PosY,true);
bRadarDragging = true;
if(keyDown(KEY_LCTRL) || keyDown(KEY_RCTRL))
@ -399,12 +399,7 @@ void ProcessRadarInput(void)
}
else if (mousePressed(MOUSE_RMB))
{
#ifdef RADAR_POSITION_AT_ZOOM
CalcRadarPosition(x,y,&PosX,&PosY);
setViewPos(PosX,PosY,true);
CheckScrollLimits();
#endif
CalcRadarPosition(x,y,(UDWORD*)&PosX,(UDWORD*)&PosY);
CalcRadarPosition(x, y, &PosX, &PosY);
if(bInstantRadarJump)
{

View File

@ -734,11 +734,11 @@ void driveTacticalSelectionChanged(void)
//
void driveProcessRadarInput(int x,int y)
{
SDWORD PosX,PosY;
int PosX, PosY;
// when drive mode is active, clicking on the radar orders all selected droids
// to move to this position.
CalcRadarPosition(x,y,(UDWORD *)&PosX,(UDWORD *)&PosY);
CalcRadarPosition(x, y, &PosX, &PosY);
orderSelectedLoc(selectedPlayer, PosX*TILE_UNITS,PosY*TILE_UNITS);
}
/*

View File

@ -2527,7 +2527,7 @@ BOOL processConsoleCommands( char *pName )
//Add a beacon (blip)
void kf_AddHelpBlip( void )
{
UDWORD worldX,worldY;
int worldX, worldY;
UDWORD i;
char tempStr[255];
SDWORD x,y;

View File

@ -184,16 +184,16 @@ static void CalcRadarPixelSize(float *SizeH, float *SizeV)
// Given a position within the radar, return a world coordinate.
//
void CalcRadarPosition(UDWORD mX, UDWORD mY, UDWORD *PosX, UDWORD *PosY)
void CalcRadarPosition(int mX, int mY, int *PosX, int *PosY)
{
const int posX = mX - radarX; // pixel position within radar
const int posY = mY - radarY;
int sPosX, sPosY;
float pixSizeH, pixSizeV;
if (mX < radarX || mY < radarY)
if (!CoordInRadar(mX, mY))
{
debug(LOG_ERROR, "clicked outside radar minimap (%u, %u)", mX, mY);
ASSERT(false, "clicked outside radar minimap (%d, %d)", mX, mY);
*PosX = 0;
*PosY = 0;
return;
@ -205,7 +205,7 @@ void CalcRadarPosition(UDWORD mX, UDWORD mY, UDWORD *PosX, UDWORD *PosY)
sPosY -= scrollMinY;
#if REALLY_DEBUG_RADAR
debug(LOG_ERROR, "m=(%u,%u) radar=(%u,%u) pos(%u,%u), scroll=(%u-%u,%u-%u) sPos=(%u,%u), pixSize=(%f,%f)",
debug(LOG_ERROR, "m=(%d,%d) radar=(%d,%d) pos(%d,%d), scroll=(%u-%u,%u-%u) sPos=(%d,%d), pixSize=(%f,%f)",
mX, mY, radarX, radarY, posX, posY, scrollMinX, scrollMaxX, scrollMinY, scrollMaxY, sPosX, sPosY, pixSizeH, pixSizeV);
#endif
@ -577,7 +577,7 @@ static void DrawRadarExtras(float pixSizeH, float pixSizeV)
//
BOOL CoordInRadar(int x,int y)
{
if (x >= radarX - 1 && x < radarX + radarWidth + 1 && y >= radarY - 1 && y < radarY + radarHeight + 1)
if (x >= radarX && x < radarX + radarWidth && y >= radarY && y < radarY + radarHeight)
{
return true;
}

View File

@ -33,7 +33,7 @@ extern BOOL InitRadar(void);
extern BOOL ShutdownRadar(void);
extern BOOL resizeRadar(void);
extern void drawRadar(void);
extern void CalcRadarPosition(UDWORD mX,UDWORD mY,UDWORD *PosX,UDWORD *PosY);
extern void CalcRadarPosition(int mX, int mY, int *PosX, int *PosY);
extern void SetRadarZoom(float ZoomLevel);
extern float GetRadarZoom(void);
extern BOOL CoordInRadar(int x,int y);