mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- new: Externalized sector loadscreens to TableData\Map\SectorLoadscreens.xml (INI-Switch: USE_EXTERNALIZED_LOADSCREENS)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@887 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+2
-4
@@ -581,10 +581,8 @@ void LoadGameExternalOptions()
|
||||
// WANNE: Drop Items
|
||||
gGameExternalOptions.ubEnemiesItemDrop = iniReader.ReadInteger("JA2 Gameplay Settings","ENEMIES_ITEM_DROP", 0);
|
||||
|
||||
// WANNE: Auto save: Attention: The game always crashes after a "normal" savegame is loaded after loading an autosave
|
||||
// So for now USE_AUTO_SAVE is always false.
|
||||
// The game crashes when removing mouse region that are not set
|
||||
//gGameExternalOptions.gfUseAutoSave = iniReader.ReadBoolean("JA2 Gameplay Settings","USE_AUTO_SAVE",FALSE);
|
||||
// WANNE: External sector Loadscreens [2007-05-19]
|
||||
gGameExternalOptions.gfUseExternalLoadscreens = iniReader.ReadBoolean("JA2 Gameplay Settings","USE_EXTERNALIZED_LOADSCREENS", FALSE);
|
||||
|
||||
// Militia settings
|
||||
gGameExternalOptions.guiAllowMilitiaGroupsDelay = iniReader.ReadInteger("JA2 Gameplay Settings","ALLOW_MILITIA_MOBILE_DELAY",1);
|
||||
|
||||
@@ -347,6 +347,9 @@ typedef struct
|
||||
// WANNE
|
||||
INT32 ubEnemiesItemDrop;
|
||||
|
||||
// WANNE: External sector loadscreens [2007-05-19]
|
||||
BOOLEAN gfUseExternalLoadscreens;
|
||||
|
||||
BOOLEAN gfUseAutoSave;
|
||||
|
||||
//Merc Assignment settings
|
||||
|
||||
@@ -119,7 +119,23 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
return FALSE;
|
||||
|
||||
// WANNE: Enemy drops - end
|
||||
|
||||
|
||||
// WANNE: Sector Loadscreens [2007-05-18]
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, SECTORLOADSCREENSFILENAME);
|
||||
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInSectorLoadscreensStats(gSectorLoadscreens, fileName))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("File does not exist, fileName = %s", fileName));
|
||||
// Reset ini-option
|
||||
gGameExternalOptions.gfUseExternalLoadscreens = FALSE;
|
||||
}
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, AMMOTYPESFILENAME);
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libexpatMT.lib mss32.lib winmm.lib smackw32.lib fmodvc.lib"
|
||||
OutputFile="D:\Games\Jagged Alliance 2\ja2_debug_687_en.exe"
|
||||
OutputFile="C:\Games\Jagged Alliance 2\ja2_debug_687_en.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories=".\..\..\Standard Gaming Platform\"
|
||||
@@ -546,7 +546,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libexpatMT.lib winmm.lib smackw32.lib mss32.lib fmodvc.lib"
|
||||
OutputFile="D:\games\Jagged Alliance 2\JA2 v1.13.872_DE.exe"
|
||||
OutputFile="C:\Games\Jagged Alliance 2\JA2 v1.13.872_DE.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories=".\..\..\Standard Gaming Platform\"
|
||||
|
||||
+1332
-838
File diff suppressed because it is too large
Load Diff
@@ -48,6 +48,11 @@ enum
|
||||
LOADINGSCREEN_NIGHTMINE,
|
||||
LOADINGSCREEN_DAYBALIME,
|
||||
LOADINGSCREEN_NIGHTBALIME,
|
||||
DAY,
|
||||
NIGHT,
|
||||
HELI,
|
||||
DAY_ALT,
|
||||
NIGHT_ALT
|
||||
};
|
||||
|
||||
|
||||
@@ -62,4 +67,23 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
|
||||
//and refreshing the screen with it.
|
||||
void DisplayLoadScreenWithID( UINT8 ubLoadScreenID );
|
||||
|
||||
#define MAX_SECTOR_LOADSCREENS 257 // 16x16 + Start Sector
|
||||
#define MAX_LOCATION_CHARS 10
|
||||
#define MAX_IMAGE_FORMAT_CHARS 5
|
||||
#define MAX_IMAGE_PATH_CHARS 80
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 uiIndex;
|
||||
CHAR8 szLocation[MAX_LOCATION_CHARS];
|
||||
BOOLEAN RandomAltSector;
|
||||
CHAR8 szImageFormat[MAX_IMAGE_FORMAT_CHARS];
|
||||
CHAR8 szDay[MAX_IMAGE_PATH_CHARS];
|
||||
CHAR8 szNight[MAX_IMAGE_PATH_CHARS];
|
||||
CHAR8 szDayAlt[MAX_IMAGE_PATH_CHARS];
|
||||
CHAR8 szNightAlt[MAX_IMAGE_PATH_CHARS];
|
||||
} SECTOR_LOADSCREENS;
|
||||
|
||||
extern SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS];
|
||||
|
||||
#endif
|
||||
@@ -5618,6 +5618,9 @@
|
||||
<File
|
||||
RelativePath=".\XML_Merge.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_SectorLoadscreens.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_Sounds.cpp">
|
||||
</File>
|
||||
|
||||
+9
-1
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "armsdealerinvinit.h"
|
||||
#include "EnemyItemDrops.h"
|
||||
#include "Loading Screen.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -70,7 +71,7 @@ typedef PARSE_STAGE;
|
||||
#define MOVEMENTCOSTFILENAME "Map\\MovementCosts.xml"
|
||||
#define ALTSECTORSFILENAME "Map\\AltSectors.xml"
|
||||
#define SAMSITESFILENAME "Map\\SamSites.xml"
|
||||
#define ROAMINGMILITIAFILENAME "Map\\RestrictedRoamingMilitia.xml"
|
||||
#define ROAMINGMILITIAFILENAME "Map\\RestrictedRoamingMilitia.xml"
|
||||
|
||||
|
||||
#define GARRISONFILENAME "Army\\GarrisonGroups.xml"
|
||||
@@ -84,6 +85,9 @@ typedef PARSE_STAGE;
|
||||
#define ENEMYARMOURDROPSFILENAME "EnemyArmourDrops.xml"
|
||||
#define ENEMYMISCDROPSFILENAME "EnemyMiscDrops.xml"
|
||||
|
||||
// WANNE: Sector loadscreens [2007-05-18]
|
||||
#define SECTORLOADSCREENSFILENAME "Map\\SectorLoadscreens.xml"
|
||||
|
||||
|
||||
extern BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion);
|
||||
extern BOOLEAN WriteItemStats();
|
||||
@@ -154,6 +158,10 @@ extern BOOLEAN WriteEnemyArmourDropsStats(ARMOUR_DROPS *pEnemyArmourDrops, STR f
|
||||
extern BOOLEAN ReadInEnemyMiscDropsStats(MISC_DROPS *pEnemyMiscDrops, STR fileName);
|
||||
extern BOOLEAN WriteEnemyMiscDropsStats(MISC_DROPS *pEnemyMiscDrops, STR fileName);
|
||||
|
||||
// WANNE: Sector Loadscreens [2007-05-18]
|
||||
extern BOOLEAN ReadInSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR fileName);
|
||||
extern BOOLEAN WriteSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR fileName);
|
||||
|
||||
// Lesh: burst sounds and explosion info
|
||||
extern BOOLEAN ReadInBurstSoundArray(STR fileName);
|
||||
extern BOOLEAN WriteBurstSoundArray();
|
||||
|
||||
@@ -0,0 +1,375 @@
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Tactical All.h"
|
||||
#else
|
||||
#include "sgp.h"
|
||||
#include "overhead types.h"
|
||||
#include "Sound Control.h"
|
||||
#include "Soldier Control.h"
|
||||
#include "overhead.h"
|
||||
#include "Event Pump.h"
|
||||
#include "weapons.h"
|
||||
#include "Animation Control.h"
|
||||
#include "sys globals.h"
|
||||
#include "Handle UI.h"
|
||||
#include "Isometric Utils.h"
|
||||
#include "worldman.h"
|
||||
#include "math.h"
|
||||
#include "points.h"
|
||||
#include "ai.h"
|
||||
#include "los.h"
|
||||
#include "renderworld.h"
|
||||
#include "opplist.h"
|
||||
#include "interface.h"
|
||||
#include "message.h"
|
||||
#include "campaign.h"
|
||||
#include "items.h"
|
||||
#include "text.h"
|
||||
#include "Soldier Profile.h"
|
||||
#include "tile animation.h"
|
||||
#include "Dialogue Control.h"
|
||||
#include "SkillCheck.h"
|
||||
#include "explosion control.h"
|
||||
#include "Quests.h"
|
||||
#include "Physics.h"
|
||||
#include "Random.h"
|
||||
#include "Vehicles.h"
|
||||
#include "bullets.h"
|
||||
#include "morale.h"
|
||||
#include "meanwhile.h"
|
||||
#include "SkillCheck.h"
|
||||
#include "gamesettings.h"
|
||||
#include "SaveLoadMap.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#include "SectorLoadscreens.h"
|
||||
#endif
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
SECTOR_LOADSCREENS curSectorLoadscreens;
|
||||
SECTOR_LOADSCREENS * curArray;
|
||||
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
}
|
||||
typedef sectorLoadscreensParseData;
|
||||
|
||||
static void XMLCALL
|
||||
sectorLoadscreensStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
sectorLoadscreensParseData * pData = (sectorLoadscreensParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "LOADSCREENS") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
memset(pData->curArray,0,sizeof(SECTOR_LOADSCREENS)*pData->maxArraySize);
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "SECTOR") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
memset(&pData->curSectorLoadscreens,0,sizeof(SECTOR_LOADSCREENS));
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if (pData->curElement == ELEMENT &&
|
||||
(strcmp(name, "uiIndex") == 0 ||
|
||||
strcmp(name, "szLocation") == 0 ||
|
||||
strcmp(name, "RandomAltSector") == 0 ||
|
||||
strcmp(name, "szImageFormat") == 0 ||
|
||||
strcmp(name, "szDay") == 0 ||
|
||||
strcmp(name, "szNight") == 0 ||
|
||||
strcmp(name, "szDayAlt") == 0 ||
|
||||
strcmp(name, "szNightAlt") == 0))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
sectorLoadscreensCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
sectorLoadscreensParseData * pData = (sectorLoadscreensParseData *)userData;
|
||||
|
||||
if( (pData->currentDepth <= pData->maxReadDepth) &&
|
||||
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
||||
){
|
||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void XMLCALL
|
||||
sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
char temp;
|
||||
sectorLoadscreensParseData * pData = (sectorLoadscreensParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
{
|
||||
if(strcmp(name, "LOADSCREENS") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "SECTOR") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if(pData->curSectorLoadscreens.uiIndex < pData->maxArraySize)
|
||||
{
|
||||
pData->curArray[pData->curSectorLoadscreens.uiIndex] = pData->curSectorLoadscreens; //write the inventory into the table
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curSectorLoadscreens.uiIndex = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "szLocation") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
if(MAX_LOCATION_CHARS >= strlen(pData->szCharData))
|
||||
strcpy(pData->curSectorLoadscreens.szLocation,pData->szCharData);
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szLocation,pData->szCharData,MAX_LOCATION_CHARS);
|
||||
pData->curSectorLoadscreens.szLocation[MAX_LOCATION_CHARS] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_LOCATION_CHARS);i++)
|
||||
{
|
||||
temp = pData->szCharData[i];
|
||||
pData->curSectorLoadscreens.szLocation[i] = temp;
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szLocation[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szLocation[i],&temp));
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "RandomAltSector") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curSectorLoadscreens.RandomAltSector = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "szImageFormat") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
if(MAX_IMAGE_FORMAT_CHARS >= strlen(pData->szCharData))
|
||||
strcpy(pData->curSectorLoadscreens.szImageFormat,pData->szCharData);
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szImageFormat,pData->szCharData,MAX_IMAGE_FORMAT_CHARS);
|
||||
pData->curSectorLoadscreens.szImageFormat[MAX_IMAGE_FORMAT_CHARS] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_FORMAT_CHARS);i++)
|
||||
{
|
||||
temp = pData->szCharData[i];
|
||||
pData->curSectorLoadscreens.szImageFormat[i] = temp;
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szImageFormat[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szImageFormat[i],&temp));
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "szDay") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
if(MAX_IMAGE_PATH_CHARS >= strlen(pData->szCharData))
|
||||
strcpy(pData->curSectorLoadscreens.szDay,pData->szCharData);
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szDay,pData->szCharData,MAX_IMAGE_PATH_CHARS);
|
||||
pData->curSectorLoadscreens.szDay[MAX_IMAGE_PATH_CHARS] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_PATH_CHARS);i++)
|
||||
{
|
||||
temp = pData->szCharData[i];
|
||||
pData->curSectorLoadscreens.szDay[i] = temp;
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szDay[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szDay[i],&temp));
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "szNight") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
if(MAX_IMAGE_PATH_CHARS >= strlen(pData->szCharData))
|
||||
strcpy(pData->curSectorLoadscreens.szNight,pData->szCharData);
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szNight,pData->szCharData,MAX_IMAGE_PATH_CHARS);
|
||||
pData->curSectorLoadscreens.szNight[MAX_IMAGE_PATH_CHARS] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_PATH_CHARS);i++)
|
||||
{
|
||||
temp = pData->szCharData[i];
|
||||
pData->curSectorLoadscreens.szNight[i] = temp;
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szNight[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szNight[i],&temp));
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "szDayAlt") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
if(MAX_IMAGE_PATH_CHARS >= strlen(pData->szCharData))
|
||||
strcpy(pData->curSectorLoadscreens.szDayAlt,pData->szCharData);
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szDayAlt,pData->szCharData,MAX_IMAGE_PATH_CHARS);
|
||||
pData->curSectorLoadscreens.szDayAlt[MAX_IMAGE_PATH_CHARS] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_PATH_CHARS);i++)
|
||||
{
|
||||
temp = pData->szCharData[i];
|
||||
pData->curSectorLoadscreens.szDayAlt[i] = temp;
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szDayAlt[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szDayAlt[i],&temp));
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "szNightAlt") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
// WANNE
|
||||
if(MAX_IMAGE_PATH_CHARS >= strlen(pData->szCharData))
|
||||
strcpy(pData->curSectorLoadscreens.szNightAlt,pData->szCharData);
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szNightAlt,pData->szCharData,MAX_IMAGE_PATH_CHARS);
|
||||
pData->curSectorLoadscreens.szNightAlt[MAX_IMAGE_PATH_CHARS] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_PATH_CHARS);i++)
|
||||
{
|
||||
temp = pData->szCharData[i];
|
||||
pData->curSectorLoadscreens.szNightAlt[i] = temp;
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szNightAlt[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szNightAlt[i],&temp));
|
||||
}
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN ReadInSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR fileName)
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
sectorLoadscreensParseData pData;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading SectorLoadscreens.xml" );
|
||||
|
||||
// Open inventory file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
//Read in block
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, sectorLoadscreensStartElementHandle, sectorLoadscreensEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, sectorLoadscreensCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.curArray = pSectorLoadscreens;
|
||||
pData.maxArraySize = MAX_SECTOR_LOADSCREENS;
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in SectorLoadscreens.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN WriteSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR fileName)
|
||||
{
|
||||
HWFILE hFile;
|
||||
|
||||
//Debug code; make sure that what we got from the file is the same as what's there
|
||||
// Open a new file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
{
|
||||
UINT32 cnt;
|
||||
|
||||
FilePrintf(hFile,"<LOADSCREENS>\r\n");
|
||||
for(cnt = 0;cnt < MAXITEMS;cnt++)
|
||||
{
|
||||
|
||||
FilePrintf(hFile,"\t<SECTOR>\r\n");
|
||||
|
||||
FilePrintf(hFile,"\t\t<uiIndex>%d</uiIndex>\r\n", cnt);
|
||||
FilePrintf(hFile,"\t\t<szLocation>%d</szLocation>\r\n", pSectorLoadscreens[cnt].szLocation);
|
||||
FilePrintf(hFile,"\t\t<RandomAltSector>%d</RandomAltSector>\r\n", pSectorLoadscreens[cnt].RandomAltSector);
|
||||
FilePrintf(hFile,"\t\t<szImageFormat>%d</szImageFormat>\r\n", pSectorLoadscreens[cnt].szImageFormat);
|
||||
FilePrintf(hFile,"\t\t<szDay>%d</szDay>\r\n", pSectorLoadscreens[cnt].szDay);
|
||||
FilePrintf(hFile,"\t\t<szNight>%d</szNight>\r\n", pSectorLoadscreens[cnt].szNight);
|
||||
FilePrintf(hFile,"\t\t<szDayAlt>%d</szDayAlt>\r\n", pSectorLoadscreens[cnt].szDayAlt);
|
||||
FilePrintf(hFile,"\t\t<szNightAlt>%d</szNightAlt>\r\n", pSectorLoadscreens[cnt].szNightAlt);
|
||||
|
||||
FilePrintf(hFile,"\t</SECTOR>\r\n");
|
||||
}
|
||||
FilePrintf(hFile,"</LOADSCREENS>\r\n");
|
||||
}
|
||||
FileClose( hFile );
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
Reference in New Issue
Block a user