diff --git a/source/player/pscrouch.cpp b/source/player/pscrouch.cpp new file mode 100644 index 000000000..993ade260 --- /dev/null +++ b/source/player/pscrouch.cpp @@ -0,0 +1,161 @@ + +/*========================================================================= + + pscrouch.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\pscrouch.h" + +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + +#ifndef __PLAYER_PMODES_H__ +#include "player\pmodes.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +#ifndef __ANIM_SPONGEBOB_HEADER__ +#include +#endif + + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +CPlayerStateCrouchDown s_stateCrouchDown; +CPlayerStateCrouchUp s_stateCrouchUp; + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateCrouchDown::enter(CPlayerModeBase *_playerMode) +{ + _playerMode->setAnimNo(ANIM_SPONGEBOB_CROUCHDOWN); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateCrouchDown::think(CPlayerModeBase *_playerMode) +{ + int maxFrame; + + _playerMode->slowdown(); + + maxFrame=_playerMode->getAnimFrameCount()-1; + if(_playerMode->getAnimFrame()advanceAnimFrameAndCheckForEndOfAnim(); + } + else + { + if(!(_playerMode->getPadInputHeld()&PI_DOWN)) + { + _playerMode->setState(STATE_CROUCHUP); + } + } +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateCrouchUp::enter(CPlayerModeBase *_playerMode) +{ + _playerMode->zeroMoveVelocity(); + _playerMode->setAnimNo(ANIM_SPONGEBOB_SOAKUP); + _playerMode->setAnimFrame(_playerMode->getAnimFrameCount()-1); + _playerMode->setPlayerCollisionSize(0,-10,60,20); +} + + +/* +void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode) +{ + int controlHeld; + + controlHeld=_playerMode->getPadInputHeld(); + if(!(controlHeld&PI_DOWN)) + { + _playerMode->setState(STATE_GETUP); + } + else + { + _playerMode->inSoakUpState(); + } +} +*/ + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateCrouchUp::enter(CPlayerModeBase *_playerMode) +{ + _playerMode->setAnimNo(ANIM_SPONGEBOB_CROUCHUP); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateCrouchUp::think(CPlayerModeBase *_playerMode) +{ + if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim()) + { + _playerMode->setState(STATE_IDLE); + } +} + + +/*=========================================================================== + end */ diff --git a/source/player/pscrouch.h b/source/player/pscrouch.h new file mode 100644 index 000000000..f02d925eb --- /dev/null +++ b/source/player/pscrouch.h @@ -0,0 +1,73 @@ +/*========================================================================= + + pscrouch.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLAYER_PSCROUCH_H__ +#define __PLAYER_PSCROUCH_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\pstates.h" + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CPlayerStateCrouchDown : public CPlayerState +{ +public: + void enter(class CPlayerModeBase *_playerMode); + void think(class CPlayerModeBase *_playerMode); + +}; + + +class CPlayerStateCrouchUp : public CPlayerState +{ +public: + void enter(class CPlayerModeBase *_playerMode); + void think(class CPlayerModeBase *_playerMode); + +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +extern CPlayerStateCrouchDown s_stateCrouchDown; +extern CPlayerStateCrouchUp s_stateCrouchUp; + + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PLAYER_PSCROUCH_H__ */ + +/*=========================================================================== + end */ + + +