Close ticket #1134 - add radar blips for events such as "structure under attack"

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9293 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2010-01-17 20:22:07 +00:00 committed by Git SVN Gateway
parent 2025407222
commit 9568ac7987
3 changed files with 46 additions and 1 deletions

View File

@ -38,6 +38,7 @@ static AUDIO_SAMPLE *g_psSampleQueue = NULL;
static BOOL g_bAudioEnabled = false;
static BOOL g_bAudioPaused = false;
static AUDIO_SAMPLE g_sPreviousSample;
static int g_iPreviousSampleTime;
/** Counts the number of samples in the SampleQueue
* \return the number of samples in the SampleQueue
@ -173,6 +174,30 @@ BOOL audio_GetPreviousQueueTrackPos( SDWORD *iX, SDWORD *iY, SDWORD *iZ )
return true;
}
BOOL audio_GetPreviousQueueTrackRadarBlipPos( SDWORD *iX, SDWORD *iY )
{
if (g_sPreviousSample.x == SAMPLE_COORD_INVALID
|| g_sPreviousSample.y == SAMPLE_COORD_INVALID)
{
return false;
}
if (g_sPreviousSample.iTrack != ID_SOUND_STRUCTURE_UNDER_ATTACK && g_sPreviousSample.iTrack != ID_SOUND_UNIT_UNDER_ATTACK)
{
return false;
}
if (gameTime2 > g_iPreviousSampleTime + 5*GAME_TICKS_PER_SEC)
{
return false;
}
*iX = g_sPreviousSample.x;
*iY = g_sPreviousSample.y;
return true;
}
//*
// =======================================================================================================================
// =======================================================================================================================
@ -511,6 +536,8 @@ static void audio_UpdateQueue( void )
g_sPreviousSample.x = psSample->x;
g_sPreviousSample.y = psSample->y;
g_sPreviousSample.z = psSample->z;
g_sPreviousSample.iTrack = psSample->iTrack;
g_iPreviousSampleTime = gameTime2;
}
}

View File

@ -60,6 +60,7 @@ extern void audio_QueueTrackGroupPos( SDWORD iTrack, SDWORD iGroup,
SDWORD iX, SDWORD iY, SDWORD iZ );
extern BOOL audio_GetPreviousQueueTrackPos( SDWORD *iX, SDWORD *iY,
SDWORD *iZ );
extern BOOL audio_GetPreviousQueueTrackRadarBlipPos( SDWORD *iX, SDWORD *iY);
extern void audio_PauseAll( void );
extern void audio_ResumeAll( void );
extern void audio_StopAll( void );

View File

@ -3058,6 +3058,7 @@ void drawRadarBlips(int radarX, int radarY, float pixSizeH, float pixSizeV)
UDWORD delay = 150;
UDWORD i;
SDWORD width, height;
int x = 0, y = 0;
// store the width & height of the radar/mini-map
width = scrollMaxX - scrollMinX;
@ -3094,7 +3095,6 @@ void drawRadarBlips(int radarX, int radarY, float pixSizeH, float pixSizeV)
for (psProxDisp = apsProxDisp[selectedPlayer]; psProxDisp != NULL; psProxDisp = psProxDisp->psNext)
{
PROX_TYPE proxType;
int x = 0, y = 0;
if (psProxDisp->type == POS_PROXDATA)
{
@ -3158,6 +3158,23 @@ void drawRadarBlips(int radarX, int radarY, float pixSizeH, float pixSizeV)
continue;
}
// NOTE: On certain missions (limbo & expand), there is still valid data that is stored outside the
// normal radar/mini-map view. We must now calculate the radar/mini-map's bounding box, and clip
// everything outside the box.
if ( (x+radarX) < width*pixSizeV/2 && (x+radarX) > -width*pixSizeV/2
&& (y+radarY) < height*pixSizeH/2 && (y+radarY) > -height*pixSizeH/2)
{
// Draw the 'blip'
iV_DrawImage(IntImages, imageID, x + radarX, y + radarY);
}
}
if (audio_GetPreviousQueueTrackRadarBlipPos(&x, &y))
{
int strobe = (gameTime2/delay)%NUM_PULSES;
x = (x / TILE_UNITS - scrollMinX) * pixSizeH;
y = (y / TILE_UNITS - scrollMinY) * pixSizeV;
imageID = (UWORD)(IMAGE_RAD_ENM1 + strobe + (PROX_ENEMY * (NUM_PULSES + 1)));
// NOTE: On certain missions (limbo & expand), there is still valid data that is stored outside the
// normal radar/mini-map view. We must now calculate the radar/mini-map's bounding box, and clip
// everything outside the box.