SBSPSS/source/player/pschop.cpp

152 lines
2.8 KiB
C++
Raw Normal View History

2001-01-22 20:24:04 +01:00
/*=========================================================================
pschop.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "player\pschop.h"
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
/* Std Lib
------- */
/* Data
---- */
2001-02-26 21:05:31 +01:00
#ifndef __ANIM_SPONGEBOB_HEADER__
#include <ACTOR_SPONGEBOB_ANIM.h>
2001-01-22 20:24:04 +01:00
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateChop::enter(CPlayer *_player)
{
2001-02-26 21:05:31 +01:00
setAnimNo(_player,ANIM_SPONGEBOB_KARATE);
2001-01-22 20:24:04 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateChop::think(CPlayer *_player)
{
if(advanceAnimFrameAndCheckForEndOfAnim(_player))
{
setState(_player,STATE_IDLE);
}
}
2001-01-22 22:02:59 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateRunChop::think(CPlayer *_player)
{
2001-01-29 23:35:18 +01:00
int controlHeld;
controlHeld=getPadInputHeld(_player);
2001-01-22 22:02:59 +01:00
2001-02-09 18:01:04 +01:00
if(controlHeld&PI_LEFT)
2001-01-22 22:02:59 +01:00
{
moveLeft(_player);
}
2001-02-09 18:01:04 +01:00
else if(controlHeld&PI_RIGHT)
2001-01-22 22:02:59 +01:00
{
moveRight(_player);
}
else
{
2001-01-22 23:58:12 +01:00
slowdown(_player);
}
if(advanceAnimFrameAndCheckForEndOfAnim(_player))
{
if(getMoveVelocity(_player).vx==0)
2001-01-22 22:02:59 +01:00
{
setState(_player,STATE_IDLE);
}
else
{
2001-01-22 23:58:12 +01:00
setState(_player,STATE_RUN);
2001-01-22 22:02:59 +01:00
}
}
}
2001-01-25 16:25:46 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateAirChop::think(CPlayer *_player)
{
2001-01-29 23:35:18 +01:00
int controlHeld;
controlHeld=getPadInputHeld(_player);
2001-01-25 16:25:46 +01:00
2001-02-09 18:01:04 +01:00
if(controlHeld&PI_LEFT)
2001-01-25 16:25:46 +01:00
{
moveLeft(_player);
}
2001-02-09 18:01:04 +01:00
else if(controlHeld&PI_RIGHT)
2001-01-25 16:25:46 +01:00
{
moveRight(_player);
}
else
{
slowdown(_player);
}
if(advanceAnimFrameAndCheckForEndOfAnim(_player))
{
setState(_player,STATE_FALL);
}
}
2001-01-22 20:24:04 +01:00
/*===========================================================================
end */