This commit is contained in:
Charles 2001-08-02 12:45:12 +00:00
parent ca1110c6e5
commit 40d8a477a4
3 changed files with 45 additions and 0 deletions

View File

@ -39,6 +39,7 @@
u8 CNpcGaryFriend::m_garySpeech;
u8 CNpcGaryFriend::m_hasReachedDoor;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -33,6 +33,8 @@ public:
void startRight();
void render();
void setObstructed() {m_obstructed = true;}
static void setReachedDoor() {m_hasReachedDoor = true;}
static bool hasReachedDoor() {return( m_hasReachedDoor );}
protected:
DVECTOR m_triggerPos;
@ -46,6 +48,7 @@ protected:
u8 m_garySB;
u8 m_garyMeow;
static u8 m_garySpeech;
static u8 m_hasReachedDoor;
};
#endif

View File

@ -18,10 +18,22 @@
#include "triggers\trigger.h"
#include "triggers\tteleprt.h"
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
#ifndef __FRIEND_FRIEND_H__
#include "friend\friend.h"
#endif
#ifndef __FRIEND_FGARY_H__
#include "friend\fgary.h"
#endif
/* Std Lib
------- */
@ -54,15 +66,44 @@
---------------------------------------------------------------------- */
void CTeleportTrigger::collidedWith(CThing *_thisThing)
{
int chapter=GameScene.getChapterNumber();
int level=GameScene.getLevelNumber();
switch( _thisThing->getThingType() )
{
case TYPE_PLAYER:
{
if ( chapter == 1 && level == 5 )
{
if ( !CNpcGaryFriend::hasReachedDoor() )
{
// if we're on chapter 1, level 5, check Gary has reached the teleport point
// if he hasn't, don't let Spongey through
return;
}
}
((CPlayer*)_thisThing)->clearPlatform();
((CPlayer*)_thisThing)->teleportTo(m_boxX1+8,m_boxY1+16);
break;
}
case TYPE_NPC:
{
if ( _thisThing->getThingSubType() == CNpcFriend::NPC_FRIEND_GARY )
{
if ( chapter == 1 && level == 5 )
{
// if Gary has touched a teleport on chapter 1, level 5, remember that he has done so
CNpcGaryFriend::setReachedDoor();
}
}
break;
}
default:
break;
}