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
+34 -35
View File
@@ -27,10 +27,10 @@ UNDERGROUND_SECTORINFO* gpUndergroundSectorInfoTail = NULL;
// Lesh: this array controls randomization of sectors
// Note that some sectors in game already using alternative map
// It is Skyrider quest: B15, E14, D12, C16
// weapon caches: E11, H5, H10, J12, M9
// Madlab quest: H7, H16, I11, E4
// weapon caches: E11, H5, H10, J12, M9
// Madlab quest: H7, H16, I11, E4
// Do not enable randomization of this sectors until you are know what you're doing
BOOLEAN RandomSector[256] =
BOOLEAN RandomSector[256] =
{
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* A */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -62,7 +62,7 @@ typedef struct
ALTSECTORS_PARSE_STAGE curElement;
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
UINT32 uiRowNumber;
UINT32 currentDepth;
UINT32 maxReadDepth;
} altSectorsParseData;
@@ -152,14 +152,14 @@ BOOLEAN ReadInAltSectors(STR fileName)
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
altSectorsParseData pData;
// Open xml file
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
@@ -174,16 +174,16 @@ BOOLEAN ReadInAltSectors(STR fileName)
FileClose( hFile );
XML_SetElementHandler(parser, altSectorsStartElementHandle, altSectorsEndElementHandle);
XML_SetCharacterDataHandler(parser, altSectorsCharacterDataHandle);
memset(&pData,0,sizeof(pData));
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
@@ -221,14 +221,14 @@ BOOLEAN WriteInAltSectors(STR fileName)
fprintf (outfile, "</ALT_SECTORS_LIST>\n");
fclose(outfile);
return (TRUE);
}
UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ )
{
UNDERGROUND_SECTORINFO *curr;
curr = (UNDERGROUND_SECTORINFO*)MemAlloc( sizeof( UNDERGROUND_SECTORINFO ) );
curr = (UNDERGROUND_SECTORINFO*)MemAlloc( sizeof( UNDERGROUND_SECTORINFO ) );
AssertMsg( curr, "Failed to create an underground sector info node." );
memset( curr, 0, sizeof( UNDERGROUND_SECTORINFO ) );
@@ -292,34 +292,34 @@ void InitMiningLocations()
{
SECTORINFO *pSector;
//Set up mining sites
pSector = &SectorInfo[SEC_D4];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 33;
// pSector->ubIncomeValue = 33;
pSector = &SectorInfo[SEC_D13];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 41;
pSector = &SectorInfo[SEC_B2];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 20;
pSector = &SectorInfo[SEC_H8];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 64;
pSector = &SectorInfo[SEC_I14];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 80;
//Grumm
pSector = &SectorInfo[SEC_H3];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 100;
}
//Mobile groups are handled separately from sectors, because they are on the move.
//Mobile groups are handled separately from sectors, because they are on the move.
void GeneratePatrolGroups()
{
GROUP *pGroup;
@@ -379,14 +379,13 @@ void TrashUndergroundSectorInfo()
gpUndergroundSectorInfoTail = NULL;
}
//Defines the sectors that can be occupied by enemies, creatures, etc. It also
//Defines the sectors that can be occupied by enemies, creatures, etc. It also
//contains the network of cave connections critical for strategic creature spreading, as we can't
//know how the levels connect without loading the maps. This is completely hardcoded, and any
//know how the levels connect without loading the maps. This is completely hardcoded, and any
//changes to the maps, require changes accordingly.
void BuildUndergroundSectorInfoList()
{
UNDERGROUND_SECTORINFO *curr;
SECTORINFO *pSector = NULL;
TrashUndergroundSectorInfo();
@@ -394,13 +393,13 @@ void BuildUndergroundSectorInfoList()
//* BASEMENT LEVEL 1 *
//********************
//Miguel's basement. Nothing here.
//Miguel's basement. Nothing here.
curr = NewUndergroundNode( 10, 1, 1 );
//Chitzena mine. Nothing here.
//Chitzena mine. Nothing here.
curr = NewUndergroundNode( 2, 2, 1 );
//San mona mine. Nothing here.
//San mona mine. Nothing here.
curr = NewUndergroundNode( 4, 4, 1 );
curr = NewUndergroundNode( 5, 4, 1 );
@@ -429,13 +428,13 @@ void BuildUndergroundSectorInfoList()
curr = NewUndergroundNode( 4, 11, 1 );
curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 ));
curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 ));
//O3
curr = NewUndergroundNode( 3, 15, 1 );
curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 ));
curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 ));
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
//P3
curr = NewUndergroundNode( 3, 16, 1 );
switch( gGameOptions.ubDifficultyLevel )
@@ -456,7 +455,7 @@ void BuildUndergroundSectorInfoList()
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
//Do all of the mandatory underground mine sectors
//Drassen's mine
//D13_B1
curr = NewUndergroundNode( 13, 4, 1 );
@@ -549,8 +548,8 @@ void BuildUndergroundSectorInfoList()
}
// Lesh: this function creates randomized world
// every sector can be randomized between common and alternative, chances 50/50
// randomization of individual sectors can be switched off via array RandomSector[]
// every sector can be randomized between common and alternative, chances 50/50
// randomization of individual sectors can be switched off via array RandomSector[]
void InitWorld()
{
INT16 sSectorCounter;
@@ -565,28 +564,28 @@ void InitWorld()
}
}
//This is the function that is called only once, when the player begins a new game. This will calculate
//This is the function that is called only once, when the player begins a new game. This will calculate
//starting numbers of the queen's army in various parts of the map, which will vary from campaign to campaign.
//This is also highly effected by the game's difficulty setting.
void InitNewCampaign()
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewCampaign");
//First clear all the sector information of all enemy existance. Conveniently, the
//First clear all the sector information of all enemy existance. Conveniently, the
//ubGroupType is also cleared, which is perceived to be an empty group.
memset( &SectorInfo, 0, sizeof( SECTORINFO ) * 256 );
InitStrategicMovementCosts();
RemoveAllGroups();
InitWorld(); // Lesh: generate different world each time using alternative maps
InitWorld(); // Lesh: generate different world each time using alternative maps
InitMiningLocations();
InitKnowFacilitiesFlags( );
BuildUndergroundSectorInfoList();
// allow overhead view of omerta A9 on game onset
SetSectorFlag( 9, 1, 0, SF_ALREADY_VISITED );
//Generates the initial forces in a new campaign. The idea is to randomize numbers and sectors
//Generates the initial forces in a new campaign. The idea is to randomize numbers and sectors
//so that no two games are the same.
InitStrategicAI();