mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Setup failsafe to block NIV Mode if "Data" is specified as the CUSTOM_DATA_LOCATION.
Setup language specific files to be optional. Setup code to accept all language specific files for items.xml, pockets.xml and ammostrings.xml. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1953 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -474,7 +474,7 @@ BOOLEAN EnterGIOScreen()
|
||||
}
|
||||
|
||||
// CHRISL: New inventory options
|
||||
if(iResolution != 0 && gCustomDataCat.GetRootDir() != ""){
|
||||
if(IsNIVModeValid() == TRUE){
|
||||
usPosY = GIO_INV_SETTING_Y - GIO_OFFSET_TO_TOGGLE_BOX_Y;
|
||||
for( cnt=0; cnt<NUM_INV_OPTIONS; cnt++)
|
||||
{
|
||||
@@ -612,7 +612,7 @@ BOOLEAN ExitGIOScreen()
|
||||
RemoveButton( guiBROptionToggles[ cnt ] );
|
||||
|
||||
// CHRISL
|
||||
if(iResolution != 0 && gCustomDataCat.GetRootDir() != ""){
|
||||
if(IsNIVModeValid() == TRUE){
|
||||
for( cnt=0; cnt<NUM_INV_OPTIONS; cnt++)
|
||||
RemoveButton( guiINVOptionToggles[ cnt ] );
|
||||
}
|
||||
@@ -775,7 +775,7 @@ BOOLEAN RenderGIOScreen()
|
||||
DisplayWrappedString( (UINT16)(GIO_BR_SETTING_X+GIO_OFFSET_TO_TEXT), usPosY, GIO_DIF_SETTINGS_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_BR_AWESOME_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// CHRISL
|
||||
if(iResolution != 0 && gCustomDataCat.GetRootDir() != ""){
|
||||
if(IsNIVModeValid() == TRUE){
|
||||
DisplayWrappedString( GIO_INV_SETTING_X, (UINT16)(GIO_INV_SETTING_Y-GIO_GAP_BN_SETTINGS), GIO_DIF_SETTINGS_WIDTH + 20, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_INV_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
usPosY = GIO_INV_SETTING_Y+2;
|
||||
|
||||
@@ -1329,7 +1329,7 @@ void RestoreGIOButtonBackGrounds()
|
||||
}
|
||||
// CHRISL
|
||||
|
||||
if(iResolution != 0 && gCustomDataCat.GetRootDir() != ""){
|
||||
if(IsNIVModeValid() == TRUE){
|
||||
usPosY = GIO_INV_SETTING_Y-GIO_OFFSET_TO_TOGGLE_BOX_Y;
|
||||
for( cnt=0; cnt<NUM_INV_OPTIONS; cnt++)
|
||||
{
|
||||
@@ -1369,7 +1369,7 @@ void DoneFadeOutForExitGameInitOptionScreen( void )
|
||||
}
|
||||
|
||||
// CHRISL:
|
||||
if(iResolution != 0 && gCustomDataCat.GetRootDir() != ""){
|
||||
if(IsNIVModeValid() == TRUE){
|
||||
switch ( GetCurrentINVOptionButtonSetting() )
|
||||
{
|
||||
case GIO_INV_OLD:
|
||||
|
||||
+23
-1
@@ -72,6 +72,28 @@ bool UsingNewInventorySystem()
|
||||
return (gGameOptions.ubInventorySystem == INVENTORY_NEW);
|
||||
}
|
||||
|
||||
std::string StringToLower(std::string strToConvert)
|
||||
{//change each element of the string to lower case
|
||||
for(unsigned int i=0;i<strToConvert.length();i++)
|
||||
{
|
||||
strToConvert[i] = tolower(strToConvert[i]);
|
||||
}
|
||||
return strToConvert;//return the converted string
|
||||
}
|
||||
|
||||
BOOLEAN IsNIVModeValid(bool checkRes)
|
||||
{
|
||||
if(iResolution == 0 && checkRes == true)
|
||||
return( FALSE );
|
||||
if(gCustomDataCat.GetRootDir() == "")
|
||||
return( FALSE );
|
||||
char customDataPath[MAX_PATH];
|
||||
GetPrivateProfileString( "Ja2 Settings","CUSTOM_DATA_LOCATION", "", customDataPath, MAX_PATH, "..\\Ja2.ini" );
|
||||
if(StringToLower((std::string)customDataPath) == "data")
|
||||
return( FALSE );
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN LoadGameSettings()
|
||||
{
|
||||
HWFILE hFile;
|
||||
@@ -300,7 +322,7 @@ void InitGameOptions()
|
||||
gGameOptions.ubGameStyle = STYLE_SCIFI;
|
||||
gGameOptions.ubDifficultyLevel = DIF_LEVEL_MEDIUM;
|
||||
//CHRISL: override default inventory mode when in low res
|
||||
if(iResolution == 0 || gCustomDataCat.GetRootDir() == "")
|
||||
if(IsNIVModeValid() == FALSE)
|
||||
gGameOptions.ubInventorySystem = INVENTORY_OLD;
|
||||
else
|
||||
gGameOptions.ubInventorySystem = INVENTORY_NEW;
|
||||
|
||||
@@ -143,6 +143,7 @@ typedef struct
|
||||
} GAME_OPTIONS;
|
||||
|
||||
bool UsingNewInventorySystem();
|
||||
BOOLEAN IsNIVModeValid(bool checkRes = true);
|
||||
|
||||
// Snap: Options read from an INI file in the default of custom Data directory
|
||||
typedef struct
|
||||
|
||||
+4
-4
@@ -13,12 +13,12 @@
|
||||
#ifdef JA2EDITOR
|
||||
|
||||
//MAP EDITOR BUILD VERSION
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.1937" };
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.1953" };
|
||||
|
||||
#elif defined JA2BETAVERSION
|
||||
|
||||
//BETA/TEST BUILD VERSION
|
||||
CHAR16 zVersionLabel[256] = { L"Debug v1.13.1937" };
|
||||
CHAR16 zVersionLabel[256] = { L"Debug v1.13.1953" };
|
||||
|
||||
#elif defined CRIPPLED_VERSION
|
||||
|
||||
@@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
|
||||
#else
|
||||
|
||||
//RELEASE BUILD VERSION
|
||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.1937" };
|
||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.1953" };
|
||||
|
||||
#endif
|
||||
|
||||
CHAR8 czVersionNumber[16] = { "Build 08.03.29" }; //YY.MM.DD
|
||||
CHAR8 czVersionNumber[16] = { "Build 08.03.31" }; //YY.MM.DD
|
||||
CHAR16 zTrackingNumber[16] = { L"Z" };
|
||||
|
||||
|
||||
|
||||
@@ -185,11 +185,32 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
strcat(fileName, RUSSIAN_PREFIX); // add Russian. prefix to filename
|
||||
#endif
|
||||
#ifdef DUTCH
|
||||
strcat(fileName, DUTCH_PREFIX); // add Polish. prefix to filename
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
strcat(fileName, POLISH_PREFIX); // add Polish. prefix to filename
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
strcat(fileName, FRENCH_PREFIX); // add Polish. prefix to filename
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
strcat(fileName, ITALIAN_PREFIX); // add Polish. prefix to filename
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
strcat(fileName, TAIWANESE_PREFIX); // add Polish. prefix to filename
|
||||
#endif
|
||||
strcat(fileName, AMMOFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInAmmoStats(fileName))
|
||||
return FALSE;
|
||||
{
|
||||
//CHRISL: If we fail to load, try loading just the default english
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, AMMOFILENAME);
|
||||
if(!ReadInAmmoStats(fileName))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Lesh: added this, begin
|
||||
@@ -237,6 +258,61 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef DUTCH
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, DUTCH_PREFIX);
|
||||
strcat(fileName, ITEMSFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInItemStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, POLISH_PREFIX);
|
||||
strcat(fileName, ITEMSFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInItemStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, FRENCH_PREFIX);
|
||||
strcat(fileName, ITEMSFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInItemStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ITALIAN_PREFIX);
|
||||
strcat(fileName, ITEMSFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInItemStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, TAIWANESE_PREFIX);
|
||||
strcat(fileName, ITEMSFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInItemStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
//if(!WriteItemStats())
|
||||
// return FALSE;
|
||||
@@ -331,6 +407,61 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef DUTCH
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, DUTCH_PREFIX);
|
||||
strcat(fileName, LBEPOCKETFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInLBEPocketStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, POLISH_PREFIX);
|
||||
strcat(fileName, LBEPOCKETFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInLBEPocketStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, FRENCH_PREFIX);
|
||||
strcat(fileName, LBEPOCKETFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInLBEPocketStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ITALIAN_PREFIX);
|
||||
strcat(fileName, LBEPOCKETFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInLBEPocketStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, TAIWANESE_PREFIX);
|
||||
strcat(fileName, LBEPOCKETFILENAME);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInLBEPocketStats(fileName,TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// CHRISL:
|
||||
strcpy(fileName, directoryName);
|
||||
|
||||
+1
-1
@@ -2886,7 +2886,7 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID )
|
||||
gGameOptions.ubInventorySystem = SaveGameHeader.ubInventorySystem;
|
||||
if((UsingNewInventorySystem() == true))
|
||||
{
|
||||
if(iResolution == 0 || gCustomDataCat.GetRootDir() == ""){
|
||||
if(IsNIVModeValid() == FALSE){
|
||||
// Only load NewInv in higher screen res
|
||||
FileClose( hFile );
|
||||
return(FALSE);
|
||||
|
||||
+1
-1
@@ -2128,7 +2128,7 @@ void DoneFadeOutForSaveLoadScreen( void )
|
||||
DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_INV_RES_ERROR], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack );
|
||||
NextLoopCheckForEnoughFreeHardDriveSpace();
|
||||
}
|
||||
else if(UsingNewInventorySystem() == true && gCustomDataCat.GetRootDir() == "")
|
||||
else if(UsingNewInventorySystem() == true && IsNIVModeValid(false) == FALSE)
|
||||
{
|
||||
DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_INV_CUSTUM_ERROR], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack );
|
||||
NextLoopCheckForEnoughFreeHardDriveSpace();
|
||||
|
||||
@@ -25,6 +25,11 @@ typedef PARSE_STAGE;
|
||||
|
||||
#define GERMAN_PREFIX "German."
|
||||
#define RUSSIAN_PREFIX "Russian."
|
||||
#define DUTCH_PREFIX "Dutch."
|
||||
#define POLISH_PREFIX "Polish."
|
||||
#define FRENCH_PREFIX "French."
|
||||
#define ITALIAN_PREFIX "Italian."
|
||||
#define TAIWANESE_PREFIX "Tiawanese."
|
||||
|
||||
#define ATTACHMENTSFILENAME "Attachments.xml"
|
||||
#define ATTACHMENTINFOFILENAME "AttachmentInfo.xml"
|
||||
|
||||
@@ -372,8 +372,10 @@ BOOLEAN ReadInLBEPocketStats(STR fileName, BOOLEAN localizedVersion)
|
||||
|
||||
// Open loadbearingequipment file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
//CHRISL: If the file fails to load, then return the value of localizedVersion. This will allow the program to continue
|
||||
// to load if all we're missing are the localized xml files.
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
return( localizedVersion );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
+3
-1
@@ -1052,8 +1052,10 @@ BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion )
|
||||
|
||||
// Open items file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
//CHRISL: If the file fails to load, then return the value of localizedVersion. This will allow the program to continue
|
||||
// to load if all we're missing are the localized xml files.
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
return( localizedVersion );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Winmm.lib"
|
||||
OutputFile="$(OutDir)\ja2_deb_en_1937.exe"
|
||||
OutputFile="$(OutDir)\ja2_deb_en_1953.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
@@ -145,7 +145,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Winmm.lib"
|
||||
OutputFile="$(OutDir)\ja2_rel_en_1937.exe"
|
||||
OutputFile="$(OutDir)\ja2_rel_en_1953.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
GenerateMapFile="true"
|
||||
|
||||
Reference in New Issue
Block a user