diff --git a/source/player/psduck.cpp b/source/player/psduck.cpp new file mode 100644 index 000000000..f8f40423f --- /dev/null +++ b/source/player/psduck.cpp @@ -0,0 +1,152 @@ + +/*========================================================================= + + psduck.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\psduck.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 CPlayerStateDuck::enter(CPlayer *_player) +{ + setAnimNo(_player,ANIM_PLAYER_ANIM_SOAKUP); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateDuck::think(CPlayer *_player) +{ + slowdown(_player); + if(advanceAnimFrameAndCheckForEndOfAnim(_player)) + { + setState(_player,STATE_SOAKUP); + } +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateSoakUp::enter(CPlayer *_player) +{ + DVECTOR move; + + move=getMoveVelocity(_player); + move.vx=0; + setMoveVelocity(_player,&move); + + setAnimNo(_player,ANIM_PLAYER_ANIM_GETUP); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateSoakUp::think(CPlayer *_player) +{ + int control; + + control=getPadInput(_player); + if(!(control&CPadConfig::getButton(CPadConfig::PAD_CFG_DOWN))) + { + setState(_player,STATE_GETUP); + } +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateGetUp::enter(CPlayer *_player) +{ + setAnimNo(_player,ANIM_PLAYER_ANIM_GETUP); +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateGetUp::think(CPlayer *_player) +{ + if(advanceAnimFrameAndCheckForEndOfAnim(_player)) + { + setState(_player,STATE_IDLE); + } +} + + +/*=========================================================================== + end */ diff --git a/source/player/psduck.h b/source/player/psduck.h new file mode 100644 index 000000000..6698fbbd5 --- /dev/null +++ b/source/player/psduck.h @@ -0,0 +1,78 @@ +/*========================================================================= + + psduck.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLAYER_PSDUCK_H__ +#define __PLAYER_PSDUCK_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\pstates.h" + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CPlayerStateDuck : public CPlayerState +{ +public: + void enter(class CPlayer *_player); + void think(class CPlayer *_player); + +}; + + +class CPlayerStateSoakUp : public CPlayerState +{ +public: + void enter(class CPlayer *_player); + void think(class CPlayer *_player); + +}; + + +class CPlayerStateGetUp : public CPlayerState +{ +public: + void enter(class CPlayer *_player); + void think(class CPlayer *_player); + +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PLAYER_PSDUCK_H__ */ + +/*=========================================================================== + end */ + + +