diff --git a/source/friend/friend.cpp b/source/friend/friend.cpp index fe96b64b2..ed633e59b 100644 --- a/source/friend/friend.cpp +++ b/source/friend/friend.cpp @@ -250,6 +250,30 @@ void CNpcFriend::render() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void CNpcFriend::collidedWith( CThing *_thisThing ) +{ + switch(_thisThing->getThingType()) + { + case TYPE_PLAYER: + { + CPlayer *player = (CPlayer *) _thisThing; + + if ( player->isTryingToConversateWithFriend() ) + { + startConderversation(); + } + + break; + } + + default: + ASSERT(0); + break; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcFriend::startConderversation() { // I am 'avin a fayg diff --git a/source/friend/friend.h b/source/friend/friend.h index 008a0604b..7d84fbd90 100644 --- a/source/friend/friend.h +++ b/source/friend/friend.h @@ -76,6 +76,8 @@ protected: void startConderversation(); + virtual void collidedWith(CThing *_thisThing); + enum { EXTEND_RIGHT = true, diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index 0a074e9d3..d68767681 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -171,6 +171,19 @@ void CThingManager::thinkAllThings(int _frames) thing1=thing1->m_nextThing; } + // Player -> Friend collision + thing1=s_thingLists[CThing::TYPE_NPC]; + thing2=s_thingLists[CThing::TYPE_PLAYER]; + while(thing1&&thing2) + { + if(thing1->canCollide()&& + thing1->checkCollisionAgainst(thing2, _frames)) + { + thing1->collidedWith(thing2); + } + thing1=thing1->m_nextThing; + } + // Player -> Hazard collision thing1=s_thingLists[CThing::TYPE_HAZARD]; thing2=s_thingLists[CThing::TYPE_PLAYER];