From 7515758decd0ac63feb05a95faacf8f796c95a68 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 24 Jan 2001 15:52:31 +0000 Subject: [PATCH] --- source/player/psidle.cpp | 111 +++++++++++++++++++++++++++++++++++++++ source/player/psidle.h | 60 +++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 source/player/psidle.cpp create mode 100644 source/player/psidle.h diff --git a/source/player/psidle.cpp b/source/player/psidle.cpp new file mode 100644 index 000000000..40e2ff565 --- /dev/null +++ b/source/player/psidle.cpp @@ -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 +#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 */ diff --git a/source/player/psidle.h b/source/player/psidle.h new file mode 100644 index 000000000..0233bb2e7 --- /dev/null +++ b/source/player/psidle.h @@ -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 */ + + +