This commit is contained in:
Paul 2001-04-03 20:26:21 +00:00
parent 3e867fc4f8
commit f947f1f62c
3 changed files with 55 additions and 70 deletions

View File

@ -848,7 +848,8 @@ void CPlayer::shove( DVECTOR move )
}
cx+=dir;
}
Pos.vx=cx-dir;
if(i)
Pos.vx=cx-dir;
}
else
{
@ -881,7 +882,8 @@ void CPlayer::shove( DVECTOR move )
}
cy+=dir;
}
Pos.vy=cy-dir;
if(i)
Pos.vy=cy-dir;
}
else
{

View File

@ -251,32 +251,7 @@ void CPlayerModeBase::thinkVerticalMovement()
// Just hit the ground
// Stick at ground level
pos.vy+=(m_moveVelocity.vy>>VELOCITY_SHIFT)+colHeight;
m_moveVelocity.vy=0;
m_fallFrames=0;
if(m_currentState==STATE_BUTTFALL)
{
// Landed from a butt bounce
setState(STATE_BUTTLAND);
}
else if(m_currentState==STATE_FALLFAR)
{
// Landed from a painfully long fall
setState(STATE_GETUP);
m_player->takeDamage(DAMAGE__FALL);
m_moveVelocity.vx=0;
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_LAND_AFTER_FALL);
}
else if(m_moveVelocity.vx)
{
// Landed from a jump with x movement
setState(STATE_RUN);
}
else
{
// Landed from a jump with no x movement
setState(STATE_IDLE);
setAnimNo(ANIM_SPONGEBOB_JUMPEND);
}
playerHasHitGround();
}
}
else if(colHeight)
@ -287,54 +262,16 @@ void CPlayerModeBase::thinkVerticalMovement()
{
// Was floating in the air.. fall!
// if ( !m_onPlatform )
// {
setState(STATE_FALL);
// }
setState(STATE_FALL);
}
}
}
else
{
/*
// Below ground
// Perhaps we should be falling?
if(m_currentState!=STATE_FALL&&m_currentState!=STATE_FALLFAR&&
m_currentState!=STATE_BUTTFALL&&m_currentState!=STATE_BUTTBOUNCE&&
m_currentState!=STATE_JUMP)
{
setState(STATE_FALL);
}
*/
if ( m_player->isOnPlatform() && m_moveVelocity.vy >= 0 )
{
pos.vy += colHeight;
m_moveVelocity.vy=0;
m_fallFrames=0;
if(m_currentState==STATE_BUTTFALL)
{
// Landed from a butt bounce
setState(STATE_BUTTLAND);
}
else if(m_currentState==STATE_FALLFAR)
{
// Landed from a painfully long fall
setState(STATE_IDLE);
m_player->takeDamage(DAMAGE__FALL);
m_moveVelocity.vx=0;
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_LAND_AFTER_FALL);
}
else if(m_moveVelocity.vx)
{
// Landed from a jump with x movement
setState(STATE_RUN);
}
else
{
// Landed from a jump with no x movement
setState(STATE_IDLE);
setAnimNo(ANIM_SPONGEBOB_JUMPEND);
}
playerHasHitGround();
}
}
@ -392,7 +329,8 @@ void CPlayerModeBase::thinkHorizontalMovement()
}
cx+=dir;
}
pos.vx=cx-dir;
if(i)
pos.vx=cx-dir;
// If running then go to idle, otherwise leave in same state
if(m_currentState==STATE_RUN)
@ -441,7 +379,8 @@ void CPlayerModeBase::thinkHorizontalMovement()
}
cx+=dir;
}
pos.vx=cx-dir;
if(i)
pos.vx=cx-dir;
m_moveVelocity.vx=0;
}
}
@ -451,6 +390,43 @@ void CPlayerModeBase::thinkHorizontalMovement()
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBase::playerHasHitGround()
{
// Grrr!
m_moveVelocity.vy=0;
m_fallFrames=0;
if(m_currentState==STATE_BUTTFALL)
{
// Landed from a butt bounce
setState(STATE_BUTTLAND);
}
else if(m_currentState==STATE_FALLFAR)
{
// Landed from a painfully long fall
setState(STATE_GETUP);
m_player->takeDamage(DAMAGE__FALL);
m_moveVelocity.vx=0;
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_LAND_AFTER_FALL);
}
else if(m_moveVelocity.vx)
{
// Landed from a jump with x movement
setState(STATE_RUN);
}
else
{
// Landed from a jump with no x movement
setState(STATE_IDLE);
setAnimNo(ANIM_SPONGEBOB_JUMPEND);
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
@ -650,6 +626,12 @@ int CPlayerModeBase::slowdown()
ret=true;
}
}
else
{
// Hmm.. was already stopped(?)
// This should probly be considered a bug.. (pkg)
ret=true;
}
return ret;
}
void CPlayerModeBase::jump()

View File

@ -118,6 +118,7 @@ public:
void thinkVerticalMovement();
void thinkHorizontalMovement();
void playerHasHitGround();
virtual const struct PlayerMetrics *getPlayerMetrics();