2001-01-25 16:25:46 +01:00
|
|
|
/*=========================================================================
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
pstates.cpp
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
2001-01-19 23:54:48 +01:00
|
|
|
|
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
#include "player\pstates.h"
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
2001-01-19 23:54:48 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
/* Std Lib
|
|
|
|
------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
/* Data
|
|
|
|
---- */
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-22 23:58:12 +01:00
|
|
|
const PlayerMetrics *CPlayerState::getPlayerMetrics(CPlayer *_player)
|
2001-01-22 22:02:59 +01:00
|
|
|
{
|
|
|
|
return _player->getPlayerMetrics();
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-31 23:50:59 +01:00
|
|
|
int CPlayerState::setState(CPlayer *_player,int _state)
|
2001-01-19 23:54:48 +01:00
|
|
|
{
|
2001-01-31 23:50:59 +01:00
|
|
|
return _player->setState((PLAYER_STATE)_state);
|
2001-01-19 23:54:48 +01:00
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
2001-02-28 20:37:01 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerState::setMode(class CPlayer *_player,int _mode)
|
|
|
|
{
|
|
|
|
_player->setMode((PLAYER_MODE)_mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
int CPlayerState::getFacing(CPlayer *_player)
|
|
|
|
{
|
|
|
|
return _player->getFacing();
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
void CPlayerState::setFacing(CPlayer *_player,int _facing)
|
|
|
|
{
|
|
|
|
_player->setFacing(_facing);
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
int CPlayerState::getAnimNo(CPlayer *_player)
|
|
|
|
{
|
|
|
|
return _player->getAnimNo();
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
void CPlayerState::setAnimNo(CPlayer *_player,int _animNo)
|
|
|
|
{
|
|
|
|
_player->setAnimNo(_animNo);
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
void CPlayerState::setAnimFrame(CPlayer *_player,int _animFrame)
|
|
|
|
{
|
|
|
|
_player->setAnimFrame(_animFrame);
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
int CPlayerState::advanceAnimFrameAndCheckForEndOfAnim(class CPlayer *_player)
|
|
|
|
{
|
|
|
|
int animFrame,frameCount;
|
|
|
|
int looped;
|
|
|
|
animFrame=_player->getAnimFrame()+1;
|
|
|
|
frameCount=_player->getAnimFrameCount();
|
|
|
|
looped=false;
|
|
|
|
if(animFrame>=frameCount)
|
|
|
|
{
|
|
|
|
looped=true;
|
|
|
|
animFrame=0;
|
|
|
|
}
|
|
|
|
_player->setAnimFrame(animFrame);
|
|
|
|
return looped;
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
int CPlayerState::retreatAnimFrameAndCheckForEndOfAnim(class CPlayer *_player)
|
|
|
|
{
|
|
|
|
int animFrame;
|
|
|
|
int looped;
|
|
|
|
animFrame=_player->getAnimFrame()-1;
|
|
|
|
looped=false;
|
|
|
|
if(animFrame<0)
|
|
|
|
{
|
|
|
|
looped=true;
|
|
|
|
animFrame=_player->getAnimFrameCount()-1;
|
|
|
|
}
|
|
|
|
_player->setAnimFrame(animFrame);
|
|
|
|
return looped;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
DVECTOR CPlayerState::getMoveVelocity(CPlayer *_player)
|
|
|
|
{
|
|
|
|
return _player->getMoveVelocity();
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
void CPlayerState::setMoveVelocity(CPlayer *_player,DVECTOR *_moveVel)
|
|
|
|
{
|
|
|
|
_player->setMoveVelocity(_moveVel);
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
2001-01-26 19:20:41 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
DVECTOR CPlayerState::getPlayerPos(CPlayer *_player)
|
|
|
|
{
|
|
|
|
return _player->getPlayerPos();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-12 22:54:44 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerState::setPlayerPos(class CPlayer *_player,DVECTOR *_pos)
|
|
|
|
{
|
|
|
|
return _player->setPlayerPos(_pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-29 23:35:18 +01:00
|
|
|
int CPlayerState::getPadInputHeld(CPlayer *_player)
|
2001-01-19 23:54:48 +01:00
|
|
|
{
|
2001-01-29 23:35:18 +01:00
|
|
|
return _player->getPadInputHeld();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
int CPlayerState::getPadInputDown(CPlayer *_player)
|
|
|
|
{
|
|
|
|
return _player->getPadInputDown();
|
2001-01-19 23:54:48 +01:00
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-02-06 18:15:28 +01:00
|
|
|
int CPlayerState::isOnEdge(class CPlayer *_player)
|
|
|
|
{
|
|
|
|
return _player->isOnEdge();
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-02-06 18:15:28 +01:00
|
|
|
int CPlayerState::canMoveLeft(class CPlayer *_player)
|
2001-01-19 23:54:48 +01:00
|
|
|
{
|
2001-02-06 18:15:28 +01:00
|
|
|
return _player->canMoveLeft();
|
|
|
|
}
|
|
|
|
int CPlayerState::canMoveRight(class CPlayer *_player)
|
|
|
|
{
|
|
|
|
return _player->canMoveRight();
|
2001-01-19 23:54:48 +01:00
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-02-06 18:15:28 +01:00
|
|
|
void CPlayerState::moveLeft(CPlayer *_player)
|
|
|
|
{
|
|
|
|
_player->moveLeft();
|
|
|
|
}
|
2001-01-19 23:54:48 +01:00
|
|
|
void CPlayerState::moveRight(CPlayer *_player)
|
|
|
|
{
|
|
|
|
_player->moveRight();
|
|
|
|
}
|
|
|
|
void CPlayerState::slowdown(CPlayer *_player)
|
|
|
|
{
|
|
|
|
_player->slowdown();
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
void CPlayerState::jump(CPlayer *_player)
|
|
|
|
{
|
|
|
|
_player->jump();
|
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-19 23:54:48 +01:00
|
|
|
void CPlayerState::fall(CPlayer *_player)
|
|
|
|
{
|
|
|
|
_player->fall();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-12 18:55:01 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerState::respawn(CPlayer *_player)
|
|
|
|
{
|
|
|
|
_player->respawn();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-25 16:25:46 +01:00
|
|
|
/*===========================================================================
|
|
|
|
end */
|