mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00: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,47 +2,11 @@
|
||||
#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 "EnemyItemDrops.h"
|
||||
#endif
|
||||
|
||||
struct
|
||||
@@ -54,13 +18,13 @@ struct
|
||||
EXPLOSIVE_DROPS * curArray;
|
||||
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
}
|
||||
typedef explosiveDropParseData;
|
||||
|
||||
static void XMLCALL
|
||||
static void XMLCALL
|
||||
explosiveDropStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
explosiveDropParseData * pData = (explosiveDropParseData *)userData;
|
||||
@@ -84,7 +48,7 @@ explosiveDropStartElementHandle(void *userData, const XML_Char *name, const XML_
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(pData->curElement == ELEMENT &&
|
||||
(strcmp(name, "uiIndex") == 0 ||
|
||||
(strcmp(name, "uiIndex") == 0 ||
|
||||
strcmp(name, "ubType") == 0 ||
|
||||
strcmp(name, "ubEnemyDropRate") == 0 ||
|
||||
strcmp(name, "ubMilitiaDropRate") == 0 ))
|
||||
@@ -106,9 +70,9 @@ explosiveDropCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
explosiveDropParseData * pData = (explosiveDropParseData *)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)));
|
||||
}
|
||||
}
|
||||
@@ -116,7 +80,7 @@ explosiveDropCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
|
||||
static void XMLCALL
|
||||
explosiveDropEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
{
|
||||
explosiveDropParseData * pData = (explosiveDropParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
@@ -137,22 +101,22 @@ explosiveDropEndElementHandle(void *userData, const XML_Char *name)
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curExplosiveDrop.uiIndex = (UINT32) atol(pData->szCharData);
|
||||
pData->curExplosiveDrop.uiIndex = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ubType") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curExplosiveDrop.ubType = (UINT8) atol(pData->szCharData);
|
||||
pData->curExplosiveDrop.ubType = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ubEnemyDropRate") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curExplosiveDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData);
|
||||
pData->curExplosiveDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ubMilitiaDropRate") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curExplosiveDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData);
|
||||
pData->curExplosiveDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
@@ -171,7 +135,7 @@ BOOLEAN ReadInEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, ST
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
|
||||
explosiveDropParseData pData;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EnemyExplosiveDrops.xml" );
|
||||
@@ -180,7 +144,7 @@ BOOLEAN ReadInEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, ST
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
@@ -195,19 +159,19 @@ BOOLEAN ReadInEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, ST
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, explosiveDropStartElementHandle, explosiveDropEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, explosiveDropCharacterDataHandle);
|
||||
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.curArray = pEnemyExplosiveDrops;
|
||||
pData.maxArraySize = MAX_DROP_ITEMS;
|
||||
|
||||
pData.maxArraySize = MAX_DROP_ITEMS;
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
@@ -236,7 +200,7 @@ BOOLEAN WriteEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, STR
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
|
||||
{
|
||||
UINT32 cnt;
|
||||
|
||||
@@ -258,4 +222,4 @@ BOOLEAN WriteEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, STR
|
||||
FileClose( hFile );
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user