mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
- externalised squad names
- moved Pockets.xml an PocketPopups.xml - requires GameDir >= r1608 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5872 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -9226,10 +9226,16 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
swprintf( sString, pMapErrorString[ 37 ], pSoldier->name );
|
||||
break;
|
||||
case CHARACTER_CANT_JOIN_SQUAD_TOO_FAR:
|
||||
swprintf( sString, pMapErrorString[ 20 ], pSoldier->name, pLongAssignmentStrings[ iValue ] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, pMapErrorString[ 20 ], pSoldier->name, SquadNames[ iValue ].squadname );
|
||||
else
|
||||
swprintf( sString, pMapErrorString[ 20 ], pSoldier->name, pLongAssignmentStrings[ iValue ] );
|
||||
break;
|
||||
case CHARACTER_CANT_JOIN_SQUAD_FULL:
|
||||
swprintf( sString, pMapErrorString[ 19 ], pSoldier->name, pLongAssignmentStrings[ iValue ] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, pMapErrorString[ 19 ], pSoldier->name, SquadNames[ iValue ].squadname );
|
||||
else
|
||||
swprintf( sString, pMapErrorString[ 19 ], pSoldier->name, pLongAssignmentStrings[ iValue ] );
|
||||
break;
|
||||
default:
|
||||
// generic "you can't join this squad" msg
|
||||
@@ -10059,13 +10065,17 @@ void CreateSquadBox( void )
|
||||
// add strings for box
|
||||
for(uiCounter=0; uiCounter <= uiMaxSquad; uiCounter++)
|
||||
{
|
||||
// get info about current squad and put in string
|
||||
//SQUAD10 FIX
|
||||
swprintf( sString, L"%s ( %d/%d )", pSquadMenuStrings[uiCounter], NumberOfPeopleInSquad( ( INT8 )uiCounter ), gGameOptions.ubSquadSize );
|
||||
AddMonoString(&hStringHandle, sString );
|
||||
// get info about current squad and put in string
|
||||
//SQUAD10 FIX
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, L"%s ( %d/%d )", SquadNames[ uiCounter ].squadname, NumberOfPeopleInSquad( ( INT8 )uiCounter ), gGameOptions.ubSquadSize );
|
||||
else
|
||||
swprintf( sString, L"%s ( %d/%d )", pSquadMenuStrings[uiCounter], NumberOfPeopleInSquad( ( INT8 )uiCounter ), gGameOptions.ubSquadSize );
|
||||
|
||||
// make sure it is unhighlighted
|
||||
UnHighLightLine(hStringHandle);
|
||||
AddMonoString(&hStringHandle, sString );
|
||||
|
||||
// make sure it is unhighlighted
|
||||
UnHighLightLine(hStringHandle);
|
||||
}
|
||||
|
||||
// add cancel line
|
||||
@@ -13744,6 +13754,10 @@ UINT32 GetLastSquadListedInSquadMenu( void )
|
||||
uiMaxSquad = NUMBER_OF_SQUADS - 1;
|
||||
}
|
||||
|
||||
// Flugente: if using xml squad names, always show all squads - people will propably want to use them
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
uiMaxSquad = NUMBER_OF_SQUADS - 1;
|
||||
|
||||
return( uiMaxSquad );
|
||||
}
|
||||
|
||||
|
||||
@@ -2173,7 +2173,10 @@ void PlotPathForCharacter( SOLDIERTYPE *pCharacter, INT16 sX, INT16 sY, BOOLEAN
|
||||
}
|
||||
else // squad
|
||||
{
|
||||
MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%s %s", pLongAssignmentStrings[ pCharacter->bAssignment ], gsUndergroundString[0] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%s %s", SquadNames[ pCharacter->bAssignment ].squadname, gsUndergroundString[0] );
|
||||
else
|
||||
MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%s %s", pLongAssignmentStrings[ pCharacter->bAssignment ], gsUndergroundString[0] );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -367,6 +367,8 @@ SGPPoint OrigFacilityPosition = { 160, 150 }; // HEADROCK HAM 3.6
|
||||
SGPPoint OrigFacilityAssignmentPosition = { 220,150 }; // HEADROCK HAM 3.6
|
||||
//SGPPoint OrigTalkToAllPosition = { 160, 150 };
|
||||
|
||||
SQUAD_NAMES SquadNames[20];
|
||||
|
||||
//extern BOOLEAN fMapExitDueToMessageBox;
|
||||
|
||||
// at least one merc was hired at some time
|
||||
@@ -3871,11 +3873,17 @@ void AddStringsToMoveBox( void )
|
||||
// add this squad, now add all the grunts in it
|
||||
if( fSquadIsMoving[ iCount ] )
|
||||
{
|
||||
swprintf( sString, L"*%s*", pSquadMenuStrings[iSquadMovingList[ iCount ] ] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, L"*%s*", SquadNames[ iSquadMovingList[ iCount ] ].squadname );
|
||||
else
|
||||
swprintf( sString, L"*%s*", pSquadMenuStrings[iSquadMovingList[ iCount ] ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sString, L"%s", pSquadMenuStrings[iSquadMovingList[ iCount ] ] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, L"%s", SquadNames[ iSquadMovingList[ iCount ] ].squadname );
|
||||
else
|
||||
swprintf( sString, L"%s", pSquadMenuStrings[iSquadMovingList[ iCount ] ] );
|
||||
}
|
||||
AddMonoString(&hStringHandle, sString );
|
||||
|
||||
@@ -3962,11 +3970,17 @@ void AddStringsToMoveBox( void )
|
||||
// add OTHER soldiers (not on duty nor in a vehicle)
|
||||
if( IsSoldierSelectedForMovement( pSoldierMovingList[ iCount ] ) == TRUE )
|
||||
{
|
||||
swprintf( sString, L" *%s ( %s )*", pSoldierMovingList[ iCount ]->name, pAssignmentStrings[ pSoldierMovingList[ iCount ]->bAssignment ] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, L" *%s ( %s )*", pSoldierMovingList[ iCount ]->name, SquadNames[ pSoldierMovingList[ iCount ]->bAssignment ].squadname );
|
||||
else
|
||||
swprintf( sString, L" *%s ( %s )*", pSoldierMovingList[ iCount ]->name, pAssignmentStrings[ pSoldierMovingList[ iCount ]->bAssignment ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sString, L" %s ( %s )", pSoldierMovingList[ iCount ]->name, pAssignmentStrings[ pSoldierMovingList[ iCount ]->bAssignment ] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, L" %s ( %s )", pSoldierMovingList[ iCount ]->name, SquadNames[ pSoldierMovingList[ iCount ]->bAssignment ].squadname );
|
||||
else
|
||||
swprintf( sString, L" %s ( %s )", pSoldierMovingList[ iCount ]->name, pAssignmentStrings[ pSoldierMovingList[ iCount ]->bAssignment ] );
|
||||
}
|
||||
AddMonoString(&hStringHandle, sString );
|
||||
}
|
||||
|
||||
@@ -21,6 +21,14 @@ typedef struct FASTHELPREGION {
|
||||
|
||||
} FASTHELPREGION;
|
||||
|
||||
// Flugente: externalised squad names
|
||||
typedef struct
|
||||
{
|
||||
UINT32 uiIndex;
|
||||
CHAR16 squadname[10];
|
||||
} SQUAD_NAMES;
|
||||
|
||||
extern SQUAD_NAMES SquadNames[20];
|
||||
|
||||
extern UINT8 FIRSTmercTOdisplay ;
|
||||
extern UINT8 maxNumberOfMercVisibleInStrategyList;
|
||||
|
||||
@@ -1931,7 +1931,10 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
||||
{
|
||||
// squad
|
||||
// HEADROCK HAM 3.6: Messages are no longer yellow by default.
|
||||
ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], pAssignmentStrings[ pGroup->pPlayerList->pSoldier->bAssignment ], pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ]);
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], SquadNames[ pGroup->pPlayerList->pSoldier->bAssignment ].squadname, pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ]);
|
||||
else
|
||||
ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], pAssignmentStrings[ pGroup->pPlayerList->pSoldier->bAssignment ], pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -776,6 +776,10 @@
|
||||
RelativePath=".\XML_SectorNames.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_SquadNames.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_UniformColors.cpp"
|
||||
>
|
||||
|
||||
@@ -774,6 +774,10 @@
|
||||
RelativePath=".\XML_SectorNames.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_SquadNames.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_UniformColors.cpp"
|
||||
>
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
<ClCompile Include="XML_FacilityTypes.cpp" />
|
||||
<ClCompile Include="XML_Roaming.cpp" />
|
||||
<ClCompile Include="XML_SectorNames.cpp" />
|
||||
<ClCompile Include="XML_SquadNames.cpp" />
|
||||
<ClCompile Include="XML_UniformColors.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
|
||||
@@ -338,5 +338,8 @@
|
||||
<ClCompile Include="XML_CoolnessBySector.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_SquadNames.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,189 @@
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Tactical All.h"
|
||||
#else
|
||||
#include "sgp.h"
|
||||
#include "Map Screen Interface.h"
|
||||
#include "overhead.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#endif
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
SQUAD_NAMES curSquadNames;
|
||||
SQUAD_NAMES * curArray;
|
||||
UINT32 maxArraySize;
|
||||
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
}
|
||||
typedef squadnamesParseData;
|
||||
|
||||
static void XMLCALL
|
||||
squadnamesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
squadnamesParseData * pData = (squadnamesParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "SQUAD_NAMES") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
memset(pData->curArray,0,sizeof(SQUAD_NAMES)*pData->maxArraySize);
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "SQUADNAME") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
memset(&pData->curSquadNames,0,sizeof(SQUAD_NAMES));
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(pData->curElement == ELEMENT &&
|
||||
(strcmp(name, "uiIndex") == 0 ||
|
||||
strcmp(name, "Squad") == 0 ))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
squadnamesCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
squadnamesParseData * pData = (squadnamesParseData *)userData;
|
||||
|
||||
if( (pData->currentDepth <= pData->maxReadDepth) &&
|
||||
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
||||
){
|
||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void XMLCALL
|
||||
squadnamesEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
squadnamesParseData * pData = (squadnamesParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
{
|
||||
if(strcmp(name, "SQUAD_NAMES") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "SQUADNAME") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if(pData->curSquadNames.uiIndex < pData->maxArraySize)
|
||||
{
|
||||
pData->curArray[pData->curSquadNames.uiIndex] = pData->curSquadNames; //write the squadnames into the table
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curSquadNames.uiIndex = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "Squad") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curSquadNames.squadname, sizeof(pData->curSquadNames.squadname)/sizeof(pData->curSquadNames.squadname[0]) );
|
||||
pData->curSquadNames.squadname[sizeof(pData->curSquadNames.squadname)/sizeof(pData->curSquadNames.squadname[0]) - 1] = '\0';
|
||||
}
|
||||
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN ReadInSquadNamesStats(STR fileName)
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
squadnamesParseData pData;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading SquadNames.xml" );
|
||||
|
||||
// Open squadnames file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
//Read in block
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, squadnamesStartElementHandle, squadnamesEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, squadnamesCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.curArray = SquadNames;
|
||||
pData.maxArraySize = 20;
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in SquadNames.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN WriteSquadNamesStats()
|
||||
{
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -2829,7 +2829,10 @@ void DrawCharacterInfo(INT16 sCharNumber)
|
||||
}
|
||||
else
|
||||
{
|
||||
wcscpy( sString, pAssignmentStrings[ pSoldier->bAssignment ] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, L"%s", SquadNames[ pSoldier->bAssignment ].squadname );
|
||||
else
|
||||
wcscpy( sString, pAssignmentStrings[ pSoldier->bAssignment ] );
|
||||
}
|
||||
|
||||
FindFontCenterCoordinates( CHAR_ASSIGN_X, CHAR_ASSIGN1_Y, CHAR_ASSIGN_WID, CHAR_ASSIGN_HEI, sString, CHAR_FONT, &usX, &usY );
|
||||
@@ -15553,7 +15556,10 @@ void GetMapscreenMercAssignmentString( SOLDIERTYPE *pSoldier, CHAR16 sString[] )
|
||||
}
|
||||
else
|
||||
{
|
||||
wcscpy(sString, pAssignmentStrings[ pSoldier->bAssignment ] );
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
swprintf( sString, L" %s", SquadNames[ pSoldier->bAssignment ].squadname );
|
||||
else
|
||||
wcscpy(sString, pAssignmentStrings[ pSoldier->bAssignment ] );
|
||||
}
|
||||
// If soldier is working at a facility, add an asterisk.
|
||||
if (pSoldier->sFacilityTypeOperated != -1)
|
||||
|
||||
Reference in New Issue
Block a user