Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+15 -15
View File
@@ -4,7 +4,6 @@
#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"
@@ -49,15 +48,15 @@ struct
PARSE_STAGE curElement;
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
UINT32 maxArraySize;
UINT32 curIndex;
UINT32 curIndex;
UINT32 currentDepth;
UINT32 maxReadDepth;
}
typedef soundParseData;
static void XMLCALL
static void XMLCALL
soundStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
{
soundParseData * pData = (soundParseData *)userData;
@@ -90,9 +89,9 @@ soundCharacterDataHandle(void *userData, const XML_Char *str, int len)
{
soundParseData * pData = (soundParseData *)userData;
if( (pData->currentDepth <= pData->maxReadDepth) &&
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)));
}
}
@@ -140,7 +139,7 @@ BOOLEAN ReadInSoundArray(STR fileName)
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
soundParseData pData;
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",SOUNDSFILENAME ) );
@@ -149,7 +148,7 @@ BOOLEAN ReadInSoundArray(STR fileName)
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
@@ -164,19 +163,19 @@ BOOLEAN ReadInSoundArray(STR fileName)
FileClose( hFile );
XML_SetElementHandler(parser, soundStartElementHandle, soundEndElementHandle);
XML_SetCharacterDataHandler(parser, soundCharacterDataHandle);
memset(&pData,0,sizeof(pData));
pData.maxArraySize = MAX_SAMPLES;
pData.maxArraySize = MAX_SAMPLES;
pData.curIndex = -1;
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
@@ -203,7 +202,7 @@ BOOLEAN WriteSoundArray()
hFile = FileOpen( "TABLEDATA\\Sounds out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
if ( !hFile )
return( FALSE );
{
UINT32 cnt;
@@ -212,13 +211,13 @@ BOOLEAN WriteSoundArray()
{
FilePrintf(hFile,"\t<SOUND>");
STR8 szRemainder = szSoundEffects[cnt]; //the remaining string to be output (for making valid XML)
STR8 szRemainder = szSoundEffects[cnt]; //the remaining string to be output (for making valid XML)
while(szRemainder[0] != '\0')
{
UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0");
char invChar = szRemainder[uiCharLoc];
if(uiCharLoc)
{
szRemainder[uiCharLoc] = '\0';
@@ -268,3 +267,4 @@ BOOLEAN WriteSoundArray()
return( TRUE );
}