SBSPSS/source/triggers/tgstop.cpp

129 lines
2.5 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-08-08 16:19:54 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGaryStopTrigger::setPositionAndSize(int _x,int _y,int _w,int _h)
{
Pos.vx=_x+(_w/2) - 8;
Pos.vy=_y+(_h/2);
setCollisionSize(4,_h);
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 */