mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Externalizations and fixes (by Buggler)
- Externalized heli tile index for helisites.xml - More checks and fixes for hidden towns and sam sites to be hidden in infobox git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6611 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -196,6 +196,9 @@ INT16 sRefuelSectorY[ MAX_NUMBER_OF_REFUEL_SITES ];
|
||||
|
||||
BOOLEAN fRefuelingSiteHidden[ MAX_NUMBER_OF_REFUEL_SITES ];
|
||||
|
||||
// heli tile index no in tileset
|
||||
INT32 iRefuelHeliTileIndex[ MAX_NUMBER_OF_REFUEL_SITES ];
|
||||
|
||||
// heli graphics grid no
|
||||
INT32 iRefuelHeliGridNo[ MAX_NUMBER_OF_REFUEL_SITES ];
|
||||
// skyrider standing grid no
|
||||
@@ -216,6 +219,7 @@ typedef enum
|
||||
HELISITE_ELEMENT_REFUELSECTOR_X,
|
||||
HELISITE_ELEMENT_REFUELSECTOR_Y,
|
||||
HELISITE_ELEMENT_REFUEL_HIDDEN,
|
||||
HELISITE_ELEMENT_REFUEL_HELI_TILE_INDEX,
|
||||
HELISITE_ELEMENT_REFUEL_HELI_GRIDNO,
|
||||
HELISITE_ELEMENT_REFUEL_SKYRIDER_GRIDNO,
|
||||
} HELISITE_PARSE_STAGE;
|
||||
@@ -226,6 +230,7 @@ typedef struct
|
||||
INT16 refuelSectorX;
|
||||
INT16 refuelSectorY;
|
||||
BOOLEAN refuelHidden;
|
||||
INT32 refuelHeliTileIndex;
|
||||
INT32 refuelHeliGridNo;
|
||||
INT32 refuelSkyriderGridNo;
|
||||
} heliInfo;
|
||||
@@ -261,7 +266,8 @@ 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( fRefuelingSiteHidden, 0, sizeof(fRefuelingSiteHidden) );
|
||||
memset( iRefuelHeliTileIndex, 0, sizeof(iRefuelHeliTileIndex) );
|
||||
memset( iRefuelHeliGridNo, 0, sizeof(iRefuelHeliGridNo) );
|
||||
memset( iRefuelSkyriderGridNo, 0, sizeof(iRefuelSkyriderGridNo) );
|
||||
|
||||
@@ -300,6 +306,11 @@ helisiteStartElementHandle(void *userData, const XML_Char *name, const XML_Char
|
||||
pData->curElement = HELISITE_ELEMENT_REFUEL_HIDDEN;
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "refuelHeliTileIndex") == 0 && pData->curElement == HELISITE_ELEMENT_REFUEL)
|
||||
{
|
||||
pData->curElement = HELISITE_ELEMENT_REFUEL_HELI_TILE_INDEX;
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "refuelHeliGridNo") == 0 && pData->curElement == HELISITE_ELEMENT_REFUEL)
|
||||
{
|
||||
pData->curElement = HELISITE_ELEMENT_REFUEL_HELI_GRIDNO;
|
||||
@@ -354,6 +365,7 @@ helisiteEndElementHandle(void *userData, const XML_Char *name)
|
||||
sRefuelSectorX [ pData->curHeliInfo.uiIndex ] = pData->curHeliInfo.refuelSectorX;
|
||||
sRefuelSectorY [ pData->curHeliInfo.uiIndex ] = pData->curHeliInfo.refuelSectorY;
|
||||
fRefuelingSiteHidden [ 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;
|
||||
}
|
||||
@@ -394,6 +406,12 @@ helisiteEndElementHandle(void *userData, const XML_Char *name)
|
||||
|
||||
pData->curHeliInfo.refuelHidden = (BOOLEAN)atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "refuelHeliTileIndex") == 0 && pData->curElement == HELISITE_ELEMENT_REFUEL_HELI_TILE_INDEX )
|
||||
{
|
||||
pData->curElement = HELISITE_ELEMENT_REFUEL;
|
||||
|
||||
pData->curHeliInfo.refuelHeliTileIndex = atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "refuelHeliGridNo") == 0 && pData->curElement == HELISITE_ELEMENT_REFUEL_HELI_GRIDNO )
|
||||
{
|
||||
pData->curElement = HELISITE_ELEMENT_REFUEL;
|
||||
@@ -504,6 +522,8 @@ BOOLEAN WriteInInfo(STR fileName)
|
||||
|
||||
FilePrintf(hFile,"\t\t\t<refuelHidden>%d</refuelHidden>\r\n", fRefuelingSiteHidden[cnt] );
|
||||
|
||||
FilePrintf(hFile,"\t\t\t<refuelHeliTileIndex>%d</refuelHeliTileIndex>\r\n", iRefuelHeliTileIndex[cnt] );
|
||||
|
||||
FilePrintf(hFile,"\t\t\t<refuelHeliGridNo>%d</refuelHeliGridNo>\r\n", iRefuelHeliGridNo[cnt] );
|
||||
|
||||
FilePrintf(hFile,"\t\t\t<refuelSkyriderGridNo>%d</refuelSkyriderGridNo>\r\n", iRefuelSkyriderGridNo[cnt] );
|
||||
@@ -2263,74 +2283,75 @@ BOOLEAN CanHelicopterTakeOff( void )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
void AddHeliPeice( INT32 sGridNo, UINT16 sOStruct )
|
||||
void AddHeliPiece( INT32 iGridNo, UINT16 sOStruct )
|
||||
{
|
||||
UINT16 usDummy;
|
||||
|
||||
// ATE: Check first if already exists....
|
||||
if ( !TypeExistsInStructLayer( sGridNo, sOStruct, &usDummy ) )
|
||||
if ( !TypeExistsInStructLayer( iGridNo, sOStruct, &usDummy ) )
|
||||
{
|
||||
// place in the world
|
||||
AddStructToTail( sGridNo, sOStruct );
|
||||
AddStructToTail( iGridNo, sOStruct );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AddHelicopterToMaps( BOOLEAN fAdd, UINT8 ubSite )
|
||||
{
|
||||
INT32 sGridNo = iRefuelHeliGridNo[ ubSite ];
|
||||
INT16 sOStruct = 0;
|
||||
INT32 iGridNo = iRefuelHeliGridNo[ ubSite ];
|
||||
INT32 iTileIndexNo = iRefuelHeliTileIndex[ ubSite ];
|
||||
//INT16 sOStruct = 0;
|
||||
INT16 sGridX, sGridY;
|
||||
INT16 sCentreGridX, sCentreGridY;
|
||||
|
||||
// find out what slot it is by which site
|
||||
if( ubSite == 0 )
|
||||
{
|
||||
// drassen
|
||||
sOStruct = FIRSTOSTRUCT1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// estoni
|
||||
sOStruct = FOURTHOSTRUCT1;
|
||||
}
|
||||
//if( ubSite == 0 )
|
||||
//{
|
||||
// // drassen
|
||||
// sOStruct = FIRSTOSTRUCT1;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // estoni
|
||||
// sOStruct = FOURTHOSTRUCT1;
|
||||
//}
|
||||
|
||||
|
||||
// are we adding or taking away
|
||||
if( fAdd )
|
||||
{
|
||||
AddHeliPeice( sGridNo, sOStruct );
|
||||
AddHeliPeice( sGridNo, ( UINT16 )( sOStruct + 1));
|
||||
AddHeliPeice( ( sGridNo - 800 ), ( UINT16 )( sOStruct + 2 ));
|
||||
AddHeliPeice( sGridNo, ( UINT16 )(sOStruct + 3 ));
|
||||
AddHeliPeice( sGridNo, ( UINT16 )(sOStruct + 4));
|
||||
AddHeliPeice( ( sGridNo - 800 ), ( UINT16 )(sOStruct + 5));
|
||||
AddHeliPiece( iGridNo, ( UINT16 ) iTileIndexNo ); // AddHeliPiece( iGridNo, sOStruct );
|
||||
AddHeliPiece( iGridNo, ( UINT16 )( iTileIndexNo + 1 ) );
|
||||
AddHeliPiece( ( iGridNo - WORLD_ROWS * 5 ), ( UINT16 )( iTileIndexNo + 2 ) ); // ( iGridNo - 800 )
|
||||
AddHeliPiece( iGridNo, ( UINT16 )( iTileIndexNo + 3 ) );
|
||||
AddHeliPiece( iGridNo, ( UINT16 )( iTileIndexNo + 4 ) );
|
||||
AddHeliPiece( ( iGridNo - WORLD_ROWS * 5 ), ( UINT16 )( iTileIndexNo + 5 ) ); // ( iGridNo - 800 )
|
||||
|
||||
InvalidateWorldRedundency();
|
||||
SetRenderFlags( RENDER_FLAG_FULL );
|
||||
|
||||
// ATE: If any mercs here, bump them off!
|
||||
ConvertGridNoToXY( sGridNo, &sCentreGridX, &sCentreGridY );
|
||||
ConvertGridNoToXY( iGridNo, &sCentreGridX, &sCentreGridY );
|
||||
|
||||
for( sGridY = sCentreGridY - 5; sGridY < sCentreGridY + 5; sGridY++ )
|
||||
{
|
||||
for( sGridX = sCentreGridX - 5; sGridX < sCentreGridX + 5; sGridX++ )
|
||||
{
|
||||
sGridNo = MAPROWCOLTOPOS( sGridY, sGridX );
|
||||
iGridNo = MAPROWCOLTOPOS( sGridY, sGridX );
|
||||
|
||||
BumpAnyExistingMerc( sGridNo );
|
||||
BumpAnyExistingMerc( iGridNo );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove from the world
|
||||
RemoveStruct( iRefuelHeliGridNo[ ubSite ], ( UINT16 )(sOStruct ));
|
||||
RemoveStruct( iRefuelHeliGridNo[ ubSite ], ( UINT16 )(sOStruct + 1 ));
|
||||
RemoveStruct( iRefuelHeliGridNo[ ubSite ] - 800, ( UINT16 )(sOStruct + 2));
|
||||
RemoveStruct( iRefuelHeliGridNo[ ubSite ], ( UINT16 )(sOStruct + 3));
|
||||
RemoveStruct( iRefuelHeliGridNo[ ubSite ], ( UINT16 )(sOStruct + 4));
|
||||
RemoveStruct( iRefuelHeliGridNo[ ubSite ] - 800, ( UINT16 )(sOStruct +5));
|
||||
RemoveStruct( iGridNo, ( UINT16 )iTileIndexNo );
|
||||
RemoveStruct( iGridNo, ( UINT16 )( iTileIndexNo + 1 ) );
|
||||
RemoveStruct( ( iGridNo - WORLD_ROWS * 5 ), ( UINT16 )( iTileIndexNo + 2 ) ); // ( iGridNo - 800 )
|
||||
RemoveStruct( iGridNo, ( UINT16 )( iTileIndexNo + 3 ) );
|
||||
RemoveStruct( iGridNo, ( UINT16 )( iTileIndexNo + 4 ) );
|
||||
RemoveStruct( ( iGridNo - WORLD_ROWS * 5 ), ( UINT16 )( iTileIndexNo + 5 ) ); // ( iGridNo - 800 )
|
||||
|
||||
InvalidateWorldRedundency();
|
||||
SetRenderFlags( RENDER_FLAG_FULL );
|
||||
|
||||
@@ -128,6 +128,7 @@ extern BOOLEAN fShowCambriaHospitalHighLight;
|
||||
extern INT32 iTotalAccumulatedCostByPlayer;
|
||||
extern UINT32 guiTimeOfLastSkyriderMonologue;
|
||||
extern BOOLEAN fSkyRiderSetUp;
|
||||
extern UINT8 NUMBER_OF_REFUEL_SITES;
|
||||
extern BOOLEAN fRefuelingSiteAvailable[ MAX_NUMBER_OF_REFUEL_SITES ];
|
||||
extern BOOLEAN fRefuelingSiteHidden[ MAX_NUMBER_OF_REFUEL_SITES ];
|
||||
|
||||
|
||||
@@ -701,52 +701,53 @@ void AddCommonInfoToBox(void)
|
||||
{
|
||||
CHAR16 wString[ 64 ];
|
||||
UINT32 hStringHandle = 0;
|
||||
BOOLEAN fHiddenSite = FALSE;
|
||||
BOOLEAN fKnownSite = FALSE;
|
||||
UINT8 ubMilitiaTotal = 0;
|
||||
UINT8 ubNumEnemies;
|
||||
UINT16 usSectorValue = 0;
|
||||
|
||||
// get the sector value
|
||||
usSectorValue = SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY );
|
||||
usSectorValue = SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY );
|
||||
|
||||
// check for hidden town
|
||||
if( !gfHiddenTown[ GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ] )
|
||||
fHiddenSite = TRUE;
|
||||
BOOLEAN fVisited = (SectorInfo[ usSectorValue ].uiFlags & SF_ALREADY_VISITED);
|
||||
UINT8 ubTownId = GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY );
|
||||
|
||||
// visited sector check
|
||||
if ( fVisited )
|
||||
fKnownSite = TRUE;
|
||||
|
||||
// known town check, exclude TownId 0 for non-town sectors
|
||||
else if( gfHiddenTown[ ubTownId ] && ubTownId != 0 )
|
||||
fKnownSite = TRUE;
|
||||
|
||||
// check for unknown SAM Site
|
||||
// known SAM Site check
|
||||
else
|
||||
{
|
||||
for (UINT16 x=0; x < MAX_NUMBER_OF_SAMS; x++)
|
||||
{
|
||||
// SAM Site 4 in Meduna is within town limits, so it's always known
|
||||
if ( usSectorValue == SEC_N4 && x == 3)
|
||||
fHiddenSite = FALSE;
|
||||
|
||||
else if ( pSamList[x] == usSectorValue )
|
||||
if ( pSamList[x] == usSectorValue )
|
||||
{
|
||||
if ( !fSamSiteFound[ x ] )
|
||||
{
|
||||
fHiddenSite = TRUE;
|
||||
}
|
||||
if ( fSamSiteFound[ x ] )
|
||||
fKnownSite = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*// ABOVE GROUND HARDCODED
|
||||
if( ubSectorID == SEC_N4 && fSamSiteFound[ SAM_SITE_FOUR ] )
|
||||
switch( SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) )
|
||||
fKnownSite = TRUE;
|
||||
switch( usSectorValue )
|
||||
{
|
||||
case SEC_D2: //Chitzena SAM
|
||||
if( !fSamSiteFound[ SAM_SITE_ONE ] )
|
||||
fHiddenSite = TRUE;
|
||||
fKnownSite = FALSE;
|
||||
break;
|
||||
case SEC_D15: //Drassen SAM
|
||||
if( !fSamSiteFound[ SAM_SITE_TWO ] )
|
||||
fHiddenSite = TRUE;
|
||||
fKnownSite = FALSE;
|
||||
break;
|
||||
case SEC_I8: //Cambria SAM
|
||||
if( !fSamSiteFound[ SAM_SITE_THREE ] )
|
||||
fHiddenSite = TRUE;
|
||||
fKnownSite = FALSE;
|
||||
break;
|
||||
// SAM Site 4 in Meduna is within town limits, so it's always controllable
|
||||
default:
|
||||
@@ -756,7 +757,7 @@ void AddCommonInfoToBox(void)
|
||||
|
||||
// in sector where militia can be trained,
|
||||
// control of the sector matters, display who controls this sector. Map brightness no longer gives this!
|
||||
if ( MilitiaTrainingAllowedInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, 0 ) && !fHiddenSite )
|
||||
if ( MilitiaTrainingAllowedInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, 0 ) && fKnownSite )
|
||||
{
|
||||
// controlled:
|
||||
swprintf( wString, L"%s:", pwMiscSectorStrings[ 4 ] );
|
||||
@@ -799,7 +800,7 @@ void AddCommonInfoToBox(void)
|
||||
// Sector contains Militia training facility?
|
||||
for (UINT8 ubCounter = 0; ubCounter < MAX_NUM_FACILITY_TYPES; ubCounter++)
|
||||
{
|
||||
if (gFacilityLocations[SECTOR(bCurrentTownMineSectorX, bCurrentTownMineSectorY)][ubCounter].fFacilityHere)
|
||||
if (gFacilityLocations[usSectorValue][ubCounter].fFacilityHere)
|
||||
{
|
||||
if (gFacilityTypes[ubCounter].ubMilitiaTrainersAllowed)
|
||||
{
|
||||
@@ -810,7 +811,7 @@ void AddCommonInfoToBox(void)
|
||||
if (fMilitiaTrainingAllowed)
|
||||
{
|
||||
// Show percent completed
|
||||
swprintf( wString, L"%d%%%%", SectorInfo[ SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ].ubMilitiaTrainingPercentDone );
|
||||
swprintf( wString, L"%d%%%%", SectorInfo[ usSectorValue ].ubMilitiaTrainingPercentDone );
|
||||
AddSecondColumnMonoString( &hStringHandle, wString );
|
||||
}
|
||||
else
|
||||
@@ -826,7 +827,7 @@ void AddCommonInfoToBox(void)
|
||||
// Sector contains Mobile training facility?
|
||||
for (UINT8 ubCounter = 0; ubCounter < MAX_NUM_FACILITY_TYPES; ubCounter++)
|
||||
{
|
||||
if (gFacilityLocations[SECTOR(bCurrentTownMineSectorX, bCurrentTownMineSectorY)][ubCounter].fFacilityHere)
|
||||
if (gFacilityLocations[usSectorValue][ubCounter].fFacilityHere)
|
||||
{
|
||||
if (gFacilityTypes[ubCounter].ubMobileMilitiaTrainersAllowed)
|
||||
{
|
||||
@@ -838,7 +839,7 @@ void AddCommonInfoToBox(void)
|
||||
if (fMobileTrainingAllowed)
|
||||
{
|
||||
// Show percentage completed
|
||||
swprintf( wString, L"%d%%%%", SectorInfo[ SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ].ubMobileMilitiaTrainingPercentDone );
|
||||
swprintf( wString, L"%d%%%%", SectorInfo[ usSectorValue ].ubMobileMilitiaTrainingPercentDone );
|
||||
AddSecondColumnMonoString( &hStringHandle, wString );
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user