Merged from revision: 6953

- Increased text limit for load screen hints from 190 to 254
o Hopefully this does not cause any problems when rendering on the loadscreens. Tests resulted in success
- Support for localization of LoadScreenHints.xml (*.LoadScreenHints.xml)
o Now the language specific xmls only have the <uiIndex> and <szName> attributes. All other attributes are in the LoadScreenHints.xml

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6954 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-02-21 09:02:17 +00:00
parent 36131f3bf1
commit 7f2ec17f9b
4 changed files with 31 additions and 25 deletions
+9 -18
View File
@@ -385,25 +385,16 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
strcat(fileName, LOADSCREENHINTSFILENAME); strcat(fileName, LOADSCREENHINTSFILENAME);
SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName, FALSE),LOADSCREENHINTSFILENAME);
#ifndef ENGLISH #ifndef ENGLISH
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
if ( FileExists(fileName) ) {
{ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName),LOADSCREENHINTSFILENAME); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName,TRUE), fileName);
} }
else #endif
{
//CHRISL: If we fail to load, try loading just the default english
strcpy(fileName, directoryName);
strcat(fileName, LOADSCREENHINTSFILENAME);
SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName),LOADSCREENHINTSFILENAME);
}
#else
SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName),LOADSCREENHINTSFILENAME);
#endif
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
strcat(fileName, ARMOURSFILENAME); strcat(fileName, ARMOURSFILENAME);
+1 -1
View File
@@ -323,7 +323,7 @@ extern BOOLEAN ReadInSquadNamesStats(STR fileName);
extern BOOLEAN WriteSquadNamesStats(); extern BOOLEAN WriteSquadNamesStats();
// Flugente: loadscreen hints // Flugente: loadscreen hints
extern BOOLEAN ReadInLoadScreenHints(STR fileName); extern BOOLEAN ReadInLoadScreenHints(STR fileName, BOOLEAN localizedVersion);
extern BOOLEAN WriteLoadScreenHints(); extern BOOLEAN WriteLoadScreenHints();
// Flugente: soldier profiles // Flugente: soldier profiles
+17 -4
View File
@@ -24,6 +24,8 @@ struct
} }
typedef enemyRankParseData; typedef enemyRankParseData;
BOOLEAN localizedTextOnly_LoadScreenHints;
UINT16 num_found_loadscreenhints = 0; // the correct number is set on reading the xml UINT16 num_found_loadscreenhints = 0; // the correct number is set on reading the xml
LOADSCREENHINT_STRUCT zLoadScreenHint[LOADSCREENHINT_MAX]; LOADSCREENHINT_STRUCT zLoadScreenHint[LOADSCREENHINT_MAX];
@@ -39,7 +41,8 @@ loadscreenhintsStartElementHandle(void *userData, const XML_Char *name, const XM
{ {
pData->curElement = ELEMENT_LIST; pData->curElement = ELEMENT_LIST;
memset(pData->curArray,0,sizeof(LOADSCREENHINT_STRUCT)*pData->maxArraySize); if (!localizedTextOnly_LoadScreenHints)
memset(pData->curArray,0,sizeof(LOADSCREENHINT_STRUCT)*pData->maxArraySize);
pData->maxReadDepth++; //we are not skipping this element pData->maxReadDepth++; //we are not skipping this element
} }
@@ -47,7 +50,8 @@ loadscreenhintsStartElementHandle(void *userData, const XML_Char *name, const XM
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
memset(&pData->curLoadScreenHint,0,sizeof(LOADSCREENHINT_STRUCT)); if (!localizedTextOnly_LoadScreenHints)
memset(&pData->curLoadScreenHint,0,sizeof(LOADSCREENHINT_STRUCT));
pData->maxReadDepth++; //we are not skipping this element pData->maxReadDepth++; //we are not skipping this element
} }
@@ -104,7 +108,14 @@ loadscreenhintsEndElementHandle(void *userData, const XML_Char *name)
if(pData->curLoadScreenHint.uiIndex < pData->maxArraySize) if(pData->curLoadScreenHint.uiIndex < pData->maxArraySize)
{ {
pData->curArray[pData->curLoadScreenHint.uiIndex] = pData->curLoadScreenHint; if (!localizedTextOnly_LoadScreenHints)
{
pData->curArray[pData->curLoadScreenHint.uiIndex] = pData->curLoadScreenHint;
}
else
{
wcscpy(zLoadScreenHint[pData->curLoadScreenHint.uiIndex].szName, pData->curLoadScreenHint.szName);
}
} }
num_found_loadscreenhints = pData->curLoadScreenHint.uiIndex; num_found_loadscreenhints = pData->curLoadScreenHint.uiIndex;
@@ -172,7 +183,7 @@ loadscreenhintsEndElementHandle(void *userData, const XML_Char *name)
pData->currentDepth--; pData->currentDepth--;
} }
BOOLEAN ReadInLoadScreenHints(STR fileName) BOOLEAN ReadInLoadScreenHints(STR fileName, BOOLEAN localizedVersion)
{ {
HWFILE hFile; HWFILE hFile;
UINT32 uiBytesRead; UINT32 uiBytesRead;
@@ -182,6 +193,8 @@ BOOLEAN ReadInLoadScreenHints(STR fileName)
enemyRankParseData pData; enemyRankParseData pData;
localizedTextOnly_LoadScreenHints = localizedVersion;
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading LoadScreenHints.xml" ); DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading LoadScreenHints.xml" );
// Open file // Open file
+3 -1
View File
@@ -35,7 +35,9 @@ extern PROGRESSBAR *pBar[ MAX_PROGRESSBARS ];
typedef struct typedef struct
{ {
UINT16 uiIndex; UINT16 uiIndex;
CHAR16 szName[190]; // text of the hint. Note that this size + any text it is used in msut be < than CHAR16 pzText[ 200 ]; of VIDEO_OVERLAY_DESC if you display this in any logs // WANNE: I changed them from 190 to 256 because otherwise it is too short for the loadscreen hints. I works just fine even if it is > 200.
CHAR16 szName[256]; // text of the hint. Note that this size + any text it is used in msut be < than CHAR16 pzText[ 200 ]; of VIDEO_OVERLAY_DESC if you display this in any logs
UINT32 usFlags; // flags that can be used to determine wether a hint is currently appropriate UINT32 usFlags; // flags that can be used to determine wether a hint is currently appropriate
BOOLEAN fAlreadyShown; // to remember if this hint has already been shown in this game (reset on starting exe) BOOLEAN fAlreadyShown; // to remember if this hint has already been shown in this game (reset on starting exe)
} LOADSCREENHINT_STRUCT; } LOADSCREENHINT_STRUCT;