2001-01-19 23:54:48 +01:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
psfall.cpp
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#include "player\psfall.h"
|
|
|
|
|
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __PAD_PADS_H__
|
|
|
|
#include "pad\pads.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
|
|
|
#ifndef __ANIM_PLAYER_ANIM_HEADER__
|
|
|
|
#include <player_anim.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerStateFall::enter(CPlayer *_player)
|
|
|
|
{
|
2001-01-25 16:25:46 +01:00
|
|
|
setAnimNo(_player,ANIM_PLAYER_ANIM_HOVER);
|
2001-01-19 23:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerStateFall::think(CPlayer *_player)
|
|
|
|
{
|
2001-01-22 23:58:12 +01:00
|
|
|
const PlayerMetrics *metrics;
|
2001-02-09 22:41:55 +01:00
|
|
|
int controlHeld,controlDown;
|
2001-01-22 23:58:12 +01:00
|
|
|
DVECTOR move;
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-01-22 22:02:59 +01:00
|
|
|
metrics=getPlayerMetrics(_player);
|
2001-01-29 23:35:18 +01:00
|
|
|
controlHeld=getPadInputHeld(_player);
|
2001-02-09 22:41:55 +01:00
|
|
|
controlDown=getPadInputDown(_player);
|
2001-01-19 23:54:48 +01:00
|
|
|
|
2001-02-09 18:01:04 +01:00
|
|
|
if(controlHeld&PI_LEFT)
|
2001-01-19 23:54:48 +01:00
|
|
|
{
|
|
|
|
moveLeft(_player);
|
|
|
|
}
|
2001-02-09 18:01:04 +01:00
|
|
|
else if(controlHeld&PI_RIGHT)
|
2001-01-19 23:54:48 +01:00
|
|
|
{
|
|
|
|
moveRight(_player);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
slowdown(_player);
|
|
|
|
}
|
|
|
|
|
2001-02-06 22:09:45 +01:00
|
|
|
fall(_player);
|
|
|
|
|
2001-02-09 22:41:55 +01:00
|
|
|
if(controlDown&PI_ACTION)
|
2001-01-25 16:25:46 +01:00
|
|
|
{
|
|
|
|
setState(_player,STATE_AIRATTACK);
|
|
|
|
}
|
2001-02-09 18:01:04 +01:00
|
|
|
else if(controlHeld&PI_DOWN)
|
2001-01-19 23:54:48 +01:00
|
|
|
{
|
2001-02-09 22:41:55 +01:00
|
|
|
if(setState(_player,STATE_BUTTBOUNCE))
|
|
|
|
{
|
|
|
|
// Only do this if this mode allows us to go into butt bounce, otherwise
|
|
|
|
// SB just floats in the air :)
|
|
|
|
move.vx=0;
|
|
|
|
move.vy=0;
|
|
|
|
setMoveVelocity(_player,&move);
|
|
|
|
}
|
2001-01-22 22:02:59 +01:00
|
|
|
}
|
2001-01-25 16:25:46 +01:00
|
|
|
advanceAnimFrameAndCheckForEndOfAnim(_player);
|
2001-01-22 22:02:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerStateFallFar::enter(CPlayer *_player)
|
|
|
|
{
|
|
|
|
setAnimNo(_player,ANIM_PLAYER_ANIM_FALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerStateFallFar::think(CPlayer *_player)
|
|
|
|
{
|
2001-01-29 23:35:18 +01:00
|
|
|
int controlHeld;
|
|
|
|
DVECTOR move;
|
2001-01-22 22:02:59 +01:00
|
|
|
|
2001-01-29 23:35:18 +01:00
|
|
|
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
|
|
|
|
{
|
|
|
|
slowdown(_player);
|
2001-01-19 23:54:48 +01:00
|
|
|
}
|
2001-02-06 22:09:45 +01:00
|
|
|
|
|
|
|
fall(_player);
|
2001-01-19 23:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|