2001-05-14 18:32:45 +02:00
|
|
|
|
|
|
|
/*=========================================================================
|
|
|
|
|
2001-05-29 17:53:50 +02:00
|
|
|
pslook.cpp
|
2001-05-14 18:32:45 +02:00
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
2001-05-29 17:53:50 +02:00
|
|
|
#include "player\pslook.h"
|
2001-05-14 18:32:45 +02:00
|
|
|
|
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __PLAYER_PMODES_H__
|
|
|
|
#include "player\pmodes.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
|
|
|
#ifndef __ANIM_SPONGEBOB_HEADER__
|
|
|
|
#include <ACTOR_SPONGEBOB_ANIM.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
|
2001-05-29 17:53:50 +02:00
|
|
|
CPlayerStateLookDown s_stateLookDown;
|
|
|
|
CPlayerStateLookDownRelax s_stateLookDownRelax;
|
2001-06-19 17:23:50 +02:00
|
|
|
CPlayerStateLookUp s_stateLookUp;
|
|
|
|
CPlayerStateLookUpRelax s_stateLookUpRelax;
|
2001-05-14 18:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-05-29 17:53:50 +02:00
|
|
|
void CPlayerStateLookDown::enter(CPlayerModeBase *_playerMode)
|
2001-05-14 18:32:45 +02:00
|
|
|
{
|
|
|
|
_playerMode->setAnimNo(ANIM_SPONGEBOB_CROUCHDOWN);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-05-29 17:53:50 +02:00
|
|
|
void CPlayerStateLookDown::think(CPlayerModeBase *_playerMode)
|
2001-05-14 18:32:45 +02:00
|
|
|
{
|
|
|
|
int maxFrame;
|
2001-05-22 23:33:15 +02:00
|
|
|
int controlDown,controlHeld;
|
|
|
|
controlDown=_playerMode->getPadInputDown();
|
|
|
|
controlHeld=_playerMode->getPadInputHeld();
|
2001-05-14 18:32:45 +02:00
|
|
|
|
|
|
|
_playerMode->slowdown();
|
|
|
|
|
|
|
|
maxFrame=_playerMode->getAnimFrameCount()-1;
|
|
|
|
if(_playerMode->getAnimFrame()<maxFrame)
|
|
|
|
{
|
|
|
|
_playerMode->advanceAnimFrameAndCheckForEndOfAnim();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-06-19 17:23:50 +02:00
|
|
|
if(!(controlHeld&controlThatMustBeHeld()))
|
2001-05-14 18:32:45 +02:00
|
|
|
{
|
2001-06-19 17:23:50 +02:00
|
|
|
_playerMode->setState(getNextState());
|
2001-05-14 18:32:45 +02:00
|
|
|
}
|
|
|
|
}
|
2001-05-22 23:33:15 +02:00
|
|
|
|
|
|
|
if(controlDown&PI_JUMP)
|
|
|
|
{
|
|
|
|
_playerMode->setState(STATE_JUMP);
|
|
|
|
}
|
|
|
|
else if(controlHeld&PI_LEFT)
|
|
|
|
{
|
|
|
|
if(_playerMode->canMoveLeft())
|
|
|
|
_playerMode->setState(STATE_RUN);
|
|
|
|
}
|
|
|
|
else if(controlHeld&PI_RIGHT)
|
|
|
|
{
|
|
|
|
if(_playerMode->canMoveRight())
|
|
|
|
_playerMode->setState(STATE_RUN);
|
|
|
|
}
|
2001-05-14 18:32:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-19 17:23:50 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
int CPlayerStateLookDown::getNextState()
|
|
|
|
{
|
|
|
|
return STATE_LOOKDOWNRELAX;
|
|
|
|
}
|
|
|
|
int CPlayerStateLookDown::controlThatMustBeHeld()
|
|
|
|
{
|
|
|
|
return PI_DOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-05-14 18:32:45 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-05-29 17:53:50 +02:00
|
|
|
void CPlayerStateLookDownRelax::enter(CPlayerModeBase *_playerMode)
|
2001-05-14 18:32:45 +02:00
|
|
|
{
|
|
|
|
_playerMode->setAnimNo(ANIM_SPONGEBOB_CROUCHUP);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-05-29 17:53:50 +02:00
|
|
|
void CPlayerStateLookDownRelax::think(CPlayerModeBase *_playerMode)
|
2001-05-14 18:32:45 +02:00
|
|
|
{
|
2001-05-22 23:33:15 +02:00
|
|
|
int controlDown,controlHeld;
|
|
|
|
controlDown=_playerMode->getPadInputDown();
|
|
|
|
controlHeld=_playerMode->getPadInputHeld();
|
|
|
|
|
2001-05-14 18:32:45 +02:00
|
|
|
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
|
|
|
|
{
|
|
|
|
_playerMode->setState(STATE_IDLE);
|
|
|
|
}
|
2001-05-22 23:33:15 +02:00
|
|
|
|
|
|
|
if(controlDown&PI_JUMP)
|
|
|
|
{
|
|
|
|
_playerMode->setState(STATE_JUMP);
|
|
|
|
}
|
|
|
|
else if(controlHeld&PI_LEFT)
|
|
|
|
{
|
|
|
|
if(_playerMode->canMoveLeft())
|
|
|
|
_playerMode->setState(STATE_RUN);
|
|
|
|
}
|
|
|
|
else if(controlHeld&PI_RIGHT)
|
|
|
|
{
|
|
|
|
if(_playerMode->canMoveRight())
|
|
|
|
_playerMode->setState(STATE_RUN);
|
|
|
|
}
|
2001-05-14 18:32:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-19 17:23:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerStateLookUp::enter(CPlayerModeBase *_playerMode)
|
|
|
|
{
|
|
|
|
_playerMode->setAnimNo(ANIM_SPONGEBOB_LOOKUP);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
int CPlayerStateLookUp::getNextState()
|
|
|
|
{
|
|
|
|
return STATE_LOOKUPRELAX;
|
|
|
|
}
|
|
|
|
int CPlayerStateLookUp::controlThatMustBeHeld()
|
|
|
|
{
|
|
|
|
return PI_UP;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerStateLookUpRelax::enter(CPlayerModeBase *_playerMode)
|
|
|
|
{
|
|
|
|
// _playerMode->setAnimNo(ANIM_SPONGEBOB_CROUCHUP);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-05-14 18:32:45 +02:00
|
|
|
/*===========================================================================
|
|
|
|
end */
|