mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
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:
@@ -2,44 +2,8 @@
|
||||
#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 "weapons.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"
|
||||
@@ -53,13 +17,13 @@ struct
|
||||
IMP_ITEM_CHOICE_TYPE curIMPItemChoices;
|
||||
IMP_ITEM_CHOICE_TYPE * curArray;
|
||||
UINT32 maxArraySize;
|
||||
|
||||
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
}
|
||||
typedef IMPitemchoicesParseData;
|
||||
|
||||
static void XMLCALL
|
||||
static void XMLCALL
|
||||
IMPitemchoicesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
IMPitemchoicesParseData * pData = (IMPitemchoicesParseData *)userData;
|
||||
@@ -154,11 +118,11 @@ IMPitemchoicesCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
IMPitemchoicesParseData * pData = (IMPitemchoicesParseData *)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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,12 +149,12 @@ IMPitemchoicesEndElementHandle(void *userData, const XML_Char *name)
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curIMPItemChoices.uiIndex = (UINT32) atol(pData->szCharData);
|
||||
pData->curIMPItemChoices.uiIndex = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ubChoices") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curIMPItemChoices.ubChoices = (UINT8) atol(pData->szCharData);
|
||||
pData->curIMPItemChoices.ubChoices = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ubNumItems") == 0)
|
||||
{
|
||||
@@ -464,7 +428,7 @@ BOOLEAN ReadInIMPItemChoicesStats(STR fileName)
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
|
||||
IMPitemchoicesParseData pData;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading IMPItemChoicess.xml" );
|
||||
@@ -473,7 +437,7 @@ BOOLEAN ReadInIMPItemChoicesStats(STR fileName)
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
@@ -488,19 +452,19 @@ BOOLEAN ReadInIMPItemChoicesStats(STR fileName)
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, IMPitemchoicesStartElementHandle, IMPitemchoicesEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, IMPitemchoicesCharacterDataHandle);
|
||||
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.curArray = gIMPItemChoices;
|
||||
pData.maxArraySize = MAX_IMP_ITEM_TYPES;
|
||||
|
||||
pData.maxArraySize = MAX_IMP_ITEM_TYPES;
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
@@ -529,7 +493,7 @@ BOOLEAN WriteIMPItemChoicesStats()
|
||||
hFile = FileOpen( "TABLEDATA\\IMPItemChoices out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
|
||||
{
|
||||
UINT32 cnt;
|
||||
|
||||
@@ -540,10 +504,10 @@ BOOLEAN WriteIMPItemChoicesStats()
|
||||
FilePrintf(hFile,"\t<IMPITEMCHOICES>\r\n");
|
||||
|
||||
FilePrintf(hFile,"\t\t<uiIndex>%d</uiIndex>\r\n", cnt );
|
||||
FilePrintf(hFile,"\t\t<ubChoices>%d</ubChoices>\r\n", gIMPItemChoices[cnt].ubChoices );
|
||||
FilePrintf(hFile,"\t\t<ubNumItems>%d</ubNumItems>\r\n", gIMPItemChoices[cnt].ubNumItems );
|
||||
FilePrintf(hFile,"\t\t<ubChoices>%d</ubChoices>\r\n", gIMPItemChoices[cnt].ubChoices );
|
||||
FilePrintf(hFile,"\t\t<ubNumItems>%d</ubNumItems>\r\n", gIMPItemChoices[cnt].ubNumItems );
|
||||
for (int i=0;i<50;i++)
|
||||
FilePrintf(hFile,"\t\t<bItemNo%d>%d</bItemNo%d>\r\n",i+1,gIMPItemChoices[cnt].bItemNo[i],i+1 );
|
||||
FilePrintf(hFile,"\t\t<bItemNo%d>%d</bItemNo%d>\r\n",i+1,gIMPItemChoices[cnt].bItemNo[i],i+1 );
|
||||
|
||||
|
||||
FilePrintf(hFile,"\t</IMPITEMCHOICES>\r\n");
|
||||
@@ -555,3 +519,4 @@ BOOLEAN WriteIMPItemChoicesStats()
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user