This commit is contained in:
Paul 2001-01-24 15:52:31 +00:00
parent 2e5379f6f3
commit 7515758dec
2 changed files with 171 additions and 0 deletions

111
source/player/psidle.cpp Normal file
View File

@ -0,0 +1,111 @@
/*=========================================================================
psidle.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "player\psidle.h"
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
#ifndef __PAD_PADS_H__
#include "pad\pads.h"
#endif
#ifndef __UTILS_HEADER__
#include "utils\utils.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 CPlayerStateIdle::enter(CPlayer *_player)
{
setAnimNo(_player,ANIM_PLAYER_ANIM_IDLEGENERIC04);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateIdle::think(CPlayer *_player)
{
int control;
control=getPadInput(_player);
if(control&CPadConfig::getButton(CPadConfig::PAD_CFG_JUMP))
{
setState(_player,STATE_JUMP);
}
else if(control&(CPadConfig::getButton(CPadConfig::PAD_CFG_LEFT)|CPadConfig::getButton(CPadConfig::PAD_CFG_RIGHT)))
{
setState(_player,STATE_RUN);
}
else if(control&CPadConfig::getButton(CPadConfig::PAD_CFG_ACTION))
{
setState(_player,STATE_ATTACK);
}
else if(control&CPadConfig::getButton(CPadConfig::PAD_CFG_DOWN))
{
setState(_player,STATE_DUCK);
}
else if(advanceAnimFrameAndCheckForEndOfAnim(_player))
{
if(getRndRange(100)<95)
setAnimNo(_player,ANIM_PLAYER_ANIM_IDLEGENERIC04);
else
setAnimNo(_player,ANIM_PLAYER_ANIM_IDLEGENERIC03);
}
}
/*===========================================================================
end */

60
source/player/psidle.h Normal file
View File

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