diff --git a/source/hazard/hazard.cpp b/source/hazard/hazard.cpp index 983b38a9b..91d2297e6 100644 --- a/source/hazard/hazard.cpp +++ b/source/hazard/hazard.cpp @@ -27,6 +27,10 @@ #include "utils\utils.h" #endif +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + #ifndef __HAZARD_HFALLING_H__ #include "hazard\hfalling.h" #endif @@ -255,3 +259,30 @@ void CNpcHazard::render() } } } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcHazard::collidedWith( CThing *_thisThing ) +{ + if ( m_isActive ) + { + switch(_thisThing->getThingType()) + { + case TYPE_PLAYER: + { + CPlayer *player = (CPlayer *) _thisThing; + + if ( !player->isRecoveringFromHit() ) + { + player->takeDamage( DAMAGE__HIT_ENEMY ); + } + + break; + } + + default: + ASSERT(0); + break; + } + } +} diff --git a/source/hazard/hazard.h b/source/hazard/hazard.h index b5076cd1c..0015b404b 100644 --- a/source/hazard/hazard.h +++ b/source/hazard/hazard.h @@ -68,6 +68,8 @@ protected: virtual void processMovement( int _frames ); virtual void processTimer( int _frames ); + virtual void collidedWith(CThing *_thisThing); + CNpcPath m_npcPath; //CActorGfx *m_actorGfx; //SpriteBank *m_spriteBank;