From 8a87a295cb27505083aed252ee1272d3d51f068d Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 1 May 2001 18:12:44 +0000 Subject: [PATCH] --- source/player/psspring.cpp | 122 +++++++++++++++++++++++++++++++++++++ source/player/psspring.h | 66 ++++++++++++++++++++ 2 files changed, 188 insertions(+) create mode 100644 source/player/psspring.cpp create mode 100644 source/player/psspring.h diff --git a/source/player/psspring.cpp b/source/player/psspring.cpp new file mode 100644 index 000000000..5b10a6a74 --- /dev/null +++ b/source/player/psspring.cpp @@ -0,0 +1,122 @@ +/*========================================================================= + + psspring.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\psspring.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 + ---- */ + +CPlayerStateSpring s_stateSpring; + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateSpring::enter(CPlayerModeBase *_playerMode) +{ + _playerMode->setAnimNo(ANIM_SPONGEBOB_JUMP); + m_jumpFrames=0; + + _playerMode->jump(); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int maxspring=20; +void CPlayerStateSpring::think(CPlayerModeBase *_playerMode) +{ + const PlayerMetrics *metrics; + int controlHeld,controlDown; + + metrics=_playerMode->getPlayerMetrics(); + controlHeld=_playerMode->getPadInputHeld(); + controlDown=_playerMode->getPadInputDown(); + + _playerMode->advanceAnimFrameAndCheckForEndOfAnim(); + + if(m_jumpFrames<=metrics->m_metric[PM__MAX_JUMP_FRAMES]) + { + m_jumpFrames++; + } + else + { + _playerMode->setState(STATE_FALL); + } + + if(controlHeld&PI_LEFT) + { + _playerMode->moveLeft(); + } + else if(controlHeld&PI_RIGHT) + { + _playerMode->moveRight(); + } + else + { + _playerMode->slowdown(); + } +} + + +/*=========================================================================== + end */ diff --git a/source/player/psspring.h b/source/player/psspring.h new file mode 100644 index 000000000..a84c3f1ff --- /dev/null +++ b/source/player/psspring.h @@ -0,0 +1,66 @@ +/*========================================================================= + + psspring.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLAYER_PSSPRING_H__ +#define __PLAYER_PSSPRING_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\pstates.h" + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CPlayerStateSpring : public CPlayerState +{ +public: + void enter(class CPlayerModeBase *_playerMode); + void think(class CPlayerModeBase *_playerMode); + +private: + int m_springFrames; + +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +extern CPlayerStateSpring s_stateSpring; + + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PLAYER_PSSPRING_H__ */ + +/*=========================================================================== + end */ + + +