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() void CNpcPath::reversePathDir()
{ {
if ( lastWaypoint ) if ( lastWaypoint )

View File

@ -30,6 +30,7 @@ public:
void setPathType( u8 newPathType ); void setPathType( u8 newPathType );
u8 getPathType(); u8 getPathType();
bool incPath(); bool incPath();
void decPath();
void resetPath(); void resetPath();
void reversePathDir(); void reversePathDir();
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY ); 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: case COLLISION_TYPE_FLAG_SOLID:
{ {
Pos = oldPos; Pos = oldPos;
m_heading += 1024; m_heading += 2048;
m_heading &= 4095; 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; break;
} }
@ -879,9 +892,22 @@ void CNpcSeaSnakeEnemy::processClose( int _frames )
m_sensorFunc = NPC_SENSOR_NONE; m_sensorFunc = NPC_SENSOR_NONE;
Pos = oldPos; Pos = oldPos;
m_heading += 1024; m_heading += 2048;
m_heading &= 4095; 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; break;
} }