This commit is contained in:
Charles 2001-08-17 16:04:11 +00:00
parent dbd7d3cf31
commit 0a80b2b09c
3 changed files with 98 additions and 7 deletions

View file

@ -2722,6 +2722,29 @@ void CPlayer::setLockoutPlatform(CThing *_newPlatform)
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::forceFall()
{
if(m_currentMode!=PLAYER_MODE_DEAD)
{
if ( m_currentPlayerModeClass->getState() != STATE_FALL )
{
m_currentPlayerModeClass->setState(STATE_FALL);
DVECTOR moveVel;
moveVel=*getMoveVelocity();
moveVel.vy=0;
m_fallFrames=0;
setMoveVelocity(&moveVel);
}
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
@ -2853,19 +2876,40 @@ int CPlayer::moveVertical(int _moveDistance)
blockAfter[i+1]=CGameScene::getCollision()->getCollisionBlock(x,y+_moveDistance);
}
bool isGoingToFall = false;
// See if either side is about to go through the ground
for(i=0;i<3;i++)
{
if(colHeightBefore[i]>=0&&colHeightAfter[i]<=0&&((blockAfter[i]&COLLISION_TYPE_MASK)!=COLLISION_TYPE_FLAG_NORMAL))
{
//moveRequired[i]=16+colHeightAfter[i];
moveRequired[i]=colHeightAfter[i];
moveRequired[i]=16+colHeightAfter[i];
//moveRequired[i]=colHeightAfter[i];
// hitGround=true;
// do not call hitground code, because this will set it to STATE_IDLE for a frame
// instead, do the appropriate stuff for a fall
if(!hitThisSuspectBlock)hitThisSuspectBlock=blockAfter[i];
isGoingToFall = true;
}
else
{
moveRequired[i]=0;
}
}
if ( isGoingToFall )
{
// check where feet are
if ( getHeightFromGround(pos.vx, pos.vy, 16 ) == 0 )
{
// standing on ground, hence do not fall
hitGround = true;
}
else
{
m_currentPlayerModeClass->setState(STATE_FALL);
DVECTOR moveVel;
@ -2874,10 +2918,6 @@ int CPlayer::moveVertical(int _moveDistance)
m_fallFrames=0;
setMoveVelocity(&moveVel);
}
else
{
moveRequired[i]=0;
}
}
// Find the smallest move required to hit ground