mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Brief: //dnl ch81
- Fix several problems with summary windows and improve map loading to any map for mapeditor. Details: - Add option from CTRL+L list box to load any map from any listed profiles. - Fix incorrect loading of items option in summary window for non vanilla maps. - Fix improper popup of radio boxes for when items is selected in summary window and summary file or map not exist. - Summary items information is now show for non sector custom map files too. - Fix glitches when switching from overhead map to sector summary windows. - Fix improper opening of exit screen text box during exit from overhead map. - Change size to fixed macro of all temporary buffers for map filename. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6687 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+19
-1
@@ -88,6 +88,9 @@ 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;
|
||||
@@ -167,6 +170,7 @@ 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();
|
||||
vfs::CProfileStack::Iterator it = st->begin();
|
||||
@@ -725,6 +729,20 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
|
||||
}
|
||||
iLastClickTime = iCurrClickTime;
|
||||
iLastFileClicked = x;
|
||||
//dnl ch81 021213
|
||||
#ifdef USE_VFS
|
||||
gzProfileName[0] = 0;
|
||||
while(FListNode = FListNode->pPrev)
|
||||
{
|
||||
if(FListNode->FileInfo.zFileName[0] == '<')
|
||||
{
|
||||
strcpy(gzProfileName, &FListNode->FileInfo.zFileName[2]);
|
||||
gzProfileName[strlen(gzProfileName)-2] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
FListNode = FListNode->pNext;
|
||||
}
|
||||
@@ -970,7 +988,7 @@ extern BOOLEAN ReEvaluateWorld( const STR8 puiFilename );
|
||||
UINT32 ProcessFileIO()
|
||||
{
|
||||
INT16 usStartX, usStartY;
|
||||
CHAR8 ubNewFilename[50];
|
||||
CHAR8 ubNewFilename[FILENAME_BUFLEN];//dnl ch81 021213
|
||||
BOOLEAN fAltMap;//dnl ch31 150909
|
||||
switch( gbCurrentFileIOStatus )
|
||||
{
|
||||
|
||||
+7
-14
@@ -1,6 +1,8 @@
|
||||
#include "BuildDefines.h"
|
||||
#include "Fileman.h"
|
||||
|
||||
#define FILENAME_BUFLEN (20 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213
|
||||
|
||||
#ifdef JA2EDITOR
|
||||
|
||||
#ifndef _JA2_LOAD_SCREEN_
|
||||
@@ -47,20 +49,11 @@ void InitErrorCatchDialog();
|
||||
extern BOOLEAN gfErrorCatch;
|
||||
extern CHAR16 gzErrorCatchString[ 256 ];
|
||||
|
||||
#define FILENAME_BUFLEN (20 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0'
|
||||
//dnl ch81 031213
|
||||
extern CHAR16 gzFilename[FILENAME_BUFLEN];
|
||||
#ifdef USE_VFS
|
||||
extern CHAR8 gzProfileName[FILENAME_BUFLEN];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+209
-7
@@ -97,7 +97,7 @@ BOOLEAN LoadSummary(STR8 pSector, UINT8 ubLevel, FLOAT dMajorMapVersion);//dnl c
|
||||
|
||||
void RegenerateSummaryInfoForAllOutdatedMaps();
|
||||
|
||||
void SetupItemDetailsMode( BOOLEAN fAllowRecursion );
|
||||
void SetupItemDetailsMode(BOOLEAN fAllowRecursion);//dnl ch81 051213
|
||||
|
||||
INT32 giCurrentViewLevel = ALL_LEVELS_MASK;
|
||||
|
||||
@@ -545,7 +545,7 @@ void RenderSectorInformation()
|
||||
ePoints++;
|
||||
//start at 10,35
|
||||
SetFontForeground( FONT_ORANGE );
|
||||
mprintf( iScreenWidthOffset + 10, iScreenHeightOffset + 32, pRenderSectorInformationText[0], gTilesets[ s->ubTilesetID ].zName );
|
||||
mprintf( iScreenWidthOffset + 10, iScreenHeightOffset + 32, pRenderSectorInformationText[0], gTilesets[ s->ubTilesetID ].zName );
|
||||
if( m->ubMapVersion < 10 )
|
||||
SetFontForeground( FONT_RED );
|
||||
mprintf(iScreenWidthOffset+10, iScreenHeightOffset+42, pRenderSectorInformationText[1], s->ubSummaryVersion, s->dMajorMapVersion, m->ubMapVersion);//dnl ch30 240909
|
||||
@@ -1060,7 +1060,8 @@ void RenderSummaryWindow()
|
||||
{
|
||||
DisableButton( iSummaryButton[ SUMMARY_LOAD ] );
|
||||
SetFontForeground( FONT_LTRED );
|
||||
mprintf( iScreenWidthOffset + 10, iScreenHeightOffset + 20, pRenderSummaryWindowText[7] );
|
||||
if( !gfItemDetailsMode )//dnl ch81 031213
|
||||
mprintf( iScreenWidthOffset + 10, iScreenHeightOffset + 20, pRenderSummaryWindowText[7] );
|
||||
if( gfTempFile )
|
||||
{
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
@@ -1073,10 +1074,25 @@ void RenderSummaryWindow()
|
||||
mprintf( iScreenWidthOffset + 10, iScreenHeightOffset + 30, pRenderSummaryWindowText[9] );
|
||||
mprintf( iScreenWidthOffset + 10, iScreenHeightOffset + 40, pRenderSummaryWindowText[10] );
|
||||
}
|
||||
else if(gCustomFileSectorSummary.ubSummaryVersion)//dnl ch30 150909
|
||||
else if(gCustomFileSectorSummary.ubSummaryVersion)//dnl ch30 150909 //dnl ch81 031213
|
||||
{
|
||||
gpCurrentSectorSummary = &gCustomFileSectorSummary;
|
||||
RenderSectorInformation();
|
||||
wcscpy(gszFilename, gzFilename);
|
||||
wcscpy(gszDisplayName, gszFilename);
|
||||
if(gfItemDetailsMode)
|
||||
{
|
||||
SetupItemDetailsMode(TRUE);
|
||||
SetFontForeground(FONT_YELLOW);
|
||||
mprintf(iScreenWidthOffset+10, iScreenHeightOffset+5, pRenderSummaryWindowText[19], gszDisplayName);
|
||||
RenderItemDetails();
|
||||
}
|
||||
else
|
||||
{
|
||||
HideButton(iSummaryButton[SUMMARY_REAL]);
|
||||
HideButton(iSummaryButton[SUMMARY_SCIFI]);
|
||||
HideButton(iSummaryButton[SUMMARY_ENEMY]);
|
||||
RenderSectorInformation();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1260,6 +1276,10 @@ void RenderSummaryWindow()
|
||||
mprintf( iScreenWidthOffset + 10, iScreenHeightOffset + 30, pRenderSummaryWindowText[24] );
|
||||
}
|
||||
ShowButton( iSummaryButton[ SUMMARY_UPDATE ] );
|
||||
//dnl ch81 041213
|
||||
HideButton(iSummaryButton[SUMMARY_REAL]);
|
||||
HideButton(iSummaryButton[SUMMARY_SCIFI]);
|
||||
HideButton(iSummaryButton[SUMMARY_ENEMY]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1292,6 +1312,11 @@ void RenderSummaryWindow()
|
||||
}
|
||||
swprintf( gszDisplayName, gszFilename );
|
||||
DisableButton( iSummaryButton[ SUMMARY_LOAD ] );
|
||||
//dnl ch81 031213
|
||||
HideButton(iSummaryButton[SUMMARY_UPDATE]);
|
||||
HideButton(iSummaryButton[SUMMARY_REAL]);
|
||||
HideButton(iSummaryButton[SUMMARY_SCIFI]);
|
||||
HideButton(iSummaryButton[SUMMARY_ENEMY]);
|
||||
}
|
||||
SPECIALCASE_LABEL:
|
||||
if( gfOverrideDirty && gfPersistantSummary )
|
||||
@@ -1747,6 +1772,8 @@ void SummaryToggleAlternateCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
gfAlternateMaps = FALSE;
|
||||
}
|
||||
gfRenderSummary = TRUE;
|
||||
if(gfItemDetailsMode)//dnl ch81 041213
|
||||
gfSetupItemDetailsMode = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1931,6 +1958,10 @@ BOOLEAN HandleSummaryInput( InputAtom *pEvent )
|
||||
case SHIFT_RIGHTARROW:
|
||||
|
||||
break;
|
||||
#ifdef dnlTEST//dnl ch81 051213
|
||||
case '\'':
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if( pEvent->usEvent == KEY_UP )
|
||||
@@ -2124,6 +2155,8 @@ void SummaryToggleLevelCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
if( GetActiveFieldID() == 1 )
|
||||
SelectNextField();
|
||||
gfRenderSummary = TRUE;
|
||||
if(gfItemDetailsMode)//dnl ch81 041213
|
||||
gfSetupItemDetailsMode = TRUE;
|
||||
for( i = SUMMARY_ALL; i <= SUMMARY_B3; i++ )
|
||||
{
|
||||
if( btn->IDNum == iSummaryButton[ i ] )
|
||||
@@ -3021,6 +3054,8 @@ void SummaryUpdateCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1][ gsSelSectorY - 1][ giCurrLevel ];
|
||||
|
||||
gfRenderSummary = TRUE;
|
||||
if(gfItemDetailsMode)//dnl ch81 041213
|
||||
gfSetupItemDetailsMode = TRUE;
|
||||
|
||||
RemoveProgressBar( 0 );
|
||||
}
|
||||
@@ -3045,11 +3080,11 @@ void ExtractTempFilename()
|
||||
BOOLEAN ReEvaluateWorld(const STR8 puiFilename)
|
||||
{
|
||||
UINT8 ubLevel;
|
||||
CHAR8 name[50];
|
||||
CHAR8 name[FILENAME_BUFLEN];//dnl ch81 021213
|
||||
INT16 sSectorX, sSectorY;
|
||||
INT8 bSectorZ;
|
||||
BOOLEAN fAltMap;
|
||||
CHAR16 szFileName[50];
|
||||
CHAR16 szFileName[FILENAME_BUFLEN];//dnl ch81 021213
|
||||
swprintf(szFileName, L"%S", puiFilename);
|
||||
GetSectorFromFileName(szFileName, sSectorX, sSectorY, bSectorZ, fAltMap);
|
||||
/*
|
||||
@@ -3223,6 +3258,7 @@ void ApologizeOverrideAndForceUpdateEverything()
|
||||
gusNumberOfMapsToBeForceUpdated = 0;
|
||||
}
|
||||
|
||||
#if 0//dnl ch81 041213 this function is screwed up so decide to rewrite it
|
||||
//CHRISL: ADB changed the way this load file is handled
|
||||
extern int gEnemyPreservedTempFileVersion[256];
|
||||
extern int gCivPreservedTempFileVersion[256];
|
||||
@@ -3435,6 +3471,172 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
|
||||
}
|
||||
FileClose( hfile );
|
||||
}
|
||||
#else
|
||||
void SetupItemDetailsMode(BOOLEAN fAllowRecursion)
|
||||
{
|
||||
UINT32 uiNumItems, uiFileSize, uiBytesRead;
|
||||
INT32 i, j;
|
||||
UINT16 usNumItems, usPEnemyIndex, usNEnemyIndex;
|
||||
UINT8 ubMinorMapVersion;
|
||||
INT8 *pBuffer, *pBufferHead;
|
||||
CHAR8 szFilename[40];
|
||||
HWFILE hfile;
|
||||
FLOAT dMajorMapVersion;
|
||||
OBJECTTYPE *pItem;
|
||||
BASIC_SOLDIERCREATE_STRUCT basic;
|
||||
SOLDIERCREATE_STRUCT priority;
|
||||
|
||||
//Clear memory for all the item summaries loaded
|
||||
if(gpWorldItemsSummaryArray)
|
||||
{
|
||||
delete[] gpWorldItemsSummaryArray;
|
||||
gpWorldItemsSummaryArray = NULL;
|
||||
gusWorldItemsSummaryArraySize = 0;
|
||||
}
|
||||
if(gpPEnemyItemsSummaryArray)
|
||||
{
|
||||
delete[] gpPEnemyItemsSummaryArray;
|
||||
gpPEnemyItemsSummaryArray = NULL;
|
||||
gusPEnemyItemsSummaryArraySize = 0;
|
||||
}
|
||||
if(gpNEnemyItemsSummaryArray)
|
||||
{
|
||||
delete[] gpNEnemyItemsSummaryArray;
|
||||
gpNEnemyItemsSummaryArray = NULL;
|
||||
gusNEnemyItemsSummaryArraySize = 0;
|
||||
}
|
||||
// Don't have one, so generate them
|
||||
if(!gpCurrentSectorSummary->uiNumItemsPosition)
|
||||
{
|
||||
if(gpCurrentSectorSummary->ubSummaryVersion == GLOBAL_SUMMARY_VERSION)
|
||||
gusNumEntriesWithOutdatedOrNoSummaryInfo++;
|
||||
SummaryUpdateCallback(ButtonList[iSummaryButton[SUMMARY_UPDATE]], MSYS_CALLBACK_REASON_LBUTTON_UP);
|
||||
if(!gpCurrentSectorSummary->uiNumItemsPosition)
|
||||
return;
|
||||
}
|
||||
//Open the original map for the sector
|
||||
sprintf(szFilename, "MAPS\\%S", gszFilename);
|
||||
hfile = FileOpen(szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE);
|
||||
if(!hfile)// The file couldn't be found!
|
||||
return;
|
||||
uiFileSize = FileGetSize(hfile);
|
||||
if(!uiFileSize)
|
||||
return;
|
||||
pBuffer = (INT8*)MemAlloc(uiFileSize);
|
||||
pBufferHead = pBuffer;
|
||||
FileRead(hfile, pBuffer, uiFileSize, &uiBytesRead);
|
||||
FileClose(hfile);
|
||||
dMajorMapVersion = *(FLOAT *)pBuffer;
|
||||
if(dMajorMapVersion >= 4.00)
|
||||
ubMinorMapVersion = pBuffer[sizeof(FLOAT)];
|
||||
else
|
||||
ubMinorMapVersion = 0;
|
||||
uiNumItems = 0;
|
||||
if(gpCurrentSectorSummary->uiNumItemsPosition)
|
||||
{
|
||||
// Now fileseek directly to the file position where the number of world items are stored
|
||||
SKIPDATA(pBuffer, pBufferHead, gpCurrentSectorSummary->uiNumItemsPosition);
|
||||
if((UINT32)(pBuffer-pBufferHead) > uiFileSize)
|
||||
{
|
||||
L01:
|
||||
if(fAllowRecursion)
|
||||
{
|
||||
gpCurrentSectorSummary->uiNumItemsPosition = 0;
|
||||
SetupItemDetailsMode(FALSE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Now load the number of world items from the map
|
||||
LOADDATA(&uiNumItems, pBuffer, sizeof(UINT32));
|
||||
if((UINT32)(pBuffer-pBufferHead) > uiFileSize)
|
||||
goto L01;
|
||||
}
|
||||
// Now compare this number with the number the summary thinks we should have. If they are different, then the summary doesn't match the map. What we will do is force regenerate the map so that they do match
|
||||
if(uiNumItems != gpCurrentSectorSummary->usNumItems)
|
||||
goto L01;
|
||||
//Passed the gauntlet, so now allocate memory for it, and load all the world items into this array.
|
||||
ShowButton(iSummaryButton[SUMMARY_SCIFI]);
|
||||
ShowButton(iSummaryButton[SUMMARY_REAL]);
|
||||
ShowButton(iSummaryButton[SUMMARY_ENEMY]);
|
||||
gpWorldItemsSummaryArray = new WORLDITEM[uiNumItems];
|
||||
gusWorldItemsSummaryArraySize = gpCurrentSectorSummary->usNumItems;
|
||||
for(i=0; i<(INT32)uiNumItems; i++)
|
||||
gpWorldItemsSummaryArray[i].Load(&pBuffer, dMajorMapVersion, ubMinorMapVersion);
|
||||
// Now, do the enemy's items! We need to do two passes. The first pass simply processes all the enemies and counts all the droppable items keeping track of two different values.
|
||||
// The first value is the number of droppable items that come off of enemy detailed placements, the other counter keeps track of the number of droppable items that come off of normal enemy placements.
|
||||
// After doing this, the memory is allocated for the tables that will store all the item summary information, then the second pass will repeat the process, except it will record the actual items.
|
||||
// PASS #1
|
||||
SKIPDATA(pBuffer, pBufferHead, gpCurrentSectorSummary->uiEnemyPlacementPosition);
|
||||
for(i=0; i<gpCurrentSectorSummary->MapInfo.ubNumIndividuals; i++)
|
||||
{
|
||||
basic.Load(&pBuffer, dMajorMapVersion);
|
||||
if((UINT32)(pBuffer-pBufferHead) > uiFileSize)
|
||||
goto L01;
|
||||
if(basic.fDetailedPlacement)// skip static priority placement
|
||||
{
|
||||
priority.Load(&pBuffer, dMajorMapVersion, ubMinorMapVersion);
|
||||
if((UINT32)(pBuffer-pBufferHead) > uiFileSize)
|
||||
goto L01;
|
||||
}
|
||||
else//non detailed placements don't have items, so skip
|
||||
continue;
|
||||
if(basic.bTeam == ENEMY_TEAM)
|
||||
{
|
||||
//Count the items that this enemy placement drops
|
||||
usNumItems = 0;
|
||||
for(j=0; j<9; j++)
|
||||
{
|
||||
pItem = &priority.Inv[gbMercSlotTypes[j]];
|
||||
if(pItem->exists() == true && !((*pItem).fFlags & OBJECT_UNDROPPABLE))
|
||||
usNumItems++;
|
||||
}
|
||||
if(basic.fPriorityExistance)
|
||||
gusPEnemyItemsSummaryArraySize += usNumItems;
|
||||
else
|
||||
gusNEnemyItemsSummaryArraySize += usNumItems;
|
||||
}
|
||||
}
|
||||
// Pass 1 completed, so now allocate enough space to hold all the items
|
||||
if(gusPEnemyItemsSummaryArraySize)
|
||||
gpPEnemyItemsSummaryArray = new OBJECTTYPE[gusPEnemyItemsSummaryArraySize];
|
||||
if(gusNEnemyItemsSummaryArraySize)
|
||||
gpNEnemyItemsSummaryArray = new OBJECTTYPE[ gusNEnemyItemsSummaryArraySize ];
|
||||
// PASS #2
|
||||
// During this pass, simply copy all the data instead of counting it, now that we have already done so
|
||||
usPEnemyIndex = usNEnemyIndex = 0;
|
||||
SKIPDATA(pBuffer, pBufferHead, gpCurrentSectorSummary->uiEnemyPlacementPosition);
|
||||
for(i=0; i<gpCurrentSectorSummary->MapInfo.ubNumIndividuals; i++)
|
||||
{
|
||||
basic.Load(&pBuffer, dMajorMapVersion);
|
||||
if(basic.fDetailedPlacement)// skip static priority placement
|
||||
priority.Load(&pBuffer, dMajorMapVersion, ubMinorMapVersion);
|
||||
else// non detailed placements don't have items, so skip
|
||||
continue;
|
||||
if(basic.bTeam == ENEMY_TEAM)
|
||||
{
|
||||
// Copy the items that this enemy placement drops
|
||||
usNumItems = 0;
|
||||
for(j=0; j<9; j++)
|
||||
{
|
||||
pItem = &priority.Inv[gbMercSlotTypes[j]];
|
||||
if(pItem->exists() == true && !((*pItem).fFlags & OBJECT_UNDROPPABLE))
|
||||
{
|
||||
if(basic.fPriorityExistance)
|
||||
{
|
||||
gpPEnemyItemsSummaryArray[usPEnemyIndex] = *pItem;
|
||||
usPEnemyIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gpNEnemyItemsSummaryArray[usNEnemyIndex] = *pItem;
|
||||
usNEnemyIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT8 GetCurrentSummaryVersion()
|
||||
{
|
||||
|
||||
@@ -1390,6 +1390,8 @@ void HandleKeyboardShortcuts( )
|
||||
{
|
||||
if( !HandleSummaryInput( &EditorInputEvent ) && !HandleTextInput( &EditorInputEvent ) && EditorInputEvent.usEvent == KEY_DOWN )
|
||||
{
|
||||
if(InOverheadMap() && !(EditorInputEvent.usParam == ESC))//dnl ch81 031213
|
||||
return;
|
||||
if( gfGotoGridNoUI )
|
||||
{
|
||||
switch( EditorInputEvent.usParam )
|
||||
@@ -1526,7 +1528,7 @@ void HandleKeyboardShortcuts( )
|
||||
{
|
||||
KillOverheadMap();
|
||||
}
|
||||
if( iDrawMode == DRAW_MODE_SCHEDULEACTION )
|
||||
else if( iDrawMode == DRAW_MODE_SCHEDULEACTION )//dnl ch81 031213
|
||||
{
|
||||
CancelCurrentScheduleAction();
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ BOOLEAN FileDelete( STR strFilename )
|
||||
// Oct 2005: Snap - modified to work with the custom Data directory
|
||||
//
|
||||
//**************************************************************************
|
||||
HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
|
||||
HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose, STR strProfilename )//dnl ch81 021213
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::Path path(strFilename);
|
||||
@@ -400,9 +400,18 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
|
||||
}
|
||||
else if(uiOptions & FILE_ACCESS_READ)
|
||||
{
|
||||
vfs::COpenReadFile open_r(path, vfs::CVirtualFile::SF_TOP);
|
||||
pFile = &open_r.file();
|
||||
open_r.release();
|
||||
if(strProfilename && strProfilename[0])
|
||||
{
|
||||
vfs::COpenReadFile open_r(vfs::tReadableFile::cast(getVFS()->getFile(path, strProfilename)));
|
||||
pFile = &open_r.file();
|
||||
open_r.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
vfs::COpenReadFile open_r(path, vfs::CVirtualFile::SF_TOP);
|
||||
pFile = &open_r.file();
|
||||
open_r.release();
|
||||
}
|
||||
s_mapFiles[pFile].op = SOperation::READ;
|
||||
return (HWFILE)pFile;
|
||||
}
|
||||
@@ -560,8 +569,6 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// FileClose
|
||||
@@ -579,7 +586,6 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
|
||||
// 9 Feb 98 DEF - modified to work with the library system
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
void FileClose( HWFILE hFile )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
|
||||
@@ -109,7 +109,7 @@ extern void FileDebug( BOOLEAN f );
|
||||
BOOLEAN FileExists( STR strFilename );
|
||||
extern BOOLEAN FileExistsNoDB( STR strFilename );
|
||||
extern BOOLEAN FileDelete( STR strFilename );
|
||||
extern HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose );
|
||||
extern HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose=FALSE, STR strProfilename=NULL );//dnl ch81 021213
|
||||
|
||||
extern void FileClose( HWFILE );
|
||||
|
||||
|
||||
+22
-4
@@ -1829,7 +1829,7 @@ BOOLEAN SaveWorld(const STR8 puiFilename, FLOAT dMajorMapVersion, UINT8 ubMinorM
|
||||
UINT8 ubType;
|
||||
UINT8 ubTypeSubIndex;
|
||||
UINT8 ubTest = 1;
|
||||
CHAR8 aFilename[ 255 ];
|
||||
CHAR8 aFilename[2*FILENAME_BUFLEN];//dnl ch81 021213
|
||||
UINT8 ubCombine;
|
||||
// UINT8 bCounts[ WORLD_MAX ][8];
|
||||
UINT8** bCounts = NULL;
|
||||
@@ -2443,7 +2443,7 @@ BOOLEAN EvaluateWorld(STR8 pSector, UINT8 ubLevel)
|
||||
UINT32 uiFlags, uiFileSize, uiBytesRead;
|
||||
INT32 i, cnt, iTilesetID;
|
||||
CHAR16 str[2*FILENAME_BUFLEN];
|
||||
CHAR8 szDirFilename[2*FILENAME_BUFLEN], szFilename[FILENAME_BUFLEN];
|
||||
CHAR8 szDirFilename[2*FILENAME_BUFLEN], szFilename[2*FILENAME_BUFLEN];//dnl ch81 021213
|
||||
UINT8 ubCombine, ubMinorMapVersion;
|
||||
UINT8 (*bCounts)[8] = NULL;
|
||||
// Make sure the file exists... if not, then return false
|
||||
@@ -2453,12 +2453,19 @@ BOOLEAN EvaluateWorld(STR8 pSector, UINT8 ubLevel)
|
||||
if(ubLevel >= 4)
|
||||
strcat(szFilename, "_a");
|
||||
strcat(szFilename, ".dat");
|
||||
CHAR16 szFileName[40];
|
||||
CHAR16 szFileName[FILENAME_BUFLEN];//dnl ch81 021213
|
||||
swprintf(szFileName, L"%S", pSector);
|
||||
if(ValidMapFileName(szFileName))
|
||||
strcpy(szFilename, pSector);
|
||||
sprintf(szDirFilename, "MAPS\\%s", szFilename);
|
||||
#ifdef USE_VFS//dnl ch81 021213
|
||||
if(guiCurrentScreen == LOADSAVE_SCREEN)
|
||||
hfile = FileOpen(szDirFilename, FILE_ACCESS_READ, FALSE, gzProfileName);
|
||||
else
|
||||
hfile = FileOpen(szDirFilename, FILE_ACCESS_READ);
|
||||
#else
|
||||
hfile = FileOpen(szDirFilename, FILE_ACCESS_READ, FALSE);
|
||||
#endif
|
||||
if(!hfile)
|
||||
return(FALSE);
|
||||
uiFileSize = FileGetSize(hfile);
|
||||
@@ -2844,7 +2851,7 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor
|
||||
UINT16 usTypeSubIndex;
|
||||
UINT8 ubType;
|
||||
UINT8 ubSubIndex;
|
||||
CHAR8 aFilename[50];
|
||||
CHAR8 aFilename[2*FILENAME_BUFLEN];//dnl ch81 021213
|
||||
UINT8 ubCombine;
|
||||
UINT8 (*bCounts)[8] = NULL;
|
||||
INT8 *pBuffer;
|
||||
@@ -2865,7 +2872,18 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor
|
||||
else
|
||||
sprintf(aFilename, "MAPS\\%s", puiFilename);
|
||||
// Open file
|
||||
#ifdef USE_VFS//dnl ch81 021213
|
||||
#ifdef JA2EDITOR
|
||||
if(guiCurrentScreen == LOADSAVE_SCREEN)
|
||||
hfile = FileOpen(aFilename, FILE_ACCESS_READ, FALSE, gzProfileName);
|
||||
else
|
||||
hfile = FileOpen(aFilename, FILE_ACCESS_READ);
|
||||
#else
|
||||
hfile = FileOpen(aFilename, FILE_ACCESS_READ);
|
||||
#endif
|
||||
#else
|
||||
hfile = FileOpen(aFilename, FILE_ACCESS_READ, FALSE);
|
||||
#endif
|
||||
if(!hfile)
|
||||
{
|
||||
#ifndef JA2EDITOR
|
||||
|
||||
@@ -62,7 +62,7 @@ class SOLDIERTYPE;
|
||||
//SB: fix macro syntax flaw
|
||||
//#define LOADDATA( dst, src, size ) memcpy( dst, src, size ); src += size
|
||||
#define LOADDATA( dst, src, size ) { memcpy( dst, src, size ); src += size; }
|
||||
|
||||
#define SKIPDATA( dst, src, size ) { dst = src + size; }//dnl ch81 051213
|
||||
|
||||
#define LANDHEAD 0
|
||||
#define MAXDIR 8
|
||||
|
||||
Reference in New Issue
Block a user