SBSPSS/source/triggers/tgstop.cpp

117 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-07-31 19:55:36 +02:00
Pos.vx += 8;
2001-07-13 22:17:16 +02:00
}
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;
2001-08-03 16:42:00 +02:00
gary->stop( Pos.vx );
2001-07-13 22:17:16 +02:00
if ( !m_dropped )
{
2001-08-02 15:19:11 +02:00
if ( GameScene.getChapterNumber() != 5 )
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 */