diff --git a/source/hazard/hcheck.cpp b/source/hazard/hcheck.cpp new file mode 100644 index 000000000..adce36199 --- /dev/null +++ b/source/hazard/hcheck.cpp @@ -0,0 +1,63 @@ +/*========================================================================= + + hcheck.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __HAZARD_HCHECK_H__ +#include "hazard\hcheck.h" +#endif + +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcCheckpointHazard::init() +{ + CNpcHazard::init(); + + m_triggered = false; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcCheckpointHazard::render() +{ + CNpcHazard::render(); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcCheckpointHazard::collidedWith(CThing *_thisThing) +{ + if ( m_isActive && !m_triggered ) + { + switch(_thisThing->getThingType()) + { + case TYPE_PLAYER: + { + CRECT collisionArea=getCollisionArea(); + DVECTOR respawnPos; + respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2); + respawnPos.vy=collisionArea.y2; + ((CPlayer*)_thisThing)->setRespawnPosAndRingTelephone(respawnPos); + m_triggered = true; + + break; + } + + default: + break; + } + } +} diff --git a/source/hazard/hcheck.h b/source/hazard/hcheck.h new file mode 100644 index 000000000..e2deb22c0 --- /dev/null +++ b/source/hazard/hcheck.h @@ -0,0 +1,32 @@ +/*========================================================================= + + hcheck.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __HAZARD_HCHECK_H__ +#define __HAZARD_HCHECK_H__ + +#ifndef __HAZARD_HAZARD_H__ +#include "hazard\hazard.h" +#endif + +class CNpcCheckpointHazard : public CNpcHazard +{ +public: + void init(); + void render(); +protected: + void collidedWith(CThing *_thisThing); + + u8 m_triggered; +}; + +#endif \ No newline at end of file