This commit is contained in:
parent
428dce6993
commit
988b9867c3
2 changed files with 95 additions and 0 deletions
63
source/hazard/hcheck.cpp
Normal file
63
source/hazard/hcheck.cpp
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
32
source/hazard/hcheck.h
Normal file
32
source/hazard/hcheck.h
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue