diff --git a/source/player/psbutt.cpp b/source/player/psbutt.cpp new file mode 100644 index 000000000..01bb75804 --- /dev/null +++ b/source/player/psbutt.cpp @@ -0,0 +1,156 @@ + +/*========================================================================= + + psbutt.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\psbutt.h" + +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + +#ifndef __PAD_PADS_H__ +#include "pad\pads.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +#ifndef __ANIM_PLAYER_ANIM_HEADER__ +#include +#endif + + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateButtBounce::enter(CPlayer *_player) +{ + setAnimNo(_player,ANIM_PLAYER_ANIM_BUTTBOUNCE); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateButtBounce::think(CPlayer *_player) +{ + if(advanceAnimFrameAndCheckForEndOfAnim(_player)) + { + setState(_player,STATE_BUTTFALL); + } +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateButtBounceFall::enter(CPlayer *_player) +{ +// setAnimNo(_player,ANIM_PLAYER_ANIM_JUMPSTART); + m_fallFrames=0; +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateButtBounceFall::think(CPlayer *_player) +{ + PlayerMetrics *metrics; + int control; + DVECTOR move; + + metrics=getPlayerMetrics(_player); + control=getPadInput(_player); + + move=getMoveVelocity(_player); + move.vy+=metrics->m_metric[PM__GRAVITY_VALUE]; + if(move.vy>=metrics->m_metric[PM__TERMINAL_VELOCITY]<m_metric[PM__TERMINAL_VELOCITY]<metrics->m_metric[PM__MAX_SAFE_FALL_FRAMES]) + { + setState(_player,STATE_FALLFAR); + } + } + setMoveVelocity(_player,&move); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateButtBounceLand::enter(CPlayer *_player) +{ + setAnimNo(_player,ANIM_PLAYER_ANIM_BUTTBOUNCE); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateButtBounceLand::think(CPlayer *_player) +{ + if(advanceAnimFrameAndCheckForEndOfAnim(_player)) + { + setState(_player,STATE_IDLE); + } +} + + +/*=========================================================================== + end */ diff --git a/source/player/psbutt.h b/source/player/psbutt.h new file mode 100644 index 000000000..87745286d --- /dev/null +++ b/source/player/psbutt.h @@ -0,0 +1,81 @@ +/*========================================================================= + + psbutt.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLAYER_PSBUTT_H__ +#define __PLAYER_PSBUTT_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\pstates.h" + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CPlayerStateButtBounce : public CPlayerState +{ +public: + void enter(class CPlayer *_player); + void think(class CPlayer *_player); + +}; + +class CPlayerStateButtBounceFall : public CPlayerState +{ +public: + void enter(class CPlayer *_player); + void think(class CPlayer *_player); + +private: + int m_fallFrames; + +}; + +class CPlayerStateButtBounceLand : public CPlayerState +{ +public: + void enter(class CPlayer *_player); + void think(class CPlayer *_player); + +private: + +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PLAYER_PSBUTT_H__ */ + +/*=========================================================================== + end */ + + +