This commit is contained in:
parent
ae6b5ef072
commit
6c221940f6
6 changed files with 77 additions and 9 deletions
|
@ -128,11 +128,13 @@ void CNpcBouncePlatform::render()
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
DVECTOR centre;
|
DVECTOR centre;
|
||||||
|
DVECTOR size;
|
||||||
int halfLength;
|
int halfLength;
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
centre=getCollisionCentre();
|
centre=getCollisionCentre();
|
||||||
halfLength=PLATFORMWIDTH/2;
|
size=getCollisionSize();
|
||||||
|
halfLength=size.vx>>1;
|
||||||
|
|
||||||
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
||||||
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
void CNpcBranchPlatform::postInit()
|
void CNpcBranchPlatform::postInit()
|
||||||
{
|
{
|
||||||
m_angularVelocity = 0;
|
m_angularVelocity = 0;
|
||||||
|
m_platformWidth <<= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -81,6 +82,48 @@ void CNpcBranchPlatform::setWaypoints( sThingPlatform *ThisPlatform )
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcBranchPlatform::collidedWith( CThing *_thisThing )
|
||||||
|
{
|
||||||
|
switch(_thisThing->getThingType())
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
if ( m_detectCollision && m_isActive )
|
||||||
|
{
|
||||||
|
CPlayer *player;
|
||||||
|
DVECTOR playerPos;
|
||||||
|
CRECT collisionArea;
|
||||||
|
|
||||||
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
|
player=(CPlayer*)_thisThing;
|
||||||
|
playerPos=player->getPos();
|
||||||
|
collisionArea=getCollisionArea();
|
||||||
|
if(playerPos.vx>=collisionArea.x1&&playerPos.vx<=collisionArea.x2&&
|
||||||
|
playerPos.vy>=collisionArea.y1&&playerPos.vy<=collisionArea.y2)
|
||||||
|
{
|
||||||
|
if ( ( m_reversed && playerPos.vx <= Pos.vx ) || ( !m_reversed && playerPos.vx >= Pos.vx ) )
|
||||||
|
{
|
||||||
|
player->setPlatform( this );
|
||||||
|
|
||||||
|
if(getHeightFromPlatformAtPosition(playerPos.vx,playerPos.vy)==0)
|
||||||
|
{
|
||||||
|
m_contact = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcBranchPlatform::processMovement( int _frames )
|
void CNpcBranchPlatform::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
s16 newAngle = getCollisionAngle();
|
s16 newAngle = getCollisionAngle();
|
||||||
|
@ -209,17 +252,30 @@ void CNpcBranchPlatform::render()
|
||||||
m_modelGfx->Render(renderPos,&rotation,&scale);
|
m_modelGfx->Render(renderPos,&rotation,&scale);
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
|
DVECTOR size;
|
||||||
DVECTOR centre;
|
DVECTOR centre;
|
||||||
int halfLength;
|
int halfLength;
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
centre=getCollisionCentre();
|
centre=getCollisionCentre();
|
||||||
halfLength=PLATFORMWIDTH/2;
|
size=getCollisionSize();
|
||||||
|
halfLength=size.vx>>1;
|
||||||
|
|
||||||
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
x1=0;
|
||||||
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
x2=0;
|
||||||
x2=+halfLength*mcos(getCollisionAngle()&4095)>>12;
|
y1=0;
|
||||||
y2=+halfLength*msin(getCollisionAngle()&4095)>>12;
|
y2=0;
|
||||||
|
|
||||||
|
if ( m_reversed )
|
||||||
|
{
|
||||||
|
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
||||||
|
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x2=+halfLength*mcos(getCollisionAngle()&4095)>>12;
|
||||||
|
y2=+halfLength*msin(getCollisionAngle()&4095)>>12;
|
||||||
|
}
|
||||||
|
|
||||||
centre.vx-=offset.vx;
|
centre.vx-=offset.vx;
|
||||||
centre.vy-=offset.vy;
|
centre.vy-=offset.vy;
|
||||||
|
|
|
@ -27,6 +27,8 @@ protected:
|
||||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
|
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
s32 m_angularVelocity;
|
s32 m_angularVelocity;
|
||||||
u8 m_reversed;
|
u8 m_reversed;
|
||||||
};
|
};
|
||||||
|
|
|
@ -310,6 +310,8 @@ void CNpcPlatform::init()
|
||||||
|
|
||||||
m_isShuttingDown = false;
|
m_isShuttingDown = false;
|
||||||
|
|
||||||
|
m_platformWidth = PLATFORMWIDTH;
|
||||||
|
|
||||||
m_npcPath.initPath();
|
m_npcPath.initPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +560,7 @@ void CNpcPlatform::calculateBoundingBoxSize()
|
||||||
|
|
||||||
angle=getCollisionAngle();
|
angle=getCollisionAngle();
|
||||||
centre=getCollisionCentre();
|
centre=getCollisionCentre();
|
||||||
halfLength=PLATFORMWIDTH/2;
|
halfLength=m_platformWidth/2;
|
||||||
|
|
||||||
x1=-halfLength*mcos(angle&4095)>>12;
|
x1=-halfLength*mcos(angle&4095)>>12;
|
||||||
y1=-halfLength*msin(angle&4095)>>12;
|
y1=-halfLength*msin(angle&4095)>>12;
|
||||||
|
@ -746,12 +748,14 @@ void CNpcPlatform::render()
|
||||||
// AddPrimToList(F4,2);
|
// AddPrimToList(F4,2);
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
|
DVECTOR size;
|
||||||
DVECTOR centre;
|
DVECTOR centre;
|
||||||
int halfLength;
|
int halfLength;
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
centre=getCollisionCentre();
|
centre=getCollisionCentre();
|
||||||
halfLength=PLATFORMWIDTH/2;
|
size=getCollisionSize();
|
||||||
|
halfLength=size.vx>>1;
|
||||||
|
|
||||||
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
||||||
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
||||||
|
|
|
@ -199,6 +199,8 @@ protected:
|
||||||
CModelGfx *m_modelGfx;
|
CModelGfx *m_modelGfx;
|
||||||
u8 m_isShuttingDown;
|
u8 m_isShuttingDown;
|
||||||
|
|
||||||
|
u8 m_platformWidth;
|
||||||
|
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
static NPC_PLATFORM_UNIT_TYPE mapEditConvertTable[NPC_PLATFORM_TYPE_MAX];
|
static NPC_PLATFORM_UNIT_TYPE mapEditConvertTable[NPC_PLATFORM_TYPE_MAX];
|
||||||
|
|
|
@ -141,12 +141,14 @@ void CNpcSeesawPlatform::render()
|
||||||
m_modelGfx->Render(renderPos,&rotation,&scale);
|
m_modelGfx->Render(renderPos,&rotation,&scale);
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
|
DVECTOR size;
|
||||||
DVECTOR centre;
|
DVECTOR centre;
|
||||||
int halfLength;
|
int halfLength;
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
centre=getCollisionCentre();
|
centre=getCollisionCentre();
|
||||||
halfLength=PLATFORMWIDTH/2;
|
size=getCollisionSize();
|
||||||
|
halfLength=size.vx>>1;
|
||||||
|
|
||||||
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
||||||
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue