mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Remove #ifdefs for USE_VFS
This commit is contained in:
+2
-41
@@ -83,9 +83,7 @@ INT32 iCurrFileShown;
|
||||
INT32 iLastFileClicked;
|
||||
INT32 iLastClickTime;
|
||||
|
||||
#ifdef USE_VFS
|
||||
CHAR8 gzProfileName[FILENAME_BUFLEN];//dnl ch81 021213
|
||||
#endif
|
||||
CHAR16 gzFilename[FILENAME_BUFLEN];//dnl ch39 190909
|
||||
extern INT16 gsSelSectorX;
|
||||
extern INT16 gsSelSectorY;
|
||||
@@ -165,7 +163,6 @@ void LoadSaveScreenEntry()
|
||||
}
|
||||
|
||||
iTopFileShown = iTotalFiles = 0;
|
||||
#ifdef USE_VFS//dnl ch37 300909
|
||||
gzProfileName[0] = 0;//dnl ch81 021213
|
||||
FDLG_LIST* TempFileList = NULL;
|
||||
vfs::CProfileStack* st = getVFS()->getProfileStack();
|
||||
@@ -220,25 +217,6 @@ void LoadSaveScreenEntry()
|
||||
}
|
||||
while(FileList->pPrev)
|
||||
FileList = FileList->pPrev;
|
||||
#else
|
||||
if(GetFileFirst("MAPS\\*.dat", &FileInfo))
|
||||
{
|
||||
if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
|
||||
{
|
||||
FileList = AddToFDlgList(FileList, &FileInfo);
|
||||
iTotalFiles++;
|
||||
}
|
||||
while(GetFileNext(&FileInfo))
|
||||
{
|
||||
if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
|
||||
{
|
||||
FileList = AddToFDlgList(FileList, &FileInfo);
|
||||
iTotalFiles++;
|
||||
}
|
||||
}
|
||||
GetFileClose(&FileInfo);
|
||||
}
|
||||
#endif
|
||||
swprintf( zOrigName, L"%s Map (*.dat)", iCurrentAction == ACTION_SAVE_MAP ? L"Save" : L"Load" );
|
||||
|
||||
swprintf( gzFilename, L"%S", gubFilename );
|
||||
@@ -283,7 +261,8 @@ UINT32 ProcessLoadSaveScreenMessageBoxResult()
|
||||
{
|
||||
if( gfReadOnly )
|
||||
{
|
||||
FileClearAttributes( gszCurrFilename );
|
||||
// Other call sites have replaced this with FileDelete(); for VFS, should we do the same here?
|
||||
//FileClearAttributes( gszCurrFilename );
|
||||
gfReadOnly = FALSE;
|
||||
}
|
||||
FileDelete( gszCurrFilename );
|
||||
@@ -468,19 +447,6 @@ UINT32 LoadSaveScreenHandle(void)
|
||||
}
|
||||
sprintf(gszCurrFilename, "MAPS\\%S", gzFilename);
|
||||
gfFileExists = FALSE;
|
||||
#ifndef USE_VFS
|
||||
gfReadOnly = FALSE;
|
||||
if(FileExists(gszCurrFilename))
|
||||
{
|
||||
gfFileExists = TRUE;
|
||||
if(GetFileFirst(gszCurrFilename, &FileInfo))
|
||||
{
|
||||
if(FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_DIRECTORY|FILE_IS_HIDDEN|FILE_IS_SYSTEM|FILE_IS_OFFLINE|FILE_IS_TEMPORARY))
|
||||
gfReadOnly = TRUE;
|
||||
GetFileClose(&FileInfo);
|
||||
}
|
||||
}
|
||||
#else
|
||||
gfReadOnly = TRUE;
|
||||
vfs::CProfileStack* st = getVFS()->getProfileStack();
|
||||
vfs::CProfileStack::Iterator it = st->begin();
|
||||
@@ -502,7 +468,6 @@ UINT32 LoadSaveScreenHandle(void)
|
||||
}
|
||||
it.next();
|
||||
}
|
||||
#endif
|
||||
if(gfReadOnly)
|
||||
{
|
||||
CreateMessageBox(L" File is read only! Choose a different name? ");
|
||||
@@ -726,7 +691,6 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
|
||||
iLastClickTime = iCurrClickTime;
|
||||
iLastFileClicked = x;
|
||||
//dnl ch81 021213
|
||||
#ifdef USE_VFS
|
||||
gzProfileName[0] = 0;
|
||||
while(FListNode = FListNode->pPrev)
|
||||
{
|
||||
@@ -737,7 +701,6 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
FListNode = FListNode->pNext;
|
||||
@@ -950,7 +913,6 @@ void HandleMainKeyEvents( InputAtom *pEvent )
|
||||
SetInputFieldStringWith16BitString(0, L"");
|
||||
wcscpy(gzFilename, L"");
|
||||
}
|
||||
#ifdef USE_VFS
|
||||
gzProfileName[0] = 0;
|
||||
while(curr = curr->pPrev)
|
||||
{
|
||||
@@ -961,7 +923,6 @@ void HandleMainKeyEvents( InputAtom *pEvent )
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,9 +51,7 @@ extern CHAR16 gzErrorCatchString[ 256 ];
|
||||
|
||||
//dnl ch81 031213
|
||||
extern CHAR16 gzFilename[FILENAME_BUFLEN];
|
||||
#ifdef USE_VFS
|
||||
extern CHAR8 gzProfileName[FILENAME_BUFLEN];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1923,40 +1923,14 @@ BOOLEAN HandleSummaryInput( InputAtom *pEvent )
|
||||
|
||||
void CreateGlobalSummary()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
STRING512 Dir;
|
||||
STRING512 ExecDir;
|
||||
#endif
|
||||
OutputDebugString( "Generating GlobalSummary Information...\n" );
|
||||
|
||||
gfGlobalSummaryExists = FALSE;
|
||||
//Set current directory to JA2\DevInfo which contains all of the summary data
|
||||
#ifndef USE_VFS
|
||||
GetExecutableDirectory( ExecDir );
|
||||
sprintf( Dir, "%s\\DevInfo", ExecDir );
|
||||
|
||||
// Snap: save current directory
|
||||
//GetFileManCurrentDirectory( DataDir );
|
||||
|
||||
//Directory doesn't exist, so create it, and continue.
|
||||
if( !MakeFileManDirectory( Dir ) )
|
||||
AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." );
|
||||
if( !SetFileManCurrentDirectory( Dir ) )
|
||||
AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." );
|
||||
|
||||
//Generate a simple readme file.
|
||||
fp = fopen( "readme.txt", "w" );
|
||||
Assert( fp );
|
||||
fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.",
|
||||
"This directory or it's contents shouldn't be included with final release." );
|
||||
fclose( fp );
|
||||
#else
|
||||
vfs::COpenWriteFile wfile(L"DevInfo\\readme.txt",true,true);
|
||||
std::string str = "This information is used in conjunction with the editor.\n";
|
||||
str += "This directory or it's contents shouldn't be included with final release.\n";
|
||||
SGP_TRYCATCH_RETHROW( wfile->write(str.c_str(), str.length()), L"" );
|
||||
#endif
|
||||
|
||||
// Snap: Restore the data directory once we are finished.
|
||||
//SetFileManCurrentDirectory( DataDir );
|
||||
@@ -2281,12 +2255,6 @@ void CalculateOverrideStatus()
|
||||
void LoadGlobalSummary()
|
||||
{
|
||||
HWFILE hfile;
|
||||
#ifndef USE_VFS
|
||||
STRING512 DataDir;
|
||||
STRING512 ExecDir;
|
||||
STRING512 DevInfoDir;
|
||||
STRING512 MapsDir;
|
||||
#endif
|
||||
UINT32 uiNumBytesRead;
|
||||
FLOAT dMajorVersion;
|
||||
INT32 x,y;
|
||||
@@ -2295,34 +2263,16 @@ void LoadGlobalSummary()
|
||||
|
||||
OutputDebugString( "Executing LoadGlobalSummary()...\n" );
|
||||
// Snap: save current directory
|
||||
#ifndef USE_VFS
|
||||
GetFileManCurrentDirectory( DataDir );
|
||||
#endif
|
||||
gfMustForceUpdateAllMaps = FALSE;
|
||||
gusNumberOfMapsToBeForceUpdated = 0;
|
||||
gfGlobalSummaryExists = FALSE;
|
||||
|
||||
//Set current directory to JA2\DevInfo which contains all of the summary data
|
||||
#ifndef USE_VFS
|
||||
GetExecutableDirectory( ExecDir );
|
||||
sprintf( DevInfoDir, "%s\\DevInfo", ExecDir );
|
||||
sprintf( MapsDir, "%s\\Maps", DataDir );
|
||||
//Check to make sure we have a DevInfo directory. If we don't create one!
|
||||
if( !SetFileManCurrentDirectory( DevInfoDir ) )
|
||||
{
|
||||
OutputDebugString( "LoadGlobalSummary() aborted -- doesn't exist on this local computer.\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
//TEMP
|
||||
#ifndef USE_VFS
|
||||
FileDelete( "_global.sum" );
|
||||
#else
|
||||
if(FileExists("DevInfo\\_global.sum"))
|
||||
{
|
||||
FileDelete( "DevInfo\\_global.sum" );
|
||||
}
|
||||
#endif
|
||||
gfGlobalSummaryExists = TRUE;
|
||||
|
||||
//Analyse all sectors to see if matching maps exist. For any maps found, the information
|
||||
@@ -2337,19 +2287,12 @@ void LoadGlobalSummary()
|
||||
sprintf( szSector, "%c%d", 'A' + y, x + 1 );
|
||||
|
||||
//main ground level
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%c%d.dat", 'A' + y, x + 1 );
|
||||
SetFileManCurrentDirectory( MapsDir );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
SetFileManCurrentDirectory( DevInfoDir );
|
||||
#else
|
||||
sprintf( szFilename, "Maps\\%c%d.dat", 'A' + y, x + 1 );
|
||||
hfile = NULL;
|
||||
if(FileExists(szFilename))
|
||||
{
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
}
|
||||
#endif
|
||||
if( hfile )
|
||||
{
|
||||
gbSectorLevels[x][y] |= GROUND_LEVEL_MASK;
|
||||
@@ -2359,27 +2302,16 @@ void LoadGlobalSummary()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%s.sum", szSector );
|
||||
#else
|
||||
sprintf( szFilename, "DevInfo\\%s.sum", szSector );
|
||||
#endif
|
||||
FileDelete( szFilename );
|
||||
}
|
||||
//main B1 level
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%c%d_b1.dat", 'A' + y, x + 1 );
|
||||
SetFileManCurrentDirectory( MapsDir );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
SetFileManCurrentDirectory( DevInfoDir );
|
||||
#else
|
||||
sprintf( szFilename, "Maps\\%c%d_b1.dat", 'A' + y, x + 1 );
|
||||
hfile = NULL;
|
||||
if(FileExists(szFilename))
|
||||
{
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
}
|
||||
#endif
|
||||
if( hfile )
|
||||
{
|
||||
gbSectorLevels[x][y] |= BASEMENT1_LEVEL_MASK;
|
||||
@@ -2389,27 +2321,16 @@ void LoadGlobalSummary()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%s_b1.sum", szSector );
|
||||
#else
|
||||
sprintf( szFilename, "DevInfo\\%s_b1.sum", szSector );
|
||||
#endif
|
||||
FileDelete( szFilename );
|
||||
}
|
||||
//main B2 level
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%c%d_b2.dat", 'A' + y, x + 1 );
|
||||
SetFileManCurrentDirectory( MapsDir );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
SetFileManCurrentDirectory( DevInfoDir );
|
||||
#else
|
||||
sprintf( szFilename, "Maps\\%c%d_b2.dat", 'A' + y, x + 1 );
|
||||
hfile = NULL;
|
||||
if(FileExists(szFilename))
|
||||
{
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
}
|
||||
#endif
|
||||
if( hfile )
|
||||
{
|
||||
gbSectorLevels[x][y] |= BASEMENT2_LEVEL_MASK;
|
||||
@@ -2419,27 +2340,16 @@ void LoadGlobalSummary()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%s_b2.sum", szSector );
|
||||
#else
|
||||
sprintf( szFilename, "DevInfo\\%s_b2.sum", szSector );
|
||||
#endif
|
||||
FileDelete( szFilename );
|
||||
}
|
||||
//main B3 level
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%c%d_b3.dat", 'A' + y, x + 1 );
|
||||
SetFileManCurrentDirectory( MapsDir );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
SetFileManCurrentDirectory( DevInfoDir );
|
||||
#else
|
||||
sprintf( szFilename, "Maps\\%c%d_b3.dat", 'A' + y, x + 1 );
|
||||
hfile = NULL;
|
||||
if(FileExists(szFilename))
|
||||
{
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
}
|
||||
#endif
|
||||
if( hfile )
|
||||
{
|
||||
gbSectorLevels[x][y] |= BASEMENT3_LEVEL_MASK;
|
||||
@@ -2449,27 +2359,16 @@ void LoadGlobalSummary()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%s_b3.sum", szSector );
|
||||
#else
|
||||
sprintf( szFilename, "DevInfo\\%s_b3.sum", szSector );
|
||||
#endif
|
||||
FileDelete( szFilename );
|
||||
}
|
||||
//alternate ground level
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%c%d_a.dat", 'A' + y, x + 1 );
|
||||
SetFileManCurrentDirectory( MapsDir );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
SetFileManCurrentDirectory( DevInfoDir );
|
||||
#else
|
||||
sprintf( szFilename, "Maps\\%c%d_a.dat", 'A' + y, x + 1 );
|
||||
hfile = NULL;
|
||||
if(FileExists(szFilename))
|
||||
{
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
}
|
||||
#endif
|
||||
if( hfile )
|
||||
{
|
||||
gbSectorLevels[x][y] |= ALTERNATE_GROUND_MASK;
|
||||
@@ -2479,27 +2378,16 @@ void LoadGlobalSummary()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%s_a.sum", szSector );
|
||||
#else
|
||||
sprintf( szFilename, "DevInfo\\%s_a.sum", szSector );
|
||||
#endif
|
||||
FileDelete( szFilename );
|
||||
}
|
||||
//alternate B1 level
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%c%d_b1_a.dat", 'A' + y, x + 1 );
|
||||
SetFileManCurrentDirectory( MapsDir );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
SetFileManCurrentDirectory( DevInfoDir );
|
||||
#else
|
||||
sprintf( szFilename, "Maps\\%c%d_b1_a.dat", 'A' + y, x + 1 );
|
||||
hfile = NULL;
|
||||
if(FileExists(szFilename))
|
||||
{
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
}
|
||||
#endif
|
||||
if( hfile )
|
||||
{
|
||||
gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;
|
||||
@@ -2509,27 +2397,16 @@ void LoadGlobalSummary()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%s_b1_a.sum", szSector );
|
||||
#else
|
||||
sprintf( szFilename, "DevInfo\\%s_b1_a.sum", szSector );
|
||||
#endif
|
||||
FileDelete( szFilename );
|
||||
}
|
||||
//alternate B2 level
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%c%d_b2_a.dat", 'A' + y, x + 1 );
|
||||
SetFileManCurrentDirectory( MapsDir );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
SetFileManCurrentDirectory( DevInfoDir );
|
||||
#else
|
||||
sprintf( szFilename, "Maps\\%c%d_b2_a.dat", 'A' + y, x + 1 );
|
||||
hfile = NULL;
|
||||
if(FileExists(szFilename))
|
||||
{
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
}
|
||||
#endif
|
||||
if( hfile )
|
||||
{
|
||||
gbSectorLevels[x][y] |= ALTERNATE_B2_MASK;
|
||||
@@ -2539,27 +2416,16 @@ void LoadGlobalSummary()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%s_b2_a.sum", szSector );
|
||||
#else
|
||||
sprintf( szFilename, "DevInfo\\%s_b2_a.sum", szSector );
|
||||
#endif
|
||||
FileDelete( szFilename );
|
||||
}
|
||||
//alternate B3 level
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%c%d_b3_a.dat", 'A' + y, x + 1 );
|
||||
SetFileManCurrentDirectory( MapsDir );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
SetFileManCurrentDirectory( DevInfoDir );
|
||||
#else
|
||||
sprintf( szFilename, "Maps\\%c%d_b3_a.dat", 'A' + y, x + 1 );
|
||||
hfile = NULL;
|
||||
if(FileExists(szFilename))
|
||||
{
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
}
|
||||
#endif
|
||||
if( hfile )
|
||||
{
|
||||
gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;;
|
||||
@@ -2569,20 +2435,12 @@ void LoadGlobalSummary()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
sprintf( szFilename, "%s_b3_a.sum", szSector );
|
||||
#else
|
||||
sprintf( szFilename, "DevInfo\\%s_b3_a.sum", szSector );
|
||||
#endif
|
||||
FileDelete( szFilename );
|
||||
}
|
||||
}
|
||||
OutputDebugString( (LPCSTR)String("Sector Row %c complete... \n", y + 'A') );
|
||||
}
|
||||
#ifndef USE_VFS
|
||||
// Snap: Restore the data directory once we are finished.
|
||||
SetFileManCurrentDirectory( DataDir );
|
||||
#endif
|
||||
//sprintf( MapsDir, "%s\\Data", ExecDir );
|
||||
//SetFileManCurrentDirectory( MapsDir );
|
||||
|
||||
@@ -2599,39 +2457,6 @@ void LoadGlobalSummary()
|
||||
|
||||
void GenerateSummaryList()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
STRING512 DataDir;
|
||||
STRING512 ExecDir;
|
||||
STRING512 Dir;
|
||||
|
||||
// Snap: save current directory
|
||||
GetFileManCurrentDirectory( DataDir );
|
||||
|
||||
//Set current directory to JA2\DevInfo which contains all of the summary data
|
||||
GetExecutableDirectory( ExecDir );
|
||||
sprintf( Dir, "%s\\DevInfo", ExecDir );
|
||||
if( !SetFileManCurrentDirectory( Dir ) )
|
||||
{
|
||||
//Directory doesn't exist, so create it, and continue.
|
||||
if( !MakeFileManDirectory( Dir ) )
|
||||
AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." );
|
||||
if( !SetFileManCurrentDirectory( Dir ) )
|
||||
AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." );
|
||||
//Generate a simple readme file.
|
||||
fp = fopen( "readme.txt", "w" );
|
||||
Assert( fp );
|
||||
fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.",
|
||||
"This directory or it's contents shouldn't be included with final release." );
|
||||
fclose( fp );
|
||||
}
|
||||
|
||||
// Snap: Restore the data directory once we are finished.
|
||||
SetFileManCurrentDirectory( DataDir );
|
||||
//Set current directory back to data directory!
|
||||
//sprintf( Dir, "%s\\Data", ExecDir );
|
||||
//SetFileManCurrentDirectory( Dir );
|
||||
#else
|
||||
try
|
||||
{
|
||||
vfs::COpenWriteFile wfile(L"DevInfo/readme.txt",true,true);
|
||||
@@ -2643,7 +2468,6 @@ void GenerateSummaryList()
|
||||
{
|
||||
SGP_RETHROW(L"Could not create readme.txt", ex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//dnl ch28 260909
|
||||
|
||||
Reference in New Issue
Block a user