diff --git a/Graphics/levels/Chapter03/Level04/Level04.MEX b/Graphics/levels/Chapter03/Level04/Level04.MEX index 483323974..8a8bb1ca9 100644 Binary files a/Graphics/levels/Chapter03/Level04/Level04.MEX and b/Graphics/levels/Chapter03/Level04/Level04.MEX differ diff --git a/Graphics/levels/Chapter03/Level04/Level04.Mep b/Graphics/levels/Chapter03/Level04/Level04.Mep index 42dd4811e..d239f9f07 100644 Binary files a/Graphics/levels/Chapter03/Level04/Level04.Mep and b/Graphics/levels/Chapter03/Level04/Level04.Mep differ diff --git a/source/enemy/npcpath.cpp b/source/enemy/npcpath.cpp index 76c1957fb..c4026eaf3 100644 --- a/source/enemy/npcpath.cpp +++ b/source/enemy/npcpath.cpp @@ -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 ) diff --git a/source/enemy/npcpath.h b/source/enemy/npcpath.h index 4c8ad93c0..680678493 100644 --- a/source/enemy/npcpath.h +++ b/source/enemy/npcpath.h @@ -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 ); diff --git a/source/enemy/nssnake.cpp b/source/enemy/nssnake.cpp index c7aec9b9a..e0dd79f1b 100644 --- a/source/enemy/nssnake.cpp +++ b/source/enemy/nssnake.cpp @@ -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; }