This commit is contained in:
Paul 2001-01-22 20:58:36 +00:00
parent 97a30e89cd
commit 4498d072bf
2 changed files with 230 additions and 0 deletions

152
source/player/psduck.cpp Normal file
View File

@ -0,0 +1,152 @@
/*=========================================================================
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
#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 CPlayerStateDuck::enter(CPlayer *_player)
{
setAnimNo(_player,ANIM_PLAYER_ANIM_SOAKUP);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateDuck::think(CPlayer *_player)
{
slowdown(_player);
if(advanceAnimFrameAndCheckForEndOfAnim(_player))
{
setState(_player,STATE_SOAKUP);
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateSoakUp::enter(CPlayer *_player)
{
DVECTOR move;
move=getMoveVelocity(_player);
move.vx=0;
setMoveVelocity(_player,&move);
setAnimNo(_player,ANIM_PLAYER_ANIM_GETUP);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateSoakUp::think(CPlayer *_player)
{
int control;
control=getPadInput(_player);
if(!(control&CPadConfig::getButton(CPadConfig::PAD_CFG_DOWN)))
{
setState(_player,STATE_GETUP);
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateGetUp::enter(CPlayer *_player)
{
setAnimNo(_player,ANIM_PLAYER_ANIM_GETUP);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateGetUp::think(CPlayer *_player)
{
if(advanceAnimFrameAndCheckForEndOfAnim(_player))
{
setState(_player,STATE_IDLE);
}
}
/*===========================================================================
end */

78
source/player/psduck.h Normal file
View File

@ -0,0 +1,78 @@
/*=========================================================================
psduck.h
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __PLAYER_PSDUCK_H__
#define __PLAYER_PSDUCK_H__
/*----------------------------------------------------------------------
Includes
-------- */
#include "player\pstates.h"
/* Std Lib
------- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
class CPlayerStateDuck : public CPlayerState
{
public:
void enter(class CPlayer *_player);
void think(class CPlayer *_player);
};
class CPlayerStateSoakUp : public CPlayerState
{
public:
void enter(class CPlayer *_player);
void think(class CPlayer *_player);
};
class CPlayerStateGetUp : public CPlayerState
{
public:
void enter(class CPlayer *_player);
void think(class CPlayer *_player);
};
/*----------------------------------------------------------------------
Globals
------- */
/*----------------------------------------------------------------------
Functions
--------- */
/*---------------------------------------------------------------------- */
#endif /* __PLAYER_PSDUCK_H__ */
/*===========================================================================
end */