summaryrefslogtreecommitdiffstats
path: root/src/control/PathFind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/PathFind.cpp')
-rw-r--r--src/control/PathFind.cpp555
1 files changed, 0 insertions, 555 deletions
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index b8203821..c278cf35 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -18,16 +18,9 @@ CPathFind ThePaths;
#define MIN_PED_ROUTE_DISTANCE 23.8f
-#ifdef MIAMI
-#define NUMTEMPNODES 5000
-#define NUMDETACHED_CARS 1024
-#define NUMDETACHED_PEDS 1214
-#define NUMTEMPEXTERNALNODES 4600
-#else
#define NUMTEMPNODES 4000
#define NUMDETACHED_CARS 100
#define NUMDETACHED_PEDS 50
-#endif
// object flags:
@@ -37,18 +30,9 @@ CPathFind ThePaths;
CPathInfoForObject *InfoForTileCars;
CPathInfoForObject *InfoForTilePeds;
-#ifndef MIAMI
// unused
CTempDetachedNode *DetachedNodesCars;
CTempDetachedNode *DetachedNodesPeds;
-#else
-CPathInfoForObject *DetachedInfoForTileCars;
-CPathInfoForObject *DetachedInfoForTilePeds;
-CTempNodeExternal *TempExternalNodes;
-int32 NumTempExternalNodes;
-int32 NumDetachedPedNodeGroups;
-int32 NumDetachedCarNodeGroups;
-#endif
bool
CPedPath::CalcPedRoute(int8 pathType, CVector position, CVector destination, CVector *pointPoses, int16 *pointsFound, int16 maxPoints)
@@ -243,28 +227,6 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
}
}
-#ifdef MIAMI
-// Make sure all externals link TO an internal
-void
-CPathInfoForObject::SwapConnectionsToBeRightWayRound(void)
-{
- int e, i;
- CPathInfoForObject *tile = this;
-
- for(e = 0; e < 12; e++)
- if(tile[e].type == NodeTypeExtern && tile[e].next < 0)
- for(i = 0; i < 12; i++)
- if(tile[i].type == NodeTypeIntern && tile[i].next == e){
- tile[e].next = i;
- tile[i].next = -1;
- bool tmp = !!tile[e].crossing;
- tile[e].crossing = tile[i].crossing;
- tile[i].crossing = tmp;
- }
-}
-#endif
-
-//--MIAMI: done
void
CPathFind::Init(void)
{
@@ -275,15 +237,11 @@ CPathFind::Init(void)
m_numConnections = 0;
m_numCarPathLinks = 0;
unk = 0;
-#ifdef MIAMI
- NumTempExternalNodes = 0;
-#endif
for(i = 0; i < NUM_PATHNODES; i++)
m_pathNodes[i].distance = MAX_DIST;
}
-//--MIAMI: done
void
CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
{
@@ -298,7 +256,6 @@ CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
InfoForTilePeds = new CPathInfoForObject[12*numPathGroups];
memset(InfoForTilePeds, 0, 12*numPathGroups*sizeof(CPathInfoForObject));
-#ifndef MIAMI
// unused
delete[] DetachedNodesCars;
DetachedNodesCars = nil;
@@ -308,32 +265,14 @@ CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
memset(DetachedNodesCars, 0, NUMDETACHED_CARS*sizeof(CTempDetachedNode));
DetachedNodesPeds = new CTempDetachedNode[NUMDETACHED_PEDS];
memset(DetachedNodesPeds, 0, NUMDETACHED_PEDS*sizeof(CTempDetachedNode));
-#else
- delete[] DetachedInfoForTileCars;
- DetachedInfoForTileCars = nil;
- delete[] DetachedInfoForTilePeds;
- DetachedInfoForTilePeds = nil;
- DetachedInfoForTileCars = new CPathInfoForObject[12*NUMDETACHED_CARS];
- memset(DetachedInfoForTileCars, 0, 12*NUMDETACHED_CARS*sizeof(CPathInfoForObject));
- DetachedInfoForTilePeds = new CPathInfoForObject[12*NUMDETACHED_PEDS];
- memset(DetachedInfoForTilePeds, 0, 12*NUMDETACHED_PEDS*sizeof(CPathInfoForObject));
-
- TempExternalNodes = new CTempNodeExternal[NUMTEMPEXTERNALNODES];
- memset(TempExternalNodes, 0, NUMTEMPEXTERNALNODES*sizeof(CTempNodeExternal));
- NumTempExternalNodes = 0;
- NumDetachedPedNodeGroups = 0;
- NumDetachedCarNodeGroups = 0;
-#endif
}
-//--MIAMI: done
void
CPathFind::RegisterMapObject(CTreadable *mapObject)
{
m_mapObjects[m_numMapObjects++] = mapObject;
}
-//--MIAMI: TODO: implement all the arguments once we can load the VC map
void
CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, int16 width, bool crossing)
{
@@ -342,27 +281,13 @@ CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x,
i = id*12 + node;
InfoForTilePeds[i].type = type;
InfoForTilePeds[i].next = next;
-#ifndef MIAMI
InfoForTilePeds[i].x = x;
InfoForTilePeds[i].y = y;
InfoForTilePeds[i].z = z;
-#else
- InfoForTilePeds[i].x = x/16.0f;
- InfoForTilePeds[i].y = y/16.0f;
- InfoForTilePeds[i].z = z/16.0f;
-#endif
InfoForTilePeds[i].numLeftLanes = 0;
InfoForTilePeds[i].numRightLanes = 0;
InfoForTilePeds[i].crossing = crossing;
-#ifdef MIAMI
- InfoForTilePeds[i].flag02 = false;
- InfoForTilePeds[i].roadBlock = false;
- InfoForTilePeds[i].disabled = false;
- InfoForTilePeds[i].waterPath = false;
- InfoForTilePeds[i].betweenLevels = false;
-#endif
-#ifndef MIAMI
if(type)
for(i = 0; i < node; i++){
j = id*12 + i;
@@ -373,13 +298,8 @@ CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x,
printf("Modelindex of cullprit: %d\n\n", id);
}
}
-#else
- if(node == 11)
- InfoForTilePeds[id*12].SwapConnectionsToBeRightWayRound();
-#endif
}
-//--MIAMI: TODO: implement all the arguments once we can load the VC map
void
CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, int16 width, int8 numLeft, int8 numRight)
{
@@ -388,28 +308,13 @@ CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x,
i = id*12 + node;
InfoForTileCars[i].type = type;
InfoForTileCars[i].next = next;
-#ifndef MIAMI
InfoForTileCars[i].x = x;
InfoForTileCars[i].y = y;
InfoForTileCars[i].z = z;
-#else
- InfoForTileCars[i].x = x/16.0f;
- InfoForTileCars[i].y = y/16.0f;
- InfoForTileCars[i].z = z/16.0f;
-#endif
InfoForTileCars[i].numLeftLanes = numLeft;
InfoForTileCars[i].numRightLanes = numRight;
-#ifdef MIAMI
- InfoForTileCars[i].crossing = false;
- InfoForTileCars[i].flag02 = false;
- InfoForTileCars[i].roadBlock = false;
- InfoForTileCars[i].disabled = false;
- InfoForTileCars[i].waterPath = false;
- InfoForTileCars[i].betweenLevels = false;
-#endif
-#ifndef MIAMI
if(type)
for(i = 0; i < node; i++){
j = id*12 + i;
@@ -420,13 +325,8 @@ CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x,
printf("Modelindex of cullprit: %d\n\n", id);
}
}
-#else
- if(node == 11)
- InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound();
-#endif
}
-#ifndef MIAMI
void
CPathFind::CalcNodeCoors(int16 x, int16 y, int16 z, int id, CVector *out)
{
@@ -436,19 +336,7 @@ CPathFind::CalcNodeCoors(int16 x, int16 y, int16 z, int id, CVector *out)
pos.z = z / 16.0f;
*out = m_mapObjects[id]->GetMatrix() * pos;
}
-#else
-void
-CPathFind::CalcNodeCoors(float x, float y, float z, int id, CVector *out)
-{
- CVector pos;
- pos.x = x;
- pos.y = y;
- pos.z = z;
- *out = m_mapObjects[id]->GetMatrix() * pos;
-}
-#endif
-//--MIAMI: done
bool
CPathFind::LoadPathFindData(void)
{
@@ -456,7 +344,6 @@ CPathFind::LoadPathFindData(void)
return false;
}
-//--MIAMI: done
void
CPathFind::PreparePathData(void)
{
@@ -468,20 +355,14 @@ CPathFind::PreparePathData(void)
printf("PreparePathData\n");
if(!CPathFind::LoadPathFindData() && // empty
InfoForTileCars && InfoForTilePeds &&
-#ifndef MIAMI
DetachedNodesCars && DetachedNodesPeds
-#else
- DetachedInfoForTileCars && DetachedInfoForTilePeds && TempExternalNodes
-#endif
){
tempNodes = new CTempNode[NUMTEMPNODES];
m_numConnections = 0;
-#ifndef MIAMI
for(i = 0; i < PATHNODESIZE; i++)
m_pathNodes[i].unkBits = 0;
-#endif
for(i = 0; i < PATHNODESIZE; i++){
numExtern = 0;
@@ -496,21 +377,6 @@ CPathFind::PreparePathData(void)
printf("ILLEGAL BLOCK. MORE THAN 1 INTERNALS AND NOT 2 EXTERNALS (Modelindex:%d)\n", i);
}
-#ifdef MIAMI
- int numExternDetached, numInternDetached;
- for(i = 0; i < NUMDETACHED_CARS; i++){
- numExternDetached = 0;
- numInternDetached = 0;
- for(j = 0; j < 12; j++){
- if(DetachedInfoForTileCars[i*12 + j].type == NodeTypeExtern)
- numExternDetached++;
- if(DetachedInfoForTilePeds[i*12 + j].type == NodeTypeIntern)
- numInternDetached++;
- }
- // no diagnostic here
- }
-#endif
-
for(i = 0; i < PATHNODESIZE; i++)
for(j = 0; j < 12; j++)
if(InfoForTileCars[i*12 + j].type == NodeTypeExtern){
@@ -522,33 +388,13 @@ CPathFind::PreparePathData(void)
if(InfoForTileCars[i*12 + j].numLeftLanes + InfoForTileCars[i*12 + j].numRightLanes <= 0)
printf("ILLEGAL BLOCK. NO LANES IN NODE (Obj:%d)\n", i);
}
-#ifdef MIAMI
- for(i = 0; i < NUMDETACHED_CARS; i++)
- for(j = 0; j < 12; j++)
- if(DetachedInfoForTilePeds[i*12 + j].type == NodeTypeExtern){
- // MI:%d here but no argument for it
- if(DetachedInfoForTilePeds[i*12 + j].numLeftLanes < 0)
- printf("ILLEGAL BLOCK. NEGATIVE NUMBER OF LANES (Obj:%d)\n", i);
- if(DetachedInfoForTilePeds[i*12 + j].numRightLanes < 0)
- printf("ILLEGAL BLOCK. NEGATIVE NUMBER OF LANES (Obj:%d)\n", i);
- if(DetachedInfoForTilePeds[i*12 + j].numLeftLanes + DetachedInfoForTilePeds[i*12 + j].numRightLanes <= 0)
- printf("ILLEGAL BLOCK. NO LANES IN NODE (Obj:%d)\n", i);
- }
-#endif
m_numPathNodes = 0;
-#ifndef MIAMI
PreparePathDataForType(PATH_CAR, tempNodes, InfoForTileCars, 1.0f, DetachedNodesCars, NUMDETACHED_CARS);
m_numCarPathNodes = m_numPathNodes;
PreparePathDataForType(PATH_PED, tempNodes, InfoForTilePeds, 1.0f, DetachedNodesPeds, NUMDETACHED_PEDS);
-#else
- PreparePathDataForType(PATH_CAR, tempNodes, InfoForTileCars, 1.0f, DetachedInfoForTileCars, NumDetachedCarNodeGroups);
- m_numCarPathNodes = m_numPathNodes;
- PreparePathDataForType(PATH_PED, tempNodes, InfoForTilePeds, 1.0f, DetachedInfoForTilePeds, NumDetachedPedNodeGroups);
-#endif
m_numPedPathNodes = m_numPathNodes - m_numCarPathNodes;
-#ifndef MIAMI
// TODO: figure out what exactly is going on here
// Some roads seem to get a west/east flag
for(i = 0; i < m_numMapObjects; i++){
@@ -587,7 +433,6 @@ CPathFind::PreparePathData(void)
}
}
}
-#endif
delete[] tempNodes;
@@ -599,24 +444,14 @@ CPathFind::PreparePathData(void)
delete[] InfoForTilePeds;
InfoForTilePeds = nil;
-#ifndef MIAMI
delete[] DetachedNodesCars;
DetachedNodesCars = nil;
delete[] DetachedNodesPeds;
DetachedNodesPeds = nil;
-#else
- delete[] DetachedInfoForTileCars;
- DetachedInfoForTileCars = nil;
- delete[] DetachedInfoForTilePeds;
- DetachedInfoForTilePeds = nil;
- delete[] TempExternalNodes;
- TempExternalNodes = nil;
-#endif
}
printf("Done with PreparePathData\n");
}
-//--MIAMI: done
/* String together connected nodes in a list by a flood fill algorithm */
void
CPathFind::CountFloodFillGroups(uint8 type)
@@ -659,13 +494,8 @@ CPathFind::CountFloodFillGroups(uint8 type)
if(node->numLinks == 0){
if(type == PATH_CAR)
-#ifndef MIAMI
printf("Single car node: %f %f %f (%d)\n",
node->GetX(), node->GetY(), node->GetZ(), m_mapObjects[node->objectIndex]->GetModelIndex());
-#else
- printf("Single car node: %f %f %f\n",
- node->GetX(), node->GetY(), node->GetZ());
-#endif
else
printf("Single ped node: %f %f %f\n",
node->GetX(), node->GetY(), node->GetZ());
@@ -693,14 +523,9 @@ CPathFind::CountFloodFillGroups(uint8 type)
int32 TempListLength;
-//--MIAMI: done
void
CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo,
-#ifndef MIAMI
float maxdist, CTempDetachedNode *detachednodes, int numDetached)
-#else
- float maxdist, CPathInfoForObject *detachednodes, int numDetached)
-#endif
{
static CVector CoorsXFormed;
int i, j, k, l;
@@ -721,17 +546,11 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
oldNumPathNodes = m_numPathNodes;
oldNumLinks = m_numConnections;
-#ifndef MIAMI
#define OBJECTINDEX(n) (m_pathNodes[(n)].objectIndex)
// Initialize map objects
for(i = 0; i < m_numMapObjects; i++)
for(j = 0; j < 12; j++)
m_mapObjects[i]->m_nodeIndices[type][j] = -1;
-#else
-#define OBJECTINDEX(n) (mapObjIndices[(n)])
- int16 *mapObjIndices = new int16[NUM_PATHNODES];
- NumTempExternalNodes = 0;
-#endif
// Calculate internal nodes, store them and connect them to defining object
for(i = 0; i < m_numMapObjects; i++){
@@ -747,83 +566,16 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
&CoorsXFormed);
m_pathNodes[m_numPathNodes].SetPosition(CoorsXFormed);
OBJECTINDEX(m_numPathNodes) = i;
-#ifndef MIAMI
m_pathNodes[m_numPathNodes].unkBits = 1;
m_mapObjects[i]->m_nodeIndices[type][j] = m_numPathNodes;
-#else
- m_pathNodes[m_numPathNodes].width = objectpathinfo[start + j].width;
- m_pathNodes[m_numPathNodes].speedLimit = objectpathinfo[start + j].speedLimit;
- m_pathNodes[m_numPathNodes].spawnRate = objectpathinfo[start + j].spawnRate;
- m_pathNodes[m_numPathNodes].bUseInRoadBlock = objectpathinfo[start + j].roadBlock;
- m_pathNodes[m_numPathNodes].bDisabled = objectpathinfo[start + j].disabled;
- m_pathNodes[m_numPathNodes].bWaterPath = objectpathinfo[start + j].waterPath;
- m_pathNodes[m_numPathNodes].flagB2 = objectpathinfo[start + j].flag02;
- m_pathNodes[m_numPathNodes].bBetweenLevels = objectpathinfo[start + j].betweenLevels;
-#endif
m_numPathNodes++;
}
-#ifdef MIAMI
- else if(objectpathinfo[start + j].type == NodeTypeExtern){
- CalcNodeCoors(
- objectpathinfo[start + j].x,
- objectpathinfo[start + j].y,
- objectpathinfo[start + j].z,
- i,
- &CoorsXFormed);
- TempExternalNodes[NumTempExternalNodes].pos = CoorsXFormed;
- assert(objectpathinfo[start + j].next >= 0);
- TempExternalNodes[NumTempExternalNodes].next = tileStart + objectpathinfo[start + j].next;
- TempExternalNodes[NumTempExternalNodes].numLeftLanes = objectpathinfo[start + j].numLeftLanes;
- TempExternalNodes[NumTempExternalNodes].numRightLanes = objectpathinfo[start + j].numRightLanes;
- TempExternalNodes[NumTempExternalNodes].width = objectpathinfo[start + j].width;
- TempExternalNodes[NumTempExternalNodes].isCross = !!objectpathinfo[start + j].crossing;
- NumTempExternalNodes++;
- }
-#endif
}
}
-#ifdef MIAMI
- // Same thing for detached nodes
- for(i = 0; i < numDetached; i++){
- tileStart = m_numPathNodes;
- start = 12*i;
- for(j = 0; j < 12; j++){
- if(detachednodes[start + j].type == NodeTypeIntern){
- CVector pos;
- pos.x = detachednodes[start + j].x;
- pos.y = detachednodes[start + j].y;
- pos.z = detachednodes[start + j].z;
- m_pathNodes[m_numPathNodes].SetPosition(pos);
- mapObjIndices[m_numPathNodes] = -(i+1);
- m_pathNodes[m_numPathNodes].width = detachednodes[start + j].width;
- m_pathNodes[m_numPathNodes].speedLimit = detachednodes[start + j].speedLimit;
- m_pathNodes[m_numPathNodes].spawnRate = detachednodes[start + j].spawnRate;
- m_pathNodes[m_numPathNodes].bUseInRoadBlock = detachednodes[start + j].roadBlock;
- m_pathNodes[m_numPathNodes].bDisabled = detachednodes[start + j].disabled;
- m_pathNodes[m_numPathNodes].bWaterPath = detachednodes[start + j].waterPath;
- m_pathNodes[m_numPathNodes].flagB2 = detachednodes[start + j].flag02;
- m_pathNodes[m_numPathNodes].bBetweenLevels = detachednodes[start + j].betweenLevels;
- m_numPathNodes++;
- }else if(detachednodes[start + j].type == NodeTypeExtern){
- TempExternalNodes[NumTempExternalNodes].pos.x = detachednodes[start + j].x;
- TempExternalNodes[NumTempExternalNodes].pos.y = detachednodes[start + j].y;
- TempExternalNodes[NumTempExternalNodes].pos.z = detachednodes[start + j].z;
- assert(detachednodes[start + j].next >= 0);
- TempExternalNodes[NumTempExternalNodes].next = tileStart + detachednodes[start + j].next;
- TempExternalNodes[NumTempExternalNodes].numLeftLanes = detachednodes[start + j].numLeftLanes;
- TempExternalNodes[NumTempExternalNodes].numRightLanes = detachednodes[start + j].numRightLanes;
- TempExternalNodes[NumTempExternalNodes].width = detachednodes[start + j].width;
- TempExternalNodes[NumTempExternalNodes].isCross = !!detachednodes[start + j].crossing;
- NumTempExternalNodes++;
- }
- }
- }
-#endif
// Insert external nodes into TempList
TempListLength = 0;
-#ifndef MIAMI
for(i = 0; i < m_numMapObjects; i++){
start = 12 * m_mapObjects[i]->GetModelIndex();
for(j = 0; j < 12; j++){
@@ -899,62 +651,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
}
}
}
-#else
- for(i = 0; i < NumTempExternalNodes; i++){
- // find closest unconnected node
- nearestId = -1;
- nearestDist = maxdist;
- for(k = 0; k < TempListLength; k++){
- if(tempnodes[k].linkState != 1)
- continue;
- dx = tempnodes[k].pos.x - TempExternalNodes[i].pos.x;
- if(Abs(dx) < nearestDist){
- dy = tempnodes[k].pos.y - TempExternalNodes[i].pos.y;
- if(Abs(dy) < nearestDist){
- nearestDist = Max(Abs(dx), Abs(dy));
- nearestId = k;
- }
- }
- }
-
- if(nearestId < 0){
- // None found, add this one to temp list
- tempnodes[TempListLength].pos = TempExternalNodes[i].pos;
- // link to connecting internal node
- tempnodes[TempListLength].link1 = TempExternalNodes[i].next;
- if(type == PATH_CAR){
- tempnodes[TempListLength].numLeftLanes = TempExternalNodes[i].numLeftLanes;
- tempnodes[TempListLength].numRightLanes = TempExternalNodes[i].numRightLanes;
- }
- tempnodes[TempListLength].width = TempExternalNodes[i].width;
- tempnodes[TempListLength].isCross = TempExternalNodes[i].isCross;
- tempnodes[TempListLength++].linkState = 1;
- }else{
- // Found nearest, connect it to our neighbour
- tempnodes[nearestId].link2 = TempExternalNodes[i].next;
- tempnodes[nearestId].linkState = 2;
-
- // collapse this node with nearest we found
- dx = m_pathNodes[tempnodes[nearestId].link1].GetX() - m_pathNodes[tempnodes[nearestId].link2].GetX();
- dy = m_pathNodes[tempnodes[nearestId].link1].GetY() - m_pathNodes[tempnodes[nearestId].link2].GetY();
- tempnodes[nearestId].pos = (tempnodes[nearestId].pos + TempExternalNodes[i].pos)*0.5f;
- mag = Sqrt(dx*dx + dy*dy);
- tempnodes[nearestId].dirX = dx/mag * 100;
- tempnodes[nearestId].dirY = dy/mag * 100;
- tempnodes[nearestId].width = Max(tempnodes[nearestId].width, TempExternalNodes[i].width);
- if(TempExternalNodes[i].isCross)
- tempnodes[nearestId].isCross = true; // TODO: is this guaranteed to be false otherwise?
- // do something when number of lanes doesn't agree
- if(type == PATH_CAR)
- if(tempnodes[nearestId].numLeftLanes != 0 && tempnodes[nearestId].numRightLanes != 0 &&
- (TempExternalNodes[i].numLeftLanes == 0 || TempExternalNodes[i].numRightLanes == 0)){
- // why switch left and right here?
- tempnodes[nearestId].numLeftLanes = TempExternalNodes[i].numRightLanes;
- tempnodes[nearestId].numRightLanes = TempExternalNodes[i].numLeftLanes;
- }
- }
- }
-#endif
// Loop through previously added internal nodes and link them
for(i = oldNumPathNodes; i < m_numPathNodes; i++){
@@ -977,49 +673,27 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
continue;
dist = (m_pathNodes[i].GetPosition() - m_pathNodes[ConnectedNode(m_numConnections)].GetPosition()).Magnitude();
-#ifndef MIAMI
m_distances[m_numConnections] = dist;
m_connectionFlags[m_numConnections].flags = 0;
-#else
- m_distances[m_numConnections] = Min(dist, 255);
- if(tempnodes[j].isCross)
- m_connections[j] |= 0x8000; // crosses road flag
-#endif
if(type == PATH_CAR){
// IMPROVE: use a goto here
// Find existing car path link
for(k = 0; k < m_numCarPathLinks; k++){
-#ifndef MIAMI
if(m_carPathLinks[k].dir.x == tempnodes[j].dirX &&
m_carPathLinks[k].dir.y == tempnodes[j].dirY &&
m_carPathLinks[k].pos.x == tempnodes[j].pos.x &&
m_carPathLinks[k].pos.y == tempnodes[j].pos.y){
-#else
- if(m_carPathLinks[k].dirX == tempnodes[j].dirX &&
- m_carPathLinks[k].dirY == tempnodes[j].dirY &&
- m_carPathLinks[k].x == (int)(tempnodes[j].pos.x*8.0f) &&
- m_carPathLinks[k].y == (int)(tempnodes[j].pos.y*8.0f)){
-#endif
m_carPathConnections[m_numConnections] = k;
k = m_numCarPathLinks;
}
}
// k is m_numCarPathLinks+1 if we found one
if(k == m_numCarPathLinks){
-#ifndef MIAMI
m_carPathLinks[m_numCarPathLinks].dir.x = tempnodes[j].dirX;
m_carPathLinks[m_numCarPathLinks].dir.y = tempnodes[j].dirY;
m_carPathLinks[m_numCarPathLinks].pos.x = tempnodes[j].pos.x;
m_carPathLinks[m_numCarPathLinks].pos.y = tempnodes[j].pos.y;
-#else
- m_carPathLinks[m_numCarPathLinks].dirX = tempnodes[j].dirX;
- m_carPathLinks[m_numCarPathLinks].dirY = tempnodes[j].dirY;
- m_carPathLinks[m_numCarPathLinks].x = tempnodes[j].pos.x*8.0f;
- m_carPathLinks[m_numCarPathLinks].y = tempnodes[j].pos.y*8.0f;
- m_carPathLinks[m_numCarPathLinks].flag1 = false;
- m_carPathLinks[m_numCarPathLinks].width = tempnodes[j].width;
-#endif
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
m_carPathLinks[m_numCarPathLinks].numLeftLanes = tempnodes[j].numLeftLanes;
m_carPathLinks[m_numCarPathLinks].numRightLanes = tempnodes[j].numRightLanes;
@@ -1033,20 +707,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
m_numConnections++;
}
-#ifdef MIAMI
- CPathInfoForObject *tile;
- if(mapObjIndices[i] < 0){
- if(type == PATH_CAR)
- tile = &DetachedInfoForTileCars[12 * (-1 - mapObjIndices[i])];
- else
- tile = &DetachedInfoForTilePeds[12 * (-1 - mapObjIndices[i])];
- }else{
- if(type == PATH_CAR)
- tile = &InfoForTileCars[12 * m_mapObjects[mapObjIndices[i]]->GetModelIndex()];
- else
- tile = &InfoForTilePeds[12 * m_mapObjects[mapObjIndices[i]]->GetModelIndex()];
- }
-#endif
// Find i inside path segment
iseg = 0;
@@ -1054,9 +714,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
if(OBJECTINDEX(j) == OBJECTINDEX(i))
iseg++;
-#ifndef MIAMI
istart = 12 * m_mapObjects[m_pathNodes[i].objectIndex]->GetModelIndex();
-#endif
// Add links to other internal nodes
for(j = Max(oldNumPathNodes, i-12); j < Min(m_numPathNodes, i+12); j++){
if(OBJECTINDEX(i) != OBJECTINDEX(j) || i == j)
@@ -1064,23 +722,14 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
// N.B.: in every path segment, the externals have to be at the end
jseg = j-i + iseg;
-#ifndef MIAMI
jstart = 12 * m_mapObjects[m_pathNodes[j].objectIndex]->GetModelIndex();
if(objectpathinfo[istart + iseg].next == jseg ||
objectpathinfo[jstart + jseg].next == iseg){
-#else
- if(tile[iseg].next == jseg ||
- tile[jseg].next == iseg){
-#endif
// Found a link between i and jConnectionSetCrossesRoad
// NB this clears the flags in MIAMI
m_connections[m_numConnections] = j;
dist = (m_pathNodes[i].GetPosition() - m_pathNodes[j].GetPosition()).Magnitude();
-#ifndef MIAMI
m_distances[m_numConnections] = dist;
-#else
- m_distances[m_numConnections] = Min(dist, 255);
-#endif
if(type == PATH_CAR){
posx = (m_pathNodes[i].GetX() + m_pathNodes[j].GetX())*0.5f;
@@ -1090,9 +739,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
mag = Sqrt(dx*dx + dy*dy);
dx /= mag;
dy /= mag;
-#ifdef MIAMI
- int width = Max(m_pathNodes[i].width, m_pathNodes[j].width);
-#endif
if(i < j){
dx = -dx;
dy = -dy;
@@ -1100,36 +746,20 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
// IMPROVE: use a goto here
// Find existing car path link
for(k = 0; k < m_numCarPathLinks; k++){
-#ifndef MIAMI
if(m_carPathLinks[k].dir.x == dx &&
m_carPathLinks[k].dir.y == dy &&
m_carPathLinks[k].pos.x == posx &&
m_carPathLinks[k].pos.y == posy){
-#else
- if(m_carPathLinks[k].dirX == (int)(dx*100.0f) &&
- m_carPathLinks[k].dirY == (int)(dy*100.0f) &&
- m_carPathLinks[k].x == (int)(posx*8.0f) &&
- m_carPathLinks[k].y == (int)(posy*8.0f)){
-#endif
m_carPathConnections[m_numConnections] = k;
k = m_numCarPathLinks;
}
}
// k is m_numCarPathLinks+1 if we found one
if(k == m_numCarPathLinks){
-#ifndef MIAMI
m_carPathLinks[m_numCarPathLinks].dir.x = dx;
m_carPathLinks[m_numCarPathLinks].dir.y = dy;
m_carPathLinks[m_numCarPathLinks].pos.x = posx;
m_carPathLinks[m_numCarPathLinks].pos.y = posy;
-#else
- m_carPathLinks[m_numCarPathLinks].dirX = dx*100.0f;
- m_carPathLinks[m_numCarPathLinks].dirY = dy*100.0f;
- m_carPathLinks[m_numCarPathLinks].x = posx*8.0f;
- m_carPathLinks[m_numCarPathLinks].y = posy*8.0f;
- m_carPathLinks[m_numCarPathLinks].flag1 = false;
- m_carPathLinks[m_numCarPathLinks].width = width;
-#endif
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1;
m_carPathLinks[m_numCarPathLinks].numRightLanes = -1;
@@ -1139,17 +769,11 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
}
}else{
// Crosses road
-#ifndef MIAMI
if(objectpathinfo[istart + iseg].next == jseg && objectpathinfo[istart + iseg].crossing ||
objectpathinfo[jstart + jseg].next == iseg && objectpathinfo[jstart + jseg].crossing)
m_connectionFlags[m_numConnections].bCrossesRoad = true;
else
m_connectionFlags[m_numConnections].bCrossesRoad = false;
-#else
- if(tile[iseg].next == jseg && tile[iseg].crossing ||
- tile[jseg].next == iseg && tile[jseg].crossing)
- m_connections[m_numConnections] |= 0x8000; // crosses road flag
-#endif
}
m_pathNodes[i].numLinks++;
@@ -1162,11 +786,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
done = 0;
// Set number of lanes for all nodes somehow
// very strange code
-#ifndef MIAMI
for(k = 0; !done && k < 10; k++){
-#else
- for(k = 0; !done && k < 12; k++){
-#endif
done = 1;
for(i = 0; i < m_numPathNodes; i++){
if(m_pathNodes[i].numLinks != 2)
@@ -1174,7 +794,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
l1 = m_carPathConnections[m_pathNodes[i].firstLink];
l2 = m_carPathConnections[m_pathNodes[i].firstLink+1];
-#ifndef MIAMI
if(m_carPathLinks[l1].numLeftLanes == -1 &&
m_carPathLinks[l2].numLeftLanes != -1){
done = 0;
@@ -1202,52 +821,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
}else if(m_carPathLinks[l1].numLeftLanes == -1 &&
m_carPathLinks[l2].numLeftLanes == -1)
done = 0;
-#else
- int8 l1Left = m_carPathLinks[l1].numLeftLanes;
- int8 l1Right = m_carPathLinks[l1].numRightLanes;
- int8 l2Left = m_carPathLinks[l2].numLeftLanes;
- int8 l2Right = m_carPathLinks[l2].numRightLanes;
- int8 *l1Leftp, *l1Rightp;
- int8 *l2Leftp, *l2Rightp;
- if(m_carPathLinks[l1].pathNodeIndex == i){
- l1Leftp = &l1Left;
- l1Rightp = &l1Right;
- }else{
- l1Leftp = &l1Right;
- l1Rightp = &l1Left;
- }
- if(m_carPathLinks[l2].pathNodeIndex == i){
- l2Leftp = &l2Left;
- l2Rightp = &l2Right;
- }else{
- l2Leftp = &l2Right;
- l2Rightp = &l2Left;
- }
- if(*l1Leftp == -1 && *l2Rightp != -1){
- *l1Leftp = *l2Rightp;
- done = 0;
- }
- if(*l1Rightp == -1 && *l2Leftp != -1){
- *l1Rightp = *l2Leftp;
- done = 0;
- }
- if(*l2Leftp == -1 && *l1Rightp != -1){
- *l2Leftp = *l1Rightp;
- done = 0;
- }
- if(*l2Rightp == -1 && *l1Leftp != -1){
- *l2Rightp = *l1Leftp;
- done = 0;
- }
- if(*l1Leftp == -1 && *l2Rightp == -1)
- done = 0;
- if(*l2Leftp == -1 && *l1Rightp == -1)
- done = 0;
- m_carPathLinks[l1].numLeftLanes = l1Left;
- m_carPathLinks[l1].numRightLanes = l1Right;
- m_carPathLinks[l2].numLeftLanes = l2Left;
- m_carPathLinks[l2].numRightLanes = l2Right;
-#endif
}
}
@@ -1255,17 +828,10 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
for(i = 0; i < m_numPathNodes; i++)
for(j = 0; j < m_pathNodes[i].numLinks; j++){
k = m_carPathConnections[m_pathNodes[i].firstLink + j];
-#ifndef MIAMI
if(m_carPathLinks[k].numLeftLanes < 0)
m_carPathLinks[k].numLeftLanes = 1;
if(m_carPathLinks[k].numRightLanes < 0)
m_carPathLinks[k].numRightLanes = 1;
-#else
- if(m_carPathLinks[k].numLeftLanes == -1)
- m_carPathLinks[k].numLeftLanes = 0;
- if(m_carPathLinks[k].numRightLanes == -1)
- m_carPathLinks[k].numRightLanes = 0;
-#endif
}
}
@@ -1274,10 +840,8 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
do{
cont = 0;
for(i = 0; i < m_numPathNodes; i++){
-#ifndef MIAMI
m_pathNodes[i].bDisabled = false;
m_pathNodes[i].bBetweenLevels = false;
-#endif
// See if node is a dead end, if so, we're not done yet
if(!m_pathNodes[i].bDeadEnd){
k = 0;
@@ -1310,7 +874,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
m_connections[j] = node-1;
}
-#ifndef MIAMI
// Also in treadables
for(j = 0; j < m_numMapObjects; j++)
for(k = 0; k < 12; k++){
@@ -1322,17 +885,12 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
}else if(m_mapObjects[j]->m_nodeIndices[PATH_PED][k] > i)
m_mapObjects[j]->m_nodeIndices[PATH_PED][k]--;
}
-#endif
i--;
m_numPathNodes--;
}
-#ifdef MIAMI
- delete[] mapObjIndices;
-#endif
}
-//--MIAMI: done
float
CPathFind::CalcRoadDensity(float x, float y)
{
@@ -1350,7 +908,6 @@ CPathFind::CalcRoadDensity(float x, float y)
density += m_carPathLinks[next].numLeftLanes * dist;
density += m_carPathLinks[next].numRightLanes * dist;
-#ifndef MIAMI
if(m_carPathLinks[next].numLeftLanes < 0)
printf("Link from object %d to %d (MIs)\n",
m_mapObjects[m_pathNodes[i].objectIndex]->GetModelIndex(),
@@ -1359,14 +916,12 @@ CPathFind::CalcRoadDensity(float x, float y)
printf("Link from object %d to %d (MIs)\n",
m_mapObjects[m_pathNodes[i].objectIndex]->GetModelIndex(),
m_mapObjects[m_pathNodes[ConnectedNode(m_pathNodes[i].firstLink + j)].objectIndex]->GetModelIndex());
-#endif
}
}
}
return density/2500.0f;
}
-//--MIAMI: done
bool
CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2)
{
@@ -1377,7 +932,6 @@ CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2)
return false;
}
-//--MIAMI: done
bool
CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2)
{
@@ -1388,7 +942,6 @@ CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2)
return false;
}
-//--MIAMI: done
void
CPathFind::AddNodeToList(CPathNode *node, int32 listId)
{
@@ -1401,7 +954,6 @@ CPathFind::AddNodeToList(CPathNode *node, int32 listId)
node->distance = listId;
}
-//--MIAMI: done
void
CPathFind::RemoveNodeFromList(CPathNode *node)
{
@@ -1410,7 +962,6 @@ CPathFind::RemoveNodeFromList(CPathNode *node)
node->GetNext()->SetPrev(node->GetPrev());
}
-//--MIAMI: done
void
CPathFind::RemoveBadStartNode(CVector pos, CPathNode **nodes, int16 *n)
{
@@ -1438,7 +989,6 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena
}
#endif
-//--MIAMI: done
void
CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
{
@@ -1454,7 +1004,6 @@ CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
}
}
-//--MIAMI: done
void
CPathFind::SwitchRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable)
{
@@ -1470,7 +1019,6 @@ CPathFind::SwitchRoadsOffInArea(float x1, float x2, float y1, float y2, float z1
}
}
-//--MIAMI: done
void
CPathFind::SwitchPedRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable)
{
@@ -1486,7 +1034,6 @@ CPathFind::SwitchPedRoadsOffInArea(float x1, float x2, float y1, float y2, float
}
}
-//--MIAMI: unused (still needed for script here)
void
CPathFind::SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float y2, float z2, float length, uint8 type, uint8 mode)
{
@@ -1538,7 +1085,6 @@ CPathFind::SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float
}
}
-//--MIAMI: unused (still needed for script here)
void
CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId)
{
@@ -1554,7 +1100,6 @@ CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId)
}
}
-//--MIAMI: unused (still needed for script here)
void
CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
{
@@ -1569,7 +1114,6 @@ CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2,
}
}
-//--MIAMI: unused (still needed for script here)
void
CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
{
@@ -1584,14 +1128,8 @@ CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y
}
}
-//--MIAMI: done
-#ifndef MIAMI
int32
CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels)
-#else
-int32
-CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, bool ignoreFlagB4, bool bWaterPath)
-#endif
{
int i;
int firstNode, lastNode;
@@ -1613,14 +1151,9 @@ CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bo
for(i = firstNode; i < lastNode; i++){
if(ignoreDisabled && m_pathNodes[i].bDisabled) continue;
if(ignoreBetweenLevels && m_pathNodes[i].bBetweenLevels) continue;
-#ifndef MIAMI
switch(m_pathNodes[i].unkBits){
case 1:
case 2:
-#else
- if(ignoreFlagB4 && m_pathNodes[i].flagB4) continue;
- if(bWaterPath != m_pathNodes[i].bWaterPath) continue;
-#endif
dist = Abs(m_pathNodes[i].GetX() - coors.x) +
Abs(m_pathNodes[i].GetY() - coors.y) +
3.0f*Abs(m_pathNodes[i].GetZ() - coors.z);
@@ -1628,15 +1161,12 @@ CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bo
closestDist = dist;
closestNode = i;
}
-#ifndef MIAMI
break;
}
-#endif
}
return closestDist < distLimit ? closestNode : -1;
}
-//--MIAMI: done
int32
CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY)
{
@@ -1659,11 +1189,9 @@ CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, floa
}
for(i = firstNode; i < lastNode; i++){
-#ifndef MIAMI
switch(m_pathNodes[i].unkBits){
case 1:
case 2:
-#endif
dX = m_pathNodes[i].GetX() - coors.x;
dY = m_pathNodes[i].GetY() - coors.y;
dist = Abs(dX) + Abs(dY) +
@@ -1676,15 +1204,12 @@ CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, floa
closestNode = i;
}
}
-#ifndef MIAMI
break;
}
-#endif
}
return closestNode;
}
-//--MIAMI: done
float
CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId)
{
@@ -1696,7 +1221,6 @@ CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId)
return RADTODEG(dir.Heading());
}
-//--MIAMI: unused (still needed for script here)
float
CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards)
{
@@ -1740,8 +1264,6 @@ CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, flo
return RADTODEG(dir.Heading());
}
-// no "New" in MIAMI
-//--MIAMI: TODO
bool
CPathFind::NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled)
{
@@ -1796,7 +1318,6 @@ CPathFind::NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY,
return false;
}
-//--MIAMI: TODO
bool
CPathFind::GeneratePedCreationCoors(float x, float y, float minDist, float maxDist, float minDistOffScreen, float maxDistOffScreen, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, CMatrix *camMatrix)
{
@@ -1856,7 +1377,6 @@ CPathFind::GeneratePedCreationCoors(float x, float y, float minDist, float maxDi
return false;
}
-#ifndef MIAMI
CTreadable*
CPathFind::FindRoadObjectClosestToCoors(CVector coors, uint8 type)
{
@@ -1892,9 +1412,7 @@ CPathFind::FindRoadObjectClosestToCoors(CVector coors, uint8 type)
}
return closestMapObj;
}
-#endif
-//--MIAMI: done
void
CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode, CPathNode **nextNode, uint8 curDir, uint8 *nextDir)
{
@@ -1902,7 +1420,6 @@ CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode
CPathNode *node;
if(lastNode == nil || (node = *lastNode) == nil || (coors - (*lastNode)->GetPosition()).MagnitudeSqr() > 7.0f){
-#ifndef MIAMI
// need to find the node we're coming from
node = nil;
CTreadable *obj = FindRoadObjectClosestToCoors(coors, type);
@@ -1916,10 +1433,6 @@ CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode
node = &m_pathNodes[obj->m_nodeIndices[type][i]];
}
}
-#else
- int32 nodeIdx = FindNodeClosestToCoors(coors, type, 999999.88f);
- node = &m_pathNodes[nodeIdx];
-#endif
}
CVector2D vCurDir(Sin(curDir*PI/4.0f), Cos(curDir * PI / 4.0f));
@@ -1975,13 +1488,8 @@ CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode
}
}
-#ifndef MIAMI
static CPathNode *apNodesToBeCleared[4995];
-#else
-static CPathNode *apNodesToBeCleared[6525];
-#endif
-//--MIAMI: done
void
CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector target, CPathNode **nodes, int16 *pNumNodes, int16 maxNumNodes, CVehicle *vehicle, float *pDist, float distLimit, int32 targetNodeId)
{
@@ -1997,7 +1505,6 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
}
// Find start
-#ifndef MIAMI
int numPathsToTry;
CTreadable *startObj;
if(startNodeId < 0){
@@ -2035,25 +1542,6 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
return;
}
}
-#else
- if(startNodeId < 0)
- startNodeId = FindNodeClosestToCoors(start, type, 999999.88f);
- if(startNodeId < 0) {
- *pNumNodes = 0;
- if(pDist) *pDist = 100000.0f;
- return;
- }
- if(startNodeId == targetNodeId){
- *pNumNodes = 0;
- if(pDist) *pDist = 0.0f;
- return;
- }
- if(m_pathNodes[startNodeId].group != m_pathNodes[targetNodeId].group) {
- *pNumNodes = 0;
- if(pDist) *pDist = 100000.0f;
- return;
- }
-#endif
for(i = 0; i < ARRAY_SIZE(m_searchNodes); i++)
m_searchNodes[i].SetNext(nil);
@@ -2064,23 +1552,14 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
// Dijkstra's algorithm
// Find distances
int numPathsFound = 0;
-#ifndef MIAMI
if(startNodeId < 0 && m_mapObjects[m_pathNodes[targetNodeId].objectIndex] == startObj)
numPathsFound++;
for(i = 0; numPathsFound < numPathsToTry; i = (i+1) & 0x1FF){
-#else
- for(i = 0; numPathsFound == 0; i = (i+1) & 0x1FF){
-#endif
CPathNode *node;
for(node = m_searchNodes[i].GetNext(); node; node = node->GetNext()){
-#ifndef MIAMI
if(m_mapObjects[node->objectIndex] == startObj &&
(startNodeId < 0 || node == &m_pathNodes[startNodeId]))
numPathsFound++;
-#else
- if(node == &m_pathNodes[startNodeId])
- numPathsFound = 1;
-#endif
for(j = 0; j < node->numLinks; j++){
int next = ConnectedNode(node->firstLink + j);
@@ -2100,7 +1579,6 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
// Find out whence to start tracing back
CPathNode *curNode;
-#ifndef MIAMI
if(startNodeId < 0){
int minDist = MAX_DIST;
*pNumNodes = 1;
@@ -2122,7 +1600,6 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
if(pDist)
*pDist = minDist;
}else
-#endif
{
curNode = &m_pathNodes[startNodeId];
*pNumNodes = 0;
@@ -2130,9 +1607,6 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
*pDist = m_pathNodes[startNodeId].distance;
}
-#ifdef MIAMI
- nodes[(*pNumNodes)++] = curNode;
-#endif
// Trace back to target and update list of nodes
while(*pNumNodes < maxNumNodes && curNode != &m_pathNodes[targetNodeId])
for(i = 0; i < curNode->numLinks; i++){
@@ -2153,7 +1627,6 @@ static CPathNode *pNodeList[32];
static int16 DummyResult;
static int16 DummyResult2;
-//--MIAMI: done
bool
CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
{
@@ -2164,16 +1637,11 @@ CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
else
DoPathSearch(type, start, -1, target, nil, &DummyResult2, 0, nil, &dist, 50.0f, -1);
if(type == PATH_CAR)
-#ifndef MIAMI
return dist < 160.0f;
-#else
- return dist < 150.0f;
-#endif
else
return dist < 100.0f;
}
-//--MIAMI: done
void
CPathFind::Save(uint8 *buf, uint32 *size)
{
@@ -2195,7 +1663,6 @@ CPathFind::Save(uint8 *buf, uint32 *size)
buf[i/8 + n] &= ~(1 << i%8);
}
-//--MIAMI: done
void
CPathFind::Load(uint8 *buf, uint32 size)
{
@@ -2340,25 +1807,3 @@ CPathFind::DisplayPathData(void)
}
}
}
-
-#ifdef MIAMI
-CPathNode*
-CPathFind::GetNode(int16 index)
-{
- if(index < 0)
- return nil;
- if(index < ARRAY_SIZE(ThePaths.m_searchNodes))
- return &ThePaths.m_searchNodes[index];
- return &ThePaths.m_pathNodes[index - ARRAY_SIZE(ThePaths.m_searchNodes)];
-}
-int16
-CPathFind::GetIndex(CPathNode *node)
-{
- if(node == nil)
- return -1;
- if(node >= &ThePaths.m_searchNodes[0] && node < &ThePaths.m_searchNodes[ARRAY_SIZE(ThePaths.m_searchNodes)])
- return node - ThePaths.m_searchNodes;
- else
- return (node - ThePaths.m_pathNodes) + ARRAY_SIZE(ThePaths.m_searchNodes);
-}
-#endif