This commit is contained in:
Charles 2001-07-20 15:52:22 +00:00
parent a1dac87c85
commit fedc13f51d
5 changed files with 45 additions and 2 deletions

View File

@ -233,6 +233,22 @@ bool CNpcPath::incPath()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPath::decPath()
{
if ( currentWaypoint > 0 )
{
lastWaypoint = currentWaypoint;
currentWaypoint--;
}
else
{
lastWaypoint = currentWaypoint;
currentWaypoint = waypointCount;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPath::reversePathDir()
{
if ( lastWaypoint )

View File

@ -30,6 +30,7 @@ public:
void setPathType( u8 newPathType );
u8 getPathType();
bool incPath();
void decPath();
void resetPath();
void reversePathDir();
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY );

View File

@ -555,9 +555,22 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
case COLLISION_TYPE_FLAG_SOLID:
{
Pos = oldPos;
m_heading += 1024;
m_heading += 2048;
m_heading &= 4095;
m_npcPath.decPath();
DVECTOR waypointPos;
m_npcPath.getCurrentWaypointPos( &waypointPos );
waypointPos.vy -= 8;
if ( CGameScene::getCollision()->getHeightFromGround( waypointPos.vx, waypointPos.vy ) < 0 )
{
// one of the special 'teleport' waypoints
m_npcPath.incPath();
}
break;
}
@ -879,9 +892,22 @@ void CNpcSeaSnakeEnemy::processClose( int _frames )
m_sensorFunc = NPC_SENSOR_NONE;
Pos = oldPos;
m_heading += 1024;
m_heading += 2048;
m_heading &= 4095;
m_npcPath.decPath();
DVECTOR waypointPos;
m_npcPath.getCurrentWaypointPos( &waypointPos );
waypointPos.vy -= 8;
if ( CGameScene::getCollision()->getHeightFromGround( waypointPos.vx, waypointPos.vy ) < 0 )
{
// one of the special 'teleport' waypoints
m_npcPath.incPath();
}
break;
}