This commit is contained in:
parent
68ca825123
commit
861c534304
8 changed files with 195 additions and 26 deletions
|
@ -29,6 +29,10 @@
|
|||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
#ifndef __FRIEND_FRIEND_H__
|
||||
#include "friend\friend.h"
|
||||
#endif
|
||||
|
||||
#ifndef __HAZARD_HAZARD_H__
|
||||
#include "hazard\hazard.h"
|
||||
#endif
|
||||
|
@ -249,7 +253,7 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
|
|||
platform = new ("cart platform") CNpcCartPlatform;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case NPC_SEESAW_PLATFORM:
|
||||
{
|
||||
platform = new ("seesaw platform") CNpcSeesawPlatform;
|
||||
|
@ -668,7 +672,7 @@ void CNpcPlatform::setCollisionAngle(int newAngle)
|
|||
m_collisionAngle=newAngle;
|
||||
// CPlatformThing::setCollisionAngle(newAngle);
|
||||
calculateBoundingBoxSize();
|
||||
|
||||
|
||||
CPlayer *player;
|
||||
|
||||
// Is the player stood on this platform as it rotates?
|
||||
|
@ -966,19 +970,55 @@ void CNpcPlatform::collidedWith( CThing *_thisThing )
|
|||
break;
|
||||
}
|
||||
|
||||
case TYPE_HAZARD:
|
||||
case TYPE_NPC:
|
||||
{
|
||||
m_contact = true;
|
||||
CNpcFriend *friendNpc;
|
||||
DVECTOR friendPos;
|
||||
CRECT collisionArea;
|
||||
|
||||
CNpcHazard *hazard;
|
||||
friendNpc = (CNpcFriend*) _thisThing;
|
||||
friendPos = friendNpc->getPos();
|
||||
collisionArea=getCollisionArea();
|
||||
|
||||
hazard = (CNpcHazard *)_thisThing;
|
||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||
|
||||
hazard->setPlatform( this );
|
||||
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;
|
||||
}
|
||||
|
||||
case TYPE_HAZARD:
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue