diff --git a/source/enemy/ngary.cpp b/source/enemy/ngary.cpp index ff3b7751e..5fa6fef55 100644 --- a/source/enemy/ngary.cpp +++ b/source/enemy/ngary.cpp @@ -18,4 +18,12 @@ void CNpc::processGaryMovement( int _frames ) { + if ( isCollisionWithGround() ) + { + Pos.vx += _frames; + } + else + { + Pos.vy += _frames; + } } \ No newline at end of file diff --git a/source/enemy/ngeneric.cpp b/source/enemy/ngeneric.cpp index aa4896fd8..a033a3411 100644 --- a/source/enemy/ngeneric.cpp +++ b/source/enemy/ngeneric.cpp @@ -98,3 +98,9 @@ void CNpc::processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ) *distX = playerPos.vx - this->Pos.vx; *distY = playerPos.vy - this->Pos.vy; } + +bool CNpc::isCollisionWithGround() +{ + ASSERT(m_layerCollision); + return m_layerCollision->Get(Pos.vx>>4,Pos.vy>>4); +} diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 003973500..f1dd7f99f 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -54,7 +54,7 @@ class CLayerCollision *CNpc::m_layerCollision; void CNpc::init() { - m_type = NPC_SKELETAL_FISH; + m_type = NPC_GARY; m_heading = m_fireHeading = 0; m_movementTimer = 0; diff --git a/source/enemy/npc.h b/source/enemy/npc.h index aa832d2fc..612e0ffe8 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -266,6 +266,7 @@ protected: void processCollision(); void processTimer( int _frames ); void detectCollisionWithPlayer(); + bool isCollisionWithGround(); void processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed ); void processGenericGetUserDist( int _frames, s32 *distX, s32 *distY );