SBSPSS/source/triggers/tgstop.cpp
Charles 131e89e064
2001-07-31 17:55:36 +00:00

117 lines
2.2 KiB
C++

/*=========================================================================
tgstop.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "triggers\trigger.h"
#include "triggers\tgstop.h"
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
#ifndef __FRIEND_FRIEND_H__
#include "friend\friend.h"
#endif
#ifndef __FRIEND_FGARY_H__
#include "friend\fgary.h"
#endif
#ifndef __PICKUPS_PICKUP_H__
#include "pickups\pickup.h"
#endif
/* Std Lib
------- */
/* Data
---- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGaryStopTrigger::init()
{
CTrigger::init();
m_dropped = false;
Pos.vx += 8;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGaryStopTrigger::collidedWith(CThing *_thisThing)
{
switch( _thisThing->getThingType() )
{
case TYPE_NPC:
{
if ( _thisThing->getThingSubType() == CNpcFriend::NPC_FRIEND_GARY )
{
CNpcGaryFriend *gary = (CNpcGaryFriend *) _thisThing;
gary->stop();
if ( !m_dropped )
{
if ( GameScene.getChapterNumber() != 1 )
{
DVECTOR newPos = Pos;
newPos.vy -= 8;
createPickup(PICKUP__LIFE,&newPos);
}
m_dropped = true;
}
}
break;
}
default:
break;
}
}
/*===========================================================================
end */