- Hardcoded bugfix for Vegas junction

This commit is contained in:
Ilya Shurumov 2021-07-31 18:46:45 +06:00 committed by InspirationByte
parent bcba884ef1
commit 078024a992
3 changed files with 30 additions and 3 deletions

View File

@ -186,12 +186,18 @@ void DrawDebugOverlays()
);
PrintString(tempBuf, 10, 195);
sprintf(tempBuf, "c %d %d %d %d",
(int)(*roadInfo.ConnectIdx)[0], (int)(*roadInfo.ConnectIdx)[1], (int)(*roadInfo.ConnectIdx)[2], (int)(*roadInfo.ConnectIdx)[3]);
PrintString(tempBuf, 10, 205);
}
else if(IS_JUNCTION_SURFACE(roadInfo.surfId))
{
DRIVER2_JUNCTION* junc = GET_JUNCTION(roadInfo.surfId);
sprintf(tempBuf, "JUN %d flg %d",roadInfo.surfId, junc->flags);
sprintf(tempBuf, "JUN %d flg %d - c %d %d %d %d",roadInfo.surfId, junc->flags,
(int)(*roadInfo.ConnectIdx)[0], (int)(*roadInfo.ConnectIdx)[1], (int)(*roadInfo.ConnectIdx)[2], (int)(*roadInfo.ConnectIdx)[3]);
PrintString(tempBuf, 10, 180);
}

View File

@ -535,7 +535,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist
exitCnt++;
} while (exitCnt < 3);
if (leftLane != rightLane && numExits != 1)
if (leftLane != rightLane && numExits != 1 && ROAD_LANES_COUNT(&currentRoadInfo) > 1)
{
if (cp->ai.c.currentLane == leftLane)
{

View File

@ -94,6 +94,7 @@ int GetSurfaceRoadInfo(DRIVER2_ROAD_INFO* outRoadInfo, int surfId)
{
DRIVER2_CURVE* curve;
DRIVER2_STRAIGHT* straight;
DRIVER2_JUNCTION* junction;
ClearMem((char*)outRoadInfo, sizeof(DRIVER2_ROAD_INFO));
outRoadInfo->surfId = surfId;
@ -116,6 +117,11 @@ int GetSurfaceRoadInfo(DRIVER2_ROAD_INFO* outRoadInfo, int surfId)
outRoadInfo->AILanes = straight->AILanes;
return 1;
}
else if (IS_JUNCTION_SURFACE(surfId))
{
junction = GET_JUNCTION(surfId);
outRoadInfo->ConnectIdx = &junction->ExitIdx;
}
return 0;
}
@ -166,7 +172,7 @@ void ProcessStraightsDriver2Lump(char *lump_file, int lump_size)
Getlong((char *)&NumDriver2Straights, lump_file);
Driver2StraightsPtr = (DRIVER2_STRAIGHT *)(lump_file + 4);
// [A] patch chicago roads
// [A] patch Chicago & Vegas roads
if (GameLevel == 0 && gDisableChicagoBridges)
{
DRIVER2_STRAIGHT* str;
@ -196,6 +202,14 @@ void ProcessStraightsDriver2Lump(char *lump_file, int lump_size)
}
}
}
else if (GameLevel == 2)
{
int i;
DRIVER2_STRAIGHT* str;
Driver2StraightsPtr[348].ConnectIdx[2] = 8244;
Driver2StraightsPtr[348].ConnectIdx[3] = 351;
}
}
// [D] [T]
@ -233,6 +247,13 @@ void ProcessJunctionsDriver2Lump(char *lump_file, int lump_size, int fix)
old++;
}
}
// [A] patch Vegas roads
if (GameLevel == 2)
{
Driver2JunctionsPtr[8244 & 0x1fff].ExitIdx[1] = 348;
Driver2JunctionsPtr[8244 & 0x1fff].ExitIdx[3] = 347;
}
}
// [D] [T]