From 12e8907ece974985b7b23ee4b768b36ac027b4b9 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 12 Feb 2001 17:52:04 +0000 Subject: [PATCH] --- source/enemy/ngary.cpp | 8 ++++++++ source/enemy/ngeneric.cpp | 6 ++++++ source/enemy/npc.cpp | 2 +- source/enemy/npc.h | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) 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 );