mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
-added localization code for German and Russian ammo strings and item names and descriptions
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@395 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -90,19 +90,24 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, AMMOTYPESFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
|
||||
if(!ReadInAmmoTypeStats(fileName))
|
||||
return FALSE;
|
||||
|
||||
//if(!WriteAmmoTypeStats())
|
||||
// return FALSE;
|
||||
|
||||
//Madd: Simple Localization
|
||||
//Read in the correct ammostring file for the given language
|
||||
strcpy(fileName, directoryName);
|
||||
#ifdef GERMAN
|
||||
strcat(fileName, GERMAN_PREFIX); // add German. prefix to filename
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
strcat(fileName, RUSSIAN_PREFIX); // add Russian. prefix to filename
|
||||
#endif
|
||||
strcat(fileName, AMMOFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInAmmoStats(fileName))
|
||||
return FALSE;
|
||||
|
||||
|
||||
// Lesh: added this, begin
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, BURSTSOUNDSFILENAME);
|
||||
@@ -117,6 +122,38 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
if(!ReadInItemStats(fileName))
|
||||
return FALSE;
|
||||
|
||||
//Madd: Simple localization
|
||||
// The idea here is that we can have a separate xml file that's named differently
|
||||
// but only contains the relevant tags that need to be localized
|
||||
// then when the file is read in using the same xml reader code, it will only overwrite
|
||||
// the tags that are contained in the localized file. This only works for items.xml
|
||||
// since I tweaked the xml_items.cpp to make it work :p
|
||||
// So for instance, the german file would be called German.Items.xml and would only contain
|
||||
// the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags
|
||||
|
||||
#ifdef GERMAN
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, GERMAN_PREFIX);
|
||||
strcat(fileName, ITEMSFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInItemStats(fileName))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, RUSSIAN_PREFIX);
|
||||
strcat(fileName, ITEMSFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInItemStats(fileName))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
//if(!WriteItemStats())
|
||||
// return FALSE;
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ typedef PARSE_STAGE;
|
||||
|
||||
#define TABLEDATA_DIRECTORY "TableData\\"
|
||||
|
||||
#define GERMAN_PREFIX "German."
|
||||
#define RUSSIAN_PREFIX "Russian."
|
||||
|
||||
|
||||
#define ATTACHMENTSFILENAME "Attachments.xml"
|
||||
#define ATTACHMENTINFOFILENAME "AttachmentInfo.xml"
|
||||
#define ITEMSFILENAME "Items.xml"
|
||||
|
||||
+12
-2
@@ -243,9 +243,19 @@ itemEndElementHandle(void *userData, const char *name)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if(pData->curItem.uiIndex < pData->maxArraySize && pData->curItem.usItemClass != 0)
|
||||
if(pData->curItem.uiIndex < pData->maxArraySize)
|
||||
{
|
||||
pData->curArray[pData->curItem.uiIndex] = pData->curItem; //write the item into the table
|
||||
if ( pData->curItem.usItemClass != 0 )
|
||||
pData->curArray[pData->curItem.uiIndex] = pData->curItem; //write the item into the table
|
||||
else if ( sizeof(pData->curItem.szItemName)>0 )
|
||||
{
|
||||
//Madd: needs testing
|
||||
strcpy(pData->curArray[pData->curItem.uiIndex].szItemName,pData->curItem.szItemName);
|
||||
strcpy(pData->curArray[pData->curItem.uiIndex].szLongItemName,pData->curItem.szLongItemName);
|
||||
strcpy(pData->curArray[pData->curItem.uiIndex].szBRName,pData->curItem.szBRName);
|
||||
strcpy(pData->curArray[pData->curItem.uiIndex].szItemDesc,pData->curItem.szItemDesc);
|
||||
strcpy(pData->curArray[pData->curItem.uiIndex].szBRDesc,pData->curItem.szBRDesc);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
|
||||
Reference in New Issue
Block a user