This commit is contained in:
parent
3e867fc4f8
commit
f947f1f62c
3 changed files with 55 additions and 70 deletions
|
@ -848,6 +848,7 @@ void CPlayer::shove( DVECTOR move )
|
||||||
}
|
}
|
||||||
cx+=dir;
|
cx+=dir;
|
||||||
}
|
}
|
||||||
|
if(i)
|
||||||
Pos.vx=cx-dir;
|
Pos.vx=cx-dir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -881,6 +882,7 @@ void CPlayer::shove( DVECTOR move )
|
||||||
}
|
}
|
||||||
cy+=dir;
|
cy+=dir;
|
||||||
}
|
}
|
||||||
|
if(i)
|
||||||
Pos.vy=cy-dir;
|
Pos.vy=cy-dir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -251,32 +251,7 @@ void CPlayerModeBase::thinkVerticalMovement()
|
||||||
// Just hit the ground
|
// Just hit the ground
|
||||||
// Stick at ground level
|
// Stick at ground level
|
||||||
pos.vy+=(m_moveVelocity.vy>>VELOCITY_SHIFT)+colHeight;
|
pos.vy+=(m_moveVelocity.vy>>VELOCITY_SHIFT)+colHeight;
|
||||||
m_moveVelocity.vy=0;
|
playerHasHitGround();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(colHeight)
|
else if(colHeight)
|
||||||
|
@ -287,54 +262,16 @@ void CPlayerModeBase::thinkVerticalMovement()
|
||||||
{
|
{
|
||||||
// Was floating in the air.. fall!
|
// Was floating in the air.. fall!
|
||||||
|
|
||||||
// if ( !m_onPlatform )
|
|
||||||
// {
|
|
||||||
setState(STATE_FALL);
|
setState(STATE_FALL);
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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 )
|
if ( m_player->isOnPlatform() && m_moveVelocity.vy >= 0 )
|
||||||
{
|
{
|
||||||
pos.vy += colHeight;
|
pos.vy += colHeight;
|
||||||
m_moveVelocity.vy=0;
|
playerHasHitGround();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,6 +329,7 @@ void CPlayerModeBase::thinkHorizontalMovement()
|
||||||
}
|
}
|
||||||
cx+=dir;
|
cx+=dir;
|
||||||
}
|
}
|
||||||
|
if(i)
|
||||||
pos.vx=cx-dir;
|
pos.vx=cx-dir;
|
||||||
|
|
||||||
// If running then go to idle, otherwise leave in same state
|
// If running then go to idle, otherwise leave in same state
|
||||||
|
@ -441,6 +379,7 @@ void CPlayerModeBase::thinkHorizontalMovement()
|
||||||
}
|
}
|
||||||
cx+=dir;
|
cx+=dir;
|
||||||
}
|
}
|
||||||
|
if(i)
|
||||||
pos.vx=cx-dir;
|
pos.vx=cx-dir;
|
||||||
m_moveVelocity.vx=0;
|
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:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
@ -650,6 +626,12 @@ int CPlayerModeBase::slowdown()
|
||||||
ret=true;
|
ret=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Hmm.. was already stopped(?)
|
||||||
|
// This should probly be considered a bug.. (pkg)
|
||||||
|
ret=true;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
void CPlayerModeBase::jump()
|
void CPlayerModeBase::jump()
|
||||||
|
|
|
@ -118,6 +118,7 @@ public:
|
||||||
|
|
||||||
void thinkVerticalMovement();
|
void thinkVerticalMovement();
|
||||||
void thinkHorizontalMovement();
|
void thinkHorizontalMovement();
|
||||||
|
void playerHasHitGround();
|
||||||
|
|
||||||
|
|
||||||
virtual const struct PlayerMetrics *getPlayerMetrics();
|
virtual const struct PlayerMetrics *getPlayerMetrics();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue