This commit is contained in:
parent
2162ac7953
commit
a358f14e09
8 changed files with 131 additions and 2 deletions
|
@ -316,7 +316,8 @@ triggers_src := trigger \
|
|||
tbgeyser \
|
||||
thazwalk \
|
||||
tsemit \
|
||||
tsswitch
|
||||
tsswitch \
|
||||
tgbowl
|
||||
|
||||
utils_src := utils \
|
||||
sincos \
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
#ifndef __FRIEND_FRIEND_H__
|
||||
#include "friend\friend.h"
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -134,3 +138,105 @@ void CNpcLiftPlatform::processTimer( int _frames )
|
|||
m_timer -= _frames;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcLiftPlatform::collidedWith( CThing *_thisThing )
|
||||
{
|
||||
switch(_thisThing->getThingType())
|
||||
{
|
||||
case TYPE_PLAYER:
|
||||
{
|
||||
CPlayer *player;
|
||||
DVECTOR playerPos;
|
||||
CRECT collisionArea;
|
||||
|
||||
// Only interested in SBs feet colliding with the box (pkg)
|
||||
player=(CPlayer*)_thisThing;
|
||||
playerPos=player->getPos();
|
||||
collisionArea=getCollisionArea();
|
||||
|
||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||
|
||||
if ( threshold > 16 )
|
||||
{
|
||||
threshold = 16;
|
||||
}
|
||||
|
||||
if( playerPos.vx >= collisionArea.x1 && playerPos.vx <= collisionArea.x2 )
|
||||
{
|
||||
if ( checkCollisionDelta( _thisThing, threshold, collisionArea ) )
|
||||
{
|
||||
player->setPlatform( this );
|
||||
|
||||
m_contact = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( playerPos.vy >= collisionArea.y1 && playerPos.vy <= collisionArea.y2 )
|
||||
{
|
||||
int height = getHeightFromPlatformAtPosition( playerPos.vx, playerPos.vy );
|
||||
|
||||
if ( height >= -threshold && height < 1 )
|
||||
{
|
||||
player->setPlatform( this );
|
||||
|
||||
m_contact = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TYPE_HAZARD:
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
virtual void postInit();
|
||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||
protected:
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
virtual void processMovement( int _frames );
|
||||
virtual void processTimer( int _frames );
|
||||
|
||||
|
|
|
@ -87,6 +87,10 @@
|
|||
#include "triggers\tsswitch.h"
|
||||
#endif
|
||||
|
||||
#ifndef __TRIGGERS_TGBOWL_H__
|
||||
#include "triggers\tgbowl.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
|
@ -149,6 +153,11 @@ CTrigger *trigger;
|
|||
trigger=(CGaryGoRightTrigger*)new("GaryGoRightTrigger") CGaryGoRightTrigger();
|
||||
break;
|
||||
|
||||
// Gary bowl trigger
|
||||
case TRIGGER_GARY_BOWL:
|
||||
trigger=(CGaryBowlTrigger*)new("GaryBowlTrigger") CGaryBowlTrigger();
|
||||
break;
|
||||
|
||||
// Flame emitter
|
||||
case TRIGGER_FLAME_EMITTER:
|
||||
trigger=(CFlameEmitterTrigger*)new( "FlameEmitterTrigger") CFlameEmitterTrigger();
|
||||
|
|
|
@ -40,6 +40,7 @@ enum TRIGGER_TYPE
|
|||
TRIGGER_INTERMITTENT_DOWN_FLAME_EMITTER,
|
||||
TRIGGER_BUBBLE_GEYSER_EMITTER,
|
||||
TRIGGER_STEAM_EMITTER,
|
||||
TRIGGER_GARY_BOWL,
|
||||
|
||||
// Code based triggers
|
||||
TRIGGER_PLATFORM,
|
||||
|
|
|
@ -145,6 +145,7 @@ IntermittentLeftFlameEmitter=13
|
|||
IntermittentDownFlameEmitter=14
|
||||
StreamGeyser=15
|
||||
SteamEmitter=16
|
||||
GaryBowl=17
|
||||
|
||||
################################################
|
||||
# FX
|
||||
|
|
|
@ -40,3 +40,5 @@ HasBox=1
|
|||
[GaryGoLeft]
|
||||
|
||||
[GaryGoRight]
|
||||
|
||||
[GaryBowl]
|
|
@ -2109,6 +2109,14 @@ SOURCE=..\..\..\source\triggers\tgarygo.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\triggers\tgbowl.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\triggers\tgbowl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\triggers\tggleft.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue