diff --git a/source/player/psfall.cpp b/source/player/psfall.cpp index e8ac2077f..829e81cbc 100644 --- a/source/player/psfall.cpp +++ b/source/player/psfall.cpp @@ -66,10 +66,15 @@ CPlayerStateFallFar s_stateFallFar; ---------------------------------------------------------------------- */ void CPlayerStateFall::enter(CPlayerModeBase *_playerMode) { - if(_playerMode->getAnimNo()!=ANIM_SPONGEBOB_JUMP) + // If already in this state then don't do the entry code + if(_playerMode->getState()!=STATE_JUMP) { - _playerMode->setAnimNo(ANIM_SPONGEBOB_JUMP); + if(_playerMode->getAnimNo()!=ANIM_SPONGEBOB_JUMP) + { + _playerMode->setAnimNo(ANIM_SPONGEBOB_JUMP); + } } + m_buttBounceTimer=0; } @@ -105,9 +110,21 @@ void CPlayerStateFall::think(CPlayerModeBase *_playerMode) } _playerMode->fall(); - if(controlDown&PI_DOWN) + // Double-tap for butt bounce + if(m_buttBounceTimer) { - _playerMode->setState(STATE_BUTTBOUNCE); + m_buttBounceTimer--; + } + if(controlDown&PI_JUMP) + { + if(m_buttBounceTimer==0) + { + m_buttBounceTimer=BUTT_BOUNCE_TIMEOUT; + } + else + { + _playerMode->setState(STATE_BUTTBOUNCE); + } } } diff --git a/source/player/psfall.h b/source/player/psfall.h index 2ab9944f0..bb281b2aa 100644 --- a/source/player/psfall.h +++ b/source/player/psfall.h @@ -38,10 +38,18 @@ public: void enter(class CPlayerModeBase *_playerMode); void think(class CPlayerModeBase *_playerMode); +private: + enum + { + BUTT_BOUNCE_TIMEOUT=45, + }; + + unsigned int m_buttBounceTimer; + }; -class CPlayerStateFallFar : public CPlayerStateFall +class CPlayerStateFallFar : public CPlayerState { private: void enter(class CPlayerModeBase *_playerMode);