diff --git a/source/player/psjmpbck.cpp b/source/player/psjmpbck.cpp new file mode 100644 index 000000000..97e07bdf2 --- /dev/null +++ b/source/player/psjmpbck.cpp @@ -0,0 +1,128 @@ +/*========================================================================= + + psjmpbck.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\psjmpbck.h" + +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + +#ifndef __PLAYER_PMODES_H__ +#include "player\pmodes.h" +#endif + +#ifndef __SOUND_SOUND_H__ +#include "sound\sound.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +#ifndef __ANIM_SPONGEBOB_HEADER__ +#include +#endif + + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +CPlayerStateJumpBack s_stateJumpBack; + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateJumpBack::enter(CPlayerModeBase *_playerMode) +{ + _playerMode->setAnimNo(ANIM_SPONGEBOB_JUMP); + m_reactFrames=0; + + _playerMode->jump(); + + CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_JUMP); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateJumpBack::think(CPlayerModeBase *_playerMode) +{ + const PlayerMetrics *metrics; + int controlHeld,controlDown; + + metrics=_playerMode->getPlayerMetrics(); + controlHeld=_playerMode->getPadInputHeld(); + controlDown=_playerMode->getPadInputDown(); + + _playerMode->advanceAnimFrameAndCheckForEndOfAnim(); + + if(m_reactFrames<=metrics->m_metric[PM__MAX_JUMP_FRAMES]&&controlHeld&PI_JUMP) + { + m_reactFrames++; + } + else + { + _playerMode->setState(STATE_FALL); + } + + if(controlHeld&PI_LEFT) + { + _playerMode->moveLeft(); + } + else if(controlHeld&PI_RIGHT) + { + _playerMode->moveRight(); + } + else + { + _playerMode->slowdown(); + } + + if(controlDown&PI_DOWN) + { + _playerMode->setState(STATE_BUTTBOUNCE); + } +} + + +/*=========================================================================== + end */ diff --git a/source/player/psjmpbck.h b/source/player/psjmpbck.h new file mode 100644 index 000000000..729eb5da7 --- /dev/null +++ b/source/player/psjmpbck.h @@ -0,0 +1,66 @@ +/*========================================================================= + + psjmpback.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLAYER_PSJMPBACK_H__ +#define __PLAYER_PSJMPBACK_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\pstates.h" + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CPlayerStateJumpBack : public CPlayerState +{ +public: + void enter(class CPlayerModeBase *_playerMode); + void think(class CPlayerModeBase *_playerMode); + +private: + int m_reactFrames; + +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +extern CPlayerStateJumpBack s_stateJump; + + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PLAYER_PSJMPBACK_H__ */ + +/*=========================================================================== + end */ + + +