Heli Refuel Updates (by Buggler)

- heli refuel site marking in airspace mode
- fixed missing remaining fuel & distance to fuel site text in other languages

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6715 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-12-27 09:37:32 +00:00
parent 0ec3c152f9
commit 5bf82b9d82
13 changed files with 166 additions and 37 deletions
+1
View File
@@ -380,6 +380,7 @@ enum
DRASSEN_AIRPORT_SITE,
MEDUNA_AIRPORT_SITE,
SAM_SITE,
REFUEL_SITE,
REBEL_HIDEOUT,
TIXA_DUNGEON,
+7 -6
View File
@@ -91,7 +91,7 @@ extern UINT8 ubSAMControlledSectors[ MAP_WORLD_Y ][ MAP_WORLD_X ];
extern INT8 SquadMovementGroups[ ];
// whether helicopted variables have been set up
// whether helicopter variables have been set up
BOOLEAN fSkyRiderSetUp = FALSE;
// plotting for a helicopter
@@ -207,11 +207,12 @@ void HandleSkyRiderMonologueAboutEstoniRefuel( UINT32 uiSpecialCode );
// refueling sites externalization stuff
UINT8 NUMBER_OF_REFUEL_SITES;
// coordinates X,Y of sam sites on strategic map
// coordinates X,Y of refuel sites on strategic map
INT16 sRefuelSectorX[ MAX_NUMBER_OF_REFUEL_SITES ];
INT16 sRefuelSectorY[ MAX_NUMBER_OF_REFUEL_SITES ];
BOOLEAN fRefuelingSiteHidden[ MAX_NUMBER_OF_REFUEL_SITES ];
// refuel sites known on game start
BOOLEAN fRefuelingSiteKnown[ MAX_NUMBER_OF_REFUEL_SITES ];
// heli tile index no in tileset
INT32 iRefuelHeliTileIndex[ MAX_NUMBER_OF_REFUEL_SITES ];
@@ -283,7 +284,7 @@ helisiteStartElementHandle(void *userData, const XML_Char *name, const XML_Char
memset( sRefuelSectorX, 0, sizeof(sRefuelSectorX) );
memset( sRefuelSectorY, 0, sizeof(sRefuelSectorY) );
memset( fRefuelingSiteHidden, 0, sizeof(fRefuelingSiteHidden) );
memset( fRefuelingSiteKnown, 0, sizeof(fRefuelingSiteKnown) );
memset( iRefuelHeliTileIndex, 0, sizeof(iRefuelHeliTileIndex) );
memset( iRefuelHeliGridNo, 0, sizeof(iRefuelHeliGridNo) );
memset( iRefuelSkyriderGridNo, 0, sizeof(iRefuelSkyriderGridNo) );
@@ -381,7 +382,7 @@ helisiteEndElementHandle(void *userData, const XML_Char *name)
pData->curHeliInfo.uiIndex--;
sRefuelSectorX [ pData->curHeliInfo.uiIndex ] = pData->curHeliInfo.refuelSectorX;
sRefuelSectorY [ pData->curHeliInfo.uiIndex ] = pData->curHeliInfo.refuelSectorY;
fRefuelingSiteHidden [ pData->curHeliInfo.uiIndex ] = pData->curHeliInfo.refuelHidden;
fRefuelingSiteKnown [ pData->curHeliInfo.uiIndex ] = !pData->curHeliInfo.refuelHidden;
iRefuelHeliTileIndex [ pData->curHeliInfo.uiIndex ] = pData->curHeliInfo.refuelHeliTileIndex;
iRefuelHeliGridNo [ pData->curHeliInfo.uiIndex ] = pData->curHeliInfo.refuelHeliGridNo;
iRefuelSkyriderGridNo [ pData->curHeliInfo.uiIndex ] = pData->curHeliInfo.refuelSkyriderGridNo;
@@ -537,7 +538,7 @@ BOOLEAN WriteInInfo(STR fileName)
FilePrintf(hFile,"\t\t\t\t<y>%d</y>\r\n",sRefuelSectorY[cnt]);
FilePrintf(hFile,"\t\t\t</refuelSector>\r\n");
FilePrintf(hFile,"\t\t\t<refuelHidden>%d</refuelHidden>\r\n", fRefuelingSiteHidden[cnt] );
FilePrintf(hFile,"\t\t\t<refuelHidden>%d</refuelHidden>\r\n", !fRefuelingSiteKnown[cnt] );
FilePrintf(hFile,"\t\t\t<refuelHeliTileIndex>%d</refuelHeliTileIndex>\r\n", iRefuelHeliTileIndex[cnt] );
+4 -1
View File
@@ -137,9 +137,12 @@ extern BOOLEAN fShowCambriaHospitalHighLight;
extern INT32 iTotalAccumulatedCostByPlayer;
extern UINT32 guiTimeOfLastSkyriderMonologue;
extern BOOLEAN fSkyRiderSetUp;
extern UINT8 NUMBER_OF_REFUEL_SITES;
extern INT16 sRefuelSectorX[ MAX_NUMBER_OF_REFUEL_SITES ];
extern INT16 sRefuelSectorY[ MAX_NUMBER_OF_REFUEL_SITES ];
extern BOOLEAN fRefuelingSiteAvailable[ MAX_NUMBER_OF_REFUEL_SITES ];
extern BOOLEAN fRefuelingSiteHidden[ MAX_NUMBER_OF_REFUEL_SITES ];
extern BOOLEAN fRefuelingSiteKnown[ MAX_NUMBER_OF_REFUEL_SITES ];
extern UINT8 gubHelicopterHitsTaken;
extern UINT8 gubHelicopterHoursToRepair;
+100
View File
@@ -6478,6 +6478,7 @@ void ShowSAMSitesOnStrategicMap( void )
BlitSAMGridMarkers( );
}
// sam site text
for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ )
{
// has the sam site here been found?
@@ -6553,6 +6554,86 @@ void ShowSAMSitesOnStrategicMap( void )
}
}
// refuel site text
for( iCounter = 0; iCounter < NUMBER_OF_REFUEL_SITES; iCounter++ )
{
// has the refuel site here been known or found?
if( !fRefuelingSiteKnown[ iCounter ] && !GetSectorFlagStatus( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ], 0, SF_ALREADY_VISITED ) )
{
continue;
}
// get the sector x and y
sSectorX = sRefuelSectorX[ iCounter ];
sSectorY = sRefuelSectorY[ iCounter ];
GetScreenXYFromMapXY( sSectorX, sSectorY, &sX, &sY );
sX += 5;
sY += 3;
if( fShowAircraftFlag )
{
// write "Refuel Site" centered underneath
// HEADROCK HAM 5: Font size is now dynamic.
INT32 MapHeliSiteFont;
if (iResolution <= _800x600 )
{
MapHeliSiteFont = MAP_FONT;
}
else
{
MapHeliSiteFont = FONT14ARIAL;
}
INT16 sLabelX = sX + (MAP_GRID_X / 2);
INT16 sLabelY;
if ( IsThisSectorASAMSector( sSectorX, sSectorY, 0 ) )
{
if (iResolution <= _800x600 )
sLabelY = sY + MAP_GRID_Y + 10;
else
sLabelY = sY + MAP_GRID_Y + 16;
}
else
sLabelY = sY + MAP_GRID_Y + 2;
wcscpy( wString, pLandTypeStrings[ REFUEL_SITE ] );
// we're CENTERING the first string AROUND sX, so calculate the starting X value
sLabelX -= StringPixLength( wString, MapHeliSiteFont) / 2;
// if within view region...render, else don't
if( ( sLabelX > MAP_VIEW_START_X + MAP_VIEW_WIDTH ) || ( sLabelX < MAP_VIEW_START_X ) ||
( sLabelY > MAP_VIEW_START_Y + MAP_VIEW_HEIGHT ) || ( sLabelY < MAP_VIEW_START_Y ) )
{
continue;
}
SetFontDestBuffer( guiSAVEBUFFER, MapScreenRect.iLeft + 2, MapScreenRect.iTop, MapScreenRect.iRight, MapScreenRect.iBottom, FALSE );
// clip blits to mapscreen region
ClipBlitsToMapViewRegion( );
SetFont(MapHeliSiteFont);
// Green on green doesn't contrast well, use Yellow
if ( fRefuelingSiteAvailable[ iCounter ] )
SetFontForeground(FONT_MCOLOR_LTYELLOW);
else
SetFontForeground(FONT_MCOLOR_LTGRAY);
SetFontBackground(FONT_MCOLOR_BLACK);
// draw the text
gprintfdirty( sLabelX, sLabelY, wString );
mprintf( sLabelX, sLabelY, wString);
// restore clip blits
RestoreClipRegionToFullScreen( );
}
}
return;
}
@@ -6576,6 +6657,7 @@ void BlitSAMGridMarkers( void )
// clip to view region
ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES );
// sam site rectangles
for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ )
{
// has the sam site here been found?
@@ -6593,6 +6675,24 @@ void BlitSAMGridMarkers( void )
RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf );
}
// refuel site rectangles
for( iCounter = 0; iCounter < NUMBER_OF_REFUEL_SITES; iCounter++ )
{
// has the refuel site here been known or found?
if( !fRefuelingSiteKnown[ iCounter ] && !GetSectorFlagStatus( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ], 0, SF_ALREADY_VISITED ) )
{
continue;
}
// get location on screen
GetScreenXYFromMapXY( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ], &sScreenX, &sScreenY );
sWidth = MAP_GRID_X;
sHeight= MAP_GRID_Y;
// draw rectangle
RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf );
}
// restore clips
RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES );