SBSPSS/source/player/psduck.cpp

157 lines
3.4 KiB
C++
Raw Normal View History

2001-01-22 21:58:36 +01:00
/*=========================================================================
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
2001-03-23 21:09:14 +01:00
#ifndef __PLAYER_PMODES_H__
#include "player\pmodes.h"
#endif
2001-01-22 21:58:36 +01:00
/* Std Lib
------- */
/* Data
---- */
2001-02-26 21:05:31 +01:00
#ifndef __ANIM_SPONGEBOB_HEADER__
#include <ACTOR_SPONGEBOB_ANIM.h>
2001-01-22 21:58:36 +01:00
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
2001-04-03 18:47:07 +02:00
CPlayerStateDuck s_stateDuck;
CPlayerStateSoakUp s_stateSoakUp;
CPlayerStateGetUp s_stateGetUp;
2001-01-22 21:58:36 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-25 22:36:28 +02:00
void CPlayerStateDuck::enter(CPlayerModeBase *_playerMode)
2001-01-22 21:58:36 +01:00
{
2001-03-23 21:09:14 +01:00
_playerMode->setAnimNo(ANIM_SPONGEBOB_SOAKUP);
2001-01-22 21:58:36 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-25 22:36:28 +02:00
void CPlayerStateDuck::think(CPlayerModeBase *_playerMode)
2001-01-22 21:58:36 +01:00
{
2001-03-23 21:09:14 +01:00
_playerMode->slowdown();
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
2001-01-22 21:58:36 +01:00
{
2001-03-23 21:09:14 +01:00
_playerMode->setState(STATE_SOAKUP);
2001-01-22 21:58:36 +01:00
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-25 22:36:28 +02:00
void CPlayerStateSoakUp::enter(CPlayerModeBase *_playerMode)
2001-01-22 21:58:36 +01:00
{
2001-03-23 21:09:14 +01:00
_playerMode->zeroMoveVelocity();
2001-05-03 21:18:31 +02:00
_playerMode->setAnimNo(ANIM_SPONGEBOB_SOAKUP);
_playerMode->setAnimFrame(_playerMode->getAnimFrameCount()-1);
2001-04-18 18:35:26 +02:00
_playerMode->setPlayerCollisionSize(0,-10,60,20);
2001-01-22 21:58:36 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-25 22:36:28 +02:00
void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode)
2001-01-22 21:58:36 +01:00
{
2001-01-29 23:35:18 +01:00
int controlHeld;
2001-01-22 21:58:36 +01:00
2001-03-23 21:09:14 +01:00
controlHeld=_playerMode->getPadInputHeld();
2001-02-09 18:01:04 +01:00
if(!(controlHeld&PI_DOWN))
2001-01-22 21:58:36 +01:00
{
2001-03-23 21:09:14 +01:00
_playerMode->setState(STATE_GETUP);
2001-01-22 21:58:36 +01:00
}
2001-05-04 01:45:28 +02:00
else
{
_playerMode->inSoakUpState();
}
2001-01-22 21:58:36 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-25 22:36:28 +02:00
void CPlayerStateGetUp::enter(CPlayerModeBase *_playerMode)
2001-01-22 21:58:36 +01:00
{
2001-03-23 21:09:14 +01:00
_playerMode->setAnimNo(ANIM_SPONGEBOB_GETUP);
2001-01-22 21:58:36 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-25 22:36:28 +02:00
void CPlayerStateGetUp::think(CPlayerModeBase *_playerMode)
2001-01-22 21:58:36 +01:00
{
2001-03-23 21:09:14 +01:00
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
2001-01-22 21:58:36 +01:00
{
2001-03-23 21:09:14 +01:00
_playerMode->setState(STATE_IDLE);
2001-01-22 21:58:36 +01:00
}
}
/*===========================================================================
end */