diff --git a/source/player/psfloat.cpp b/source/player/psfloat.cpp new file mode 100644 index 000000000..598297230 --- /dev/null +++ b/source/player/psfloat.cpp @@ -0,0 +1,117 @@ +/*========================================================================= + + psfloat.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\psfloat.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 + +#ifndef __PLATFORM_PLATFORM_H__ +#include "platform\platform.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +#ifndef __ANIM_SPONGEBOB_HEADER__ +#include +#endif + + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +CPlayerStateFloat s_stateFloat; + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateFloat::enter(CPlayerModeBase *_playerMode) +{ + m_isActive = true; +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerStateFloat::think(CPlayerModeBase *_playerMode) +{ + if ( _playerMode->advanceAnimFrameAndCheckForEndOfAnim() ) + { + _playerMode->setAnimNo( ANIM_SPONGEBOB_IDLEBREATH ); + } + + int controlHeld; + + controlHeld=_playerMode->getPadInputHeld(); + + if(controlHeld&PI_LEFT) + { + _playerMode->moveLeft(); + } + else if(controlHeld&PI_RIGHT) + { + _playerMode->moveRight(); + } + + if ( m_isActive ) + { + m_isActive = false; + } + else + { + _playerMode->setState( STATE_IDLE ); + } +} + + +/*=========================================================================== + end */ diff --git a/source/player/psfloat.h b/source/player/psfloat.h new file mode 100644 index 000000000..5de17f095 --- /dev/null +++ b/source/player/psfloat.h @@ -0,0 +1,60 @@ +/*========================================================================= + + psfloat.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLAYER_PSFLOAT_H__ +#define __PLAYER_PSFLOAT_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "player\pstates.h" + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CPlayerStateFloat : public CPlayerState +{ +public: + void enter(class CPlayerModeBase *_playerMode); + void think(class CPlayerModeBase *_playerMode); +protected: + bool m_isActive; +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +extern CPlayerStateFloat s_stateFloat; + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PLAYER_PSFLOAT_H__ */ + +/*=========================================================================== + end */ diff --git a/source/triggers/twindup.cpp b/source/triggers/twindup.cpp new file mode 100644 index 000000000..e637b04bd --- /dev/null +++ b/source/triggers/twindup.cpp @@ -0,0 +1,48 @@ +/*========================================================================= + + twindup.cpp + + Author: Charles Blair + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __TRIGGERS_TWINDUP_H__ +#include "triggers\twindup.h" +#endif + +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + +#ifndef __SYSTEM_GSTATE_H__ +#include "system\gstate.h" +#endif + + +void CWindUpTrigger::collidedWith(CThing *_thisThing) +{ + switch( _thisThing->getThingType() ) + { + case TYPE_PLAYER: + { + CPlayer *player = (CPlayer *) _thisThing; + + DVECTOR move; + move.vy = -4 * GameState::getFramesSinceLast(); + + player->shove( move ); + player->setFloating(); + + break; + } + + default: + break; + } +} + diff --git a/source/triggers/twindup.h b/source/triggers/twindup.h new file mode 100644 index 000000000..afb517543 --- /dev/null +++ b/source/triggers/twindup.h @@ -0,0 +1,55 @@ +/*========================================================================= + + twindup.h + + Author: Charles Blair + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __TRIGGERS_TWINDUP_H__ +#define __TRIGGERS_TWINDUP_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __TRIGGERS_THAZARD_H__ +#include "triggers\thazard.h" +#endif + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CWindUpTrigger : public CTrigger +{ +protected: + virtual void collidedWith(CThing *_thisThing); +}; + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif + +/*=========================================================================== + end */