This commit is contained in:
parent
30272803d0
commit
25de06c1a6
21 changed files with 595 additions and 41 deletions
|
@ -297,7 +297,9 @@ triggers_src := trigger \
|
||||||
tplatfrm \
|
tplatfrm \
|
||||||
tgarygo \
|
tgarygo \
|
||||||
tfemit \
|
tfemit \
|
||||||
tifemit
|
tifemit \
|
||||||
|
tggleft \
|
||||||
|
tgstop
|
||||||
|
|
||||||
utils_src := utils \
|
utils_src := utils \
|
||||||
sincos \
|
sincos \
|
||||||
|
|
|
@ -169,3 +169,13 @@ void CNpcGaryFriend::render()
|
||||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcGaryFriend::startLeft()
|
||||||
|
{
|
||||||
|
start();
|
||||||
|
|
||||||
|
m_extension = EXTEND_LEFT;
|
||||||
|
m_reversed = true;
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ public:
|
||||||
virtual void setupWaypoints( sThingActor *ThisActor );
|
virtual void setupWaypoints( sThingActor *ThisActor );
|
||||||
DVECTOR const &getTriggerPos() {return( m_triggerPos );}
|
DVECTOR const &getTriggerPos() {return( m_triggerPos );}
|
||||||
void start() {m_started = true;}
|
void start() {m_started = true;}
|
||||||
|
void stop() {m_started = false;}
|
||||||
|
void startLeft();
|
||||||
virtual void render();
|
virtual void render();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __FRIEND_FRIEND_H__
|
||||||
|
#include "friend\friend.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -372,7 +376,50 @@ void CNpcDualPlatform::collidedWith( CThing *_thisThing )
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_NPC:
|
case TYPE_NPC:
|
||||||
|
{
|
||||||
|
CNpcFriend *friendNpc;
|
||||||
|
DVECTOR friendPos;
|
||||||
|
CRECT collisionArea;
|
||||||
|
|
||||||
|
friendNpc = (CNpcFriend*) _thisThing;
|
||||||
|
friendPos = friendNpc->getPos();
|
||||||
|
collisionArea=getCollisionArea();
|
||||||
|
|
||||||
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
if ( threshold > 16 )
|
||||||
|
{
|
||||||
|
threshold = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( friendPos.vx >= collisionArea.x1 && friendPos.vx <= collisionArea.x2 )
|
||||||
|
{
|
||||||
|
if ( checkCollisionDelta( _thisThing, threshold, collisionArea ) )
|
||||||
|
{
|
||||||
|
int height = getHeightFromPlatformAtPosition( friendPos.vx, friendPos.vy );
|
||||||
|
|
||||||
|
friendNpc->setPlatform( this );
|
||||||
|
|
||||||
|
m_contact = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( friendPos.vy >= collisionArea.y1 && friendPos.vy <= collisionArea.y2 )
|
||||||
|
{
|
||||||
|
int height = getHeightFromPlatformAtPosition( friendPos.vx, friendPos.vy );
|
||||||
|
|
||||||
|
if ( height >= -threshold && height < 1 )
|
||||||
|
{
|
||||||
|
friendNpc->setPlatform( this );
|
||||||
|
|
||||||
|
m_contact = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case TYPE_HAZARD:
|
case TYPE_HAZARD:
|
||||||
{
|
{
|
||||||
|
|
|
@ -543,11 +543,27 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
|
||||||
thing1=thing1->m_nextCollisionThing;
|
thing1=thing1->m_nextCollisionThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enemy -> Player projectile collision
|
// Friend -> Trigger collision
|
||||||
thing1=s_CollisionLists[CThing::TYPE_PLAYERPROJECTILE];
|
thing1=s_CollisionLists[CThing::TYPE_TRIGGER];
|
||||||
thing2=s_CollisionLists[CThing::TYPE_ENEMY];
|
|
||||||
while(thing1)
|
while(thing1)
|
||||||
{
|
{
|
||||||
|
thing2=s_CollisionLists[CThing::TYPE_NPC];
|
||||||
|
while(thing2)
|
||||||
|
{
|
||||||
|
if(thing1->checkCollisionAgainst(thing2, _frames))
|
||||||
|
{
|
||||||
|
thing1->collidedWith(thing2);
|
||||||
|
}
|
||||||
|
thing2=thing2->m_nextCollisionThing;
|
||||||
|
}
|
||||||
|
thing1=thing1->m_nextCollisionThing;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enemy -> Player projectile collision
|
||||||
|
thing1=s_CollisionLists[CThing::TYPE_PLAYERPROJECTILE];
|
||||||
|
while(thing1)
|
||||||
|
{
|
||||||
|
thing2=s_CollisionLists[CThing::TYPE_ENEMY];
|
||||||
while(thing2)
|
while(thing2)
|
||||||
{
|
{
|
||||||
if(thing1->checkCollisionAgainst(thing2, _frames))
|
if(thing1->checkCollisionAgainst(thing2, _frames))
|
||||||
|
|
|
@ -57,11 +57,20 @@ void CCameraLockTrigger::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
CPlayer::CameraBox camBox={m_boxX1,m_boxY1,m_boxX2,m_boxY2};
|
CPlayer::CameraBox camBox={m_boxX1,m_boxY1,m_boxX2,m_boxY2};
|
||||||
|
|
||||||
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
switch( _thisThing->getThingType() )
|
||||||
|
{
|
||||||
((CPlayer*)_thisThing)->setCameraBox(camBox);
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
((CPlayer*)_thisThing)->setCameraBox(camBox);
|
||||||
|
|
||||||
PAUL_DBGMSG("HIT CAM BOX TRIGGER");
|
PAUL_DBGMSG("HIT CAM BOX TRIGGER");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
tgarygo.cpp
|
tgarygo.cpp
|
||||||
|
|
||||||
Author: PKG
|
Author: CRB
|
||||||
Created:
|
Created:
|
||||||
Project: Spongebob
|
Project: Spongebob
|
||||||
Purpose:
|
Purpose:
|
||||||
|
@ -96,10 +96,18 @@ void CGaryStartTrigger::render()
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CGaryStartTrigger::collidedWith(CThing *_thisThing)
|
void CGaryStartTrigger::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
switch( _thisThing->getThingType() )
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
m_gary->start();
|
||||||
|
|
||||||
CPlayer *player = (CPlayer *) _thisThing;
|
break;
|
||||||
m_gary->start();
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
127
source/triggers/tggleft.cpp
Normal file
127
source/triggers/tggleft.cpp
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
tggleft.cpp
|
||||||
|
|
||||||
|
Author: CRB
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Includes
|
||||||
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
|
#include "triggers\tggleft.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
|
||||||
|
|
||||||
|
|
||||||
|
/* Std Lib
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/* Data
|
||||||
|
---- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Tyepdefs && Defines
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Structure defintions
|
||||||
|
-------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function Prototypes
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Vars
|
||||||
|
---- */
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
|
#include "gfx\prim.h"
|
||||||
|
void CGaryGoLeftTrigger::render()
|
||||||
|
{
|
||||||
|
DVECTOR ofs;
|
||||||
|
CRECT area;
|
||||||
|
|
||||||
|
CTriggerThing::render();
|
||||||
|
|
||||||
|
ofs=CLevel::getCameraPos();
|
||||||
|
area=getCollisionArea();
|
||||||
|
area.x1-=ofs.vx;
|
||||||
|
area.y1-=ofs.vy;
|
||||||
|
area.x2-=ofs.vx;
|
||||||
|
area.y2-=ofs.vy;
|
||||||
|
|
||||||
|
if(area.x1<=511&&area.x2>=0&&
|
||||||
|
area.y1<=255&&area.y2>=0)
|
||||||
|
{
|
||||||
|
POLY_F4 *f4;
|
||||||
|
f4=GetPrimF4();
|
||||||
|
setXY4(f4,area.x1,area.y1,
|
||||||
|
area.x2,area.y1,
|
||||||
|
area.x1,area.y2,
|
||||||
|
area.x2,area.y2);
|
||||||
|
setRGB0(f4,0,255,0);
|
||||||
|
setSemiTrans(f4,true);
|
||||||
|
AddPrimToList(f4,0);
|
||||||
|
DrawLine(area.x1,area.y1,area.x2,area.y1,0,255,0,0);
|
||||||
|
DrawLine(area.x2,area.y1,area.x2,area.y2,0,255,0,0);
|
||||||
|
DrawLine(area.x2,area.y2,area.x1,area.y2,0,255,0,0);
|
||||||
|
DrawLine(area.x1,area.y2,area.x1,area.y1,0,255,0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CGaryGoLeftTrigger::collidedWith(CThing *_thisThing)
|
||||||
|
{
|
||||||
|
switch( _thisThing->getThingType() )
|
||||||
|
{
|
||||||
|
case TYPE_NPC:
|
||||||
|
{
|
||||||
|
if ( _thisThing->getThingSubType() == CNpcFriend::NPC_FRIEND_GARY )
|
||||||
|
{
|
||||||
|
CNpcGaryFriend *gary = (CNpcGaryFriend *) _thisThing;
|
||||||
|
|
||||||
|
gary->startLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
end */
|
60
source/triggers/tggleft.h
Normal file
60
source/triggers/tggleft.h
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
tggleft.h
|
||||||
|
|
||||||
|
Author: Charles Blair
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __TRIGGERS_TGGLEFT_H__
|
||||||
|
#define __TRIGGERS_TGGLEFT_H__
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Includes
|
||||||
|
-------- */
|
||||||
|
|
||||||
|
#ifndef __THING_THING_H__
|
||||||
|
#include "thing/thing.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Std Lib
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Tyepdefs && Defines
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Structure defintions
|
||||||
|
-------------------- */
|
||||||
|
|
||||||
|
class CGaryGoLeftTrigger : public CTrigger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
|
virtual void render();
|
||||||
|
#endif
|
||||||
|
protected:
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Globals
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Functions
|
||||||
|
--------- */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#endif /* __TRIGGERS_TPLATFRM_H__ */
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
end */
|
127
source/triggers/tgstop.cpp
Normal file
127
source/triggers/tgstop.cpp
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
/* Std Lib
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/* Data
|
||||||
|
---- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Tyepdefs && Defines
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Structure defintions
|
||||||
|
-------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function Prototypes
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Vars
|
||||||
|
---- */
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
|
#include "gfx\prim.h"
|
||||||
|
void CGaryGoLeftTrigger::render()
|
||||||
|
{
|
||||||
|
DVECTOR ofs;
|
||||||
|
CRECT area;
|
||||||
|
|
||||||
|
CTriggerThing::render();
|
||||||
|
|
||||||
|
ofs=CLevel::getCameraPos();
|
||||||
|
area=getCollisionArea();
|
||||||
|
area.x1-=ofs.vx;
|
||||||
|
area.y1-=ofs.vy;
|
||||||
|
area.x2-=ofs.vx;
|
||||||
|
area.y2-=ofs.vy;
|
||||||
|
|
||||||
|
if(area.x1<=511&&area.x2>=0&&
|
||||||
|
area.y1<=255&&area.y2>=0)
|
||||||
|
{
|
||||||
|
POLY_F4 *f4;
|
||||||
|
f4=GetPrimF4();
|
||||||
|
setXY4(f4,area.x1,area.y1,
|
||||||
|
area.x2,area.y1,
|
||||||
|
area.x1,area.y2,
|
||||||
|
area.x2,area.y2);
|
||||||
|
setRGB0(f4,0,255,0);
|
||||||
|
setSemiTrans(f4,true);
|
||||||
|
AddPrimToList(f4,0);
|
||||||
|
DrawLine(area.x1,area.y1,area.x2,area.y1,0,255,0,0);
|
||||||
|
DrawLine(area.x2,area.y1,area.x2,area.y2,0,255,0,0);
|
||||||
|
DrawLine(area.x2,area.y2,area.x1,area.y2,0,255,0,0);
|
||||||
|
DrawLine(area.x1,area.y2,area.x1,area.y1,0,255,0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
end */
|
60
source/triggers/tgstop.h
Normal file
60
source/triggers/tgstop.h
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
tgstop.h
|
||||||
|
|
||||||
|
Author: Charles Blair
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __TRIGGERS_TGSTOP_H__
|
||||||
|
#define __TRIGGERS_TGSTOP_H__
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Includes
|
||||||
|
-------- */
|
||||||
|
|
||||||
|
#ifndef __THING_THING_H__
|
||||||
|
#include "thing/thing.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Std Lib
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Tyepdefs && Defines
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Structure defintions
|
||||||
|
-------------------- */
|
||||||
|
|
||||||
|
class CGaryStopTrigger : public CTrigger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
|
virtual void render();
|
||||||
|
#endif
|
||||||
|
protected:
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Globals
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Functions
|
||||||
|
--------- */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#endif /* __TRIGGERS_TPLATFRM_H__ */
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
end */
|
|
@ -96,11 +96,19 @@ void CLevelExitTrigger::render()
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CLevelExitTrigger::collidedWith(CThing *_thisThing)
|
void CLevelExitTrigger::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
switch( _thisThing->getThingType() )
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
#if !defined (__USER_art__) && !defined (__USER_sbart__)
|
#if !defined (__USER_art__) && !defined (__USER_sbart__)
|
||||||
CGameScene::levelFinished();
|
CGameScene::levelFinished();
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
|
@ -56,17 +56,26 @@ void CLookTrigger::collidedWith(CThing *_thisThing)
|
||||||
DVECTOR collCentre;
|
DVECTOR collCentre;
|
||||||
CRECT collArea;
|
CRECT collArea;
|
||||||
|
|
||||||
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
switch( _thisThing->getThingType() )
|
||||||
|
|
||||||
// Only collide if players feet are inside the trigger
|
|
||||||
collCentre=((CPlayer*)_thisThing)->getCollisionCentre();
|
|
||||||
collArea.x1=collCentre.vx-5;
|
|
||||||
collArea.y1=collCentre.vy-5;
|
|
||||||
collArea.x2=collArea.x1+10;
|
|
||||||
collArea.y2=collArea.y1+10;
|
|
||||||
if(checkCollisionAgainstArea(&collArea))
|
|
||||||
{
|
{
|
||||||
((CPlayer*)_thisThing)->setLedgeLookAhead(+4);
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
// Only collide if players feet are inside the trigger
|
||||||
|
collCentre=((CPlayer*)_thisThing)->getCollisionCentre();
|
||||||
|
collArea.x1=collCentre.vx-5;
|
||||||
|
collArea.y1=collCentre.vy-5;
|
||||||
|
collArea.x2=collArea.x1+10;
|
||||||
|
collArea.y2=collArea.y1+10;
|
||||||
|
if(checkCollisionAgainstArea(&collArea))
|
||||||
|
{
|
||||||
|
((CPlayer*)_thisThing)->setLedgeLookAhead(+4);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,14 +96,23 @@ void CPlatformTrigger::render()
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CPlatformTrigger::collidedWith(CThing *_thisThing)
|
void CPlatformTrigger::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
switch( _thisThing->getThingType() )
|
||||||
|
|
||||||
CPlayer *player = (CPlayer *) _thisThing;
|
|
||||||
ATTACK_STATE playerState = player->getAttackState();
|
|
||||||
|
|
||||||
if ( playerState == ATTACK_STATE__BUTT_BOUNCE )
|
|
||||||
{
|
{
|
||||||
m_platform->trigger();
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
CPlayer *player = (CPlayer *) _thisThing;
|
||||||
|
ATTACK_STATE playerState = player->getAttackState();
|
||||||
|
|
||||||
|
if ( playerState == ATTACK_STATE__BUTT_BOUNCE )
|
||||||
|
{
|
||||||
|
m_platform->trigger();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,12 +57,21 @@ void CRestartPointTrigger::collidedWith(CThing *_thisThing)
|
||||||
CRECT collisionArea;
|
CRECT collisionArea;
|
||||||
DVECTOR respawnPos;
|
DVECTOR respawnPos;
|
||||||
|
|
||||||
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
switch( _thisThing->getThingType() )
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
collisionArea=getCollisionArea();
|
||||||
|
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
|
||||||
|
respawnPos.vy=collisionArea.y2;
|
||||||
|
((CPlayer*)_thisThing)->setRespawnPos(respawnPos);
|
||||||
|
|
||||||
collisionArea=getCollisionArea();
|
break;
|
||||||
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
|
}
|
||||||
respawnPos.vy=collisionArea.y2;
|
|
||||||
((CPlayer*)_thisThing)->setRespawnPos(respawnPos);
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
|
@ -51,6 +51,14 @@
|
||||||
#include "triggers\tifemit.h"
|
#include "triggers\tifemit.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __TRIGGERS_TGGLEFT_H__
|
||||||
|
#include "triggers\tggleft.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __TRIGGERS_TGSTOP_H__
|
||||||
|
#include "triggers\tgstop.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __GAME_GAME_H__
|
#ifndef __GAME_GAME_H__
|
||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -95,7 +103,7 @@ CTrigger *trigger;
|
||||||
|
|
||||||
// Gary start trigger
|
// Gary start trigger
|
||||||
case TRIGGER_GARYSTART:
|
case TRIGGER_GARYSTART:
|
||||||
trigger=(CGaryStartTrigger*)new( "GaryStartTrigger") CGaryStartTrigger();
|
trigger=(CGaryStartTrigger*)new("GaryStartTrigger") CGaryStartTrigger();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Flame emitter
|
// Flame emitter
|
||||||
|
@ -103,6 +111,16 @@ CTrigger *trigger;
|
||||||
trigger=(CFlameEmitterTrigger*)new( "FlameEmitterTrigger") CFlameEmitterTrigger();
|
trigger=(CFlameEmitterTrigger*)new( "FlameEmitterTrigger") CFlameEmitterTrigger();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Gary stop trigger
|
||||||
|
case TRIGGER_GARYSTOP:
|
||||||
|
trigger=(CGaryStopTrigger*)new("GaryStopTrigger") CGaryStopTrigger();
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Gary go left trigger
|
||||||
|
case TRIGGER_GARYGOLEFT:
|
||||||
|
trigger=(CGaryGoLeftTrigger*)new("GaryGoLeftTrigger") CGaryGoLeftTrigger();
|
||||||
|
break;
|
||||||
|
|
||||||
case TRIGGER_INTERMITTENTFLAMEEMITTER:
|
case TRIGGER_INTERMITTENTFLAMEEMITTER:
|
||||||
trigger=(CIntermittentFlameEmitterTrigger*)new( "IntermittentFlameEmitterTrigger") CIntermittentFlameEmitterTrigger();
|
trigger=(CIntermittentFlameEmitterTrigger*)new( "IntermittentFlameEmitterTrigger") CIntermittentFlameEmitterTrigger();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -32,6 +32,8 @@ enum TRIGGER_TYPE
|
||||||
TRIGGER_GARYSTART,
|
TRIGGER_GARYSTART,
|
||||||
TRIGGER_FLAMEEMITTER,
|
TRIGGER_FLAMEEMITTER,
|
||||||
TRIGGER_INTERMITTENTFLAMEEMITTER,
|
TRIGGER_INTERMITTENTFLAMEEMITTER,
|
||||||
|
TRIGGER_GARYSTOP,
|
||||||
|
TRIGGER_GARYGOLEFT,
|
||||||
|
|
||||||
// Code based triggers
|
// Code based triggers
|
||||||
TRIGGER_PLATFORM,
|
TRIGGER_PLATFORM,
|
||||||
|
|
|
@ -54,11 +54,20 @@
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CTeleportTrigger::collidedWith(CThing *_thisThing)
|
void CTeleportTrigger::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
switch( _thisThing->getThingType() )
|
||||||
|
{
|
||||||
((CPlayer*)_thisThing)->teleportTo(m_boxX1+8,m_boxY1+16);
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
((CPlayer*)_thisThing)->teleportTo(m_boxX1+8,m_boxY1+16);
|
||||||
|
|
||||||
PAUL_DBGMSG("HIT TELEPORT TRIGGER");
|
PAUL_DBGMSG("HIT TELEPORT TRIGGER");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
|
@ -134,6 +134,8 @@ OutOfWater=5
|
||||||
GaryStart=6
|
GaryStart=6
|
||||||
FlameEmitter=7
|
FlameEmitter=7
|
||||||
IntermittentFlameEmitter=8
|
IntermittentFlameEmitter=8
|
||||||
|
GaryStop=9
|
||||||
|
GaryGoLeft=10
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# FX
|
# FX
|
||||||
|
|
|
@ -24,3 +24,7 @@ HasBox=1
|
||||||
[FlameEmitter]
|
[FlameEmitter]
|
||||||
|
|
||||||
[IntermittentFlameEmitter]
|
[IntermittentFlameEmitter]
|
||||||
|
|
||||||
|
[GaryStop]
|
||||||
|
|
||||||
|
[GaryGoLeft]
|
|
@ -1933,6 +1933,22 @@ SOURCE=..\..\..\source\triggers\tgarygo.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\tggleft.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\tggleft.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\tgstop.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\tgstop.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\triggers\tifemit.cpp
|
SOURCE=..\..\..\source\triggers\tifemit.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
Loading…
Add table
Reference in a new issue