SBSPSS/source/triggers/tgstop.cpp

116 lines
2.2 KiB
C++
Raw Normal View History

2001-06-04 14:54:44 +02:00
/*=========================================================================
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
2001-07-13 22:17:16 +02:00
#ifndef __PICKUPS_PICKUP_H__
#include "pickups\pickup.h"
#endif
2001-06-04 14:54:44 +02:00
/* Std Lib
------- */
/* Data
---- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
2001-07-13 22:17:16 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGaryStopTrigger::init()
{
CTrigger::init();
m_dropped = false;
}
2001-06-04 14:54:44 +02:00
/*----------------------------------------------------------------------
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();
2001-07-13 22:17:16 +02:00
if ( !m_dropped )
{
2001-07-16 22:50:07 +02:00
if ( GameScene.getChapterNumber() != 1 )
2001-07-13 22:17:16 +02:00
{
DVECTOR newPos = Pos;
newPos.vy -= 8;
createPickup(PICKUP__LIFE,&newPos);
}
m_dropped = true;
}
2001-06-04 14:54:44 +02:00
}
break;
}
default:
break;
}
}
/*===========================================================================
end */