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
+180 -187
View File
@@ -3,7 +3,7 @@
#else
#include <memory.h>
#include "Map Edgepoints.h"
#include "Soldier Control.h"
#include "pathai.h"
#include "ai.h"
#include "Map Information.h"
@@ -19,6 +19,11 @@
#include "worldman.h"
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
//dynamic arrays that contain the valid gridno's for each edge
INT16 *gps1stNorthEdgepointArray = NULL;
INT16 *gps1stEastEdgepointArray = NULL;
@@ -122,10 +127,6 @@ void ValidateEdgepoints()
INT32 i;
UINT16 usValidEdgepoints;
SOLDIERTYPE Soldier;
// WDS - Clean up inventory handling
// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE );
Soldier.initialize();
Soldier.bTeam = 1;
//north
@@ -316,9 +317,9 @@ void CompactEdgepointArray( INT16 **psArray, UINT16 *pusMiddleIndex, UINT16 *pus
Assert( *psArray );
}
void InternallyClassifyEdgepoints( SOLDIERTYPE *pSoldier, INT16 sGridNo,
INT16 **psArray1, UINT16 *pusMiddleIndex1, UINT16 *pusArraySize1,
INT16 **psArray2, UINT16 *pusMiddleIndex2, UINT16 *pusArraySize2 )
void InternallyClassifyEdgepoints( SOLDIERTYPE *pSoldier, INT16 sGridNo,
INT16 **psArray1, UINT16 *pusMiddleIndex1, UINT16 *pusArraySize1,
INT16 **psArray2, UINT16 *pusMiddleIndex2, UINT16 *pusArraySize2 )
{
INT32 i;
UINT16 us1stBenchmarkID, us2ndBenchmarkID;
@@ -360,8 +361,8 @@ void InternallyClassifyEdgepoints( SOLDIERTYPE *pSoldier, INT16 sGridNo,
break;
}
}
//Now we have found the two benchmarks, so go in both directions for each one to determine which entrypoints
//are going to be used in the primary array. All rejections will be positioned in the secondary array for
//Now we have found the two benchmarks, so go in both directions for each one to determine which entrypoints
//are going to be used in the primary array. All rejections will be positioned in the secondary array for
//use for isolated entry when tactically traversing.
if( us1stBenchmarkID != 0xffff )
{
@@ -401,7 +402,7 @@ void InternallyClassifyEdgepoints( SOLDIERTYPE *pSoldier, INT16 sGridNo,
for( i = us2ndBenchmarkID; i > *pusMiddleIndex1; i-- )
{
if( !EdgepointsClose( pSoldier, (*psArray1)[ i ], (*psArray1)[ i-1 ] ) )
{ //All edgepoints from 1st middle index to i-1 are rejected.
{ //All edgepoints from 1st middle index to i-1 are rejected.
while( i > *pusMiddleIndex1 )
{
i--;
@@ -437,9 +438,6 @@ void ClassifyEdgepoints()
SOLDIERTYPE Soldier;
INT16 sGridNo = -1;
// WDS - Clean up inventory handling
// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE );
Soldier.initialize();
Soldier.bTeam = 1;
//north
@@ -447,8 +445,8 @@ void ClassifyEdgepoints()
{
sGridNo = FindNearestEdgepointOnSpecifiedEdge( gMapInformation.sNorthGridNo, NORTH_EDGEPOINT_SEARCH );
if( sGridNo != NOWHERE )
{
InternallyClassifyEdgepoints( &Soldier, sGridNo,
{
InternallyClassifyEdgepoints( &Soldier, sGridNo,
&gps1stNorthEdgepointArray, &gus1stNorthEdgepointMiddleIndex, &gus1stNorthEdgepointArraySize,
&gps2ndNorthEdgepointArray, &gus2ndNorthEdgepointMiddleIndex, &gus2ndNorthEdgepointArraySize );
}
@@ -458,8 +456,8 @@ void ClassifyEdgepoints()
{
sGridNo = FindNearestEdgepointOnSpecifiedEdge( gMapInformation.sEastGridNo, EAST_EDGEPOINT_SEARCH );
if( sGridNo != NOWHERE )
{
InternallyClassifyEdgepoints( &Soldier, sGridNo,
{
InternallyClassifyEdgepoints( &Soldier, sGridNo,
&gps1stEastEdgepointArray, &gus1stEastEdgepointMiddleIndex, &gus1stEastEdgepointArraySize,
&gps2ndEastEdgepointArray, &gus2ndEastEdgepointMiddleIndex, &gus2ndEastEdgepointArraySize );
}
@@ -469,8 +467,8 @@ void ClassifyEdgepoints()
{
sGridNo = FindNearestEdgepointOnSpecifiedEdge( gMapInformation.sSouthGridNo, SOUTH_EDGEPOINT_SEARCH );
if( sGridNo != NOWHERE )
{
InternallyClassifyEdgepoints( &Soldier, sGridNo,
{
InternallyClassifyEdgepoints( &Soldier, sGridNo,
&gps1stSouthEdgepointArray, &gus1stSouthEdgepointMiddleIndex, &gus1stSouthEdgepointArraySize,
&gps2ndSouthEdgepointArray, &gus2ndSouthEdgepointMiddleIndex, &gus2ndSouthEdgepointArraySize );
}
@@ -480,8 +478,8 @@ void ClassifyEdgepoints()
{
sGridNo = FindNearestEdgepointOnSpecifiedEdge( gMapInformation.sWestGridNo, WEST_EDGEPOINT_SEARCH );
if( sGridNo != NOWHERE )
{
InternallyClassifyEdgepoints( &Soldier, sGridNo,
{
InternallyClassifyEdgepoints( &Soldier, sGridNo,
&gps1stWestEdgepointArray, &gus1stWestEdgepointMiddleIndex, &gus1stWestEdgepointArraySize,
&gps2ndWestEdgepointArray, &gus2ndWestEdgepointMiddleIndex, &gus2ndWestEdgepointArraySize );
}
@@ -493,8 +491,6 @@ void GenerateMapEdgepoints()
INT32 i=-1;
INT16 sGridNo=-1;
INT16 sVGridNo[400];
UINT8 gubSaveNPCAPBudget=0;
UINT8 gubSaveNPCDistLimit=0;
//Get rid of the current edgepoint lists.
TrashMapEdgepoints();
@@ -521,39 +517,39 @@ void GenerateMapEdgepoints()
{
//1st row
sGridNo = gsTLGridNo;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo;
while( sGridNo > gsTRGridNo )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo;
sGridNo -= 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo;
}
//2nd row
gus1stNorthEdgepointMiddleIndex = gus1stNorthEdgepointArraySize;
sGridNo = gsTLGridNo + 161;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo;
while( sGridNo > gsTRGridNo + 161 )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo;
sGridNo -= 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo;
}
if( gus1stNorthEdgepointArraySize )
{
{
//Allocate and copy over the valid gridnos.
gps1stNorthEdgepointArray = (INT16*)MemAlloc( gus1stNorthEdgepointArraySize * sizeof( INT16) );
for( i = 0; i < gus1stNorthEdgepointArraySize; i++ )
@@ -565,35 +561,35 @@ void GenerateMapEdgepoints()
{
//1st row
sGridNo = gsTRGridNo;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo;
while( sGridNo < gsBRGridNo )
{
sGridNo += 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo;
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo;
}
//2nd row
gus1stEastEdgepointMiddleIndex = gus1stEastEdgepointArraySize;
sGridNo = gsTRGridNo + 159;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo;
while( sGridNo < gsBRGridNo + 159 )
{
sGridNo += 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo;
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo;
}
if( gus1stEastEdgepointArraySize )
@@ -608,35 +604,35 @@ void GenerateMapEdgepoints()
{
//1st row
sGridNo = gsBLGridNo;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo;
while( sGridNo > gsBRGridNo )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo;
sGridNo -= 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo;
}
//2nd row
gus1stSouthEdgepointMiddleIndex = gus1stSouthEdgepointArraySize;
sGridNo = gsBLGridNo - 161;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo;
while( sGridNo > gsBRGridNo - 161 )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo;
sGridNo -= 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo;
}
if( gus1stSouthEdgepointArraySize )
@@ -651,35 +647,35 @@ void GenerateMapEdgepoints()
{
//1st row
sGridNo = gsTLGridNo;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo;
while( sGridNo < gsBLGridNo )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo;
sGridNo += 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo;
}
//2nd row
gus1stWestEdgepointMiddleIndex = gus1stWestEdgepointArraySize;
sGridNo = gsTLGridNo - 159;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo;
while( sGridNo < gsBLGridNo - 159 )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo;
sGridNo += 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo;
}
if( gus1stWestEdgepointArraySize )
@@ -698,39 +694,39 @@ void GenerateMapEdgepoints()
{
//1st row
sGridNo = gsTLGridNo;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo;
while( sGridNo > gsTRGridNo )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo;
sGridNo -= 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo;
}
//2nd row
gus2ndNorthEdgepointMiddleIndex = gus2ndNorthEdgepointArraySize;
sGridNo = gsTLGridNo + 161;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo;
while( sGridNo > gsTRGridNo + 161 )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo;
sGridNo -= 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo;
}
if( gus2ndNorthEdgepointArraySize )
{
{
//Allocate and copy over the valid gridnos.
gps2ndNorthEdgepointArray = (INT16*)MemAlloc( gus2ndNorthEdgepointArraySize * sizeof( INT16) );
for( i = 0; i < gus2ndNorthEdgepointArraySize; i++ )
@@ -742,35 +738,35 @@ void GenerateMapEdgepoints()
{
//1st row
sGridNo = gsTRGridNo;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo;
while( sGridNo < gsBRGridNo )
{
sGridNo += 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo;
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo;
}
//2nd row
gus2ndEastEdgepointMiddleIndex = gus2ndEastEdgepointArraySize;
sGridNo = gsTRGridNo + 159;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo;
while( sGridNo < gsBRGridNo + 159 )
{
sGridNo += 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo;
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo;
}
if( gus2ndEastEdgepointArraySize )
@@ -785,35 +781,35 @@ void GenerateMapEdgepoints()
{
//1st row
sGridNo = gsBLGridNo;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo;
while( sGridNo > gsBRGridNo )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo;
sGridNo -= 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo;
}
//2nd row
gus2ndSouthEdgepointMiddleIndex = gus2ndSouthEdgepointArraySize;
sGridNo = gsBLGridNo - 161;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo;
while( sGridNo > gsBRGridNo - 161 )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo;
sGridNo -= 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo;
}
if( gus2ndSouthEdgepointArraySize )
@@ -828,35 +824,35 @@ void GenerateMapEdgepoints()
{
//1st row
sGridNo = gsTLGridNo;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo;
while( sGridNo < gsBLGridNo )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo;
sGridNo += 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo;
}
//2nd row
gus2ndWestEdgepointMiddleIndex = gus2ndWestEdgepointArraySize;
sGridNo = gsTLGridNo - 159;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo;
while( sGridNo < gsBLGridNo - 159 )
{
sGridNo++;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo;
sGridNo += 160;
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE &&
(!gubWorldRoomInfo[ sGridNo ] || gfBasement) )
sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo;
}
if( gus2ndWestEdgepointArraySize )
@@ -867,18 +863,18 @@ void GenerateMapEdgepoints()
}
}
}
//Eliminates any edgepoints not accessible to the edge of the world. This is done to the primary edgepoints
//Eliminates any edgepoints not accessible to the edge of the world. This is done to the primary edgepoints
ValidateEdgepoints();
//Second step is to process the primary edgepoints and determine if any of the edgepoints aren't accessible from
//the associated entrypoint. These edgepoints that are rejected are placed in the secondary list.
//the associated entrypoint. These edgepoints that are rejected are placed in the secondary list.
if( gMapInformation.sIsolatedGridNo != -1 )
{ //only if there is an isolated gridno in the map. There is a flaw in the design of this system. The classification
{ //only if there is an isolated gridno in the map. There is a flaw in the design of this system. The classification
//process will automatically assign areas to be isolated if there is an obstacle between one normal edgepoint and another
//causing a 5 tile connection check to fail. So, all maps with isolated edgepoints will need to be checked manually to
//causing a 5 tile connection check to fail. So, all maps with isolated edgepoints will need to be checked manually to
//make sure there are no obstacles causing this to happen (except for obstacles between normal areas and the isolated area)
//Good thing most maps don't have isolated sections. This is one expensive function to call! Maybe 200MI!
//Good thing most maps don't have isolated sections. This is one expensive function to call! Maybe 200MI!
ClassifyEdgepoints();
}
@@ -904,7 +900,7 @@ void SaveMapEdgepoints( HWFILE fp )
FileWrite( fp, &gus1stWestEdgepointMiddleIndex, 2, NULL );
if( gus1stWestEdgepointArraySize )
FileWrite( fp, gps1stWestEdgepointArray, gus1stWestEdgepointArraySize * sizeof( INT16 ), NULL );
//2nd priority edgepoints -- for isolated areas. Okay to be zero
//2nd priority edgepoints -- for isolated areas. Okay to be zero
FileWrite( fp, &gus2ndNorthEdgepointArraySize, 2, NULL );
FileWrite( fp, &gus2ndNorthEdgepointMiddleIndex, 2, NULL );
if( gus2ndNorthEdgepointArraySize )
@@ -963,8 +959,8 @@ BOOLEAN LoadMapEdgepoints( INT8 **hBuffer )
{
TrashMapEdgepoints();
if( gMapInformation.ubMapVersion < 17 )
{ //To prevent invalidation of older maps, which only used one layer of edgepoints, and a UINT8 for
//containing the size, we will preserve that paradigm, then kill the loaded edgepoints and
{ //To prevent invalidation of older maps, which only used one layer of edgepoints, and a UINT8 for
//containing the size, we will preserve that paradigm, then kill the loaded edgepoints and
//regenerate them.
OldLoadMapEdgepoints( hBuffer );
TrashMapEdgepoints();
@@ -1071,7 +1067,7 @@ UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode )
usArraySize = gus1stWestEdgepointArraySize;
break;
default:
AssertMsg( 0, "ChooseMapEdgepoints: Failed to pass a valid strategic insertion code." );
AssertMsg( 0, "ChooseMapEdgepoints: Failed to pass a valid strategic insertion code." );
break;
}
if( !usArraySize )
@@ -1089,8 +1085,8 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic
UINT16 usSlots, usCurrSlot;
INT16 *psTempArray = NULL;
AssertMsg( ubNumDesiredPoints > 0 && ubNumDesiredPoints <= 32,
String( "ChooseMapEdgepoints: Desired points = %d, valid range is 1-32", ubNumDesiredPoints ) );
AssertMsg( ubNumDesiredPoints > 0 && ubNumDesiredPoints <= 32,
String( "ChooseMapEdgepoints: Desired points = %d, valid range is 1-32", ubNumDesiredPoints ) );
//First validate and get access to the correct array based on strategic direction.
//We will use the selected array to choose insertion gridno's.
switch( ubStrategicInsertionCode )
@@ -1112,7 +1108,7 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic
usArraySize = gus1stWestEdgepointArraySize;
break;
default:
AssertMsg( 0, "ChooseMapEdgepoints: Failed to pass a valid strategic insertion code." );
AssertMsg( 0, "ChooseMapEdgepoints: Failed to pass a valid strategic insertion code." );
break;
}
pMapEdgepointInfo->ubStrategicInsertionCode = ubStrategicInsertionCode;
@@ -1120,18 +1116,18 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic
if( !psArray || !usArraySize )
{
if( gMapInformation.sNorthGridNo == -1 && gMapInformation.sEastGridNo == -1 &&
gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1 &&
gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1 &&
gMapInformation.sCenterGridNo == -1 )
{
if( gbWorldSectorZ )
{
AssertMsg( 0,
AssertMsg( 0,
String( "Map %c%d_b%d(_a) doesn't have ANY entry points which means that it is impossible to generate map edgepoints. (LC : 1)",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
}
else
{
AssertMsg( 0,
AssertMsg( 0,
String( "Map %c%d(_a) doesn't have ANY entry points which means that it is impossible to generate map edgepoints. (LC : 1)",
gWorldSectorY + 'A' - 1, gWorldSectorX ) );
}
@@ -1139,16 +1135,16 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic
else switch( ubStrategicInsertionCode )
{
case INSERTION_CODE_NORTH:
AssertMsg( 0, "This map doesn't have any north mapedgepoints. Possibly because there is no north entry point. (LC : 1)" );
AssertMsg( 0, "This map doesn't have any north mapedgepoints. Possibly because there is no north entry point. (LC : 1)" );
break;
case INSERTION_CODE_EAST:
AssertMsg( 0, "This map doesn't have any east mapedgepoints. Possibly because there is no east entry point. (LC : 1)" );
AssertMsg( 0, "This map doesn't have any east mapedgepoints. Possibly because there is no east entry point. (LC : 1)" );
break;
case INSERTION_CODE_SOUTH:
AssertMsg( 0, "This map doesn't have any south mapedgepoints. Possibly because there is no south entry point. (LC : 1)" );
AssertMsg( 0, "This map doesn't have any south mapedgepoints. Possibly because there is no south entry point. (LC : 1)" );
break;
case INSERTION_CODE_WEST:
AssertMsg( 0, "This map doesn't have any west mapedgepoints. Possibly because there is no west entry point. NOTE: Teleportation always uses the west entrypoint. Some maps shouldn't have west entrypoints. (LC : 1)" );
AssertMsg( 0, "This map doesn't have any west mapedgepoints. Possibly because there is no west entry point. NOTE: Teleportation always uses the west entrypoint. Some maps shouldn't have west entrypoints. (LC : 1)" );
break;
}
}
@@ -1237,12 +1233,12 @@ void BeginMapEdgepointSearch()
sGridNo = gMapInformation.sSouthGridNo;
else if( gMapInformation.sWestGridNo != -1 )
sGridNo = gMapInformation.sWestGridNo;
else
else
return;
GlobalReachableTest( sGridNo );
//Now, we have the path values calculated. Now, we can check for closest edgepoints.
//Now, we have the path values calculated. Now, we can check for closest edgepoints.
}
void EndMapEdgepointSearch()
@@ -1264,8 +1260,8 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode
BOOLEAN fReserved;
if( gsReservedIndex >= 20 )
{ //Everything is reserved.
AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum...");
{ //Everything is reserved.
AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum...");
}
switch( ubInsertionCode )
{
@@ -1273,29 +1269,29 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode
psArray = gps1stNorthEdgepointArray;
usArraySize = gus1stNorthEdgepointArraySize;
if( !usArraySize )
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any north mapedgepoints. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any north mapedgepoints. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
break;
case INSERTION_CODE_EAST:
psArray = gps1stEastEdgepointArray;
usArraySize = gus1stEastEdgepointArraySize;
if( !usArraySize )
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any east mapedgepoints. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any east mapedgepoints. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
break;
case INSERTION_CODE_SOUTH:
psArray = gps1stSouthEdgepointArray;
usArraySize = gus1stSouthEdgepointArraySize;
if( !usArraySize )
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any south mapedgepoints. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any south mapedgepoints. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
break;
case INSERTION_CODE_WEST:
psArray = gps1stWestEdgepointArray;
usArraySize = gus1stWestEdgepointArraySize;
if( !usArraySize )
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any west mapedgepoints. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any west mapedgepoints. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
break;
}
if( !usArraySize )
@@ -1352,7 +1348,7 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode
{
sGridNo += sDirection;
if( sGridNo < 0 || sGridNo >= WORLD_MAX )
continue;
continue;
//Check the gridno, to see if it is available and an edgepoint.
fReserved = FALSE;
for( i = 0; i < gsReservedIndex; i++ )
@@ -1391,8 +1387,8 @@ INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCod
BOOLEAN fReserved;
if( gsReservedIndex >= 20 )
{ //Everything is reserved.
AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum...");
{ //Everything is reserved.
AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum...");
}
switch( ubInsertionCode )
{
@@ -1400,29 +1396,29 @@ INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCod
psArray = gps2ndNorthEdgepointArray;
usArraySize = gus2ndNorthEdgepointArraySize;
if( !usArraySize )
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated north mapedgepoints. KM:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated north mapedgepoints. KM:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
break;
case INSERTION_CODE_EAST:
psArray = gps2ndEastEdgepointArray;
usArraySize = gus2ndEastEdgepointArraySize;
if( !usArraySize )
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated east mapedgepoints. KM:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated east mapedgepoints. KM:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
break;
case INSERTION_CODE_SOUTH:
psArray = gps2ndSouthEdgepointArray;
usArraySize = gus2ndSouthEdgepointArraySize;
if( !usArraySize )
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated south mapedgepoints. KM:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated south mapedgepoints. KM:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
break;
case INSERTION_CODE_WEST:
psArray = gps2ndWestEdgepointArray;
usArraySize = gus2ndWestEdgepointArraySize;
if( !usArraySize )
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated west mapedgepoints. KM:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated west mapedgepoints. KM:1",
gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
break;
}
if( !usArraySize )
@@ -1479,7 +1475,7 @@ INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCod
{
sGridNo += sDirection;
if( sGridNo < 0 || sGridNo >= WORLD_MAX )
continue;
continue;
//Check the gridno, to see if it is available and an edgepoint.
fReserved = FALSE;
for( i = 0; i < gsReservedIndex; i++ )
@@ -1522,18 +1518,18 @@ BOOLEAN VerifyEdgepoint( SOLDIERTYPE * pSoldier, INT16 sEdgepoint )
iSearchRange = EDGE_OF_MAP_SEARCH;
// determine maximum horizontal limits
sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL));
sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL));
//NumMessage("sMaxLeft = ",sMaxLeft);
sMaxRight = min( iSearchRange, MAXCOL - ((pSoldier->sGridNo % MAXCOL) + 1));
//NumMessage("sMaxRight = ",sMaxRight);
// determine maximum vertical limits
sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW));
sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW));
//NumMessage("sMaxUp = ",sMaxUp);
sMaxDown = min( iSearchRange, MAXROW - ((pSoldier->sGridNo / MAXROW) + 1));
// Call FindBestPath to set flags in all locations that we can
// walk into within range. We have to set some things up first...
// walk into within range. We have to set some things up first...
// set the distance limit of the square region
gubNPCDistLimit = EDGE_OF_MAP_SEARCH;
@@ -1548,7 +1544,7 @@ BOOLEAN VerifyEdgepoint( SOLDIERTYPE * pSoldier, INT16 sEdgepoint )
}
}
FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE );
FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE );
// Turn off the "reachable" flag for the current location
// so we don't consider it
@@ -1588,7 +1584,7 @@ BOOLEAN EdgepointsClose( SOLDIERTYPE *pSoldier, INT16 sEdgepoint1, INT16 sEdgepo
pSoldier->sGridNo = sEdgepoint1;
if( gWorldSectorX == 14 && gWorldSectorY == 9 && !gbWorldSectorZ )
{ //BRUTAL CODE -- special case map.
{ //BRUTAL CODE -- special case map.
iSearchRange = 250;
}
else
@@ -1597,18 +1593,18 @@ BOOLEAN EdgepointsClose( SOLDIERTYPE *pSoldier, INT16 sEdgepoint1, INT16 sEdgepo
}
// determine maximum horizontal limits
sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL));
sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL));
//NumMessage("sMaxLeft = ",sMaxLeft);
sMaxRight = min( iSearchRange, MAXCOL - ((pSoldier->sGridNo % MAXCOL) + 1));
//NumMessage("sMaxRight = ",sMaxRight);
// determine maximum vertical limits
sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW));
sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW));
//NumMessage("sMaxUp = ",sMaxUp);
sMaxDown = min( iSearchRange, MAXROW - ((pSoldier->sGridNo / MAXROW) + 1));
// Call FindBestPath to set flags in all locations that we can
// walk into within range. We have to set some things up first...
// walk into within range. We have to set some things up first...
// set the distance limit of the square region
gubNPCDistLimit = (UINT8)iSearchRange;
@@ -1623,7 +1619,7 @@ BOOLEAN EdgepointsClose( SOLDIERTYPE *pSoldier, INT16 sEdgepoint1, INT16 sEdgepo
}
}
if( FindBestPath( pSoldier, sEdgepoint2, pSoldier->bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ) )
if( FindBestPath( pSoldier, sEdgepoint2, pSoldier->pathing.bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ) )
{
return TRUE;
}
@@ -1640,13 +1636,10 @@ UINT8 CalcMapEdgepointClassInsertionCode( INT16 sGridNo )
INT16 sClosestSpot2 = NOWHERE, sClosestDist2 = 0x7FFF;
BOOLEAN fPrimaryValid = FALSE, fSecondaryValid = FALSE;
// WDS - Clean up inventory handling
// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE );
Soldier.initialize();
Soldier.bTeam = 1;
Soldier.sGridNo = sGridNo;
if( gMapInformation.sIsolatedGridNo == -1 )
if( gMapInformation.sIsolatedGridNo == -1 )
{ //If the map has no isolated area, then all edgepoints are primary.
return INSERTION_CODE_PRIMARY_EDGEINDEX;
}
@@ -1682,7 +1675,7 @@ UINT8 CalcMapEdgepointClassInsertionCode( INT16 sGridNo )
return INSERTION_CODE_PRIMARY_EDGEINDEX;
}
// Do a 2D search to find the closest map edgepoint and
// Do a 2D search to find the closest map edgepoint and
// try to create a path there
for ( iLoop = 0; iLoop < iEdgepointArraySize1; iLoop++ )
{
@@ -1833,11 +1826,11 @@ void ShowMapEdgepoints()
{
ScreenMsg( 0, MSG_TESTVERSION, L"Showing display of map edgepoints (%d illegal primary, %d illegal secondary)" );
}
ScreenMsg( 0, MSG_TESTVERSION, L"N:%d:%d E:%d:%d S:%d:%d W:%d:%d",
gus1stNorthEdgepointArraySize, gus2ndNorthEdgepointArraySize,
gus1stEastEdgepointArraySize, gus2ndEastEdgepointArraySize,
gus1stSouthEdgepointArraySize, gus2ndSouthEdgepointArraySize,
gus1stWestEdgepointArraySize, gus2ndWestEdgepointArraySize );
ScreenMsg( 0, MSG_TESTVERSION, L"N:%d:%d E:%d:%d S:%d:%d W:%d:%d",
gus1stNorthEdgepointArraySize, gus2ndNorthEdgepointArraySize,
gus1stEastEdgepointArraySize, gus2ndEastEdgepointArraySize,
gus1stSouthEdgepointArraySize, gus2ndSouthEdgepointArraySize,
gus1stWestEdgepointArraySize, gus2ndWestEdgepointArraySize );
}
void HideMapEdgepoints()
@@ -1872,7 +1865,7 @@ void HideMapEdgepoints()
RemoveAllTopmostsOfTypeRange( gps1stWestEdgepointArray[ i ], FIRSTPOINTERS, FIRSTPOINTERS );
}
}
for( i = 0 ; i < gus2ndNorthEdgepointArraySize; i++ )
{
if( gps2ndNorthEdgepointArray[ i ] != -1 )
@@ -1902,4 +1895,4 @@ void HideMapEdgepoints()
}
}
}
#endif
#endif